numra-pde 0.1.3

Partial differential equation solvers for Numra via Method of Lines: heat, advection-diffusion, reaction-diffusion in 1D/2D/3D, Stefan moving-boundary problems.
Documentation

numra-pde

Partial differential equation solvers for the Numra workspace — Method of Lines for heat, advection-diffusion, and reaction-diffusion in 1D / 2D / 3D, plus Stefan-condition moving-boundary problems.

Crates.io docs.rs

Method of Lines: discretize the spatial operator with finite differences, hand the resulting ODE system to a numra-ode stepper (often Radau5 for stiff diffusion problems), and let stiffness and step control happen at the time-integration layer rather than in custom PDE code.

Example

use numra_ode::{DoPri5, Solver, SolverOptions};
use numra_pde::boundary::DirichletBC;
use numra_pde::{Grid1D, HeatEquation1D, MOLSystem};

let grid = Grid1D::uniform(0.0_f64, 1.0, 51);
let pde = HeatEquation1D::new(0.01);
let mol = MOLSystem::new(pde, grid.clone(), DirichletBC::new(1.0), DirichletBC::new(0.0));

let u0: Vec<f64> = grid.points().iter()
    .map(|&x| (std::f64::consts::PI * x).sin())
    .collect();

let opts = SolverOptions::default().rtol(1e-6);
let _ = DoPri5::solve(&mol, 0.0, 0.5, &u0[1..u0.len()-1], &opts);

What's in this crate

Equations (built-in):

  • 1D: HeatEquation1D, DiffusionReaction1D
  • 2D: HeatEquation2D, AdvectionDiffusion2D, ReactionDiffusion2D
  • 3D: HeatEquation3D, AdvectionDiffusion3D, ReactionDiffusion3D

Discretization:

  • Grid1D, Grid2D, Grid3D — uniform spatial grids
  • FDM, Stencil, DifferenceScheme — finite-difference operators
  • MOLSystem, MOLSystem2D, MOLSystem3D — Method-of-Lines wrappers
  • ParametricMOLSystem2D, ParametricMOLSystem3D — parameterized variants for sensitivity studies

Boundary conditions:

  • 1D: DirichletBC, NeumannBC, RobinBC, PeriodicBC
  • 2D/3D: BoundaryConditions2D, BoundaryConditions3D

Moving boundaries: MovingBound, StefanCondition, CoordinateTransform, Domain1D — for melting/freezing and other phase-change problems.

Sparse assembly: assemble_laplacian_2d, assemble_laplacian_3d, assemble_operator_2d, assemble_operator_3d.

Composes with

  • numra-ode — time-stepping the spatially-discretized system (often Radau5 for stiff diffusion)
  • numra-spde — shares the same spatial discretizations under stochastic time stepping
  • numra-stats — spatial-distribution statistics at final time (mean, variance, percentile)
  • numra-linalg — sparse Laplacian / Helmholtz operator assembly

See interop workflows for the verified PDE → statistics workflow.

Install

[dependencies]
numra-pde = "0.1"

Or via the umbrella crate:

[dependencies]
numra = "0.1"

Documentation

License

Numra Academic & Research License (Non-Commercial). Academic and research use is free; commercial use requires a separate license — contact contact@spectralautomata.com. See LICENSE.