Skip to content
Snippets Groups Projects
nonLinearTest.jl 4.27 KiB
Newer Older
# Amira Abdel-Rahman
# (c) Massachusetts Institute of Technology 2020

######################### 1. Voxel Design ###########################
setup = Dict()

### 1.b Draw Lattice

rhino=false

voxelSize=0.001
Amira Abdel-Rahman's avatar
Amira Abdel-Rahman committed
latticeSizeX=10
latticeSizeY=5
latticeSizeZ=5

gridSize=10

setup["gridSize"]=gridSize

setup["rhino"]=false
setup["useVoxelList"]=false


setup["latticeSizeX"]=latticeSizeX
setup["latticeSizeY"]=latticeSizeY
setup["latticeSizeZ"]=latticeSizeZ

######################### 2. Boundary Conditions #########################

######################### 2.a. Global Settings #########################

#scaling params
setup["voxelSize"]=voxelSize; #voxel size
setup["scale"]=1e4; #scale for visualization
setup["hierarchical"]=true; #hierachical simualtion


#simulation params
Amira Abdel-Rahman's avatar
Amira Abdel-Rahman committed
setup["numTimeSteps"]=30000; #num of saved timesteps for simulation
Amira Abdel-Rahman's avatar
Amira Abdel-Rahman committed
setup["poisson"]=true; # account for poisson ration (only for hierarchical)
setup["linear"]=false; # linear vs non-linear
setup["thermal"]=false; #if there is change in temperature
setup["globalDamping"]=0.2; # (usually from 0.1 to 0.4)


#visualization params
Amira Abdel-Rahman's avatar
Amira Abdel-Rahman committed
setup["maxNumFiles"]=200; #num of saved timesteps for visualization


######################### 2.b. Materials #########################

#default material
material1= Dict()
material1["area"]=voxelSize*voxelSize
material1["density"]=1e3
material1["stiffness"]=1e6
material1["poissonRatio"]=0.3
material1["cTE"]=0.0 #coefficient of thermal expansion

#large bounding box for default material
boundingBoxMaterial1=Dict()
boundingBoxMaterial1["min"]=Dict()
boundingBoxMaterial1["max"]=Dict()

boundingBoxMaterial1["min"]["x"]=-voxelSize*gridSize;
boundingBoxMaterial1["min"]["y"]=-voxelSize*gridSize;
boundingBoxMaterial1["min"]["z"]=-voxelSize*gridSize;

boundingBoxMaterial1["max"]["x"]= voxelSize*gridSize;
boundingBoxMaterial1["max"]["y"]= voxelSize*gridSize;
boundingBoxMaterial1["max"]["z"]= voxelSize*gridSize;



setup["materials"]=[
    [boundingBoxMaterial1,material1]
    ];

######################### 2.c. Supports #########################

#x,y,z,rx,ry,rz (default is pinned joing i.e [false,false,false,true,true,true])
dof=[true,true,true,true,true,true]

boundingBoxSupport1=Dict()
boundingBoxSupport1["min"]=Dict()
boundingBoxSupport1["max"]=Dict()


boundingBoxSupport1["min"]["x"]= 0;
boundingBoxSupport1["min"]["y"]= 0;
boundingBoxSupport1["min"]["z"]= 0;

boundingBoxSupport1["max"]["x"]= voxelSize;
boundingBoxSupport1["max"]["y"]= voxelSize*(latticeSizeY);
boundingBoxSupport1["max"]["z"]= voxelSize*(latticeSizeZ);

setup["supports"]=[
Amira Abdel-Rahman's avatar
Amira Abdel-Rahman committed
        # [boundingBoxSupport1,dof]
    ];

######################### 2.d. Loads #########################
#### 2.d.1 Static Loads
load1=Dict()
Amira Abdel-Rahman's avatar
Amira Abdel-Rahman committed
load1["x"]=0.05
load1["y"]=0.0
load1["z"]=0.0

Amira Abdel-Rahman's avatar
Amira Abdel-Rahman committed
load2=Dict()
load2["x"]=-0.05
load2["y"]=0.0
load2["z"]=0.0

boundingBoxLoad1=Dict()
boundingBoxLoad1["min"]=Dict()
boundingBoxLoad1["max"]=Dict()

boundingBoxLoad1["min"]["x"]=voxelSize*(latticeSizeX-1);
boundingBoxLoad1["min"]["y"]=0;
boundingBoxLoad1["min"]["z"]=0;

boundingBoxLoad1["max"]["x"]=voxelSize*(latticeSizeX);
boundingBoxLoad1["max"]["y"]=voxelSize*(latticeSizeY);
boundingBoxLoad1["max"]["z"]=voxelSize*(latticeSizeZ);


setup["loads"]=[
Amira Abdel-Rahman's avatar
Amira Abdel-Rahman committed
        [boundingBoxLoad1,load1],
        [boundingBoxSupport1,load2]

fixedD=Dict()
Amira Abdel-Rahman's avatar
Amira Abdel-Rahman committed
fixedD["x"]=voxelSize*0.0002
fixedD["y"]=0.0
fixedD["z"]=0.0
Amira Abdel-Rahman's avatar
Amira Abdel-Rahman committed

fixedD1=Dict()
fixedD1["x"]=-voxelSize*0.0002
fixedD1["y"]=0.0
fixedD1["z"]=0.0
setup["fixedDisplacements"]=[
Amira Abdel-Rahman's avatar
Amira Abdel-Rahman committed
    # [boundingBoxLoad1,fixedD],
    # [boundingBoxSupport1,fixedD1]

#### 2.d.2 Dynamic Loads
function floorEnabled()
    return false
end

function gravityEnabled()
    return false
end

function externalDisplacement(currentTimeStep,N_position,N_fixedDisplacement)
    return N_fixedDisplacement
Amira Abdel-Rahman's avatar
Amira Abdel-Rahman committed
    
Amira Abdel-Rahman's avatar
Amira Abdel-Rahman committed
# function externalForce(currentTimeStep,N_position,N_force)
#     if currentTimeStep>100000
#     # if currentTimeStep>100&&currentTimeStep<200
#         return return Vector3(0,0,0)
#     else
#         return N_force
#     end
# end

function externalForce(currentTimeStep,N_position,N_force)
Amira Abdel-Rahman's avatar
Amira Abdel-Rahman committed
    factor=currentTimeStep/2000
    return Vector3(N_force.x*factor,N_force.y*factor,N_force.z*factor)

end

function updateTemperature(currentRestLength,currentTimeStep,mat)
    return currentRestLength
end


###########################################################################