Skip to content

[SNAPPY] Enable only selected shapes of UniformRefinement#1846

Open
piotrkluba wants to merge 10 commits intomainfrom
piotr/uniform-refinements-restrictions-snappy
Open

[SNAPPY] Enable only selected shapes of UniformRefinement#1846
piotrkluba wants to merge 10 commits intomainfrom
piotr/uniform-refinements-restrictions-snappy

Conversation

@piotrkluba
Copy link
Collaborator

@piotrkluba piotrkluba commented Feb 26, 2026

Note

Medium Risk
Introduces stricter validation rules for snappy workflows and changes when/where validation runs (especially for volume refinements projected to surface), which may break previously-accepted configs but is otherwise localized to meshing parameter validation/translation.

Overview
snappyHexMesh UniformRefinement validation is tightened and made consistent across surface/volume workflows. UniformRefinement now rejects unsupported entity types under snappy (only Box, Cylinder, Sphere are allowed), and additional constraints are enforced: boxes must be axis-aligned and cylinders must be non-hollow.

The snappy-specific entity checks were refactored into a shared helper (meshing_validators.py) and are now applied not only in snappy.SurfaceMeshingParams, but also in VolumeMeshingParams whenever a UniformRefinement is projected to the surface mesh (project_to_surface default/True; skipped when explicitly False). Tests and translator golden output were extended to cover these cases, including new sphere-based snappy coupled-refinement translation coverage.

Written by Cursor Bugbot for commit 54e4437. This will update automatically on new commits. Configure here.

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

"UniformRefinement for snappy accepts only Boxes with axes aligned"
+ " with the global coordinate system (angle_of_rotation=0)."
)
if isinstance(entity, Cylinder) and entity.inner_radius.to("m") != 0 * u.m:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cylinder with None inner_radius causes AttributeError in validator

Medium Severity

Cylinder.inner_radius is Optional[LengthType.NonNegative] (with default 0 * u.m), so it can be explicitly None. The expression entity.inner_radius.to("m") on line 23 will raise an AttributeError when inner_radius is None, instead of correctly treating it as a full cylinder (equivalent to inner_radius=0). This is now reachable through the newly added _check_snappy_uniform_refinement_entities validator in VolumeMeshingParams, expanding the blast radius of this crash path.

Additional Locations (1)
Fix in Cursor Fix in Web

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants