Skip to content

Commit 26ea0de

Browse files
Sudhanshu-Dubey14berndhahnebach
authored andcommitted
FEM: unit tests, add elmer tests
...in FreeCAD standard units
1 parent 0a8a136 commit 26ea0de

6 files changed

+501
-0
lines changed

src/Mod/Fem/CMakeLists.txt

+4
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,11 @@ SET(FemTestsElmer_SRCS
382382
femtest/data/elmer/ccxcantilever_faceload_1_si.sif
383383
femtest/data/elmer/ccxcantilever_nodeload_0_mm.sif
384384
femtest/data/elmer/ccxcantilever_prescribeddisplacement_0_mm.sif
385+
femtest/data/elmer/equation_electrostatics_capacitance_two_balls_0_mm.sif
386+
femtest/data/elmer/equation_electrostatics_cube_capacitor_0_mm.sif
387+
femtest/data/elmer/equation_electrostatics_electricforce_elmer_nongui6_0_mm.sif
385388
femtest/data/elmer/group_mesh.geo
389+
femtest/data/elmer/thermomech_bimetall_0_mm.sif
386390
femtest/data/elmer/ELMERSOLVER_STARTINFO
387391
)
388392

src/Mod/Fem/femtest/app/test_solver_elmer.py

+40
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,46 @@ def test_ccxcantilever_prescribeddisplacement_0_mm(
200200
setup(self.document, "elmer")
201201
self.input_file_writing_test(get_namefromdef("test_"))
202202

203+
# ********************************************************************************************
204+
def test_equation_electrostatics_capacitance_two_balls_0_mm(
205+
self
206+
):
207+
fcc_print("")
208+
self.set_unit_schema(0) # mm/kg/s
209+
from femexamples.equation_electrostatics_capacitance_two_balls import setup
210+
setup(self.document, "elmer")
211+
self.input_file_writing_test(get_namefromdef("test_"))
212+
213+
# ********************************************************************************************
214+
def test_equation_electrostatics_cube_capacitor_0_mm(
215+
self
216+
):
217+
fcc_print("")
218+
self.set_unit_schema(0) # mm/kg/s
219+
from femexamples.equation_electrostatics_cube_capacitor import setup
220+
setup(self.document, "elmer")
221+
self.input_file_writing_test(get_namefromdef("test_"))
222+
223+
# ********************************************************************************************
224+
def test_equation_electrostatics_electricforce_elmer_nongui6_0_mm(
225+
self
226+
):
227+
fcc_print("")
228+
self.set_unit_schema(0) # mm/kg/s
229+
from femexamples.equation_electrostatics_electricforce_elmer_nongui6 import setup
230+
setup(self.document, "elmer")
231+
self.input_file_writing_test(get_namefromdef("test_"))
232+
233+
# ********************************************************************************************
234+
def test_thermomech_bimetall_0_mm(
235+
self
236+
):
237+
fcc_print("")
238+
self.set_unit_schema(0) # mm/kg/s
239+
from femexamples.thermomech_bimetall import setup
240+
setup(self.document, "elmer")
241+
self.input_file_writing_test(get_namefromdef("test_"))
242+
203243
# ********************************************************************************************
204244
def input_file_writing_test(
205245
self,
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
Check Keywords Warn
2+
3+
Header
4+
Mesh DB "."
5+
End
6+
7+
Solver 1
8+
Bubbles = Logical False
9+
Calculate Capacitance Matrix = Logical True
10+
Calculate Electric Energy = Logical True
11+
Calculate Electric Field = Logical True
12+
Calculate Surface Charge = Logical False
13+
Displace mesh = Logical False
14+
Equation = String "Stat Elec Solver"
15+
Exec Solver = String "Always"
16+
Linear System Abort Not Converged = Logical False
17+
Linear System Convergence Tolerance = Real 1e-08
18+
Linear System Iterative Method = String "BiCGStab"
19+
Linear System Max Iterations = Integer 500
20+
Linear System Precondition Recompute = Integer 1
21+
Linear System Preconditioning = String "ILU0"
22+
Linear System Residual Output = Integer 1
23+
Linear System Solver = String "Iterative"
24+
Optimize Bandwidth = Logical True
25+
Procedure = File "StatElecSolve" "StatElecSolver"
26+
Stabilize = Logical True
27+
Steady State Convergence Tolerance = Real 1e-05
28+
Variable = String "Potential"
29+
Variable DOFs = Integer 1
30+
End
31+
32+
Simulation
33+
BDF Order = Integer 1
34+
Coordinate Mapping(3) = Integer 1 2 3
35+
Coordinate System = String "Cartesian 3D"
36+
Output Intervals = Integer 1
37+
Simulation Type = String "Steady state"
38+
Steady State Max Iterations = Integer 1
39+
Steady State Min Iterations = Integer 0
40+
Timestepping Method = String "BDF"
41+
Use Mesh Names = Logical True
42+
End
43+
44+
Constants
45+
Permittivity Of Vacuum = Real 9.999999999999999e-10
46+
End
47+
48+
Body 1
49+
Equation = Integer 1
50+
Material = Integer 1
51+
Name = String "Solid1"
52+
End
53+
54+
Material 1
55+
Relative Permittivity = Real 1.0
56+
End
57+
58+
Equation 1
59+
Active Solvers(2) = Integer 1 2
60+
End
61+
62+
Solver 2
63+
Equation = String "ResultOutput"
64+
Exec Solver = String "After simulation"
65+
Output File Name = File "case"
66+
Procedure = File "ResultOutputSolve" "ResultOutputSolver"
67+
Vtu Format = Logical True
68+
End
69+
70+
Boundary Condition 1
71+
Electric Infinity BC = Logical True
72+
Name = String "Face1"
73+
End
74+
75+
Boundary Condition 2
76+
Capacitance Body = Integer 1
77+
Name = String "Face2"
78+
End
79+
80+
Boundary Condition 3
81+
Capacitance Body = Integer 2
82+
Name = String "Face3"
83+
End
84+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
Check Keywords Warn
2+
3+
Header
4+
Mesh DB "."
5+
End
6+
7+
Solver 1
8+
Bubbles = Logical False
9+
Calculate Capacitance Matrix = Logical True
10+
Calculate Electric Energy = Logical False
11+
Calculate Electric Field = Logical False
12+
Calculate Surface Charge = Logical False
13+
Displace mesh = Logical False
14+
Equation = String "Stat Elec Solver"
15+
Exec Solver = String "Always"
16+
Linear System Abort Not Converged = Logical False
17+
Linear System Convergence Tolerance = Real 1e-08
18+
Linear System Iterative Method = String "BiCGStab"
19+
Linear System Max Iterations = Integer 500
20+
Linear System Precondition Recompute = Integer 1
21+
Linear System Preconditioning = String "ILU0"
22+
Linear System Residual Output = Integer 1
23+
Linear System Solver = String "Iterative"
24+
Optimize Bandwidth = Logical True
25+
Procedure = File "StatElecSolve" "StatElecSolver"
26+
Stabilize = Logical True
27+
Steady State Convergence Tolerance = Real 1e-05
28+
Variable = String "Potential"
29+
Variable DOFs = Integer 1
30+
End
31+
32+
Simulation
33+
BDF Order = Integer 1
34+
Coordinate Mapping(3) = Integer 1 2 3
35+
Coordinate System = String "Cartesian 3D"
36+
Output Intervals = Integer 1
37+
Simulation Type = String "Steady state"
38+
Steady State Max Iterations = Integer 1
39+
Steady State Min Iterations = Integer 0
40+
Timestepping Method = String "BDF"
41+
Use Mesh Names = Logical True
42+
End
43+
44+
Constants
45+
Permittivity Of Vacuum = Real 8.854190000000001e-21
46+
End
47+
48+
Body 1
49+
Equation = Integer 1
50+
Material = Integer 1
51+
Name = String "Solid1"
52+
End
53+
54+
Material 1
55+
Relative Permittivity = Real 1.0
56+
End
57+
58+
Equation 1
59+
Active Solvers(2) = Integer 1 2
60+
End
61+
62+
Solver 2
63+
Equation = String "ResultOutput"
64+
Exec Solver = String "After simulation"
65+
Output File Name = File "case"
66+
Procedure = File "ResultOutputSolve" "ResultOutputSolver"
67+
Vtu Format = Logical True
68+
End
69+
70+
Boundary Condition 1
71+
Capacitance Body = Integer 1
72+
Name = String "Face6"
73+
Potential = Real 2000000.0
74+
End
75+
76+
Boundary Condition 2
77+
Capacitance Body = Integer 2
78+
Name = String "Face5"
79+
Potential = Real -1000000.0
80+
End
81+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
Check Keywords Warn
2+
3+
Header
4+
Mesh DB "."
5+
End
6+
7+
Solver 1
8+
Bubbles = Logical False
9+
Calculate Capacitance Matrix = Logical False
10+
Calculate Electric Energy = Logical False
11+
Calculate Electric Field = Logical False
12+
Calculate Surface Charge = Logical False
13+
Displace mesh = Logical False
14+
Equation = String "Stat Elec Solver"
15+
Exec Solver = String "Always"
16+
Linear System Abort Not Converged = Logical False
17+
Linear System Convergence Tolerance = Real 1e-08
18+
Linear System Iterative Method = String "BiCGStab"
19+
Linear System Max Iterations = Integer 500
20+
Linear System Precondition Recompute = Integer 1
21+
Linear System Preconditioning = String "ILU0"
22+
Linear System Residual Output = Integer 1
23+
Linear System Solver = String "Iterative"
24+
Optimize Bandwidth = Logical True
25+
Procedure = File "StatElecSolve" "StatElecSolver"
26+
Stabilize = Logical True
27+
Steady State Convergence Tolerance = Real 1e-05
28+
Variable = String "Potential"
29+
Variable DOFs = Integer 1
30+
End
31+
32+
Simulation
33+
BDF Order = Integer 1
34+
Coordinate Mapping(3) = Integer 1 2 3
35+
Coordinate System = String "Cartesian 3D"
36+
Output Intervals = Integer 1
37+
Simulation Type = String "Steady state"
38+
Steady State Max Iterations = Integer 1
39+
Steady State Min Iterations = Integer 0
40+
Timestepping Method = String "BDF"
41+
Use Mesh Names = Logical True
42+
End
43+
44+
Constants
45+
Permittivity Of Vacuum = Real 8.854190000000001e-21
46+
End
47+
48+
Body 1
49+
Equation = Integer 1
50+
Material = Integer 1
51+
Name = String "Solid1"
52+
End
53+
54+
Material 1
55+
Relative Permittivity = Real 1.0
56+
End
57+
58+
Equation 1
59+
Active Solvers(3) = Integer 1 2 3
60+
End
61+
62+
Solver 2
63+
Equation = String "Electric Force"
64+
Procedure = File "ElectricForce" "StatElecForce"
65+
End
66+
67+
Solver 3
68+
Equation = String "ResultOutput"
69+
Exec Solver = String "After simulation"
70+
Output File Name = File "case"
71+
Procedure = File "ResultOutputSolve" "ResultOutputSolver"
72+
Vtu Format = Logical True
73+
End
74+
75+
Boundary Condition 1
76+
Capacitance Body = Integer 1
77+
Name = String "Face2"
78+
Potential = Real 0.0
79+
End
80+
81+
Boundary Condition 2
82+
Calculate Electric Force = Logical True
83+
Capacitance Body = Integer 2
84+
Name = String "Face4"
85+
Potential = Real 1000000000000.0
86+
End
87+
88+
Boundary Condition 3
89+
Calculate Electric Force = Logical True
90+
Capacitance Body = Integer 2
91+
Name = String "Face5"
92+
Potential = Real 1000000000000.0
93+
End
94+
95+
Boundary Condition 4
96+
Calculate Electric Force = Logical True
97+
Capacitance Body = Integer 2
98+
Name = String "Face6"
99+
Potential = Real 1000000000000.0
100+
End
101+
102+
Boundary Condition 5
103+
Calculate Electric Force = Logical True
104+
Capacitance Body = Integer 2
105+
Name = String "Face11"
106+
Potential = Real 1000000000000.0
107+
End
108+

0 commit comments

Comments
 (0)