Skip to content

Commit 912b7b5

Browse files
authored
Add periodic boundary condtions section string (#119)
1 parent 1690ea2 commit 912b7b5

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

src/cubitpy/cubitpy_types.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,8 @@ class BoundaryConditionType(Enum):
292292
# Please use "solid_to_solid_contact" instead.
293293
solid_to_solid_surface_contact = auto()
294294
solid_to_solid_contact = auto()
295+
periodic_rve_surface = auto()
296+
periodic_rve_edge = auto()
295297

296298
# fluid
297299
flow_rate = auto()
@@ -362,6 +364,12 @@ def get_dat_bc_section_header(self, geometry_type):
362364
geometry_type == GeometryType.curve
363365
):
364366
return "FLUID NEUMANN INFLOW LINE CONDITIONS"
367+
elif self == self.periodic_rve_surface and (
368+
geometry_type == GeometryType.surface
369+
):
370+
return "DESIGN SURF PERIODIC RVE 3D BOUNDARY CONDITIONS"
371+
elif self == self.periodic_rve_edge and (geometry_type == GeometryType.curve):
372+
return "DESIGN EDGE PERIODIC RVE 2D BOUNDARY CONDITIONS"
365373
else:
366374
raise ValueError(
367375
"No implemented case for {} and {}!".format(self, geometry_type)

tests/test_cubitpy.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2259,3 +2259,25 @@ def test_object_formatter():
22592259
TypeError, match="Expected CubitObject, CubitGroup or int, but got "
22602260
):
22612261
formatter(surface_1, 0.5)
2262+
2263+
2264+
@pytest.mark.parametrize(
2265+
("bc_type", "geometry", "expected_section"),
2266+
[
2267+
(
2268+
cupy.bc_type.periodic_rve_surface,
2269+
cupy.geometry.surface,
2270+
"DESIGN SURF PERIODIC RVE 3D BOUNDARY CONDITIONS",
2271+
),
2272+
(
2273+
cupy.bc_type.periodic_rve_edge,
2274+
cupy.geometry.curve,
2275+
"DESIGN EDGE PERIODIC RVE 2D BOUNDARY CONDITIONS",
2276+
),
2277+
],
2278+
)
2279+
def test_periodic_rve_boundary_condition_section_headers(
2280+
bc_type, geometry, expected_section
2281+
):
2282+
"""Check section headers for periodic RVE boundary condition types."""
2283+
assert bc_type.get_dat_bc_section_header(geometry) == expected_section

0 commit comments

Comments
 (0)