Skip to content

Make PISO's pressure correction genuinely multi-pass (TASK-033) - #46

Merged
AdamClemens merged 1 commit into
mainfrom
feat/task-033-pressure-correction-loop
Aug 29, 2026
Merged

Make PISO's pressure correction genuinely multi-pass (TASK-033)#46
AdamClemens merged 1 commit into
mainfrom
feat/task-033-pressure-correction-loop

Conversation

@AdamClemens

Copy link
Copy Markdown
Owner

Summary

  • Stage 5's fourth task: turns TASK-027's single-pass PISO into a real corrector loop. Each pass records its own maximum divergence; the loop returns once it's at or below numerics.pressure_correction_tolerance, or raises DivergenceDidNotConvergeError after numerics.pressure_correction_max_iterations rather than returning a best-effort result.
  • Resolves Stage 5's design question three (what carries the momentum-equation coefficients Rhie-Chow needs, given PyFlow's fully explicit RK4 predictor) by numerical prototyping before writing any test or implementation code, per the roadmap's own instruction: a_P = V/dt is the only contribution to a_P for this architecture, and PyFlow's uniform cell volume makes V/a_P = dt one constant for the whole mesh. Pairing that correction with the same compact Laplacian the Poisson matrix already uses — not the composed Gradient/Divergence pair TASK-027 tried and measured stalling — restores the discrete adjoint property and converges a manufactured field to floating-point-exact zero divergence in one pass, verified numerically before being trusted.
  • tolerance/max_iterations are bound at PISO's own construction ("outer-loop state the strategy owns"), so PressureCoupling.correct's interface is unchanged and no ADR was needed.
  • Couette flow's own comparison stays with TASK-034 alone, which has the fully assembled timestep it needs — this task supplies the corrector loop it depends on.

Test plan

  • tests/features/pressure_correction_loop.feature written first (TDD), three scenarios: monotonic convergence with a real solver, genuine multi-pass convergence with a deliberately halving solver, honest exhaustion (DivergenceDidNotConvergeError) with a no-op solver.
  • tests/unit/test_pressure_correction_loop.py binds all three scenarios against the real PISO.
  • New NumericsConfig.pressure_correction_tolerance/pressure_correction_max_iterations fields, with load/reject tests.
  • Blast radius: assembly.py's register_pressure_coupling widened to a four-argument factory (own stale docstrings found and fixed in the same pass); _StubLinearSolver/_CapturingPressureCoupling test doubles updated; docs/architecture/icds.md, docs/architecture/engine.md, docs/repository-manifest.md, and all relevant CLAUDE.md files updated to describe PISO as genuinely multi-pass rather than single-pass.
  • make ci green: 653 tests passed, 99% coverage, all doc/graph/scenario/status checks pass.

🤖 Generated with Claude Code

Turns TASK-027's single-pass PISO into a real corrector loop: each pass
records its own maximum divergence and either returns at or below
numerics.pressure_correction_tolerance, or solves another pass, up to
numerics.pressure_correction_max_iterations before raising
DivergenceDidNotConvergeError rather than returning a best-effort
result.

Resolves Stage 5's design question three (what carries the
momentum-equation coefficients Rhie-Chow needs, given PyFlow's fully
explicit RK4 predictor) by numerical prototyping before writing any
test or implementation code, per the roadmap's own instruction for this
task: a_P = V/dt is the only contribution to a_P for this architecture,
and PyFlow's uniform cell volume makes V/a_P = dt one constant for the
whole mesh. Pairing that correction with the same compact Laplacian the
Poisson matrix already uses -- not the composed Gradient/Divergence
pair TASK-027 tried and measured stalling -- restores the discrete
adjoint property and converges a manufactured field to floating-point-
exact zero divergence in one pass, verified before being trusted.
tolerance/max_iterations are bound at PISO's own construction, so
PressureCoupling.correct's interface is unchanged and no ADR is needed.

Couette flow's own comparison stays with TASK-034 alone, which has the
fully assembled timestep it needs; this task supplies the corrector
loop it depends on.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@AdamClemens
AdamClemens merged commit 03c3bac into main Aug 29, 2026
2 checks passed
@AdamClemens
AdamClemens deleted the feat/task-033-pressure-correction-loop branch August 29, 2026 12:40
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