From 9da10d6696d85cc80944b2e0c3ed4fd6fe222558 Mon Sep 17 00:00:00 2001 From: NasserFlexCompute Date: Mon, 13 Oct 2025 20:26:00 +0000 Subject: [PATCH 1/4] Added gap sealing --- flow360/component/simulation/meshing_param/face_params.py | 6 ++++++ flow360/component/simulation/meshing_param/params.py | 7 +++++++ .../simulation/translator/surface_meshing_translator.py | 1 + tests/ref/simulation/service_init_geometry.json | 3 ++- tests/ref/simulation/service_init_surface_mesh.json | 3 ++- .../translator/ref/surface_meshing/gai_surface_mesher.json | 4 +++- 6 files changed, 21 insertions(+), 3 deletions(-) diff --git a/flow360/component/simulation/meshing_param/face_params.py b/flow360/component/simulation/meshing_param/face_params.py index 3b9274d85..97a28f358 100644 --- a/flow360/component/simulation/meshing_param/face_params.py +++ b/flow360/component/simulation/meshing_param/face_params.py @@ -8,6 +8,7 @@ from flow360.component.simulation.framework.entity_base import EntityList from flow360.component.simulation.primitives import Surface from flow360.component.simulation.unit_system import LengthType +import flow360.component.simulation.units as u from flow360.component.simulation.validation.validation_context import ( get_validation_info, ) @@ -77,6 +78,11 @@ class GeometryRefinement(Flow360BaseModel): + "to geometry_accuracy should be resolved accurately during the surface meshing process.", ) + healing_gap_size: Optional[LengthType.NonNegative] = pd.Field( + 0.0 * u.m, + description="FFlag that defines the threshold size below which all geometry gaps are automatically closed..", + ) + # Note: No checking on deleted surfaces since geometry accuracy on deleted surface does impact the volume mesh. @pd.model_validator(mode="after") diff --git a/flow360/component/simulation/meshing_param/params.py b/flow360/component/simulation/meshing_param/params.py index cfacb0818..43be8ded5 100644 --- a/flow360/component/simulation/meshing_param/params.py +++ b/flow360/component/simulation/meshing_param/params.py @@ -168,6 +168,12 @@ class MeshingDefaults(Flow360BaseModel): + "This can be overridden with class: ~flow360.GeometryRefinement", ) + healing_gap_size: Optional[LengthType.NonNegative] = pd.Field( + 0.0 * u.m, + description="FFlag that defines the threshold size below which all geometry gaps are automatically closed..", + ) + + @pd.field_validator("number_of_boundary_layers", mode="after") @classmethod def invalid_number_of_boundary_layers(cls, value): @@ -201,6 +207,7 @@ def invalid_geometry_accuracy(cls, value): "surface_max_aspect_ratio", "surface_max_adaptation_iterations", "preserve_thin_geometry", + "healing_gap_size", mode="after", ) @classmethod diff --git a/flow360/component/simulation/translator/surface_meshing_translator.py b/flow360/component/simulation/translator/surface_meshing_translator.py index 7994e6dab..71a68973d 100644 --- a/flow360/component/simulation/translator/surface_meshing_translator.py +++ b/flow360/component/simulation/translator/surface_meshing_translator.py @@ -157,6 +157,7 @@ def _get_surface_refinements(refinement_list: list[dict]): "preserve_thin_geometry": None, "surface_max_aspect_ratio": None, "surface_max_adaptation_iterations": None, + "healing_gap_size": None }, "refinements": _get_surface_refinements, }, diff --git a/tests/ref/simulation/service_init_geometry.json b/tests/ref/simulation/service_init_geometry.json index c290925f8..79ed19f77 100644 --- a/tests/ref/simulation/service_init_geometry.json +++ b/tests/ref/simulation/service_init_geometry.json @@ -16,7 +16,8 @@ "value": 12.0, "units": "degree" }, - "preserve_thin_geometry": false + "preserve_thin_geometry": false, + "healing_gap_size": 0.0 }, "refinements": [], "volume_zones": [ diff --git a/tests/ref/simulation/service_init_surface_mesh.json b/tests/ref/simulation/service_init_surface_mesh.json index 0ac4df709..9c34aee13 100644 --- a/tests/ref/simulation/service_init_surface_mesh.json +++ b/tests/ref/simulation/service_init_surface_mesh.json @@ -16,7 +16,8 @@ "value": 12.0, "units": "degree" }, - "preserve_thin_geometry": false + "preserve_thin_geometry": false, + "healing_gap_size": 0.0 }, "refinements": [], "volume_zones": [ diff --git a/tests/simulation/translator/ref/surface_meshing/gai_surface_mesher.json b/tests/simulation/translator/ref/surface_meshing/gai_surface_mesher.json index 2808d091d..65f80b74c 100644 --- a/tests/simulation/translator/ref/surface_meshing/gai_surface_mesher.json +++ b/tests/simulation/translator/ref/surface_meshing/gai_surface_mesher.json @@ -16,7 +16,8 @@ }, "preserve_thin_geometry": false, "surface_max_aspect_ratio": 0.01, - "surface_max_adaptation_iterations": 19 + "surface_max_adaptation_iterations": 19, + "healing_gap_size": 0.0 }, "refinements": [ { @@ -179,6 +180,7 @@ ] }, "preserve_thin_geometry": false, + "healing_gap_size": 0.0, "geometry_accuracy": { "value": 0.05, "units": "flow360_length_unit" From ffc25570768d47a9b3e6416a1a9855ec3a806469 Mon Sep 17 00:00:00 2001 From: NasserFlexCompute Date: Tue, 21 Oct 2025 20:08:28 +0000 Subject: [PATCH 2/4] Applied comments --- flow360/component/simulation/meshing_param/face_params.py | 4 ++-- flow360/component/simulation/meshing_param/params.py | 6 +++--- .../simulation/translator/surface_meshing_translator.py | 2 +- tests/ref/simulation/service_init_geometry.json | 2 +- tests/ref/simulation/service_init_surface_mesh.json | 2 +- .../translator/ref/surface_meshing/gai_surface_mesher.json | 4 ++-- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/flow360/component/simulation/meshing_param/face_params.py b/flow360/component/simulation/meshing_param/face_params.py index 97a28f358..5b547223f 100644 --- a/flow360/component/simulation/meshing_param/face_params.py +++ b/flow360/component/simulation/meshing_param/face_params.py @@ -78,9 +78,9 @@ class GeometryRefinement(Flow360BaseModel): + "to geometry_accuracy should be resolved accurately during the surface meshing process.", ) - healing_gap_size: Optional[LengthType.NonNegative] = pd.Field( + sealing_size: Optional[LengthType.NonNegative] = pd.Field( 0.0 * u.m, - description="FFlag that defines the threshold size below which all geometry gaps are automatically closed..", + description="Threshold size below which all geometry gaps are automatically closed. Zero is deactivated.", ) # Note: No checking on deleted surfaces since geometry accuracy on deleted surface does impact the volume mesh. diff --git a/flow360/component/simulation/meshing_param/params.py b/flow360/component/simulation/meshing_param/params.py index 43be8ded5..6857028f1 100644 --- a/flow360/component/simulation/meshing_param/params.py +++ b/flow360/component/simulation/meshing_param/params.py @@ -168,9 +168,9 @@ class MeshingDefaults(Flow360BaseModel): + "This can be overridden with class: ~flow360.GeometryRefinement", ) - healing_gap_size: Optional[LengthType.NonNegative] = pd.Field( + sealing_size: Optional[LengthType.NonNegative] = pd.Field( 0.0 * u.m, - description="FFlag that defines the threshold size below which all geometry gaps are automatically closed..", + description="Threshold size below which all geometry gaps are automatically closed. Zero is deactivated.", ) @@ -207,7 +207,7 @@ def invalid_geometry_accuracy(cls, value): "surface_max_aspect_ratio", "surface_max_adaptation_iterations", "preserve_thin_geometry", - "healing_gap_size", + "sealing_size", mode="after", ) @classmethod diff --git a/flow360/component/simulation/translator/surface_meshing_translator.py b/flow360/component/simulation/translator/surface_meshing_translator.py index 71a68973d..e181388f4 100644 --- a/flow360/component/simulation/translator/surface_meshing_translator.py +++ b/flow360/component/simulation/translator/surface_meshing_translator.py @@ -157,7 +157,7 @@ def _get_surface_refinements(refinement_list: list[dict]): "preserve_thin_geometry": None, "surface_max_aspect_ratio": None, "surface_max_adaptation_iterations": None, - "healing_gap_size": None + "sealing_size": None }, "refinements": _get_surface_refinements, }, diff --git a/tests/ref/simulation/service_init_geometry.json b/tests/ref/simulation/service_init_geometry.json index 79ed19f77..f7c872ea5 100644 --- a/tests/ref/simulation/service_init_geometry.json +++ b/tests/ref/simulation/service_init_geometry.json @@ -17,7 +17,7 @@ "units": "degree" }, "preserve_thin_geometry": false, - "healing_gap_size": 0.0 + "sealing_size": 0.0 }, "refinements": [], "volume_zones": [ diff --git a/tests/ref/simulation/service_init_surface_mesh.json b/tests/ref/simulation/service_init_surface_mesh.json index 9c34aee13..0f26f4bd8 100644 --- a/tests/ref/simulation/service_init_surface_mesh.json +++ b/tests/ref/simulation/service_init_surface_mesh.json @@ -17,7 +17,7 @@ "units": "degree" }, "preserve_thin_geometry": false, - "healing_gap_size": 0.0 + "sealing_size": 0.0 }, "refinements": [], "volume_zones": [ diff --git a/tests/simulation/translator/ref/surface_meshing/gai_surface_mesher.json b/tests/simulation/translator/ref/surface_meshing/gai_surface_mesher.json index 65f80b74c..984e1eb1d 100644 --- a/tests/simulation/translator/ref/surface_meshing/gai_surface_mesher.json +++ b/tests/simulation/translator/ref/surface_meshing/gai_surface_mesher.json @@ -17,7 +17,7 @@ "preserve_thin_geometry": false, "surface_max_aspect_ratio": 0.01, "surface_max_adaptation_iterations": 19, - "healing_gap_size": 0.0 + "sealing_size": 0.0 }, "refinements": [ { @@ -180,7 +180,7 @@ ] }, "preserve_thin_geometry": false, - "healing_gap_size": 0.0, + "sealing_size": 0.0, "geometry_accuracy": { "value": 0.05, "units": "flow360_length_unit" From dcba1cd1f168859cc306b7fe192381df2d0b3857 Mon Sep 17 00:00:00 2001 From: NasserFlexCompute Date: Tue, 21 Oct 2025 20:45:28 +0000 Subject: [PATCH 3/4] Fixed style --- flow360/component/simulation/meshing_param/face_params.py | 2 +- flow360/component/simulation/meshing_param/params.py | 4 ++-- .../simulation/translator/surface_meshing_translator.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/flow360/component/simulation/meshing_param/face_params.py b/flow360/component/simulation/meshing_param/face_params.py index 5b547223f..b41df3f2d 100644 --- a/flow360/component/simulation/meshing_param/face_params.py +++ b/flow360/component/simulation/meshing_param/face_params.py @@ -4,11 +4,11 @@ import pydantic as pd +import flow360.component.simulation.units as u from flow360.component.simulation.framework.base_model import Flow360BaseModel from flow360.component.simulation.framework.entity_base import EntityList from flow360.component.simulation.primitives import Surface from flow360.component.simulation.unit_system import LengthType -import flow360.component.simulation.units as u from flow360.component.simulation.validation.validation_context import ( get_validation_info, ) diff --git a/flow360/component/simulation/meshing_param/params.py b/flow360/component/simulation/meshing_param/params.py index 6857028f1..fbf5c107d 100644 --- a/flow360/component/simulation/meshing_param/params.py +++ b/flow360/component/simulation/meshing_param/params.py @@ -170,10 +170,10 @@ class MeshingDefaults(Flow360BaseModel): sealing_size: Optional[LengthType.NonNegative] = pd.Field( 0.0 * u.m, - description="Threshold size below which all geometry gaps are automatically closed. Zero is deactivated.", + description="Threshold size below which all geometry gaps are automatically closed. " + + "Zero is deactivated. This can be overridden with class: ~flow360.GeometryRefinement", ) - @pd.field_validator("number_of_boundary_layers", mode="after") @classmethod def invalid_number_of_boundary_layers(cls, value): diff --git a/flow360/component/simulation/translator/surface_meshing_translator.py b/flow360/component/simulation/translator/surface_meshing_translator.py index e181388f4..4bcef7068 100644 --- a/flow360/component/simulation/translator/surface_meshing_translator.py +++ b/flow360/component/simulation/translator/surface_meshing_translator.py @@ -157,7 +157,7 @@ def _get_surface_refinements(refinement_list: list[dict]): "preserve_thin_geometry": None, "surface_max_aspect_ratio": None, "surface_max_adaptation_iterations": None, - "sealing_size": None + "sealing_size": None, }, "refinements": _get_surface_refinements, }, From ededa4f20e5c8da2235c39b6d3e471352c0af400 Mon Sep 17 00:00:00 2001 From: NasserFlexCompute Date: Tue, 21 Oct 2025 21:36:43 +0000 Subject: [PATCH 4/4] Fixed the tests --- tests/ref/simulation/service_init_geometry.json | 5 ++++- tests/ref/simulation/service_init_surface_mesh.json | 5 ++++- .../ref/surface_meshing/gai_surface_mesher.json | 12 +++++++++--- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/tests/ref/simulation/service_init_geometry.json b/tests/ref/simulation/service_init_geometry.json index 89d2b9734..ac45b985e 100644 --- a/tests/ref/simulation/service_init_geometry.json +++ b/tests/ref/simulation/service_init_geometry.json @@ -17,7 +17,10 @@ "units": "degree" }, "preserve_thin_geometry": false, - "sealing_size": 0.0 + "sealing_size": { + "value": 0.0, + "units": "m" + } }, "refinements": [], "volume_zones": [ diff --git a/tests/ref/simulation/service_init_surface_mesh.json b/tests/ref/simulation/service_init_surface_mesh.json index b5ba1675b..9cb4ebc25 100644 --- a/tests/ref/simulation/service_init_surface_mesh.json +++ b/tests/ref/simulation/service_init_surface_mesh.json @@ -17,7 +17,10 @@ "units": "degree" }, "preserve_thin_geometry": false, - "sealing_size": 0.0 + "sealing_size": { + "value": 0.0, + "units": "m" + } }, "refinements": [], "volume_zones": [ diff --git a/tests/simulation/translator/ref/surface_meshing/gai_surface_mesher.json b/tests/simulation/translator/ref/surface_meshing/gai_surface_mesher.json index 40c57af44..7f7655913 100644 --- a/tests/simulation/translator/ref/surface_meshing/gai_surface_mesher.json +++ b/tests/simulation/translator/ref/surface_meshing/gai_surface_mesher.json @@ -17,7 +17,10 @@ "preserve_thin_geometry": false, "surface_max_aspect_ratio": 0.01, "surface_max_adaptation_iterations": 19, - "sealing_size": 0.0 + "sealing_size": { + "value": 0.0, + "units": "flow360_length_unit" + } }, "refinements": [ { @@ -179,11 +182,14 @@ } ] }, - "preserve_thin_geometry": false, - "sealing_size": 0.0, "geometry_accuracy": { "value": 0.05, "units": "flow360_length_unit" + }, + "preserve_thin_geometry": false, + "sealing_size": { + "value": 0.0, + "units": "flow360_length_unit" } } ],