Skip to content

fix(): Redefine the surface issue enums #795

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions flow360/component/simulation/primitives.py
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,29 @@ def _check_inner_radius_is_less_than_outer_radius(self) -> Self:
class _SurfaceIssueEnums(str, Enum):
"""
Enums for indicating that there is something wrong/special about the surface.

+-------------------+--------------------+--------------------+
| If my sub faces...| Issue should be | Conflict with when |
| | predicted as | using |
+-------------------+--------------------+--------------------+
| All overlaps with | overlap_half_model_| Auto and Quasi |
| the HalfModel Symm| symmetric | |
+-------------------+--------------------+--------------------+
| All overlaps with | overlap_quasi_3d_ | Quasi |
| the Non Half | symmetric | |
| Model (the other | | |
| Q3D) Symm. Or not | | |
| half model at all.| | |
+-------------------+--------------------+--------------------+
| Some on HalfModel | overlap_quasi_3d_ | Quasi |
| Symm, Some on Non | symmetric | |
| HalfModel Symm | | |
+-------------------+--------------------+--------------------+
| Have some faces | None | None |
| elsewhere | | |
+-------------------+--------------------+--------------------+


"""

# pylint: disable=invalid-name
Expand Down Expand Up @@ -461,6 +484,8 @@ def _will_be_deleted_by_mesher(self, farfield_method: Literal["auto", "quasi-3d"
return (
_SurfaceIssueEnums.overlap_quasi_3d_symmetric
in self.private_attribute_potential_issues
or _SurfaceIssueEnums.overlap_half_model_symmetric
in self.private_attribute_potential_issues
)

raise ValueError(f"Unknown auto farfield generation method: {farfield_method}.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@
VolumeOutput,
)
from flow360.component.simulation.primitives import (
GhostCircularPlane,
GhostSphere,
GhostSurface,
_SurfaceEntityBase,
_VolumeEntityBase,
)
Expand Down Expand Up @@ -299,7 +296,9 @@ def _validate_cht_has_heat_transfer(params):
return params


def _check_complete_boundary_condition_and_unknown_surface(params):
def _check_complete_boundary_condition_and_unknown_surface(
params,
): # pylint:disable=too-many-branches
## Step 1: Get all boundaries patches from asset cache

current_lvls = get_validation_levels() if get_validation_levels() else []
Expand All @@ -318,6 +317,18 @@ def _check_complete_boundary_condition_and_unknown_surface(params):
for item in asset_boundary_entities
if item._will_be_deleted_by_mesher(automated_farfield_method) is False
]
if automated_farfield_method == "auto":
asset_boundary_entities += [
item
for item in params.private_attribute_asset_cache.project_entity_info.ghost_entities
if item.name not in ("symmetric-1", "symmetric-2")
]
elif automated_farfield_method == "quasi-3d":
asset_boundary_entities += [
item
for item in params.private_attribute_asset_cache.project_entity_info.ghost_entities
if item.name != "symmetric"
]

if asset_boundary_entities is None or asset_boundary_entities == []:
raise ValueError("[Internal] Failed to retrieve asset boundaries")
Expand All @@ -344,8 +355,6 @@ def _check_complete_boundary_condition_and_unknown_surface(params):
]

for entity in entities:
if isinstance(entity, (GhostSurface, GhostSphere, GhostCircularPlane)):
continue
used_boundaries.add(entity.name)

## Step 3: Use set operations to find missing and unknown boundaries
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

5 changes: 0 additions & 5 deletions tests/data/mock_webapi/project_case_simulation_json_resp.json

This file was deleted.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Loading