diff --git a/cubitpy/cubitpy_types.py b/cubitpy/cubitpy_types.py index 938d106..8e3707d 100644 --- a/cubitpy/cubitpy_types.py +++ b/cubitpy/cubitpy_types.py @@ -128,6 +128,10 @@ class ElementType(Enum): hex8sh = auto() hex8_fluid = auto() tet4_fluid = auto() + hex8_thermo = auto() + tet4_thermo = auto() + hex8_scatra = auto() + tet4_scatra = auto() quad4 = auto() def get_cubit_names(self): @@ -135,7 +139,13 @@ def get_cubit_names(self): cubit.""" # Get the element type parameters. - if self == self.hex8 or self == self.hex8sh or self == self.hex8_fluid: + if ( + self == self.hex8 + or self == self.hex8sh + or self == self.hex8_fluid + or self == self.hex8_thermo + or self == self.hex8_scatra + ): cubit_scheme = "Auto" cubit_element_type = "HEX8" elif self == self.hex20: @@ -144,7 +154,12 @@ def get_cubit_names(self): elif self == self.hex27: cubit_scheme = "Auto" cubit_element_type = "HEX27" - elif self == self.tet4 or self == self.tet4_fluid: + elif ( + self == self.tet4 + or self == self.tet4_fluid + or self == self.tet4_thermo + or self == self.tet4_scatra + ): cubit_scheme = "Tetmesh" cubit_element_type = "TETRA4" elif self == self.tet10: @@ -174,6 +189,10 @@ def get_four_c_name(self): return "SOLID" elif self == self.hex8_fluid or self == self.tet4_fluid: return "FLUID" + elif self == self.hex8_thermo or self == self.tet4_thermo: + return "THERMO" + elif self == self.hex8_scatra or self == self.tet4_scatra: + return "TRANSP" if self == self.quad4: return "WALL" else: @@ -195,19 +214,34 @@ def get_four_c_section(self): or self == self.quad4 ): return "STRUCTURE" + elif self == self.hex8_thermo or self == self.tet4_thermo: + return "THERMO" + elif self == self.hex8_scatra or self == self.tet4_scatra: + return "TRANSPORT" else: raise ValueError("Got wrong element type {}!".format(self)) def get_four_c_type(self): """Get the correct element shape name of this element in 4C.""" - if self == self.hex8 or self == self.hex8sh or self == self.hex8_fluid: + if ( + self == self.hex8 + or self == self.hex8sh + or self == self.hex8_fluid + or self == self.hex8_thermo + or self == self.hex8_scatra + ): return "HEX8" elif self == self.hex20: return "HEX20" elif self == self.hex27: return "HEX27" - elif self == self.tet4 or self == self.tet4_fluid: + elif ( + self == self.tet4 + or self == self.tet4_fluid + or self == self.tet4_thermo + or self == self.tet4_scatra + ): return "TET4" elif self == self.tet10: return "TET10" @@ -231,8 +265,12 @@ def get_default_four_c_description(self): return "KINEM nonlinear" elif self == self.hex8sh: return "KINEM nonlinear EAS none ANS none THICKDIR auto" - elif self == self.hex8_fluid or self.tet4_fluid: + elif self == self.hex8_fluid or self == self.tet4_fluid: return "NA ALE" + elif self == self.hex8_thermo or self == self.tet4_thermo: + return "" + elif self == self.hex8_scatra or self == self.tet4_scatra: + return "" else: raise ValueError("Got wrong element type {}!".format(self)) diff --git a/tests/input-files-ref/test_scatra_functionality.dat b/tests/input-files-ref/test_scatra_functionality.dat new file mode 100644 index 0000000..6577835 --- /dev/null +++ b/tests/input-files-ref/test_scatra_functionality.dat @@ -0,0 +1,12 @@ + +-------------------------------------------------------NODE COORDS +NODE 1 COORD -5.0000000000000000e-01 -5.0000000000000000e-01 5.0000000000000000e-01 +NODE 2 COORD -5.0000000000000000e-01 -5.0000000000000000e-01 -5.0000000000000000e-01 +NODE 3 COORD -5.0000000000000000e-01 5.0000000000000000e-01 -5.0000000000000000e-01 +NODE 4 COORD -5.0000000000000000e-01 5.0000000000000000e-01 5.0000000000000000e-01 +NODE 5 COORD 5.0000000000000000e-01 -5.0000000000000000e-01 5.0000000000000000e-01 +NODE 6 COORD 5.0000000000000000e-01 -5.0000000000000000e-01 -5.0000000000000000e-01 +NODE 7 COORD 5.0000000000000000e-01 5.0000000000000000e-01 -5.0000000000000000e-01 +NODE 8 COORD 5.0000000000000000e-01 5.0000000000000000e-01 5.0000000000000000e-01 +------------------------------------------------TRANSPORT ELEMENTS + 1 TRANSP HEX8 1 2 3 4 5 6 7 8 MAT 1 diff --git a/tests/input-files-ref/test_thermo_functionality.dat b/tests/input-files-ref/test_thermo_functionality.dat new file mode 100644 index 0000000..ca40081 --- /dev/null +++ b/tests/input-files-ref/test_thermo_functionality.dat @@ -0,0 +1,12 @@ + +-------------------------------------------------------NODE COORDS +NODE 1 COORD -5.0000000000000000e-01 -5.0000000000000000e-01 5.0000000000000000e-01 +NODE 2 COORD -5.0000000000000000e-01 -5.0000000000000000e-01 -5.0000000000000000e-01 +NODE 3 COORD -5.0000000000000000e-01 5.0000000000000000e-01 -5.0000000000000000e-01 +NODE 4 COORD -5.0000000000000000e-01 5.0000000000000000e-01 5.0000000000000000e-01 +NODE 5 COORD 5.0000000000000000e-01 -5.0000000000000000e-01 5.0000000000000000e-01 +NODE 6 COORD 5.0000000000000000e-01 -5.0000000000000000e-01 -5.0000000000000000e-01 +NODE 7 COORD 5.0000000000000000e-01 5.0000000000000000e-01 -5.0000000000000000e-01 +NODE 8 COORD 5.0000000000000000e-01 5.0000000000000000e-01 5.0000000000000000e-01 +------------------------------------------------THERMO ELEMENTS + 1 THERMO HEX8 1 2 3 4 5 6 7 8 MAT 1 diff --git a/tests/testing.py b/tests/testing.py index b967d5d..6d5d58f 100644 --- a/tests/testing.py +++ b/tests/testing.py @@ -771,6 +771,40 @@ def test_fluid_functionality(): compare(cubit) +def test_thermo_functionality(): + """Test thermo mesh creation.""" + + cubit = CubitPy() + thermo = create_brick( + cubit, + 1, + 1, + 1, + mesh_interval=[1, 1, 1], + element_type=cupy.element_type.hex8_thermo, + ) + + # Compare the input file created for 4C. + compare(cubit) + + +def test_scatra_functionality(): + """Test scatra mesh creation.""" + + cubit = CubitPy() + thermo = create_brick( + cubit, + 1, + 1, + 1, + mesh_interval=[1, 1, 1], + element_type=cupy.element_type.hex8_scatra, + ) + + # Compare the input file created for 4C. + compare(cubit) + + def test_fsi_functionality(): """Test fsi and ale conditions and fluid mesh creation."""