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
17 changes: 0 additions & 17 deletions flow360/component/simulation/meshing_param/params.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,23 +144,6 @@ def invalid_number_of_boundary_layers(cls, value):
raise ValueError("Number of boundary layers is only supported by the beta mesher.")
return value

@pd.field_validator("planar_face_tolerance", mode="after")
@classmethod
def invalid_planar_face_tolerance(cls, value):
"""Ensure planar face tolerance is not specified"""
validation_info = get_validation_info()

if validation_info is None:
return value

# pylint:disable = unsubscriptable-object
if (
value != cls.model_fields["planar_face_tolerance"].default
and not validation_info.is_beta_mesher
):
raise ValueError("Planar face tolerance is only supported by the beta mesher.")
return value

@pd.field_validator("geometry_accuracy", mode="after")
@classmethod
def invalid_geometry_accuracy(cls, value):
Expand Down
15 changes: 7 additions & 8 deletions flow360/component/simulation/primitives.py
Original file line number Diff line number Diff line change
Expand Up @@ -623,17 +623,16 @@ def _get_existence_dependency(self, validation_info):
def exists(self, validation_info) -> bool:
"""Mesher logic for symmetric plane existence."""

if (
validation_info is None
or not validation_info.is_beta_mesher
or self.name != "symmetric"
):
# Non-beta mesher mode, then symmetric plane existence is handled upstream.
if self.name != "symmetric":
# Quasi-3D mode, no need to check existence.
return True

if validation_info is None:
raise ValueError("Validation info is required for GhostCircularPlane existence check.")

if validation_info.global_bounding_box is None:
# This likely means the user try to use in-house mesher on old cloud resources.
# We cannot validate if symmetric exists so will let it pass. Pipeline will error out.
# This likely means the user try to use mesher on old cloud resources.
# We cannot validate if symmetric exists so will let it pass. Pipeline will error out anyway.
return True

y_min, y_max, tolerance, _ = self._get_existence_dependency(validation_info)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
from flow360.exceptions import Flow360TranslationError


def unifrom_refinement_translator(obj: UniformRefinement):
def uniform_refinement_translator(obj: UniformRefinement):
"""
Translate UniformRefinement.

Expand Down Expand Up @@ -94,7 +94,7 @@ def rotation_cylinder_translator(obj: RotationCylinder, rotor_disk_names: list):
return setting


def refinement_entitity_injector(entity_obj):
def refinement_entity_injector(entity_obj):
"""Injector for UniformRefinement entity [box & cylinder]."""
if isinstance(entity_obj, Cylinder):
return {
Expand Down Expand Up @@ -188,7 +188,10 @@ def get_volume_meshing_json(input_params: SimulationParams, mesh_units):
break

if isinstance(zone, AutomatedFarfield):
translated["farfield"] = {"type": zone.method}
translated["farfield"] = {
"type": zone.method,
"planarFaceTolerance": meshing_params.defaults.planar_face_tolerance,
}
break

if "farfield" not in translated:
Expand Down Expand Up @@ -231,9 +234,9 @@ def get_volume_meshing_json(input_params: SimulationParams, mesh_units):
uniform_refinement_list = translate_setting_and_apply_to_all_entities(
meshing_params.refinements,
UniformRefinement,
unifrom_refinement_translator,
uniform_refinement_translator,
to_list=True,
entity_injection_func=refinement_entitity_injector,
entity_injection_func=refinement_entity_injector,
)
rotor_disk_refinement = translate_setting_and_apply_to_all_entities(
meshing_params.refinements,
Expand Down
4 changes: 3 additions & 1 deletion flow360/component/simulation/validation/validation_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,10 @@ def check_deleted_surface_pair(value):
def check_symmetric_boundary_existence_for_inhouse(stored_entities):
"""Check according to the criteria if the symmetric plane exists."""
validation_info = get_validation_info()
if validation_info is None or validation_info.is_beta_mesher is False:

if validation_info is None:
return stored_entities

for item in stored_entities:
if item.private_attribute_entity_type_name != "GhostCircularPlane":
continue
Expand Down
5 changes: 1 addition & 4 deletions tests/simulation/params/test_validators_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -1845,10 +1845,7 @@ def test_beta_mesher_only_features():
root_item_type="Geometry",
validation_level="VolumeMesh",
)
assert len(errors) == 1
assert errors[0]["msg"] == (
"Value error, Planar face tolerance is only supported by the beta mesher."
)
assert errors is None


def test_geometry_AI_only_features():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ def test_param_to_json(get_test_param, get_surface_mesh):

ref_dict = {
"refinementFactor": 1.45,
"farfield": {"type": "auto"},
"farfield": {"type": "auto", "planarFaceTolerance": 1e-6},
"volume": {
"firstLayerThickness": 1.35e-06,
"growthRate": 1.04,
Expand Down
Loading