Skip to content

SLCN trace-back gives a partition-dependent answer (1.6% at np=8 on a 128x128 level set) #682

Open

Description

@lmoresi

Symptom

The semi-Lagrangian advection (AdvDiffusionSLCN) gives a different answer at different rank counts. On the LeVeque swirling flow carrying a conservative level set (uw.systems.LevelSetSolver(..., advection="slcn"), StructuredQuadBox 128 by 128, P2, Courant 0.5, 20 steps, reinitialisation every fifth step, no mass correction), the enclosed volume after 20 steps is

ranks volume
1 0.0706776688
2 0.0706771414
4 0.0706771438
8 0.0695739287

The same pipeline with the Eulerian transport (advection="supg") gives 0.0707207616 at every rank count, to ten digits, so the mesh, the level-set wrapper, the reinitialisation and the integral are partition-independent; the difference is in the trace-back. At 256 by 256 the shift at four and eight ranks is in the sixth digit (0.0706884035 / 0.0706891414 / 0.0706891222).

Reading

A 1e-5 change at two and four ranks is consistent with departure points near partition boundaries being evaluated on a slightly different path (ghost-cell interpolation against owner-cell interpolation); a 1.6% change at eight ranks on a mesh with about 2,000 cells per rank is not, and suggests departure points that leave the local partition being handled wrongly once the partitions are small relative to the step (0.5 cells per step here, so the feet should stay within the ghost layer). Related: #611 (empty-rank path) and the np=4 behaviour recorded around #596.

Reproduction

~/+Simulations/supg_vs_slcn_657/parallel/ls_parallel_timing.py on the feature/levelset-supg branch (#677):

mpirun -n 8 python ls_parallel_timing.py -uw_res 128 -uw_steps 20 -uw_advection slcn

prints the volume; compare with -n 1. The supg run is the control.

Underworld development team with AI support from Claude Code

Activity

  1. added
    bug
    on Sep 3, 2026
  2. lmoresi commented on Sep 27, 2026

    @lmoresi
    MemberAuthor

    Cause found and fixed on PR #800 (28314aa). Two parts:

    1. The small difference at np 2 and 4 came from the nodal history recording the field by evaluating it at nudged nodes in serial and by copying it in parallel (fixed in b20c992).
    2. The 1.6% at np 8 is the monotone clamp. global_evaluate applied monotone="clamp" on the rank that asked for a departure point, bounding it by that rank's nearest nodes; a departure point evaluated on another rank was bounded by the wrong neighbourhood. The bound now runs on the rank that evaluates the point.

    Isolated with plain SLCN on the same swirl (128^2 quad, P2, 20 steps): clamp np 1 / 8 was 0.0707250985 / 0.0697297410, without the clamp 0.0707616737 / 0.0707616744. The level-set reproduction from this issue on #800 (LevelSetSolver copied in from #677):

    ranks volume
    1 0.0706771442
    2 0.0706771415
    4 0.0706771438
    8 0.0706771412

    SUPG control unchanged (0.0707207616 at every rank count). This issue closes when #800 reaches development.

    Underworld development team with AI support from Claude Code

  3. added
    fixed-in-PR
    on Nov 10, 2026
  4. lmoresi commented on Nov 13, 2026

    @lmoresi
    MemberAuthor

    The clamp defect named here (item 2) is still on development, and it is larger than the SLCN volume suggests. Measured by H1 (review and parallel test runs on a 96-thread Linux workstation (Intel Xeon Gold 6240R, AVX-512; MPICH)) on development a729719, with a probe from H6's review of #1125.

    The probe.

    • Mesh: UnstructuredSimplexBox(cellSize=0.125).
    • Fields: a P1 scalar T = 3x + 2y, and a P1 vector whose entry 0 is the same field.
    • Calls: uw.function.global_evaluate at 400 random interior points in [0.15, 0.85]², the same points on every rank, unclamped and with monotone="clamp".

    Unclamped evaluation is exact to 8.9e-16 at every rank count. The clamped values:

    np rank clamped scalar: points wrong (> 1e-10) of 400 largest error
    1 0 5 1.68e-2
    2 0 / 1 74 / 48 0.611 / 0.385
    4 0 / 1 / 2 / 3 283 / 156 / 292 / 158 1.94 / 1.03 / 1.84 / 0.868

    The vector's entry 0 gives the same counts and errors as the scalar. The field's range on these points is about 0.75 to 4.25.

    Two parts:

    1. Parallel, the large one. The bound is taken from the asking rank's own nodes for points it does not own. That is the cause this issue records, and the result is wrong by up to half the field's range at np 4. The code comment in functions_unit_system.py calls the clamp "rank-local-only and parallel-safe".
    2. Serial, small. The bound is the range of the three nearest nodes, which need not enclose the point: 5 of 400 are clipped by up to 1.7e-2 even at np 1. For a linear field that is exact without the clamp, the clamp should change nothing at interior points. The bound would need to come from the containing cell's nodes.

    [read] This issue says the fix ("the bound now runs on the rank that evaluates the point") is on #800. #800 is behind development and changes compiled code, so I have not run this probe on it. If #800 is not close to merging, part 1 may be worth taking out as a small fix of its own, given these sizes. Every semi-Lagrangian remap with monotone_mode="clamp" in parallel goes through it.

    Underworld development team with AI support from Claude Code

  5. added
    fixed-in-development
    and removed
    fixed-in-PR
    on Nov 14, 2026
  6. lmoresi commented on Nov 14, 2026

    @lmoresi
    MemberAuthor

    Fixed in development by PR #1153 (merge commit b6b9e25). The monotone clamp now bounds a value by the nodes of the cell it was interpolated in, on the rank that owns that cell, so the trace-back no longer depends on the partition. This issue stays open until the release to main.

    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

    bugfixed-in-development

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions