Skip to content

Commit e7778b8

Browse files
authored
Merge pull request #8 from perebalazs/CoordinateSystems
Coordinate systems
2 parents f0cd5f3 + 2457589 commit e7778b8

File tree

12 files changed

+1117
-28
lines changed

12 files changed

+1117
-28
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "LowLevelFEM"
22
uuid = "6171b9fb-adbf-4751-adb9-5faded75de07"
33
authors = ["Balázs Pere"]
4-
version = "1.6.3"
4+
version = "1.7.0"
55

66
[deps]
77
Arpack = "7d9fca2a-8960-54d3-9f78-7d1dccf2cb97"

README.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,14 @@ The above described steps can be easily performed using the LowLevelFEM package.
3636
- Giving displacement constraints as functions
3737
- Different materials on each physical group
3838
- Solves stress, stain and heat flux field as element result (possibly jumps at the element boundaries) or as nodal results.
39-
- Resultant of "load vector" type quantities on arbitrary physical group (in GMSH).
39+
- Resultant of "load vector" type quantities on arbitrary physical group (in [GMSH](https://gmsh.info)).
4040
- Applying initial conditions (displacement and velocity) on arbitrary points, edges, surfaces, volumes and on combinations of them.
4141
- Solution of static and dynamic (transient with central difference method, Newmark and HHT-α) problems,
4242
- Displaying the results (scalar or vector displacements, scalar or tensor stresses and strains) with [GMSH](https://gmsh.info).
43-
- When dynamic problems are solved animations are also possible (click on $\triangleright$).
43+
44+
- When dynamic problems are solved animations are also possible (click on $\triangleright$).
45+
- Rotation of nodal coordinate systems using transformation matrix. Transformation matrix can be given with constant direction vectors or with functions. (With this arbitrary coordinate systems can be defined.)
46+
4447
- Plotting arbitrary results on paths.
4548
- Solves the damping matrix of structures in case of proportional damping
4649

@@ -70,14 +73,11 @@ The above described steps can be easily performed using the LowLevelFEM package.
7073
- [ ] in 3D,
7174
- [ ] with penalty method
7275
- [ ] with Lagrange multiplier method.
73-
- [ ] Defining and using coordinate systems,
74-
75-
- [ ] cartesian at arbitrary position and arbitrary orientation,
76-
- [ ] cylindrical.
7776
- [ ] Defining displacement initial condition as a function of x, y and z.
7877
- [ ] Defining velocity initial condition as a function of x, y and z.
7978
- [ ] Transient problems in heat conduction.
80-
- [ ] Finite deformations.
79+
- [ ] Finite rotations.
80+
- [ ] Plastic deformation (within small strain theory).
8181
- [ ] Linear buckling.
8282

8383
Any suggestions are welcome.
@@ -118,9 +118,9 @@ sx = FEM.showStressResults(problem, S, "sx", name="σx", visible=false, smooth=t
118118
sy = FEM.showStressResults(problem, S, "sy", name="σy", visible=false, smooth=true)
119119
sxy = FEM.showStressResults(problem, S, "sxy", name="τxy", visible=false, smooth=true)
120120

121-
FEM.plotOnPath(problem, "path", sx, 100, name="σx", visible=false);
122-
FEM.plotOnPath(problem, "path", sxy, 100, name="τxy", visible=false);
123-
FEM.plotOnPath(problem, "path", ux, 100, name="ux", visible=false);
121+
FEM.plotOnPath(problem, "path", sx, name="σx", visible=false);
122+
FEM.plotOnPath(problem, "path", sxy, name="τxy", visible=false);
123+
FEM.plotOnPath(problem, "path", ux, name="ux", visible=false);
124124

125125
gmsh.fltk.run()
126126
gmsh.finalize()
@@ -193,9 +193,9 @@ sxy = FEM.showStressResults(problem, S, "sxy", name="τxy", visible=false, smoot
193193
syz = FEM.showStressResults(problem, S, "syz", name="τyz", visible=false, smooth=true)
194194
szx = FEM.showStressResults(problem, S, "szx", name="τzx", visible=false, smooth=true)
195195

196-
FEM.plotOnPath(problem, "path", sx, 100, name="σx", visible=false);
197-
FEM.plotOnPath(problem, "path", sxy, 100, name="τxy", visible=false);
198-
FEM.plotOnPath(problem, "path", ux, 100, name="ux", visible=false);
196+
FEM.plotOnPath(problem, "path", sx, name="σx", visible=false);
197+
FEM.plotOnPath(problem, "path", sxy, name="τxy", visible=false);
198+
FEM.plotOnPath(problem, "path", ux, name="ux", visible=false);
199199

200200
gmsh.fltk.run()
201201
gmsh.finalize()

docs/src/Examples.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ sx = FEM.showStressResults(problem, S, "sx", name="σx", visible=false, smooth=t
3737
sy = FEM.showStressResults(problem, S, "sy", name="σy", visible=false, smooth=true)
3838
sxy = FEM.showStressResults(problem, S, "sxy", name="τxy", visible=false, smooth=true)
3939

40-
FEM.plotOnPath(problem, "path", sx, 100, name="σx", visible=false);
41-
FEM.plotOnPath(problem, "path", sxy, 100, name="τxy", visible=false);
42-
FEM.plotOnPath(problem, "path", ux, 100, name="ux", visible=false);
40+
FEM.plotOnPath(problem, "path", sx, name="σx", visible=false);
41+
FEM.plotOnPath(problem, "path", sxy, name="τxy", visible=false);
42+
FEM.plotOnPath(problem, "path", ux, name="ux", visible=false);
4343

4444
gmsh.fltk.run()
4545
gmsh.finalize()
@@ -112,9 +112,9 @@ sxy = FEM.showStressResults(problem, S, "sxy", name="τxy", visible=false, smoot
112112
syz = FEM.showStressResults(problem, S, "syz", name="τyz", visible=false, smooth=true)
113113
szx = FEM.showStressResults(problem, S, "szx", name="τzx", visible=false, smooth=true)
114114

115-
FEM.plotOnPath(problem, "path", sx, 100, name="σx", visible=false);
116-
FEM.plotOnPath(problem, "path", sxy, 100, name="τxy", visible=false);
117-
FEM.plotOnPath(problem, "path", ux, 100, name="ux", visible=false);
115+
FEM.plotOnPath(problem, "path", sx, name="σx", visible=false);
116+
FEM.plotOnPath(problem, "path", sxy, name="τxy", visible=false);
117+
FEM.plotOnPath(problem, "path", ux, name="ux", visible=false);
118118

119119
gmsh.fltk.run()
120120
gmsh.finalize()
@@ -195,7 +195,7 @@ sxy = FEM.showStressResults(problem, S, "sxy", name="τxy", visible=false, smoot
195195
syz = FEM.showStressResults(problem, S, "syz", name="τyz", visible=false, smooth=true)
196196
szx = FEM.showStressResults(problem, S, "szx", name="τzx", visible=false, smooth=true)
197197

198-
FEM.plotOnPath(problem, "path", s, 100, name="σred", visible=false);
198+
FEM.plotOnPath(problem, "path", s, name="σred", visible=false);
199199

200200
gmsh.fltk.run()
201201
gmsh.finalize()

docs/src/index.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,13 @@ The above described steps can be easily performed using the LowLevelFEM package.
3333
- Giving displacement constraints as functions
3434
- Different materials on each physical group
3535
- Solves stress, stain and heat flux field as element result (possibly jumps at the element boundaries) or as nodal results.
36-
- Resultant of "load vector" type quantities on arbitrary physical group (in GMSH).
36+
- Resultant of "load vector" type quantities on arbitrary physical group (in [GMSH](https://gmsh.info)).
3737
- Applying initial conditions (displacement and velocity) on arbitrary points, edges, surfaces, volumes and on combinations of them.
3838
- Solution of static and dynamic (transient with central difference method, Newmark and HHT-α) problems,
3939
- Displaying the results (scalar or vector displacements, scalar or tensor stresses and strains) with [GMSH](https://gmsh.info).
40-
- When dynamic problems are solved animations are also possible (click on $\triangleright$).
40+
41+
- When dynamic problems are solved animations are also possible (click on $\triangleright$).
42+
- Rotation of nodal coordinate systems using transformation matrix. Transformation matrix can be given with constant direction vectors or with functions. (With this arbitrary coordinate systems can be defined.)
4143
- Plotting arbitrary results on paths.
4244
- Solves the damping matrix of structures in case of proportional damping
4345
- using Rayleigh-damping (**C****M****K**) or
@@ -66,14 +68,11 @@ The above described steps can be easily performed using the LowLevelFEM package.
6668
- [ ] in 3D,
6769
- [ ] with penalty method
6870
- [ ] with Lagrange multiplier method.
69-
- [ ] Defining and using coordinate systems,
70-
71-
- [ ] cartesian at arbitrary position and arbitrary orientation,
72-
- [ ] cylindrical.
7371
- [ ] Defining displacement initial condition as a function of x, y and z.
7472
- [ ] Defining velocity initial condition as a function of x, y and z.
7573
- [ ] Transient problems in heat conduction.
76-
- [ ] Finite deformations.
74+
- [ ] Finite rotations.
75+
- [ ] Plastic deformation (within small strain theory).
7776
- [ ] Linear buckling.
7877

7978
Any suggestions are welcome.

examples/HeatConduction/house.ipynb

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -613,6 +613,26 @@
613613
"source": [
614614
"gmsh.finalize()"
615615
]
616+
},
617+
{
618+
"cell_type": "code",
619+
"execution_count": null,
620+
"metadata": {},
621+
"outputs": [
622+
{
623+
"data": {
624+
"text/plain": [
625+
"14"
626+
]
627+
},
628+
"metadata": {},
629+
"output_type": "display_data"
630+
}
631+
],
632+
"source": [
633+
"e = [1, 2, 3]\n",
634+
"e * e'\n"
635+
]
616636
}
617637
],
618638
"metadata": {
Lines changed: 198 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,198 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": null,
6+
"metadata": {},
7+
"outputs": [],
8+
"source": [
9+
"import LowLevelFEM as FEM\n",
10+
"using LowLevelFEM\n",
11+
"\n",
12+
"gmsh.initialize()"
13+
]
14+
},
15+
{
16+
"cell_type": "code",
17+
"execution_count": null,
18+
"metadata": {},
19+
"outputs": [],
20+
"source": [
21+
"gmsh.open(\"test-twist.geo\")"
22+
]
23+
},
24+
{
25+
"cell_type": "code",
26+
"execution_count": null,
27+
"metadata": {},
28+
"outputs": [],
29+
"source": [
30+
"#gmsh.fltk.run()"
31+
]
32+
},
33+
{
34+
"cell_type": "code",
35+
"execution_count": null,
36+
"metadata": {},
37+
"outputs": [],
38+
"source": [
39+
"mat = FEM.material(\"body\", E=2e5, ν=0.3, ρ=7.85e-9)\n",
40+
"problem = FEM.Problem([mat], type=\"Solid\")"
41+
]
42+
},
43+
{
44+
"cell_type": "code",
45+
"execution_count": null,
46+
"metadata": {},
47+
"outputs": [],
48+
"source": [
49+
"K = FEM.stiffnessMatrix(problem)"
50+
]
51+
},
52+
{
53+
"cell_type": "markdown",
54+
"metadata": {},
55+
"source": [
56+
"10.7s"
57+
]
58+
},
59+
{
60+
"cell_type": "code",
61+
"execution_count": null,
62+
"metadata": {},
63+
"outputs": [],
64+
"source": [
65+
"e2y(x, y, z) = -z#√(y^2 + z^2) * cos(atan(y, z))\n",
66+
"e2z(x, y, z) = y#-√(y^2 + z^2) * sin(atan(y, z))\n",
67+
"csys = FEM.CoordinateSystem([1, 0, 0], [0, e2y, e2z])"
68+
]
69+
},
70+
{
71+
"cell_type": "code",
72+
"execution_count": null,
73+
"metadata": {},
74+
"outputs": [],
75+
"source": [
76+
"T = FEM.rotateNodes(problem, \"body\", csys)"
77+
]
78+
},
79+
{
80+
"cell_type": "markdown",
81+
"metadata": {},
82+
"source": [
83+
"31.6s"
84+
]
85+
},
86+
{
87+
"cell_type": "code",
88+
"execution_count": null,
89+
"metadata": {},
90+
"outputs": [],
91+
"source": [
92+
"fc(x, y, z) = √(y^2 + z^2)\n",
93+
"load = FEM.load(\"load\", fy=fc, fx=20)"
94+
]
95+
},
96+
{
97+
"cell_type": "code",
98+
"execution_count": null,
99+
"metadata": {},
100+
"outputs": [],
101+
"source": [
102+
"KK = T' * K * T"
103+
]
104+
},
105+
{
106+
"cell_type": "code",
107+
"execution_count": null,
108+
"metadata": {},
109+
"outputs": [],
110+
"source": [
111+
"f = FEM.loadVector(problem, [load])"
112+
]
113+
},
114+
{
115+
"cell_type": "code",
116+
"execution_count": null,
117+
"metadata": {},
118+
"outputs": [],
119+
"source": [
120+
"supp = FEM.displacementConstraint(\"supp\", ux=0, uy=0);"
121+
]
122+
},
123+
{
124+
"cell_type": "code",
125+
"execution_count": null,
126+
"metadata": {},
127+
"outputs": [],
128+
"source": [
129+
"FEM.applyBoundaryConditions!(problem, KK, f, [supp]);"
130+
]
131+
},
132+
{
133+
"cell_type": "code",
134+
"execution_count": null,
135+
"metadata": {},
136+
"outputs": [],
137+
"source": [
138+
"q = FEM.solveDisplacement(KK, f)"
139+
]
140+
},
141+
{
142+
"cell_type": "code",
143+
"execution_count": null,
144+
"metadata": {},
145+
"outputs": [],
146+
"source": [
147+
"u = FEM.showDoFResults(problem, q, \"uvec\", visible=true)\n",
148+
"ux = FEM.showDoFResults(problem, q, \"ux\")\n",
149+
"uy = FEM.showDoFResults(problem, q, \"uy\")\n",
150+
"uz = FEM.showDoFResults(problem, q, \"uz\")"
151+
]
152+
},
153+
{
154+
"cell_type": "code",
155+
"execution_count": null,
156+
"metadata": {},
157+
"outputs": [],
158+
"source": [
159+
"gmsh.fltk.run()"
160+
]
161+
},
162+
{
163+
"cell_type": "code",
164+
"execution_count": null,
165+
"metadata": {},
166+
"outputs": [],
167+
"source": [
168+
"gmsh.finalize()"
169+
]
170+
},
171+
{
172+
"cell_type": "code",
173+
"execution_count": null,
174+
"metadata": {},
175+
"outputs": [],
176+
"source": [
177+
"using SparseArrays\n",
178+
"cb(x, y) = y\n",
179+
"a = sparse([1, 2, 3, 1], [3, 1, 2, 3], [1, 1, 1, 2], 3, 3, cb)"
180+
]
181+
}
182+
],
183+
"metadata": {
184+
"kernelspec": {
185+
"display_name": "Julia 1.11.1",
186+
"language": "julia",
187+
"name": "julia-1.11"
188+
},
189+
"language_info": {
190+
"file_extension": ".jl",
191+
"mimetype": "application/julia",
192+
"name": "julia",
193+
"version": "1.11.1"
194+
}
195+
},
196+
"nbformat": 4,
197+
"nbformat_minor": 2
198+
}

0 commit comments

Comments
 (0)