Skip to main content

Introduction

Dedalus comes with a comprehensive set of example scripts that demonstrate how to solve PDEs across various geometries and problem types. These examples range from simple 1D problems to complex 3D simulations on spherical domains, covering initial value problems (IVPs), eigenvalue problems (EVPs), linear boundary value problems (LBVPs), and nonlinear boundary value problems (NLBVPs). All examples are located in the examples/ directory of the source distribution and are fully documented with clear explanations of the physics, numerics, and expected results.

Running Examples

Most examples can be run directly with Python:
python3 example_script.py
For parallel execution with MPI (when supported):
mpiexec -n 4 python3 example_script.py
Many examples include companion plotting scripts (e.g., plot_snapshots.py) to visualize the saved data:
mpiexec -n 4 python3 plot_snapshots.py snapshots/*.h5

Example Categories

By Geometry

Cartesian

Rectangular domains with Fourier and Chebyshev bases

Disk & Annulus

Polar coordinate problems in disks and annular regions

Sphere, Shell & Ball

Spherical coordinate problems in full spheres, shells, and balls

Eigenvalue Problems

Linear stability analysis and spectral problems

By Problem Type

  • Initial Value Problems (IVP): Time-evolving simulations starting from initial conditions
  • Eigenvalue Problems (EVP): Linear stability analysis and mode computation
  • Linear Boundary Value Problems (LBVP): Steady-state linear problems
  • Nonlinear Boundary Value Problems (NLBVP): Steady-state nonlinear problems solved via Newton iteration

Rayleigh-Bénard Convection

Classic thermal convection between heated plates

KdV-Burgers Equation

Nonlinear wave equation with dispersion and dissipation

Disk Libration

Librational instability in a rotating disk

Shallow Water on Sphere

Barotropic instability of a mid-latitude jet

Spherical Shell Convection

Boussinesq convection in a spherical shell

Lane-Emden Equation

Astrophysical polytropic structure via nonlinear BVP

Getting Started

If you’re new to Dedalus, we recommend starting with:
  1. 1D KdV-Burgers equation - Simple 1D Fourier basis problem with visualization
  2. 2D Rayleigh-Bénard convection - Classic fluid dynamics problem in Cartesian geometry
  3. Waves on a string - Simple eigenvalue problem with analytical solution
These examples provide clear templates for building your own simulations.

Computational Requirements

Examples are designed to run quickly for testing and learning:
  • 1D examples: Seconds (serial only)
  • 2D examples: 5-20 cpu-minutes (parallelizable)
  • 3D examples: 10-30 cpu-minutes (parallelizable)
Reduction in resolution or runtime can speed up testing, though results may differ from documented behavior.

Build docs developers (and LLMs) love