upwind

← Components

intsharp/solvers/upwind.py

First-order upwind advection

Supports: 1D and 2D (selected automatically based on domain)

Solves the linear advection equation:

\[ \frac{\partial f}{\partial t} + \mathbf{u} \cdot \nabla f = 0 \]

Discrete update (1D, \( u \geq 0 \)):

\[ f_i^{n+1} = f_i^n - \text{CFL} \cdot (f_i^n - f_{i-1}^n) \]

where \( \text{CFL} = u \, \Delta t / \Delta x \). For \( u < 0 \), upwind is taken from the right.

In 2D, operator splitting is used to apply 1D upwind in each direction sequentially.

Stability: Requires \( \text{CFL} \leq 1 \) in each direction.