Skip to content

Semi-Lagrangian record of a units field is 1000 times too large at np 2 and up #992

Open

Description

@lmoresi

The semi-Lagrangian record of a units-carrying field is 1000 times too large at np 2 and up, with no error.

T raw 0.5 in K, SemiLagrangian record, update_pre_solve (p27_record_units.py): psi_star raw 0.5 at np 1, 500 at np 2.

_record_psi_star_from_field_data (systems/ddt.py:3520) reads var.array, which is dimensional, strips the units, and writes the plain number as non-dimensional. np 1 takes another route. No full advection-diffusion solve was run, so its effect on a solve is not measured.

The same function also reads a SYM_TENSOR's S[1,1] from S[0,1]'s slot: 11 where 12 is right, at np 2 and 3 (p14_sl.py). It flattens var.array by row and takes the index from meshVariable_lookup_by_symbol.

Found in the third review of the #909 branch. Measured on eddab70 (development before #954 to #973, which do not touch these paths) unless stated; not rerun on f31edcb. Probes on hyperion in runs/2026-11-06/review909r3/probes/.

Part of the units bundle the hub is recording for one owner: #979, and the issues linked below.

Underworld development team with AI support from Claude Code

Activity

  1. lmoresi commented on Nov 10, 2026

    @lmoresi
    MemberAuthor

    Still live on development a6eebb6, and not the same defect as #990: the record error survives a fix to the clamp, and at np 2 the two cancel.

    Probe: reference quantities (1000 km, 1 Myr, 1e24 kg, 1000 K), T in K with raw value 0.5, SemiLagrangian(..., units="K"), update_pre_solve(0.01), raw psi_star. The patched arm wraps _apply_monotone_limit to work in non-dimensional values, which is the fix for #989 and #990.

    np 1 np 2
    no clamp, plain 0.5 500
    no clamp, limiter patched 0.5 500
    monotone_mode="clamp", plain 0.0005 (#990) 0.5 (the two errors cancel)
    monotone_mode="clamp", limiter patched 0.5 500

    The np 2 error does not depend on the limiter. It comes from _record_psi_star_from_field_data (ddt.py:3497, vflat = np.asarray(var.array)), which reads the dimensional var.array, strips its units and stores the number as non-dimensional. That is the same class as #991 (np.asarray(cv.coords)), applied to values rather than coordinates. The fixes for #989 and #990 and for this issue should land together. Otherwise a clamped parallel run that is right today by accident becomes 1000 times wrong.

    Script: runs/2026-11-10-sweep/D/probes/g9_clamp.py on hyperion.

    Underworld development team with AI support from Claude Code

  2. lmoresi commented on Nov 10, 2026

    @lmoresi
    MemberAuthor

    Re-verified on development 8f0ed0a (H3 units). Raw psi_star is 0.5 at np 1 and 500 at np 2 with no clamp, and 0.0005 and 0.5 with the clamp, the same as the comment above. H3 owns this fix. It reads var.array with its units kept, and picks the component by its (i, j) position, which also fixes the SYM_TENSOR slot. It will be stacked on #1003 and merged right after it, so that no merge order leaves a clamped parallel run 1000 times off.

    Underworld development team with AI support from Claude Code

  3. added
    fixed-in-PR
    on Nov 16, 2026
  4. added a commit that references this issue on Nov 16, 2026
  5. added
    fixed-in-development
    and removed
    fixed-in-PR
    on Nov 16, 2026
  6. lmoresi commented on Nov 16, 2026

    @lmoresi
    MemberAuthor

    Fixed in development by #1205 (units PR 2), merge commit 04d6f84. The PR body gives the change for this issue and the test that fails on development without it. H1 checked each reproducer, at np 1 to 4 where the issue is parallel. The issue stays open until the release.

    Underworld development team with AI support from Claude Code


    Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    fixed-in-development

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions