Skip to content

Commit

Permalink
Add test case
Browse files Browse the repository at this point in the history
  • Loading branch information
isteinbrecher committed Mar 28, 2024
1 parent a4ceeb5 commit f8b6884
Show file tree
Hide file tree
Showing 6 changed files with 108 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ created by pre_exodus
------------------------------------------------------PROBLEM SIZE
//ELEMENTS 6
//NODES 12
DIM 2
DIM 3


-----------------------------------------------DNODE-NODE TOPOLOGY
Expand Down
22 changes: 22 additions & 0 deletions tests/input-files-ref/test_element_types_quad_z_values_cubitpy.dat
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ created by pre_exodus
------------------------------------------------------PROBLEM SIZE
//ELEMENTS 18
//NODES 28
DIM 2
DIM 3


-----------------------------------------------DNODE-NODE TOPOLOGY
Expand Down
22 changes: 22 additions & 0 deletions tests/test_element_types_quad_z_values_cubitpy.dat
Original file line number Diff line number Diff line change
@@ -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
25 changes: 25 additions & 0 deletions tests/testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."""
Expand Down

0 comments on commit f8b6884

Please sign in to comment.