Skip to content

Kramer free-slip Nitsche fieldsplit solve needs flexible subsolves on Gadi #147

Closed

Description

@gthyagi

Summary

While debugging the spherical Kramer benchmark, case1 with free-slip Nitsche boundary conditions failed on Gadi when the Stokes fieldsplit sub-solves used non-flexible Krylov methods. The failure is in the Schur/fieldsplit solve path for the internal-boundary/delta forcing case.

This was observed in the downstream spherical benchmark driver:

  • benchmark script: benchmarks/spherical/ex_stokes_kramer.py in gthyagi/UW3_Annulus_Spherical_Benchmarks
  • case: case1
  • parameters: l=2, m=2, k=3, P2/P1, pcont=true
  • boundary mode: -uw_freeslip_type nitsche
  • platform: Gadi, OpenMPI/PETSc UW3 environment

Observed failures

The original solver path used fieldsplit_velocity_ksp_type=fcg and left the pressure fieldsplit KSP on PETSc/default settings. For case1 this failed on Gadi.

Observed failure modes:

  • fcg fieldsplit subsolve failed with PETSc reporting an indefinite matrix / DIVERGED_PC_FAILED path.
  • gmres avoided the FCG indefinite-matrix failure, but failed with a GMRES residual-recursion mismatch on Gadi.
  • The same configuration can converge on macOS, so this is not simply a benchmark-formulation failure or a broken PETSc install. It appears to be a robustness issue exposed by the Gadi partitioning, multigrid, and Schur fieldsplit path.

The issue is specific to the combination that stresses the fieldsplit solve:

  • free-slip Nitsche boundaries
  • Kramer case1 internal-boundary/delta forcing
  • Schur fieldsplit Stokes solve

Other nearby cases were checked:

  • case2 free-slip Nitsche + smooth forcing converged.
  • case3 no-slip essential + internal-boundary/delta forcing converged.
  • case4 no-slip essential + smooth forcing converged.

This isolates the problematic path to free-slip Nitsche plus the internal-boundary/delta forcing case, rather than all Nitsche runs or all internal-boundary runs.

Validated fix

A debug version of the Kramer benchmark was run with flexible GMRES for both velocity and pressure fieldsplit sub-solves:

fieldsplit_velocity_ksp_type = fgmres
fieldsplit_velocity_ksp_pc_side = right
fieldsplit_velocity_ksp_max_it = 200
fieldsplit_pressure_ksp_type = fgmres
fieldsplit_pressure_ksp_pc_side = right
fieldsplit_pressure_ksp_max_it = 200

Gadi results for case1, l=2, m=2, free-slip Nitsche:

cellsize CPUs exit SNES reason KSP reason SNES iters KSP iters final true residual ratio memory used walltime
1/8 8 0 5 2 1 1 5.3887e-07 7.14GB 00:04:26
1/16 32 0 5 2 1 1 3.4574e-08 40.42GB 00:25:59
1/32 144 0 5 2 1 1 3.5783e-09 308.53GB 00:23:59

The .e logs for these successful FGMRES runs contain only OpenMPI LOG_CAT_ML warnings and no PETSc solver error.

Downstream benchmark fix

The downstream benchmark fix is to use FGMRES only for free-slip Nitsche fieldsplit sub-solves:

  • keep the existing outer ksp_type=fgmres
  • keep existing velocity GAMG/Kaskade settings
  • for freeslip and uw_freeslip_type == "nitsche":
    • set velocity fieldsplit KSP to fgmres
    • set pressure fieldsplit KSP to fgmres
    • use right preconditioning for both
    • set a bounded subsolve max iteration count
  • leave penalty and essential cases on their previous settings

This keeps the change targeted to the unstable solver path while preserving existing behaviour for cases that were already stable.

Request

This issue is to document the solver robustness problem and the validated downstream fix. It may also be useful for UW3 examples/defaults: Nitsche free-slip Stokes problems using Schur fieldsplit preconditioning can require flexible fieldsplit subsolves, especially when the preconditioner is effectively variable due to multigrid/coarse-grid behaviour.

Activity

  1. added
    bug
    type:code
    on Apr 27, 2026
  2. lmoresi commented on Apr 28, 2026

    @lmoresi
    Member

    @gthyagi — proposed UW3-side fix in PR #149.

    Credit for this one is yours: you found the failure mode, isolated the trigger conditions (free-slip Nitsche + Schur fieldsplit + internal-boundary delta forcing on Gadi), and validated FGMRES as the working configuration up to np=144 / cellsize=1/32. PR #149 just promotes that configuration to the UW3 default so other users hit the working path automatically — the analytical and validation work that made the fix possible was all done in this issue.

    What PR #149 does

    • `fieldsplit_velocity_ksp_type`: `cg` → `fgmres` (in `SNES_Stokes_SaddlePt.init` and the `strategy` setter, which re-applies the same defaults).
    • `fieldsplit_velocity_ksp_max_it` and `fieldsplit_pressure_ksp_max_it`: 200 (safety bound).
    • `pc_side` is intentionally not set — FGMRES is right-preconditioned by construction, and leaving `pc_side` unset keeps the defaults compatible with users who override the velocity KSP to CG/FCG (which require left preconditioning). The 8 existing tests that explicitly set `fieldsplit_velocity_ksp_type=fcg` after solver construction still pass.

    Reset path (in case it's useful for downstream code):

    • Construct: gets the new FGMRES defaults.
    • Override at any time: `solver.petsc_options["fieldsplit_velocity_ksp_type"] = "cg"` (etc.) — works as before.
    • Reset to UW3 default: `solver.strategy = "default"` re-applies the new FGMRES defaults via the same code path.

    Diagnosis summary (so it's recorded alongside the fix)

    The Schur fieldsplit's velocity preconditioner is GAMG with bounded but variable-iteration `mg_levels` solves (`mg_levels_ksp_max_it=3`, `_converged_maxits=true`). That makes the preconditioner application non-linear. CG/FCG and standard GMRES build their residual recurrence assuming a linear preconditioner, so under non-stationary preconditioning the recurrence drifts from the true residual. Layered on top: GAMG can produce weakly-indefinite coarse operators on partition-stressed problems with sharp internal sources (which is exactly Kramer case1's internal-boundary delta forcing), and CG/FCG report this as DIVERGED_PC_FAILED. FGMRES fixes both — it stores the preconditioned vectors explicitly (no m-term recurrence) and tolerates a weakly-indefinite preconditioner application.

    Notably this is not about Nitsche introducing asymmetry — UW3's Nitsche default is symmetric (`theta=1`). The non-stationarity comes from GAMG, which is why the same fix works for all Stokes problems, not just Nitsche ones.

    Once #149 lands I'll close this issue. Thanks for the careful at-scale validation work that made it cheap to land.

    Underworld development team with AI support from Claude Code

  3. added a commit that references this issue on Apr 28, 2026
  4. lmoresi commented on Apr 28, 2026

    @lmoresi
    Member

    Fixed in #149 (merged to development at 575d0d8). Credit to @gthyagi for diagnosing the failure mode and validating the FGMRES configuration at scale on Gadi. Closing manually since the PR merged to development, not main.

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

    bugtype:code

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions