Skip to content

Commit 80e8f8c

Browse files
committed
Remove 4C capabilities fomr space-time functionality
1 parent 5fdc47b commit 80e8f8c

6 files changed

+26
-704
lines changed

src/meshpy/space_time/beam_to_space_time.py

Lines changed: 24 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,6 @@
4343
get_coupled_nodes_to_master_map as _get_coupled_nodes_to_master_map,
4444
)
4545
from meshpy.core.node import NodeCosserat as _NodeCosserat
46-
from meshpy.four_c.element_beam import Beam3rHerm2Line3 as _Beam3rHerm2Line3
47-
from meshpy.four_c.element_beam import Beam3rLine2Line2 as _Beam3rLine2Line2
4846
from meshpy.utils.nodes import get_nodal_coordinates as _get_nodal_coordinates
4947

5048

@@ -58,80 +56,26 @@ def __init__(self, coordinates, rotation, time, **kwargs):
5856
super().__init__(coordinates, rotation, **kwargs)
5957
self.time = time
6058

61-
def _get_dat(self):
62-
"""Return the line that represents this node in the input file.
63-
64-
For now, we add time to the z-dimension. In the future, we could
65-
add the time to the element description, similar to the rotation
66-
vectors
67-
"""
68-
69-
space_time_coordinates = self.coordinates.copy()
70-
space_time_coordinates[2] += self.time
71-
72-
coordinate_string = " ".join(
73-
[
74-
(
75-
_mpy.dat_precision.format(component + 0)
76-
if _np.abs(component) >= _mpy.eps_pos
77-
else "0"
78-
)
79-
for component in space_time_coordinates
80-
]
81-
)
82-
return f"NODE {self.i_global} COORD {coordinate_string}"
83-
8459

8560
class SpaceTimeElement(_VolumeElement):
8661
"""A general beam space-time surface element."""
8762

88-
def __init__(
89-
self,
90-
nodes,
91-
*,
92-
dat_pre_nodes="DUMMY",
93-
dat_post_nodes="POST_DUMMY",
94-
**kwargs,
95-
):
96-
super().__init__(
97-
nodes=nodes,
98-
dat_pre_nodes=dat_pre_nodes,
99-
dat_post_nodes=dat_post_nodes,
100-
**kwargs,
101-
)
102-
103-
def _get_dat(self):
104-
"""Return the dat line for this element."""
105-
106-
# String with the node ids.
107-
nodes_string = ""
108-
for node in self.nodes:
109-
nodes_string += f"{node.i_global} "
110-
111-
# Rotation vector string
112-
rotation_vectors = []
113-
for node in self.nodes:
114-
rotation_vectors.extend(node.rotation.get_rotation_vector())
115-
rotation_vectors = map(str, rotation_vectors)
116-
117-
# Return the dat line.
118-
return f"{self.i_global} {self.dat_pre_nodes} {self.four_c_name} {nodes_string} {self.dat_post_nodes} {' '.join(rotation_vectors)}"
63+
def __init__(self, nodes, **kwargs):
64+
super().__init__(nodes=nodes, **kwargs)
11965

12066

12167
class SpaceTimeElementQuad4(SpaceTimeElement):
12268
"""A space-time element with 4 nodes."""
12369

12470
vtk_cell_type = _vtk.vtkQuad
12571
vtk_topology = list(range(4))
126-
four_c_name = "QUAD4"
12772

12873

12974
class SpaceTimeElementQuad9(SpaceTimeElement):
13075
"""A space-time element with 9 nodes."""
13176

13277
vtk_cell_type = _vtk.vtkQuadraticQuad
13378
vtk_topology = list(range(9))
134-
four_c_name = "QUAD9"
13579

13680

13781
def beam_to_space_time(
@@ -143,27 +87,26 @@ def beam_to_space_time(
14387
) -> _Tuple[_Mesh, _GeometryName]:
14488
"""Convert a MeshPy beam mesh to a surface space-time mesh.
14589
146-
Args
147-
----
148-
mesh_space_or_generator:
149-
Either a fixed spatial Mesh object or a function that returns the
150-
spatial mesh for a given time. If this is a generator, the topology
151-
of the mesh at the initial time is chosen for all times, only the
152-
positions and rotations are updated.
153-
time_duration:
154-
Total time increment to be solved with the space-time mesh
155-
number_of_elements_in_time:
156-
Number of elements in time direction
157-
time_start:
158-
Starting time for the space-time mesh. Can be used to create time slaps.
159-
Return
160-
----
161-
space_time_mesh:
162-
The space time mesh. Be aware that translating / rotating this mesh
163-
might lead to unexpected results.
164-
return_set:
165-
The nodes sets to be returned for the space time mesh:
166-
"start", "end", "left", "right", "surface"
90+
Args:
91+
mesh_space_or_generator:
92+
Either a fixed spatial Mesh object or a function that returns the
93+
spatial mesh for a given time. If this is a generator, the topology
94+
of the mesh at the initial time is chosen for all times, only the
95+
positions and rotations are updated.
96+
time_duration:
97+
Total time increment to be solved with the space-time mesh
98+
number_of_elements_in_time:
99+
Number of elements in time direction
100+
time_start:
101+
Starting time for the space-time mesh. Can be used to create time slaps.
102+
Returns:
103+
Tuple (space_time_mesh, return_set)
104+
- space_time_mesh:
105+
The space time mesh. Be aware that translating / rotating this mesh
106+
might lead to unexpected results.
107+
- return_set:
108+
The nodes sets to be returned for the space time mesh:
109+
"start", "end", "left", "right", "surface"
167110
"""
168111

169112
# Get the "reference" spatial mesh
@@ -186,11 +129,11 @@ def beam_to_space_time(
186129
space_time_element_type: _Union[
187130
_Type[SpaceTimeElementQuad4], _Type[SpaceTimeElementQuad9]
188131
]
189-
if element_type == _Beam3rLine2Line2:
132+
if len(element_type.nodes_create) == 2:
190133
number_of_copies_in_time = number_of_elements_in_time + 1
191134
time_increment_between_nodes = time_duration / number_of_elements_in_time
192135
space_time_element_type = SpaceTimeElementQuad4
193-
elif element_type == _Beam3rHerm2Line3:
136+
elif len(element_type.nodes_create) == 3:
194137
number_of_copies_in_time = 2 * number_of_elements_in_time + 1
195138
time_increment_between_nodes = time_duration / (2 * number_of_elements_in_time)
196139
space_time_element_type = SpaceTimeElementQuad9

tests/reference-files/test_space_time_curved_linear.4C.yaml

Lines changed: 0 additions & 87 deletions
This file was deleted.

0 commit comments

Comments
 (0)