Skip to content

Stokes_Constrained: multiplier() is not the whole boundary traction — the augmented-Lagrangian share is missing #607

Open

Description

@lmoresi

add_constraint_bc assembles the momentum row as

fn_f = (h + r*(n·u − g)) * n

so the traction holding the boundary is h + r(n·u − g), not h. multiplier()
and topography() return h alone, and the docstring states that accuracy is
independent of the augmentation (augmentation_base, default 1e4):

Accuracy is independent of this value (the multiplier carries the exact constraint)

That holds in the exact limit. Discretely the constraint row is satisfied to the
solver's tolerance, and r multiplies that residual back into the traction.

Measured

Annulus, radiusInner=0.5, radiusOuter=1.0, isoviscous, smooth density
(r/r_o)^3 cos 2θ, exact velocity Dirichlet on Lower, add_constraint_bc(0.0, "Upper"). The exact surface radial stress is 0.1506696 cos 2θ
(uw.analytic.CylindricalStokes, Kramer et al. 2021). Relative error in that
amplitude, read off the multiplier's boundary trace:

cell r max abs(n·u) h alone h + r(n·u)
0.100 1e4 5.2e-07 2.9e-02 8.5e-04
0.100 1e2 5.6e-07 3.7e-03 3.7e-03
0.075 1e4 4.8e-07 2.5e-02 1.7e-03
0.075 1e2 4.4e-07 2.6e-03 2.6e-03

At the default r = 1e4·μ the reported multiplier is a few per cent low, and
the error tracks r rather than the mesh — at cell=0.05 the same run
converged to abs(n·u) = 1.1e-08 and h alone read 1.5e-03, so the column does
not converge monotonically either. Adding the augmentation share removes the
dependence on r.

For comparison, boundary_normal_traction on the rotated constraint reads
2.1e-03 at cell=0.075 on the same problem, and a projection of n·σ·n out of
the solved fields reads 6.3e-03.

Suggested fix

Return h + r(n·u − g) from multiplier() (and hence topography()), or —
if the bare multiplier is wanted as well — keep h available and make the
traction the default. Either way the docstring's independence claim needs to
name the condition under which it holds.

Found while measuring surface stress for UWTN 2026-016 (Boundary conditions on
non-planar boundaries
); the reproduction is examples/stress.py in that note.

Underworld development team with AI support from Claude Code

Activity

  1. lmoresi commented on Aug 19, 2026

    @lmoresi
    MemberAuthor

    The same defect is far more severe under a lateral viscosity contrast, because
    the default augmentation is viscosity-weighted: r = augmentation_base · μ(x).

    SolCx, 32 × 32, eta_A = 1, eta_B = 1e6, add_constraint_bc(0.0, "Top"), three
    walls held by the ordinary component condition. So r = 1e4 on the soft half and
    1e10 on the stiff one. Surface topography along the top wall, mean removed,
    against SolCx.topography_top:

    route max abs(h) correlation with exact relative l2
    multiplier() as returned 0.042 −0.53 1.04
    h + r(n·u − g) 0.382 +0.999 0.047
    exact 0.383 — —
    (recovered n·σ·n, same solve) 0.383 +0.997 0.075

    The solve is not at fault: velocity error 8.8e-06, max abs(n·u) = 1.7e-10.
    Almost the whole traction is in the augmentation term, so the multiplier as
    returned is an order of magnitude low and of the opposite sign. With the term
    added back it is the most accurate surface stress in the whole comparison —
    better than the projected recovery.

    Turning r down is not an available workaround here: at this contrast both
    augmentation=0 and augmentation=1e2 fail the line search, so the augmentation
    is doing necessary conditioning work and the reported multiplier has to account
    for it.

    Reproduction: examples/solcx.py and examples/generate-topography-figure.py in
    UWTN 2026-016.

    Underworld development team with AI support from Claude Code

  2. lmoresi commented on Oct 6, 2026

    @lmoresi
    MemberAuthor

    Already fixed, and the test that used to pin the defect now pins the fix. Probed on development (1391e4aa): 116 passed, 3 skipped across the batch including tests/test_1061_constrained_freeslip.py.

    test_multiplier_and_topography_api says so in its own docstring — it asserted topography == h / scale until 2026-08-19, which is exactly this defect — and now asserts the opposite:

    share = sympy.simplify(traction - hL.sym[0])
    assert share != 0
    assert blk.u.sym[0] in share.atoms(sympy.Function)

    So the augmented-Lagrangian share is demonstrably present in traction(), and topography() is the whole traction over the scale. Closed under the issue-adjudication rule in #819.

  3. lmoresi commented on Oct 12, 2026

    @lmoresi
    MemberAuthor

    Reopened and labelled fixed-in-development, under the policy now in CLAUDE.md:

    While the fix is in an open PR, label the issue fixed-in-PR; when the PR merges, relabel it fixed-in-development, comment with the PR and the merge commit, and leave it open. Issues are closed when development is released to main.

    The fix stands and the evidence above is unchanged — this is a bookkeeping correction, not a reversal. Closing it on merge was wrong because development has not been released, so anyone running the release still has the defect; the label says where the fix is and the release sweep closes it.

  4. added
    fixed-in-development
    on Oct 12, 2026
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