Commit 2f2ec880 authored by florez's avatar florez
Browse files

wall with rips

parent 973adb6c
This diff is collapsed.
...@@ -3,9 +3,10 @@ SetFactory("OpenCASCADE"); ...@@ -3,9 +3,10 @@ SetFactory("OpenCASCADE");
//+ //+
Cylinder(1) = {0, 0, 0, 0, 0, 1, 0.5, 2*Pi}; Cylinder(1) = {0, 0, 0, 0, 0, 1, 0.5, 2*Pi};
//+ //+
Surface Loop(2) = {1, 2, 3}; //Surface Loop(2) = {1, 2, 3};
//+ //+
Volume(2) = {2}; //Volume(2) = {2};
Physical Surface("bottom") = {3}; Physical Surface("bottom") = {3};
Physical Surface("top") = {2}; Physical Surface("top") = {2};
Physical Volume("steel") = {1};
\ No newline at end of file
This diff is collapsed.
//+
SetFactory("OpenCASCADE"); SetFactory("OpenCASCADE");
Box(1) = {0, 0, 0, 1, 1, 1}; Box(1) = {0, 0, 0, 1, 1, 1};
//+
Physical Surface("top") = {6};
//+
Physical Surface("bottom") = {5}; Physical Surface("bottom") = {5};
Physical Surface("top") = {6};
Physical Volume("cube") = {1};
box1[] = Point{1};
Printf("this is text %g", box1[2]);
Mesh.MeshSizeMin = 1;
Mesh.MeshSizeMax = 1;
Mesh.SaveAll = 1;
Mesh.ElementOrder = 1;
Mesh 3;
Save "cube.msh";
$MeshFormat
4.1 0 8
$EndMeshFormat
$PhysicalNames
3
2 1 "bottom"
2 2 "top"
3 3 "cube"
$EndPhysicalNames
$Entities
8 12 6 1
1 0 0 1 0
2 0 0 0 0
3 0 1 1 0
4 0 1 0 0
5 1 0 1 0
6 1 0 0 0
7 1 1 1 0
8 1 1 0 0
1 -1e-07 -1e-07 -9.999999994736442e-08 1e-07 1e-07 1.0000001 0 2 2 -1
2 -1e-07 -9.999999994736442e-08 0.9999999000000001 1e-07 1.0000001 1.0000001 0 2 1 -3
3 -1e-07 0.9999999000000001 -9.999999994736442e-08 1e-07 1.0000001 1.0000001 0 2 4 -3
4 -1e-07 -9.999999994736442e-08 -1e-07 1e-07 1.0000001 1e-07 0 2 2 -4
5 0.9999999000000001 -1e-07 -9.999999994736442e-08 1.0000001 1e-07 1.0000001 0 2 6 -5
6 0.9999999000000001 -9.999999994736442e-08 0.9999999000000001 1.0000001 1.0000001 1.0000001 0 2 5 -7
7 0.9999999000000001 0.9999999000000001 -9.999999994736442e-08 1.0000001 1.0000001 1.0000001 0 2 8 -7
8 0.9999999000000001 -9.999999994736442e-08 -1e-07 1.0000001 1.0000001 1e-07 0 2 6 -8
9 -9.999999994736442e-08 -1e-07 -1e-07 1.0000001 1e-07 1e-07 0 2 2 -6
10 -9.999999994736442e-08 -1e-07 0.9999999000000001 1.0000001 1e-07 1.0000001 0 2 1 -5
11 -9.999999994736442e-08 0.9999999000000001 -1e-07 1.0000001 1.0000001 1e-07 0 2 4 -8
12 -9.999999994736442e-08 0.9999999000000001 0.9999999000000001 1.0000001 1.0000001 1.0000001 0 2 3 -7
1 -1e-07 -9.999999994736442e-08 -9.999999994736442e-08 1e-07 1.0000001 1.0000001 0 4 1 2 -3 -4
2 0.9999999000000001 -9.999999994736442e-08 -9.999999994736442e-08 1.0000001 1.0000001 1.0000001 0 4 5 6 -7 -8
3 -9.999999994736442e-08 -1e-07 -9.999999994736442e-08 1.0000001 1e-07 1.0000001 0 4 9 5 -10 -1
4 -9.999999994736442e-08 0.9999999000000001 -9.999999994736442e-08 1.0000001 1.0000001 1.0000001 0 4 11 7 -12 -3
5 -9.999999994736442e-08 -9.999999994736442e-08 -1e-07 1.0000001 1.0000001 1e-07 1 1 4 4 11 -8 -9
6 -9.999999994736442e-08 -9.999999994736442e-08 0.9999999000000001 1.0000001 1.0000001 1.0000001 1 2 4 2 12 -6 -10
1 -9.999999994736442e-08 -9.999999994736442e-08 -9.999999994736442e-08 1.0000001 1.0000001 1.0000001 1 3 6 1 2 3 4 5 6
$EndEntities
$Nodes
27 14 1 14
0 1 0 1
1
0 0 1
0 2 0 1
2
0 0 0
0 3 0 1
3
0 1 1
0 4 0 1
4
0 1 0
0 5 0 1
5
1 0 1
0 6 0 1
6
1 0 0
0 7 0 1
7
1 1 1
0 8 0 1
8
1 1 0
1 1 0 0
1 2 0 0
1 3 0 0
1 4 0 0
1 5 0 0
1 6 0 0
1 7 0 0
1 8 0 0
1 9 0 0
1 10 0 0
1 11 0 0
1 12 0 0
2 1 0 1
9
0 0.5 0.5
2 2 0 1
10
1 0.5 0.5
2 3 0 1
11
0.5 0 0.5
2 4 0 1
12
0.5 1 0.5
2 5 0 1
13
0.5 0.5 0
2 6 0 1
14
0.5 0.5 1
3 1 0 0
$EndNodes
$Elements
27 68 1 68
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 1
9 2 1
1 2 1 1
10 1 3
1 3 1 1
11 4 3
1 4 1 1
12 2 4
1 5 1 1
13 6 5
1 6 1 1
14 5 7
1 7 1 1
15 8 7
1 8 1 1
16 6 8
1 9 1 1
17 2 6
1 10 1 1
18 1 5
1 11 1 1
19 4 8
1 12 1 1
20 3 7
2 1 2 4
21 2 1 9
22 1 3 9
23 4 2 9
24 3 4 9
2 2 2 4
25 6 10 5
26 5 10 7
27 8 10 6
28 7 10 8
2 3 2 4
29 1 2 11
30 5 1 11
31 2 6 11
32 6 5 11
2 4 2 4
33 3 12 4
34 7 12 3
35 4 12 8
36 8 12 7
2 5 2 4
37 2 4 13
38 6 2 13
39 4 8 13
40 8 6 13
2 6 2 4
41 1 14 3
42 5 14 1
43 3 14 7
44 7 14 5
3 1 4 24
45 10 11 12 13
46 9 12 14 11
47 12 14 11 10
48 9 12 11 13
49 2 9 1 11
50 1 9 3 14
51 11 14 1 5
52 4 9 12 3
53 2 4 9 13
54 12 3 14 7
55 5 10 14 7
56 7 10 12 8
57 11 10 5 6
58 12 4 8 13
59 13 8 10 6
60 13 11 2 6
61 14 1 9 11
62 9 12 3 14
63 11 2 9 13
64 12 9 4 13
65 8 10 12 13
66 14 11 10 5
67 12 14 10 7
68 13 10 11 6
$EndElements
material elastic [
name = steel
rho = 7800 # density
E = 210e6 # young's modulus
nu = 0.3 # poisson's ratio
]
\ No newline at end of file
%% Cell type:code id:1dbbab78-6ef1-4e97-8440-f6db326755e9 tags: %% Cell type:code id:3a4b7e63-10d0-4af2-bc97-5360ea402ff5 tags:
``` python ``` python
import akantu as aka
import numpy as np import numpy as np
import pygmsh import akantu as aka
# 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: %% Cell type:code id:91261137-56d5-49b9-b386-dfb54d40da2a tags:
``` python ``` python
# reading the mesh # import subprocess
spatial_dimension = 3
mesh_file = 'shell_cyl_2.msh' # ret = subprocess.run("gmsh -3 -order 1 -o out.msh in.geo", shell=True)
mesh = aka.Mesh(spatial_dimension) # if ret.returncode:
mesh.read(mesh_file) # print("Beware, gmsh could not run: mesh is not regenerated")
# else:
# print("Mesh generated")
``` ```
%% Cell type:code id:ac11734f-f415-43aa-a1a3-92edca236554 tags: %% Cell type:code id:c1339e28-e6b1-4155-b25e-f3b848025838 tags:
``` python ``` python
material_file = """ material_file = """
material elastic [ material elastic [
name = steel name = steel
rho = 1 # density rho = 7800 # density
E = 1 # young's modulus E = 210e6 # young's modulus
nu = 0.3 # poisson's ratio nu = 0.3 # poisson's ratio
]""" ]"""
# writing the material file # writing the material file
open('material.dat', 'w').write(material_file) open('material.dat', 'w').write(material_file)
#reading the material file #reading the material file
material_file = 'material.dat' material_file = 'material.dat'
```
%% Cell type:code id:30c1bb68-80b2-41ea-9aa6-a08daf741c9b tags:
``` python
aka.parseInput(material_file) aka.parseInput(material_file)
# creating the solid mechanics model spatial_dimension = 3
model = aka.SolidMechanicsModel(mesh) mesh = aka.Mesh(spatial_dimension)
mesh.read('cube.msh')
# initialize a static solver model = aka.SolidMechanicsModel(mesh)
model.initFull(_analysis_method=aka._static) model.initFull(_analysis_method=aka._static)
``` ```
%% Cell type:code id:e2379428-0b40-406f-bfed-160eb297f730 tags: %% Cell type:code id:9bb306b5-2e9c-4b3e-aaeb-347e7a1ee5f8 tags:
``` python ``` 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]: for dir in [aka._x, aka._y, aka._z]:
model.applyBC(aka.FixedValue(0, dir), "bottom") model.applyBC(aka.FixedValue(0.0, dir), "bottom")
# set the force/Neumann boundary conditions
trac = np.eye(3) # Newtons/m^2
trac = [0,0,1]
# trac = np.eye(3)
trac = [0, 0, 1e8]
model.applyBC(aka.FromTraction(trac), "top") model.applyBC(aka.FromTraction(trac), "top")
np.set_printoptions(threshold=10)
``` ```
%% Cell type:code id:6d82b932-ca93-45eb-8e3e-c0ec2c24f381 tags: %% Cell type:code id:4d56ac9e-37db-48d3-8366-f8f8cb000bb6 tags:
``` python ``` python
np.set_printoptions(threshold=20) steel = model.getMaterial('steel')
steel
model.getExternalForce()[:]
# np.size(model.getExternalForce(),0)
# model.getBlockedDOFs()
``` ```
%%%% Output: execute_result %%%% Output: execute_result
array([[0., 0., 0.], <py11_akantu.Material at 0x7f2145e75730>
[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: %% Cell type:code id:845b08f6-cda8-4a72-8fa0-f1ba47fb432f tags:
``` python ``` python
# configure the linear algebra solver
solver = model.getNonLinearSolver() solver = model.getNonLinearSolver()
solver.set("max_iterations", 3) solver.set("max_iterations", 6)
solver.set("threshold", 1e-8) solver.set("threshold", 1e-8)
solver.set("convergence_type", aka.SolveConvergenceCriteria.residual) solver.set("convergence_type", aka.SolveConvergenceCriteria.residual)
# compute the solution
model.solveStep() model.solveStep()
```
u = model.getDisplacement() %% Cell type:code id:2a96374a-1ade-42cf-8024-69c1dd27f02e tags:
np.set_printoptions(threshold=120)
u ``` python
mesh.getConnectivity(aka._tetrahedron_4)
stress_field = model.getMaterial(0).getStress(aka._tetrahedron_4)
np.set_printoptions(threshold=100)
stress_field
mesh.getNbElement()
``` ```
%%%% Output: execute_result %%%% Output: execute_result
array([[0., 0., 0.], 24
[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: %% Cell type:code id:23e23201-534c-4b3b-8121-6f8504b57243 tags:
``` python
np.argmax(stress_field,0)
np.size(stress_field,0)
stress_normal = stress_field[:,(0,4,8)]
np.size(stress_normal,0)
```
%% Cell type:code id:60a70c37-31bf-48bf-a4ac-8333abd62e93 tags:
``` python ``` python
# specify what field to output into paraview files # specify what field to output into paraview files
model.setBaseName("shell_cyl") model.setBaseName("cube")
model.addDumpFieldVector("displacement") model.addDumpFieldVector("displacement")
model.addDumpFieldVector("external_force") model.addDumpFieldVector("external_force")
model.addDumpField("strain") model.addDumpField("strain")
model.addDumpField("stress") model.addDumpField("stress")
model.addDumpField("blocked_dofs") model.addDumpField("blocked_dofs")
# generate paraview files
model.dump() model.dump()
``` ```
%%%% Output: error %% Cell type:code id:ac9c3e33-7117-4809-a433-3e7fef3a3344 tags:
--------------------------------------------------------------------------- ``` python
Exception Traceback (most recent call last) import pyvista as pv
<ipython-input-7-254e5de967ab> in <module>
8 p = pv.Plotter(off_screen=False, notebook=False)
9 # generate paraview files p.background_color = 'white'
---> 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] cyl_msh = pv.read(f'paraview/cube_{0:04d}.pvtu')
cyl_msh.set_active_scalars('displacement')
cyl_warped = cyl_msh.warp_by_vector('displacement')
cyl_warped.set_active_scalars('displacement')
cyl_warped.plot()
```
%% Cell type:code id:b9caba6a-e863-495b-989c-fd3bc3cf44ab tags: %% Cell type:code id:738e4f52-bea5-4ae3-9454-2456af57c208 tags:
``` python ``` python
``` ```
......
This diff is collapsed.
SetFactory("OpenCASCADE");
ra = 0.5; ri = 0.45; h = 1;
Cylinder(1) = {0, 0, 0, 0, 0, h, ra, 2*Pi};
Cylinder(2) = {0, 0, 0, 0, 0, h, ri, 2*Pi};
vol[] = BooleanDifference{ Volume{1}; Delete; }{ Volume{2}; Delete; };
Physical Volume("body") = {vol[0]};
Physical Surface("inside") = {4};
Physical Surface("bottom") = {7};
Physical Point("fixpoint") = {6};
Mesh.MeshSizeMin = 0.05;
Mesh.MeshSizeMax = 0.1;
Mesh.SaveAll = 1;
Mesh.ElementOrder = 2;
// Mesh 3;
Save "hollow_cylinder.msh";
This diff is collapsed.
$MeshFormat
4.1 0 8
$EndMeshFormat
$PhysicalNames
4
0 4 "fixpoint"
2 2 "inside"
2 3 "bottom"
3 1 "body"
$EndPhysicalNames
$Entities
4 6 4 1
3 0.45 -1.102182119232618e-16 1 0
4 0.45 -1.102182119232618e-16 0 0
5 0.5 -1.224646799147353e-16 1 0
6 0.5 -1.224646799147353e-16 0 1 4
4 -0.4500001 -0.4500001 0.9999999000000001 0.4500001 0.4500001 1.0000001 0 2 3 -3
5 0.4499999 -1.000000001102182e-07 -9.999999994736442e-08 0.4500001 9.999999988978178e-08 1.0000001 0 2 4 -3
6 -0.4500001 -0.4500001 -1e-07 0.4500001 0.4500001 1e-07 0 2 4 -4
7 -0.5000000999999999 -0.5000000999999999 0.9999999000000001 0.5000000999999999 0.5000000999999999 1.0000001 0 2 5 -5
8 0.4999999 -1.000000001224647e-07 -9.999999994736442e-08 0.5000000999999999 9.999999987753531e-08 1.0000001 0 2 6 -5
9 -0.5000000999999999 -0.5000000999999999 -1e-07 0.5000000999999999 0.5000000999999999 1e-07 0 2 6 -6
4 -0.4500001 -0.4500001 -9.999999994736442e-08 0.4500001 0.4500001 1.0000001 1 2 4 4 -5 6 5
5 -0.5000000999999999 -0.5000000999999999 -9.999999994736442e-08 0.5000000999999999 0.5000000999999999 1.0000001 0 4 7 -8 9 8
6 -0.5000000999999999 -0.5000000999999999 0.9999999000000001 0.5000000999999999 0.5000000999999999 1.0000001 0 2 7 4
7 -0.5000000999999999 -0.5000000999999999 -1e-07 0.5000000999999999 0.5000000999999999 1e-07 1 3 2 9 6
1 -0.5000000999999999 -0.5000000999999999 -9.999999994736442e-08 0.5000000999999999 0.5000000999999999 1.0000001 1 1 4 5 6 7 4
$EndEntities
material elastic [
name = steel
rho = 7800 # density
E = 1e3 # young's modulus
nu = 0.3 # poisson's ratio
]
\ No newline at end of file
{
"cells": [],
"metadata": {},
"nbformat": 4,
"nbformat_minor": 5
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
{
"cells": [],
"metadata": {},
"nbformat": 4,
"nbformat_minor": 5
}
material elastic [
name = polymer
rho = 1000 # density
E = 1e5 # young's modulus
nu = 0.3 # poisson's ratio
]
\ No newline at end of file
SetFactory("OpenCASCADE");
length = 3; height = 2; t_w = 0.2;
t_r = 0.2; l_r = 0.7000000000000001; dist = 1.0;
Box(1) = {0, 0, 0, length, t_w, height};
Box(2) = {0.0-t_r/2, 0, 0, t_r, l_r, height};
Box(3) = {1.0-t_r/2, 0, 0, t_r, l_r, height};
Box(4) = {2.0-t_r/2, 0, 0, t_r, l_r, height};
Box(5) = {3.0-t_r/2, 0, 0, t_r, l_r, height};
vol[] = BooleanUnion { Volume{1}; Delete; } { Volume{2}; Volume{3}; Volume{4}; Volume{5}; Delete; };
Printf('%g', vol[0]);
Physical Volume("Volume") = {vol[0]};
Physical Surface("front") = {1};
Physical Surface("bottom") = {2};
Physical Point("fixpoint") = {1};
Mesh.MeshSizeMin = 0.02;
Mesh.MeshSizeMax = 0.2;
Mesh.SaveAll = 1;
Mesh.ElementOrder = 2;
Mesh 3;
Save "test.msh";
\ No newline at end of file