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

Owns the axisymmetric magnetic equilibrium, flux coordinates, and species background profiles used throughout ORB5X. More...

#include "equil.hpp"

Classes

struct  DeviceState
 Shallow, device-copyable handle to equilibrium interpolation data. More...
 

Static Public Member Functions

static void back_vel_diff (Real sigmat, Real chi, Real &due2dsigma, Real &due2dchi)
 Evaluate derivatives of squared background speed.
 
static void back_vel_mod (Real sigmat, Real chi, Real &vexb2)
 Evaluate squared background \(E\times B\) speed.
 
static void back_vel_tor (Real sigmat, Real chi, Real &ue_phi)
 Evaluate the toroidal component of background flow.
 
static void bderivs (Real s, Real chi, Real &dBds, Real &dBdchi, Real &absb)
 Evaluate derivatives and magnitude of the equilibrium field.
 
static Real calc_ftrap (Real s, Real theta, int itrap)
 Calculate local or flux-surface-averaged trapped-particle fraction.
 
static void compute_bin_vol_3d (Real stmin, Real zds, int stbin, Real chitmin, Real zdchi, int chitbin, Real zdphi)
 Integrate volumes for a uniform diagnostic \((s,\chi,\varphi)\) mesh.
 
static void compute_geometry ()
 Integrate Jacobians and construct volume, surface, and diagnostic-bin measures.
 
static void compute_profiles ()
 Construct density, temperature, flow, and safety-factor profiles on the internal grids.
 
static void create_equil ()
 Allocate and initialize all equilibrium, profile, and geometry data.
 
static void curl_ue (Real sigmat, Real chi, Real &X, Real &Y, Real &Z)
 Evaluate cylindrical components of the curl of background flow.
 
static Real den (Real s, int isp)
 Evaluate the normalized loading density.
 
static void dump_equil ()
 Write equilibrium arrays, profiles, coordinates, and scalars to the configured HDF5 output.
 
static Real equil_absb (Real s, Real chi)
 Evaluate normalized magnetic-field magnitude.
 
static Real equil_addpBst (Real s, Real chi)
 Evaluate the correction entering guiding-centre \(B_\parallel^*\).
 
static void equil_backfields (Real s, Real chi, Real &pot, Real &es, Real &echi)
 Interpolate background potential and electric-field components.
 
static void equil_backfields1d (Real psi, Real &pot, Real &epsi)
 Interpolate flux-function background potential and radial field.
 
static Real equil_brotb (Real s, Real chi)
 Evaluate \(\beta\,\mathbf b\cdot\nabla\times\mathbf B/B\).
 
static void equil_coef_sc (Real s, Real chi, Real &zr, Real &zpsidr, Real &zpsidz, Real &zB, Real &zhchi, Real &zhphi, std::vector< Real > &zgrB, Real &addpchi, Real &addpphi, Real &brotb, Real &divh, std::vector< Real > &grads, std::vector< Real > &gradchi)
 Gather the complete interpolated equilibrium coefficient set at \((s,\chi)\).
 
static Real equil_dmaxb (Real st)
 Interpolate \(dB_{\max}/ds\) on a surface.
 
static Real equil_hchi (Real s, Real chi)
 Evaluate the poloidal contravariant component of \(\mathbf h=\mathbf B/B\).
 
static Real equil_maxb (Real st)
 Interpolate the maximum normalized \(|B|\) on a surface.
 
static void equil_move_sc (Real s, Real chi, Real &r, Real &tprime, Real &B, std::vector< Real > &bgrb, Real &divh, std::vector< Real > &h, Real &addpBst, std::vector< Real > &addp, std::vector< Real > &exh, Real &toB, Real &addvpa)
 Gather geometry and magnetic coefficients used by the particle pusher.
 
static void equil_move_strong (Real s, Real chi, Real &due2dsigma, Real &due2dchi, Real &dBdsigma, Real &dBdchi)
 Gather speed and magnetic-field derivatives for the strong-flow pusher.
 
static void equil_perp_vec (Real s, Real chi, Real &hy, Real &hz, Real &grsigma2, Real &grchi2, Real &grsigmagrchi, Real &J_s, Real &r)
 Evaluate strong-flow basis vectors and metric contractions.
 
static void equil_strong_vdr (Real sigmat, Real chi, Real &duphidpsi, Real &duphidchi)
 Evaluate derivatives of toroidal background flow.
 
static Real equil_toB (Real s, Real chi)
 Evaluate \(R B_\varphi/B\).
 
static Real equil_tprime (Real s, Real chi)
 Evaluate the equilibrium \(T'(\psi)/B\) coefficient.
 
static Real equil_ubulk (Real s_val, int isp)
 Interpolate normalized background parallel flow.
 
static Real func_b_pszs (Real ss)
 Interpolate the PSZS flux-surface average of \(B\).
 
static Real func_sigma (Real ss)
 Evaluate the flux-surface-averaged Jacobian factor \(\sigma(s)\).
 
static Real func_sigmab (Real ss)
 Interpolate the PSZS surface-average factor \(\sigma_B\).
 
static Real func_sigmatprimeob (Real ss)
 Interpolate the PSZS \(\sigma T'/B\) surface-average factor.
 
static Real func_torpsi (Real ss)
 Evaluate the normalized toroidal-flux function.
 
static Real func_tprimeob_pszs (Real ss)
 Interpolate the PSZS flux-surface average of \(T'/B\).
 
static const std::vector< Real > * get_alphain ()
 Return current interpolation weights for asymmetric-boundary re-entry.
 
static const std::vector< Real > * get_alphain0 ()
 Return previous interpolation weights for asymmetric-boundary re-entry.
 
static const std::vector< Real > * get_bin_surf ()
 Return diagnostic radial-bin surface measures, including guard bins.
 
static const std::vector< Real > * get_bin_vol ()
 Return radial diagnostic-bin volumes, including guard bins.
 
static const std::vector< std::vector< Real > > * get_bin_vol_2d ()
 Return flux/poloidal diagnostic-bin volumes, including radial guards.
 
static const std::vector< std::vector< Real > > * get_bin_vol_3d ()
 Return \((s,\chi)\) bin volumes used for volume-weighted 3-D moments.
 
static const std::vector< std::vector< Real > > * get_bin_vol_3d_inv ()
 Return inverse \((s,\chi)\) bin volumes used to normalize 3-D moments.
 
static Real get_c_psi0corr ()
 Return the prefactor used to normalize the strong-flow potential correction.
 
static Real get_chi (Real s, Real theta)
 Convert geometric to equilibrium poloidal angle.
 
static std::vector< Real > get_comp (Real s, Real chi)
 Return meridional components of \(\nabla\psi/|\nabla\psi|\).
 
static Kokkos::View< Real * > get_den0_norm ()
 Return the reference normalized-density table used by field equations.
 
static Real get_density (Real s, int isp=1)
 Evaluate normalized species density at \(s=\sqrt{\psi}\).
 
static DeviceState get_device_state ()
 Return shallow device handles and scalar metadata for Kokkos kernels.
 
static Real get_ds_inv ()
 Return inverse spacing of the uniform equilibrium \(s\) grid.
 
static void get_FdFds (Real s, Real &F, Real &dFds)
 Evaluate toroidal-field function \(F\) and its derivative.
 
static Real get_fpsin ()
 Return the edge value of the normalized toroidal-flux function.
 
static Real get_func_alphab_fsa (Real ss)
 Return the flux-surface-averaged trapped-particle fraction.
 
static void get_gradients (Real s, Real chi, std::vector< Real > &grads, std::vector< Real > &gradchi, Real &gradphi)
 Evaluate the field-coordinate gradient basis at \((s,\chi)\).
 
static const std::vector< int > * get_jchiin ()
 Return current-cell indices for asymmetric-boundary particle re-entry.
 
static const std::vector< int > * get_jchiin0 ()
 Return previous-cell indices for asymmetric-boundary particle re-entry.
 
static void get_larm_coeff (Real s, Real chi, Real &larmsc, Real &larmchic, Real &larmchis)
 Evaluate scalar gyro-displacement coefficients at a guiding centre.
 
static void get_larm_coeffn (Real s, Real chi, Kokkos::View< Real * > &larmsc, Kokkos::View< Real * > &larmchic, Kokkos::View< Real * > &larmchis)
 Fill device Views with gyro-displacement coefficients and derivatives.
 
static void get_larm_coeffn_scalar (Real s, Real chi, std::array< Real, 3 > &larmsc, std::array< Real, 3 > &larmchic, std::array< Real, 3 > &larmchis)
 Evaluate gyro-displacement coefficients and first derivatives.
 
static Real get_magnetic_field (Real s, Real chi=0.0)
 Evaluate normalized \(|B|\) at \((s,\chi)\).
 
static int get_ngmax ()
 Return the highest valid index of the equilibrium radial grid.
 
static int get_profile_grid_type (int isp)
 Return the profile-grid selector for a species.
 
static Real get_psi_of_r (Real rho)
 Interpolate normalized poloidal flux at normalized minor radius.
 
static Real get_psihe_grd (int idx)
 Read one helical-flux grid entry.
 
static int get_psihe_grd_size ()
 Return the number of helical-flux grid entries.
 
static Real get_psihes ()
 Return helical flux at the island separatrix.
 
static Real get_psires ()
 Return normalized flux at the island resonant surface.
 
static void get_qmin (Real &sqmin, Real &qmin)
 Locate the minimum of the safety-factor profile.
 
static void get_rz (Real s, Real chi, Real &r, Real &z)
 Convert flux coordinates to cylindrical meridional coordinates.
 
static Real get_safety_factor (Real s)
 Evaluate the dimensionless safety factor \(q(s)\).
 
static const Kokkos::View< Real * > * get_sgrid_eq ()
 Return the equilibrium radial grid in \(s\).
 
static const Kokkos::View< Real ** > * get_sigmas ()
 Return the table of equilibrium flux-surface averages used by PSZS.
 
static Kokkos::View< Real * > get_skin_norm ()
 Return the normalized electron-skin-depth table used by electromagnetic solvers.
 
static Real get_temperature (Real s, int isp=1)
 Evaluate normalized species temperature at \(s=\sqrt{\psi}\).
 
static Real get_theta (Real s, Real chi)
 Convert equilibrium poloidal coordinate to geometric angle.
 
static Kokkos::View< Real * > get_vol_coord ()
 Return the cumulative normalized volume coordinate on the equilibrium radial grid.
 
static Real get_voldiag (int isp)
 Return the sampled diagnostic volume for a species.
 
static Real get_width_is ()
 Return the island half-width.
 
static Real get_zdpsi_0 ()
 Return the uniform normalized-flux spacing used by profile tables.
 
static int get_znin ()
 Return the number of inner-region island radial bins.
 
static int get_znisl ()
 Return the number of island-region radial bins.
 
static int get_znout ()
 Return the number of outer-region island radial bins.
 
static Real getdens_corr (Real psit)
 Evaluate the multiplicative strong-flow density correction.
 
static Real getdn_corr (Real psit)
 Evaluate the flux derivative of the strong-flow density correction.
 
static void init_dens_profile_public (int worktype, int isp, std::vector< Real > *zf_av=nullptr, std::vector< Real > *z_den=nullptr)
 Dispatch density-profile preparation for control and restart paths.
 
static void init_equil ()
 Read the selected equilibrium and prepare coordinate interpolation tables.
 
static Real jacob (Real s, Real chi)
 Evaluate the field-coordinate Jacobian.
 
static Real jacob_tsp (Real s, Real chi)
 Evaluate \(J_{\theta s\varphi}\).
 
static Real jacobDerivative (Real s, Real chi)
 Evaluate \(\partial J/\partial s\).
 
static void load_equil (const std::string &fname)
 Load equilibrium data from fname.
 
static void load_profiles (const std::string &prof_file)
 Load species profiles into internal interpolation tables.
 
static void normalize_profiles ()
 Convert loaded density, temperature, and flow profiles to simulation normalization.
 
static bool prepare_profiles_host_cache ()
 Mirror profile views into a host cache for host-only call paths.
 
static void profiles (int isp, Real psi, Real &tval, Real &tgrad, Real &nval, Real &ngrad, Real &vpval, Real &vpgrad)
 Interpolate all background profiles at normalized poloidal flux psi.
 
static void profiles_host_cached (int isp, Real psi, Real &tval, Real &tgrad, Real &nval, Real &ngrad, Real &vpval, Real &vpgrad)
 Host-cache equivalent of profiles(); the cache must first be prepared.
 
static void profiles_sh (int isp, Real psi, Real &nishval)
 Interpolate normalized shielding density.
 
static void qchi (Real radvar, Real &qout, const std::string &strsel="")
 Evaluate safety factor on either the \(s\) or normalized-radius grid.
 
static void s2rad (Real ps, Real &prad, Real &pdrds)
 Convert \(s\) to normalized minor radius and its derivative.
 
static Real s_of_q (Real zq)
 Invert a monotonic safety-factor profile.
 
static void xy2sc (Real x, Real y, Real &s, Real &chi)
 Convert cylindrical meridional coordinates \((R,Z)\) to \((s,\chi)\).
 

Static Public Attributes

static Real b_norm
 Magnetic-field normalization used by equilibrium tables.
 
static Real Bmax_c
 Global upper bound of normalized magnetic-field magnitude.
 
static Real Bmin_c
 Global lower bound of normalized magnetic-field magnitude.
 
static Real d_norm
 Length/metric normalization used by equilibrium tables.
 
static Real FonBmax_c
 Maximum of the normalized toroidal-field ratio used for binning.
 
static Real FonBmin_c
 Minimum of the normalized toroidal-field ratio used for binning.
 
static Real psi0
 Normalized poloidal flux at the computational edge.
 

Detailed Description

Owns the axisymmetric magnetic equilibrium, flux coordinates, and species background profiles used throughout ORB5X.

Equil converts between cylindrical geometry and the field-aligned coordinates \((s,\chi,\varphi)\), where \(s=\sqrt{\psi}\) and \(\psi\) is normalized poloidal flux. It also supplies metric and magnetic-field quantities to particle pushers, normalized density/temperature/flow profiles to loading and field solvers, and flux-bin measures to diagnostics. The class is a namespace-like singleton: initialization populates static host and Kokkos-resident tables before any evaluation routine is called. Unless stated otherwise, returned physical quantities use ORB5X normalized units, radial coordinates are dimensionless, and angles are in radians.

Fortran reference
equil.F90, module equil_mod; routine names are retained where practical.

Member Function Documentation

◆ back_vel_diff()

static void orb5x::Equil::back_vel_diff ( Real  sigmat,
Real  chi,
Real &  due2dsigma,
Real &  due2dchi 
)
static

Evaluate derivatives of squared background speed.

Parameters
[in]sigmatStrong-flow radial coordinate.
[in]chiPoloidal angle, in radians.
[out]due2dsigmaRadial derivative of squared normalized speed.
[out]due2dchiPoloidal derivative of squared normalized speed, per radian.

◆ back_vel_mod()

static void orb5x::Equil::back_vel_mod ( Real  sigmat,
Real  chi,
Real &  vexb2 
)
static

Evaluate squared background \(E\times B\) speed.

Parameters
[in]sigmatStrong-flow radial coordinate.
[in]chiPoloidal angle, in radians.
[out]vexb2Squared drift speed in normalized velocity units squared.

◆ back_vel_tor()

static void orb5x::Equil::back_vel_tor ( Real  sigmat,
Real  chi,
Real &  ue_phi 
)
static

Evaluate the toroidal component of background flow.

Parameters
[in]sigmatStrong-flow radial coordinate.
[in]chiPoloidal angle, in radians.
[out]ue_phiToroidal flow in normalized velocity units.

◆ bderivs()

static void orb5x::Equil::bderivs ( Real  s,
Real  chi,
Real &  dBds,
Real &  dBdchi,
Real &  absb 
)
static

Evaluate derivatives and magnitude of the equilibrium field.

Parameters
[in]sNormalized radial coordinate.
[in]chiPoloidal angle, in radians.
[out]dBdsRadial derivative of normalized field magnitude.
[out]dBdchiPoloidal derivative per radian.
[out]absbNormalized magnetic-field magnitude.

◆ calc_ftrap()

static Real orb5x::Equil::calc_ftrap ( Real  s,
Real  theta,
int  itrap 
)
static

Calculate local or flux-surface-averaged trapped-particle fraction.

Parameters
[in]sNormalized flux coordinate.
[in]thetaGeometric poloidal angle [rad].
[in]itrap1 for local and 2 for flux-surface-averaged evaluation.
Returns
Dimensionless trapped-particle fraction.

◆ compute_bin_vol_3d()

static void orb5x::Equil::compute_bin_vol_3d ( Real  stmin,
Real  zds,
int  stbin,
Real  chitmin,
Real  zdchi,
int  chitbin,
Real  zdphi 
)
static

Integrate volumes for a uniform diagnostic \((s,\chi,\varphi)\) mesh.

Parameters
[in]stminLower radial coordinate.
[in]zdsRadial bin width.
[in]stbinNumber of radial bins.
[in]chitminLower poloidal coordinate [rad].
[in]zdchiPoloidal bin width [rad].
[in]chitbinNumber of poloidal bins.
[in]zdphiToroidal bin width [rad].

◆ compute_geometry()

static void orb5x::Equil::compute_geometry ( )
static

Integrate Jacobians and construct volume, surface, and diagnostic-bin measures.

◆ compute_profiles()

static void orb5x::Equil::compute_profiles ( )
static

Construct density, temperature, flow, and safety-factor profiles on the internal grids.

◆ create_equil()

static void orb5x::Equil::create_equil ( )
static

Allocate and initialize all equilibrium, profile, and geometry data.

◆ curl_ue()

static void orb5x::Equil::curl_ue ( Real  sigmat,
Real  chi,
Real &  X,
Real &  Y,
Real &  Z 
)
static

Evaluate cylindrical components of the curl of background flow.

Parameters
[in]sigmatStrong-flow radial coordinate.
[in]chiPoloidal coordinate [rad].
[out]XRadial component.
[out]YVertical component.
[out]ZToroidal component.

◆ den()

static Real orb5x::Equil::den ( Real  s,
int  isp 
)
static

Evaluate the normalized loading density.

Parameters
[in]sNormalized radial coordinate.
[in]ispOne-based species index.
Returns
Loading density in ORB5X normalization.

◆ dump_equil()

static void orb5x::Equil::dump_equil ( )
static

Write equilibrium arrays, profiles, coordinates, and scalars to the configured HDF5 output.

◆ equil_absb()

static Real orb5x::Equil::equil_absb ( Real  s,
Real  chi 
)
static

Evaluate normalized magnetic-field magnitude.

Parameters
[in]sNormalized radial coordinate.
[in]chiPoloidal angle, in radians.
Returns
Local \(|B|\) in normalized magnetic-field units.

◆ equil_addpBst()

static Real orb5x::Equil::equil_addpBst ( Real  s,
Real  chi 
)
static

Evaluate the correction entering guiding-centre \(B_\parallel^*\).

Parameters
[in]sNormalized radial coordinate.
[in]chiPoloidal angle, in radians.
Returns
Dimensionless correction coefficient.

◆ equil_backfields()

static void orb5x::Equil::equil_backfields ( Real  s,
Real  chi,
Real &  pot,
Real &  es,
Real &  echi 
)
static

Interpolate background potential and electric-field components.

Parameters
[in]sNormalized radial coordinate.
[in]chiPoloidal angle, in radians.
[out]potBackground electrostatic potential in normalized units.
[out]esRadial electric-field coefficient.
[out]echiPoloidal electric-field coefficient.

◆ equil_backfields1d()

static void orb5x::Equil::equil_backfields1d ( Real  psi,
Real &  pot,
Real &  epsi 
)
static

Interpolate flux-function background potential and radial field.

Parameters
[in]psiNormalized poloidal flux.
[out]potBackground potential in normalized units.
[out]epsiNegative flux derivative/electric-field coefficient.

◆ equil_brotb()

static Real orb5x::Equil::equil_brotb ( Real  s,
Real  chi 
)
static

Evaluate \(\beta\,\mathbf b\cdot\nabla\times\mathbf B/B\).

Parameters
[in]sNormalized radial coordinate.
[in]chiPoloidal angle, in radians.
Returns
Normalized curl contraction.

◆ equil_coef_sc()

static void orb5x::Equil::equil_coef_sc ( Real  s,
Real  chi,
Real &  zr,
Real &  zpsidr,
Real &  zpsidz,
Real &  zB,
Real &  zhchi,
Real &  zhphi,
std::vector< Real > &  zgrB,
Real &  addpchi,
Real &  addpphi,
Real &  brotb,
Real &  divh,
std::vector< Real > &  grads,
std::vector< Real > &  gradchi 
)
static

Gather the complete interpolated equilibrium coefficient set at \((s,\chi)\).

Outputs contain major radius, poloidal-flux gradients, normalized field magnitude and direction, field gradients/curls, divergence, and coordinate gradients in the same layout used by the time-advance kernels.

Parameters
[in]sNormalized radial coordinate.
[in]chiPoloidal angle, in radians.
[out]zrMajor radius in normalized length units.
[out]zpsidrRadial cylindrical derivative of normalized poloidal flux.
[out]zpsidzVertical cylindrical derivative of normalized poloidal flux.
[out]zBMagnetic-field magnitude in normalized units.
[out]zhchiPoloidal contravariant component of the unit field.
[out]zhphiToroidal contravariant component of the unit field.
[out]zgrBMeridional components of the magnetic-field gradient.
[out]addpchiPoloidal curl/parallel-force coefficient.
[out]addpphiToroidal curl/parallel-force coefficient.
[out]brotbUnit-field curl contraction.
[out]divhDivergence of the magnetic-field unit vector.
[out]gradsMeridional components of \(\nabla s\).
[out]gradchiMeridional components of \(\nabla\chi\).

◆ equil_dmaxb()

static Real orb5x::Equil::equil_dmaxb ( Real  st)
static

Interpolate \(dB_{\max}/ds\) on a surface.

Parameters
[in]stNormalized radial coordinate.
Returns
Radial derivative of the surface-maximum normalized field.

◆ equil_hchi()

static Real orb5x::Equil::equil_hchi ( Real  s,
Real  chi 
)
static

Evaluate the poloidal contravariant component of \(\mathbf h=\mathbf B/B\).

Parameters
[in]sNormalized radial coordinate.
[in]chiPoloidal angle, in radians.
Returns
Normalized poloidal contravariant component.

◆ equil_maxb()

static Real orb5x::Equil::equil_maxb ( Real  st)
static

Interpolate the maximum normalized \(|B|\) on a surface.

Parameters
[in]stNormalized radial coordinate.
Returns
Surface maximum of normalized magnetic-field magnitude.

◆ equil_move_sc()

static void orb5x::Equil::equil_move_sc ( Real  s,
Real  chi,
Real &  r,
Real &  tprime,
Real &  B,
std::vector< Real > &  bgrb,
Real &  divh,
std::vector< Real > &  h,
Real &  addpBst,
std::vector< Real > &  addp,
std::vector< Real > &  exh,
Real &  toB,
Real &  addvpa 
)
static

Gather geometry and magnetic coefficients used by the particle pusher.

Parameters
[in]sNormalized radial coordinate.
[in]chiPoloidal coordinate [rad].
[out]rMajor radius.
[out]tprimeEquilibrium \(T'/B\) coefficient.
[out]BNormalized magnetic-field magnitude.
[out]bgrbComponents of \(\mathbf b\cdot\nabla\mathbf B\) terms.
[out]divhDivergence of \(\mathbf h=\mathbf B/B\).
[out]hCylindrical components of \(\mathbf h\).
[out]addpBstCorrection to \(B_\parallel^*\).
[out]addpAdditional parallel-force coefficients.
[out]exhEquilibrium electric-drift coefficients.
[out]toBValue of \(RB_\varphi/B\).
[out]addvpaParallel-acceleration coefficient.

◆ equil_move_strong()

static void orb5x::Equil::equil_move_strong ( Real  s,
Real  chi,
Real &  due2dsigma,
Real &  due2dchi,
Real &  dBdsigma,
Real &  dBdchi 
)
static

Gather speed and magnetic-field derivatives for the strong-flow pusher.

Parameters
[in]sNormalized radial coordinate.
[in]chiPoloidal angle, in radians.
[out]due2dsigmaRadial derivative of squared background speed.
[out]due2dchiPoloidal derivative of squared background speed.
[out]dBdsigmaRadial derivative of normalized field magnitude.
[out]dBdchiPoloidal derivative of normalized field magnitude.

◆ equil_perp_vec()

static void orb5x::Equil::equil_perp_vec ( Real  s,
Real  chi,
Real &  hy,
Real &  hz,
Real &  grsigma2,
Real &  grchi2,
Real &  grsigmagrchi,
Real &  J_s,
Real &  r 
)
static

Evaluate strong-flow basis vectors and metric contractions.

Parameters
[in]sRadial coordinate.
[in]chiPoloidal coordinate [rad].
[out]hyVertical component of \(\mathbf h\).
[out]hzToroidal component of \(\mathbf h\).
[out]grsigma2\(|\nabla\sigma|^2\).
[out]grchi2\(|\nabla\chi|^2\).
[out]grsigmagrchi\(\nabla\sigma\cdot\nabla\chi\).
[out]J_sCoordinate Jacobian.
[out]rMajor radius.

◆ equil_strong_vdr()

static void orb5x::Equil::equil_strong_vdr ( Real  sigmat,
Real  chi,
Real &  duphidpsi,
Real &  duphidchi 
)
static

Evaluate derivatives of toroidal background flow.

Parameters
[in]sigmatStrong-flow radial coordinate.
[in]chiPoloidal angle, in radians.
[out]duphidpsiFlux derivative of toroidal flow.
[out]duphidchiPoloidal derivative of toroidal flow, per radian.

◆ equil_toB()

static Real orb5x::Equil::equil_toB ( Real  s,
Real  chi 
)
static

Evaluate \(R B_\varphi/B\).

Parameters
[in]sNormalized radial coordinate.
[in]chiPoloidal angle, in radians.
Returns
Toroidal-field ratio in normalized length units.

◆ equil_tprime()

static Real orb5x::Equil::equil_tprime ( Real  s,
Real  chi 
)
static

Evaluate the equilibrium \(T'(\psi)/B\) coefficient.

Parameters
[in]sNormalized radial coordinate.
[in]chiPoloidal angle, in radians.
Returns
Coefficient in ORB5X equilibrium normalization.

◆ equil_ubulk()

static Real orb5x::Equil::equil_ubulk ( Real  s_val,
int  isp 
)
static

Interpolate normalized background parallel flow.

Parameters
[in]s_valNormalized radial coordinate.
[in]ispOne-based species index.
Returns
Background parallel flow in normalized velocity units.

◆ func_b_pszs()

static Real orb5x::Equil::func_b_pszs ( Real  ss)
static

Interpolate the PSZS flux-surface average of \(B\).

Parameters
[in]ssNormalized radial coordinate.
Returns
Surface-averaged normalized magnetic-field magnitude.

◆ func_sigma()

static Real orb5x::Equil::func_sigma ( Real  ss)
static

Evaluate the flux-surface-averaged Jacobian factor \(\sigma(s)\).

Parameters
[in]ssNormalized radial coordinate.
Returns
Dimensionless interpolated surface-average factor.

◆ func_sigmab()

static Real orb5x::Equil::func_sigmab ( Real  ss)
static

Interpolate the PSZS surface-average factor \(\sigma_B\).

Parameters
[in]ssNormalized radial coordinate.
Returns
Dimensionless surface-average factor.

◆ func_sigmatprimeob()

static Real orb5x::Equil::func_sigmatprimeob ( Real  ss)
static

Interpolate the PSZS \(\sigma T'/B\) surface-average factor.

Parameters
[in]ssNormalized radial coordinate.
Returns
Surface-average factor in equilibrium normalization.

◆ func_torpsi()

static Real orb5x::Equil::func_torpsi ( Real  ss)
static

Evaluate the normalized toroidal-flux function.

Parameters
[in]ssNormalized radial coordinate.
Returns
Dimensionless toroidal-flux function.

◆ func_tprimeob_pszs()

static Real orb5x::Equil::func_tprimeob_pszs ( Real  ss)
static

Interpolate the PSZS flux-surface average of \(T'/B\).

Parameters
[in]ssNormalized radial coordinate.
Returns
Surface-averaged coefficient in equilibrium normalization.

◆ get_alphain()

static const std::vector< Real > * orb5x::Equil::get_alphain ( )
static

Return current interpolation weights for asymmetric-boundary re-entry.

Returns
Non-owning pointer to module-owned dimensionless weights, or null when unavailable.

◆ get_alphain0()

static const std::vector< Real > * orb5x::Equil::get_alphain0 ( )
static

Return previous interpolation weights for asymmetric-boundary re-entry.

Returns
Non-owning pointer to module-owned previous weights, or null when unavailable.

◆ get_bin_surf()

static const std::vector< Real > * orb5x::Equil::get_bin_surf ( )
static

Return diagnostic radial-bin surface measures, including guard bins.

Returns
Non-owning pointer to module-owned normalized surface measures.

◆ get_bin_vol()

static const std::vector< Real > * orb5x::Equil::get_bin_vol ( )
static

Return radial diagnostic-bin volumes, including guard bins.

Returns
Non-owning pointer to module-owned normalized bin volumes.

◆ get_bin_vol_2d()

static const std::vector< std::vector< Real > > * orb5x::Equil::get_bin_vol_2d ( )
static

Return flux/poloidal diagnostic-bin volumes, including radial guards.

Returns
Non-owning pointer to module-owned [radial][poloidal] volumes.

◆ get_bin_vol_3d()

static const std::vector< std::vector< Real > > * orb5x::Equil::get_bin_vol_3d ( )
static

Return \((s,\chi)\) bin volumes used for volume-weighted 3-D moments.

Returns
Non-owning pointer to module-owned normalized volume factors.

◆ get_bin_vol_3d_inv()

static const std::vector< std::vector< Real > > * orb5x::Equil::get_bin_vol_3d_inv ( )
static

Return inverse \((s,\chi)\) bin volumes used to normalize 3-D moments.

Returns
Non-owning pointer to module-owned inverse volume factors.

◆ get_c_psi0corr()

static Real orb5x::Equil::get_c_psi0corr ( )
static

Return the prefactor used to normalize the strong-flow potential correction.

Returns
Cached dimensionless correction prefactor.

◆ get_chi()

static Real orb5x::Equil::get_chi ( Real  s,
Real  theta 
)
static

Convert geometric to equilibrium poloidal angle.

Parameters
[in]sNormalized radial coordinate.
[in]thetaGeometric poloidal angle, in radians.
Returns
Equilibrium angle \(\chi\), in radians.

◆ get_comp()

static std::vector< Real > orb5x::Equil::get_comp ( Real  s,
Real  chi 
)
static

Return meridional components of \(\nabla\psi/|\nabla\psi|\).

Parameters
[in]sNormalized radial coordinate.
[in]chiPoloidal angle, in radians.
Returns
Two-element vector in (R,Z) component order.

◆ get_den0_norm()

static Kokkos::View< Real * > orb5x::Equil::get_den0_norm ( )
static

Return the reference normalized-density table used by field equations.

Returns
Shallow Kokkos View of normalized density versus equilibrium radius.

◆ get_density()

static Real orb5x::Equil::get_density ( Real  s,
int  isp = 1 
)
static

Evaluate normalized species density at \(s=\sqrt{\psi}\).

Parameters
[in]sNormalized flux-surface coordinate.
[in]ispOne-based species index.
Returns
Equilibrium number density in ORB5X normalization.

◆ get_device_state()

static DeviceState orb5x::Equil::get_device_state ( )
static

Return shallow device handles and scalar metadata for Kokkos kernels.

Returns
Device-copyable state aliasing module-owned tables.

◆ get_ds_inv()

static Real orb5x::Equil::get_ds_inv ( )
static

Return inverse spacing of the uniform equilibrium \(s\) grid.

Returns
Dimensionless inverse radial spacing.

◆ get_FdFds()

static void orb5x::Equil::get_FdFds ( Real  s,
Real &  F,
Real &  dFds 
)
static

Evaluate toroidal-field function \(F\) and its derivative.

Parameters
[in]sNormalized radial coordinate.
[out]FToroidal-field function in equilibrium normalization.
[out]dFdsRadial derivative of F.

◆ get_fpsin()

static Real orb5x::Equil::get_fpsin ( )
static

Return the edge value of the normalized toroidal-flux function.

Returns
Dimensionless cached edge value.

◆ get_func_alphab_fsa()

static Real orb5x::Equil::get_func_alphab_fsa ( Real  ss)
static

Return the flux-surface-averaged trapped-particle fraction.

Parameters
[in]ssNormalized radial coordinate.
Returns
Dimensionless trapped-particle fraction.

◆ get_gradients()

static void orb5x::Equil::get_gradients ( Real  s,
Real  chi,
std::vector< Real > &  grads,
std::vector< Real > &  gradchi,
Real &  gradphi 
)
static

Evaluate the field-coordinate gradient basis at \((s,\chi)\).

Parameters
[in]sNormalized flux coordinate.
[in]chiPoloidal coordinate [rad].
[out]gradsMeridional components of \(\nabla s\).
[out]gradchiMeridional components of \(\nabla\chi\).
[out]gradphiMagnitude of \(\nabla\varphi\).

◆ get_jchiin()

static const std::vector< int > * orb5x::Equil::get_jchiin ( )
static

Return current-cell indices for asymmetric-boundary particle re-entry.

Returns
Non-owning pointer to module-owned integer indices, or null when unavailable.

◆ get_jchiin0()

static const std::vector< int > * orb5x::Equil::get_jchiin0 ( )
static

Return previous-cell indices for asymmetric-boundary particle re-entry.

Returns
Non-owning pointer to module-owned previous indices, or null when unavailable.

◆ get_larm_coeff()

static void orb5x::Equil::get_larm_coeff ( Real  s,
Real  chi,
Real &  larmsc,
Real &  larmchic,
Real &  larmchis 
)
static

Evaluate scalar gyro-displacement coefficients at a guiding centre.

Parameters
[in]sGuiding-centre normalized radial coordinate.
[in]chiGuiding-centre poloidal angle, in radians.
[out]larmscRadial gyro-displacement coefficient.
[out]larmchicCosine-phase poloidal displacement coefficient.
[out]larmchisSine-phase poloidal displacement coefficient.

◆ get_larm_coeffn()

static void orb5x::Equil::get_larm_coeffn ( Real  s,
Real  chi,
Kokkos::View< Real * > &  larmsc,
Kokkos::View< Real * > &  larmchic,
Kokkos::View< Real * > &  larmchis 
)
static

Fill device Views with gyro-displacement coefficients and derivatives.

Parameters
[in]sGuiding-centre normalized radial coordinate.
[in]chiGuiding-centre poloidal angle, in radians.
[out]larmscView of at least three radial entries.
[out]larmchicView of at least three cosine-phase entries.
[out]larmchisView of at least three sine-phase entries.

◆ get_larm_coeffn_scalar()

static void orb5x::Equil::get_larm_coeffn_scalar ( Real  s,
Real  chi,
std::array< Real, 3 > &  larmsc,
std::array< Real, 3 > &  larmchic,
std::array< Real, 3 > &  larmchis 
)
static

Evaluate gyro-displacement coefficients and first derivatives.

Parameters
[in]sGuiding-centre normalized radial coordinate.
[in]chiGuiding-centre poloidal angle, in radians.
[out]larmscThree radial coefficient/derivative entries.
[out]larmchicThree cosine-phase poloidal entries.
[out]larmchisThree sine-phase poloidal entries.

◆ get_magnetic_field()

static Real orb5x::Equil::get_magnetic_field ( Real  s,
Real  chi = 0.0 
)
static

Evaluate normalized \(|B|\) at \((s,\chi)\).

Parameters
[in]sNormalized flux-surface coordinate.
[in]chiPoloidal coordinate [rad].
Returns
Magnetic-field magnitude in ORB5X normalization.

◆ get_ngmax()

static int orb5x::Equil::get_ngmax ( )
static

Return the highest valid index of the equilibrium radial grid.

Returns
Zero-based maximum valid radial index.

◆ get_profile_grid_type()

static int orb5x::Equil::get_profile_grid_type ( int  isp)
static

Return the profile-grid selector for a species.

Parameters
[in]ispZero-based species index.
Returns
Integer selector identifying the configured profile grid type.

◆ get_psi_of_r()

static Real orb5x::Equil::get_psi_of_r ( Real  rho)
static

Interpolate normalized poloidal flux at normalized minor radius.

Parameters
[in]rhoNormalized minor radius.
Returns
Interpolated normalized poloidal flux.

◆ get_psihe_grd()

static Real orb5x::Equil::get_psihe_grd ( int  idx)
static

Read one helical-flux grid entry.

Parameters
[in]idxZero-based grid index.
Returns
Helical-flux coordinate stored at idx.

◆ get_psihe_grd_size()

static int orb5x::Equil::get_psihe_grd_size ( )
static

Return the number of helical-flux grid entries.

Returns
Size of the module-owned helical-flux grid.

◆ get_psihes()

static Real orb5x::Equil::get_psihes ( )
static

Return helical flux at the island separatrix.

Returns
Separatrix helical-flux value in ORB5X normalization.

◆ get_psires()

static Real orb5x::Equil::get_psires ( )
static

Return normalized flux at the island resonant surface.

Returns
Resonant-surface normalized flux.

◆ get_qmin()

static void orb5x::Equil::get_qmin ( Real &  sqmin,
Real &  qmin 
)
static

Locate the minimum of the safety-factor profile.

Parameters
[out]sqminRadial coordinate of the minimum.
[out]qminMinimum safety factor.

◆ get_rz()

static void orb5x::Equil::get_rz ( Real  s,
Real  chi,
Real &  r,
Real &  z 
)
static

Convert flux coordinates to cylindrical meridional coordinates.

Parameters
[in]sNormalized radial coordinate.
[in]chiEquilibrium poloidal angle, in radians.
[out]rMajor radius in normalized length units.
[out]zVertical coordinate in normalized length units.

◆ get_safety_factor()

static Real orb5x::Equil::get_safety_factor ( Real  s)
static

Evaluate the dimensionless safety factor \(q(s)\).

Parameters
[in]sNormalized flux-surface coordinate.
Returns
Magnetic safety factor at s.

◆ get_sgrid_eq()

static const Kokkos::View< Real * > * orb5x::Equil::get_sgrid_eq ( )
static

Return the equilibrium radial grid in \(s\).

Returns
Non-owning pointer to the module-owned Kokkos View.

◆ get_sigmas()

static const Kokkos::View< Real ** > * orb5x::Equil::get_sigmas ( )
static

Return the table of equilibrium flux-surface averages used by PSZS.

Returns
Non-owning pointer to the module-owned Kokkos View.

◆ get_skin_norm()

static Kokkos::View< Real * > orb5x::Equil::get_skin_norm ( )
static

Return the normalized electron-skin-depth table used by electromagnetic solvers.

Returns
Shallow Kokkos View of the radial skin-depth profile.

◆ get_temperature()

static Real orb5x::Equil::get_temperature ( Real  s,
int  isp = 1 
)
static

Evaluate normalized species temperature at \(s=\sqrt{\psi}\).

Parameters
[in]sNormalized flux-surface coordinate.
[in]ispOne-based species index.
Returns
Equilibrium temperature in ORB5X normalization.

◆ get_theta()

static Real orb5x::Equil::get_theta ( Real  s,
Real  chi 
)
static

Convert equilibrium poloidal coordinate to geometric angle.

Parameters
[in]sNormalized radial coordinate.
[in]chiEquilibrium poloidal angle, in radians.
Returns
Geometric poloidal angle \(\theta\), in radians.

◆ get_vol_coord()

static Kokkos::View< Real * > orb5x::Equil::get_vol_coord ( )
static

Return the cumulative normalized volume coordinate on the equilibrium radial grid.

Returns
Shallow Kokkos View sharing the module's radial volume table.

◆ get_voldiag()

static Real orb5x::Equil::get_voldiag ( int  isp)
static

Return the sampled diagnostic volume for a species.

Parameters
[in]ispZero-based C++ species index.
Returns
Normalized volume covered by that species' diagnostic domain.

◆ get_width_is()

static Real orb5x::Equil::get_width_is ( )
static

Return the island half-width.

Returns
Half-width in normalized-flux units.

◆ get_zdpsi_0()

static Real orb5x::Equil::get_zdpsi_0 ( )
static

Return the uniform normalized-flux spacing used by profile tables.

Returns
Dimensionless \(\Delta\psi\).

◆ get_znin()

static int orb5x::Equil::get_znin ( )
static

Return the number of inner-region island radial bins.

Returns
Nonnegative inner-region bin count.

◆ get_znisl()

static int orb5x::Equil::get_znisl ( )
static

Return the number of island-region radial bins.

Returns
Nonnegative island-region bin count.

◆ get_znout()

static int orb5x::Equil::get_znout ( )
static

Return the number of outer-region island radial bins.

Returns
Nonnegative outer-region bin count.

◆ getdens_corr()

static Real orb5x::Equil::getdens_corr ( Real  psit)
static

Evaluate the multiplicative strong-flow density correction.

Parameters
[in]psitNormalized poloidal flux.
Returns
Dimensionless density-correction factor.

◆ getdn_corr()

static Real orb5x::Equil::getdn_corr ( Real  psit)
static

Evaluate the flux derivative of the strong-flow density correction.

Parameters
[in]psitNormalized poloidal flux.
Returns
Derivative of the dimensionless correction with respect to normalized flux.

◆ init_dens_profile_public()

static void orb5x::Equil::init_dens_profile_public ( int  worktype,
int  isp,
std::vector< Real > *  zf_av = nullptr,
std::vector< Real > *  z_den = nullptr 
)
static

Dispatch density-profile preparation for control and restart paths.

Parameters
[in]worktypeOperation selector documented by init_dens_profile().
[in]ispOne-based species index.
[in,out]zf_avOptional flux-abscissa data.
[in,out]z_denOptional density data.

◆ init_equil()

static void orb5x::Equil::init_equil ( )
static

Read the selected equilibrium and prepare coordinate interpolation tables.

◆ jacob()

static Real orb5x::Equil::jacob ( Real  s,
Real  chi 
)
static

Evaluate the field-coordinate Jacobian.

Parameters
[in]sNormalized radial coordinate.
[in]chiPoloidal angle, in radians.
Returns
Jacobian in ORB5X geometry normalization.

◆ jacob_tsp()

static Real orb5x::Equil::jacob_tsp ( Real  s,
Real  chi 
)
static

Evaluate \(J_{\theta s\varphi}\).

Parameters
[in]sNormalized radial coordinate.
[in]chiPoloidal angle, in radians.
Returns
Geometric-angle coordinate Jacobian in normalized units.

◆ jacobDerivative()

static Real orb5x::Equil::jacobDerivative ( Real  s,
Real  chi 
)
static

Evaluate \(\partial J/\partial s\).

Parameters
[in]sNormalized radial coordinate.
[in]chiPoloidal angle, in radians.
Returns
Radial derivative of the normalized coordinate Jacobian.

◆ load_equil()

static void orb5x::Equil::load_equil ( const std::string &  fname)
static

Load equilibrium data from fname.

Parameters
[in]fnamePath to the equilibrium input file.

◆ load_profiles()

static void orb5x::Equil::load_profiles ( const std::string &  prof_file)
static

Load species profiles into internal interpolation tables.

Parameters
[in]prof_filePath to the profile input file.

◆ normalize_profiles()

static void orb5x::Equil::normalize_profiles ( )
static

Convert loaded density, temperature, and flow profiles to simulation normalization.

◆ prepare_profiles_host_cache()

static bool orb5x::Equil::prepare_profiles_host_cache ( )
static

Mirror profile views into a host cache for host-only call paths.

Returns
true when the cache is ready for interpolation.

◆ profiles()

static void orb5x::Equil::profiles ( int  isp,
Real  psi,
Real &  tval,
Real &  tgrad,
Real &  nval,
Real &  ngrad,
Real &  vpval,
Real &  vpgrad 
)
static

Interpolate all background profiles at normalized poloidal flux psi.

Parameters
[in]ispOne-based species index.
[in]psiNormalized poloidal flux (normally \(s^2\)).
[out]tvalTemperature.
[out]tgrad\(dT/d\psi\).
[out]nvalDensity.
[out]ngrad\(dn/d\psi\).
[out]vpvalParallel flow speed.
[out]vpgrad\(dv_\parallel/d\psi\).

◆ profiles_host_cached()

static void orb5x::Equil::profiles_host_cached ( int  isp,
Real  psi,
Real &  tval,
Real &  tgrad,
Real &  nval,
Real &  ngrad,
Real &  vpval,
Real &  vpgrad 
)
static

Host-cache equivalent of profiles(); the cache must first be prepared.

Parameters
[in]ispOne-based species index.
[in]psiNormalized poloidal flux.
[out]tvalTemperature in normalized units.
[out]tgradFlux derivative of temperature.
[out]nvalDensity in normalized units.
[out]ngradFlux derivative of density.
[out]vpvalParallel flow in normalized velocity units.
[out]vpgradFlux derivative of parallel flow.

◆ profiles_sh()

static void orb5x::Equil::profiles_sh ( int  isp,
Real  psi,
Real &  nishval 
)
static

Interpolate normalized shielding density.

Parameters
[in]ispOne-based species index.
[in]psiNormalized poloidal flux.
[out]nishvalShielding density in normalized units.

◆ qchi()

static void orb5x::Equil::qchi ( Real  radvar,
Real &  qout,
const std::string &  strsel = "" 
)
static

Evaluate safety factor on either the \(s\) or normalized-radius grid.

Parameters
[in]radvar\(s\) when strsel is empty, otherwise \(\rho/a\).
[out]qoutDimensionless safety factor.
[in]strselNonempty to select normalized minor radius input.

◆ s2rad()

static void orb5x::Equil::s2rad ( Real  ps,
Real &  prad,
Real &  pdrds 
)
static

Convert \(s\) to normalized minor radius and its derivative.

Parameters
[in]psFlux coordinate \(s\).
[out]pradNormalized minor radius \(\rho/a\).
[out]pdrdsDerivative \(d(\rho/a)/ds\).

◆ s_of_q()

static Real orb5x::Equil::s_of_q ( Real  zq)
static

Invert a monotonic safety-factor profile.

Parameters
[in]zqTarget dimensionless safety factor.
Returns
Radial coordinate \(s\), or -1 when zq lies outside it.

◆ xy2sc()

static void orb5x::Equil::xy2sc ( Real  x,
Real  y,
Real &  s,
Real &  chi 
)
static

Convert cylindrical meridional coordinates \((R,Z)\) to \((s,\chi)\).

Parameters
[in]xMajor radius in normalized length units.
[in]yVertical position in normalized length units.
[out]sNormalized flux coordinate.
[out]chiPoloidal coordinate [rad].

Member Data Documentation

◆ b_norm

Real orb5x::Equil::b_norm
static

Magnetic-field normalization used by equilibrium tables.

◆ Bmax_c

Real orb5x::Equil::Bmax_c
static

Global upper bound of normalized magnetic-field magnitude.

◆ Bmin_c

Real orb5x::Equil::Bmin_c
static

Global lower bound of normalized magnetic-field magnitude.

◆ d_norm

Real orb5x::Equil::d_norm
static

Length/metric normalization used by equilibrium tables.

◆ FonBmax_c

Real orb5x::Equil::FonBmax_c
static

Maximum of the normalized toroidal-field ratio used for binning.

◆ FonBmin_c

Real orb5x::Equil::FonBmin_c
static

Minimum of the normalized toroidal-field ratio used for binning.

◆ psi0

Real orb5x::Equil::psi0
static

Normalized poloidal flux at the computational edge.


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