Repository navigation
Refinement moves the internal sphere of a shell onto its sphere (#949 item 3) - #1173
Merged
lmoresi merged 5 commits intoNov 14, 2026
Merged
Conversation
…949 item 3) On every level of the hierarchy, serially and on every rank at np 2 and more, the vertices of Lower, Internal and Upper lie on their spheres to 64 eps of the radius, every copy has its owner's coordinates, and the refined shell declares its Internal sphere. The regions fill the volume between their surfaces, which a cell turned over by the snap would not. Fail on the base: Internal is 2.9e-02 of the radius off its sphere at level 1 and the declaration is released. Underworld development team with AI support from Claude Code
…item 3) The refinement callback of SphericalShellInternalBoundary moved the new vertices of Lower and Upper onto their spheres but left those of the embedded Internal surface on the chords of the coarse one, up to 2.9e-02 of its radius off. It now moves all three, so the refined mesh is on the spheres it registers, and the temporary release of the Internal declaration on refinement (#1148) goes. Lower loses its 1e-16 guard on the radius, which no vertex of a shell wall can need. Underworld development team with AI support from Claude Code
Member
Author
|
READY at 80aea76. Review by H5, a debugging session, run on a 96-thread Linux workstation (single system image; Intel Xeon Gold 6240R, AVX-512; MPICH), on a build of this head.
A note that is not this PR's: the generator refuses several reasonable parameter sets at gmsh time.
This PR only touches the refinement callback, so these come from the generator itself. Worth an issue. Underworld development team with AI support from Claude Code |
Merged
9 tasks done
The two comments #1148 changed on the Internal surface are the ones this branch removes with the stopgap; the snap's comment stands. Underworld development team with AI support from Claude Code
Underworld development team with AI support from Claude Code
lmoresi
changed the base branch from
feature/mesh-analytic-surface
to
development
November 14, 2026 03:43
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.
Refinement moves the internal sphere of a shell onto its sphere (#949 item 3)
Stacked on #1148 (
feature/mesh-analytic-surface); the base of this PR is that branch. It removes #1148's temporary release of theInternaldeclaration on a refinedSphericalShellInternalBoundary, and theTODO(BUG)with it, because the refined mesh is now on that sphere.What it reverses from #1148, in full:
src/underworld3/meshing/spherical.py: the block after the registration inSphericalShellInternalBoundarythat releasedInternalwhenrefinementwas set, and its comment, are removed.TODO(BUG)on the refinement callback naming Spherical mesh generators: five defects found while fixing #946, left open #949 item 3 is replaced by a comment saying the callback moves all three surfaces.tests/test_1179_mesh_analytic_surface.py:test_a_refined_shell_does_not_declare_its_internal_spherebecomestest_a_refined_shell_declares_its_internal_sphere, asserting radius 0.8 from the accessor where it asserted the refusal.docs/developer/design/boundary-slip-strategy.md: the sentence saying a refinedSphericalShellInternalBoundarywithdraws itsInternalsphere now says it declares it, because refinement moves that surface onto it (commit d2aa1f2).What changed and why
SphericalShellInternalBoundaryembeds a sphere of radiusradiusInternalbetween its walls. Refinement places the new vertices of every surface on the chords of the coarse one. The constructor's refinement callback moved the new vertices ofLowerandUpperback onto their spheres but not those ofInternal, which stayed up to 2.9e-02 of its radius inside the sphere (#949 item 3), while the mesh registered that sphere for it andmesh.GammaonInternalresolves to the analytic radial normal.The callback now moves the vertices of all three surfaces onto their spheres, with one loop over the three labels (it was two copies of the same block).
AnnulusInternalBoundaryalready does this for its internal circle.One detail: the old
Lowerline divided by1e-16 + R; the loop divides byRfor all three surfaces, asUpperdid. The guard mattered only for a vertex at the origin, which no vertex of a sphere of positive radius is;radiusInner = 0was not tried. On the fixtures below this movesLowervertices by round-off only (largest 3.0e-16 of the radius) and puts them closer to the sphere (largest distance 3.3e-16 before, 2.2e-16 after).What a user's run gets now that it did not
SphericalShellInternalBoundarydeclares itsInternalsphere:mesh.analytic_surface("Internal")returns it (on Mesh.analytic_surface: read the declared circle, sphere or plane of a boundary, or refuse #1148 alone it refuses on a refined mesh).Internalsurface.analytic_surfaceyet.The vertices moved
SphericalShellInternalBoundary(radiusOuter=1.0, radiusInternal=0.8, radiusInner=0.5, cellSize=0.3), per level of the hierarchy, relative toradiusInternal. Distances compare the same vertex (same topology) on the base and on this branch.At refinement 2 the interior vertices of level 2 move because level 2 is refined from a level 1 whose
Internalvertices are now on the sphere.LowerandUppermove by round-off only (at most 3.1e-16).Distance of each surface from its sphere, largest over its vertices, relative to the radius:
No vertex is held back by the hierarchy's guard against inverted cells (#946) on these fixtures: no warning at refinement 1 or 2. (With #1152, a held-back
Internalvertex would release the declaration; without #1152 the hierarchy warns as before.)Cell quality of the finest level:
The region labels (
Inner/Outer, by topology from theInternalfacets) are unchanged: 4448 / 7776 cells at refinement 1 and 35584 / 62208 at refinement 2, on both.One answer, before and after
Stokes on the refined shell (refinement 1, cell size 0.3), with an l = 2 load on the
Internalsurface and rotated free slip on both walls (the setup of the Zhong case intest_1018, with radii 0.5 / 0.8 / 1.0), tolerance 1e-8, converged (reason 2) on both:The base number is the same on development eb3d2f0.
Tests
tests/test_1190_spherical_internal_refinement_snap.py(level 1, tier b), at refinement 1 and 2: every vertex of the three surfaces on its sphere to 64 machine epsilon relative to the radius, on every level; the refined shell declaresInternalwith radius 0.8; the cells of each region fill exactly the volume between that region's two surface polyhedra (a cell turned over by the snap would overlap its neighbours; measured 2.2e-16 relative at most, against a bound of 1.4e-14).tests/parallel/test_1190_spherical_internal_refinement_snap_parallel.py(level 2, tier b): every local copy, owned or not, of a surface vertex on its sphere on every level; every copy has its owner's coordinates; every rank gets the declaration.tests/test_1179_mesh_analytic_surface.py: the refined-shell case now asserts the declaration instead of its release.What was run
On a 96-thread Linux workstation (single system image, Intel Xeon Gold 6240R, MPICH).
test_1179on this branchInternalsphere after the callbacktest_1064_constrained_spherical_shell_response.py, which builds no refined mesh, so this change cannot reach it). A first run with them included reached its 30-minute limit and was stoppedtest_11756,test_10711,test_0001_sphere_refinement_folds5,test_07653,test_07732,test_10697 passed and 1 skipped,test_1064_rotated_freeslip7 passed and 2 skipped, on each rankscripts/check_test_coverage.pyscripts/check_deprecated_patterns.pyWhat was not run
Checklist (UW3 Style Charter — docs/developer/UW3_STYLE_CHARTER.md)
level_*andtier_*markers (S8)maybe_/try_/do_) and no commented-out code (S3, S4) — the callback's commented-out prints are removed with the block.array/mesh.X.coords— not applicable: the callback works on the DM's coordinates, as every refinement callback doespixi.toml/pixi.lockor other dependency changes riding in an unrelated PRReviewer: H5 (one of the AI-assisted development sessions; it owns the mesh generators).
Underworld development team with AI support from Claude Code