Newer
Older
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# MetaVoxel Tutorial"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"# Amira Abdel-Rahman\n",
"# (c) Massachusetts Institute of Technology 2020\n",
"\n",
"# tested using julia 1.5.2 and windows Nvidia geforce gtx 1070 Ti"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Import Julia Libraries"
]
},
{
"cell_type": "code",
"source": [
"using LinearAlgebra\n",
"import JSON\n",
"using StaticArrays, BenchmarkTools\n",
"using Base.Threads\n",
"import Base: +, * , -, ^"
]
},
{
"cell_type": "code",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"axialStrain (generic function with 1 method)"
]
},
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"include(\"./julia/include/vector.jl\") #utils for vectors and quaternions\n",
"include(\"./julia/include/material.jl\") #utils for node and edge material\n",
"include(\"./julia/include/export.jl\") #export simulation data to json\n",
"include(\"./julia/include/run.jl\") #turn setup to cuda arrays and run simulation\n",
"include(\"./julia/include/updateEdges.jl\") #edges properties update\n",
"include(\"./julia/include/externalForces.jl\") #external forces applied to the system\n",
"include(\"./julia/include/forces.jl\") #force integration\n",
"include(\"./julia/include/updateNodes.jl\") #nodes properties update"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## 1. Voxel Design"
]
},
{
"cell_type": "code",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"\"tutorial\""
]
},
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# set name for simulation\n",
"name= \"tutorial\""
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### 1.a. Import lines from Rhino (.3dm)"
]
},
{
"cell_type": "code",
"metadata": {},
"outputs": [],
"source": [
"rhino=true\n",
"\n",
"setup = Dict()\n",
"\n",
"setup[\"rhino\"]=rhino\n",
"setup[\"rhinoFileName\"]=\"./julia/examples/trial.3dm\";\n",
"setup[\"layerIndex\"]=\"1\"; #layer index to import, only lines from these layer will get imported\n",
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
"\n",
"# make sure to divide curves into smaller lines, it will only add nodes at the start and end of each line/curve\n",
"\n",
"voxelSize=75 #in case you want to array the base rhino curve, what is the size of the voxel\n",
"latticeSizeX=2 # if you don't want to copy/array make this 1\n",
"latticeSizeY=2 # if you don't want to copy/array make this 1\n",
"latticeSizeZ=2 # if you don't want to copy/array make this 1\n",
"\n",
"setup[\"latticeSizeX\"]=latticeSizeX\n",
"setup[\"latticeSizeY\"]=latticeSizeY\n",
"setup[\"latticeSizeZ\"]=latticeSizeZ\n",
"\n",
"gridSize=10 #lattice size\n",
"setup[\"gridSize\"]=gridSize\n",
"\n",
"#scaling params\n",
"setup[\"voxelSize\"]=voxelSize; #voxel size\n",
"setup[\"scale\"]=1e4; #scale for visualization\n",
"setup[\"hierarchical\"]=false; #hierachical simualtion\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### 1.b Draw Lattice"
]
},
{
"cell_type": "code",
"metadata": {},
"outputs": [],
"source": [
"rhino=false\n",
"\n",
"voxelSize=0.001\n",
"latticeSizeX=7\n",
"latticeSizeY=2\n",
"latticeSizeZ=2\n",
"\n",
"gridSize=10\n",
"\n",
"setup = Dict()\n",
"setup[\"gridSize\"]=gridSize\n",
"\n",
"setup[\"rhino\"]=false\n",
"\n",
"setup[\"latticeSizeX\"]=latticeSizeX\n",
"setup[\"latticeSizeY\"]=latticeSizeY\n",
"setup[\"latticeSizeZ\"]=latticeSizeZ\n",
"\n",
"#scaling params\n",
"setup[\"voxelSize\"]=voxelSize; #voxel size\n",
"setup[\"scale\"]=1e4; #scale for visualization\n",
"setup[\"hierarchical\"]=true; #hierachical simualtion \n",
"# if setup[\"hierarchical\"] is true it will assume each voxel is one node, \n",
"# else it will assume each voxel is a detailed cuboct"
]
},
Loading
Loading full blame...