Skip to main content

Module pde_solvers

Module pde_solvers 

Source
Expand description

Finite-difference PDE solvers for common one-dimensional equations.

All solvers operate on simple Vecf64` grids and accept closure-based boundary conditions or source terms for flexibility. The emphasis is on correctness and clarity rather than maximum performance.

Structs§

CflCondition
Stability criterion checker for explicit finite-difference schemes.

Functions§

advection_1d_upwind
Solve the 1-D linear advection equation ∂u/∂t + c ∂u/∂x = 0 for n_steps time steps using a first-order upwind scheme.
burger_equation_1d
Solve the inviscid Burgers equation ∂u/∂t + ∂(u²/2)/∂x = 0 for n_steps time steps using the Godunov (Rusanov) flux.
diffusion_reaction_1d
Solve the 1-D diffusion-reaction equation ∂u/∂t = D ∂²u/∂x² + R(u, x, t) for n_steps time steps using the explicit FTCS scheme.
heat_equation_1d
Solve the 1-D heat equation ∂u/∂t = α ∂²u/∂x² for n_steps time steps using the explicit Forward-Time Centred-Space (FTCS) scheme.
poisson_1d
Solve the 1-D Poisson equation −u″ = f on a uniform grid using the Thomas algorithm (tridiagonal matrix algorithm, TDMA).
wave_equation_1d
Solve the 1-D wave equation ∂²u/∂t² = c² ∂²u/∂x² using the second-order leapfrog (Störmer–Verlet) explicit scheme.