2 Examples

These are example scripts using the py-pde package, which illustrates some of the most important features of the package.

2.1 Grids and fields

These examples show how to define and manipulate discretized fields.

Plot a polar grid

Plot a polar grid

Plotting a vector field

Plotting a vector field

Plotting a scalar field in cylindrical coordinates

Plotting a scalar field in cylindrical coordinates

Visualizing a scalar field

Visualizing a scalar field

2.2 Simple PDEs

These examples demonstrate basic usage of the package to solve PDEs.

Solving Laplace’s equation in 2d

Solving Laplace's equation in 2d

Solving Poisson’s equation in 1d

Solving Poisson's equation in 1d

Simple diffusion equation

Simple diffusion equation

Kuramoto-Sivashinsky - Using PDE class

Kuramoto-Sivashinsky - Using PDE class

Spherically symmetric PDE

Spherically symmetric PDE

Diffusion on a Cartesian grid

Diffusion on a Cartesian grid

Stochastic simulation

Stochastic simulation

Setting boundary conditions

Setting boundary conditions

Time-dependent boundary conditions

Time-dependent boundary conditions

1D problem - Using PDE class

1D problem - Using PDE class

Brusselator - Using the PDE class

Brusselator - Using the PDE class

Diffusion equation with spatial dependence

Diffusion equation with spatial dependence

Schrödinger’s Equation

Schrödinger's Equation

2.3 Output and analysis

These examples demonstrate how to store and analyze output.

Storage examples

Storage examples

Writing and reading trajectory data

Writing and reading trajectory data

Using simulation trackers

Using simulation trackers

2.4 Advanced PDEs

These examples demonstrate more advanced usage of the package.

Post-step hook function

Post-step hook function

Heterogeneous boundary conditions

Heterogeneous boundary conditions

Kuramoto-Sivashinsky - Using custom class

Kuramoto-Sivashinsky - Using custom class

Custom Class for coupled PDEs

Custom Class for coupled PDEs

1D problem - Using custom class

1D problem - Using custom class

Custom noise

Custom noise

Kuramoto-Sivashinsky - Compiled methods

Kuramoto-Sivashinsky - Compiled methods

Solver comparison

Solver comparison

Post-step hook function in a custom class

Post-step hook function in a custom class

Custom PDE class: SIR model

Custom PDE class: SIR model

Brusselator - Using custom class

Brusselator - Using custom class