Skip to content

Finish rotated free-slip prescribed-normal datum: wire FreeSurface consistent solve, pyx API, parallel, nonlinear #403

Closed

Description

@lmoresi

Context

The rotated strong free-slip constraint now supports a prescribed non-zero wall-normal
datum u.n = ũ_n on the LINEAR solve path (commit 1a08d398 on
feature/free-surface-tangent): one rotated matrix, a switchable datum (0 = free-slip /
held, ũ_n = prescribed radial), differing only in the constraint RHS. Validated serial
in tests/test_1018_rotated_freeslip.py (datum-zero matches free-slip to round-off;
u.n = cos θ imposed to machine precision).

This lets the free-surface consistent solve drop its ill-conditioned penalty natural
BC (penalty=1e5·(n̂·v − ũ_n)·n̂) — the term that trips newtonls line search on an
otherwise linear solve — in favour of the strong rotated constraint.

Remaining work

  1. Wire the FreeSurface manager. In free_surface.py::_build_consistent, register
    rotated free-slip on the surface and set consistent._rotated_freeslip_datum = {surface: un_target.sym} (updated each step in _solve_consistent), removing the
    add_natural_bc penalty. Confirm the material-surface advection is unchanged /
    improved (no penalty leak).

  2. Clean pyx API. Let add_rotated_freeslip_bc(conds, boundary, normal=...) accept a
    non-zero conds (constant / sympy expr / field .sym) and store it, replacing the
    private solver._rotated_freeslip_datum route. Needs a Cython rebuild. Update
    _classify_walls (currently unpacks 2-tuples) if the stored form changes.

  3. Parallel np2/np4. The datum application (_set_rows_local, the xhat ownership
    loop, build_rotation per-node datum eval) is written ownership-safe but untested in
    parallel. Add an np2 case to the datum test.

  4. Nonlinear path. solve_rotated_freeslip_nonlinear currently raises on a datum.
    Extend it (the datum enters the constrained residual / initial-feasible guess) if a
    prescribed normal is ever needed with a nonlinear rheology.

  5. CBF σ_nn regression. datum=0 is bit-path-identical (so σ_nn recovery is safe), but
    add an explicit test that boundary_normal_traction is unchanged with the new code.

Origin

Found while building a fresh annulus free-surface convection driver and tracing why a
linear solve tripped newtonls (the penalty BC). See also #402 (composition transport
for temperature convection).

Underworld development team with AI support from Claude Code

Activity

  1. lmoresi commented on Jul 23, 2026

    @lmoresi
    MemberAuthor

    Item 1 done (commit 7134d690 on feature/free-surface-tangent).

    FreeSurface._build_consistent now prescribes u.n = ũ_n via the strong rotated
    free-slip constraint (add_rotated_freeslip_bc(0, surface, normal=...) +
    consistent._rotated_freeslip_datum = {surface: un_target.sym[0]}), dropping the
    penalty=1e5 add_natural_bc.

    Result: the annulus FS-convection driver runs clean under the default newtonls — 0
    DIVERGED_LINE_SEARCH, T in [0,1], vrms/h_max match the old ksponly baseline. The
    consistent solve routes through the rotated LINEAR solver (direct KSP), so the penalty's
    newtonls line-search thrash is gone; no manual snes_type=ksponly needed. All 16 level_1
    free-surface + rotated tests green.

    Remaining here: items 2 (pyx datum arg), 3 (np2/np4), 4 (nonlinear path), 5 (CBF
    regression test).

  2. lmoresi commented on Jul 23, 2026

    @lmoresi
    MemberAuthor

    Item 3 (parallel) done (commit 7c373993). tests/parallel/test_1064_rotated_datum_parallel.py: prescribe u.n = cos θ on the annulus; np1 and np2 give identical datum relL2 (3.98e-5) and ∫v·v matching to iterative round-off — fully partition-independent. The annulus FS-convection driver also runs clean np2 (T in [0,1], results matching serial). Remaining: item 2 (pyx datum arg), 4 (nonlinear path), 5 (CBF regression test).

  3. lmoresi commented on Jul 23, 2026

    @lmoresi
    MemberAuthor

    Item 5 (CBF σ_nn regression) — covered by existing tests. test_1018's test_rotated_freeslip_boundary_normal_traction_solcx and test_rotated_freeslip_sigma_nn_lumped_no_overshoot (level_1) pass against the datum code. They exercise the held-solve σ_nn recovery on pure free-slip (datum=0), which takes the bit-identical RHS path, so the traction recovery is provably unchanged.

    Status: items 1, 3, 5 done; 2 (pyx datum arg — needs Cython rebuild) and 4 (nonlinear path) remain as focused follow-ups.

  4. lmoresi commented on Jul 27, 2026

    @lmoresi
    MemberAuthor

    Items 2 and 4 (the pyx datum argument and the nonlinear-path datum) are now use-case-elevated in #438: nonlinear and anisotropic rheology with the FreeSurface strong material-boundary constraint. #438 carries the compatibility matrix, the measured cost of the penalty fallback, and the acceptance criteria; implementation notes for the SNES-path datum live there. Suggest treating #438 as the tracking issue and this one as the primitive-level checklist.

    Underworld development team with AI support from Claude Code

  5. lmoresi commented on Jul 28, 2026

    @lmoresi
    MemberAuthor

    Items 2 (pyx datum argument: add_rotated_freeslip_bc(conds, ...) value-first, non-zero scalar accepted) and 4 (nonlinear/SNES datum path) are implemented in draft PR #458, with the FreeSurface consumer switched to the public argument and the penalty fallback removed. Parallel item: nonlinear datum now tested np2+np4 (test_1066). Remaining open here after #458 merges: nothing on the original checklist — suggest closing then.

    Underworld development team with AI support from Claude Code

  6. lmoresi commented on Jul 29, 2026

    @lmoresi
    MemberAuthor

    Completed by #458 (with #435 having carried the parallel item): the pyx datum argument (value-first conds, non-zero scalar), the nonlinear/SNES path, the FreeSurface consumer on the public API, and np2+np4 parallel tests. Checklist clear.

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions