From f8b6884f0af5da4a80b94ee35e63e891f12f95ae Mon Sep 17 00:00:00 2001 From: Ivo Steinbrecher Date: Thu, 28 Mar 2024 10:59:50 +0100 Subject: [PATCH] Add test case --- .../test_element_types_quad_pre_exodus.dat | 2 +- ...st_element_types_quad_z_values_cubitpy.dat | 22 +++++++++++ ...element_types_quad_z_values_pre_exodus.dat | 37 +++++++++++++++++++ .../test_group_of_surfaces_pre_exodus.dat | 2 +- ...st_element_types_quad_z_values_cubitpy.dat | 22 +++++++++++ tests/testing.py | 25 +++++++++++++ 6 files changed, 108 insertions(+), 2 deletions(-) create mode 100644 tests/input-files-ref/test_element_types_quad_z_values_cubitpy.dat create mode 100644 tests/input-files-ref/test_element_types_quad_z_values_pre_exodus.dat create mode 100644 tests/test_element_types_quad_z_values_cubitpy.dat diff --git a/tests/input-files-ref/test_element_types_quad_pre_exodus.dat b/tests/input-files-ref/test_element_types_quad_pre_exodus.dat index 2b80510..bad6c41 100644 --- a/tests/input-files-ref/test_element_types_quad_pre_exodus.dat +++ b/tests/input-files-ref/test_element_types_quad_pre_exodus.dat @@ -6,7 +6,7 @@ created by pre_exodus ------------------------------------------------------PROBLEM SIZE //ELEMENTS 6 //NODES 12 -DIM 2 +DIM 3 -----------------------------------------------DNODE-NODE TOPOLOGY diff --git a/tests/input-files-ref/test_element_types_quad_z_values_cubitpy.dat b/tests/input-files-ref/test_element_types_quad_z_values_cubitpy.dat new file mode 100644 index 0000000..650e951 --- /dev/null +++ b/tests/input-files-ref/test_element_types_quad_z_values_cubitpy.dat @@ -0,0 +1,22 @@ + +-------------------------------------------------------NODE COORDS +NODE 1 COORD 5.0000000000000000e-01 6.1232342629258393e-17 -1.0000000000000000e+00 +NODE 2 COORD 1.6666667163372040e-01 6.1232342629258393e-17 -1.0000000000000000e+00 +NODE 3 COORD 1.6666667163372040e-01 -4.6351060092292664e-34 7.5697026662207798e-18 +NODE 4 COORD 5.0000000000000000e-01 0.0000000000000000e+00 0.0000000000000000e+00 +NODE 5 COORD -1.6666667163372040e-01 6.1232342629258393e-17 -1.0000000000000000e+00 +NODE 6 COORD -1.6666667163372040e-01 -4.6351060092292664e-34 7.5697026662207798e-18 +NODE 7 COORD -5.0000000000000000e-01 6.1232342629258393e-17 -1.0000000000000000e+00 +NODE 8 COORD -5.0000000000000000e-01 0.0000000000000000e+00 0.0000000000000000e+00 +NODE 9 COORD 1.6666667163372040e-01 -6.1232342629258393e-17 1.0000000000000000e+00 +NODE 10 COORD 5.0000000000000000e-01 -6.1232342629258393e-17 1.0000000000000000e+00 +NODE 11 COORD -1.6666667163372040e-01 -6.1232342629258393e-17 1.0000000000000000e+00 +NODE 12 COORD -5.0000000000000000e-01 -6.1232342629258393e-17 1.0000000000000000e+00 +------------------------------------------------STRUCTURE ELEMENTS + 1 WALL QUAD4 1 2 3 4 MAT 1 KINEM nonlinear EAS none THICK 1.0 STRESS_STRAIN plane_stress GP 3 3 + 2 WALL QUAD4 2 5 6 3 MAT 1 KINEM nonlinear EAS none THICK 1.0 STRESS_STRAIN plane_stress GP 3 3 + 3 WALL QUAD4 5 7 8 6 MAT 1 KINEM nonlinear EAS none THICK 1.0 STRESS_STRAIN plane_stress GP 3 3 + 4 WALL QUAD4 4 3 9 10 MAT 1 KINEM nonlinear EAS none THICK 1.0 STRESS_STRAIN plane_stress GP 3 3 + 5 WALL QUAD4 3 6 11 9 MAT 1 KINEM nonlinear EAS none THICK 1.0 STRESS_STRAIN plane_stress GP 3 3 + 6 WALL QUAD4 6 8 12 11 MAT 1 KINEM nonlinear EAS none THICK 1.0 STRESS_STRAIN plane_stress GP 3 3 +---------------------------------------------------------------END diff --git a/tests/input-files-ref/test_element_types_quad_z_values_pre_exodus.dat b/tests/input-files-ref/test_element_types_quad_z_values_pre_exodus.dat new file mode 100644 index 0000000..5793f03 --- /dev/null +++ b/tests/input-files-ref/test_element_types_quad_z_values_pre_exodus.dat @@ -0,0 +1,37 @@ +================================================================== + General Data File BACI +================================================================== +-------------------------------------------------------------TITLE +created by pre_exodus +------------------------------------------------------PROBLEM SIZE +//ELEMENTS 6 +//NODES 12 +DIM 3 + + +-----------------------------------------------DNODE-NODE TOPOLOGY +-----------------------------------------------DLINE-NODE TOPOLOGY +-----------------------------------------------DSURF-NODE TOPOLOGY +------------------------------------------------DVOL-NODE TOPOLOGY +-------------------------------------------------------NODE COORDS +NODE 1 COORD 5.0000000000000000e-01 6.1232342629258393e-17 -1.0000000000000000e+00 +NODE 2 COORD 1.6666667163372040e-01 6.1232342629258393e-17 -1.0000000000000000e+00 +NODE 3 COORD 1.6666667163372040e-01 -4.6351060092292664e-34 7.5697026662207798e-18 +NODE 4 COORD 5.0000000000000000e-01 0.0000000000000000e+00 0.0000000000000000e+00 +NODE 5 COORD -1.6666667163372040e-01 6.1232342629258393e-17 -1.0000000000000000e+00 +NODE 6 COORD -1.6666667163372040e-01 -4.6351060092292664e-34 7.5697026662207798e-18 +NODE 7 COORD -5.0000000000000000e-01 6.1232342629258393e-17 -1.0000000000000000e+00 +NODE 8 COORD -5.0000000000000000e-01 0.0000000000000000e+00 0.0000000000000000e+00 +NODE 9 COORD 1.6666667163372040e-01 -6.1232342629258393e-17 1.0000000000000000e+00 +NODE 10 COORD 5.0000000000000000e-01 -6.1232342629258393e-17 1.0000000000000000e+00 +NODE 11 COORD -1.6666667163372040e-01 -6.1232342629258393e-17 1.0000000000000000e+00 +NODE 12 COORD -5.0000000000000000e-01 -6.1232342629258393e-17 1.0000000000000000e+00 +------------------------------------------------STRUCTURE ELEMENTS + 1 WALL QUAD4 1 2 3 4 MAT 1 KINEM nonlinear EAS none THICK 1.0 STRESS_STRAIN plane_stress GP 3 3 + 2 WALL QUAD4 2 5 6 3 MAT 1 KINEM nonlinear EAS none THICK 1.0 STRESS_STRAIN plane_stress GP 3 3 + 3 WALL QUAD4 5 7 8 6 MAT 1 KINEM nonlinear EAS none THICK 1.0 STRESS_STRAIN plane_stress GP 3 3 + 4 WALL QUAD4 4 3 9 10 MAT 1 KINEM nonlinear EAS none THICK 1.0 STRESS_STRAIN plane_stress GP 3 3 + 5 WALL QUAD4 3 6 11 9 MAT 1 KINEM nonlinear EAS none THICK 1.0 STRESS_STRAIN plane_stress GP 3 3 + 6 WALL QUAD4 6 8 12 11 MAT 1 KINEM nonlinear EAS none THICK 1.0 STRESS_STRAIN plane_stress GP 3 3 +---------------------------------------------------------------END +// END \ No newline at end of file diff --git a/tests/input-files-ref/test_group_of_surfaces_pre_exodus.dat b/tests/input-files-ref/test_group_of_surfaces_pre_exodus.dat index a2d9854..d95a80e 100644 --- a/tests/input-files-ref/test_group_of_surfaces_pre_exodus.dat +++ b/tests/input-files-ref/test_group_of_surfaces_pre_exodus.dat @@ -6,7 +6,7 @@ created by pre_exodus ------------------------------------------------------PROBLEM SIZE //ELEMENTS 18 //NODES 28 -DIM 2 +DIM 3 -----------------------------------------------DNODE-NODE TOPOLOGY diff --git a/tests/test_element_types_quad_z_values_cubitpy.dat b/tests/test_element_types_quad_z_values_cubitpy.dat new file mode 100644 index 0000000..650e951 --- /dev/null +++ b/tests/test_element_types_quad_z_values_cubitpy.dat @@ -0,0 +1,22 @@ + +-------------------------------------------------------NODE COORDS +NODE 1 COORD 5.0000000000000000e-01 6.1232342629258393e-17 -1.0000000000000000e+00 +NODE 2 COORD 1.6666667163372040e-01 6.1232342629258393e-17 -1.0000000000000000e+00 +NODE 3 COORD 1.6666667163372040e-01 -4.6351060092292664e-34 7.5697026662207798e-18 +NODE 4 COORD 5.0000000000000000e-01 0.0000000000000000e+00 0.0000000000000000e+00 +NODE 5 COORD -1.6666667163372040e-01 6.1232342629258393e-17 -1.0000000000000000e+00 +NODE 6 COORD -1.6666667163372040e-01 -4.6351060092292664e-34 7.5697026662207798e-18 +NODE 7 COORD -5.0000000000000000e-01 6.1232342629258393e-17 -1.0000000000000000e+00 +NODE 8 COORD -5.0000000000000000e-01 0.0000000000000000e+00 0.0000000000000000e+00 +NODE 9 COORD 1.6666667163372040e-01 -6.1232342629258393e-17 1.0000000000000000e+00 +NODE 10 COORD 5.0000000000000000e-01 -6.1232342629258393e-17 1.0000000000000000e+00 +NODE 11 COORD -1.6666667163372040e-01 -6.1232342629258393e-17 1.0000000000000000e+00 +NODE 12 COORD -5.0000000000000000e-01 -6.1232342629258393e-17 1.0000000000000000e+00 +------------------------------------------------STRUCTURE ELEMENTS + 1 WALL QUAD4 1 2 3 4 MAT 1 KINEM nonlinear EAS none THICK 1.0 STRESS_STRAIN plane_stress GP 3 3 + 2 WALL QUAD4 2 5 6 3 MAT 1 KINEM nonlinear EAS none THICK 1.0 STRESS_STRAIN plane_stress GP 3 3 + 3 WALL QUAD4 5 7 8 6 MAT 1 KINEM nonlinear EAS none THICK 1.0 STRESS_STRAIN plane_stress GP 3 3 + 4 WALL QUAD4 4 3 9 10 MAT 1 KINEM nonlinear EAS none THICK 1.0 STRESS_STRAIN plane_stress GP 3 3 + 5 WALL QUAD4 3 6 11 9 MAT 1 KINEM nonlinear EAS none THICK 1.0 STRESS_STRAIN plane_stress GP 3 3 + 6 WALL QUAD4 6 8 12 11 MAT 1 KINEM nonlinear EAS none THICK 1.0 STRESS_STRAIN plane_stress GP 3 3 +---------------------------------------------------------------END diff --git a/tests/testing.py b/tests/testing.py index a55eff2..f35e05a 100644 --- a/tests/testing.py +++ b/tests/testing.py @@ -526,6 +526,31 @@ def test_element_types_quad(kwargs): compare(cubit, single_precision=True, **kwargs) +@pytest.mark.parametrize(*get_pre_processor_decorator(True, True)) +def test_element_types_quad_z_values(kwargs): + """Create quad4 mesh, with non-zero z-values to check that they are correctly output. + This is not the case if the automatic option from cubit while exporting the exo file + is chosen.""" + + # Initialize cubit. + cubit = CubitPy() + + # Create the plate. + cubit.cmd("create surface rectangle width 1 height 2 yplane") + cubit.cmd("curve 1 3 interval 3") + cubit.cmd("curve 2 4 interval 2") + cubit.cmd("mesh surface 1") + cubit.add_element_type( + cubit.surface(1), + cupy.element_type.quad4, + material="MAT 1", + bc_description="KINEM nonlinear EAS none THICK 1.0 STRESS_STRAIN plane_stress GP 3 3", + ) + + # Compare the input file created for baci. + compare(cubit, single_precision=True, **kwargs) + + @pytest.mark.parametrize(*get_pre_processor_decorator(True, True)) def test_block_function(kwargs): """Create a solid block with different element types."""