Fix SphericalShellInternalBoundary internal surface labels#242
Open
gthyagi wants to merge 2 commits into
Open
Conversation
Rework SphericalShellInternalBoundary mesh construction so the shell volume is retained, the internal spherical surface is embedded, and duplicate internal geometry is removed before meshing. The previous nested-sphere fragment path could leave the Lower boundary unusable for BdIntegral; the benchmark probe observed lower_area=0.0 even though the Stokes solve converged. Add a boundary-integral regression test that checks nonzero, close-to-analytic Lower, Internal, and Upper surface areas. Validation: ./uw build passed. py_compile passed for src/underworld3/meshing/spherical.py. pytest -q tests/test_0502_boundary_integrals.py::test_bd_integral_spherical_internal_boundary_areas passed. 005_internal_boundary_delta_probe.py passed with -uw_mesh_source uw3_builtin for serial Nitsche, serial constrained, 8-rank Nitsche, and 8-rank constrained runs.
Add explicit radius ordering validation for SphericalShellInternalBoundary and wrap the entity-selection comprehensions introduced by the internal-boundary label fix. Validation: py_compile passed for src/underworld3/meshing/spherical.py and test_bd_integral_spherical_internal_boundary_areas passed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fix
uw.meshing.SphericalShellInternalBoundary()so the generated mesh preserves usableLower,Internal, andUpperboundary labels for boundary integrals and internal-boundary Stokes loads.This PR also adds input validation for the radius ordering and a regression test that checks the three spherical boundary areas against analytic values.
Root Cause
The previous implementation built nested spheres with an OCC fragment path and then removed the inner solid volume recursively. In the Zhong-style internal-boundary probe, the resulting mesh loaded successfully and Stokes could converge, but
BdIntegral(mesh, fn=1.0, boundary="Lower")returned0.0. That meant theLowerboundary label existed at the API level but did not correspond to a usable boundary surface in the loaded DMPlex mesh.A non-recursive volume removal preserved the surface but produced an invalid Gmsh file for PETSc (
Could not determine Plex facet for Gmsh element ...), so the fix needed a cleaner geometry construction rather than a one-line removal change.What Changed
SphericalShellInternalBoundary()geometry construction:radiusInternal,Lower,Internal, andUpper.radiusInner < radiusInternal < radiusOuter.test_bd_integral_spherical_internal_boundary_areas, which verifiesLower,Internal, andUpperboundary areas are nonzero and close to analytic spherical areas.Validation
Run locally in the mantle-convection UW3 worktree:
./uw buildpixi run -e amr-dev python -m py_compile src/underworld3/meshing/spherical.pypixi run -e amr-dev pytest -q tests/test_0502_boundary_integrals.py::test_bd_integral_spherical_internal_boundary_areasSphericalShellInternalBoundary():Stokes_Constrained: passedStokes_Constrained: passedRepresentative fixed serial boundary areas at
ri=0.55,rint=0.775,ro=1.0,cellSize=0.25:Lower = 3.651738570092663Internal = 7.402572621636933Upper = 12.418895120898583Before the fix, the same benchmark path reported
Lower = 0.0and failed its boundary-area check.Notes
The benchmark now uses the fixed built-in
SphericalShellInternalBoundary()path directly and removed its benchmark-local Gmsh fallback helper.