Aux Struct ReferenceΒΆ

adc_cpp: pops::Aux 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

POINTWISE auxiliary fields shared with the physics: single coupling channel. More...

#include <state.hpp>

+ Collaboration diagram for pops::Aux:

Public Member Functions

POPS_HD Real extra_field (int k) const
 BOUNDED read of a named aux field (component kAuxNamedBase + k).
 

Public Attributes

Real phi {}
 
Real grad_x {}
 
Real grad_y {}
 
Real extra [kAuxMaxExtra] {}
 

Detailed Description

POINTWISE auxiliary fields shared with the physics: single coupling channel.

Role: carry to the point the outputs of the elliptic solver and the fields provided by the system, which the physics consumes BOTH in the flux (drift transport: E x B velocity = grad phi) and in the source (self-gravitating fluid: S = -rho grad phi).

Usage: a PhysicalModel reads phi/grad_x/grad_y (BASE contract, components 0..2, always present). The canonical EXTRA fields (B_z = comp 3, T_e = comp 4) and the fields NAMED by the model (extra[k] <-> component kAuxNamedBase + k) are loaded ONLY if the model declares a static member n_aux large enough; a model without n_aux stays strictly bit-identical. Read a named field via extra_field(k) (bounded read, returns 0 out of bounds).

Contract: trivially copyable POD, device-clean (raw C array, no allocation); the layout of the EXTRA fields is generated from the X-macro POPS_AUX_FIELDS (single source).

Invariants:

  • all fields beyond the base contract default to 0 (load_aux overwrites them only on the model's request);
  • the indices must stay in sync with AUX_CANONICAL / AUX_NAMED_BASE on the DSL side (python/pops/dsl.py): inherent duplication, Python does not read C++ headers;
  • kAuxMaxExtra bounds the number of named fields to keep the POD at fixed size.

Member Function Documentation

◆ extra_field()

POPS_HD Real pops::Aux::extra_field ( int  k) const
inline

BOUNDED read of a named aux field (component kAuxNamedBase + k).

Returns 0 out of bounds: the generated brick never calls extra_field with a k that the model did not declare, but the guard makes the access safe (still device-clean, no dynamic branch on a k known at codegen).

Member Data Documentation

◆ extra

Real pops::Aux::extra[kAuxMaxExtra] {}

◆ grad_x

Real pops::Aux::grad_x {}

◆ grad_y

Real pops::Aux::grad_y {}

◆ phi

Real pops::Aux::phi {}

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