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

Wrapper for profile and geometry functions used by solver. More...

#include "profiles_wrapper.hpp"

Static Public Member Functions

static Real getB0 (Real s, Real chi)
 Evaluate the equilibrium magnetic-field magnitude.
 
static void getGeometry (Real s, Real chi, Real &jac, Real &g11, Real &g12, Real &g21, Real &g22, Real &B0)
 Evaluate the geometry coefficients consumed by matrix assembly.
 
static void getGeometry_cylinder (Real x, Real R, Real a, Real &jac, Real &g11, Real &g12, Real &g21, Real &g22, Real &B0, Real &Bz)
 Evaluate cylindrical geometry with the configured \(q(r)\) profile.
 
static void getGeometry_straightcylinder (Real x, Real &jac, Real &g11, Real &g12, Real &g21, Real &g22, Real &B0, Real &Bz)
 Evaluate the straight-cylinder test geometry.
 
static Real getJacobian (Real s, Real chi)
 Evaluate the equilibrium-coordinate Jacobian.
 
static Real getJacobianDerivative (Real s, Real chi)
 Evaluate the radial derivative of the coordinate Jacobian.
 
static void getProfileGradients (Real s, int isp, Real &dTj0ds, Real &dNj0ds)
 Get profile gradients dT/ds and dN/ds (Fortran: getProfileGradients)
 
static void getProfiles (Real s, Real chi, int isp, Real &Tj0, Real &Nj0)
 Get temperature and density profiles (Fortran: getProfiles)
 
static void getProfiles_constant (Real &Tj0, Real &Nj0)
 Return the constant-profile test model.
 
static Real getSafetyFactor (Real s)
 Evaluate the dimensionless magnetic safety factor.
 
static void getSpecies (int isp, Real &qj, Real &mj)
 Get species charge and mass (Fortran: getSpecies)
 
static void initSafetyFactor (const std::array< Real, 5 > &qsc_)
 Set the five coefficients of the cylindrical safety-factor polynomial.
 
static Real safetyFactor (Real x, Real a)
 Evaluate the cylindrical safety-factor polynomial.
 

Detailed Description

Wrapper for profile and geometry functions used by solver.

Provides interface to equilibrium and species data. C++ port of Fortran module profilesWrapper (profilesWrapper.F90).

Species indexing convention: All public functions take isp as a 1-based species index, matching the Fortran calling convention (isp = 1 for first species). Internally, isp is passed unchanged to Equil functions (which also expect 1-based), and converted to 0-based isp0 = isp - 1 once at function entry for C++ container access (std::vector, Kokkos::View).

Member Function Documentation

◆ getB0()

static Real orb5x::ProfilesWrapper::getB0 ( Real  s,
Real  chi 
)
static

Evaluate the equilibrium magnetic-field magnitude.

Parameters
[in]sNormalized radial coordinate.
[in]chiStraight-field-line poloidal angle, in radians.
Returns
\(|B_0|\) in ORB5X normalized magnetic-field units.
Fortran reference profilesWrapper.F90: getB0; equil.F90: equil_absb.

◆ getGeometry()

static void orb5x::ProfilesWrapper::getGeometry ( Real  s,
Real  chi,
Real &  jac,
Real &  g11,
Real &  g12,
Real &  g21,
Real &  g22,
Real &  B0 
)
static

Evaluate the geometry coefficients consumed by matrix assembly.

Parameters
[in]sNormalized radial coordinate.
[in]chiStraight-field-line poloidal angle, in radians.
[out]jacEquilibrium-coordinate Jacobian in solver normalization.
[out]g11Contravariant radial-radial metric coefficient.
[out]g12Contravariant radial-poloidal metric coefficient.
[out]g21Contravariant poloidal-radial metric coefficient.
[out]g22Contravariant poloidal-poloidal metric coefficient.
[out]B0Magnetic-field magnitude in normalized units.
Fortran reference profilesWrapper.F90: getGeometry and getGeometry_ORB5.

◆ getGeometry_cylinder()

static void orb5x::ProfilesWrapper::getGeometry_cylinder ( Real  x,
Real  R,
Real  a,
Real &  jac,
Real &  g11,
Real &  g12,
Real &  g21,
Real &  g22,
Real &  B0,
Real &  Bz 
)
static

Evaluate cylindrical geometry with the configured \(q(r)\) profile.

Parameters
[in]xCylinder radial coordinate, in the same length units as R and a.
[in]RMajor radius used by the cylindrical model.
[in]aReference minor radius used to normalize x.
[out]jacCoordinate Jacobian.
[out]g11Radial-radial contravariant metric coefficient.
[out]g12Radial-poloidal contravariant metric coefficient.
[out]g21Poloidal-radial contravariant metric coefficient.
[out]g22Poloidal-poloidal contravariant metric coefficient.
[out]B0Total magnetic-field magnitude in normalized units.
[out]BzAxial magnetic-field component in normalized units.
Fortran reference profilesWrapper.F90: getGeometry_cylinder.

◆ getGeometry_straightcylinder()

static void orb5x::ProfilesWrapper::getGeometry_straightcylinder ( Real  x,
Real &  jac,
Real &  g11,
Real &  g12,
Real &  g21,
Real &  g22,
Real &  B0,
Real &  Bz 
)
static

Evaluate the straight-cylinder test geometry.

Parameters
[in]xCylinder radial coordinate in the model's normalized units.
[out]jacCoordinate Jacobian.
[out]g11Radial-radial contravariant metric coefficient.
[out]g12Radial-poloidal contravariant metric coefficient.
[out]g21Poloidal-radial contravariant metric coefficient.
[out]g22Poloidal-poloidal contravariant metric coefficient.
[out]B0Total magnetic-field magnitude in normalized units.
[out]BzAxial magnetic-field component in normalized units.
Fortran reference profilesWrapper.F90: getGeometry_straightcylinder.

◆ getJacobian()

static Real orb5x::ProfilesWrapper::getJacobian ( Real  s,
Real  chi 
)
static

Evaluate the equilibrium-coordinate Jacobian.

Parameters
[in]sNormalized radial coordinate.
[in]chiStraight-field-line poloidal angle, in radians.
Returns
Coordinate Jacobian in the normalization used by the field solver.
Fortran reference profilesWrapper.F90: getJacobian; equil.F90: jacob.

◆ getJacobianDerivative()

static Real orb5x::ProfilesWrapper::getJacobianDerivative ( Real  s,
Real  chi 
)
static

Evaluate the radial derivative of the coordinate Jacobian.

Parameters
[in]sNormalized radial coordinate.
[in]chiStraight-field-line poloidal angle, in radians.
Returns
\(\partial J/\partial s\) in solver-normalized units.
Fortran reference profilesWrapper.F90: getJacobianDerivative;
equil.F90: jacobDerivative.

◆ getProfileGradients()

static void orb5x::ProfilesWrapper::getProfileGradients ( Real  s,
int  isp,
Real &  dTj0ds,
Real &  dNj0ds 
)
static

Get profile gradients dT/ds and dN/ds (Fortran: getProfileGradients)

Parameters
sNormalized radial coordinate.
ispSpecies index (1-based, Fortran convention)
[out]dTj0dsRadial temperature derivative.
[out]dNj0dsRadial density derivative.

◆ getProfiles()

static void orb5x::ProfilesWrapper::getProfiles ( Real  s,
Real  chi,
int  isp,
Real &  Tj0,
Real &  Nj0 
)
static

Get temperature and density profiles (Fortran: getProfiles)

Parameters
sNormalized radial coordinate.
chiStraight-field-line poloidal angle in radians.
ispSpecies index (1-based, Fortran convention)
[out]Tj0Equilibrium temperature in normalized units.
[out]Nj0Equilibrium number density in normalized units.

◆ getProfiles_constant()

static void orb5x::ProfilesWrapper::getProfiles_constant ( Real &  Tj0,
Real &  Nj0 
)
static

Return the constant-profile test model.

Parameters
[out]Tj0Unit normalized temperature.
[out]Nj0Unit normalized density.

◆ getSafetyFactor()

static Real orb5x::ProfilesWrapper::getSafetyFactor ( Real  s)
static

Evaluate the dimensionless magnetic safety factor.

Parameters
[in]sNormalized radial coordinate.
Returns
Safety factor \(q(s)\).
Fortran reference profilesWrapper.F90: getSafetyFactor; equil.F90: qchi.

◆ getSpecies()

static void orb5x::ProfilesWrapper::getSpecies ( int  isp,
Real &  qj,
Real &  mj 
)
static

Get species charge and mass (Fortran: getSpecies)

Parameters
ispSpecies index (1-based, Fortran convention)
[out]qjSpecies charge in ORB5X normalized units.
[out]mjSpecies mass in ORB5X normalized units.

◆ initSafetyFactor()

static void orb5x::ProfilesWrapper::initSafetyFactor ( const std::array< Real, 5 > &  qsc_)
static

Set the five coefficients of the cylindrical safety-factor polynomial.

Parameters
[in]qsc_Coefficients in increasing polynomial order.
Fortran reference profilesWrapper.F90: initSafetyFactor.

◆ safetyFactor()

static Real orb5x::ProfilesWrapper::safetyFactor ( Real  x,
Real  a 
)
static

Evaluate the cylindrical safety-factor polynomial.

Parameters
[in]xMinor-radius coordinate, in the same length units as a.
[in]aReference minor radius.
Returns
Dimensionless safety factor at normalized radius x/a.
Fortran reference profilesWrapper.F90: safetyFactor.

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