Add Stokes/Poiseuille 1D FD playground: temporal convergence for index-1 semi-explicit DAE with constraint lifting, differentiated-constraint remedy, coupled block-solve exploration, and monolithic RADAU-IIA solver#641
Conversation
Co-authored-by: pancetta <7158893+pancetta@users.noreply.github.com> Agent-Logs-Url: https://github.com/Parallel-in-Time/pySDC/sessions/96b37f2c-762b-4b92-a75a-9eca004dca16
Co-authored-by: pancetta <7158893+pancetta@users.noreply.github.com> Agent-Logs-Url: https://github.com/Parallel-in-Time/pySDC/sessions/96b37f2c-762b-4b92-a75a-9eca004dca16
|
@copilot Can you now apply lifting to the algebraic constraint (and not the boundary conditions) as described in the code snippet I provided in the original request to see if this raises the convergence order in the pressure term? Keep the non-lifting example to compare. |
…un_convergence.py to compare both Co-authored-by: pancetta <7158893+pancetta@users.noreply.github.com> Agent-Logs-Url: https://github.com/Parallel-in-Time/pySDC/sessions/fe78add1-f3a2-429c-b4d5-e9257c7405a5
Done in commit d6aa801. Here's what was added: Lifting function: A new class The velocity is identical in both cases. The pressure order with lifting is clearly increasing beyond M=3 with each halving of dt (3.09 → 3.34 → 3.46 → 3.54 → 4.19), consistent with approaching the full collocation order 2M-1=5. At the finest accessible dt the pressure error hits the 4th-order spatial floor (~1e-12 with nvars=1023), so we're in a pre-asymptotic regime — larger nvars would be needed to see the asymptote cleanly. |
|
@copilot Can you get the convergence orders more pronounced by playing with the variables? I wonder why we don't see full order esp. in the velocity. |
…ormulation order limit Co-authored-by: pancetta <7158893+pancetta@users.noreply.github.com> Agent-Logs-Url: https://github.com/Parallel-in-Time/pySDC/sessions/0a7bcad2-2358-4ceb-b9be-ee9049ffa9cf
Done in commit 289e581. Here's what was found and fixed: Root cause of the muddy orders: With Why the velocity converges at M+1=4 (not 2M-1=5): The The DAE constraint at each stage limits the stage derivatives to
New results ( The velocity now shows a clean plateau at 4.01 = M+1 and the no-lift pressure sits at exactly 3.00 = M. The lifted pressure order increases monotonically, confirming that the homogeneous constraint removes the order reduction. |
|
@copilot Try this remedy: treat velocity and algebraic variable together in a collocation-consistent way at every stage, or in SDC language, use an iteration that also raises the pressure/constraint approximation to collocation order instead of only correcting the differential variable. |
…e.py with 4-variant comparison Co-authored-by: pancetta <7158893+pancetta@users.noreply.github.com> Agent-Logs-Url: https://github.com/Parallel-in-Time/pySDC/sessions/caaa10d2-854c-4d03-8f8f-986aa9a48220
Done in commit 6d21c46. Added Result — Why: For this semi-explicit index-1 DAE, the stage pressure values Achieving full order 2M-1 for both velocity and pressure would require solving all M RADAU stages simultaneously as a coupled saddle-point system (standard RADAU-IIA), which goes beyond the node-by-node SDC sweep structure used here. |
|
@copilot Does the following pseudocode provide a potential remedy worth trying? given u_n for k = 1,...,K sweeps: |
… for velocity and pressure Co-authored-by: pancetta <7158893+pancetta@users.noreply.github.com> Agent-Logs-Url: https://github.com/Parallel-in-Time/pySDC/sessions/93f40bfb-629c-47d8-8e13-7f5d9f451f22
Done in commit 870f342. The differentiated constraint approach works beautifully and is simpler than the full two-step pseudocode. Key insight: Rather than the two-step provisional-velocity → pressure correction → re-solve, the remedy reduces to a single Schur-complement formula that enforces This reduces the stage pressure error from Results ( The differentiated constraint converts the semi-explicit index-1 DAE to an equivalent index-0 ODE system at each stage, allowing RADAU to achieve its full collocation order |
|
@copilot Is this coincidence (because M+1+1=2M-1 for M=3)? I.e., does this hold for M=4, 5, too? |
…ncidental Co-authored-by: pancetta <7158893+pancetta@users.noreply.github.com> Agent-Logs-Url: https://github.com/Parallel-in-Time/pySDC/sessions/62cb79d8-8b37-46d3-89b3-20e84e919ae3
Not a coincidence for the right reason you suspect, but confirmed it is indeed a coincidence! For M=3: Numerical evidence (M=4, nvars=2047, restol=1e-13): Both consecutive orders sit squarely at 6 = M+2, not heading toward 7 = 2M-1. Why M+2 (not 2M-1): The differentiated constraint reduces stage pressure errors from Docstrings corrected in commit 6e79a2c. |
|
@copilot What if we, instead of enforcing the differentiated constraint, solve the fully coupled system at each node, as described in the pseudocode here: given u_n precompute S = B * M^{-1} * B^T for k = 1,...,K sweeps: |
…ional projection Co-authored-by: pancetta <7158893+pancetta@users.noreply.github.com> Agent-Logs-Url: https://github.com/Parallel-in-Time/pySDC/sessions/a4d9fa91-6674-4917-9903-3f9123628b48
Done in commit 0aad670. The new Block solve (no projection): Mathematically equivalent to the Schur reduction in Block solve + projection ( |
|
@copilot Can we convert this into a monolithic solver over the whole time-step and check again? |
…d differentiated-constraint variants) Co-authored-by: pancetta <7158893+pancetta@users.noreply.github.com> Agent-Logs-Url: https://github.com/Parallel-in-Time/pySDC/sessions/bc544fa4-6fe9-4053-95f8-9c6e2c1e884f
Done in commit 2016d90 ( Two findings: 1. Algebraic constraint monolithic ≡ SDC standard — the monolithic y-formulation solves the same collocation fixed point as the fully-converged SDC standard sweep, producing identical errors: The order reduction is inherent in the DAE (Hairer–Wanner theory predicts only stage-order M+1 for the differential variable when RADAU-IIA is applied to an index-1 DAE with algebraic constraint). Switching from iterative SDC sweeping to a direct monolithic solve does not change this. 2. Differentiated constraint monolithic achieves 2M-1 — replacing For M=4, monolithic diffconstr achieves
|
Tests temporal order of convergence for a concrete semi-discrete Stokes/Poiseuille DAE (1D unsteady Stokes with flow-rate constraint), confirming order reduction in the algebraic pressure variable, partial restoration via constraint lifting, improved order via a differentiated-constraint remedy (order
M+2, coinciding with2M−1only forM=3), exploration of a fully coupled (N+1)×(N+1) block-solve approach with optional projection, and a monolithic RADAU-IIA collocation solver that solves all M stages simultaneously to achieve the full2M−1order.Problem / DAE formulation
Semi-explicit index-1 DAE after 4th-order FD spatial discretisation:
where
G(t)is the Lagrange multiplier (pressure gradient) andB = h·1ᵀis the discrete flow-rate integral. Manufactured solution:u_ex = sin(πy)sin(t),G_ex = cos(t).New files —
pySDC/playgrounds/Stokes_Poiseuille_1D_FD/Stokes_Poiseuille_1D_FD.py— shared_StokesBase(ProblemDAE)with seven problem classes:stokes_poiseuille_1d_fd(standard,SemiImplicitDAE): algebraic constraintB u = q(t)stokes_poiseuille_1d_fd_lift(constraint lifting,SemiImplicitDAE): liftingu_ell(t) = (q(t)/s)·1makes the constraint homogeneousB ṽ = 0stokes_poiseuille_1d_fd_diffconstr(differentiated constraint,SemiImplicitDAE): enforcesB U_m = q'(τ_m)at each stage via Schur reduction — achieves orderM+2for both velocity and pressure (=2M−1forM=3only)stokes_poiseuille_1d_fd_lift_diffconstr(lifted + differentiated,SemiImplicitDAE): equivalent to lifted at the SDC fixed pointstokes_poiseuille_1d_fd_full(no lifting,FullyImplicitDAE): same fixed point as standardstokes_poiseuille_1d_fd_lift_full(constraint lifting,FullyImplicitDAE): same fixed point as liftedstokes_poiseuille_1d_fd_coupled(coupled block solve,SemiImplicitDAE): assembles and solves the explicit (N+1)×(N+1) saddle-point block system for the differentiated constraint at each stage, with an optional post-solve projection step that additionally enforcesB·u_m = q(τ_m)_StokesBaseprovides_schur_solve,_schur_solve_full_implicit,_schur_solve_diffconstr, and_coupled_block_solve~1e-12atnvars=1023run_convergence.py—SemiImplicitDAE,M=3RADAU-RIGHT,restol=1e-13,nvars=1023,ν=0.1,Tend=1.0(7 halvings, dt=0.5…0.0078):run_monolithic.py— standalone monolithic RADAU-IIA collocation solver that builds and solves the full M×(N+1)×M×(N+1) sparse block system over the whole time-step (y-formulation:u_{n+1} = u_M). Two variants:_monolithic_step_algebraic): enforcesB·u_m = q(τ_m)at each stage — givesM+1/Morders (identical fixed point as SDC standard; order reduction is intrinsic to DAE, not an SDC artifact)_monolithic_step_diffconstr): enforcesB·u_m' = q'(τ_m)at each stage — achieves the full2M−1collocation order for both velocity and pressureKey findings
Standard (algebraic constraint): velocity converges at
M+1 = 4, pressure atM = 3. TheO(Δt^M)stage pressure errorsG_mfeed back into velocity derivatives and break the2M−1superconvergence.Constraint lifting: velocity at
M+1 = 4(unchanged); pressure order increases monotonically towardM+1 = 4. The homogeneous constraintB ṽ = 0reduces but does not fully eliminate the order reduction.Differentiated constraint
B·U_m = q'(τ_m): both velocity and pressure achieve orderM+2. The Schur formulaG = (q'(t) − B·w) / (B·v₀)reduces the stage pressure error fromO(Δt^M)toO(Δt^{M+1}). The U-formulation then gives endpoint errorΔt·O(Δt^{M+1}) = O(Δt^{M+2}). ForM=3,M+2 = 5 = 2M−1coincidentally equals the full RADAU collocation order; forM=4the order isM+2 = 6 ≠ 2M−1 = 7, as confirmed numerically. Achieving the true2M−1order requires the y-formulation (standard RADAU-IIA).Coupled (N+1)×(N+1) block solve: assembles the full saddle-point system for
(U_m, G_m)at each stage. Without projection, this is mathematically equivalent to the Schur-complement diffconstr solve and produces identicalM+2orders. With the optional projection enforcingB·u_m = q(τ_m)after the solve, convergence degrades back toM+1/M— this illustrates that self-consistency betweensolve_systemandeval_fis critical: ifeval_fchecks the differentiated residualB·U_m − q'(τ_m)but the projection enforces the algebraic residualB·u_m − q(τ_m), the fixed point is broken.Monolithic RADAU-IIA (algebraic): solving all M stages simultaneously confirms that the
M+1/Morder reduction is inherent in the algebraic DAE formulation, not an artifact of the node-by-node SDC sweep. The monolithic algebraic solver produces the same fixed point as SDC standard.Monolithic RADAU-IIA (differentiated constraint): replacing the algebraic constraint rows with the differentiated constraint in the monolithic block system achieves the full
2M−1collocation order for both velocity and pressure. Verified for M=2,3,4: orders 3, 5, 7 respectively. This confirms that the y-formulation with differentiated constraint is the route to optimal collocation accuracy.SemiImplicitDAEvsFullyImplicitDAE: both sweepers converge to the same collocation fixed point and produce identical errors for the standard and lifted formulations. Achieving2M−1with those formulations would require solving allMRADAU stages simultaneously.Why
ν=0.1: Withν=1.0the slow-mode Courant number|λΔt| ≈ 2.5at Δt=0.25 keeps results pre-asymptotic. Withν=0.1,|λΔt| ≤ 0.49at Δt=0.5, revealing the clean asymptotic orders.🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.