Stop the mesh factories recommending a deprecated, broken API (#538) - #654
Open
lmoresi wants to merge 1 commit into
Open
Stop the mesh factories recommending a deprecated, broken API (#538)#654lmoresi wants to merge 1 commit into
lmoresi wants to merge 1 commit into
Conversation
Ten comments across four meshing modules said
# boundary_normals deprecated — use mesh.Gamma_P1 for boundary normals
steering the reader from one deprecated API to another. `Gamma_P1` is itself
deprecated, and its own docstring explains that off-kernel evaluation "falls
back to a coordinate-based direction" rather than a normal. Measured on a unit
box (#538), it returns the edge TANGENT on Left and Bottom -- (0,1) where the
outward normal is (-1,0) -- and drifts up to 40 degrees along Right and Top.
`mesh.boundary_normal(boundary)` is exact on all four edges to 1.6e-11.
So the guidance pointed at the one thing that does not work. Comments only; no
behaviour change.
Found by sweeping for in-tree callers of APIs whose own docstrings mark them
deprecated or back-compat-only, prompted by two bugs in a row turning out to be
callers of documented-unsuitable APIs (#538 on Gamma_P1, #614 on boundary_flux
at a constrained boundary).
The rest of that sweep came back clean, which is worth recording so nobody
repeats it:
boundary_flux_to_field no internal callers (only its own alias + warning)
swarm.points only the deprecation machinery itself; the ckdtree
hits are its own unrelated self.points
mesh/swarm.access() only inside commented-out code
use_legacy_array no callers
The one REAL internal dependency on Gamma_P1 is the mesh-smoothing path --
`_slip_normals` (meshing/smoothing/graph.py:547) evaluates it, with pre-touch
plumbing in graph.py, api.py and mmpde.py. That is #538's actual defect and is
left alone here: it needs the per-boundary normal threaded through, not a
comment change.
Underworld development team with AI support from Claude Code
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.
Comments only, no behaviour change.
The problem
Ten comments across four meshing modules said:
# boundary_normals deprecated — use mesh.Gamma_P1 for boundary normalssteering the reader from one deprecated API to another.
Gamma_P1is itself deprecated, and its own docstring explains why it cannot serve here:Measured on a unit box (#538), it returns the edge tangent on Left and Bottom —
(0, 1)where the outward normal is(-1, 0)— and drifts up to 40 degrees along Right and Top.mesh.boundary_normal(boundary)is exact on all four edges to 1.6e-11.So the guidance pointed at the one thing that does not work.
Why this was looked for
Two bugs in a row turned out to be callers of documented-unsuitable APIs — #538 (
_slip_normalsonGamma_P1) and #614 (boundary_fluxat a constrained boundary). That suggested sweeping for in-tree callers of anything whose own docstring says deprecated or back-compat-only.The rest of the sweep came back clean, recorded here so nobody repeats it:
boundary_flux_to_fieldswarm.pointsckdtreehits are its own unrelatedself.pointsmesh.access()/swarm.access()use_legacy_arrayWhat is deliberately not touched
The one real internal dependency on
Gamma_P1is the mesh-smoothing path:_slip_normals(meshing/smoothing/graph.py:547) evaluates it, with pre-touch plumbing ingraph.py,api.pyandmmpde.py. That is #538's actual defect — a node whose "normal" lies along its own edge has its tangential motion projected out, which is whynode_redistribution(..., slip_surfaces=True)freezes Left and Bottom exactly. Fixing it means threading the per-boundary normal through_slip_normals, which takes arbitrary boundary coordinates and would need each mapped to its owning boundary. That is a code change with its own testing, not a comment change, so it stays with the issue.Underworld development team with AI support from Claude Code