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]
This diff is collapsed.
Merge "cylinder.stp";
SetFactory("Built-in");
//+
Recombine Surface {4, 1};
//+
Recombine Surface {2, 1, 4, 3};
//+
Recombine Surface {2, 1, 4, 3};
//+
Recombine Surface {2, 1, 4, 3};
//+
MeshSize {3, 1, 4, 2} = 0.1;
//+
MeshSize {3, 1, 4, 2} = 0.05;
//+
MeshSize {3, 1, 4, 2} = 2;
//+
MeshSize {3, 1, 4, 2} = 0.001;
//+
Curve Loop(7) = {4};
//+
Plane Surface(5) = {7};
//+
Physical Surface("Inside") = {4};
//+
MeshSize {1, 3, 2, 4} = 0.1;
//+
MeshSize {1, 3, 2, 4} = 1;
//+
MeshSize {1, 3, 2, 4} = 10;
//+
MeshSize {1, 3, 2, 4} = 1000;
//+
MeshSize {1, 3, 2, 4} = 500;
//+
MeshSize {1, 3, 2, 4} = 500;
//+
MeshSize {1, 3, 2, 4} = 200;
//+
MeshSize {1, 3, 2, 4} = 50;
//+
MeshSize {1, 3, 4, 2} = 20;
//+
MeshSize {1, 3, 2, 4} = 500;
$MeshFormat
4.1 0 8
$EndMeshFormat
$Entities
8 6 2 0
1 0 0 0 0
2 1 0 0 0
3 -0.4999999999999998 0.8660254037844387 0 0
4 -0.5000000000000004 -0.8660254037844384 0 0
5 0 0 10 0
6 1 0 10 0
7 -0.4999999999999998 0.8660254037844387 10 0
8 -0.5000000000000004 -0.8660254037844384 10 0
1 -0.4999999999999998 0 0 1 0.9983081582712682 0 0 2 2 -3
2 -0.9932383577419432 -0.8660254037844386 0 -0.5 0.866025403784439 0 0 2 3 -4
3 -0.5000000000000004 -0.9983081582712682 0 1 1.665334536937735e-16 0 0 2 4 -2
4 -0.4999999999999998 0 10 1 0.9983081582712682 10 0 2 6 -7
5 -0.9932383577419432 -0.8660254037844386 10 -0.5 0.866025403784439 10 0 2 7 -8
6 -0.5000000000000004 -0.9983081582712682 10 1 1.665334536937735e-16 10 0 2 8 -6
1 -0.9932383577419432 -0.9983081582712682 0 1 0.9983081582712682 0 0 3 1 2 3
2 -0.9932383577419432 -0.9983081582712682 10 1 0.9983081582712682 10 0 3 4 5 6
$EndEntities
$Nodes
16 76 1 76
0 1 0 1
1
0 0 0
0 2 0 1
2
1 0 0
0 3 0 1
3
-0.4999999999999998 0.8660254037844387 0
0 4 0 1
4
-0.5000000000000004 -0.8660254037844384 0
0 5 0 1
5
0 0 10
0 6 0 1
6
1 0 10
0 7 0 1
7
-0.4999999999999998 0.8660254037844387 10
0 8 0 1
8
-0.5000000000000004 -0.8660254037844384 10
1 1 0 4
9
10
11
12
0.9135454572049513 0.4067366440587774 0
0.6691306046349795 0.7431448270295816 0
0.3090169923092427 0.9510565169663417 0
-0.1045284642815645 0.994521895261707 0
1 2 0 4
13
14
15
16
-0.8090169950810331 0.5877852513206302 0
-0.9781476012268401 0.2079116884982156 0
-0.9781476002519894 -0.2079116930845272 0
-0.8090169937363013 -0.5877852531714943 0
1 3 0 4
17
18
19
20
-0.1045284622502921 -0.9945218954752024 0
0.30901699635185 -0.951056515652819 0
0.6691306079854299 -0.7431448240128224 0
0.9135454580920364 -0.4067366420663514 0
1 4 0 4
21
22
23
24
0.9135454572049513 0.4067366440587774 10
0.6691306046349795 0.7431448270295816 10
0.3090169923092427 0.9510565169663417 10
-0.1045284642815645 0.994521895261707 10
1 5 0 4
25
26
27
28
-0.8090169950810331 0.5877852513206302 10
-0.9781476012268401 0.2079116884982156 10
-0.9781476002519894 -0.2079116930845272 10
-0.8090169937363013 -0.5877852531714943 10
1 6 0 4
29
30
31
32
-0.1045284622502921 -0.9945218954752024 10
0.30901699635185 -0.951056515652819 10
0.6691306079854299 -0.7431448240128224 10
0.9135454580920364 -0.4067366420663514 10
2 1 0 22
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
-0.4135454581254429 -0.4592887617466681 0
0.3586636904399069 0.6233108954615405 0
0.5142999893642952 -0.3746885289135919 0
-0.5843131382167875 0.2512155342436214 0
-0.1909830062417072 0.5877852531708454 0
0.0691663035992533 -0.6525773565542949 0
0.6045284631011147 0.1284964918883672 0
-0.7370831896953947 -0.009630384459983727 0
-0.3736191368743351 -0.07941520029734764 0
-0.2301468837319993 0.2397662948189617 0
-0.006804659428745562 -0.06292065860249636 0
0.1961929519589293 0.3280066564150433 0
-0.1178271396805306 -0.3626346463954796 0
0.5644454417581223 0.4440181131401474 0
0.3736191390490459 -0.647127328324319 0
-0.230909325554682 -0.7106658310767089 0
0.730909326329408 -0.1553595728750666 0
0.3516498816161224 -0.07474549001743327 0
-0.5000000005641374 0.5553062573703903 0
-0.6826361317495985 -0.3039291888751113 0
0.1035110712930455 0.7101386956212686 0
0.1973505857532401 -0.3624490014679358 0
2 2 0 22
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
-0.4819707121284427 -0.5337231008513558 10
0.3090169934559188 0.5352331358438651 10
0.5152774051036455 -0.3733432315125985 10
-0.4194828619441121 0.4780849475330147 10
0.06460214398276543 -0.6146483332069383 10
-0.6180339892996958 -1.448910314061594e-09 10
0.6420115103882927 0.1358764309416624 10
-0.2186121940666673 0.7039837225688523 10
-0.03992632037681249 0.3798735612512203 10
-0.299150596066515 0.144790833384966 10
0.05773834660422503 0.02591516882119098 10
-0.2513259110428465 -0.287950217155399 10
0.3084754545618241 0.2241205376823588 10
0.6045284624834868 0.4392156385638607 10
0.3736191390490459 -0.647127328324319 10
0.1797529758691714 -0.311341283990325 10
0.730909326329408 -0.1553595728750666 10
-0.2478630846497401 -0.6740286589466788 10
-0.6433953528512104 -0.3178898062088442 10
-0.6826361324316929 0.3039291863255435 10
0.07810766744913732 0.7431448261878042 10
0.4056941698094277 -0.07568865848879631 10
$EndNodes
$Elements
16 152 1 152
0 1 15 1
1 1
0 2 15 1
2 2
0 3 15 1
3 3
0 4 15 1
4 4
0 5 15 1
5 5
0 6 15 1
6 6
0 7 15 1
7 7
0 8 15 1
8 8
1 1 1 5
9 2 9
10 9 10
11 10 11
12 11 12
13 12 3
1 2 1 5
14 3 13
15 13 14
16 14 15
17 15 16
18 16 4
1 3 1 5
19 4 17
20 17 18
21 18 19
22 19 20
23 20 2
1 4 1 5
24 6 21
25 21 22
26 22 23
27 23 24
28 24 7
1 5 1 5
29 7 25
30 25 26
31 26 27
32 27 28
33 28 8
1 6 1 5
34 8 29
35 29 30
36 30 31
37 31 32
38 32 6
2 1 2 57
39 44 39 46
40 34 44 46
41 37 44 53
42 44 34 53
43 39 44 50
44 2 9 39
45 17 18 38
46 13 14 36
47 10 11 34
48 19 20 35
49 16 4 33
50 12 3 37
51 37 42 44
52 42 41 43
53 42 37 51
54 36 42 51
55 43 41 45
56 42 43 44
57 36 41 42
58 2 39 49
59 3 13 51
60 4 17 48
61 38 18 47
62 9 10 46
63 36 14 40
64 33 41 52
65 41 40 52
66 14 15 40
67 18 19 47
68 17 38 48
69 34 11 53
70 36 40 41