Skip to content
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
2 changes: 2 additions & 0 deletions flow360/component/simulation/primitives.py
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,8 @@ class Surface(_SurfaceEntityBase):
private_attribute_sub_components: Optional[List[str]] = pd.Field(
[], description="The face ids in geometry that composed into this `Surface`."
)
# pylint: disable=fixme
# TODO: This should be deprecated since it is not very useful or easy to use.
private_attribute_potential_issues: List[_SurfaceIssueEnums] = pd.Field(
[],
description="Issues (not necessarily problems) found on this `Surface` after inspection by "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@
from flow360.component.simulation.framework.entity_base import EntityList
from flow360.component.simulation.framework.expressions import StringExpression
from flow360.component.simulation.primitives import Cylinder, GenericVolume, Surface
from flow360.component.simulation.validation.validation_context import (
get_validation_info,
)
from flow360.component.simulation.validation.validation_utils import (
check_deleted_surface_in_entity_list,
)
Expand Down Expand Up @@ -115,17 +112,19 @@ def ensure_surface_existence(cls, value):
@classmethod
def ensure_output_surface_existence(cls, value):
"""Ensure that the output target surface is not a deleted surface"""
validation_info = get_validation_info()
if validation_info is None or validation_info.auto_farfield_method is None:
# validation not necessary now.
return value

# - Check if the surfaces are deleted.
# pylint: disable=protected-access
if isinstance(value, Surface) and value._will_be_deleted_by_mesher(
validation_info.auto_farfield_method
):
raise ValueError(
f"Boundary `{value.name}` will likely be deleted after mesh generation. Therefore it cannot be used."
)
# --- Disabled for FXC-2006
# validation_info = get_validation_info()
# if validation_info is None or validation_info.auto_farfield_method is None:
# # validation not necessary now.
# return value

# # - Check if the surfaces are deleted.
# # pylint: disable=protected-access
# if isinstance(value, Surface) and value._will_be_deleted_by_mesher(
# validation_info.auto_farfield_method
# ):
# raise ValueError(
# f"Boundary `{value.name}` will likely be deleted after mesh generation. Therefore it cannot be used."
# )
return value
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,10 @@ def _check_complete_boundary_condition_and_unknown_surface(
): # pylint:disable=too-many-branches
## Step 1: Get all boundaries patches from asset cache

return params

# --- Disabled for FXC-2006
# pylint: disable=unreachable
current_lvls = get_validation_levels() if get_validation_levels() else []
if all(level not in current_lvls for level in (ALL, CASE)):
return params
Expand Down
70 changes: 37 additions & 33 deletions flow360/component/simulation/validation/validation_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

from flow360.component.simulation.entity_info import DraftEntityTypes
from flow360.component.simulation.primitives import (
Surface,
_SurfaceEntityBase,
_VolumeEntityBase,
)
Expand Down Expand Up @@ -68,25 +67,27 @@ def check_deleted_surface_in_entity_list(value):
Check if any boundary is meant to be deleted
value--> EntityList
"""
validation_info = get_validation_info()
if (
validation_info is None
or validation_info.auto_farfield_method is None
or validation_info.is_beta_mesher is True
):
# validation not necessary now.
return value

# - Check if the surfaces are deleted.
for surface in value.stored_entities:
if isinstance(
surface, Surface
) and surface._will_be_deleted_by_mesher( # pylint:disable=protected-access
validation_info.auto_farfield_method
):
raise ValueError(
f"Boundary `{surface.name}` will likely be deleted after mesh generation. Therefore it cannot be used."
)
# --- Disabled for FXC-2006
# validation_info = get_validation_info()
# if (
# validation_info is None
# or validation_info.auto_farfield_method is None
# or validation_info.is_beta_mesher is True
# ):
# # validation not necessary now.
# return value

# # - Check if the surfaces are deleted.
# for surface in value.stored_entities:
# if isinstance(
# surface, Surface
# ) and surface._will_be_deleted_by_mesher( # pylint:disable=protected-access
# validation_info.auto_farfield_method
# ):
# raise ValueError(
# f"Boundary `{surface.name}` will likely be deleted after mesh generation. "
# "Therefore it cannot be used."
# )

return value

Expand All @@ -96,19 +97,22 @@ def check_deleted_surface_pair(value):
Check if any boundary is meant to be deleted
value--> SurfacePair
"""
validation_info = get_validation_info()
if validation_info is None or validation_info.auto_farfield_method is None:
# validation not necessary now.
return value

# - Check if the surfaces are deleted.
for surface in value.pair:
if surface._will_be_deleted_by_mesher( # pylint:disable=protected-access
validation_info.auto_farfield_method
):
raise ValueError(
f"Boundary `{surface.name}` will likely be deleted after mesh generation. Therefore it cannot be used."
)

# --- Disabled for FXC-2006
# validation_info = get_validation_info()
# if validation_info is None or validation_info.auto_farfield_method is None:
# # validation not necessary now.
# return value

# # - Check if the surfaces are deleted.
# for surface in value.pair:
# if surface._will_be_deleted_by_mesher( # pylint:disable=protected-access
# validation_info.auto_farfield_method
# ):
# raise ValueError(
# f"Boundary `{surface.name}` will likely be deleted after mesh generation. "
# "Therefore it cannot be used."
# )

return value

Expand Down
9 changes: 5 additions & 4 deletions tests/simulation/params/test_automated_farfield.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,10 +190,11 @@ def _run_validation(params):

# Valid Symmetric but did not use it
errors = _run_validation(params)
assert len(errors) == 1
assert (
"The following boundaries do not have a boundary condition: symmetric." in errors[0]["msg"]
)
# --- Disabled for FXC-2006
# assert len(errors) == 1
# assert (
# "The following boundaries do not have a boundary condition: symmetric." in errors[0]["msg"]
# )

params.models.append(SymmetryPlane(surfaces=[farfield.symmetry_planes]))
errors = _run_validation(params)
Expand Down
Loading
Loading