Skip to content

Commit

Permalink
Move locsys test to four_c folder
Browse files Browse the repository at this point in the history
  • Loading branch information
knarfnitram committed Oct 1, 2024
1 parent de1ab6c commit 61f5b59
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 45 deletions.
48 changes: 47 additions & 1 deletion tests/testing_four_c.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,18 @@
InputFile,
MaterialReissner,
mpy,
Rotation,
)
from meshpy.four_c.beam_potential import BeamPotential
from meshpy.four_c.solid_shell_thickness_direction import (
set_solid_shell_thickness_direction,
get_visualization_third_parameter_direction_hex8,
)
from meshpy.mesh_creation_functions.beam_basic_geometry import create_beam_mesh_helix
from meshpy.four_c.locsys_condition import LocSysCondition
from meshpy.mesh_creation_functions.beam_basic_geometry import (
create_beam_mesh_helix,
create_beam_mesh_line
)
from meshpy.utility import is_node_on_plane


Expand Down Expand Up @@ -256,6 +261,47 @@ def director_function(cell_center):
grid = get_visualization_third_parameter_direction_hex8(mesh_dome)
grid.save(test_file)
compare_vtk(self, ref_file, test_file)
def test_meshpy_locsys_condition(self):
"""Test case for point locsys condition for beams.
The testcase is similar to beam3r_herm2line3_static_locsys.dat, but with simpler material.
"""

# Create the input file with function and material.
input_file = InputFile()

fun = Function("SYMBOLIC_FUNCTION_OF_SPACE_TIME t")
input_file.add(fun)

mat = MaterialReissner()
input_file.add(mat)

# Create the beam.
beam_set = create_beam_mesh_line(
input_file, Beam3rHerm2Line3, mat, [2.5, 2.5, 2.5], [4.5, 2.5, 2.5], n_el=1
)

# Add dirichlet boundary conditions.
input_file.add(
BoundaryCondition(
beam_set["start"],
"NUMDOF 9 ONOFF 1 1 1 1 1 1 0 0 0 VAL 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 FUNCT 0 0 0 0 0 0 0 0 0",
bc_type=mpy.bc.dirichlet,
)
)
# Add additional dirichlet boundary condtion to check if combination with locsys condition works.
input_file.add(
BoundaryCondition(
beam_set["end"],
"NUMDOF 9 ONOFF 1 0 0 0 0 0 0 0 0 VAL 1.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 FUNCT 1 0 0 0 0 0 0 0 0",
bc_type=mpy.bc.dirichlet,
)
)

# Add locsys condition with rotation
input_file.add(LocSysCondition(beam_set["end"], Rotation([0, 0, 1], 0.1)))

# Compare with the reference solution.
compare_test_result(self, input_file.get_string(header=False, check_nox=False))


if __name__ == "__main__":
Expand Down
44 changes: 0 additions & 44 deletions tests/testing_meshpy.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@
Beam3rLine2Line2,
MaterialStVenantKirchhoff,
)
from meshpy.four_c.locsys_condition import LocSysCondition
from meshpy.node import Node, NodeCosserat
from meshpy.vtk_writer import VTKWriter
from meshpy.geometry_set import GeometrySet, GeometrySetNodes
Expand Down Expand Up @@ -1944,49 +1943,6 @@ def test_meshpy_display_pyvista(self):
mesh = self.create_beam_to_solid_conditions_model()
_plotter = mesh.display_pyvista(is_testing=True, resolution=3)

def test_meshpy_locsys_condition(self):
"""
Test case for point locsys condition for beams.
The testcase is similar to beam3r_herm2line3_static_locsys.dat, but with simpler material.
"""

# Create the input file with function and material.
input_file = InputFile()

fun = Function("SYMBOLIC_FUNCTION_OF_SPACE_TIME t")
input_file.add(fun)

mat = MaterialReissner()
input_file.add(mat)

# Create the beam.
beam_set = create_beam_mesh_line(
input_file, Beam3rHerm2Line3, mat, [2.5, 2.5, 2.5], [4.5, 2.5, 2.5], n_el=1
)

# Add dirichlet boundary conditions.
input_file.add(
BoundaryCondition(
beam_set["start"],
"NUMDOF 9 ONOFF 1 1 1 1 1 1 0 0 0 VAL 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 FUNCT 0 0 0 0 0 0 0 0 0",
bc_type=mpy.bc.dirichlet,
)
)

input_file.add(
BoundaryCondition(
beam_set["end"],
"NUMDOF 9 ONOFF 1 0 0 0 0 0 0 0 0 VAL 1.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 FUNCT 1 0 0 0 0 0 0 0 0",
bc_type=mpy.bc.dirichlet,
)
)

# Add local sys condition with rotation
input_file.add(LocSysCondition(beam_set["end"], Rotation([0, 0, 1], 0.1)))

# Compare with the reference solution.
compare_test_result(self, input_file.get_string(header=False, check_nox=False))


if __name__ == "__main__":
# Execution part of script.
Expand Down

0 comments on commit 61f5b59

Please sign in to comment.