Skip to content

Probe-pass fixes: a MATRIX semi-Lagrangian history, tensor swarm read_timestep, a clamp on one component (#995, #984, #1000) - #1125

Merged
lmoresi merged 4 commits into
developmentfrom
bugfix/probe-pass-h4-tensor-paths
Nov 13, 2026
Merged

lmoresi merged 4 commits into
developmentfrom
bugfix/probe-pass-h4-tensor-paths

Conversation

@lmoresi

@lmoresi lmoresi commented Nov 13, 2026 •

Copy link
Copy Markdown
Member

Fixes #995 and #1000, and the swarm read_timestep half of #984 (#984's mesh.deform half was already fixed on development). These are tensor-shaped paths that raised on development 01dec8d, found in a probe pass. Each fix is small, with a regression test shown failing first.

issue defect fix
#995 SemiLagrangian(..., vtype=MATRIX) built its history stores without the MATRIX shape: TypeError: 'NoneType' object is not subscriptable in the store's constructor ddt._history_shape passes the tracked field's shape to a MATRIX store. The history's projection had no MATRIX branch, so MATRIX joins the tensor branch (every entry independent)
#984 (swarm half) SwarmVariable.read_timestep raised "could not broadcast (N,3) into (N,2)" for a symmetric tensor ((N,4) for a tensor): it assigned into self.array[:, 0, :], which is the stored layout only for scalars and vectors the file holds the storage layout (save writes self.data), so the values go back into self.data, the raw inverse of the write. No layout helper (#1006) is needed
#1000 global_evaluate(var.sym[i, j], pts, monotone="clamp") raised "cannot reshape": the bound was built for every component, while the value holds one a single component is bounded by its own stored column, through _data_layout, so a symmetric tensor's Voigt component maps correctly. This also fixes a single vector component, which failed the same way

Tests. tests/test_1165_tensor_history_swarm_read_and_component_clamp.py, tier B, serial: each rank would get its own tmp_path, and the clamp is rank-local by design.

The #995, #984 and #1000 tests fail on development. The history, swarm I/O, evaluate, stress-history and transport suites pass (583, 2 skipped).

Not here. The same missing MATRIX shape is at the history stores of Eulerian, Lagrangian, Lagrangian_Swarm, IntegrationPointSemiLagrangian and ForwardSemiLagrangian. It is noted for the hub; this PR fixes only #995's class.

None of these touches solver defaults, petsc_generic_snes_solvers, rotated_bc.py or the custom multigrid.

Checklist (UW3 Style Charter — docs/developer/UW3_STYLE_CHARTER.md)

  • I have read the Style Charter and followed it over the surrounding code (S2)
  • No drive-by refactors, renames, or "while I was here" cleanups (S9)
  • Bug fixes ship the regression test, written first, with level_* and tier_* markers (S8)
  • No hedging names (maybe_ / try_ / do_) and no commented-out code (S3, S4)
  • Every exception swallow states its sanctioned failure mode in a comment (S4)
  • New data access uses .array / mesh.X.coords — no with ....access(...), no mesh.data (S7). read_timestep writes .data, the charter's one sanctioned case: a raw copy of non-dimensional storage, here the inverse of save
  • Parallel safety considered (S11): no collective is added. The clamp change is rank-local, as before
  • No pixi.toml / pixi.lock or other dependency changes riding in an unrelated PR
  • AI-assisted work carries the attribution line below

Underworld development team with AI support from Claude Code

…_timestep, a clamp on one component (#995, #984, #1000)

- #995: SemiLagrangian built its history stores (psi_star, forcing_star)
  without the MATRIX shape, so their constructor failed on None. A new
  ddt._history_shape gives a MATRIX store the shape of the field it
  tracks. The projection that fills the history had no MATRIX branch,
  so MATRIX joins the tensor branch, with every entry of the field's
  shape independent.
- #984 (the swarm half): SwarmVariable.read_timestep put the file's
  values into self.array[:, 0, :], which is the stored layout only for
  scalars and vectors. The file holds the storage layout (save writes
  self.data), so the values go back into self.data, the raw inverse of
  the write. No layout helper is needed.
- #1000: global_evaluate of ONE component with monotone="clamp" built the
  bound for every component of the variable and failed to reshape. A
  single component is now bounded by its own stored column (through
  _data_layout, so a symmetric tensor's Voigt component maps correctly).
  This also fixes a single vector component, which failed the same way.

tests/test_1165_tensor_history_swarm_read_and_component_clamp.py: 6
tests (tier B), all failing on development 01dec8d first. The history,
swarm I/O, evaluate, stress-history and transport suites pass (583,
2 skipped).

Side finding, not fixed here: the same missing MATRIX shape is at the
history stores of Eulerian, Lagrangian, Lagrangian_Swarm,
IntegrationPointSemiLagrangian and ForwardSemiLagrangian.

Underworld development team with AI support from Claude Code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings November 13, 2026 03:17

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

…clamp incl. a 2x3 MATRIX; serial-only; a units round trip; the MATRIX history over two steps

Underworld development team with AI support from Claude Code
claude and others added 2 commits November 13, 2026 17:05
…istories of the same scheme

Over two steps at zero velocity the history does not reproduce the nodal
field exactly (5.5e-3 here; a property of the scheme), so the baseline is
a scalar SemiLagrangian of each entry, which the MATRIX history must
equal to 1e-12. The flat-index clamp mutant from the review fails the
2x3 MATRIX clamp case and nothing else.

Underworld development team with AI support from Claude Code
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.

3 participants