Skip to content

Commit 12b9899

Browse files
committed
Added: Regression test (Snail) for self-interconnection.
Replace two obsolete python scripts by a new one based on SpliPy.
1 parent 71bfb7b commit 12b9899

7 files changed

Lines changed: 194 additions & 32 deletions

File tree

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,7 @@ ifem_add_regression_test(
231231
Linear/RectPlate-modal.reg
232232
Linear/ScordelisLo-p4-4x4.reg
233233
Linear/ScordelisLo-symm-p4-2x2.reg
234+
Linear/Snail-p1.reg
234235
Linear/SquarePlate-Lagrange.reg
235236
Linear/SquarePlate-Spectral.reg
236237
Linear/SquarePlate-Splines.reg

Test/Linear/Snail-p1.reg

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
Snail-p1.xinp
2+
3+
Input file: Snail-p1.xinp
4+
Equation solver: 2
5+
Number of Gauss points: 4
6+
Basis function values are precalculated but not cached
7+
Evaluation time for property functions: 1
8+
Solution component output zero tolerance: 1e-06
9+
Parsing input file Snail-p1.xinp
10+
Parsing <geometry>
11+
Parsing <patchfile>
12+
Reading data file snail-p1.g2
13+
Reading patch 1
14+
Parsing <topologysets>
15+
Topology sets: fixed (1,1,4D)
16+
loaded (1,2,1D)
17+
Parsing <coupling>
18+
Parsing <patchfile>
19+
Parsing <topologysets>
20+
Parsing <coupling>
21+
Parsing <coupling>
22+
Parsed 11 nodal couplings for Patch 1 (tolerance = 0.001)
23+
Parsing <boundaryconditions>
24+
Parsing <dirichlet>
25+
Dirichlet code 12: (fixed)
26+
Parsing <neumann>
27+
Neumann code 1000000 direction 2: -1e+09
28+
Parsing input file succeeded.
29+
Equation solver: 2
30+
Number of Gauss points: 4
31+
Basis function values are precalculated but not cached
32+
Problem definition:
33+
Elasticity: 2D, gravity = 0 0
34+
LinIsotropic: E = 2.05e+11, nu = 0.29, rho = 7850, alpha = 1.2e-07
35+
Node sets in patch P1: 1
36+
"fixed": 10 \[22,31]
37+
Resolving Dirichlet boundary conditions
38+
Constraining P1 in direction(s) 12
39+
>>> SAM model summary <<<
40+
Number of elements 20
41+
Number of nodes 42
42+
Number of dofs 62
43+
Number of unknowns 42
44+
Number of quadrature points 320 4
45+
Processing integrand associated with code 0
46+
Assembling interior matrix terms for P1
47+
Assembling Neumann matrix terms for boundary 2 on P1
48+
Done.
49+
Sum external load : 0 -1e+09 0
50+
Solving the equation system ...
51+
Condition number: 222.244
52+
>>> Solution summary <<<
53+
L2-norm : 0.00334349
54+
Max X-displacement : 0.00445524
55+
Max Y-displacement : 0.0186845
56+
Projecting secondary solution ...
57+
Greville point projection
58+
Integrating solution norms (FE solution) ...
59+
Energy norm |u^h| = a(u^h,u^h)^0.5 : 3747.16
60+
External energy ((f,u^h)+(t,u^h)^0.5 : 3747.16
61+
>>> Error estimates based on Greville point projection <<<
62+
Energy norm |u^r| = a(u^r,u^r)^0.5 : 3589.92
63+
Error norm a(e,e)^0.5, e=u^r-u^h : 2246.41
64+
relative error (% of |u^r|) : 62.5755
65+
L2-norm |s^r| = (s^r,s^r)^0.5 : 1.41287e+09
66+
L2-error (e,e)^0.5, e=s^r-s^h : 1.08843e+09
67+
relative error (% of |s^r|) : 77.0364

Test/Linear/Snail-p1.xinp

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
2+
3+
<!-- 2D helix with self-interconnection. !-->
4+
5+
<simulation>
6+
7+
<geometry dim="2">
8+
<patchfile>snail-p1.g2</patchfile>
9+
<topologysets>
10+
<set name="fixed" type="nodes">
11+
<item patch="1">22:31</item>
12+
</set>
13+
<set name="loaded" type="edge">
14+
<item patch="1">2</item>
15+
</set>
16+
</topologysets>
17+
<coupling patch="1" xtol="0.001">
18+
32 1 1.0 \
19+
33 2 1.0 \
20+
34 3 1.0 \
21+
35 4 1.0 \
22+
36 5 1.0 \
23+
37 6 1.0 \
24+
38 7 1.0 \
25+
39 8 1.0 \
26+
40 9 1.0 \
27+
41 10 1.0 \
28+
42 11 1.0
29+
</coupling>
30+
</geometry>
31+
32+
<boundaryconditions>
33+
<dirichlet set="fixed" comp="12"/>
34+
<neumann set="loaded" direction="2">-1.0e9</neumann>
35+
</boundaryconditions>
36+
37+
</simulation>

Test/Linear/annulus.py

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,28 @@
1-
from GoTools import *
2-
from GoTools.CurveFactory import *
3-
from GoTools.SurfaceFactory import *
4-
from math import *
5-
6-
SetFinalOutput("annulus.g2")
1+
import splipy.curve_factory as CurveFactory
2+
import splipy.surface_factory as SurfaceFactory
3+
import splipy.volume_factory as VolumeFactory
4+
from splipy.io import G2
5+
from math import pi
6+
from sys import argv
77

88
r1 = 5
99
r2 = 7
10+
H = 1
1011

11-
inner = CircleSegment([0,0,0],[-r1,0,0],pi,[0,0,1])
12-
outer = CircleSegment([0,0,0],[-r2,0,0],pi,[0,0,1])
12+
inner = CurveFactory.circle_segment(pi,r1,[0,0,1])
13+
outer = CurveFactory.circle_segment(pi,r2,[0,0,1])
14+
surf = SurfaceFactory.edge_curves(outer,inner)
15+
vol = None
1316

14-
surf = LoftCurves([inner,outer])
17+
if len(argv) > 1:
18+
if argv[1] == "3D":
19+
vol = VolumeFactory.extrude(surf,amount=(0,0,H))
20+
g2file = "annulus" + argv[1] + ".g2"
21+
else:
22+
g2file = "annulus.g2"
1523

16-
FinalOutput(surf,True)
24+
with G2(g2file) as output:
25+
if vol:
26+
output.write(vol)
27+
else:
28+
output.write(surf)

Test/Linear/annulus3D.py

Lines changed: 0 additions & 22 deletions
This file was deleted.

Test/Linear/snail-p1.g2

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
200 1 0 0
2+
2 0
3+
21 2
4+
0 0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4 0.45 0.5 0.55 0.6 0.65 0.7 0.75 0.8 0.85 0.9 0.95 1 1
5+
2 2
6+
0 0 1 1
7+
2 0
8+
1.698444510121399 1.234296406275989
9+
0.679837387624884 2.092324335849338
10+
-0.7106638787796116 2.186270834949481
11+
-1.941640786499874 1.410684605501935
12+
-2.498807276419563 -0.0003309934237682652
13+
-2.103444185374864 -1.52824165596043
14+
-0.8343194898087567 -2.567625013125361
15+
0.8652475842498547 -2.66295824562643
16+
2.345986661771544 -1.704390993465773
17+
3 -6.938893903907228e-16
18+
2.507710617496368 1.822025768712561
19+
0.9888543819998328 3.043380852144491
20+
-1.019722458690372 3.138206838448003
21+
-2.750657780874821 1.99846985779441
22+
-3.499708197046047 -5.356664430067326e-05
23+
-2.912461179749807 -2.116026908252907
24+
-1.143148376578134 -3.518677860112109
25+
1.174264578624798 -3.614014761921584
26+
3.154436753690882 -2.291824082211871
27+
4 -1.959434878635765e-15
28+
1 0
29+
0.8899186938124423 0.6465637775217208
30+
0.3708203932499367 1.141267819554184
31+
-0.4017220926874316 1.2363734711837
32+
-1.132614605908429 0.8231216155389067
33+
-1.500835507637458 -0.0003701260149266417
34+
-1.292565970757077 -0.939966650726791
35+
-0.5261981703652951 -1.616939746436597
36+
0.5562305898749065 -1.711901729331276
37+
1.537051390365992 -1.116650116169913
38+
2 -5.273559366969494e-16
39+
1.698761101735437 1.234289644450433
40+
0.6798373876248852 2.092324335849338
41+
-0.7107313431664333 2.18722996900475
42+
-1.941640786499874 1.410684605501936
43+
-2.499791581888863 -5.373712200418268e-05
44+
-2.103444185374861 -1.528241655960433
45+
-0.8341757426576569 -2.567692125828344
46+
0.8652475842498515 -2.662958245626431
47+
2.345622575299683 -1.704143158026125
48+
3 -1.469576158976824e-15

Test/Linear/snail_2D.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
from sys import argv
2+
from splipy.io import G2
3+
import splipy.curve_factory as cf
4+
import splipy.surface_factory as sf
5+
import numpy as np
6+
7+
p = int(argv[1]) if len(argv) > 1 else 1
8+
9+
def helix1(t):
10+
return np.vstack([(t+1)*np.cos(t*2*np.pi), (t+1)*np.sin(t*2*np.pi)]).T
11+
def helix2(t):
12+
return np.vstack([(t+2)*np.cos(t*2*np.pi), (t+2)*np.sin(t*2*np.pi)]).T
13+
14+
c1 = cf.fit(helix1, 0, 2)
15+
c2 = cf.fit(helix2, 0, 2)
16+
s1 = sf.edge_curves(c2, c1)
17+
18+
with G2("snail-p" + str(p) + ".g2") as output:
19+
output.write(s1.rebuild(p=p+1, n=(21*p,p+1)))

0 commit comments

Comments
 (0)