To receive notifications about scheduled maintenance, please subscribe to the mailing-list gitlab-operations@sympa.ethz.ch. You can subscribe to the mailing-list at https://sympa.ethz.ch

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");
//+
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("top") = {2};
Physical Volume("steel") = {1};
\ No newline at end of file
This diff is collapsed.
//+
SetFactory("OpenCASCADE");
Box(1) = {0, 0, 0, 1, 1, 1};
//+
Physical Surface("top") = {6};
//+
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
 
 
"cells": [
{
"cell_type": "code",
"cell_type": "code",
"id": "1dbbab78-6ef1-4e97-8440-f6db326755e9",
"metadata": {},
"outputs": [],
"source": [
"import akantu as aka\n",
"import numpy as np\n",
"import pygmsh\n",
"\n",
"execution_count": 1,
"id": "3a4b7e63-10d0-4af2-bc97-5360ea402ff5",
"metadata": {},
 
 
"source": [
"import numpy as np\n",
"plt.rcParams['figure.figsize'] = [10, 10]"
]
},
{
"cell_type": "code",
"import akantu as aka"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "91261137-56d5-49b9-b386-dfb54d40da2a",
"metadata": {},
"outputs": [],
 
 
"# import subprocess\n",
"\n",
"# ret = subprocess.run(\"gmsh -3 -order 1 -o out.msh in.geo\", shell=True)\n",
"# if ret.returncode:\n",
"# print(\"Beware, gmsh could not run: mesh is not regenerated\")\n",
"mesh.read(mesh_file)\n"
 
"# else:\n",
"# print(\"Mesh generated\")"
]
},
"cell_type": "code",
{
"cell_type": "code",
"execution_count": 3,
"id": "c1339e28-e6b1-4155-b25e-f3b848025838",
"metadata": {},
"outputs": [],
"source": [
"material_file = \"\"\"\n",
"material elastic [\n",
" name = steel\n",
" rho = 7800 # density\n",
"material elastic [\n",
" name = steel\n",
" E = 210e6 # young's modulus\n",
" nu = 0.3 # poisson's ratio\n",
"]\"\"\"\n",
"# writing the material file\n",
" E = 1 # young's modulus\n",
"open('material.dat', 'w').write(material_file)\n",
"#reading the material file\n",
"material_file = 'material.dat'"
]
"# writing the material file\n",
 
{
"cell_type": "code",
"material_file = 'material.dat'\n",
"aka.parseInput(material_file)\n",
"\n",
"execution_count": 4,
"model = aka.SolidMechanicsModel(mesh)\n",
"\n",
"# initialize a static solver\n",
"model.initFull(_analysis_method=aka._static)"
]
},
{
"cell_type": "code",
"id": "30c1bb68-80b2-41ea-9aa6-a08daf741c9b",
"metadata": {},
"outputs": [],
"source": [
"aka.parseInput(material_file)\n",
"\n",
"spatial_dimension = 3\n",
"mesh = aka.Mesh(spatial_dimension)\n",
"mesh.read('cube.msh')\n",
"# Bottom ring 'bottom', top ring 'top', cylinder surface 'surface'\n",
 
"model = aka.SolidMechanicsModel(mesh)\n",
"model.initFull(_analysis_method=aka._static)"
"for dir in [aka._x, aka._y, aka._z]:\n",
" model.applyBC(aka.FixedValue(0, dir), \"bottom\")\n",
"\n",
"\n",
"\n",
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "9bb306b5-2e9c-4b3e-aaeb-347e7a1ee5f8",
"\n",
"model.applyBC(aka.FromTraction(trac), \"top\")\n"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [],
 
 
"for dir in [aka._x, aka._y, aka._z]:\n",
" model.applyBC(aka.FixedValue(0.0, dir), \"bottom\")\n",
"data": {
"\n",
"array([[0., 0., 0.],\n",
 
"trac = [0, 0, 1e8]\n",
"model.applyBC(aka.FromTraction(trac), \"top\")\n",
"np.set_printoptions(threshold=10)\n"
" [0., 0., 0.],\n",
]
},
{
]
},
"execution_count": 5,
"cell_type": "code",
"execution_count": 6,
"id": "4d56ac9e-37db-48d3-8366-f8f8cb000bb6",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<py11_akantu.Material at 0x7f2145e75730>"
]
},
"execution_count": 6,
"source": [
"np.set_printoptions(threshold=20)\n",
"\n",
"model.getExternalForce()[:]\n",
"# np.size(model.getExternalForce(),0)\n",
"# model.getBlockedDOFs()"
]
"metadata": {},
"output_type": "execute_result"
{
}
],
"source": [
"steel = model.getMaterial('steel')\n",
"steel"
]
},
{
"cell_type": "code",
"execution_count": 7,
"id": "845b08f6-cda8-4a72-8fa0-f1ba47fb432f",
"metadata": {},
"outputs": [],
"metadata": {},
 
"solver = model.getNonLinearSolver()\n",
"solver.set(\"max_iterations\", 6)\n",
"solver.set(\"threshold\", 1e-8)\n",
"solver.set(\"convergence_type\", aka.SolveConvergenceCriteria.residual)\n",
"\n",
"model.solveStep()"
" [0., 0., 0.],\n",
]
},
{
" [0., 0., 0.]])"
"cell_type": "code",
"execution_count": 10,
"id": "2a96374a-1ade-42cf-8024-69c1dd27f02e",
"metadata": {},
"outputs": [
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
{
"data": {
"text/plain": [
"# configure the linear algebra solver\n",
"24"
]
},
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"solver.set(\"max_iterations\", 3)\n",
"mesh.getConnectivity(aka._tetrahedron_4)\n",
"stress_field = model.getMaterial(0).getStress(aka._tetrahedron_4)\n",
"np.set_printoptions(threshold=100)\n",
"stress_field\n",
"mesh.getNbElement()"
......
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
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment