pySDC#
Prototyping spectral deferred corrections, from a single sweep to space-time parallel PFASST.
SDC MLSDC PFASST ParaDiag NumPy CuPy FEniCS Firedrake PETSc MPI
pySDC solves initial value problems \(u' = f(u, t)\) with spectral deferred corrections (SDC): each time step is a collocation problem, which SDC solves iteratively, one sweep over the nodes at a time. On top of SDC, pySDC has multilevel SDC (MLSDC), PFASST, which iterates on many time steps in parallel, and ParaDiag. Problems, sweepers, preconditioners and the parallel setup are exchangeable parts, so trying out a new idea takes a few lines, and the tests keep the results of papers and theses reproducible.
Where to go#
Features, installation, and how to cite pySDC.
Nine steps, from a first collocation problem to SDC, MLSDC, PFASST and ParaDiag.
Research built on pySDC: the tested code behind papers, theses and studies.
Problems, sweepers, controllers, hooks and helpers.
How to cite pySDC, and the research that uses it.
How to contribute: pull requests, continuous integration, testing and conventions.
Try it#
What this looks like in practice: one time step of the nonlinear, and for a thin interface ε stiff, Allen-Cahn equation
on 128 periodic grid points. Press Run, and the plot shows how fast SDC, or two-level MLSDC, drives the residual of the step’s collocation problem down, iteration by iteration. Change the setup and run again to compare. It runs in your browser, with Pyodide; nothing is installed.
Choose a setup and press Run. Each run adds a curve, so you can compare setups.
The default setup, in pySDC
from pySDC.implementations.problem_classes.AllenCahn_1D_FD import allencahn_periodic_fullyimplicit
from pySDC.implementations.sweeper_classes.generic_implicit import generic_implicit
from pySDC.implementations.controller_classes.controller_nonMPI import controller_nonMPI
from pySDC.helpers.stats_helper import get_sorted
description = {
'problem_class': allencahn_periodic_fullyimplicit,
'problem_params': {'nvars': 128, 'eps': 0.04, 'dw': 0.0, 'newton_tol': 1e-12},
'sweeper_class': generic_implicit,
'sweeper_params': {'num_nodes': 3, 'quad_type': 'RADAU-RIGHT', 'QI': 'LU', 'initial_guess': 'spread'},
'level_params': {'dt': 0.1, 'restol': 1e-10},
'step_params': {'maxiter': 30},
}
# one time step, the collocation problem solved by SDC
controller = controller_nonMPI(num_procs=1, controller_params={'logger_level': 40}, description=description)
u0 = controller.MS[0].levels[0].prob.u_exact(0.0)
uend, stats = controller.run(u0=u0, t0=0.0, Tend=0.1)
residuals = [r for _, r in get_sorted(stats, type='residual_post_iteration', sortby='iter')]
The whole demo is landing_demo.py.