Skip to content

Add boundary lifting case to restore full SDC order with time-dependent BCs (FEniCS playground)#633

Closed
Copilot wants to merge 2 commits into
masterfrom
copilot/copilotimplement-sdc-time-dependent-bc
Closed

Add boundary lifting case to restore full SDC order with time-dependent BCs (FEniCS playground)#633
Copilot wants to merge 2 commits into
masterfrom
copilot/copilotimplement-sdc-time-dependent-bc

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 22, 2026

Adds a third case fenics_heat_mass_timebc_lift to the pySDC/playgrounds/FEniCS/order_reduction/ playground (alongside the existing homogeneous-BC and time-dependent-BC cases) that uses boundary lifting to restore full order of convergence when solving the heat equation with time-dependent Dirichlet boundary conditions, as described in Dutt, Greengard, Rokhlin — Mathematics of Computation, 2001.

Approach

The boundary lifting technique decomposes the solution as

$$u(x, t) = v(x, t) + E(x, t)$$

where $E(x, t) = (1-2x)\cos(t) + c$ is a linear lift satisfying the time-dependent boundary conditions, and $v(x,t)$ satisfies homogeneous Dirichlet BCs. Applying SDC to $v$ (with homogeneous BCs) restores the full order of convergence that is lost when time-dependent BCs are applied directly.

The equation for the transformed variable $v = u - E$ becomes:

$$\frac{dv}{dt} = \nu \Delta v + \tilde{f}, \quad \tilde{f} = f - \frac{\partial E}{\partial t} + \nu \Delta E$$

Since $E$ is linear in $x$, $\Delta E = 0$ and $\partial E/\partial t = -(1-2x)\sin(t)$, giving:

$$\tilde{f}(x,t) = -\cos(\pi x)(\sin(t) - \nu\pi^2\cos(t)) + (1-2x)\sin(t)$$

The exact transformed solution is $v(x,t) = \cos(t)(\cos(\pi x) - 1 + 2x)$.

Changes

pySDC/playgrounds/FEniCS/order_reduction/problem_classes.py (new file)

  • New class fenics_heat_mass_timebc_lift inheriting from fenics_heat_mass_timebc:
    • __init__: overrides self.g with the modified forcing $\tilde{f}$ including the lift correction
    • solve_system: uses bc_hom (homogeneous BCs) instead of the time-dependent bc
    • u_exact: returns the exact transformed variable $v_\text{exact} = u_\text{exact} - E$

pySDC/playgrounds/FEniCS/order_reduction/run_convergence.py (new file)

  • Convergence study over three cases: sine/homogeneous (no reduction), cosine/time-dependent (order reduction), and cosine with boundary lifting (full order restored)

pySDC/playgrounds/FEniCS/order_reduction/test_order_reduction.py (new file)

  • Tests for all three cases:
    • test_sine_no_order_reduction: sine case achieves expected SDC order
    • test_cosine_order_reduction: cosine case exhibits order reduction
    • test_cosine_has_lower_order_than_sine: order reduction is present relative to sine case
    • test_lifting_restores_full_order: lifting case recovers full SDC convergence order (≥ 2M − 2)
    • test_lifting_has_higher_order_than_timebc: lifting order exceeds plain time-dependent BC order by more than 1.0

Security Summary

No security vulnerabilities introduced or found. CodeQL analysis returned 0 alerts.


📱 Kick off Copilot coding agent tasks wherever you are with GitHub Mobile, available on iOS and Android.

…for full-order SDC

Co-authored-by: pancetta <7158893+pancetta@users.noreply.github.com>
Agent-Logs-Url: https://github.com/Parallel-in-Time/pySDC/sessions/e779943f-1db6-43de-b754-0662b9de5907
@pancetta
Copy link
Copy Markdown
Member

@copilot Do not touch the tutorial or the problem class. Only operate in the playground of #632 . You can create a derived problem class there and add the next case to the demonstrator of #632 , checking the order as for the other two.

… order_reduction playground

Co-authored-by: pancetta <7158893+pancetta@users.noreply.github.com>
Agent-Logs-Url: https://github.com/Parallel-in-Time/pySDC/sessions/2c36aac4-ef83-455d-b575-cdf0b6c3cbb3
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Mar 22, 2026

@copilot Do not touch the tutorial or the problem class. Only operate in the playground of #632 . You can create a derived problem class there and add the next case to the demonstrat...

Done in commit 8041402. Reverted the changes to the problem class and tutorial. The boundary lifting implementation is now entirely in the playground:

  • pySDC/playgrounds/FEniCS/order_reduction/problem_classes.pyfenics_heat_mass_timebc_lift derived from fenics_heat_mass_timebc, overriding __init__ (lift-corrected forcing), solve_system (homogeneous BCs), and u_exact (transformed variable v)
  • pySDC/playgrounds/FEniCS/order_reduction/run_convergence.py — adds the third case to main() and the for loop
  • pySDC/playgrounds/FEniCS/order_reduction/test_order_reduction.py — adds test_lifting_restores_full_order and test_lifting_has_higher_order_than_timebc, checking that the lifting approach recovers the full SDC convergence order

Copilot AI changed the title Add boundary lifting case to restore full SDC order with time-dependent BCs Add boundary lifting case to restore full SDC order with time-dependent BCs (FEniCS playground) Mar 22, 2026
@pancetta
Copy link
Copy Markdown
Member

@copilot Create this PR not for the master branch but for the branch copilot/implement-sdc-time-dependent-bc from #632. This avoids recreating everything.

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Mar 22, 2026

@copilot Create this PR not for the master branch but for the branch copilot/implement-sdc-time-dependent-bc from #632. This avoids recreating everything.

The current branch (copilot/copilotimplement-sdc-time-dependent-bc) already contains exactly the right diff when compared against copilot/implement-sdc-time-dependent-bc — only 3 playground files:

  • problem_classes.py (new: fenics_heat_mass_timebc_lift)
  • run_convergence.py (updated: adds lifting case to the loop)
  • test_order_reduction.py (updated: adds test_lifting_restores_full_order and test_lifting_has_higher_order_than_timebc)

No tutorial or problem class files appear in that diff. However, the integration token doesn't have permission to change a PR's base branch programmatically — could you please update the base of PR #633 from master to copilot/implement-sdc-time-dependent-bc via the GitHub UI?

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.

2 participants