updated notebook

This commit is contained in:
Jukka Aho
2015-12-14 17:49:36 +02:00
parent a3f84b7292
commit 0679edaad6
+123 -143
View File
@@ -15,8 +15,18 @@
"source": [
"## Solid block\n",
"\n",
"<img src=\"http://results.juliafem.org/2015-12-13-box_geom.png\" width=300px style=\"float:left\">\n",
"<img src=\"http://results.juliafem.org/2015-12-13-box_bcs.png\" width=300px style=\"float:left\">"
"Geometry and mesh:\n",
"\n",
"<div class=\"main_block\" style=\"max-width: 800px;\">\n",
" <div class=\"inner_block\" style=\"display: inline-block; float:left; width:50%;\">\n",
" <img src=\"http://results.juliafem.org/2015-12-13-box_geom.png\"\n",
" style=\"width:100%; height:auto; vertical-align:middle;\">\n",
" </div>\n",
" <div class=\"inner_block\" style=\"display: inline-block; float:left; width:50%;\">\n",
" <img src=\"http://results.juliafem.org/2015-12-13-box_bcs.png\"\n",
" style=\"width:100%; height:auto; vertical-align:middle;\">\n",
" </div>\n",
"</div>"
]
},
{
@@ -29,7 +39,7 @@
"source": [
"using JuliaFEM\n",
"using JuliaFEM.Preprocess: parse_aster_med_file\n",
"using JuliaFEM.Core: LinearElasticityProblem, DirichletProblem, get_connectivity, Quad4, Hex8, LinearSolver"
"using JuliaFEM.Core: LinearElasticityProblem, DirichletProblem, get_connectivity, Quad4, Hex8, DirectSolver"
]
},
{
@@ -66,7 +76,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 5,
"metadata": {
"collapsed": false
},
@@ -103,7 +113,7 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 6,
"metadata": {
"collapsed": false
},
@@ -137,7 +147,7 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 7,
"metadata": {
"collapsed": false,
"scrolled": true
@@ -147,31 +157,64 @@
"name": "stderr",
"output_type": "stream",
"text": [
"INFO: solving displacement problem, 3 dofs / nodes\n",
"INFO: solved problem in 2.11 seconds.\n"
"INFO: # of field problems: 1\n",
"INFO: # of boundary problems: 1\n",
"INFO: Starting iteration 1\n",
"INFO: Assembling field problems...\n",
"INFO: Assembling body 1...\n",
"INFO: dim = 192\n",
"INFO: Assembling boundary problems...\n",
"INFO: Assembling boundary 1...\n",
"INFO: dumping matrices to disk, file = matrices_block_host_1_iteration_1.jld\n",
"INFO: Solving system\n",
"INFO: CHOLMOD: all dofs = 192\n",
"INFO: CHOLMOD: interior dofs = 144\n",
"INFO: CHOLMOD: boundary dofs = 48\n",
"INFO: CHOLMOD: displacement on boundary solved.\n",
"INFO: CHOLMOD: homogeneous dirichlet boundary\n",
"INFO: CHOLMOD: LDLt factorization done in 0.0012049674987792969 seconds\n",
"INFO: CHOLMOD: solved in 0.05479288101196289 seconds. norm = 0.5879447357921324\n",
"INFO: timing info for iteration:\n",
"INFO: boundary assembly : 0.09608697891235352\n"
]
},
{
"data": {
"text/plain": [
"0.587944735792132"
"(1,true)"
]
},
"execution_count": 5,
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"INFO: field assembly : 1.0157549381256104\n",
"INFO: dump matrices to disk : 0.9569120407104492\n",
"INFO: solve problem : 0.48387885093688965\n",
"INFO: update element data : 0.01578807830810547\n",
"INFO: non-linear iteration : 2.568441867828369\n",
"INFO: solver finished in 2.7200798988342285 seconds.\n"
]
}
],
"source": [
"ls = LinearSolver(\"block\")\n",
"push!(ls, field_problem)\n",
"push!(ls, boundary_problem)\n",
"norm = call(ls, 0.0)"
"solver = DirectSolver()\n",
"solver.name = \"block\"\n",
"solver.nonlinear_problem = false\n",
"#solver.method = :UMFPACK\n",
"solver.dump_matrices = true\n",
"push!(solver, field_problem)\n",
"push!(solver, boundary_problem)\n",
"call(solver, 0.0)"
]
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 8,
"metadata": {
"collapsed": false
},
@@ -189,7 +232,7 @@
"7"
]
},
"execution_count": 6,
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
@@ -207,7 +250,7 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 9,
"metadata": {
"collapsed": false
},
@@ -216,8 +259,8 @@
"name": "stderr",
"output_type": "stream",
"text": [
"INFO: displacement X = [1.0,1.0,1.0], u = [-0.02777777777777779,-0.027777777777777773,0.11111111111111113]\n",
"INFO: displacement X = [1.0,1.0,1.0], u = [-0.02777777777777779,-0.027777777777777773,0.11111111111111113]\n"
"INFO: displacement X = [1.0,1.0,1.0], u = [0.027777777777777794,0.02777777777777784,-0.11111111111111129]\n",
"INFO: displacement X = [1.0,1.0,1.0], u = [0.027777777777777794,0.02777777777777784,-0.11111111111111129]\n"
]
}
],
@@ -230,13 +273,13 @@
" X = element(\"geometry\", 0.0)\n",
" u = element(\"displacement\", 0.0)\n",
" info(\"displacement X = $(X[i]), u = $(u[i])\")\n",
" @test isapprox(-u[i], known_value)\n",
" @test isapprox(u[i], known_value)\n",
"end"
]
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": 10,
"metadata": {
"collapsed": false
},
@@ -286,39 +329,24 @@
"<img src=\"http://results.juliafem.org/2015-12-13-box_results.png\" width=300px style=\"float:left\">"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"3x56 Array{Float64,2}:\n",
" 0.0 0.0 0.0 0.0 0.0 0.0 … 0.0 0.0 0.0 \n",
" 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 \n",
" -2.77778 0.0 -2.77778 0.0 -2.77778 0.0 -11.1111 -11.1111 -11.1111"
]
},
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"reshape(full(JuliaFEM.Core.assemble(field_problem, 0.0).force_vector), 3, 56)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Block divived to two parts\n",
"\n",
"<img src=\"http://results.juliafem.org/2015-12-13-divided-block-geometry.png\" width=400px style=\"float:left\">\n",
"<img src=\"http://results.juliafem.org/2015-12-13-divided-block-both-parts.png\" width=400px style=\"float:left\">"
"Block is now divided to two parts and meshes are tied using mortar method.\n",
"\n",
"<div class=\"main_block\" style=\"max-width: 800px;\">\n",
" <div class=\"inner_block\" style=\"display: inline-block; float:left; width:50%;\">\n",
" <img src=\"http://results.juliafem.org/2015-12-13-divided-block-geometry.png\"\n",
" style=\"width:100%; height:auto; vertical-align:middle;\">\n",
" </div>\n",
" <div class=\"inner_block\" style=\"display: inline-block; float:left; width:50%;\">\n",
" <img src=\"http://results.juliafem.org/2015-12-13-divided-block-both-parts.png\"\n",
" style=\"width:100%; height:auto; vertical-align:middle;\">\n",
" </div>\n",
"</div>"
]
},
{
@@ -341,7 +369,7 @@
"text/plain": [
"Dict{ASCIIString,Any} with 2 entries:\n",
" \"nodes\" => Dict(2=>[0.0,0.0,1.0],11=>[0.0,0.6666666666666666,1.0],39=>…\n",
" \"connectivity\" => Dict(68=>(:QU4,:UPPER_BLOCK_TO_LOWER_BLOCK,[42,14,4,26]),2=…"
" \"connectivity\" => Dict(68=>(:QU4,:UPPER_BLOCK_TO_LOWER_BLOCK,[26,4,14,42]),2=…"
]
},
"execution_count": 1,
@@ -513,31 +541,31 @@
"data": {
"text/plain": [
"Dict{Int64,Tuple{Symbol,Symbol,Array{Int64,1}}} with 92 entries:\n",
" 68 => (:QU4,:UPPER_BLOCK_TO_LOWER_BLOCK,[117,89,79,101])\n",
" 2 => (:SE2,:OTHER,[84,77])\n",
" 89 => (:HE8,:OTHER,[121,123,115,114,118,119,103,102])\n",
" 11 => (:SE2,:OTHER,[80,90])\n",
" 39 => (:QU4,:USYM13,[80,90,106,93])\n",
" 46 => (:QU4,:LOAD,[95,108,109,96])\n",
" 85 => (:HE8,:OTHER,[107,120,116,94,106,121,114,93])\n",
" 25 => (:SE2,:OTHER,[83,99])\n",
" 55 => (:QU4,:OTHER,[96,112,113,95])\n",
" 42 => (:QU4,:USYM13,[90,81,92,106])\n",
" 66 => (:QU4,:UPPER_BLOCK_TO_LOWER_BLOCK,[94,76,88,116])\n",
" 58 => (:QU4,:OTHER,[112,100,101,113])\n",
" 29 => (:SE2,:OTHER,[101,79])\n",
" 59 => (:QU4,:OTHER,[113,101,79,87])\n",
" 8 => (:SE2,:OTHER,[76,88])\n",
" 74 => (:QU4,:OTHER,[119,103,83,99])\n",
" 90 => (:HE8,:OTHER,[105,87,79,89,122,113,101,117])\n",
" 57 => (:QU4,:OTHER,[99,83,100,112])\n",
" 20 => (:SE2,:OTHER,[95,96])\n",
" 78 => (:HE8,:OTHER,[85,86,105,104,110,108,122,120])\n",
" 14 => (:SE2,:OTHER,[91,92])\n",
" 31 => (:SE2,:OTHER,[102,103])\n",
" 70 => (:QU4,:OTHER,[97,118,119,98])\n",
" 33 => (:QU4,:USYM23,[76,84,104,88])\n",
" 52 => (:QU4,:LOAD,[110,91,92,111])\n",
" 68 => (:QU4,:UPPER_BLOCK_TO_LOWER_BLOCK,[101,79,89,117])\n",
" 2 => (:SE2,:OTHER,[77,84])\n",
" 89 => (:HE8,:OTHER,[114,102,103,115,121,118,119,123])\n",
" 11 => (:SE2,:OTHER,[90,80])\n",
" 39 => (:QU4,:USYM13,[93,106,90,80])\n",
" 46 => (:QU4,:LOAD,[96,109,108,95])\n",
" 85 => (:HE8,:OTHER,[94,93,114,116,107,106,121,120])\n",
" 25 => (:SE2,:OTHER,[99,83])\n",
" 55 => (:QU4,:OTHER,[95,113,112,96])\n",
" 42 => (:QU4,:USYM13,[106,92,81,90])\n",
" 66 => (:QU4,:UPPER_BLOCK_TO_LOWER_BLOCK,[116,88,76,94])\n",
" 58 => (:QU4,:OTHER,[113,101,100,112])\n",
" 29 => (:SE2,:OTHER,[79,101])\n",
" 59 => (:QU4,:OTHER,[87,79,101,113])\n",
" 8 => (:SE2,:OTHER,[88,76])\n",
" 74 => (:QU4,:OTHER,[99,83,103,119])\n",
" 90 => (:HE8,:OTHER,[89,117,101,79,105,122,113,87])\n",
" 57 => (:QU4,:OTHER,[112,100,83,99])\n",
" 20 => (:SE2,:OTHER,[96,95])\n",
" 78 => (:HE8,:OTHER,[104,120,122,105,85,110,108,86])\n",
" 14 => (:SE2,:OTHER,[92,91])\n",
" 31 => (:SE2,:OTHER,[103,102])\n",
" 70 => (:QU4,:OTHER,[98,119,118,97])\n",
" 33 => (:QU4,:USYM23,[88,104,84,76])\n",
" 52 => (:QU4,:LOAD,[111,92,91,110])\n",
" ⋮ => ⋮"
]
},
@@ -561,56 +589,6 @@
"name": "stderr",
"output_type": "stream",
"text": [
"INFO: lower: add element with connectivity [40,69,57,23,17,64,34,5]\n",
"INFO: lower: add element with connectivity [73,54,31,61,74,53,32,62]\n",
"INFO: lower: add element with connectivity [75,52,33,63,66,30,8,36]\n",
"INFO: lower: add element with connectivity [71,74,62,59,72,75,63,60]\n",
"INFO: lower: add element with connectivity [46,47,71,68,49,50,72,69]\n",
"INFO: lower: add element with connectivity [49,50,72,69,24,25,65,64]\n",
"INFO: lower: add element with connectivity [20,43,67,42,19,46,68,41]\n",
"INFO: lower: add element with connectivity [9,37,14,1,42,67,55,21]\n",
"INFO: lower: add element with connectivity [44,45,73,70,47,48,74,71]\n",
"INFO: lower: add element with connectivity [10,11,38,37,43,44,70,67]\n",
"INFO: lower: add element with connectivity [39,13,4,16,73,54,31,61]\n",
"INFO: lower: add element with connectivity [74,53,32,62,75,52,33,63]\n",
"INFO: lower: add element with connectivity [37,38,15,14,67,70,58,55]\n",
"INFO: lower: add element with connectivity [70,73,61,58,71,74,62,59]\n",
"INFO: lower: add element with connectivity [43,44,70,67,46,47,71,68]\n",
"INFO: lower: add element with connectivity [68,71,59,56,69,72,60,57]\n",
"INFO: lower: add element with connectivity [12,3,13,39,45,29,54,73]\n",
"INFO: lower: add element with connectivity [67,70,58,55,68,71,59,56]\n",
"INFO: lower: add element with connectivity [47,48,74,71,50,51,75,72]\n",
"INFO: lower: add element with connectivity [2,10,37,9,20,43,67,42]\n",
"INFO: lower: add element with connectivity [69,72,60,57,64,65,35,34]\n",
"INFO: lower: add element with connectivity [72,75,63,60,65,66,36,35]\n",
"INFO: lower: add element with connectivity [45,29,54,73,48,28,53,74]\n",
"INFO: lower: add element with connectivity [51,27,52,75,26,7,30,66]\n",
"INFO: lower: add element with connectivity [11,12,39,38,44,45,73,70]\n",
"INFO: lower: add element with connectivity [42,67,55,21,41,68,56,22]\n",
"INFO: lower: add element with connectivity [19,46,68,41,18,49,69,40]\n",
"INFO: lower: add element with connectivity [38,39,16,15,70,73,61,58]\n",
"INFO: lower: add element with connectivity [48,28,53,74,51,27,52,75]\n",
"INFO: lower: add element with connectivity [50,51,75,72,25,26,66,65]\n",
"INFO: lower: add element with connectivity [41,68,56,22,40,69,57,23]\n",
"INFO: lower: add element with connectivity [18,49,69,40,6,24,64,17]\n",
"INFO: upper: add element with connectivity [121,123,115,114,118,119,103,102]\n",
"INFO: upper: add element with connectivity [107,120,116,94,106,121,114,93]\n",
"INFO: upper: add element with connectivity [105,87,79,89,122,113,101,117]\n",
"INFO: upper: add element with connectivity [85,86,105,104,110,108,122,120]\n",
"INFO: upper: add element with connectivity [109,96,112,123,98,82,99,119]\n",
"INFO: upper: add element with connectivity [84,104,88,76,107,120,116,94]\n",
"INFO: upper: add element with connectivity [106,121,114,93,90,118,102,80]\n",
"INFO: upper: add element with connectivity [92,111,121,106,81,97,118,90]\n",
"INFO: upper: add element with connectivity [111,109,123,121,97,98,119,118]\n",
"INFO: upper: add element with connectivity [108,95,113,122,109,96,112,123]\n",
"INFO: upper: add element with connectivity [122,113,101,117,123,112,100,115]\n",
"INFO: upper: add element with connectivity [77,85,104,84,91,110,120,107]\n",
"INFO: upper: add element with connectivity [104,105,89,88,120,122,117,116]\n",
"INFO: upper: add element with connectivity [110,108,122,120,111,109,123,121]\n",
"INFO: upper: add element with connectivity [91,110,120,107,92,111,121,106]\n",
"INFO: upper: add element with connectivity [86,78,87,105,108,95,113,122]\n",
"INFO: upper: add element with connectivity [120,122,117,116,121,123,115,114]\n",
"INFO: upper: add element with connectivity [123,112,100,115,119,99,83,103]\n",
"INFO: created 59 elements.\n"
]
}
@@ -625,7 +603,7 @@
" element[\"geometry\"] = Vector{Float64}[mesh_lower[\"nodes\"][i] for i in get_connectivity(element)]\n",
" element[\"youngs modulus\"] = 900.0\n",
" element[\"poissons ratio\"] = 0.25\n",
" info(\"lower: add element with connectivity $elcon\")\n",
" #info(\"lower: add element with connectivity $elcon\")\n",
" push!(field_problem, element)\n",
"end\n",
"\n",
@@ -635,7 +613,7 @@
" element[\"geometry\"] = Vector{Float64}[mesh_upper[\"nodes\"][i] for i in get_connectivity(element)]\n",
" element[\"youngs modulus\"] = 900.0\n",
" element[\"poissons ratio\"] = 0.25\n",
" info(\"upper: add element with connectivity $elcon\")\n",
" #info(\"upper: add element with connectivity $elcon\")\n",
" push!(field_problem, element)\n",
"end\n",
"\n",
@@ -644,7 +622,7 @@
" (eltype == :QU4) && (elset == :LOAD) || continue\n",
" element = Quad4(elcon)\n",
" element[\"geometry\"] = Vector{Float64}[mesh_upper[\"nodes\"][i] for i in get_connectivity(element)]\n",
" element[\"displacement traction force\"] = Vector{Float64}[[0.0, 0.0, 100.0] for i=1:4]\n",
" element[\"displacement traction force\"] = Vector{Float64}[[0.0, 0.0, -100.0] for i=1:4]\n",
" push!(field_problem, element)\n",
"end\n",
"info(\"created $(length(field_problem.elements)) elements.\")"
@@ -763,14 +741,14 @@
"INFO: Assembling boundary 2...\n",
"INFO: dumping matrices to disk, file = matrices_tie_contact_3d_host_1_iteration_1.jld\n",
"INFO: Solving system\n",
"INFO: UMFPACK: solved in 0.1845378875732422 seconds. norm = 0.37585220926688956\n",
"INFO: timing info for non-linear iteration:\n"
"INFO: UMFPACK: solved in 0.18637418746948242 seconds. norm = 0.7276121358181449\n",
"INFO: timing info for iteration:\n"
]
},
{
"data": {
"text/plain": [
"(1,false)"
"(1,true)"
]
},
"execution_count": 10,
@@ -781,13 +759,13 @@
"name": "stderr",
"output_type": "stream",
"text": [
"INFO: boundary assembly : 1.6115069389343262\n",
"INFO: field assembly : 1.110853910446167\n",
"INFO: dump matrices to disk : 1.0786750316619873\n",
"INFO: solve problem : 0.3312990665435791\n",
"INFO: update element data : 0.022845029830932617\n",
"INFO: non-linear iteration : 4.155207872390747\n",
"INFO: Warning: did not coverge in 1 iterations!\n"
"INFO: boundary assembly : 1.6767330169677734\n",
"INFO: field assembly : 1.1170330047607422\n",
"INFO: dump matrices to disk : 1.0959408283233643\n",
"INFO: solve problem : 0.3340458869934082\n",
"INFO: update element data : 0.022793054580688477\n",
"INFO: non-linear iteration : 4.246567964553833\n",
"INFO: solver finished in 4.391422986984253 seconds.\n"
]
}
],
@@ -796,6 +774,7 @@
"solver = DirectSolver()\n",
"solver.name = \"tie_contact_3d\"\n",
"solver.method = :UMFPACK\n",
"solver.nonlinear_problem = false\n",
"solver.max_iterations = 1\n",
"solver.dump_matrices = true\n",
"push!(solver, field_problem)\n",
@@ -816,7 +795,7 @@
"output_type": "stream",
"text": [
"INFO: nid near corner = 82\n",
"INFO: displacement X = [1.0,1.0,1.0], u = [0.022782767229558416,0.022002026379764242,-0.08215452308106556]\n"
"INFO: displacement X = [1.0,1.0,1.0], u = [0.02865803993668297,0.02865803993668297,-0.11229776250350555]\n"
]
},
{
@@ -860,7 +839,7 @@
},
{
"cell_type": "code",
"execution_count": 12,
"execution_count": 28,
"metadata": {
"collapsed": false
},
@@ -904,13 +883,14 @@
]
},
{
"cell_type": "code",
"execution_count": null,
"cell_type": "markdown",
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
"source": [
"<img src=\"http://results.juliafem.org/2015-12-14-divided-block-results.png\"\n",
" style=\"width:30%; height:auto; vertical-align:middle;\">"
]
}
],
"metadata": {