Commit 937f99dd authored by florez's avatar florez
Browse files

add files

parent 8a0a4a14
%% Cell type:code id:59a9f2d7-aadb-4d96-9b19-0cfcf7c950dc tags:
``` python
import numpy as np
import akantu as aka
```
%% Cell type:code id:c1339e28-e6b1-4155-b25e-f3b848025838 tags:
``` python
material_file = """
material elastic [
name = steel
rho = 1 # density
E = 1 # young's modulus
nu = 0.3 # poisson's ratio
]"""
# writing the material file
open('material.dat', 'w').write(material_file)
#reading the material file
material_file = 'material.dat'
aka.parseInput(material_file)
```
%% Cell type:code id:e70a5ac5-9f8e-4cd7-af1d-931ccb725052 tags:
``` python
mesh = aka.Mesh(3)
mesh.read('cyl_01.msh')
model = aka.SolidMechanicsModel(mesh)
model.initFull(_analysis_method=aka._static)
```
%% Cell type:code id:18ffad89-ec5f-41ae-9705-21ba5ac967d6 tags:
``` python
for dir in [aka._x, aka._y, aka._z]:
model.applyBC(aka.FixedValue(0, dir), "bottom")
trac = [0, 0, 1]
model.applyBC(aka.FromTraction(trac), "top")
model.solveStep()
```
%%%% Output: error
---------------------------------------------------------------------------
Exception Traceback (most recent call last)
<ipython-input-19-52b1c10eaa2d> in <module>
5 model.applyBC(aka.FromTraction(trac), "top")
6
----> 7 model.solveStep()
Exception: akantu::debug::CriticalError : Error in mumps during solve process, check mumps user guide INFO(1) = -3 [/tmp/app/spack-stage/spack-stage-akantu-master-t5tv2fws2j5an4dr4sqytng27g7b3fyr/spack-src/src/solver/sparse_solver_mumps.cc:445]
//+
SetFactory("OpenCASCADE");
//+
t = 0.05;
Circle(1) = {0, -0, 0, 0.5, 0, 2*Pi};
Circle(2) = {0, -0, 0, 0.5+t, 0, 2*Pi};
//+
Extrude {0, 0, 5} {
Curve{1};
}
Extrude {0, 0, 5} {
Curve{2};
}
//+
Physical Surface("Inside") = {1};
//+
Physical Curve("top") = {1};
//+
Physical Point("fixpoint") = {3,4};
//+
//+
Curve Loop(3) = {6};
//+
Curve Loop(4) = {4};
//+
Plane Surface(3) = {3, 4};
Physical Surface("bottom") = {3};
//+
Curve Loop(5) = {2};
//+
Curve Loop(6) = {1};
Plane Surface(4) = {5, 6};
//+
Surface Loop(1) = {3, 2, 4, 1};
//+
Volume(1) = {1};
%% Cell type:code id:1dbbab78-6ef1-4e97-8440-f6db326755e9 tags:
``` python
import akantu as aka
import numpy as np
import pygmsh
# import the pyplot submodule to draw figures
import matplotlib.pyplot as plt
# import triangluation routine to plot meshes
import matplotlib.tri as tri
# setting a default image size large enough
plt.rcParams['figure.figsize'] = [10, 10]
```
%% Cell type:code id:4f3b63d5-abe9-43ce-9eca-80cd47fb4d49 tags:
``` python
# reading the mesh
spatial_dimension = 3
mesh_file = 'shell_cyl_2.msh'
mesh = aka.Mesh(spatial_dimension)
mesh.read(mesh_file)
```
%% Cell type:code id:ac11734f-f415-43aa-a1a3-92edca236554 tags:
``` python
material_file = """
material elastic [
name = steel
rho = 1 # density
E = 1 # young's modulus
nu = 0.3 # poisson's ratio
]"""
# writing the material file
open('material.dat', 'w').write(material_file)
#reading the material file
material_file = 'material.dat'
aka.parseInput(material_file)
# creating the solid mechanics model
model = aka.SolidMechanicsModel(mesh)
# initialize a static solver
model.initFull(_analysis_method=aka._static)
```
%% Cell type:code id:e2379428-0b40-406f-bfed-160eb297f730 tags:
``` python
# Bottom ring 'bottom', top ring 'top', cylinder surface 'surface'
# set the displacement/Dirichlet boundary conditions
for dir in [aka._x, aka._y, aka._z]:
model.applyBC(aka.FixedValue(0, dir), "bottom")
# set the force/Neumann boundary conditions
trac = np.eye(3) # Newtons/m^2
trac = [0,0,1]
model.applyBC(aka.FromTraction(trac), "top")
```
%% Cell type:code id:6d82b932-ca93-45eb-8e3e-c0ec2c24f381 tags:
``` python
np.set_printoptions(threshold=20)
model.getExternalForce()[:]
# np.size(model.getExternalForce(),0)
# model.getBlockedDOFs()
```
%%%% Output: execute_result
array([[0., 0., 0.],
[0., 0., 0.],
[0., 0., 0.],
...,
[0., 0., 0.],
[0., 0., 0.],
[0., 0., 0.]])
%% Cell type:code id:09675758-79eb-4314-b23f-f34fe359dc9f tags:
``` python
# configure the linear algebra solver
solver = model.getNonLinearSolver()
solver.set("max_iterations", 3)
solver.set("threshold", 1e-8)
solver.set("convergence_type", aka.SolveConvergenceCriteria.residual)
# compute the solution
model.solveStep()
u = model.getDisplacement()
np.set_printoptions(threshold=120)
u
```
%%%% Output: execute_result
array([[0., 0., 0.],
[0., 0., 0.],
[0., 0., 0.],
...,
[0., 0., 0.],
[0., 0., 0.],
[0., 0., 0.]])
%% Cell type:code id:a81b557e-7adb-452a-9982-efeef3070962 tags:
``` python
# specify what field to output into paraview files
model.setBaseName("shell_cyl")
model.addDumpFieldVector("displacement")
model.addDumpFieldVector("external_force")
model.addDumpField("strain")
model.addDumpField("stress")
model.addDumpField("blocked_dofs")
# generate paraview files
model.dump()
```
%%%% Output: error
---------------------------------------------------------------------------
Exception Traceback (most recent call last)
<ipython-input-7-254e5de967ab> in <module>
8
9 # generate paraview files
---> 10 model.dump()
Exception: akantu::debug::Exception : No element of type (not_ghost:_cohesive_2d_4) in this const ElementTypeMapArray<unsigned int> class("mesh:connectivities") [/tmp/app/spack-stage/spack-stage-akantu-master-t5tv2fws2j5an4dr4sqytng27g7b3fyr/spack-src/src/mesh/element_type_map_tmpl.hh:293]
%% Cell type:code id:b9caba6a-e863-495b-989c-fd3bc3cf44ab tags:
``` python
```
# florez_akantu
SetFactory("OpenCASCADE");
Point(1) = {0, 0, 0};
Point(2) = {0, .5, 0};
Circle(1) = {0,0,0,0.5,0,2*Pi};
Extrude {0, 0, 1} {
Curve{1};
}
//+
Curve Loop(2) = {3};
//+
Plane Surface(2) = {2};
Curve Loop(3) = {1};
Plane Surface(3) = {3};
Physical Surface("bottom") = {3};
Physical Surface("top") = {2};
Physical Surface("surface") = {1};
%% Cell type:code id:59a9f2d7-aadb-4d96-9b19-0cfcf7c950dc tags:
``` python
import numpy as np
import akantu as aka
```
%% Cell type:code id:c1339e28-e6b1-4155-b25e-f3b848025838 tags:
``` python
material_file = """
material elastic [
name = steel
rho = 1 # density
E = 1 # young's modulus
nu = 0.3 # poisson's ratio
]"""
# writing the material file
open('material.dat', 'w').write(material_file)
#reading the material file
material_file = 'material.dat'
aka.parseInput(material_file)
```
%% Cell type:code id:e70a5ac5-9f8e-4cd7-af1d-931ccb725052 tags:
``` python
mesh = aka.Mesh(3)
mesh.read('cyl_01.msh')
model = aka.SolidMechanicsModel(mesh)
model.initFull(_analysis_method=aka._static)
```
%% Cell type:code id:18ffad89-ec5f-41ae-9705-21ba5ac967d6 tags:
``` python
for dir in [aka._x, aka._y, aka._z]:
model.applyBC(aka.FixedValue(0, dir), "bottom")
trac = [0, 0, 1]
model.applyBC(aka.FromTraction(trac), "top")
model.solveStep()
```
%%%% Output: error
---------------------------------------------------------------------------
Exception Traceback (most recent call last)
<ipython-input-19-52b1c10eaa2d> in <module>
5 model.applyBC(aka.FromTraction(trac), "top")
6
----> 7 model.solveStep()
Exception: akantu::debug::CriticalError : Error in mumps during solve process, check mumps user guide INFO(1) = -3 [/tmp/app/spack-stage/spack-stage-akantu-master-t5tv2fws2j5an4dr4sqytng27g7b3fyr/spack-src/src/solver/sparse_solver_mumps.cc:445]
$MeshFormat
4.1 0 8
$EndMeshFormat
$PhysicalNames
3
2 1 "bottom"
2 2 "top"
2 3 "surface"
$EndPhysicalNames
$Entities
4 3 3 0
1 0 0 0 0
2 0 0.5 0 0
3 0.5 0 0 0
4 0.5 0 1 0
1 -0.5000000999999999 -0.5000000999999999 -1e-07 0.5000000999999999 0.5000000999999999 1e-07 0 2 3 -3
2 0.4999999 -1e-07 -9.999999994736442e-08 0.5000000999999999 1e-07 1.0000001 0 2 3 -4
3 -0.5000000999999999 -0.5000000999999999 0.9999999000000001 0.5000000999999999 0.5000000999999999 1.0000001 0 2 4 -4
1 -0.5000000999999999 -0.5000000999999999 -9.999999994736442e-08 0.5000000999999999 0.5000000999999999 1.0000001 1 3 4 2 3 -2 1
2 -0.5000000999999999 -0.5000000999999999 0.9999999000000001 0.5000000999999999 0.5000000999999999 1.0000001 1 2 1 3
3 -0.5000000999999999 -0.5000000999999999 -1e-07 0.5000000999999999 0.5000000999999999 1e-07 1 1 1 1
$EndEntities
$Nodes
8 2418 1 2418
0 3 0 1
1
0.5 0 0
0 4 0 1
2
0.5 0 1
1 1 0 63
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
0.4903926402016153 0.09754516100806389 0
0.4619397662556436 0.1913417161825444 0
0.415734806151273 0.2777851165098005 0
0.3535533905932744 0.3535533905932731 0
0.2777851165098021 0.415734806151272 0
0.1913417161825461 0.4619397662556429 0
0.09754516100806568 0.4903926402016149 0
1.695950706916419e-15 0.5 0
-0.09754516100806203 0.4903926402016157 0
-0.1913417161825426 0.4619397662556443 0
-0.277785116509799 0.4157348061512741 0
-0.3535533905932717 0.3535533905932758 0
-0.415734806151271 0.2777851165098036 0
-0.4619397662556421 0.1913417161825478 0
-0.4903926402016146 0.09754516100806734 0
-0.5 3.613946018757869e-15 0
-0.490392640201616 -0.09754516100806004 0
-0.4619397662556449 -0.1913417161825411 0
-0.4157348061512744 -0.2777851165097984 0
-0.353553390593276 -0.3535533905932715 0
-0.2777851165098037 -0.4157348061512709 0
-0.1913417161825472 -0.4619397662556424 0
-0.09754516100806651 -0.4903926402016148 0
-2.312294559186364e-15 -0.5 0
0.09754516100806197 -0.4903926402016157 0
0.1913417161825429 -0.4619397662556442 0
0.2777851165098002 -0.4157348061512732 0
0.3535533905932731 -0.3535533905932745 0
0.4157348061512721 -0.2777851165098019 0
0.4619397662556433 -0.1913417161825452 0
0.4903926402016152 -0.09754516100806436 0
0.4975923633360985 0.04900857016478017 0
0.4784701678661045 0.1451423386272308 0
0.4409606321741778 0.2356983684129983 0
0.386505226681369 0.3171966420818221 0
0.3171966420818236 0.3865052266813678 0
0.235698368413 0.4409606321741769 0
0.1451423386272326 0.478470167866104 0
0.04900857016478193 0.4975923633360983 0
-0.04900857016477844 0.4975923633360986 0
-0.145142338627229 0.4784701678661051 0
-0.2356983684129965 0.4409606321741787 0
-0.3171966420818206 0.3865052266813702 0
-0.3865052266813665 0.3171966420818251 0
-0.440960632174176 0.2356983684130017 0
-0.4784701678661035 0.1451423386272344 0
-0.4975923633360981 0.04900857016478373 0
-0.4975923633360988 -0.04900857016477653 0
-0.4784701678661056 -0.1451423386272273 0
-0.4409606321741793 -0.2356983684129955 0
-0.3865052266813706 -0.3171966420818202 0
-0.3171966420818254 -0.3865052266813663 0
-0.2356983684130013 -0.4409606321741762 0
-0.1451423386272333 -0.4784701678661038 0
-0.04900857016478288 -0.4975923633360982 0
0.04900857016477828 -0.4975923633360986 0
0.1451423386272289 -0.4784701678661051 0
0.2356983684129972 -0.4409606321741784 0
0.3171966420818217 -0.3865052266813693 0
0.386505226681368 -0.3171966420818233 0
0.4409606321741772 -0.2356983684129994 0
0.4784701678661043 -0.1451423386272317 0
0.4975923633360985 -0.04900857016478025 0
1 2 0 19
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
0.5 0 0.1
0.5 0 0.2
0.5 0 0.3
0.5 0 0.4
0.5 0 0.5
0.5 0 0.6
0.5 0 0.7
0.5 0 0.8
0.5 0 0.9
0.5 0 0.05
0.5 0 0.15
0.5 0 0.25
0.5 0 0.35
0.5 0 0.45
0.5 0 0.55
0.5 0 0.6499999999999999
0.5 0 0.75
0.5 0 0.8500000000000001
0.5 0 0.95
1 3 0 63
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
147
0.4903926402016153 0.09754516100806389 1
0.4619397662556436 0.1913417161825444 1
0.415734806151273 0.2777851165098005 1
0.3535533905932744 0.3535533905932731 1
0.2777851165098021 0.415734806151272 1
0.1913417161825461 0.4619397662556429 1
0.09754516100806568 0.4903926402016149 1
1.695950706916419e-15 0.5 1
-0.09754516100806203 0.4903926402016157 1
-0.1913417161825426 0.4619397662556443 1
-0.277785116509799 0.4157348061512741 1
-0.3535533905932717 0.3535533905932758 1
-0.415734806151271 0.2777851165098036 1
-0.4619397662556421 0.1913417161825478 1
-0.4903926402016146 0.09754516100806734 1
-0.5 3.613946018757869e-15 1
-0.490392640201616 -0.09754516100806004 1
-0.4619397662556449 -0.1913417161825411 1
-0.4157348061512744 -0.2777851165097984 1
-0.353553390593276 -0.3535533905932715 1
-0.2777851165098037 -0.4157348061512709 1
-0.1913417161825472 -0.4619397662556424 1
-0.09754516100806651 -0.4903926402016148 1
-2.312294559186364e-15 -0.5 1
0.09754516100806197 -0.4903926402016157 1
0.1913417161825429 -0.4619397662556442 1
0.2777851165098002 -0.4157348061512732 1
0.3535533905932731 -0.3535533905932745 1
0.4157348061512721 -0.2777851165098019 1
0.4619397662556433 -0.1913417161825452 1
0.4903926402016152 -0.09754516100806436 1
0.4975923633360985 0.04900857016478017 1
0.4784701678661045 0.1451423386272308 1
0.4409606321741778 0.2356983684129983 1
0.386505226681369 0.3171966420818221 1
0.3171966420818236 0.3865052266813678 1
0.235698368413 0.4409606321741769 1
0.1451423386272326 0.478470167866104 1
0.04900857016478193 0.4975923633360983 1
-0.04900857016477844 0.4975923633360986 1
-0.145142338627229 0.4784701678661051 1
-0.2356983684129965 0.4409606321741787 1
-0.3171966420818206 0.3865052266813702 1
-0.3865052266813665 0.3171966420818251 1
-0.440960632174176 0.2356983684130017 1
-0.4784701678661035 0.1451423386272344 1
-0.4975923633360981 0.04900857016478373 1
-0.4975923633360988 -0.04900857016477653 1
-0.4784701678661056 -0.1451423386272273 1
-0.4409606321741793 -0.2356983684129955 1
-0.3865052266813706 -0.3171966420818202 1
-0.3171966420818254 -0.3865052266813663 1
-0.2356983684130013 -0.4409606321741762 1
-0.1451423386272333 -0.4784701678661038 1
-0.04900857016478288 -0.4975923633360982 1
0.04900857016477828 -0.4975923633360986 1
0.1451423386272289 -0.4784701678661051 1
0.2356983684129972 -0.4409606321741784 1
0.3171966420818217 -0.3865052266813693 1