Skip to content

Commit

Permalink
FEM: elmer unit test data, rename some test data files
Browse files Browse the repository at this point in the history
  • Loading branch information
berndhahnebach committed Jul 6, 2020
1 parent 74e0912 commit e10fae8
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 23 deletions.
6 changes: 3 additions & 3 deletions src/Mod/Fem/CMakeLists.txt
Expand Up @@ -254,9 +254,9 @@ SET(FemTestsCcx_SRCS

SET(FemTestsElmer_SRCS
femtest/data/elmer/__init__.py
femtest/data/elmer/case_mm.sif
femtest/data/elmer/elmer_ccxcanti_faceload_mm.sif
femtest/data/elmer/elmer_ccxcanti_nodeload_mm.sif
femtest/data/elmer/box_static_mm.sif
femtest/data/elmer/ccxcantilever_faceload_mm.sif
femtest/data/elmer/ccxcantilever_nodeload_mm.sif
femtest/data/elmer/group_mesh.geo
femtest/data/elmer/ELMERSOLVER_STARTINFO
)
Expand Down
21 changes: 11 additions & 10 deletions src/Mod/Fem/femtest/app/test_solver_elmer.py
Expand Up @@ -33,6 +33,7 @@
import femsolver.run
from . import support_utils as testtools
from .support_utils import fcc_print
from .support_utils import get_namefromdef


class TestSolverElmer(unittest.TestCase):
Expand Down Expand Up @@ -91,7 +92,7 @@ def test_00print(
))

# ********************************************************************************************
def test_solver_elmer(
def test_box_static(
self
):
fcc_print("")
Expand All @@ -106,8 +107,8 @@ def test_solver_elmer(
# the examples do use a gmsh mesh object thus ok
# FIXME elmer elasticity needs the dict key "ThermalExpansionCoefficient" in material

base_name = "elmer_generic_test"
analysis_dir = testtools.get_fem_test_tmp_dir("solver_" + base_name)
base_name = get_namefromdef("test_")
analysis_dir = testtools.get_fem_test_tmp_dir(self.pre_dir_name + base_name)

# save the file
save_fc_file = join(analysis_dir, base_name + ".FCStd")
Expand All @@ -133,8 +134,8 @@ def test_solver_elmer(
self.assertFalse(ret, "STARTINFO write file test failed.\n{}".format(ret))

fcc_print("Test writing case file")
casefile_given = join(self.test_file_dir, "case_mm.sif")
casefile_totest = join(analysis_dir, "case.sif")
casefile_given = join(self.test_file_dir, base_name + "_mm" + self.ending)
casefile_totest = join(analysis_dir, self.infilename + self.ending)
# fcc_print("Comparing {} to {}".format(casefile_given, casefile_totest))
ret = testtools.compare_files(casefile_given, casefile_totest)
self.assertFalse(ret, "case write file test failed.\n{}".format(ret))
Expand All @@ -147,22 +148,22 @@ def test_solver_elmer(
self.assertFalse(ret, "GMSH geo write file test failed.\n{}".format(ret))

# ********************************************************************************************
def test_elmer_ccxcantilever_faceload(
def test_ccxcantilever_faceload(
self
):
fcc_print("")
from femexamples.ccx_cantilever_faceload import setup
setup(self.document, "elmer")
self.input_file_writing_test("elmer_ccxcanti_faceload")
self.input_file_writing_test(get_namefromdef("test_"))

# ********************************************************************************************
def test_elmer_ccxcantilever_nodeload(
def test_ccxcantilever_nodeload(
self
):
fcc_print("")
from femexamples.ccx_cantilever_nodeload import setup
setup(self.document, "elmer")
self.input_file_writing_test("elmer_ccxcanti_nodeload")
self.input_file_writing_test(get_namefromdef("test_"))

# ********************************************************************************************
def input_file_writing_test(
Expand All @@ -172,7 +173,7 @@ def input_file_writing_test(
self.document.recompute()

# get analysis working directory and save FreeCAD file
working_dir = testtools.get_fem_test_tmp_dir("solver_" + base_name)
working_dir = testtools.get_fem_test_tmp_dir(self.pre_dir_name + base_name)
save_fc_file = join(working_dir, base_name + ".FCStd")
# fcc_print("Save FreeCAD file to {} ...".format(save_fc_file))
self.document.saveAs(save_fc_file)
Expand Down
File renamed without changes.
20 changes: 10 additions & 10 deletions src/Mod/Fem/femtest/test_commands.sh
Expand Up @@ -39,7 +39,7 @@ make -j 4 && ./bin/FreeCADCmd -t femtest.app.test_solver_elmer.TestSolverElmer
# methods
make -j 4 && ./bin/FreeCADCmd -t femtest.app.test_ccxtools.TestCcxTools.test_box_frequency
make -j 4 && ./bin/FreeCADCmd -t femtest.app.test_ccxtools.TestCcxTools.test_box_static
make -j 4 && ./bin/FreeCADCmd -t femtest.app.test_ccxtools.TestCcxTools.test_ccxcantilever_faceload_hexa20
make -j 4 && ./bin/FreeCADCmd -t femtest.app.test_ccxtools.TestCcxTools.test_ccxcantilever_hexa20
make -j 4 && ./bin/FreeCADCmd -t femtest.app.test_ccxtools.TestCcxTools.test_constraint_contact_shell_shell
make -j 4 && ./bin/FreeCADCmd -t femtest.app.test_ccxtools.TestCcxTools.test_constraint_contact_solid_solid
make -j 4 && ./bin/FreeCADCmd -t femtest.app.test_ccxtools.TestCcxTools.test_constraint_sectionprint
Expand Down Expand Up @@ -81,10 +81,10 @@ make -j 4 && ./bin/FreeCADCmd -t femtest.app.test_result.TestResult.test_stress_
make -j 4 && ./bin/FreeCADCmd -t femtest.app.test_result.TestResult.test_stress_principal_reinforced
make -j 4 && ./bin/FreeCADCmd -t femtest.app.test_result.TestResult.test_rho
make -j 4 && ./bin/FreeCADCmd -t femtest.app.test_result.TestResult.test_disp_abs
make -j 4 && ./bin/FreeCADCmd -t femtest.app.test_solver_calculix.TestSolverCalculix.test_solver_calculix
make -j 4 && ./bin/FreeCADCmd -t femtest.app.test_solver_elmer.TestSolverElmer.test_solver_elmer
make -j 4 && ./bin/FreeCADCmd -t femtest.app.test_solver_elmer.TestSolverElmer.test_elmer_ccxcanti_faceload
make -j 4 && ./bin/FreeCADCmd -t femtest.app.test_solver_elmer.TestSolverElmer.test_elmer_ccxcanti_nodeload
make -j 4 && ./bin/FreeCADCmd -t femtest.app.test_solver_calculix.TestSolverCalculix.test_box_static
make -j 4 && ./bin/FreeCADCmd -t femtest.app.test_solver_elmer.TestSolverElmer.test_box_static
make -j 4 && ./bin/FreeCADCmd -t femtest.app.test_solver_elmer.TestSolverElmer.test_ccxcantilever_faceload
make -j 4 && ./bin/FreeCADCmd -t femtest.app.test_solver_elmer.TestSolverElmer.test_ccxcantilever_nodeload


# methods in FreeCAD
Expand All @@ -101,7 +101,7 @@ unittest.TextTestRunner().run(unittest.TestLoader().loadTestsFromName(

import unittest
unittest.TextTestRunner().run(unittest.TestLoader().loadTestsFromName(
'femtest.app.test_ccxtools.TestCcxTools.test_ccxcantilever_faceload_hexa20'
'femtest.app.test_ccxtools.TestCcxTools.test_ccxcantilever_hexa20'
))

import unittest
Expand Down Expand Up @@ -311,20 +311,20 @@ unittest.TextTestRunner().run(unittest.TestLoader().loadTestsFromName(

import unittest
unittest.TextTestRunner().run(unittest.TestLoader().loadTestsFromName(
'femtest.app.test_solver_calculix.TestSolverCalculix.test_solver_calculix'
'femtest.app.test_solver_calculix.TestSolverCalculix.test_box_static'
))

import unittest
unittest.TextTestRunner().run(unittest.TestLoader().loadTestsFromName(
'femtest.app.test_solver_elmer.TestSolverElmer.test_solver_elmer'
'femtest.app.test_solver_elmer.TestSolverElmer.test_box_static'
))

import unittest
unittest.TextTestRunner().run(unittest.TestLoader().loadTestsFromName(
'femtest.app.test_solver_elmer.TestSolverElmer.test_elmer_ccxcanti_faceload'
'femtest.app.test_solver_elmer.TestSolverElmer.test_ccxcantilever_faceload'
))

import unittest
unittest.TextTestRunner().run(unittest.TestLoader().loadTestsFromName(
'femtest.app.test_solver_elmer.TestSolverElmer.test_elmer_ccxcanti_nodeload'
'femtest.app.test_solver_elmer.TestSolverElmer.test_ccxcantilever_nodeload'
))

0 comments on commit e10fae8

Please sign in to comment.