Skip to content

Commit 82c5916

Browse files
Exposing error when boundary is missing compared to metadata (#1357) (#1358)
Co-authored-by: Ben <106089368+benflexcompute@users.noreply.github.com>
1 parent 8e38f54 commit 82c5916

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

flow360/component/simulation/primitives.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
from flow360.component.simulation.user_code.core.types import ValueOrExpression
2525
from flow360.component.simulation.utils import model_attribute_unlock
2626
from flow360.component.types import Axis
27+
from flow360.exceptions import Flow360BoundaryMissingError
2728

2829

2930
def _get_boundary_full_name(surface_name: str, volume_mesh_meta: dict[str, dict]) -> str:
@@ -43,11 +44,14 @@ def _get_boundary_full_name(surface_name: str, volume_mesh_meta: dict[str, dict]
4344
return existing_boundary_name
4445
if surface_name == "symmetric":
4546
# Provides more info when the symmetric boundary is not auto generated.
46-
raise ValueError(
47+
raise Flow360BoundaryMissingError(
4748
f"Parent zone not found for boundary: {surface_name}. "
48-
+ "It is likely that it was never auto generated because the condition is not met."
49+
"It is likely that it was never auto generated because the condition is not met."
4950
)
50-
raise ValueError(f"Parent zone not found for surface {surface_name}.")
51+
raise Flow360BoundaryMissingError(
52+
f"Parent zone not found for surface {surface_name}. "
53+
"It may have been deleted due to overlapping with generated symmetry plane."
54+
)
5155

5256

5357
def _check_axis_is_orthogonal(axis_pair: Tuple[Axis, Axis]) -> Tuple[Axis, Axis]:

flow360/exceptions.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ class Flow360ValidationError(Flow360Error):
4141
"""Error when constructing FLow360 components."""
4242

4343

44+
class Flow360BoundaryMissingError(Flow360Error):
45+
"""Error when a boundary in simulation.json is not found in mesh metadata"""
46+
47+
4448
class Flow360ErrorWithLocation(Exception):
4549
"""
4650
Error with metadata on where the error is in the SimulationParams.

0 commit comments

Comments
 (0)