PotentialForce Struct ReferenceΒΆ

adc_cpp: pops::PotentialForce Struct Reference
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
pops::PotentialForce Struct Reference

Electrostatic potential force (q/m) rho E on momentum (+ work on energy if 4 variables). More...

#include <source.hpp>

+ Collaboration diagram for pops::PotentialForce:

Public Member Functions

template<class State >
POPS_HD State apply (const State &u, const Aux &a) const
 

Public Attributes

Real qom = 1
 
int c_rho = 0
 
int c_mx = 1
 
int c_my = 2
 
int c_E = 3
 

Detailed Description

Electrostatic potential force (q/m) rho E on momentum (+ work on energy if 4 variables).

E = -grad phi = -(aux.grad_x, aux.grad_y).

CONTRACT: pointwise SOURCE brick, device-callable (POPS_HD), no global state. Formula: s[c_mx] += qom*rho*Ex, s[c_my] += qom*rho*Ey, s[c_E] += qom*(rho_u*Ex + rho_v*Ey) (the c_E work term is active only if State::size() == 4: compressible Euler).

ROLE-AWARE (audit section 5): the component indices (density c_rho, momentum c_mx/c_my, energy c_E) are MEMBERS, defaulting to the CANONICAL fluid layout (rho=0, m_x=1, m_y=2, E=3). model_factory RESOLVES them at construction (host) via TR::conservative_vars().index_of(role); for any NATIVE transport (Euler/Isothermal, canonical roles) the resolved indices == these defaults -> STRICTLY bit-identical. POD integers -> apply stays device-clean (reads u[c_rho], never resolves on device). No new user parameter: automatic, transparent resolution.

Member Function Documentation

◆ apply()

template<class State >
POPS_HD State pops::PotentialForce::apply ( const State &  u,
const Aux a 
) const
inline

Member Data Documentation

◆ c_E

int pops::PotentialForce::c_E = 3

◆ c_mx

int pops::PotentialForce::c_mx = 1

◆ c_my

int pops::PotentialForce::c_my = 2

◆ c_rho

int pops::PotentialForce::c_rho = 0

◆ qom

Real pops::PotentialForce::qom = 1

The documentation for this struct was generated from the following file: