Skip to content

Commit 2d4e7ab

Browse files
[FXC-2006] Disable boundary completeness and deletion validation (#1330)
* [FSC-2006] Disable boundary completness and deletion validation * Fix unit test
1 parent 88c2087 commit 2d4e7ab

File tree

6 files changed

+234
-202
lines changed

6 files changed

+234
-202
lines changed

flow360/component/simulation/primitives.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -514,6 +514,8 @@ class Surface(_SurfaceEntityBase):
514514
private_attribute_sub_components: Optional[List[str]] = pd.Field(
515515
[], description="The face ids in geometry that composed into this `Surface`."
516516
)
517+
# pylint: disable=fixme
518+
# TODO: This should be deprecated since it is not very useful or easy to use.
517519
private_attribute_potential_issues: List[_SurfaceIssueEnums] = pd.Field(
518520
[],
519521
description="Issues (not necessarily problems) found on this `Surface` after inspection by "

flow360/component/simulation/user_defined_dynamics/user_defined_dynamics.py

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@
88
from flow360.component.simulation.framework.entity_base import EntityList
99
from flow360.component.simulation.framework.expressions import StringExpression
1010
from flow360.component.simulation.primitives import Cylinder, GenericVolume, Surface
11-
from flow360.component.simulation.validation.validation_context import (
12-
get_validation_info,
13-
)
1411
from flow360.component.simulation.validation.validation_utils import (
1512
check_deleted_surface_in_entity_list,
1613
)
@@ -115,17 +112,19 @@ def ensure_surface_existence(cls, value):
115112
@classmethod
116113
def ensure_output_surface_existence(cls, value):
117114
"""Ensure that the output target surface is not a deleted surface"""
118-
validation_info = get_validation_info()
119-
if validation_info is None or validation_info.auto_farfield_method is None:
120-
# validation not necessary now.
121-
return value
122115

123-
# - Check if the surfaces are deleted.
124-
# pylint: disable=protected-access
125-
if isinstance(value, Surface) and value._will_be_deleted_by_mesher(
126-
validation_info.auto_farfield_method
127-
):
128-
raise ValueError(
129-
f"Boundary `{value.name}` will likely be deleted after mesh generation. Therefore it cannot be used."
130-
)
116+
# --- Disabled for FXC-2006
117+
# validation_info = get_validation_info()
118+
# if validation_info is None or validation_info.auto_farfield_method is None:
119+
# # validation not necessary now.
120+
# return value
121+
122+
# # - Check if the surfaces are deleted.
123+
# # pylint: disable=protected-access
124+
# if isinstance(value, Surface) and value._will_be_deleted_by_mesher(
125+
# validation_info.auto_farfield_method
126+
# ):
127+
# raise ValueError(
128+
# f"Boundary `{value.name}` will likely be deleted after mesh generation. Therefore it cannot be used."
129+
# )
131130
return value

flow360/component/simulation/validation/validation_simulation_params.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,10 @@ def _check_complete_boundary_condition_and_unknown_surface(
313313
): # pylint:disable=too-many-branches
314314
## Step 1: Get all boundaries patches from asset cache
315315

316+
return params
317+
318+
# --- Disabled for FXC-2006
319+
# pylint: disable=unreachable
316320
current_lvls = get_validation_levels() if get_validation_levels() else []
317321
if all(level not in current_lvls for level in (ALL, CASE)):
318322
return params

flow360/component/simulation/validation/validation_utils.py

Lines changed: 37 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
from flow360.component.simulation.entity_info import DraftEntityTypes
99
from flow360.component.simulation.primitives import (
10-
Surface,
1110
_SurfaceEntityBase,
1211
_VolumeEntityBase,
1312
)
@@ -68,25 +67,27 @@ def check_deleted_surface_in_entity_list(value):
6867
Check if any boundary is meant to be deleted
6968
value--> EntityList
7069
"""
71-
validation_info = get_validation_info()
72-
if (
73-
validation_info is None
74-
or validation_info.auto_farfield_method is None
75-
or validation_info.is_beta_mesher is True
76-
):
77-
# validation not necessary now.
78-
return value
79-
80-
# - Check if the surfaces are deleted.
81-
for surface in value.stored_entities:
82-
if isinstance(
83-
surface, Surface
84-
) and surface._will_be_deleted_by_mesher( # pylint:disable=protected-access
85-
validation_info.auto_farfield_method
86-
):
87-
raise ValueError(
88-
f"Boundary `{surface.name}` will likely be deleted after mesh generation. Therefore it cannot be used."
89-
)
70+
# --- Disabled for FXC-2006
71+
# validation_info = get_validation_info()
72+
# if (
73+
# validation_info is None
74+
# or validation_info.auto_farfield_method is None
75+
# or validation_info.is_beta_mesher is True
76+
# ):
77+
# # validation not necessary now.
78+
# return value
79+
80+
# # - Check if the surfaces are deleted.
81+
# for surface in value.stored_entities:
82+
# if isinstance(
83+
# surface, Surface
84+
# ) and surface._will_be_deleted_by_mesher( # pylint:disable=protected-access
85+
# validation_info.auto_farfield_method
86+
# ):
87+
# raise ValueError(
88+
# f"Boundary `{surface.name}` will likely be deleted after mesh generation. "
89+
# "Therefore it cannot be used."
90+
# )
9091

9192
return value
9293

@@ -96,19 +97,22 @@ def check_deleted_surface_pair(value):
9697
Check if any boundary is meant to be deleted
9798
value--> SurfacePair
9899
"""
99-
validation_info = get_validation_info()
100-
if validation_info is None or validation_info.auto_farfield_method is None:
101-
# validation not necessary now.
102-
return value
103-
104-
# - Check if the surfaces are deleted.
105-
for surface in value.pair:
106-
if surface._will_be_deleted_by_mesher( # pylint:disable=protected-access
107-
validation_info.auto_farfield_method
108-
):
109-
raise ValueError(
110-
f"Boundary `{surface.name}` will likely be deleted after mesh generation. Therefore it cannot be used."
111-
)
100+
101+
# --- Disabled for FXC-2006
102+
# validation_info = get_validation_info()
103+
# if validation_info is None or validation_info.auto_farfield_method is None:
104+
# # validation not necessary now.
105+
# return value
106+
107+
# # - Check if the surfaces are deleted.
108+
# for surface in value.pair:
109+
# if surface._will_be_deleted_by_mesher( # pylint:disable=protected-access
110+
# validation_info.auto_farfield_method
111+
# ):
112+
# raise ValueError(
113+
# f"Boundary `{surface.name}` will likely be deleted after mesh generation. "
114+
# "Therefore it cannot be used."
115+
# )
112116

113117
return value
114118

tests/simulation/params/test_automated_farfield.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -190,10 +190,11 @@ def _run_validation(params):
190190

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

198199
params.models.append(SymmetryPlane(surfaces=[farfield.symmetry_planes]))
199200
errors = _run_validation(params)

0 commit comments

Comments
 (0)