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. | |
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.
equil.F90, module equil_mod; routine names are retained where practical.
|
static |
Evaluate derivatives of squared background speed.
| [in] | sigmat | Strong-flow radial coordinate. |
| [in] | chi | Poloidal angle, in radians. |
| [out] | due2dsigma | Radial derivative of squared normalized speed. |
| [out] | due2dchi | Poloidal derivative of squared normalized speed, per radian. |
Evaluate squared background \(E\times B\) speed.
| [in] | sigmat | Strong-flow radial coordinate. |
| [in] | chi | Poloidal angle, in radians. |
| [out] | vexb2 | Squared drift speed in normalized velocity units squared. |
Evaluate the toroidal component of background flow.
| [in] | sigmat | Strong-flow radial coordinate. |
| [in] | chi | Poloidal angle, in radians. |
| [out] | ue_phi | Toroidal flow in normalized velocity units. |
|
static |
Evaluate derivatives and magnitude of the equilibrium field.
| [in] | s | Normalized radial coordinate. |
| [in] | chi | Poloidal angle, in radians. |
| [out] | dBds | Radial derivative of normalized field magnitude. |
| [out] | dBdchi | Poloidal derivative per radian. |
| [out] | absb | Normalized magnetic-field magnitude. |
Calculate local or flux-surface-averaged trapped-particle fraction.
| [in] | s | Normalized flux coordinate. |
| [in] | theta | Geometric poloidal angle [rad]. |
| [in] | itrap | 1 for local and 2 for flux-surface-averaged evaluation. |
|
static |
Integrate volumes for a uniform diagnostic \((s,\chi,\varphi)\) mesh.
| [in] | stmin | Lower radial coordinate. |
| [in] | zds | Radial bin width. |
| [in] | stbin | Number of radial bins. |
| [in] | chitmin | Lower poloidal coordinate [rad]. |
| [in] | zdchi | Poloidal bin width [rad]. |
| [in] | chitbin | Number of poloidal bins. |
| [in] | zdphi | Toroidal bin width [rad]. |
|
static |
Integrate Jacobians and construct volume, surface, and diagnostic-bin measures.
|
static |
Construct density, temperature, flow, and safety-factor profiles on the internal grids.
|
static |
Allocate and initialize all equilibrium, profile, and geometry data.
Evaluate cylindrical components of the curl of background flow.
| [in] | sigmat | Strong-flow radial coordinate. |
| [in] | chi | Poloidal coordinate [rad]. |
| [out] | X | Radial component. |
| [out] | Y | Vertical component. |
| [out] | Z | Toroidal component. |
Evaluate the normalized loading density.
| [in] | s | Normalized radial coordinate. |
| [in] | isp | One-based species index. |
|
static |
Write equilibrium arrays, profiles, coordinates, and scalars to the configured HDF5 output.
Evaluate normalized magnetic-field magnitude.
| [in] | s | Normalized radial coordinate. |
| [in] | chi | Poloidal angle, in radians. |
Evaluate the correction entering guiding-centre \(B_\parallel^*\).
| [in] | s | Normalized radial coordinate. |
| [in] | chi | Poloidal angle, in radians. |
|
static |
Interpolate background potential and electric-field components.
| [in] | s | Normalized radial coordinate. |
| [in] | chi | Poloidal angle, in radians. |
| [out] | pot | Background electrostatic potential in normalized units. |
| [out] | es | Radial electric-field coefficient. |
| [out] | echi | Poloidal electric-field coefficient. |
Interpolate flux-function background potential and radial field.
| [in] | psi | Normalized poloidal flux. |
| [out] | pot | Background potential in normalized units. |
| [out] | epsi | Negative flux derivative/electric-field coefficient. |
Evaluate \(\beta\,\mathbf b\cdot\nabla\times\mathbf B/B\).
| [in] | s | Normalized radial coordinate. |
| [in] | chi | Poloidal angle, in radians. |
|
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.
| [in] | s | Normalized radial coordinate. |
| [in] | chi | Poloidal angle, in radians. |
| [out] | zr | Major radius in normalized length units. |
| [out] | zpsidr | Radial cylindrical derivative of normalized poloidal flux. |
| [out] | zpsidz | Vertical cylindrical derivative of normalized poloidal flux. |
| [out] | zB | Magnetic-field magnitude in normalized units. |
| [out] | zhchi | Poloidal contravariant component of the unit field. |
| [out] | zhphi | Toroidal contravariant component of the unit field. |
| [out] | zgrB | Meridional components of the magnetic-field gradient. |
| [out] | addpchi | Poloidal curl/parallel-force coefficient. |
| [out] | addpphi | Toroidal curl/parallel-force coefficient. |
| [out] | brotb | Unit-field curl contraction. |
| [out] | divh | Divergence of the magnetic-field unit vector. |
| [out] | grads | Meridional components of \(\nabla s\). |
| [out] | gradchi | Meridional components of \(\nabla\chi\). |
Interpolate \(dB_{\max}/ds\) on a surface.
| [in] | st | Normalized radial coordinate. |
Evaluate the poloidal contravariant component of \(\mathbf h=\mathbf B/B\).
| [in] | s | Normalized radial coordinate. |
| [in] | chi | Poloidal angle, in radians. |
Interpolate the maximum normalized \(|B|\) on a surface.
| [in] | st | Normalized radial coordinate. |
|
static |
Gather geometry and magnetic coefficients used by the particle pusher.
| [in] | s | Normalized radial coordinate. |
| [in] | chi | Poloidal coordinate [rad]. |
| [out] | r | Major radius. |
| [out] | tprime | Equilibrium \(T'/B\) coefficient. |
| [out] | B | Normalized magnetic-field magnitude. |
| [out] | bgrb | Components of \(\mathbf b\cdot\nabla\mathbf B\) terms. |
| [out] | divh | Divergence of \(\mathbf h=\mathbf B/B\). |
| [out] | h | Cylindrical components of \(\mathbf h\). |
| [out] | addpBst | Correction to \(B_\parallel^*\). |
| [out] | addp | Additional parallel-force coefficients. |
| [out] | exh | Equilibrium electric-drift coefficients. |
| [out] | toB | Value of \(RB_\varphi/B\). |
| [out] | addvpa | Parallel-acceleration coefficient. |
|
static |
Gather speed and magnetic-field derivatives for the strong-flow pusher.
| [in] | s | Normalized radial coordinate. |
| [in] | chi | Poloidal angle, in radians. |
| [out] | due2dsigma | Radial derivative of squared background speed. |
| [out] | due2dchi | Poloidal derivative of squared background speed. |
| [out] | dBdsigma | Radial derivative of normalized field magnitude. |
| [out] | dBdchi | Poloidal derivative of normalized field magnitude. |
|
static |
Evaluate strong-flow basis vectors and metric contractions.
| [in] | s | Radial coordinate. |
| [in] | chi | Poloidal coordinate [rad]. |
| [out] | hy | Vertical component of \(\mathbf h\). |
| [out] | hz | Toroidal component of \(\mathbf h\). |
| [out] | grsigma2 | \(|\nabla\sigma|^2\). |
| [out] | grchi2 | \(|\nabla\chi|^2\). |
| [out] | grsigmagrchi | \(\nabla\sigma\cdot\nabla\chi\). |
| [out] | J_s | Coordinate Jacobian. |
| [out] | r | Major radius. |
|
static |
Evaluate derivatives of toroidal background flow.
| [in] | sigmat | Strong-flow radial coordinate. |
| [in] | chi | Poloidal angle, in radians. |
| [out] | duphidpsi | Flux derivative of toroidal flow. |
| [out] | duphidchi | Poloidal derivative of toroidal flow, per radian. |
Evaluate \(R B_\varphi/B\).
| [in] | s | Normalized radial coordinate. |
| [in] | chi | Poloidal angle, in radians. |
Evaluate the equilibrium \(T'(\psi)/B\) coefficient.
| [in] | s | Normalized radial coordinate. |
| [in] | chi | Poloidal angle, in radians. |
Interpolate normalized background parallel flow.
| [in] | s_val | Normalized radial coordinate. |
| [in] | isp | One-based species index. |
Interpolate the PSZS flux-surface average of \(B\).
| [in] | ss | Normalized radial coordinate. |
Evaluate the flux-surface-averaged Jacobian factor \(\sigma(s)\).
| [in] | ss | Normalized radial coordinate. |
Interpolate the PSZS surface-average factor \(\sigma_B\).
| [in] | ss | Normalized radial coordinate. |
Interpolate the PSZS \(\sigma T'/B\) surface-average factor.
| [in] | ss | Normalized radial coordinate. |
Evaluate the normalized toroidal-flux function.
| [in] | ss | Normalized radial coordinate. |
Interpolate the PSZS flux-surface average of \(T'/B\).
| [in] | ss | Normalized radial coordinate. |
|
static |
Return current interpolation weights for asymmetric-boundary re-entry.
|
static |
Return previous interpolation weights for asymmetric-boundary re-entry.
|
static |
Return diagnostic radial-bin surface measures, including guard bins.
|
static |
Return radial diagnostic-bin volumes, including guard bins.
|
static |
Return flux/poloidal diagnostic-bin volumes, including radial guards.
[radial][poloidal] volumes.
|
static |
Return \((s,\chi)\) bin volumes used for volume-weighted 3-D moments.
|
static |
Return inverse \((s,\chi)\) bin volumes used to normalize 3-D moments.
|
static |
Return the prefactor used to normalize the strong-flow potential correction.
Convert geometric to equilibrium poloidal angle.
| [in] | s | Normalized radial coordinate. |
| [in] | theta | Geometric poloidal angle, in radians. |
Return meridional components of \(\nabla\psi/|\nabla\psi|\).
| [in] | s | Normalized radial coordinate. |
| [in] | chi | Poloidal angle, in radians. |
(R,Z) component order.
|
static |
Return the reference normalized-density table used by field equations.
Evaluate normalized species density at \(s=\sqrt{\psi}\).
| [in] | s | Normalized flux-surface coordinate. |
| [in] | isp | One-based species index. |
|
static |
Return shallow device handles and scalar metadata for Kokkos kernels.
|
static |
Return inverse spacing of the uniform equilibrium \(s\) grid.
Evaluate toroidal-field function \(F\) and its derivative.
| [in] | s | Normalized radial coordinate. |
| [out] | F | Toroidal-field function in equilibrium normalization. |
| [out] | dFds | Radial derivative of F. |
|
static |
Return the edge value of the normalized toroidal-flux function.
Return the flux-surface-averaged trapped-particle fraction.
| [in] | ss | Normalized radial coordinate. |
|
static |
Evaluate the field-coordinate gradient basis at \((s,\chi)\).
| [in] | s | Normalized flux coordinate. |
| [in] | chi | Poloidal coordinate [rad]. |
| [out] | grads | Meridional components of \(\nabla s\). |
| [out] | gradchi | Meridional components of \(\nabla\chi\). |
| [out] | gradphi | Magnitude of \(\nabla\varphi\). |
|
static |
Return current-cell indices for asymmetric-boundary particle re-entry.
|
static |
Return previous-cell indices for asymmetric-boundary particle re-entry.
|
static |
Evaluate scalar gyro-displacement coefficients at a guiding centre.
| [in] | s | Guiding-centre normalized radial coordinate. |
| [in] | chi | Guiding-centre poloidal angle, in radians. |
| [out] | larmsc | Radial gyro-displacement coefficient. |
| [out] | larmchic | Cosine-phase poloidal displacement coefficient. |
| [out] | larmchis | Sine-phase poloidal displacement coefficient. |
|
static |
Fill device Views with gyro-displacement coefficients and derivatives.
| [in] | s | Guiding-centre normalized radial coordinate. |
| [in] | chi | Guiding-centre poloidal angle, in radians. |
| [out] | larmsc | View of at least three radial entries. |
| [out] | larmchic | View of at least three cosine-phase entries. |
| [out] | larmchis | View of at least three sine-phase entries. |
|
static |
Evaluate gyro-displacement coefficients and first derivatives.
| [in] | s | Guiding-centre normalized radial coordinate. |
| [in] | chi | Guiding-centre poloidal angle, in radians. |
| [out] | larmsc | Three radial coefficient/derivative entries. |
| [out] | larmchic | Three cosine-phase poloidal entries. |
| [out] | larmchis | Three sine-phase poloidal entries. |
Evaluate normalized \(|B|\) at \((s,\chi)\).
| [in] | s | Normalized flux-surface coordinate. |
| [in] | chi | Poloidal coordinate [rad]. |
|
static |
Return the highest valid index of the equilibrium radial grid.
|
static |
Return the profile-grid selector for a species.
| [in] | isp | Zero-based species index. |
Interpolate normalized poloidal flux at normalized minor radius.
| [in] | rho | Normalized minor radius. |
|
static |
Read one helical-flux grid entry.
| [in] | idx | Zero-based grid index. |
idx.
|
static |
Return the number of helical-flux grid entries.
|
static |
Return helical flux at the island separatrix.
|
static |
Return normalized flux at the island resonant surface.
Locate the minimum of the safety-factor profile.
| [out] | sqmin | Radial coordinate of the minimum. |
| [out] | qmin | Minimum safety factor. |
Convert flux coordinates to cylindrical meridional coordinates.
| [in] | s | Normalized radial coordinate. |
| [in] | chi | Equilibrium poloidal angle, in radians. |
| [out] | r | Major radius in normalized length units. |
| [out] | z | Vertical coordinate in normalized length units. |
Evaluate the dimensionless safety factor \(q(s)\).
| [in] | s | Normalized flux-surface coordinate. |
s.
|
static |
Return the equilibrium radial grid in \(s\).
|
static |
Return the table of equilibrium flux-surface averages used by PSZS.
|
static |
Return the normalized electron-skin-depth table used by electromagnetic solvers.
Evaluate normalized species temperature at \(s=\sqrt{\psi}\).
| [in] | s | Normalized flux-surface coordinate. |
| [in] | isp | One-based species index. |
Convert equilibrium poloidal coordinate to geometric angle.
| [in] | s | Normalized radial coordinate. |
| [in] | chi | Equilibrium poloidal angle, in radians. |
|
static |
Return the cumulative normalized volume coordinate on the equilibrium radial grid.
|
static |
Return the sampled diagnostic volume for a species.
| [in] | isp | Zero-based C++ species index. |
|
static |
Return the island half-width.
|
static |
Return the uniform normalized-flux spacing used by profile tables.
|
static |
Return the number of inner-region island radial bins.
|
static |
Return the number of island-region radial bins.
|
static |
Return the number of outer-region island radial bins.
Evaluate the multiplicative strong-flow density correction.
| [in] | psit | Normalized poloidal flux. |
Evaluate the flux derivative of the strong-flow density correction.
| [in] | psit | Normalized poloidal flux. |
|
static |
Dispatch density-profile preparation for control and restart paths.
| [in] | worktype | Operation selector documented by init_dens_profile(). |
| [in] | isp | One-based species index. |
| [in,out] | zf_av | Optional flux-abscissa data. |
| [in,out] | z_den | Optional density data. |
|
static |
Read the selected equilibrium and prepare coordinate interpolation tables.
Evaluate the field-coordinate Jacobian.
| [in] | s | Normalized radial coordinate. |
| [in] | chi | Poloidal angle, in radians. |
Evaluate \(J_{\theta s\varphi}\).
| [in] | s | Normalized radial coordinate. |
| [in] | chi | Poloidal angle, in radians. |
Evaluate \(\partial J/\partial s\).
| [in] | s | Normalized radial coordinate. |
| [in] | chi | Poloidal angle, in radians. |
|
static |
Load equilibrium data from fname.
| [in] | fname | Path to the equilibrium input file. |
|
static |
Load species profiles into internal interpolation tables.
| [in] | prof_file | Path to the profile input file. |
|
static |
Convert loaded density, temperature, and flow profiles to simulation normalization.
|
static |
Mirror profile views into a host cache for host-only call paths.
true when the cache is ready for interpolation.
|
static |
Interpolate all background profiles at normalized poloidal flux psi.
| [in] | isp | One-based species index. |
| [in] | psi | Normalized poloidal flux (normally \(s^2\)). |
| [out] | tval | Temperature. |
| [out] | tgrad | \(dT/d\psi\). |
| [out] | nval | Density. |
| [out] | ngrad | \(dn/d\psi\). |
| [out] | vpval | Parallel flow speed. |
| [out] | vpgrad | \(dv_\parallel/d\psi\). |
|
static |
Host-cache equivalent of profiles(); the cache must first be prepared.
| [in] | isp | One-based species index. |
| [in] | psi | Normalized poloidal flux. |
| [out] | tval | Temperature in normalized units. |
| [out] | tgrad | Flux derivative of temperature. |
| [out] | nval | Density in normalized units. |
| [out] | ngrad | Flux derivative of density. |
| [out] | vpval | Parallel flow in normalized velocity units. |
| [out] | vpgrad | Flux derivative of parallel flow. |
Interpolate normalized shielding density.
| [in] | isp | One-based species index. |
| [in] | psi | Normalized poloidal flux. |
| [out] | nishval | Shielding density in normalized units. |
Evaluate safety factor on either the \(s\) or normalized-radius grid.
| [in] | radvar | \(s\) when strsel is empty, otherwise \(\rho/a\). |
| [out] | qout | Dimensionless safety factor. |
| [in] | strsel | Nonempty to select normalized minor radius input. |
Convert \(s\) to normalized minor radius and its derivative.
| [in] | ps | Flux coordinate \(s\). |
| [out] | prad | Normalized minor radius \(\rho/a\). |
| [out] | pdrds | Derivative \(d(\rho/a)/ds\). |
Invert a monotonic safety-factor profile.
| [in] | zq | Target dimensionless safety factor. |
-1 when zq lies outside it. Convert cylindrical meridional coordinates \((R,Z)\) to \((s,\chi)\).
| [in] | x | Major radius in normalized length units. |
| [in] | y | Vertical position in normalized length units. |
| [out] | s | Normalized flux coordinate. |
| [out] | chi | Poloidal coordinate [rad]. |
|
static |
Magnetic-field normalization used by equilibrium tables.
|
static |
Global upper bound of normalized magnetic-field magnitude.
|
static |
Global lower bound of normalized magnetic-field magnitude.
|
static |
Length/metric normalization used by equilibrium tables.
|
static |
Maximum of the normalized toroidal-field ratio used for binning.
|
static |
Minimum of the normalized toroidal-field ratio used for binning.
|
static |
Normalized poloidal flux at the computational edge.