Skip to content

Commit 77e1f5d

Browse files
committed
[skip ci] add test case for mortar bc's for 2D navier equation using n-t coordinate system
1 parent 265d94f commit 77e1f5d

File tree

6 files changed

+6188
-1
lines changed

6 files changed

+6188
-1
lines changed

fem/src/SolverUtils.F90

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9895,7 +9895,8 @@ SUBROUTINE AverageBoundaryNormals( Model, VariableName, &
98959895
CALL TangentDirections( BoundaryNormals(k,:), &
98969896
BoundaryTangent1(k,:), BoundaryTangent2(k,:) )
98979897
IF( RotSystem ) THEN
9898-
IF( SUM(BoundaryTangent2(k,:)) < 0.0 ) THEN
9898+
! We want to always have n_z as positive in cylinder system.
9899+
IF( BoundaryTangent2(k,3) < 0.0 ) THEN
98999900
BoundaryTangent2(k,:) = -BoundaryTangent2(k,:)
99009901
END IF
99019902
ELSE IF( LhsSystem ) THEN
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
INCLUDE(test_macros)
2+
INCLUDE_DIRECTORIES(${CMAKE_BINARY_DIR}/fem/src)
3+
4+
CONFIGURE_FILE( case.sif case.sif COPYONLY)
5+
6+
file(COPY ELMERSOLVER_STARTINFO mortar.msh DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/")
7+
8+
ADD_ELMER_TEST(RotatingBCNavier2D LABELS mortar)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
case.sif
Lines changed: 189 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,189 @@
1+
! Test case for 2D nonconforming mortar elements
2+
! This cases solves the linear elasticity equation using
3+
! normal-tangential coordinate system.
4+
! Can be activated for Galerkin Projector = True / False.
5+
!
6+
! P.R. 5.3.2026
7+
8+
Header
9+
CHECK KEYWORDS Warn
10+
Mesh DB "." "mortar"
11+
Include Path ""
12+
Results Directory "results"
13+
End
14+
15+
$omega = 1.0
16+
$phi0 = 33.0
17+
18+
Simulation
19+
Max Output Level = 5
20+
Coordinate System = Cartesian
21+
Simulation Type = Scanning
22+
Steady State Max Iterations = 1
23+
Output Intervals = 1
24+
25+
Timestep Intervals = 3 !180
26+
Output Intervals = 1
27+
28+
Post File = case.vtu
29+
Ascii Output = True
30+
31+
Simulation Timing = Logical True
32+
33+
! This make the treatment of normals consistent such that all normals
34+
! point consistently out of cylinder axis.
35+
Use Cylinder System = Logical True
36+
End
37+
38+
39+
Body 1
40+
Target Bodies(1) = 1
41+
Name = "Stator"
42+
Equation = 1
43+
Material = 1
44+
Body Force = 1
45+
Initial Condition = 1
46+
End
47+
48+
Body 2
49+
Target Bodies(1) = 2
50+
Name = "Rotor-Hot"
51+
Equation = 1
52+
Material = 1
53+
Body Force = 2
54+
Initial Condition = 1
55+
End
56+
57+
Body 3
58+
Target Bodies(1) = 3
59+
Name = "Rotor-Cold"
60+
Equation = 1
61+
Material = 1
62+
Body Force = 3
63+
Initial Condition = 1
64+
End
65+
66+
67+
Solver 1
68+
Exec Solver = Before Timestep
69+
Equation = MeshDeform
70+
Procedure = "RigidMeshMapper" "RigidMeshMapper"
71+
Cumulative Displacements = Logical False
72+
Translate Before Rotate = Logical True
73+
End
74+
75+
76+
Solver 2
77+
Equation = StessEq
78+
Procedure = "StressSolve" "StressSolver"
79+
Variable = -dofs 2 Displacement
80+
Steady State Convergence Tolerance = 1.0e-5
81+
82+
Nonlinear System Max Iterations = 1
83+
Nonlinear System Consistent Norm = True
84+
85+
Linear System Solver = direct
86+
Linear System Direct Method = umfpack
87+
88+
Optimize Bandwidth = False
89+
90+
Apply Mortar BCs = Logical True
91+
92+
Displace Mesh = False
93+
End
94+
95+
Solver 3
96+
! Settings mainly for timing and verification
97+
Exec Solver = never
98+
99+
Equation = SaveScalars
100+
Procedure = "SaveData" "SaveScalars"
101+
102+
Filename = scalars.dat
103+
104+
Variable 1 = Temperature
105+
Operator 1 = dofs
106+
Operator 2 = partitions
107+
Operator 3 = min
108+
Operator 4 = max
109+
Operator 5 = norm
110+
Operator 6 = cpu time
111+
Operator 7 = wall time
112+
113+
! Reduce just to one file when parallel
114+
Parallel Reduce = Logical True
115+
Default Parallel Operator = String max
116+
Parallel Operator 1 = String sum
117+
End
118+
119+
120+
Equation 1
121+
Name = "Heat"
122+
Active Solvers(1) = 2
123+
End
124+
125+
Material 1
126+
Name = "Ideal"
127+
Density = 1
128+
Poisson Ratio = 0.3 ! makes the equation diagonal!
129+
Youngs Modulus = 1.0e3
130+
End
131+
132+
Body Force 1
133+
Name = "MoveToLeft"
134+
Mesh Translate 1 = -4.0
135+
End
136+
137+
Body Force 2
138+
Name = "Hot Move"
139+
Stress Bodyforce 1 = Variable "Coordinate"
140+
Real MATC "sqrt(tx(0)^2+tx(1)^2)"
141+
Mesh Rotate 3 = Variable time
142+
Real MATC "omega*tx+phi0"
143+
End
144+
145+
Body Force 3
146+
Name = "Cold Move"
147+
Stress Bodyforce 1 = Variable "Coordinate"
148+
Real MATC "-sqrt(tx(0)^2+tx(1)^2)"
149+
Mesh Rotate 3 = Variable time
150+
Real MATC "omega*tx+phi0"
151+
End
152+
153+
Boundary Condition 1
154+
Target Boundaries(4) = 10 11 12 13
155+
Name = "Ambient"
156+
Displacement 1 = 0.0
157+
Displacement 2 = 0.0
158+
End
159+
160+
Boundary Condition 2
161+
Target Boundaries(4) = 6 7 8 9
162+
Name = "Mortar Outside"
163+
164+
! This makes the normals point always out from cylinder origin
165+
Normal-Tangential Displacement = True
166+
Rotational Normals = True
167+
End
168+
169+
Boundary Condition 3
170+
Target Boundaries(4) = 1 2 3 4
171+
Name = "Mortar Inside"
172+
173+
Mortar BC = 2
174+
Rotational Projector = True
175+
176+
Normal-Tangential Displacement = True
177+
Rotational Normals = True
178+
179+
! This gives almost the same results using strong projector
180+
Galerkin Projector = True
181+
End
182+
183+
Solver 2 :: Reference Norm = 5.74636514E-05
184+
185+
186+
!Material 1 :: Poisson Ratio = 0.0
187+
!Solver 2 :: Reference Norm = 5.28565365E-05
188+
189+

0 commit comments

Comments
 (0)