Skip to content

Commit 7ac1172

Browse files
Revert "Ensure the geometry tolerance and the planar tolerance are compatible with each other (#1389)"
This reverts commit ba7bd43.
1 parent 5113e28 commit 7ac1172

File tree

2 files changed

+0
-93
lines changed

2 files changed

+0
-93
lines changed

flow360/component/simulation/meshing_param/params.py

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -180,42 +180,6 @@ def invalid_geometry_accuracy(cls, value):
180180
raise ValueError("Geometry accuracy is required when geometry AI is used.")
181181
return value
182182

183-
@pd.field_validator("geometry_accuracy", mode="after")
184-
@classmethod
185-
def compatible_geometry_accuracy_and_planar_face_tolerance(cls, value):
186-
"""Ensure geometry accuracy and planar face tolerance are compatible"""
187-
if value is None:
188-
return value
189-
190-
validation_info = get_validation_info()
191-
192-
if (
193-
validation_info is None
194-
or validation_info.planar_face_tolerance is None
195-
or validation_info.global_bounding_box is None
196-
or validation_info.project_length_unit is None
197-
):
198-
return value
199-
200-
absolute_tolerance_dimensioned = (
201-
validation_info.global_bounding_box.largest_dimension
202-
* validation_info.planar_face_tolerance
203-
* validation_info.project_length_unit
204-
)
205-
if value > absolute_tolerance_dimensioned:
206-
minimum_planar_face_tolerance = (
207-
value
208-
/ validation_info.project_length_unit
209-
/ validation_info.global_bounding_box.largest_dimension
210-
).value
211-
raise ValueError(
212-
f"geometry_accuracy is too large for the planar_face_tolerance to take effect."
213-
f" Reduce geometry_accuracy to at most {absolute_tolerance_dimensioned} "
214-
f"or increase the planar_face_tolerance to at least {minimum_planar_face_tolerance}."
215-
)
216-
217-
return value
218-
219183
@pd.field_validator(
220184
"surface_max_aspect_ratio", "surface_max_adaptation_iterations", mode="after"
221185
)

tests/simulation/params/test_validators_params.py

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

88
import flow360.component.simulation.units as u
99
from flow360.component.simulation.entity_info import (
10-
GeometryEntityInfo,
1110
SurfaceMeshEntityInfo,
1211
VolumeMeshEntityInfo,
1312
)
@@ -2002,7 +2001,6 @@ def test_beta_mesher_only_features():
20022001

20032002

20042003
def test_geometry_AI_only_features():
2005-
# * Test GAI guardrails
20062004
with SI_unit_system:
20072005
params = SimulationParams(
20082006
meshing=MeshingParams(
@@ -2063,61 +2061,6 @@ def test_geometry_AI_only_features():
20632061
errors[0]["msg"] == "Value error, Geometry accuracy is required when geometry AI is used."
20642062
)
20652063

2066-
# * Test geometry_accuracy and planar_face_tolerance compatibility
2067-
with SI_unit_system:
2068-
params_original = SimulationParams(
2069-
meshing=MeshingParams(
2070-
defaults=MeshingDefaults(
2071-
geometry_accuracy=1e-5 * u.m,
2072-
planar_face_tolerance=1e-10,
2073-
boundary_layer_first_layer_thickness=10,
2074-
surface_max_edge_length=1e-2,
2075-
),
2076-
),
2077-
private_attribute_asset_cache=AssetCache(
2078-
project_length_unit=1 * u.cm,
2079-
use_inhouse_mesher=True,
2080-
use_geometry_AI=True,
2081-
project_entity_info=GeometryEntityInfo(
2082-
global_bounding_box=[[-100, -100, -100], [100, 1e-12, 100]],
2083-
),
2084-
),
2085-
)
2086-
params, errors, _ = validate_model(
2087-
params_as_dict=params_original.model_dump(mode="json"),
2088-
validated_by=ValidationCalledBy.LOCAL,
2089-
root_item_type="Geometry",
2090-
validation_level="VolumeMesh",
2091-
)
2092-
assert len(errors) == 1
2093-
# Largest dim = 200 cm
2094-
# with planar face tolerance = 1e-10
2095-
# largest geometry accuracy = 1e-10 * 200 cm = 2e-8 cm
2096-
# with geometry accuracy = 1e-5m
2097-
# minimum planar face tolerance = 1e-5m / 200 cm = 5e-06
2098-
assert errors[0]["msg"] == (
2099-
"Value error, geometry_accuracy is too large for the planar_face_tolerance to take effect. "
2100-
"Reduce geometry_accuracy to at most 2e-08 cm or increase the planar_face_tolerance to at least 5e-06."
2101-
)
2102-
params_original.meshing.defaults.geometry_accuracy = 2e-08 * u.cm
2103-
params, _, _ = validate_model(
2104-
params_as_dict=params_original.model_dump(mode="json"),
2105-
validated_by=ValidationCalledBy.LOCAL,
2106-
root_item_type="Geometry",
2107-
validation_level="VolumeMesh",
2108-
)
2109-
assert params
2110-
2111-
params_original.meshing.defaults.geometry_accuracy = 1e-5 * u.m
2112-
params_original.meshing.defaults.planar_face_tolerance = 5e-06
2113-
params, _, _ = validate_model(
2114-
params_as_dict=params_original.model_dump(mode="json"),
2115-
validated_by=ValidationCalledBy.LOCAL,
2116-
root_item_type="Geometry",
2117-
validation_level="VolumeMesh",
2118-
)
2119-
assert params
2120-
21212064

21222065
def test_redefined_user_defined_fields():
21232066

0 commit comments

Comments
 (0)