Upwind Divergence

First-order upwind schemes on a particle cloud. Three algorithms are available, selected with a symbol at construction:

AlgorithmSystemsDimensionForm
:Classicany $M$any $D$Riemann fluxes at particle midpoints (conservative, supports non-conservative jumps)
:Tiwari$M = 1$any $D$One-sided MLS gradient per direction, times the advection speed
:Praveen$M = 1$$D = 2$Normal/tangential splitting of edge velocities (Praveen's meshless upwind)

Construction

UpwindDivergence(T, D, M, order, alg::Symbol, flux::NumericalFluxFunction; div_order = 0)

order must be 1. :Tiwari and :Praveen assert M == 1. :Praveen is only defined for D == 2; other dimensions give a MethodError on the first call.

Algorithms

Classic. For each neighbour, the numerical flux between $U_i$ and $U_j$ is evaluated (no reconstruction) and

\[\nabla\cdot F_i \approx 2\, \mathcal D^{(1)}_i\big[\, F_{\text{num},ij} - F(U_i) + \text{nc\_jump}_{ij} \,\big].\]

See Numerical Flux Functions for the factor 2. The divergence is zero if the particle has fewer than $D$ neighbours.

Tiwari. For each direction $d$, the stencil is restricted to upwind neighbours, $v_d\, x_{ij,d} \le 0$ with $v_d = {\tt velocity}(eq, U_i, d)$, and

\[\nabla\cdot F_i \approx \sum_d v_d\, \big(\partial_d u\big)_{\text{upwind}} .\]

This is the advective (quasi-linear) form $v\cdot\nabla u$, which is conservative only for constant $v$. A direction whose upwind stencil is too small contributes zero.

Praveen. Uses a 2×2 first-order moment matrix; each neighbour offset is projected onto normal $n$ and tangential $s$ directions, and only the upwind parts $\min(v_n, 0)$ and $\min(\bar\beta\, v_s, 0)$ contribute. The result is scaled by 2. The divergence is zero for fewer than three neighbours or a singular moment matrix.

Behaviour

  • Stateless: no pre-gather pass.
  • Order: always 1, so MOOD has nothing to lower; the scheme is a natural fallback reference.
  • Moving grids: all three algorithms read only the PDE API, so with an ALEFrame they upwind with respect to the relative velocity $v - w$.

Reference

HyperCloudCore.UpwindDivergence — Type
UpwindDivergence{D, M, T, MAX_ORDER, DIV_ORDER, B_LEN, INTERPS, Algorithm <: UpwindAlgorithm, NF} <: DivergenceInterpolator
UpwindDivergence(::Type{T}, dimension::Int, M::Int, order::Int, algType::Symbol, flux::NumericalFluxFunction; div_order::Int=0)
(upwind::UpwindDivergence)(eq, i, f_i, nb_slice, pg, ib)

Upwind divergence interpolator for evaluating flux derivatives in hyperbolic PDEs using directional physics-based algorithms.

Constructors

UpwindDivergence(::Type{T}, dimension::Int, M::Int, order::Int, algType::Symbol, flux::NumericalFluxFunction; div_order::Int=0)
  • T: The numeric type (e.g., Float64).
  • dimension: Spatial dimension.
  • M: Number of state components.
  • order: Maximum interpolation order. Must be 1 (upwind evaluates piecewise-constant states).
  • algType: Symbol specifying the upwind strategy. Accepts :Classic, :Tiwari (scalar only), or :Praveen (scalar 2D only).
  • flux: The numerical flux function instance to resolve interface states.
  • div_order: Target order (defaults to 0, dynamically bound to the available particle order).

Callable / Functor

(upwind::UpwindDivergence)(eq, i, f_i, nb_slice, pg, ib, strat) -> State{M, T}

Evaluates the divergence at particle i. The behavior dispatched depends on the underlying Algorithm:

  • Classic Algorithm: Computes interface fluxes via standard Riemann solver logic and non-conservative jump evaluation. Dynamically degrades interpolation order based on neighbor count.
  • Tiwari Algorithm: Evaluates one-sided directional stencils masked by the advection velocity sign, calculating the divergence dimension-by-dimension.
  • Praveen Algorithm: Uses a strictly first-order, stateless approach computing upwind fluxes via local moment matrices and edge normal/tangential velocities.

Fields

  • interpolators: Pre-allocated tuple of Interpolator instances up to MAX_ORDER.
  • flux: The associated numerical flux function (NF).
source