Skip to content

Commit 6e79a2c

Browse files
Copilotpancetta
andauthored
Fix diffconstr order claim: M+2 (not 2M-1); for M=3 M+2=5=2M-1 is coincidental
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
1 parent 870f342 commit 6e79a2c

2 files changed

Lines changed: 50 additions & 33 deletions

File tree

pySDC/playgrounds/Stokes_Poiseuille_1D_FD/Stokes_Poiseuille_1D_FD.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,9 @@
5656
5757
* :class:`~pySDC.projects.DAE.sweepers.semiImplicitDAE.SemiImplicitDAE`
5858
(U-formulation): velocity order :math:`M+1`, pressure order :math:`M`
59-
(standard), approaching :math:`M+1` (lifted), or full :math:`2M-1`
60-
(differentiated constraint).
59+
(standard), approaching :math:`M+1` (lifted), or order :math:`M+2`
60+
(differentiated constraint — coincides with :math:`2M-1` only for
61+
:math:`M = 3`).
6162
6263
Three constraint treatments are provided — see Classes section below.
6364
@@ -108,8 +109,13 @@
108109
G_m = \frac{q'(\tau_m) - B\mathbf{w}}{B\mathbf{v}_0},
109110
110111
and the stage pressure error reduces from :math:`\mathcal{O}(\Delta t^M)`
111-
to :math:`\mathcal{O}(\Delta t^{M+1})`, restoring the full RADAU
112-
collocation order :math:`2M-1` for **both** velocity and pressure.
112+
to :math:`\mathcal{O}(\Delta t^{M+1})`. The U-formulation quadrature then
113+
gives endpoint error :math:`\Delta t \cdot \mathcal{O}(\Delta t^{M+1}) =
114+
\mathcal{O}(\Delta t^{M+2})`. **For :math:`M = 3`, :math:`M+2 = 5 = 2M-1`
115+
coincidentally equals the full RADAU collocation order.** For :math:`M = 4`,
116+
the order is :math:`M+2 = 6 \neq 2M-1 = 7`, as confirmed numerically.
117+
Achieving :math:`2M-1` for :math:`M \geq 4` requires the y-formulation
118+
(standard RADAU-IIA), not the U-formulation used here.
113119
114120
Classes
115121
-------
@@ -123,7 +129,8 @@
123129
124130
stokes_poiseuille_1d_fd_diffconstr
125131
Differentiated constraint :math:`B\mathbf{U}_m = q'(\tau_m)`.
126-
SemiImplicitDAE: **vel and pres both at** :math:`2M-1`.
132+
SemiImplicitDAE: vel and pres both at :math:`M+2` (= :math:`2M-1`
133+
only for :math:`M = 3`).
127134
128135
stokes_poiseuille_1d_fd_lift_diffconstr
129136
Lifting + differentiated :math:`B\tilde{\mathbf{U}} = 0`.

pySDC/playgrounds/Stokes_Poiseuille_1D_FD/run_convergence.py

Lines changed: 38 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -26,33 +26,35 @@
2626
increases toward :math:`M+1`.
2727
2828
3. **Differentiated constraint** :math:`B\mathbf{u}' = q'(t)`: replaces the
29-
algebraic constraint with its time derivative. Converts the DAE to an
30-
equivalent index-0 ODE system, allowing RADAU to achieve the full
31-
collocation order :math:`2M-1` for **both** velocity and pressure.
29+
algebraic constraint with its time derivative, raising the stage pressure
30+
accuracy by one order from :math:`\mathcal{O}(\Delta t^M)` to
31+
:math:`\mathcal{O}(\Delta t^{M+1})`. The endpoint error in the
32+
**U-formulation** then becomes
33+
:math:`\Delta t\,\sum_j Q_{Mj}\,\mathcal{O}(\Delta t^{M+1}) =
34+
\mathcal{O}(\Delta t^{M+2})`. For :math:`M = 3` this gives
35+
:math:`M+2 = 5 = 2M-1` (coincidence!). For :math:`M \geq 4` the order
36+
is :math:`M+2`, **not** :math:`2M-1`.
3237
3338
Key findings (:math:`\nu = 0.1`, ``nvars = 1023``, ``restol = 1e-13``,
3439
:math:`M = 3`)
3540
------------------------------------------------------------------------
3641
3742
* **Standard (algebraic)**: velocity :math:`\to M+1 = 4`, pressure
3843
:math:`\to M = 3`. The :math:`\mathcal{O}(\Delta t^M)` stage pressure
39-
errors feed back into the velocity derivatives and break the :math:`2M-1`
40-
superconvergence.
44+
errors feed back into the velocity derivatives and break superconvergence.
4145
4246
* **Lifted (homogeneous)**: velocity :math:`\to M+1 = 4` (unchanged);
4347
pressure order increases monotonically toward :math:`M+1 = 4`.
4448
45-
* **Differentiated constraint**: velocity :math:`\to 2M-1 = 5` ✓,
46-
pressure :math:`\to 2M-1 = 5` ✓. By enforcing :math:`B\mathbf{U}_m =
47-
q'(\tau_m)` at each stage instead of :math:`B\mathbf{u}_m = q(\tau_m)`,
48-
the stage pressure errors are reduced to
49-
:math:`e_{G_m} = -BAe_{\mathbf{u}_m}/s = \mathcal{O}(\Delta t^{M+1})`,
50-
eliminating the feedback that breaks superconvergence. The index-reduced
51-
system is essentially an ODE and RADAU achieves its full order :math:`2M-1`.
49+
* **Differentiated constraint**: velocity :math:`\to M+2 = 5`,
50+
pressure :math:`\to M+2 = 5`. For :math:`M = 3`, :math:`M+2 = 5 = 2M-1`
51+
coincidentally equals the full RADAU collocation order. For :math:`M = 4`,
52+
the observed order is :math:`M+2 = 6 \neq 2M-1 = 7`, confirming that the
53+
improvement is one order (+1) above the standard, not a jump to :math:`2M-1`.
5254
53-
Why the differentiated constraint works
54-
----------------------------------------
55-
For the original algebraic constraint at each node:
55+
Why the differentiated constraint improves order by +1
56+
-------------------------------------------------------
57+
For the original algebraic constraint at each SDC node:
5658
5759
.. math::
5860
@@ -74,7 +76,12 @@
7476
7577
since the stage velocity error :math:`e_{\mathbf{u}_m} = \mathcal{O}(\Delta
7678
t^{M+1})` at collocation nodes. With :math:`G_m` at order :math:`M+1`, the
77-
velocity endpoint recovers the full RADAU superconvergence :math:`2M-1`.
79+
stage velocity derivative errors :math:`e_{\mathbf{U}_m} = \mathcal{O}(\Delta
80+
t^{M+1})`, and the U-formulation quadrature gives endpoint order
81+
:math:`\Delta t \cdot \mathcal{O}(\Delta t^{M+1}) = \mathcal{O}(\Delta
82+
t^{M+2})`. Achieving the full collocation order :math:`2M-1 \geq M+2` for
83+
:math:`M \geq 4` would require the **y-formulation** (standard RADAU-IIA), not
84+
the U-formulation.
7885
7986
Usage::
8087
@@ -212,18 +219,21 @@ def main():
212219
:math:`M = 3`.
213220
* **Lifted (homogeneous)**: velocity :math:`M+1 = 4`, pressure
214221
approaches :math:`M+1 = 4`.
215-
* **Differentiated constraint**: both velocity and pressure
216-
approach full collocation order :math:`2M-1 = 5`.
222+
* **Differentiated constraint**: both velocity and pressure at
223+
order :math:`M+2 = 5`. For :math:`M = 3`, :math:`M+2 = 5 = 2M-1`
224+
coincidentally equals the full RADAU collocation order; the improvement
225+
is one order (+1) above the standard, not a jump to :math:`2M-1`.
217226
* **Lifted + differentiated**: same as lifted (the differentiated
218227
homogeneous constraint is equivalent to the original).
219228
"""
220-
colloc_order = 2 * _NUM_NODES - 1 # 2M-1 = 5
229+
mplus2 = _NUM_NODES + 2 # M+2 = 5 for M=3 (coincides with 2M-1=5)
221230

222231
# 7 halvings from T_end/2 to T_end/128 → 0.5, 0.25, …, 0.0078125
223232
dts = [_TEND / (2**k) for k in range(1, 8)]
224233

225234
print(f'\nFully-converged SDC (restol={_RESTOL:.0e}, ν={_NU}, M={_NUM_NODES})')
226-
print(f'Full RADAU collocation order: 2M-1 = {colloc_order}')
235+
print(f'Standard vel order: M+1={_NUM_NODES+1}; diffconstr vel order: M+2={mplus2}')
236+
print(f' (For M=3: M+2=5=2M-1=5 — coincidence; for M=4: M+2=6≠2M-1=7)')
227237
print(f'nvars = {_NVARS}, 4th-order FD (spatial floor ~ O(dx^4) ≈ 1e-12)')
228238
print(f'ν = {_NU}: slow-mode |λΔt| ≤ {_NU * np.pi**2 * dts[0]:.2f} at Δt = {dts[0]:.4f}'
229239
f' → asymptotic regime accessible')
@@ -235,7 +245,7 @@ def main():
235245
(stokes_poiseuille_1d_fd_lift,
236246
'Lifted (B·ṽ = 0, homogeneous constraint)'),
237247
(stokes_poiseuille_1d_fd_diffconstr,
238-
'Diff.constr. (B·U = q\'(t), differentiated) ← remedy'),
248+
f'Diff.constr. (B·U = q\'(t)) order M+2={mplus2} ← remedy'),
239249
(stokes_poiseuille_1d_fd_lift_diffconstr,
240250
'Lifted+diff. (B·Ũ = 0, equiv. to lifted)'),
241251
]
@@ -254,7 +264,7 @@ def main():
254264
vel_errs.append(ve)
255265
pres_errs.append(pe)
256266

257-
_print_table(dts, vel_errs, pres_errs, colloc_order)
267+
_print_table(dts, vel_errs, pres_errs, mplus2)
258268
results[label] = (vel_errs, pres_errs)
259269

260270
# ---- Summary ----
@@ -279,15 +289,15 @@ def main():
279289
f' • Lifted (B·ṽ=0): vel→M+1, pres increasing toward M+1 (pre-asymptotic).'
280290
)
281291
print(
282-
f' • Differentiated constraint (B·U=q\'): vel→2M-1={colloc_order}, '
283-
f'pres→2M-1={colloc_order}.'
292+
f' • Differentiated constraint (B·U=q\'): vel→M+2={mplus2}, '
293+
f'pres→M+2={mplus2}.'
284294
)
285295
print(
286296
' Enforcing B·U_m = q\'(τ_m) at each stage reduces the stage pressure\n'
287-
' error from O(dt^M) to O(dt^(M+1)), restoring the full RADAU\n'
288-
' superconvergence order 2M-1 for both velocity and pressure.\n'
289-
' The differentiated constraint converts the semi-explicit index-1\n'
290-
' DAE to an equivalent index-0 ODE system at each stage.'
297+
' error from O(dt^M) to O(dt^{M+1}), giving endpoint order O(dt^{M+2})\n'
298+
' in the U-formulation. For M=3: M+2=5=2M-1 (coincidence!). For M=4:\n'
299+
' M+2=6, which is observed, confirming the improvement is +1 order\n'
300+
' over the standard, not a jump to the full collocation order 2M-1.'
291301
)
292302
print(
293303
f' • Lifted+differentiated: same as lifted (the differentiated\n'

0 commit comments

Comments
 (0)