ORB5X 1.0.0
Performance-portable global electromagnetic gyrokinetic PIC code
orb5x::MatrixCoeff Class Reference

Evaluate weak-form coefficients for ORB5X field matrices. More...

#include "matrix_coeff.hpp"

Static Public Member Functions

static void calc_coefs (Real x, Real y, int matnum, bool nl_boundary, int nterms, std::vector< Complex > &c_j, std::vector< std::array< int, 2 > > &kdert, std::vector< std::array< int, 2 > > &kderw)
 Dispatch coefficient evaluation from a MATS matrix identifier.
 
static void coefeq1d (int kmat, int krterms, Real ps, std::vector< Real > &pcoef, std::vector< int > &kderw, std::vector< int > &kdert)
 Evaluate radial coefficients for auxiliary one-dimensional matrices.
 
static void coefeq_adi_charge (int krterms, Real ps, Real pchi, std::vector< Real > &pcoef, std::vector< std::array< int, 2 > > &kderw, std::vector< std::array< int, 2 > > &kdert)
 Evaluate the adiabatic-electron charge-response mass term.
 
static void coefeq_adi_curr (int krterms, Real ps, Real pchi, std::vector< Real > &pcoef, std::vector< std::array< int, 2 > > &kderw, std::vector< std::array< int, 2 > > &kdert)
 Evaluate the adiabatic-electron parallel-current mass term.
 
static void coefeq_amp (int krterms, Real ps, Real pchi, std::vector< Real > &pcoef, std::vector< std::array< int, 2 > > &kderw, std::vector< std::array< int, 2 > > &kdert)
 Evaluate skin/mass and perpendicular-Laplacian Ampere terms.
 
static void coefeq_lapl (bool nl_boundary, int krterms, Real ps, Real pchi, std::vector< Real > &pcoef, std::vector< std::array< int, 2 > > &kderw, std::vector< std::array< int, 2 > > &kdert)
 Evaluate metric coefficients of the perpendicular Laplacian.
 
static void coefeq_mass (int krterms, Real ps, Real pchi, std::vector< Real > &pcoef, std::vector< std::array< int, 2 > > &kderw, std::vector< std::array< int, 2 > > &kdert)
 Evaluate the Jacobian-weighted scalar mass term.
 
static void coefeq_ohm (int kmat, int krterms, Real ps, Real pchi, std::vector< Real > &pcoef, std::vector< std::array< int, 2 > > &kderw, std::vector< std::array< int, 2 > > &kdert)
 Evaluate Ohm, continuity, pressure, or Ampere-mass coupling terms.
 
static void coefeq_qn (int kmat, int krterms, Real ps, Real pchi, std::vector< Real > &pcoef, std::vector< std::array< int, 2 > > &kderw, std::vector< std::array< int, 2 > > &kdert)
 Evaluate adiabatic-response and polarization-density terms.
 
static void coefeq_test (int kmat, int krterms, std::vector< Real > &pcoef, std::vector< std::array< int, 2 > > &kderw, std::vector< std::array< int, 2 > > &kdert)
 Construct unit-coefficient derivative operators for solver tests.
 

Detailed Description

Evaluate weak-form coefficients for ORB5X field matrices.

At one flux-coordinate quadrature point (s,chi), this class returns scalar coefficients together with derivative orders for the trial and test basis. Each 2-D derivative pair is {d/ds order, d/dchi order}. Coefficients include the equilibrium Jacobian and the normalized metric/profile factors required by quasineutrality, Ampere, Laplacian, and electron-fluid equations. Matrix assembly and Fourier d/dphi factors are handled by the solver.

The implementation caches process-local species scratch arrays and therefore relies on initialized global basic, species, equilibrium, field, and solver state. It is not designed for concurrent calls that share those caches.

Member Function Documentation

◆ calc_coefs()

static void orb5x::MatrixCoeff::calc_coefs ( Real  x,
Real  y,
int  matnum,
bool  nl_boundary,
int  nterms,
std::vector< Complex > &  c_j,
std::vector< std::array< int, 2 > > &  kdert,
std::vector< std::array< int, 2 > > &  kderw 
)
static

Dispatch coefficient evaluation from a MATS matrix identifier.

Parameters
[in]xNormalized radial coordinate s.
[in]yStraight-field-line poloidal angle chi [rad].
[in]matnumMatrix identifier stored in the global MATS registry.
[in]nl_boundarySelect the integrated boundary form where supported.
[in]ntermsNumber of weak-form terms allocated by the matrix definition.
[out]c_jComplex coefficients of length nterms; current physical coefficient routines return zero imaginary parts.
[out]kdertTrial-basis derivative orders [term]{ds,dchi}.
[out]kderwTest/weight-basis derivative orders [term]{ds,dchi}.

◆ coefeq1d()

static void orb5x::MatrixCoeff::coefeq1d ( int  kmat,
int  krterms,
Real  ps,
std::vector< Real > &  pcoef,
std::vector< int > &  kderw,
std::vector< int > &  kdert 
)
static

Evaluate radial coefficients for auxiliary one-dimensional matrices.

Parameters
[in]kmat1 for the sigma-weighted mass form or 3 for mass plus a weak regularizing derivative term.
[in]krtermsOutput term count.
[in]psNon-negative normalized squared-radial coordinate used by func_sigma(sqrt(ps)).
[out]pcoefRadial coefficients.
[out]kderwTest-function radial derivative orders.
[out]kdertTrial-function radial derivative orders.

◆ coefeq_adi_charge()

static void orb5x::MatrixCoeff::coefeq_adi_charge ( int  krterms,
Real  ps,
Real  pchi,
std::vector< Real > &  pcoef,
std::vector< std::array< int, 2 > > &  kderw,
std::vector< std::array< int, 2 > > &  kdert 
)
static

Evaluate the adiabatic-electron charge-response mass term.

Parameters
[in]krtermsOutput term count.
[in]psNormalized radial coordinate s.
[in]pchiPoloidal angle chi [rad].
[out]pcoefCoefficient, zero when no qualifying electron exists.
[out]kderwTest-basis derivative orders.
[out]kdertTrial-basis derivative orders.

◆ coefeq_adi_curr()

static void orb5x::MatrixCoeff::coefeq_adi_curr ( int  krterms,
Real  ps,
Real  pchi,
std::vector< Real > &  pcoef,
std::vector< std::array< int, 2 > > &  kderw,
std::vector< std::array< int, 2 > > &  kdert 
)
static

Evaluate the adiabatic-electron parallel-current mass term.

Parameters
[in]krtermsOutput term count.
[in]psNormalized radial coordinate s.
[in]pchiPoloidal angle chi [rad].
[out]pcoefSkin-normalized q^2 n/m coefficient times Jacobian.
[out]kderwTest-basis derivative orders.
[out]kdertTrial-basis derivative orders.

◆ coefeq_amp()

static void orb5x::MatrixCoeff::coefeq_amp ( int  krterms,
Real  ps,
Real  pchi,
std::vector< Real > &  pcoef,
std::vector< std::array< int, 2 > > &  kderw,
std::vector< std::array< int, 2 > > &  kdert 
)
static

Evaluate skin/mass and perpendicular-Laplacian Ampere terms.

Parameters
[in]krtermsOutput term count (mass followed by four metric terms).
[in]psNormalized radial coordinate s.
[in]pchiPoloidal angle chi [rad].
[out]pcoefSpecies-profile and metric coefficients.
[out]kderwTest-basis derivative orders.
[out]kdertTrial-basis derivative orders.

◆ coefeq_lapl()

static void orb5x::MatrixCoeff::coefeq_lapl ( bool  nl_boundary,
int  krterms,
Real  ps,
Real  pchi,
std::vector< Real > &  pcoef,
std::vector< std::array< int, 2 > > &  kderw,
std::vector< std::array< int, 2 > > &  kdert 
)
static

Evaluate metric coefficients of the perpendicular Laplacian.

Parameters
[in]nl_boundaryFalse for the four gradient-gradient volume terms; true for the two boundary-flux terms.
[in]krtermsOutput term count required by the selected form.
[in]psNormalized radial coordinate s.
[in]pchiPoloidal angle chi [rad].
[out]pcoefJacobian- and beta-scaled coefficients.
[out]kderwTest-basis derivative orders.
[out]kdertTrial-basis derivative orders.

◆ coefeq_mass()

static void orb5x::MatrixCoeff::coefeq_mass ( int  krterms,
Real  ps,
Real  pchi,
std::vector< Real > &  pcoef,
std::vector< std::array< int, 2 > > &  kderw,
std::vector< std::array< int, 2 > > &  kdert 
)
static

Evaluate the Jacobian-weighted scalar mass term.

Parameters
[in]krtermsOutput term count (normally one).
[in]psNormalized radial coordinate s.
[in]pchiPoloidal angle chi [rad].
[out]pcoefReal coefficients.
[out]kderwTest-basis derivative orders.
[out]kdertTrial-basis derivative orders.

◆ coefeq_ohm()

static void orb5x::MatrixCoeff::coefeq_ohm ( int  kmat,
int  krterms,
Real  ps,
Real  pchi,
std::vector< Real > &  pcoef,
std::vector< std::array< int, 2 > > &  kderw,
std::vector< std::array< int, 2 > > &  kdert 
)
static

Evaluate Ohm, continuity, pressure, or Ampere-mass coupling terms.

Parameters
[in]kmatSub-operator: 1–2 Ohm, 3–10 continuity, 11–12 pressure, and 13 Ampere mass.
[in]krtermsOutput term count for that sub-operator.
[in]psNormalized radial coordinate s.
[in]pchiPoloidal angle chi [rad].
[out]pcoefJacobian-weighted coefficients.
[out]kderwTest-basis derivative orders.
[out]kdertTrial-basis derivative orders.

◆ coefeq_qn()

static void orb5x::MatrixCoeff::coefeq_qn ( int  kmat,
int  krterms,
Real  ps,
Real  pchi,
std::vector< Real > &  pcoef,
std::vector< std::array< int, 2 > > &  kderw,
std::vector< std::array< int, 2 > > &  kdert 
)
static

Evaluate adiabatic-response and polarization-density terms.

Parameters
[in]kmat2 includes the Boltzmann/adiabatic mass response; 3 retains only polarization terms.
[in]krtermsOutput term count (mass plus four metric terms).
[in]psNormalized radial coordinate s.
[in]pchiPoloidal angle chi [rad].
[out]pcoefJacobian-weighted normalized coefficients.
[out]kderwTest-basis derivative orders.
[out]kdertTrial-basis derivative orders.

◆ coefeq_test()

static void orb5x::MatrixCoeff::coefeq_test ( int  kmat,
int  krterms,
std::vector< Real > &  pcoef,
std::vector< std::array< int, 2 > > &  kderw,
std::vector< std::array< int, 2 > > &  kdert 
)
static

Construct unit-coefficient derivative operators for solver tests.

Parameters
[in]kmat1 ds, 2 dchi, 3 dphi placeholder, 4 ds-ds, or 5 dchi-dchi.
[in]krtermsOutput term count.
[out]pcoefUnit/zero coefficients.
[out]kderwTest-basis derivative orders.
[out]kdertTrial-basis derivative orders.

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