diff --git a/flow360/component/simulation/meshing_param/snappy/snappy_mesh_refinements.py b/flow360/component/simulation/meshing_param/snappy/snappy_mesh_refinements.py index b74a1f91e..e5d8abd38 100644 --- a/flow360/component/simulation/meshing_param/snappy/snappy_mesh_refinements.py +++ b/flow360/component/simulation/meshing_param/snappy/snappy_mesh_refinements.py @@ -113,6 +113,9 @@ class SurfaceEdgeRefinement(Flow360BaseModel): retain_on_smoothing: bool = pd.Field( True, description="Maintain the edge when smoothing is applied." ) + geometric_test_only: bool = pd.Field( + False, description="If enabled, only geometric tests are performed on the edge (region edge will be ignored)." + ) @pd.model_validator(mode="after") def _check_spacing_format(self) -> Self: diff --git a/flow360/component/simulation/translator/surface_meshing_translator.py b/flow360/component/simulation/translator/surface_meshing_translator.py index 682af274b..ae9d8a295 100644 --- a/flow360/component/simulation/translator/surface_meshing_translator.py +++ b/flow360/component/simulation/translator/surface_meshing_translator.py @@ -165,6 +165,7 @@ def apply_SnappySurfaceEdgeRefinement( edges["minLen"] = refinement.min_len.value.item() if refinement.retain_on_smoothing is not None: edges["retainOnSmoothing"] = refinement.retain_on_smoothing + edges["geometricTestOnly"] = "yes" if refinement.geometric_test_only else "no" if refinement.spacing is None: edges["edgeSpacing"] = defaults.min_spacing.value.item() elif isinstance(refinement.spacing, unyt_array) and isinstance( diff --git a/tests/simulation/translator/ref/surface_meshing/snappy_basic_refinements.json b/tests/simulation/translator/ref/surface_meshing/snappy_basic_refinements.json index f92e0d513..0161a52be 100644 --- a/tests/simulation/translator/ref/surface_meshing/snappy_basic_refinements.json +++ b/tests/simulation/translator/ref/surface_meshing/snappy_basic_refinements.json @@ -20,7 +20,8 @@ "edgeSpacing": [[5, 4]], "minElem": 3, "includedAngle": 120, - "retainOnSmoothing": true + "retainOnSmoothing": true, + "geometricTestOnly": "no" } }, { @@ -38,7 +39,8 @@ ], "minLen": 6, "includedAngle": 150, - "retainOnSmoothing": false + "retainOnSmoothing": false, + "geometricTestOnly": "no" } } ] @@ -54,7 +56,8 @@ "edgeSpacing": 4, "minElem": 3, "includedAngle": 120, - "retainOnSmoothing": true + "retainOnSmoothing": true, + "geometricTestOnly": "yes" }, "regions": [ { @@ -80,7 +83,8 @@ ], "minLen": 6, "includedAngle": 150, - "retainOnSmoothing": false + "retainOnSmoothing": false, + "geometricTestOnly": "no" } }, { @@ -122,7 +126,8 @@ ], "minLen": 6, "includedAngle": 150, - "retainOnSmoothing": false + "retainOnSmoothing": false, + "geometricTestOnly": "no" }, "regions": [ { diff --git a/tests/simulation/translator/ref/surface_meshing/snappy_no_regions.json b/tests/simulation/translator/ref/surface_meshing/snappy_no_regions.json index 271937930..60a1bafc0 100644 --- a/tests/simulation/translator/ref/surface_meshing/snappy_no_regions.json +++ b/tests/simulation/translator/ref/surface_meshing/snappy_no_regions.json @@ -31,7 +31,8 @@ "edgeSpacing": 4, "minElem": 3, "includedAngle": 120, - "retainOnSmoothing": true + "retainOnSmoothing": true, + "geometricTestOnly": "no" }, "regions": [] } diff --git a/tests/simulation/translator/ref/surface_meshing/snappy_refinements_multiple_regions.json b/tests/simulation/translator/ref/surface_meshing/snappy_refinements_multiple_regions.json index e329968ad..0b2057c96 100644 --- a/tests/simulation/translator/ref/surface_meshing/snappy_refinements_multiple_regions.json +++ b/tests/simulation/translator/ref/surface_meshing/snappy_refinements_multiple_regions.json @@ -19,7 +19,8 @@ "edgeSpacing": 4, "minElem": 3, "includedAngle": 120, - "retainOnSmoothing": false + "retainOnSmoothing": false, + "geometricTestOnly": "yes" } }, { @@ -32,7 +33,8 @@ "edgeSpacing": 4, "minElem": 3, "includedAngle": 120, - "retainOnSmoothing": false + "retainOnSmoothing": false, + "geometricTestOnly": "yes" } } ] diff --git a/tests/simulation/translator/test_surface_meshing_translator.py b/tests/simulation/translator/test_surface_meshing_translator.py index bb57f2a90..6af3cf5af 100644 --- a/tests/simulation/translator/test_surface_meshing_translator.py +++ b/tests/simulation/translator/test_surface_meshing_translator.py @@ -638,6 +638,7 @@ def snappy_basic_refinements(): min_elem=3, included_angle=120 * u.deg, entities=test_geometry.snappy_bodies["body1"], + geometric_test_only=True, ), snappy.SurfaceEdgeRefinement( spacing=[4 * u.mm], @@ -796,6 +797,7 @@ def snappy_refinements_multiple_regions(): included_angle=120 * u.deg, entities=[test_geometry["body0::patch0"], test_geometry["body0::patch1"]], retain_on_smoothing=False, + geometric_test_only=True, ), ], smooth_controls=snappy.SmoothControls(),