Skip to content

Add upwind advection operator builder in matrix_ops #59

@jc-macdonald

Description

@jc-macdonald

Summary

matrix_ops.py currently provides a diffusion (Laplacian) operator builder and Crank–Nicolson / implicit-Euler / trapezoidal time-stepping helpers, but has no advection operator builder.

Motivation

McKendrick–von Foerster-style PDE models (e.g., immune-status-structured compartmental models) require a first-order advection (transport) term of the form:

$$\frac{\partial u}{\partial t} + v \frac{\partial u}{\partial x} = \ldots$$

to model continuous waning along a structured axis. The StageOperatorFactory pattern is already set up to produce (L, R) matrix pairs keyed on dt, so an advection builder would slot in naturally.

Proposed scope

  1. Add build_advection_matrix(n, dx, velocity, ...) to matrix_ops.py returning a sparse upwind (or flux-limiter) discretisation matrix.
  2. Support uniform grids initially; non-uniform grid support can follow from Non-uniform grid Laplacian operator in matrix_ops #45.
  3. Return format compatible with existing build_cn_operators / build_implicit_euler_operators helpers.
  4. Unit tests covering CFL stability, conservation, and convergence order.

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions