mirror of
https://github.com/JuliaFEM/JuliaFEM.jl.git
synced 2026-09-18 01:31:31 +00:00
unfinished notebooks
This commit is contained in:
+18
-1
@@ -1,5 +1,22 @@
|
||||
Delaynay triangulation
|
||||
Discretization
|
||||
==============
|
||||
|
||||
http://code.activestate.com/recipes/579021-delaunay-triangulation/
|
||||
|
||||
|
||||
Interpolation
|
||||
=============
|
||||
|
||||
- http://www.cs.rpi.edu/~flaherje/pdf/fea4.pdf
|
||||
- http://www.sd.ruhr-uni-bochum.de/downloads/Shape_funct.pdf
|
||||
- http://what-when-how.com/the-finite-element-method/fem-for-3d-solids-finite-element-method-part-1/
|
||||
- http://www.uni-tuebingen.de/zag/teaching/environmental_modeling/S4B_FiniteElements.pdf
|
||||
- http://www.colorado.edu/engineering/CAS/courses.d/AFEM.d/AFEM.Ch10.d/AFEM.Ch10.pdf
|
||||
- http://www.colorado.edu/engineering/CAS/courses.d/AFEM.d/AFEM.Ch10.d/AFEM.Ch10.Slides.d/AFEM.Ch10.Slides.pdf
|
||||
- http://www.colorado.edu/engineering/CAS/courses.d/AFEM.d/AFEM.AppI.d/AFEM.AppI.pdf
|
||||
- http://www.code-aster.org/V2/doc/default/en/man_r/r3/r3.01.01.pdf
|
||||
- http://www.researchgate.net/publication/267082822_Unified_isoparametric_3D_Lagrange_finite_elements
|
||||
|
||||
Integration
|
||||
===========
|
||||
- http://arxiv.org/pdf/1411.1341.pdf
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"# Elasticity solver example\n",
|
||||
"# Elasticity solver examples\n",
|
||||
"\n",
|
||||
"Author(s): Jukka Aho <jukka.aho@kapsi.fi>"
|
||||
]
|
||||
@@ -13,18 +13,48 @@
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"metadata": {
|
||||
"collapsed": true
|
||||
"collapsed": false
|
||||
},
|
||||
"outputs": [],
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stderr",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"\n",
|
||||
"WARNING: deprecated syntax \"{a=>b, ...}\" at /Users/jukka/.julia/v0.4/JuliaFEM/src/abaqus_reader.jl:29.\n",
|
||||
"Use \"Dict{Any,Any}(a=>b, ...)\" instead.\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"Logger(root,DEBUG,Pipe(open, 0 bytes waiting),root)"
|
||||
]
|
||||
},
|
||||
"execution_count": 1,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"# These are internal module functions and not intended to use like this.\n",
|
||||
"using JuliaFEM.elasticity_solver: solve_elasticity_increment!\n",
|
||||
"using JuliaFEM.xdmf: xdmf_new_model, xdmf_new_grid, xdmf_new_temporal_collection, xdmf_new_mesh, xdmf_new_field"
|
||||
"using JuliaFEM.elasticity_solver\n",
|
||||
"using JuliaFEM.xdmf\n",
|
||||
"using JuliaFEM.abaqus_reader\n",
|
||||
"using Logging\n",
|
||||
"Logging.configure(level=DEBUG)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## 2d beam with linear elements"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 3,
|
||||
"execution_count": 2,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
@@ -44,7 +74,7 @@
|
||||
" 0.0 -2.17799 -2.22224 0.0"
|
||||
]
|
||||
},
|
||||
"execution_count": 3,
|
||||
"execution_count": 2,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
@@ -90,7 +120,7 @@
|
||||
" la, mu, N, dNdξ, ipoints, iweights) = one_elem_fixture()\n",
|
||||
" \n",
|
||||
"for i=1:10\n",
|
||||
" solve_elasticity_increment!(X, u, du, elmap, nodalloads, dirichletbc,\n",
|
||||
" JuliaFEM.elasticity_solver.solve_elasticity_increment!(X, u, du, elmap, nodalloads, dirichletbc,\n",
|
||||
" la, mu, N, dNdξ, ipoints, iweights)\n",
|
||||
" u += du\n",
|
||||
" if norm(du) < 1.0e-9\n",
|
||||
@@ -104,36 +134,20 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 20,
|
||||
"execution_count": 3,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"5x1 Array{Int64,2}:\n",
|
||||
" 5\n",
|
||||
" 1\n",
|
||||
" 2\n",
|
||||
" 3\n",
|
||||
" 4"
|
||||
]
|
||||
},
|
||||
"execution_count": 20,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"u3d = [u; 0 0 0 0] # extend to 3d vector field\n",
|
||||
"X3d = [X; 0 0 0 0]\n",
|
||||
"elmap2 = [0x5; elmap]''"
|
||||
"elmap2 = [0x5; elmap]'';"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 21,
|
||||
"execution_count": 4,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
@@ -165,38 +179,48 @@
|
||||
"</Xdmf>\n",
|
||||
"\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"xdoc, model = xdmf_new_model()\n",
|
||||
"temporal_collection = xdmf_new_temporal_collection(model)\n",
|
||||
"grid = xdmf_new_grid(temporal_collection; time=0)\n",
|
||||
"xdmf_new_mesh(grid, X3d, elmap2)\n",
|
||||
"xdmf_new_field(grid, \"Displacement\", \"nodes\", u3d)\n",
|
||||
"print(xdoc)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 22,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"outputs": [
|
||||
},
|
||||
{
|
||||
"name": "stderr",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"WARNING: int(x) is deprecated, use Int(x) instead.\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"1015"
|
||||
]
|
||||
},
|
||||
"execution_count": 22,
|
||||
"execution_count": 4,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
},
|
||||
{
|
||||
"name": "stderr",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
" in depwarn at /Applications/Julia-0.4.0-dev-539c818c4e.app/Contents/Resources/julia/lib/julia/sys.dylib\n",
|
||||
" in int at deprecated.jl:49\n",
|
||||
" in save_file at /Users/jukka/.julia/v0.4/LightXML/src/document.jl:108\n",
|
||||
" in xdmf_save_model at /Users/jukka/.julia/v0.4/JuliaFEM/src/xdmf.jl:106\n",
|
||||
" in include_string at loading.jl:99\n",
|
||||
" in execute_request_0x535c5df2 at /Users/jukka/.julia/v0.4/IJulia/src/execute_request.jl:157\n",
|
||||
" in eventloop at /Users/jukka/.julia/v0.4/IJulia/src/IJulia.jl:123\n",
|
||||
" in anonymous at task.jl:365\n",
|
||||
"while loading In[4], in expression starting on line 7\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"using LightXML\n",
|
||||
"save_file(xdoc, \"/tmp/foo.xmf\")"
|
||||
"xdoc, model = JuliaFEM.xdmf.xdmf_new_model()\n",
|
||||
"temporal_collection = JuliaFEM.xdmf.xdmf_new_temporal_collection(model)\n",
|
||||
"grid = JuliaFEM.xdmf.xdmf_new_grid(temporal_collection; time=0)\n",
|
||||
"JuliaFEM.xdmf.xdmf_new_mesh(grid, X3d, elmap2)\n",
|
||||
"JuliaFEM.xdmf.xdmf_new_field(grid, \"Displacement\", \"nodes\", u3d)\n",
|
||||
"print(xdoc)\n",
|
||||
"JuliaFEM.xdmf.xdmf_save_model(xdoc, \"/tmp/foo.xmf\")"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -227,13 +251,395 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"cell_type": "markdown",
|
||||
"metadata": {
|
||||
"collapsed": true
|
||||
},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
"source": [
|
||||
"## 3d beam with quadratic elements"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 5,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stderr",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"25-Jun 20:00:29:INFO:root:Registered handlers: Any[\"ELEMENT\",\"NODE\",\"NSET\"]\n",
|
||||
"WARNING: beginswith is deprecated, use startswith instead.\n",
|
||||
" in depwarn at /Applications/Julia-0.4.0-dev-539c818c4e.app/Contents/Resources/julia/lib/julia/sys.dylib\n",
|
||||
" in beginswith at deprecated.jl:30\n",
|
||||
" in parse_abaqus at /Users/jukka/.julia/v0.4/JuliaFEM/src/abaqus_reader.jl:110\n",
|
||||
" in include_string at loading.jl:99\n",
|
||||
" in execute_request_0x535c5df2 at /Users/jukka/.julia/v0.4/IJulia/src/execute_request.jl:157\n",
|
||||
" in eventloop at /Users/jukka/.julia/v0.4/IJulia/src/IJulia.jl:123\n",
|
||||
" in anonymous at task.jl:365\n",
|
||||
"while loading In[5], in expression starting on line 2\n",
|
||||
"WARNING: beginswith is deprecated, use startswith instead.\n",
|
||||
" in depwarn at /Applications/Julia-0.4.0-dev-539c818c4e.app/Contents/Resources/julia/lib/julia/sys.dylib\n",
|
||||
" in beginswith at deprecated.jl:30\n",
|
||||
" in parse_abaqus at /Users/jukka/.julia/v0.4/JuliaFEM/src/abaqus_reader.jl:110\n",
|
||||
" in include_string at loading.jl:99\n",
|
||||
" in execute_request_0x535c5df2 at /Users/jukka/.julia/v0.4/IJulia/src/execute_request.jl:157\n",
|
||||
" in eventloop at /Users/jukka/.julia/v0.4/IJulia/src/IJulia.jl:123\n",
|
||||
" in anonymous at task.jl:365\n",
|
||||
"while loading In[5], in expression starting on line 2\n",
|
||||
"25-Jun 20:00:30:DEBUG:root:Found NODE section\n",
|
||||
"25-Jun 20:00:30:DEBUG:root:Found ELEMENT section\n",
|
||||
"WARNING: integer(s::AbstractString) is deprecated, use parse(Int,s) instead.\n",
|
||||
" in depwarn at /Applications/Julia-0.4.0-dev-539c818c4e.app/Contents/Resources/julia/lib/julia/sys.dylib\n",
|
||||
" in integer at deprecated.jl:49\n",
|
||||
" in map at abstractarray.jl:1251\n",
|
||||
" in parse_element_section at /Users/jukka/.julia/v0.4/JuliaFEM/src/abaqus_reader.jl:56\n",
|
||||
" in process_section at /Users/jukka/.julia/v0.4/JuliaFEM/src/abaqus_reader.jl:105\n",
|
||||
" in parse_abaqus at /Users/jukka/.julia/v0.4/JuliaFEM/src/abaqus_reader.jl:114\n",
|
||||
" in include_string at loading.jl:99\n",
|
||||
" in execute_request_0x535c5df2 at /Users/jukka/.julia/v0.4/IJulia/src/execute_request.jl:157\n",
|
||||
" in eventloop at /Users/jukka/.julia/v0.4/IJulia/src/IJulia.jl:123\n",
|
||||
" in anonymous at task.jl:365\n",
|
||||
"while loading In[5], in expression starting on line 2\n",
|
||||
"25-Jun 20:00:31:DEBUG:root:120 elements found\n",
|
||||
"25-Jun 20:00:31:INFO:root:Creating ELSET Body1\n",
|
||||
"25-Jun 20:00:31:DEBUG:root:Found NSET section\n",
|
||||
"25-Jun 20:00:31:DEBUG:root:Creating node set SUPPORT\n",
|
||||
"25-Jun 20:00:31:DEBUG:root:Found NSET section\n",
|
||||
"25-Jun 20:00:31:DEBUG:root:Creating node set LOAD\n",
|
||||
"25-Jun 20:00:31:DEBUG:root:Found NSET section\n",
|
||||
"25-Jun 20:00:31:DEBUG:root:Creating node set TOP\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"Dict{Any,Any} with 4 entries:\n",
|
||||
" \"nodes\" => Dict{Any,Any}(288=>[97.5,7.5,10.0],11=>[92.5,2.5,5.0],134=>[45.…\n",
|
||||
" \"elements\" => Dict{Any,Any}(68=>[71,144,149,198,51,150,57,43,50,214],2=>[204,…\n",
|
||||
" \"elsets\" => Dict{Any,Any}(\"Body1\"=>[1,2,3,4,5,6,7,8,9,10 … 111,112,113,11…\n",
|
||||
" \"nsets\" => Dict{Any,Any}(\"LOAD\"=>[82,84,87,179,197,246,249,256,257],\"SUPPO…"
|
||||
]
|
||||
},
|
||||
"execution_count": 5,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"fid = open(\"../geometry/3d_beam/palkki.inp\")\n",
|
||||
"model = JuliaFEM.abaqus_reader.parse_abaqus(fid)\n",
|
||||
"close(fid)\n",
|
||||
"model"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 30,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"10x120 Array{Int64,2}:\n",
|
||||
" 47 56 91 87 72 72 176 290 … 260 165 101 18 271 72 24\n",
|
||||
" 173 236 176 45 97 253 173 22 236 181 261 201 211 146 166\n",
|
||||
" 76 97 139 49 253 158 76 252 202 87 19 71 18 289 196\n",
|
||||
" 202 111 242 290 289 289 47 49 254 290 254 255 277 29 133\n",
|
||||
" 156 10 120 53 74 169 144 127 114 95 75 2 100 67 135\n",
|
||||
" 88 214 266 291 270 118 88 70 … 14 185 104 235 257 180 198\n",
|
||||
" 16 89 179 40 169 209 44 17 103 68 215 12 212 200 65\n",
|
||||
" 134 278 199 4 200 200 34 177 147 163 145 121 170 167 92\n",
|
||||
" 32 187 221 243 210 37 156 240 195 7 117 80 9 48 52\n",
|
||||
" 132 15 265 177 37 233 16 268 79 4 263 168 208 57 150"
|
||||
]
|
||||
},
|
||||
"execution_count": 30,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"nnodes = length(model[\"nodes\"])\n",
|
||||
"nelements = length(model[\"elements\"])\n",
|
||||
"dim = 3\n",
|
||||
"E = 90\n",
|
||||
"nu = 0.25\n",
|
||||
"mu = E/(2*(1+nu))\n",
|
||||
"la = E*nu/((1+nu)*(1-2*nu))\n",
|
||||
"\n",
|
||||
"X = zeros(dim, nnodes)\n",
|
||||
"u = zeros(dim, nnodes)\n",
|
||||
"du = zeros(dim, nnodes)\n",
|
||||
"elmap = zeros(Int, 10, nelements)\n",
|
||||
"nodalloads = zeros(3, nnodes)\n",
|
||||
"dirichletbc = NaN*ones(3, nnodes)\n",
|
||||
"la = la*ones(1, nnodes)\n",
|
||||
"mu = mu*ones(1, nnodes)\n",
|
||||
"\n",
|
||||
"# calculate permutation which maps node ids to matrix indices\n",
|
||||
"perm = Dict()\n",
|
||||
"for (j, k) in enumerate(keys(model[\"nodes\"]))\n",
|
||||
" perm[k] = j\n",
|
||||
"end\n",
|
||||
"\n",
|
||||
"for j=1:nnodes\n",
|
||||
" X[:,j] = model[\"nodes\"][perm[j]]\n",
|
||||
"end\n",
|
||||
"\n",
|
||||
"for (j, k) in enumerate(keys(model[\"elements\"]))\n",
|
||||
" node_ids = model[\"elements\"][k]\n",
|
||||
" for l=1:10\n",
|
||||
" elmap[l, j] = perm[node_ids[l]]\n",
|
||||
" end\n",
|
||||
"end\n",
|
||||
"\n",
|
||||
"elmap"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 18,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"3x298 Array{Float64,2}:\n",
|
||||
" NaN NaN NaN NaN NaN NaN NaN NaN … NaN NaN NaN NaN NaN NaN NaN\n",
|
||||
" NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN\n",
|
||||
" NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN"
|
||||
]
|
||||
},
|
||||
"execution_count": 18,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"# Handle dirichlet boundaries on SUPPORT\n",
|
||||
"for j in model[\"nsets\"][\"SUPPORT\"]\n",
|
||||
" dirichletbc[perm[j]] = 0.0\n",
|
||||
"end\n",
|
||||
"dirichletbc"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"Shape functions and integration points"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 21,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"dNtet (generic function with 1 method)"
|
||||
]
|
||||
},
|
||||
"execution_count": 21,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"Ntet(xi) = [ -xi[1] - xi[2] - xi[3] + 1\n",
|
||||
" xi[1]\n",
|
||||
" xi[2]\n",
|
||||
" xi[3]\n",
|
||||
" 4*xi[1]*(-xi[1] - xi[2] - xi[3] + 1)\n",
|
||||
" 4*xi[1]*xi[2]\n",
|
||||
" 4*xi[2]*(-xi[1] - xi[2] - xi[3] + 1)\n",
|
||||
" 4*xi[3]*(-xi[1] - xi[2] - xi[3] + 1)\n",
|
||||
" 4*xi[1]*xi[3]\n",
|
||||
" 4*xi[2]*xi[3]]\n",
|
||||
"\n",
|
||||
"dNtet(xi) = [\n",
|
||||
" -1 -1 -1\n",
|
||||
" 1 0 0\n",
|
||||
" 0 1 0\n",
|
||||
" 0 0 1\n",
|
||||
"-8*xi[1] - 4*xi[2] - 4*xi[3] + 4 -4*xi[1] -4*xi[1]\n",
|
||||
" 4*xi[2] 4*xi[1] 0\n",
|
||||
" -4*xi[2] -4*xi[1] - 8*xi[2] - 4*xi[3] + 4 -4*xi[2]\n",
|
||||
" -4*xi[3] -4*xi[3] -4*xi[1] - 4*xi[2] - 8*xi[3] + 4\n",
|
||||
" 4*xi[3] 0 4*xi[1]\n",
|
||||
" 0 4*xi[3] 4*xi[2]]"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 24,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"10x3 Array{Int64,2}:\n",
|
||||
" -1 -1 -1\n",
|
||||
" 1 0 0\n",
|
||||
" 0 1 0\n",
|
||||
" 0 0 1\n",
|
||||
" -4 0 0\n",
|
||||
" 4 0 0\n",
|
||||
" -4 -8 -4\n",
|
||||
" -4 -4 -8\n",
|
||||
" 4 0 0\n",
|
||||
" 0 4 4"
|
||||
]
|
||||
},
|
||||
"execution_count": 24,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"dNtet([0, 1, 1])"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 25,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"1x4 Array{Float64,2}:\n",
|
||||
" 0.0416667 0.0416667 0.0416667 0.0416667"
|
||||
]
|
||||
},
|
||||
"execution_count": 25,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"# from code aster documentation\n",
|
||||
"a = 1/20*(5-sqrt(5))\n",
|
||||
"b = 1/20*(5+3*sqrt(5))\n",
|
||||
"ipoints = [a a a; a a b; a b a; b a a]\n",
|
||||
"iweights = 1/24*[1 1 1 1]"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"Add point force to LOAD nodeset"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 33,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"9-element Array{Int64,1}:\n",
|
||||
" 82\n",
|
||||
" 84\n",
|
||||
" 87\n",
|
||||
" 179\n",
|
||||
" 197\n",
|
||||
" 246\n",
|
||||
" 249\n",
|
||||
" 256\n",
|
||||
" 257"
|
||||
]
|
||||
},
|
||||
"execution_count": 33,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"model[\"nsets\"][\"LOAD\"]"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 40,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"[95.0,10.0,5.0]\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"nodalloads[3, perm[82]] = -0.0001\n",
|
||||
"println(model[\"nodes\"][83])"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 39,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"3x298 Array{Float64,2}:\n",
|
||||
" -76167.8 -73.0493 … 5.19615e7 -43075.8 \n",
|
||||
" -7.72988e5 6.45188e5 8.51808e7 559158.0 \n",
|
||||
" 1.26765e6 -74404.1 -2.43735e7 6.01587e5"
|
||||
]
|
||||
},
|
||||
"execution_count": 39,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"u = zeros(dim, nnodes)\n",
|
||||
"du = zeros(dim, nnodes)\n",
|
||||
"\n",
|
||||
"for i=1:10\n",
|
||||
" JuliaFEM.elasticity_solver.solve_elasticity_increment!(X, u, du, elmap, nodalloads, dirichletbc,\n",
|
||||
" la, mu, Ntet, dNtet, ipoints, iweights)\n",
|
||||
" u += du\n",
|
||||
" if norm(du) < 1.0e-9\n",
|
||||
" println(\"Converged\")\n",
|
||||
" break\n",
|
||||
" end\n",
|
||||
"end\n",
|
||||
"u"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"Not converging."
|
||||
]
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
|
||||
@@ -0,0 +1,136 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"metadata": {
|
||||
"collapsed": true
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"from sympy import *"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
"metadata": {
|
||||
"collapsed": true
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"xi = DeferredVector(\"xi\")"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 9,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"Matrix([\n",
|
||||
"[ -xi[1] - xi[2] - xi[3] + 1],\n",
|
||||
"[ xi[1]],\n",
|
||||
"[ xi[2]],\n",
|
||||
"[ xi[3]],\n",
|
||||
"[4*xi[1]*(-xi[1] - xi[2] - xi[3] + 1)],\n",
|
||||
"[ 4*xi[1]*xi[2]],\n",
|
||||
"[4*xi[2]*(-xi[1] - xi[2] - xi[3] + 1)],\n",
|
||||
"[4*xi[3]*(-xi[1] - xi[2] - xi[3] + 1)],\n",
|
||||
"[ 4*xi[1]*xi[3]],\n",
|
||||
"[ 4*xi[2]*xi[3]]])"
|
||||
]
|
||||
},
|
||||
"execution_count": 9,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"def c3d10():\n",
|
||||
" N1 = 1 - xi[1] - xi[2] - xi[3]\n",
|
||||
" N2 = xi[1]\n",
|
||||
" N3 = xi[2]\n",
|
||||
" N4 = xi[3]\n",
|
||||
" N5 = 4*xi[1]*(1-xi[1]-xi[2]-xi[3])\n",
|
||||
" N6 = 4*xi[1]*xi[2]\n",
|
||||
" N7 = 4*xi[2]*(1-xi[1]-xi[2]-xi[3])\n",
|
||||
" N8 = 4*xi[3]*(1-xi[1]-xi[2]-xi[3])\n",
|
||||
" N9 = 4*xi[1]*xi[3]\n",
|
||||
" N10 = 4*xi[2]*xi[3]\n",
|
||||
" N = Matrix([N1, N2, N3, N4, N5, N6, N7, N8, N9, N10])\n",
|
||||
" dN = Matrix([N.diff(xi[1]).T, N.diff(xi[2]).T, N.diff(xi[3]).T]).T\n",
|
||||
" return N, dN\n",
|
||||
"\n",
|
||||
"N, dN = c3d10()\n",
|
||||
"N"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 10,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"Matrix([\n",
|
||||
"[ -1, -1, -1],\n",
|
||||
"[ 1, 0, 0],\n",
|
||||
"[ 0, 1, 0],\n",
|
||||
"[ 0, 0, 1],\n",
|
||||
"[-8*xi[1] - 4*xi[2] - 4*xi[3] + 4, -4*xi[1], -4*xi[1]],\n",
|
||||
"[ 4*xi[2], 4*xi[1], 0],\n",
|
||||
"[ -4*xi[2], -4*xi[1] - 8*xi[2] - 4*xi[3] + 4, -4*xi[2]],\n",
|
||||
"[ -4*xi[3], -4*xi[3], -4*xi[1] - 4*xi[2] - 8*xi[3] + 4],\n",
|
||||
"[ 4*xi[3], 0, 4*xi[1]],\n",
|
||||
"[ 0, 4*xi[3], 4*xi[2]]])"
|
||||
]
|
||||
},
|
||||
"execution_count": 10,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"dN"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"collapsed": true
|
||||
},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Python 2",
|
||||
"language": "python",
|
||||
"name": "python2"
|
||||
},
|
||||
"language_info": {
|
||||
"codemirror_mode": {
|
||||
"name": "ipython",
|
||||
"version": 2
|
||||
},
|
||||
"file_extension": ".py",
|
||||
"mimetype": "text/x-python",
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython2",
|
||||
"version": "2.7.9"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 0
|
||||
}
|
||||
Reference in New Issue
Block a user