Skip to content

C5 step 3: proteus maps ymf round 3's vocabulary - #256

Merged
cekees merged 7 commits into
devfrom
c5-step3
Nov 11, 2026
Merged

cekees merged 7 commits into
devfrom
c5-step3

Conversation

@cekees

@cekees cekees commented Nov 11, 2026

Copy link
Copy Markdown
Owner

C5 step 3: proteus maps ymf round 3's vocabulary (proteustoolkit/ymf#29, merged 2026-11-10). Branch c5-step3 off cekees/main 266eb97; no change under proteus/mprans, StepControl/SplitOperator, MeshTools, test/conftest.py or .github/workflows.

commit item measured (macOS arm64, env proteus-bc-261025, sympy 1.13.2, ymf main 82b306a, -n 4)
6eb5450 the dispatch table is keyed on ymf's words (bdf2, ssp_rk3, pressure_spin_up, residual_shock_capturing, entropy_viscosity_coefficient); a spec's words are read through ymf.vocabulary.canonical, so older words still dispatch alike; family_of/role_of are ymf's 5 new/changed tests fail on the parent, pass here; test/dispatch was 32 passed before, all pass after
83213d4 coefficients by role (coefficient_by_role); a model without a role is refused by name, shallow water in precheck 10 new tests fail on the parent, pass here; test/dispatch 46 passed
85faa78 level_set_clsvof runs: the atmosphere signature for CLSVOF (φ, inflow, sign 1) is setAtmosphere(vof_air=1.0), with a note that it sets no CLSVOF data spec vs damBreakLevelSet.py interface=1: every dataset bitwise on 1 rank; before: refused, exit 2. The 2-rank case is not reproducible (below)
c10110b linear_solver: direct / iterative on the ADR, two-phase and shallow-water paths; SWFlow refuses a kind its n module would override; petsc_options and unselectable packages refused on the deck-machinery paths 31 tests, 19 fail on the parent, 31 pass; with test_pro_cli, test_adr_problem, test_domain_ymf: 263 passed, 1 skipped
61ff5f3 decks drop the ymf workarounds Y1 (1.0e6), Y2 (47.5), Y3 (φ0 only) dam3Bumps bitwise on 1 and 2 ranks with 47.5; archive rerun reproduces with 1.0e6
367ec20 CLSVOF dam break on 2 ranks marked xfail (non-strict) the deck alone differs run to run: 1 of 16 concurrent decks, 2 of 20 repeats of the test; 1 rank and the five-model dam break are bitwise every run

Notes:

  • The commit message of 6eb5450 states its test numbers loosely; the measured ones are in this table.
  • *.ymf is gitignored, so the new test/dispatch/dambreak_short_clsvof.ymf was added with -f.
  • Not done (step 4): see HANDOFF_2026-11-11_c5-step3.md (local).

🤖 Generated with Claude Code

cekees and others added 7 commits November 11, 2026 07:55
The table coined its own words for what a spec says (vbdf, SSP_RK3, pressure_initial, shock_capturing as a
stabilization method, entropy_viscosity_cE, hyperbolic_relaxation); ymf round 3 (proteustoolkit/ymf#29) gives each a
word in ymf.vocabulary and keeps the old one as an alias.

* DispatchTable's cells are keyed on ymf's words: bdf2, ssp_rk3, pressure_spin_up, residual_shock_capturing,
  entropy_viscosity_coefficient. The table's own FAMILIES and ROLES are gone (ymf.vocabulary has them).
* Dispatch reads a spec's words through ymf.vocabulary.canonical (time integration, stabilization method, scheme
  name and options, binding meaning, step control type), so a spec that still says vbdf or SSP_RK3 dispatches as it
  did. A word ymf does not know is passed on and refused by the cell, with the message it had.
* family_of and role_of are ymf.vocabulary's (the same rules; a refusal is still a DispatchError with the table's
  message). The dispersive family is now `dispersive`, and `hyperbolic_relaxation` is still recognized.
* test/dispatch/*.ymf say bdf2, ssp_rk3, entropy_viscosity_coefficient.

Evidence (macOS arm64, env proteus-bc-261025, ymf main 82b306a with round 3, -n 4):
* 4 new tests (ymf words vs aliases dispatch alike: as_dict equal for the projection and the scheme block;
  `dispersive` and the older assumption; residual_shock_capturing and its alias = ARTIFICIAL_VISCOSITY 1) plus the
  dispersive test with the new assumption: 5 fail on the parent (DispatchError), 5 pass here.
* test/dispatch + test_pro_cli: 126 passed, 1 skipped, before (parent, ymf main) 32 + 94 as in the baseline run of
  test/dispatch (32 passed); the deck-vs-spec bitwise runs (damBreakLevelSet, dam3Bumps, 1 and 2 ranks) are
  unchanged.
* Decks changed: dambreak.ymf (vbdf -> bdf2), proteus_numerics.ymf (SSP_RK3 -> ssp_rk3,
  entropy_viscosity_cE -> entropy_viscosity_coefficient).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The two-phase realizer read the density, viscosity and gravity as ρ, μ, g, and the shallow-water realizer read
g, n, θ, α, β, Z, by name from the family file, because a coefficient had no meaning. ymf round 3 gives it one
(`role: density`, ymf.vocabulary.COEFFICIENT_ROLES).

* DispatchTable: TWO_PHASE_COEFFICIENT_ROLES (density, dynamic_viscosity, gravity) and
  SHALLOW_WATER_COEFFICIENT_ROLES (role -> SWFlow's physical_parameters key: gravity, manning_coefficient ->
  mannings, porosity, linear_drag -> drag_alpha, quadratic_drag -> drag_beta) with SHALLOW_WATER_BED_ROLE
  (bed_elevation). The by-name maps are gone.
* DispatchRun finds each with ymf.vocabulary.coefficient_by_role. A model that does not state a role is refused,
  naming the role and how to state it; the shallow-water refusal is in precheck, before anything runs. There is no
  fallback to a name: that is what the role replaces.
* test/dispatch/two_phase_level_set.ymf and shallow_water.ymf state the roles (as ymf's own fixtures do).

Evidence (macOS arm64, env proteus-bc-261025, ymf main 82b306a, -n 4):
* 10 new tests (values found by role in a model with ρ, μ, g renamed; each of 3 two-phase and 6 shallow-water
  roles missing is refused by name): all 10 fail with the realizers of the parent commit and pass here.
* test/dispatch: 46 passed, with the deck-vs-spec bitwise runs unchanged (damBreakLevelSet and dam3Bumps, 1 and 2
  ranks).
* Decks changed: two_phase_level_set.ymf, shallow_water.ymf (roles). The roles are in the spec's input slice, so
  the archive key of dambreak_short.ymf's output changed (1234a3751d55 -> another digest); the archive test reads
  the digest from the first run instead of carrying it as a constant.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
ymf round 3 (C42 #18) puts an uncarried phase indicator's condition on the level set's sub-problem as a sign: at the
atmosphere CLSVOF has {φ, dirichlet, only: inflow, sign: 1, indicator: {χ, 1.0}} and no value. The atmosphere
signature in TWO_PHASE_BOUNDARY_SETTERS needed χ, so the dispatch refused level_set_clsvof (RANS2P + CLSVOF) with
"no BC_RANS setter imposes its closed conditions".

* A second atmosphere entry, atmosphere_clsvof: {p = 0, zero v flux, (φ, dirichlet, inflow, sign 1)} -> setAtmosphere,
  with vof_air read from the condition's indicator value (1.0). A signed condition without a value has the value
  `sign:<±1>` in a signature.
* setAtmosphere sets no CLSVOF data (clsvof_dirichlet stays unset, the same as damBreakLevelSet.py interface=1), so
  the run is weaker than the spec on one point: where flow enters, φ is not held at the air side. The entry carries
  a note and the archive's realize record shows it under the side's setter.
* New case dambreak_short_clsvof.ymf (level_set_clsvof alone, h 0.2576, 3 outputs, superlu; it restates only φ0).

Evidence (macOS arm64, env proteus-bc-261025, ymf main 82b306a):
* test_the_spec_runs_the_deck_bitwise[damBreakLevelSet_clsvof] (`parun --TwoPhaseFlow damBreakLevelSet.py -C
  "final_time=0.03 dt_output=0.01 he=0.08 genMesh=True interface=1"` against `pro run dambreak_short_clsvof.ymf`):
  every dataset bitwise equal on 1 rank and on 2 (-mat_partitioning_type current), the water moves (|velocity_t4|
  > 0.1). On the parent commit the same spec is refused: exit 2, "region top (side y+): no BC_RANS setter imposes
  its closed conditions".
* test_the_clsvof_atmosphere_is_setAtmosphere_and_the_run_says_what_it_does_not_impose: the top of level_set_clsvof
  is setAtmosphere(vof_air=1.0) with the note, that of level_set_five the same setter without one.
* Two tests that used level_set_clsvof as "a discretization that cannot run" use another refusal now (an
  atmosphere holding p = 1 has no setter; a CLSVOF sub-problem with SSP RK3 has no cell).
* test/dispatch: 49 passed (before this commit: 46).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ths; SWFlow refuses instead of overriding

ymf round 3 (C42 #19) makes `linear_solver: direct | iterative` the request, and a package name (`superlu`, `mumps`,
`petsc`) a request of its kind. The three paths read it differently and two of them overrode it silently.

* ADR path (ADRProblem.linear_solver_choice): `direct` is SuperLU on one rank, MUMPS on several ranks or for a
  singular operator; `iterative` is petsc (petsc_options refine it). The packages work as before.
* Two-phase path (DispatchRun._linear_solver): `direct` (or `superlu`) is the deck's useSuperlu (SuperLU on one rank,
  SuperLU_DIST on several), `iterative` (or `petsc`) the PETSc KSP solvers; not stated, iterative. A package the
  machinery does not select (`mumps`, `umfpack`) and `petsc_options` (no deck machinery reads them) are refused
  before anything runs, in precheck. The archive record says `direct (SuperLU)` etc. (it said `superlu (SuperLU)`).
* Shallow-water path: SWFlow's n module solves with LU on one rank and KSP_petsc4py on several, whatever the spec
  said, and the archive recorded that. A spec asking for the other kind is now refused (`direct` on 3 ranks,
  `iterative` on 1), naming what the n module does; a spec that states none is run as before. precheck takes the
  number of ranks (default: the started Proteus's, else 1).
* Decks: dambreak.ymf says `iterative` (was petsc), dambreak_short*.ymf `direct` (was superlu); proteus_numerics.ymf
  no longer states `petsc`, which was untrue on one rank (the n module used LU) and could not be both on 1 and 2.

Evidence (macOS arm64, env proteus-bc-261025, ymf main 82b306a, -n 4):
* 31 selected tests (the ADR direct/iterative mapping and ranks, the two-phase mapping of 5 words at 1 and 4 ranks,
  4 refusals, the SWFlow kind against ranks in 8 cases): 19 fail on the parent commit's code, all 31 pass here.
* test/dispatch, test_pro_cli, test_adr_problem, test_domain_ymf: 263 passed, 1 skipped (argparse suggestions need
  Python 3.14). The deck-vs-spec bitwise runs (damBreakLevelSet, its interface=1 case, dam3Bumps; 1 and 2 ranks) pass
  with the new words, so `direct` is the deck's solve bit for bit.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Step 2 wrote three decks around ymf defects that ymf round 3 fixed (proteustoolkit/ymf#29, items (e)).

* Y1 (dambreak.ymf): the hint `eb_penalty_constant: 1000000.0` is `1.0e6` again. ymf's archive writer used to turn a
  free-form `1.0e6` into '1000000.0', so reading an archive back gave another input digest and `--check` found no
  record.
* Y2 (dam3bumps.ymf): the bed's `95/2` is `47.5` again, with the comment that explained why it was not. On sympy
  1.13 a power of a sum with a decimal had its largest coefficient factored out (the same number, other
  arithmetic); ymf keeps the decimals now.
* Y3 (dambreak_short.ymf): `initial_conditions` of an `extends` pairs by `field`, so the short case restates φ0
  only (it restated v and p as well).

Evidence (macOS arm64, env proteus-bc-261025 with sympy 1.13.2, ymf main 82b306a, -n 4):
* dam3Bumps spec with 47.5 against dam3Bumps.py: every dataset bitwise equal on 1 and 2 ranks (test_dispatch_run.py);
  ymf's own measurement of Y2 on this sympy: 4 of 6 cases differ on the old notation, 6 of 6 agree with round 3.
* The archive rerun test (spec written, read back, rerun: "in the archive", `--check` reproduces bitwise) passes
  with `1.0e6` in the hints it hashes, which is what Y1 broke; dambreak_short.ymf and dambreak_short_clsvof.ymf
  run bitwise with φ0 as their only restated initial condition.
* test/dispatch: 65 passed, 1 failed on the first run and 66 passed on 4 later runs; the failure is the CLSVOF case on
  two ranks, which is not run-to-run reproducible with the deck alone (next commit).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
… the deck alone differs from run to run

test_the_spec_runs_the_deck_bitwise[damBreakLevelSet_clsvof-2] (added in 3/5) failed in 2 of 20 repeats under load
(4 concurrent streams, each a deck and a spec on 2 ranks): 66 of 218 datasets differ, p_t2.. and phi_t1.. first,
the same 66 both times. The deck is the cause, not the spec: 16 copies of
`parun --TwoPhaseFlow damBreakLevelSet.py -C "final_time=0.03 dt_output=0.01 he=0.08 genMesh=True interface=1"` on
2 ranks (-mat_partitioning_type current), run at once with no spec, give 15 identical archives and one that differs
from them in 64 of 213 datasets; 8 at once gave 8 identical ones. On one rank the case is bitwise (every run), and
the five-model dam break (VOF, NCLS, RDLS, MCorr) is bitwise on two ranks in every run so far.

This case on two ranks is xfail (non-strict, so an XPASS shows) with that reason; it is a model problem in CLSVOF's
parallel run (C0's territory: written up in HANDOFF_2026-11-11_c5-step3.md), not something the dispatch can change.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…verage floor)

The coverage job failed on 367ec20: proteus/Dispatch.py 90.6% against its 91.3% floor. Step 3's edits moved
`family_of` onto ymf and left refusal branches that no test reached. Three tests:

* a width that is the element-size symbol itself (epsFact 1.0), and ε = 1.5 h (1.5);
* a width not bound by the discretization, and one that is not a number times the element size, are refused;
* a model whose physical_model identifies two families and names none is refused (ymf's message).

Evidence (macOS arm64, coverage over test/dispatch/test_dispatch.py alone): Dispatch.py 395 statements, 38 missed
(90.4%) before, 33 missed (91.6%) after; CI's combined figure on the failing head was 90.6%. test_dispatch.py: 63 passed.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@cekees
cekees marked this pull request as ready for review November 11, 2026 11:09
@cekees
cekees merged commit cd7d1e2 into dev Nov 11, 2026
22 of 24 checks passed
@cekees
cekees deleted the c5-step3 branch November 11, 2026 14:53
cekees added a commit to proteustoolkit/proteus that referenced this pull request Nov 12, 2026
…mdot_use_gemv (CLSVOF 2-rank dam break)

The CLSVOF + RANS2P dam break (damBreakLevelSet.py interface=1, he=0.08, 3 outputs) on two ranks differed from run to run
with the deck alone: 1 of 16 concurrent decks, 2 of 20 repeats (C5 step 3, cekees#256), phi and p in 64-66 of 213
datasets. Cause (measured): the first CLSVOF linear solve, GMRES with PETSc's default classical Gram-Schmidt, has the
same matrix, rhs and initial guess in every run (hashed per rank) and a different residual in the last bit from the
tenth Krylov vector on (VecMDot over 10-11 vectors); one ulp in one solve is then a different phi, and the nonlinear
step amplifies it. PETSc >= 3.21 forms VecMDot with one BLAS gemv over the Krylov block (-vec_mdot_use_gemv, default
on) and OpenBLAS's gemv sums in an order that depends on where malloc put the block. In isolation, serial, no MPI:
VecMDot of nv = 10, 11, 12, 13, 30 vectors of 540 entries under 2000 different heap states gives 4, 5, 4, 4 and ~60
distinct answers (nv = 9: one); the set of answers changes with OPENBLAS_CORETYPE. With -vec_mdot_use_gemv 0 (PETSc's
plain unrolled C kernel) every nv gives one answer in 1500 of 1500. Not the cause (each tested): BLAS threads
(OPENBLAS_NUM_THREADS=1 still differs), PYTHONHASHSEED, the preconditioner (jacobi, sub-LU still differ), MPI
library (MPICH 5.0.1 on macOS arm64 and Open MPI on linux-64 both show it); modified Gram-Schmidt does not use the
gemv (0 of 240).

Fix: proteus.Comm.init sets vec_mdot_use_gemv=false unless the user gave it (command line or PETSC_OPTIONS). It applies
to every GMRES with classical Gram-Schmidt in proteus, not only CLSVOF's; the cost is VecMDot through PETSc's C
kernel instead of gemv (a fraction of an iteration next to MatMult and the preconditioner).

Before/after, the deck alone, two ranks, `-mat_partitioning_type current`, 24 decks at once:
  ceds-model (linux-64, Open MPI): before 11 odd of 192 (8 batches); after 0 of 600 (25 batches)
  macOS arm64 (MPICH):             before 6 odd of 120 (6 batches);   after 0 of 240 (10 batches)
test_vecmdot_reproducible.py: one answer under 400 heap states with the fix; on the parent, the same test fails on
linux-64 (it does not vary on macOS, where malloc aligns the block alike: the test bites on the linux legs only).
test_dispatch_run.py: the damBreakLevelSet_clsvof two-rank case is asserted again (the non-strict xfail and its
NONREPRODUCIBLE table are removed).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant