Make PISO's pressure correction genuinely multi-pass (TASK-033) - #46
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
PISOinto a real corrector loop. Each pass records its own maximum divergence; the loop returns once it's at or belownumerics.pressure_correction_tolerance, or raisesDivergenceDidNotConvergeErrorafternumerics.pressure_correction_max_iterationsrather than returning a best-effort result.a_P = V/dtis the only contribution toa_Pfor this architecture, and PyFlow's uniform cell volume makesV/a_P = dtone 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_iterationsare bound atPISO's own construction ("outer-loop state the strategy owns"), soPressureCoupling.correct's interface is unchanged and no ADR was needed.Test plan
tests/features/pressure_correction_loop.featurewritten 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.pybinds all three scenarios against the realPISO.NumericsConfig.pressure_correction_tolerance/pressure_correction_max_iterationsfields, with load/reject tests.assembly.py'sregister_pressure_couplingwidened to a four-argument factory (own stale docstrings found and fixed in the same pass);_StubLinearSolver/_CapturingPressureCouplingtest doubles updated;docs/architecture/icds.md,docs/architecture/engine.md,docs/repository-manifest.md, and all relevantCLAUDE.mdfiles updated to describe PISO as genuinely multi-pass rather than single-pass.make cigreen: 653 tests passed, 99% coverage, all doc/graph/scenario/status checks pass.🤖 Generated with Claude Code