include/pops/validation/physics/advection_diffusion.hpp Source FileΒΆ

adc_cpp: include/pops/validation/physics/advection_diffusion.hpp Source File
adc_cpp 0.3.0
Model-free C++23 core for coupled hyperbolic-elliptic systems on adaptive (AMR) meshes, with MPI and GPU (Kokkos) backends
advection_diffusion.hpp
Go to the documentation of this file.
1#pragma once
2
16
19
20#include <cmath>
21
23
37 using Aux = pops::Aux;
38 static constexpr int n_vars = 1;
39
40 Real ax = 1.0;
41 Real ay = 0.0;
42 Real nu = 0.0;
43
45 POPS_HD State flux(const State& u, const Aux&, int dir) const {
46 return State{(dir == 0 ? ax : ay) * u[0]}; // F = a u
47 }
49 POPS_HD Real max_wave_speed(const State&, const Aux&, int dir) const {
50 const Real v = (dir == 0) ? ax : ay;
51 return v < 0 ? -v : v;
52 }
54 POPS_HD State source(const State&, const Aux&) const { return State{Real(0)}; }
56 POPS_HD Real elliptic_rhs(const State& u) const { return u[0]; }
58 POPS_HD Real diffusivity() const { return nu; }
59};
60
61} // namespace pops::validation
Definition advection_diffusion.hpp:22
double Real
Definition types.hpp:30
Pointwise types of the physics layer: StateVec<N> (conserved state) and Aux (auxiliary fields from th...
POINTWISE auxiliary fields shared with the physics: single coupling channel.
Definition state.hpp:123
Conserved state vector of fixed size, known at compile time.
Definition state.hpp:29
Scalar advection-diffusion: d_t u + a .
Definition advection_diffusion.hpp:35
POPS_HD Real diffusivity() const
Diffusivity nu: enables the parabolic term on the core side (DiffusiveModel trait).
Definition advection_diffusion.hpp:58
static constexpr int n_vars
number of conservative variables
Definition advection_diffusion.hpp:38
Real nu
diffusivity (0 = pure advection)
Definition advection_diffusion.hpp:42
POPS_HD Real elliptic_rhs(const State &u) const
Poisson right-hand side: u (not coupled here, present for the concept).
Definition advection_diffusion.hpp:56
Real ax
advection velocity in x
Definition advection_diffusion.hpp:40
POPS_HD Real max_wave_speed(const State &, const Aux &, int dir) const
Maximum wave speed: magnitude of the advection velocity in direction dir.
Definition advection_diffusion.hpp:49
POPS_HD State flux(const State &u, const Aux &, int dir) const
Advection flux F = a u in direction dir.
Definition advection_diffusion.hpp:45
POPS_HD State source(const State &, const Aux &) const
Zero source term.
Definition advection_diffusion.hpp:54
Real ay
advection velocity in y
Definition advection_diffusion.hpp:41
Base scalar types and the POPS_HD macro (host+device portability).
#define POPS_HD
Definition types.hpp:25