-
Notifications
You must be signed in to change notification settings - Fork 9
[FXC-3620] Octree base spacing for volume mesh #1807
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
5772267
13a9162
efc5c93
b9e405b
d071510
6b9bef7
55eb5d2
ce027bc
d6d9763
8c0094e
284d253
ef85e58
e2d3dcd
2a650d6
eb626e9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -46,7 +46,17 @@ class SurfaceMeshingParams(Flow360BaseModel): | |
| castellated_mesh_controls: CastellatedMeshControls = pd.Field(CastellatedMeshControls()) | ||
| smooth_controls: Union[SmoothControls, Literal[False]] = pd.Field(SmoothControls()) | ||
| refinements: Optional[List[SnappySurfaceRefinementTypes]] = pd.Field(None) | ||
| base_spacing: Optional[OctreeSpacing] = pd.Field(None) | ||
| octree_spacing: Optional[OctreeSpacing] = pd.Field(None, validation_alias="base_spacing") | ||
|
|
||
| @pd.model_validator(mode="before") | ||
| @classmethod | ||
| def _warn_base_spacing_deprecated(cls, data): | ||
| if isinstance(data, dict) and "base_spacing" in data: | ||
| log.warning( | ||
| "`base_spacing` has been renamed to `octree_spacing`. " | ||
| "Please update your code. `base_spacing` will be removed in a future release." | ||
| ) | ||
| return data | ||
|
|
||
| @pd.model_validator(mode="after") | ||
| def _check_body_refinements_w_defaults(self): | ||
|
|
@@ -134,15 +144,15 @@ def _check_uniform_refinement_entities(self): | |
| @pd.model_validator(mode="after") | ||
| def _check_sizing_against_octree_series(self): | ||
|
|
||
| if self.base_spacing is None: | ||
| if self.octree_spacing is None: | ||
| return self | ||
|
|
||
| def check_spacing(spacing, location): | ||
| # pylint: disable=no-member | ||
| lvl, close = self.base_spacing.to_level(spacing) | ||
| lvl, close = self.octree_spacing.to_level(spacing) | ||
| spacing_unit = spacing.units | ||
| if not close: | ||
| closest_spacing = self.base_spacing[lvl] | ||
| closest_spacing = self.octree_spacing[lvl] | ||
| msg = f"The spacing of {spacing:.4g} specified in {location} will be cast to the first lower refinement" | ||
| msg += f" in the octree series ({closest_spacing.to(spacing_unit):.4g})." | ||
| log.warning(msg) | ||
|
|
@@ -172,12 +182,12 @@ def check_spacing(spacing, location): | |
|
|
||
| return self | ||
|
|
||
| @contextual_field_validator("base_spacing", mode="after") | ||
| @contextual_field_validator("octree_spacing", mode="after") | ||
| @classmethod | ||
| def _set_default_base_spacing(cls, base_spacing, param_info: ParamsValidationInfo): | ||
| if (base_spacing is not None) or (param_info.project_length_unit is None): | ||
| return base_spacing | ||
| def _set_default_octree_spacing(cls, octree_spacing, param_info: ParamsValidationInfo): | ||
| if (octree_spacing is not None) or (param_info.project_length_unit is None): | ||
| return octree_spacing | ||
|
|
||
| # pylint: disable=no-member | ||
| base_spacing = 1 * LengthType.validate(param_info.project_length_unit) | ||
| return OctreeSpacing(base_spacing=base_spacing) | ||
| project_length = 1 * LengthType.validate(param_info.project_length_unit) | ||
| return OctreeSpacing(base_spacing=project_length) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Snappy ignores shared set_default_octree_spacing, missing validation warningLow Severity The shared Additional Locations (1) |
||


There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Snappy local check_spacing duplicates new OctreeSpacing.check_spacing method
Low Severity
The local
check_spacingfunction inside snappy's_check_sizing_against_octree_seriesis functionally identical to the newly introducedOctreeSpacing.check_spacingmethod. The non-snappy validators (MeshingParams,VolumeMeshingParams) already callself.defaults.octree_spacing.check_spacing(...), but the snappy code was not refactored to use it. This duplication means a future bug fix inOctreeSpacing.check_spacingwon't propagate to the snappy path.Additional Locations (1)
flow360/component/simulation/meshing_param/meshing_specs.py#L66-L79