Issue quick-fix batch: units/pint crash, pressure gauge under units, two stale parallel tests, scalar-field default, penalty migration note#396
Merged
Conversation
…328) The protocol-5 branch constructed UWQuantity with an invalid dimensionality= keyword, so any raw pint.Quantity with a resolvable scale raised TypeError. The scaled result is now returned as a plain float, matching the magnitude returns of the branch's other exits, and the input is converted to SI base units before dividing (the scale is SI, so a km or cm/year input must cancel through SI or the magnitude keeps the unit prefactor). Regression tests: tests/test_0819_units_nondim_regressions.py (SI and non-SI inputs; shown to fail with the TypeError before the fix). Closes #328 Underworld development team with AI support from Claude Code
…ore applying (#271) set_pressure_gauge's callback fires inside the SNES non-dimensionalisation cordon, where p.data holds non-dimensional values — but BdIntegral.evaluate() returns a dimensional UWQuantity when a units model is active, so the solve crashed with an object-dtype ufunc casting error (and stripping the wrapper would still be wrong by the pressure scale). The mean's non-dimensional value is now taken before the shift is applied. Also documents in the docstring that a pressure gauge is counter-productive for pressure-dependent plasticity (it shifts the yield surface every iteration), per the finding recorded on the issue. The issue's in-cordon boundary-mass-weights redesign remains recorded there as a possible later refinement; this fix makes the current mechanism correct. Regression test: test_0819 gauge-under-units Stokes solve (crashed before the fix, exactly as reported). Closes #271 Underworld development team with AI support from Claude Code
…() (#331) The test predates the live-mesh coordinate-mutation guard (PR #326) and called the internal Mesh._deform_mesh() directly on a mesh carrying a variable — rejected by the guard, so the test failed at np2/np4 on every branch and polluted parallel gates as a known pre-existing failure. Verified green at np2 and np4 (3 passed each). Closes #331 Underworld development team with AI support from Claude Code
The script counted DuDt._nswarm_psi particles before/after advection, but the SL trace-back no longer allocates a nodal swarm (_nswarm_psi is None by design — the trace-back evaluates through global_evaluate), so the script's premise is gone, not just its API. Its live coverage (parallel SL advection across ranks) is carried by test_0700_basic_parallel_operations:: test_nodal_swarm_advection_basic, which this commit repairs — it was itself stale (SemiLagrangian now requires degree/continuous) and only runs at np4, so the breakage was invisible. Verified: 13 passed at np4. Closes #340 Underworld development team with AI support from Claude Code
…nents=1 (#367) Investigation outcome: no over-allocation ever occurred — MeshVariable forces num_components=1 whenever vtype=SCALAR, so the constructor's num_components=mesh.dim was ignored. The default now states the truth and the TODO(BUG) marker is replaced by a comment recording why this is behaviour-identical. Existing default-field Poisson coverage (test_0641 Wave-C shims) passes unchanged. Closes #367 Underworld development team with AI support from Claude Code
The June 2026 change of the augmented-Lagrangian grad-div penalty from a bare constant to a viscosity-scaled term silently changes older scripts that tuned large constant penalties against the viscosity magnitude. The troubleshooting page (previously a stub) now carries the migration note — what changed, why, and what to update — and the changelog Q2 section records the change with a pointer. Closes #292 Underworld development team with AI support from Claude Code
This was referenced Jul 23, 2026
Closed
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.
Six small, well-understood fixes from the 2026-07-23 issue triage, one commit per issue. Closes #271, closes #292, closes #328, closes #331, closes #340, closes #367.
What each commit does
#328 —
uw.non_dimensionalise(pint.Quantity)crashed (fix(units))The protocol-5 branch built a UWQuantity with an invalid
dimensionality=keyword, so any raw pint quantity with a resolvable scale raised TypeError. It now returns a plain float, and converts the input to SI base units before dividing so non-SI inputs (km, cm/year) cancel correctly.#271 —
set_pressure_gaugecrashed under an active units model (fix(stokes))The gauge callback runs inside the SNES non-dimensionalisation cordon where
p.datais non-dimensional, but the boundary integral it computes is a dimensional quantity — the solve died with an object-dtype casting error. The mean's non-dimensional value is now taken before the shift. The docstring also records the issue's second finding: a pressure gauge is counter-productive with pressure-dependent plasticity (it moves the yield surface every iteration). The issue's in-cordon boundary-weights redesign stays on record there as a possible refinement; this makes the current mechanism correct.#331 —
test_0765deformed-shell test failed at np2/np4 on every branchIt called the internal
Mesh._deform_mesh()directly, which the live-mesh coordinate-mutation guard (PR #326) rejects. Ported to the publicmesh.deform(). This removes the "known pre-existing failure" that has been polluting every PR's parallel gate since early July.#340 — retire
ptest_004(stale nodal-swarm advection script)Its premise is gone, not just its API: the SL trace-back no longer allocates a nodal swarm (
_nswarm_psiis None by design), so there are no particles to count. The live coverage (parallel SL advection across ranks) is carried bytest_0700::test_nodal_swarm_advection_basic— which was itself stale (missing the now-requireddegree/continuousarguments, invisible because it only runs at np4) and is repaired in the same commit.#367 —
SNES_Scalardefault field created withnum_components=mesh.dimInvestigation outcome: never a real over-allocation —
MeshVariableforcesnum_components=1forvtype=SCALAR, so the argument was ignored. The default now passes the honest value and a comment records why this is behaviour-identical.#292 — migration note for the viscosity-scaled Stokes penalty (docs only)
The June 2026 change from a bare-constant to a viscosity-scaled grad-div penalty silently changes older scripts that tuned large constant penalties. The troubleshooting page (previously a stub) now carries the what/why/what-to-update note; the changelog Q2 section records the change.
Verification
tests/test_0819_units_nondim_regressions.py(level_1 / tier_b): both uw.non_dimensionalise(pint.Quantity) crashes: invalid dimensionality= kwarg in units.py protocol 5 #328 cases and the set_pressure_gauge crashes under units (computes the gauge in user space, not inside the SNES non-dim cordon) #271 gauge-under-units Stokes solve. All three shown to fail with the reported errors on the pristine build before the fixes, green after.test_1016_snes_update_callbacks,test_0641_wave_c_api_shims,test_0812_poisson_with_units: 57 passed.test_0765at np2 and np4: 3 passed each (was 1 failure).test_0700at np4: 13 passed (advection test was TypeError-broken before).Reminder for the merge: PRs land on
development, so GitHub will not auto-close the six issues — they need manual closing (or use this PR's closing keywords when the change reachesmain).Underworld development team with AI support from Claude Code