mirror of
https://github.com/JuliaFEM/JuliaFEM.jl.git
synced 2026-09-20 10:08:31 +00:00
490 lines
182 KiB
Plaintext
490 lines
182 KiB
Plaintext
|
|
{
|
||
|
|
"cells": [
|
||
|
|
{
|
||
|
|
"cell_type": "code",
|
||
|
|
"execution_count": 1,
|
||
|
|
"metadata": {
|
||
|
|
"collapsed": false
|
||
|
|
},
|
||
|
|
"outputs": [
|
||
|
|
{
|
||
|
|
"data": {
|
||
|
|
"text/plain": [
|
||
|
|
"300"
|
||
|
|
]
|
||
|
|
},
|
||
|
|
"execution_count": 1,
|
||
|
|
"metadata": {},
|
||
|
|
"output_type": "execute_result"
|
||
|
|
}
|
||
|
|
],
|
||
|
|
"source": [
|
||
|
|
"using JuliaFEM\n",
|
||
|
|
"\n",
|
||
|
|
"using JuliaFEM.Core: Node, Element, Seg2, Tri3, Quad4, Hex8\n",
|
||
|
|
"using JuliaFEM.Core: Problem, FieldProblem, BoundaryProblem, Dirichlet, Elasticity, Mortar\n",
|
||
|
|
"using JuliaFEM.Core: Solver, SparseMatrixCOO\n",
|
||
|
|
"using JuliaFEM.Core: get_elements, update!, calculate_normal_tangential_coordinates!,\n",
|
||
|
|
"get_connectivity, get_field_assembly, get_boundary_problems, handle_overconstraint_error!\n",
|
||
|
|
"\n",
|
||
|
|
"using JuliaFEM.Preprocess: parse_aster_med_file, aster_create_elements\n",
|
||
|
|
"\n",
|
||
|
|
"import JuliaFEM.Core: solve_linear_system\n",
|
||
|
|
"\n",
|
||
|
|
"using PyPlot\n",
|
||
|
|
"\n",
|
||
|
|
"ENV[\"COLUMNS\"] = 300"
|
||
|
|
]
|
||
|
|
},
|
||
|
|
{
|
||
|
|
"cell_type": "markdown",
|
||
|
|
"metadata": {},
|
||
|
|
"source": [
|
||
|
|
"### Hyperelastic beam"
|
||
|
|
]
|
||
|
|
},
|
||
|
|
{
|
||
|
|
"cell_type": "code",
|
||
|
|
"execution_count": 2,
|
||
|
|
"metadata": {
|
||
|
|
"collapsed": false
|
||
|
|
},
|
||
|
|
"outputs": [
|
||
|
|
{
|
||
|
|
"name": "stderr",
|
||
|
|
"output_type": "stream",
|
||
|
|
"text": [
|
||
|
|
"INFO: Found 10 element sets: BEAM_LEFT, BEAM_TOP, BEAM, RING_OUTER, RING_INNER, RING_TOP_LEFT, BEAM_RIGHT, RING_TOP_RIGHT, BEAM_BOTTOM, RING\n",
|
||
|
|
"INFO: bc3: # of master elements: 63\n",
|
||
|
|
"INFO: bc3: # of slave elements: 69\n",
|
||
|
|
"INFO: normal tangential for first slave element\n"
|
||
|
|
]
|
||
|
|
},
|
||
|
|
{
|
||
|
|
"name": "stdout",
|
||
|
|
"output_type": "stream",
|
||
|
|
"text": [
|
||
|
|
"Array(Float64,(2,2)) 2x2 Array{Float64,2}"
|
||
|
|
]
|
||
|
|
}
|
||
|
|
],
|
||
|
|
"source": [
|
||
|
|
"function get_hyperelastic_beam_problem(meshfile=\"/geometry/2d_hyperelastic_beam/MESH.med\")\n",
|
||
|
|
"\n",
|
||
|
|
" mesh = parse_aster_med_file(Pkg.dir(\"JuliaFEM\")*meshfile)\n",
|
||
|
|
" \n",
|
||
|
|
" body1 = Problem(Elasticity, \"beam\", 2)\n",
|
||
|
|
" body1_elements = aster_create_elements(mesh, :BEAM, :QU4)\n",
|
||
|
|
" update!(body1_elements, \"youngs modulus\", 2880.0)\n",
|
||
|
|
" update!(body1_elements, \"poissons ratio\", 1/3)\n",
|
||
|
|
" push!(body1, body1_elements...)\n",
|
||
|
|
"\n",
|
||
|
|
" body2 = Problem(Elasticity, \"ring\", 2)\n",
|
||
|
|
" body2_elements = aster_create_elements(mesh, :RING, (:TR3, :QU4))\n",
|
||
|
|
" #body2_elements = aster_create_elements(mesh, :RING, :QU4)\n",
|
||
|
|
" update!(body2_elements, \"youngs modulus\", 2880.0)\n",
|
||
|
|
" update!(body2_elements, \"poissons ratio\", 1/3)\n",
|
||
|
|
" push!(body2, body2_elements...)\n",
|
||
|
|
"\n",
|
||
|
|
" # boundary conditions\n",
|
||
|
|
" bc1 = Problem(Dirichlet, \"SUPPORT\", 2, \"displacement\")\n",
|
||
|
|
" bc1_elements_1 = aster_create_elements(mesh, :BEAM_LEFT, :SE2)\n",
|
||
|
|
" update!(bc1_elements_1, \"displacement 1\", 0.0)\n",
|
||
|
|
" update!(bc1_elements_1, \"displacement 2\", 0.0)\n",
|
||
|
|
" push!(bc1, bc1_elements_1...)\n",
|
||
|
|
" bc1_elements_2 = aster_create_elements(mesh, :BEAM_RIGHT, :SE2)\n",
|
||
|
|
" update!(bc1_elements_2, \"displacement 1\", 0.0)\n",
|
||
|
|
" update!(bc1_elements_2, \"displacement 2\", 0.0)\n",
|
||
|
|
" push!(bc1, bc1_elements_2...)\n",
|
||
|
|
"\n",
|
||
|
|
" bc2 = Problem(Dirichlet, \"SUPPORT ring\", 2, \"displacement\")\n",
|
||
|
|
" bc2_elements_1 = aster_create_elements(mesh, :RING_TOP_LEFT, :SE2)\n",
|
||
|
|
" bc2_elements_2 = aster_create_elements(mesh, :RING_TOP_RIGHT, :SE2)\n",
|
||
|
|
" update!(bc2_elements_1, \"displacement 1\", 0.0)\n",
|
||
|
|
" update!(bc2_elements_1, \"displacement 2\", -2.0)\n",
|
||
|
|
" update!(bc2_elements_2, \"displacement 1\", 0.0)\n",
|
||
|
|
" update!(bc2_elements_2, \"displacement 2\", -2.0)\n",
|
||
|
|
" push!(bc2, bc2_elements_1...)\n",
|
||
|
|
" push!(bc2, bc2_elements_2...)\n",
|
||
|
|
" \n",
|
||
|
|
" # contact between bodies\n",
|
||
|
|
" bc3 = Problem(Mortar, \"sliding ocntact\", 2, \"displacement\")\n",
|
||
|
|
" bc3_slave_elements = aster_create_elements(mesh, :BEAM_TOP, :SE2)\n",
|
||
|
|
" bc3_master_elements = aster_create_elements(mesh, :RING_OUTER, :SE2)\n",
|
||
|
|
" info(\"bc3: # of master elements: $(length(bc3_master_elements))\")\n",
|
||
|
|
" info(\"bc3: # of slave elements: $(length(bc3_slave_elements))\")\n",
|
||
|
|
" calculate_normal_tangential_coordinates!(bc3_slave_elements, 0.0)\n",
|
||
|
|
" update!(bc3_slave_elements, \"master elements\", bc3_master_elements)\n",
|
||
|
|
" push!(bc3, bc3_slave_elements...)\n",
|
||
|
|
" push!(bc3, bc3_master_elements...)\n",
|
||
|
|
" info(\"normal tangential for first slave element\")\n",
|
||
|
|
" Q = bc3_slave_elements[1](\"normal-tangential coordinates\", [0.0], 0.0)\n",
|
||
|
|
" dump(Q)\n",
|
||
|
|
"\n",
|
||
|
|
" return body1, body2, bc1, bc2, bc3\n",
|
||
|
|
"end\n",
|
||
|
|
"\n",
|
||
|
|
"body1, body2, bc1, bc2, bc3 = get_hyperelastic_beam_problem();"
|
||
|
|
]
|
||
|
|
},
|
||
|
|
{
|
||
|
|
"cell_type": "code",
|
||
|
|
"execution_count": 3,
|
||
|
|
"metadata": {
|
||
|
|
"collapsed": false
|
||
|
|
},
|
||
|
|
"outputs": [
|
||
|
|
{
|
||
|
|
"name": "stderr",
|
||
|
|
"output_type": "stream",
|
||
|
|
"text": [
|
||
|
|
"INFO: Found 10 element sets: BEAM_LEFT, BEAM_TOP, BEAM, RING_OUTER, RING_INNER, RING_TOP_LEFT, BEAM_RIGHT, RING_TOP_RIGHT, BEAM_BOTTOM, RING\n",
|
||
|
|
"INFO: bc3: # of master elements: 63\n"
|
||
|
|
]
|
||
|
|
},
|
||
|
|
{
|
||
|
|
"name": "stdout",
|
||
|
|
"output_type": "stream",
|
||
|
|
"text": [
|
||
|
|
":\n",
|
||
|
|
" 0.0 -1.0\n",
|
||
|
|
" 1.0 0.0\n",
|
||
|
|
"Array(Float64,(2,2)) 2x2 Array{Float64,2}:\n",
|
||
|
|
" 0.0 -1.0\n",
|
||
|
|
" 1.0 0.0\n"
|
||
|
|
]
|
||
|
|
},
|
||
|
|
{
|
||
|
|
"name": "stderr",
|
||
|
|
"output_type": "stream",
|
||
|
|
"text": [
|
||
|
|
"INFO: bc3: # of slave elements: 69\n",
|
||
|
|
"INFO: normal tangential for first slave element\n",
|
||
|
|
"INFO: solving linear system of 5 problems.\n",
|
||
|
|
"INFO: PDASS: Starting primal-dual active set strategy to determine active constraints\n",
|
||
|
|
"INFO: PDASS: contact nodes: [5,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146]\n",
|
||
|
|
"INFO: PDASS: active nodes: Int64[]\n",
|
||
|
|
"INFO: PDASS: inactive nodes: [5,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146]\n",
|
||
|
|
"INFO: UMFPACK: solved in 0.482158899307251 seconds. norm = 32.98484500494083\n",
|
||
|
|
"INFO: solving linear system of 5 problems.\n",
|
||
|
|
"INFO: PDASS: Starting primal-dual active set strategy to determine active constraints\n",
|
||
|
|
"INFO: PDASS: contact nodes: [5,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146]\n",
|
||
|
|
"INFO: PDASS: active nodes: [118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144]\n",
|
||
|
|
"INFO: PDASS: inactive nodes: [5,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,145,146]\n",
|
||
|
|
"INFO: UMFPACK: solved in 0.017026185989379883 seconds. norm = 32.29737154275384\n",
|
||
|
|
"INFO: solving linear system of 5 problems.\n",
|
||
|
|
"INFO: PDASS: Starting primal-dual active set strategy to determine active constraints\n",
|
||
|
|
"INFO: PDASS: contact nodes: [5,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146]\n",
|
||
|
|
"INFO: PDASS: active nodes: [119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143]\n",
|
||
|
|
"INFO: PDASS: inactive nodes: [5,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,144,145,146]\n",
|
||
|
|
"INFO: UMFPACK: solved in 0.014234066009521484 seconds. norm = 32.33387399057165\n",
|
||
|
|
"INFO: solving linear system of 5 problems.\n",
|
||
|
|
"INFO: PDASS: Starting primal-dual active set strategy to determine active constraints\n",
|
||
|
|
"INFO: PDASS: contact nodes: [5,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146]\n",
|
||
|
|
"INFO: PDASS: active nodes: [120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142]\n",
|
||
|
|
"INFO: PDASS: inactive nodes: [5,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,143,144,145,146]\n",
|
||
|
|
"INFO: UMFPACK: solved in 0.021646976470947266 seconds. norm = 32.699038077640864\n",
|
||
|
|
"INFO: solving linear system of 5 problems.\n",
|
||
|
|
"INFO: PDASS: Starting primal-dual active set strategy to determine active constraints\n",
|
||
|
|
"INFO: PDASS: contact nodes: [5,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146]\n",
|
||
|
|
"INFO: PDASS: active nodes: [121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141]\n",
|
||
|
|
"INFO: PDASS: inactive nodes: [5,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,142,143,144,145,146]\n",
|
||
|
|
"INFO: UMFPACK: solved in 0.010354042053222656 seconds. norm = 33.258179193127965\n",
|
||
|
|
"INFO: solving linear system of 5 problems.\n",
|
||
|
|
"INFO: PDASS: Starting primal-dual active set strategy to determine active constraints\n",
|
||
|
|
"INFO: PDASS: contact nodes: [5,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146]\n",
|
||
|
|
"INFO: PDASS: active nodes: [122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140]\n",
|
||
|
|
"INFO: PDASS: inactive nodes: [5,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,141,142,143,144,145,146]\n",
|
||
|
|
"INFO: UMFPACK: solved in 0.012367010116577148 seconds. norm = 33.927981181900996\n",
|
||
|
|
"INFO: solving linear system of 5 problems.\n",
|
||
|
|
"INFO: PDASS: Starting primal-dual active set strategy to determine active constraints\n",
|
||
|
|
"INFO: PDASS: contact nodes: [5,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146]\n",
|
||
|
|
"INFO: PDASS: active nodes: [123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140]\n",
|
||
|
|
"INFO: PDASS: inactive nodes: [5,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,141,142,143,144,145,146]\n",
|
||
|
|
"INFO: UMFPACK: solved in 0.0136871337890625 seconds. norm = 34.629575285095385\n",
|
||
|
|
"INFO: solving linear system of 5 problems.\n",
|
||
|
|
"INFO: PDASS: Starting primal-dual active set strategy to determine active constraints\n",
|
||
|
|
"INFO: PDASS: contact nodes: [5,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146]\n",
|
||
|
|
"INFO: PDASS: active nodes: [124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140]\n",
|
||
|
|
"INFO: PDASS: inactive nodes: [5,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,141,142,143,144,145,146]\n",
|
||
|
|
"INFO: UMFPACK: solved in 0.020704984664916992 seconds. norm = 35.36372079765873\n",
|
||
|
|
"INFO: solving linear system of 5 problems.\n",
|
||
|
|
"INFO: PDASS: Starting primal-dual active set strategy to determine active constraints\n",
|
||
|
|
"INFO: PDASS: contact nodes: [5,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146]\n",
|
||
|
|
"INFO: PDASS: active nodes: [125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140]\n",
|
||
|
|
"INFO: PDASS: inactive nodes: [5,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,141,142,143,144,145,146]\n",
|
||
|
|
"INFO: UMFPACK: solved in 0.013571977615356445 seconds. norm = 36.05313416585338\n",
|
||
|
|
"INFO: solving linear system of 5 problems.\n",
|
||
|
|
"INFO: PDASS: Starting primal-dual active set strategy to determine active constraints\n",
|
||
|
|
"INFO: PDASS: contact nodes: [5,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146]\n",
|
||
|
|
"INFO: PDASS: active nodes: [126,127,128,129,130,131,132,133,134,135,136,137,138,139,140]\n",
|
||
|
|
"INFO: PDASS: inactive nodes: [5,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,141,142,143,144,145,146]\n",
|
||
|
|
"INFO: UMFPACK: solved in 0.020359039306640625 seconds. norm = 36.68889887835854\n",
|
||
|
|
"INFO: solving linear system of 5 problems.\n",
|
||
|
|
"INFO: PDASS: Starting primal-dual active set strategy to determine active constraints\n",
|
||
|
|
"INFO: PDASS: contact nodes: [5,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146]\n",
|
||
|
|
"INFO: PDASS: active nodes: [127,128,129,130,131,132,133,134,135,136,137,138,139,140]\n",
|
||
|
|
"INFO: PDASS: inactive nodes: [5,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,141,142,143,144,145,146]\n",
|
||
|
|
"INFO: UMFPACK: solved in 0.015437126159667969 seconds. norm = 37.24847423019135\n",
|
||
|
|
"INFO: solving linear system of 5 problems.\n",
|
||
|
|
"INFO: PDASS: Starting primal-dual active set strategy to determine active constraints\n",
|
||
|
|
"INFO: PDASS: contact nodes: [5,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146]\n",
|
||
|
|
"INFO: PDASS: active nodes: [128,129,130,131,132,133,134,135,136,137,138,139,140]\n",
|
||
|
|
"INFO: PDASS: inactive nodes: [5,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,141,142,143,144,145,146]\n",
|
||
|
|
"INFO: UMFPACK: solved in 0.01300501823425293 seconds. norm = 37.73476317547798\n",
|
||
|
|
"INFO: solving linear system of 5 problems.\n",
|
||
|
|
"INFO: PDASS: Starting primal-dual active set strategy to determine active constraints\n",
|
||
|
|
"INFO: PDASS: contact nodes: [5,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146]\n",
|
||
|
|
"INFO: PDASS: active nodes: [129,130,131,132,133,134,135,136,137,138,139,140]\n",
|
||
|
|
"INFO: PDASS: inactive nodes: [5,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,141,142,143,144,145,146]\n",
|
||
|
|
"INFO: UMFPACK: solved in 0.013777017593383789 seconds. norm = 38.14401610389244\n",
|
||
|
|
"INFO: solving linear system of 5 problems.\n",
|
||
|
|
"INFO: PDASS: Starting primal-dual active set strategy to determine active constraints\n",
|
||
|
|
"INFO: PDASS: contact nodes: [5,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146]\n",
|
||
|
|
"INFO: PDASS: active nodes: [130,131,132,133,134,135,136,137,138,139,140]\n",
|
||
|
|
"INFO: PDASS: inactive nodes: [5,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,141,142,143,144,145,146]\n",
|
||
|
|
"INFO: UMFPACK: solved in 0.01752495765686035 seconds. norm = 38.45905535427587\n",
|
||
|
|
"INFO: solving linear system of 5 problems.\n",
|
||
|
|
"INFO: PDASS: Starting primal-dual active set strategy to determine active constraints\n",
|
||
|
|
"INFO: PDASS: contact nodes: [5,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146]\n",
|
||
|
|
"INFO: PDASS: active nodes: [131,132,133,134,135,136,137,138,139,140]\n",
|
||
|
|
"INFO: PDASS: inactive nodes: [5,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,141,142,143,144,145,146]\n",
|
||
|
|
"INFO: UMFPACK: solved in 0.018970012664794922 seconds. norm = 38.70723549357263\n",
|
||
|
|
"INFO: solving linear system of 5 problems.\n",
|
||
|
|
"INFO: PDASS: Starting primal-dual active set strategy to determine active constraints\n",
|
||
|
|
"INFO: PDASS: contact nodes: [5,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146]\n",
|
||
|
|
"INFO: PDASS: active nodes: [132,133,134,135,136,137,138,139,140]\n",
|
||
|
|
"INFO: PDASS: inactive nodes: [5,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,141,142,143,144,145,146]\n",
|
||
|
|
"INFO: UMFPACK: solved in 0.016641855239868164 seconds. norm = 38.89875943043454\n",
|
||
|
|
"INFO: solving linear system of 5 problems.\n",
|
||
|
|
"INFO: PDASS: Starting primal-dual active set strategy to determine active constraints\n",
|
||
|
|
"INFO: PDASS: contact nodes: [5,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146]\n",
|
||
|
|
"INFO: PDASS: active nodes: [133,134,135,136,137,138,139,140]\n",
|
||
|
|
"INFO: PDASS: inactive nodes: [5,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,141,142,143,144,145,146]\n",
|
||
|
|
"INFO: UMFPACK: solved in 0.02564692497253418 seconds. norm = 39.028247200511615\n",
|
||
|
|
"INFO: solving linear system of 5 problems.\n",
|
||
|
|
"INFO: PDASS: Starting primal-dual active set strategy to determine active constraints\n",
|
||
|
|
"INFO: PDASS: contact nodes: [5,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146]\n",
|
||
|
|
"INFO: PDASS: active nodes: [134,135,136,137,138,139,140]\n",
|
||
|
|
"INFO: PDASS: inactive nodes: [5,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,141,142,143,144,145,146]\n",
|
||
|
|
"INFO: UMFPACK: solved in 0.013334035873413086 seconds. norm = 39.0805994302936\n",
|
||
|
|
"INFO: solving linear system of 5 problems.\n",
|
||
|
|
"INFO: PDASS: Starting primal-dual active set strategy to determine active constraints\n"
|
||
|
|
]
|
||
|
|
},
|
||
|
|
{
|
||
|
|
"data": {
|
||
|
|
"text/plain": [
|
||
|
|
"true"
|
||
|
|
]
|
||
|
|
},
|
||
|
|
"execution_count": 3,
|
||
|
|
"metadata": {},
|
||
|
|
"output_type": "execute_result"
|
||
|
|
}
|
||
|
|
],
|
||
|
|
"source": [
|
||
|
|
"body1, body2, bc1, bc2, bc3 = get_hyperelastic_beam_problem()\n",
|
||
|
|
"solver = Solver(\"solver beam problem\")\n",
|
||
|
|
"push!(solver, body1, body2, bc1, bc2, bc3)\n",
|
||
|
|
"body1.properties.formulation = :plane_stress\n",
|
||
|
|
"body2.properties.formulation = :plane_stress\n",
|
||
|
|
"#bc3.properties.normal_condition = :Contact\n",
|
||
|
|
"#bc3.properties.tangential_condition = :Slip\n",
|
||
|
|
"bc3.properties.inequality_constraints = true\n",
|
||
|
|
"#bc3.properties.minimum_distance = 2.0\n",
|
||
|
|
"#bc3.properties.store_debug_info = true\n",
|
||
|
|
"solver.nonlinear_system_max_iterations = 20\n",
|
||
|
|
"#solver.is_linear_system = true\n",
|
||
|
|
"call(solver)"
|
||
|
|
]
|
||
|
|
},
|
||
|
|
{
|
||
|
|
"cell_type": "code",
|
||
|
|
"execution_count": 4,
|
||
|
|
"metadata": {
|
||
|
|
"collapsed": false
|
||
|
|
},
|
||
|
|
"outputs": [
|
||
|
|
{
|
||
|
|
"data": {
|
||
|
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAA9kAAAF0CAYAAAA3qfrzAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAPYQAAD2EBqD+naQAAIABJREFUeJzs3Xl8XNWV4PFf7aVSlZZSaZe1WJJlW4t3G2NjGwNhM1kxhmBIB5iQzNCdpYGZBCafdHoynUmnyTZNJ3TShA5LMPuOV4w3eZFXrda+7yqpSqVSqVR6NX8oEii2rPeEIUx0vp+PPzKld3xfFX/cOu+ee64uHA6HEUIIIYQQQgghxEem/0vfgBBCCCGEEEII8ddCkmwhhBBCCCGEEOIykSRbCCGEEEIIIYS4TCTJFkIIIYQQQgghLhNJsoUQQgghhBBCiMtEkmwhhBBCCCGEEOIykSRbCCGEEEIIIYS4TCTJFkIIIYQQQgghLhNJsoUQQgghhBBCiMtEkmwhhBBCCCGEEOIykSRbCCGEEEIIIYS4TCTJFkIIIYQQQgghLhNJsoUQQgghhBBCiMtEkmwhhBBCCCGEEOIykSRbCCGEEEIIIYS4TCTJFkIIIYQQQgghLhNJsoUQQgghhBBCiMtEkmwhhBBCCCGEEOIykSRbCCGEEEIIIYS4TCTJFkIIIYQQQggh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LDOvfn/YSGhESsVnIEm2EELMISaDibHwGGOKtrOoLUbLrBJmrTETE/3gyKDqGLPBDMhKthBCiE+XMWWM4FhQ80q2L+jDbtK2uuwZGd/HHWuN1RTnH/UTZYnSFDMyNiJNz2YgSbYQQswhE/unQkpIU5zFYNG8km0z2VQd3fVhE18qJs7iVGPifFFZyRZCCPFpMvGgWetKti/oI9ISqSnGExhPsi/WDXw
|
||
|
|
"text/plain": [
|
||
|
|
"PyPlot.Figure(PyObject <matplotlib.figure.Figure object at 0x7fbbe044b350>)"
|
||
|
|
]
|
||
|
|
},
|
||
|
|
"metadata": {},
|
||
|
|
"output_type": "display_data"
|
||
|
|
},
|
||
|
|
{
|
||
|
|
"data": {
|
||
|
|
"text/plain": [
|
||
|
|
"(0.0,35.0,-2.0,10.0)"
|
||
|
|
]
|
||
|
|
},
|
||
|
|
"execution_count": 4,
|
||
|
|
"metadata": {},
|
||
|
|
"output_type": "execute_result"
|
||
|
|
},
|
||
|
|
{
|
||
|
|
"name": "stderr",
|
||
|
|
"output_type": "stream",
|
||
|
|
"text": [
|
||
|
|
"INFO: PDASS: contact nodes: [5,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146]\n",
|
||
|
|
"INFO: PDASS: active nodes: [134,135,136,137,138,139,140]\n",
|
||
|
|
"INFO: PDASS: inactive nodes: [5,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,141,142,143,144,145,146]\n",
|
||
|
|
"INFO: UMFPACK: solved in 0.013537883758544922 seconds. norm = 39.0805994302936\n",
|
||
|
|
"INFO: Converged in 19 iterations.\n"
|
||
|
|
]
|
||
|
|
}
|
||
|
|
],
|
||
|
|
"source": [
|
||
|
|
"function plot_it(field_problem, scaling_factor=1, time=0.0; show_undeformed=true,\n",
|
||
|
|
" show_deformed=true, show_node_ids=true, equal_axis=true, xmin=-1000, ymin=-1000, xmax=1000, ymax=1000)\n",
|
||
|
|
"\n",
|
||
|
|
" function in_window(X)\n",
|
||
|
|
" xmin < X[1] < xmax || return false\n",
|
||
|
|
" ymin < X[2] < ymax || return false\n",
|
||
|
|
" return true\n",
|
||
|
|
" end\n",
|
||
|
|
"\n",
|
||
|
|
" for element in field_problem.elements\n",
|
||
|
|
" conn = get_connectivity(element)\n",
|
||
|
|
" X = element(\"geometry\", time)\n",
|
||
|
|
" \n",
|
||
|
|
" u = element(\"displacement\", time)\n",
|
||
|
|
" x = X + scaling_factor*u\n",
|
||
|
|
"\n",
|
||
|
|
" if show_undeformed\n",
|
||
|
|
" # undeformed\n",
|
||
|
|
" for i=1:length(X)\n",
|
||
|
|
" in_window(X[i]) || continue\n",
|
||
|
|
" px1 = X[i][1]\n",
|
||
|
|
" py1 = X[i][2]\n",
|
||
|
|
" px2 = X[mod(i,length(X))+1][1]\n",
|
||
|
|
" py2 = X[mod(i,length(X))+1][2]\n",
|
||
|
|
" PyPlot.plot([px1, px2], [py1, py2], \"k-\", alpha=0.5, label=\"undeformed\")\n",
|
||
|
|
" end\n",
|
||
|
|
" end\n",
|
||
|
|
"\n",
|
||
|
|
" if show_deformed\n",
|
||
|
|
" # deformed\n",
|
||
|
|
" for i=1:length(x)\n",
|
||
|
|
" in_window(x[i]) || continue\n",
|
||
|
|
" px1 = x[i][1]\n",
|
||
|
|
" py1 = x[i][2]\n",
|
||
|
|
" px2 = x[mod(i,length(x))+1][1]\n",
|
||
|
|
" py2 = x[mod(i,length(x))+1][2]\n",
|
||
|
|
" PyPlot.plot([px1, px2], [py1, py2], \"g-\", alpha=0.5, label=\"deformed\")\n",
|
||
|
|
" end\n",
|
||
|
|
" end\n",
|
||
|
|
"\n",
|
||
|
|
" if show_node_ids\n",
|
||
|
|
" for (i, c) in enumerate(conn)\n",
|
||
|
|
" in_window(x[i]) || continue\n",
|
||
|
|
" PyPlot.text(x[i][1], x[i][2], \"$c\")\n",
|
||
|
|
" end\n",
|
||
|
|
" end\n",
|
||
|
|
" \n",
|
||
|
|
" end\n",
|
||
|
|
"\n",
|
||
|
|
" if equal_axis\n",
|
||
|
|
" PyPlot.axis(\"equal\")\n",
|
||
|
|
" end\n",
|
||
|
|
" #PyPlot.grid()\n",
|
||
|
|
"\n",
|
||
|
|
"end\n",
|
||
|
|
"\n",
|
||
|
|
"using JuliaFEM.Core: project_from_master_to_slave, project_from_slave_to_master\n",
|
||
|
|
"\n",
|
||
|
|
"function plot_normals(contact_problem, time, scale=3)\n",
|
||
|
|
" for element in get_elements(contact_problem)\n",
|
||
|
|
" X1 = element(\"geometry\", [-1.0], time)\n",
|
||
|
|
" X2 = element(\"geometry\", [ 1.0], time)\n",
|
||
|
|
" n1 = element(\"normal-tangential coordinates\", [-1.0], time)\n",
|
||
|
|
" n2 = element(\"normal-tangential coordinates\", [ 1.0], time)\n",
|
||
|
|
" plot([X1[1], X1[1]+scale*n1[1]], [X1[2], X1[2]+scale*n1[2]], \"-b\")\n",
|
||
|
|
" plot([X2[1], X2[1]+scale*n2[1]], [X2[2], X2[2]+scale*n2[2]], \"-b\")\n",
|
||
|
|
" end\n",
|
||
|
|
"end\n",
|
||
|
|
"\n",
|
||
|
|
"function plot_contact_segmentation(slave_element, time)\n",
|
||
|
|
" for master_element in slave_element[\"master elements\"]\n",
|
||
|
|
" xi1a = 0\n",
|
||
|
|
" xi1b = 0\n",
|
||
|
|
" try\n",
|
||
|
|
" xi1a = project_from_master_to_slave(slave_element, master_element, [-1.0])\n",
|
||
|
|
" xi1b = project_from_master_to_slave(slave_element, master_element, [ 1.0])\n",
|
||
|
|
" catch\n",
|
||
|
|
" info(\"failed get construct segmentation\")\n",
|
||
|
|
" end\n",
|
||
|
|
" xi1 = clamp([xi1a xi1b], -1.0, 1.0)\n",
|
||
|
|
" l = 1/2*(xi1[2]-xi1[1])\n",
|
||
|
|
" if abs(l) < 1.0e-9\n",
|
||
|
|
" continue\n",
|
||
|
|
" end\n",
|
||
|
|
" Xs1 = slave_element(\"geometry\", [xi1[1]], time)\n",
|
||
|
|
" Xs2 = slave_element(\"geometry\", [xi1[2]], time)\n",
|
||
|
|
" xi2a = project_from_slave_to_master(slave_element, master_element, [xi1[1]])\n",
|
||
|
|
" xi2b = project_from_slave_to_master(slave_element, master_element, [xi1[2]])\n",
|
||
|
|
" Xm1 = master_element(\"geometry\", xi2a, time)\n",
|
||
|
|
" Xm2 = master_element(\"geometry\", xi2b, time)\n",
|
||
|
|
" plot([Xs1[1], Xm1[1]], [Xs1[2], Xm1[2]], \"-r\", alpha=0.3)\n",
|
||
|
|
" plot([Xs2[1], Xm2[1]], [Xs2[2], Xm2[2]], \"-r\", alpha=0.3)\n",
|
||
|
|
" end\n",
|
||
|
|
"end\n",
|
||
|
|
"\n",
|
||
|
|
"function plot_segmentation(contact_problem, time=0.0)\n",
|
||
|
|
" info(\"plot segmentation\")\n",
|
||
|
|
" for (i, element) in enumerate(get_elements(contact_problem))\n",
|
||
|
|
" haskey(element, \"master elements\") || continue\n",
|
||
|
|
" plot_contact_segmentation(element, time)\n",
|
||
|
|
" end\n",
|
||
|
|
"end\n",
|
||
|
|
"\n",
|
||
|
|
"\n",
|
||
|
|
"figure(figsize=(12, 4))\n",
|
||
|
|
"plot_it(body1; show_undeformed=false, equal_axis=false, show_node_ids=false)\n",
|
||
|
|
"plot_it(body2; show_undeformed=false, equal_axis=false, show_node_ids=false)\n",
|
||
|
|
"#plot_segmentation(bc3)\n",
|
||
|
|
"#xlim(-0.1, 1.1)\n",
|
||
|
|
"#ylim(0.30, 0.52)\n",
|
||
|
|
"#axis(\"off\")\n",
|
||
|
|
"\n",
|
||
|
|
"element = nothing\n",
|
||
|
|
"for element in get_elements(bc3)\n",
|
||
|
|
" continue\n",
|
||
|
|
" haskey(element, \"master elements\") || continue\n",
|
||
|
|
" haskey(element, \"active nodes\") || continue\n",
|
||
|
|
" A = element[\"active nodes\"]\n",
|
||
|
|
" X = element(\"geometry\", [0.0], 0.0)\n",
|
||
|
|
" u = element(\"displacement\", [0.0], 0.0)\n",
|
||
|
|
"\n",
|
||
|
|
" G = element[\"G\"].data\n",
|
||
|
|
" isapprox(G, [0.0, 0.0, 0.0, 0.0]) && continue\n",
|
||
|
|
" println(A.data)\n",
|
||
|
|
" println(element[\"c\"].data[1:2:end])\n",
|
||
|
|
" x = X + u\n",
|
||
|
|
" plot(x[1], x[2], \"ro\")\n",
|
||
|
|
"end\n",
|
||
|
|
"axis(\"off\")"
|
||
|
|
]
|
||
|
|
}
|
||
|
|
],
|
||
|
|
"metadata": {
|
||
|
|
"kernelspec": {
|
||
|
|
"display_name": "Julia 0.4.3",
|
||
|
|
"language": "julia",
|
||
|
|
"name": "julia-0.4"
|
||
|
|
},
|
||
|
|
"language_info": {
|
||
|
|
"file_extension": ".jl",
|
||
|
|
"mimetype": "application/julia",
|
||
|
|
"name": "julia",
|
||
|
|
"version": "0.4.3"
|
||
|
|
}
|
||
|
|
},
|
||
|
|
"nbformat": 4,
|
||
|
|
"nbformat_minor": 0
|
||
|
|
}
|