Interface for solver integration in ORB5X. More...
#include "interface_solver_in_orb5.hpp"
Public Member Functions | |
| void | backsolveMassF (Kokkos::View< Complex * > &rhs_f, int globalk) |
| Instance implementation of backsolve_mass_f(). | |
| void | backsolveRhsF (Kokkos::View< Complex * > &rhs_f, int globalk, int matnum) |
| Instance implementation of backsolve_rhs_f(). | |
| int | degree () const |
| void | destroy () |
| Release all instance-owned solver and communicator resources. | |
| void | init (int nx, int ny, int nz, int degree, int nfilt1, int nfilt2, int deltan, int dm, int nsel_poisson, int nsel_ampere, int nsel_control_variate, int inner_BC, Real xmin, Real xmax, Real ymin, Real ymax, Real a, int nphip) |
| Configure grids, Fourier filters, MPI assembly ranks, and all field matrices. | |
| int | innerBC () const |
| InterfaceSolverInOrb5 () | |
| Construct an inactive solver interface with no communicator ownership. | |
| InterfaceSolverInOrb5 (const InterfaceSolverInOrb5 &)=delete | |
| Process-wide interface state is noncopyable. | |
| bool | isInitialized () const |
| int | multiMatrix () const |
| void | multiplyMassF (Kokkos::View< Complex * > &arr_f, int globalk) |
| Instance implementation of multiply_mass_f(). | |
| int | nm () const |
| int | nx () const |
| int | ny () const |
| InterfaceSolverInOrb5 & | operator= (const InterfaceSolverInOrb5 &)=delete |
| Copy assignment is disabled. | |
| int | subarraySize () const |
| Return the coefficient count used by one backsolve/multiply. | |
| ~InterfaceSolverInOrb5 () | |
| Destroy solver resources and any owned assembly communicator. | |
Static Public Member Functions | |
| static void | backsolve_mass_f (Kokkos::View< Complex * > &rhs_f, int globalk) |
| Apply the inverse mass matrix in place. | |
| static void | backsolve_rhs_f (Kokkos::View< Complex * > &rhs_f, int globalk, int matnum) |
| Solve one Fourier-mode field system in place. | |
| static void | computeLoadBalancing (int nphip, int nfilt1, int nfilt2, int deltan, int nsd, std::vector< int > &loadbalancing_mpi, std::vector< int > &rank_cart, int &nbcart_busy) |
| Compute MPI rank selection and Cartesian-rank mapping for matrix assembly. | |
| static void | destroyNewSolver () |
| Destroy the process-wide solver, basis, filters, matrices, and MPI communicator. | |
| static void | determineLocalModes (int nphip, int nfilt1, int nfilt2, int deltan, int nz, int color, int me_sd, Kokkos::View< bool * > &isnfiltlocal, Kokkos::View< bool * > &isnfiltlocalysolved, Kokkos::View< int * > &nfiltlocal, int &NBmodeslocal, bool &localassembly) |
| Determine rank-local toroidal modes for assembly and backsolve. | |
| static void | initNewSolverInOrb5 (int nx, int ny, int nz, int degree, int nfilt1, int nfilt2, int deltan, int dm, int nsel_poisson, int nsel_ampere, int nsel_control_variate, int inner_BC, Real xmin, Real xmax, Real ymin, Real ymax, Real a, int nphip) |
| Initialize the process-wide finite-element field solver. | |
| static void | multiply_mass_f (Kokkos::View< Complex * > &arr_f, int globalk) |
| Multiply a Fourier coefficient vector by the mass matrix in place. | |
| static void | readSolverHackNamelist (const std::string &input_path, bool &phase_factor, bool &force_no_adiabatic, bool &force_no_polarization, bool &force_no_zonal, int &counter_freq, bool &old_parallelization, int &testcase, bool &oldAvgJac, int &internal_boundary, int &multi_matrix, bool &lapl_boundary_terms) |
Parse optional SOLVER_HACK compatibility overrides from input_path. | |
Interface for solver integration in ORB5X.
Refactored from Fortran module interfaceSolverInOrb5 (interfaceSolverInOrb5.F90).
The class mirrors the Fortran module pattern: a single process-wide instance (instance_) holds all module-level state. Static facade methods keep existing call sites unchanged.
| orb5x::InterfaceSolverInOrb5::InterfaceSolverInOrb5 | ( | ) |
Construct an inactive solver interface with no communicator ownership.
| orb5x::InterfaceSolverInOrb5::~InterfaceSolverInOrb5 | ( | ) |
Destroy solver resources and any owned assembly communicator.
|
delete |
Process-wide interface state is noncopyable.
|
static |
Apply the inverse mass matrix in place.
| [in,out] | rhs_f | Fourier coefficient vector replaced by the solution. |
| [in] | globalk | Signed global toroidal mode number. |
|
static |
Solve one Fourier-mode field system in place.
| [in,out] | rhs_f | Fourier RHS replaced by its solution. |
| [in] | globalk | Signed global toroidal mode number. |
| [in] | matnum | Factorized field-matrix selector. |
| void orb5x::InterfaceSolverInOrb5::backsolveMassF | ( | Kokkos::View< Complex * > & | rhs_f, |
| int | globalk | ||
| ) |
Instance implementation of backsolve_mass_f().
| [in,out] | rhs_f | Fourier vector replaced by the inverse-mass result. |
| [in] | globalk | Signed global toroidal mode number. |
| void orb5x::InterfaceSolverInOrb5::backsolveRhsF | ( | Kokkos::View< Complex * > & | rhs_f, |
| int | globalk, | ||
| int | matnum | ||
| ) |
Instance implementation of backsolve_rhs_f().
| [in,out] | rhs_f | Fourier RHS replaced by its solution. |
| [in] | globalk | Signed global toroidal mode number. |
| [in] | matnum | Factorized field-matrix selector. |
|
static |
Compute MPI rank selection and Cartesian-rank mapping for matrix assembly.
| [in] | nphip | Toroidal planes per spatial subdomain. |
| [in] | nfilt1 | Lowest retained toroidal mode. |
| [in] | nfilt2 | Highest retained toroidal mode. |
| [in] | deltan | Mode stride. |
| [in] | nsd | Number of spatial-domain ranks. |
| [out] | loadbalancing_mpi | Selected world/cartesian ranks performing assembly. |
| [out] | rank_cart | Cartesian ranks in communicator order. |
| [out] | nbcart_busy | Number of ranks assigned useful work. |
interfaceSolverInOrb5.F90, lines 213–233.
|
inline |
| void orb5x::InterfaceSolverInOrb5::destroy | ( | ) |
Release all instance-owned solver and communicator resources.
|
static |
Destroy the process-wide solver, basis, filters, matrices, and MPI communicator.
|
static |
Determine rank-local toroidal modes for assembly and backsolve.
| [in] | nphip | Toroidal planes per spatial rank. |
| [in] | nfilt1 | Lowest retained signed toroidal mode. |
| [in] | nfilt2 | Highest retained signed toroidal mode. |
| [in] | deltan | Mode stride. |
| [in] | nz | Number of global toroidal intervals. |
| [in] | color | Assembly load-balancing color. |
| [in] | me_sd | Spatial-domain rank. |
| [out] | isnfiltlocal | Global-mode mask assembled by this color. |
| [out] | isnfiltlocalysolved | Global-mode mask backsolved locally. |
| [out] | nfiltlocal | Packed signed local mode numbers. |
| [out] | NBmodeslocal | Number of packed local modes. |
| [out] | localassembly | Whether this rank participates in matrix assembly. |
interfaceSolverInOrb5.F90, lines 290–315.| void orb5x::InterfaceSolverInOrb5::init | ( | int | nx, |
| int | ny, | ||
| int | nz, | ||
| int | degree, | ||
| int | nfilt1, | ||
| int | nfilt2, | ||
| int | deltan, | ||
| int | dm, | ||
| int | nsel_poisson, | ||
| int | nsel_ampere, | ||
| int | nsel_control_variate, | ||
| int | inner_BC, | ||
| Real | xmin, | ||
| Real | xmax, | ||
| Real | ymin, | ||
| Real | ymax, | ||
| Real | a, | ||
| int | nphip | ||
| ) |
Configure grids, Fourier filters, MPI assembly ranks, and all field matrices.
| [in] | nx | Number of radial intervals. |
| [in] | ny | Number of poloidal intervals. |
| [in] | nz | Number of global toroidal intervals. |
| [in] | degree | B-spline order/number of local nonzero basis functions. |
| [in] | nfilt1 | Lowest retained signed toroidal mode. |
| [in] | nfilt2 | Highest retained signed toroidal mode. |
| [in] | deltan | Toroidal-mode stride. |
| [in] | dm | Half-width of poloidal mode coupling/filtering. |
| [in] | nsel_poisson | Quasineutrality model selector. |
| [in] | nsel_ampere | Ampere model selector. |
| [in] | nsel_control_variate | Control-variate selector. |
| [in] | inner_BC | Inner radial boundary-condition selector. |
| [in] | xmin | Lower radial coordinate. |
| [in] | xmax | Upper radial coordinate. |
| [in] | ymin | Lower poloidal angle [rad]. |
| [in] | ymax | Upper poloidal angle [rad]. |
| [in] | a | Reference minor radius in solver normalization. |
| [in] | nphip | Number of toroidal planes owned by one spatial rank. |
interfaceSolverInOrb5.F90:initNewSolverInOrb5.
|
static |
Initialize the process-wide finite-element field solver.
| [in] | nx | Number of radial intervals. |
| [in] | ny | Number of poloidal intervals. |
| [in] | nz | Number of global toroidal intervals. |
| [in] | degree | B-spline order/number of local nonzero basis functions. |
| [in] | nfilt1 | Lowest retained signed toroidal mode. |
| [in] | nfilt2 | Highest retained signed toroidal mode. |
| [in] | deltan | Toroidal-mode stride. |
| [in] | dm | Half-width of poloidal mode coupling/filtering. |
| [in] | nsel_poisson | Quasineutrality model selector. |
| [in] | nsel_ampere | Ampere model selector. |
| [in] | nsel_control_variate | Control-variate selector. |
| [in] | inner_BC | Inner radial boundary-condition selector. |
| [in] | xmin | Lower radial coordinate. |
| [in] | xmax | Upper radial coordinate. |
| [in] | ymin | Lower poloidal angle [rad]. |
| [in] | ymax | Upper poloidal angle [rad]. |
| [in] | a | Reference minor radius in solver normalization. |
| [in] | nphip | Number of toroidal planes owned by one spatial rank. |
interfaceSolverInOrb5.F90:initNewSolverInOrb5.
|
inline |
|
inline |
true when all solver resources are active.
|
inline |
|
static |
Multiply a Fourier coefficient vector by the mass matrix in place.
| [in,out] | arr_f | Coefficient vector replaced by its mass projection. |
| [in] | globalk | Signed global toroidal mode number. |
| void orb5x::InterfaceSolverInOrb5::multiplyMassF | ( | Kokkos::View< Complex * > & | arr_f, |
| int | globalk | ||
| ) |
Instance implementation of multiply_mass_f().
| [in,out] | arr_f | Fourier vector replaced by its mass projection. |
| [in] | globalk | Signed global toroidal mode number. |
|
inline |
|
inline |
|
inline |
|
delete |
Copy assignment is disabled.
|
static |
Parse optional SOLVER_HACK compatibility overrides from input_path.
All remaining reference arguments are outputs retaining defaults when the namelist or an individual key is absent.
| [in] | input_path | ORB5 input/namelist file path. |
| [in,out] | phase_factor | Field-aligned phase-factor override. |
| [in,out] | force_no_adiabatic | Disable adiabatic response when true. |
| [in,out] | force_no_polarization | Disable polarization response when true. |
| [in,out] | force_no_zonal | Disable zonal response when true. |
| [in,out] | counter_freq | Compatibility diagnostic frequency. |
| [in,out] | old_parallelization | Select the legacy assembly distribution. |
| [in,out] | testcase | Analytic solver test-case selector. |
| [in,out] | oldAvgJac | Select the legacy averaged-Jacobian treatment. |
| [in,out] | internal_boundary | Internal radial-boundary selector. |
| [in,out] | multi_matrix | Multi-matrix configuration selector/count. |
| [in,out] | lapl_boundary_terms | Include explicit Laplacian boundary terms. |
interfaceSolverInOrb5.F90, lines 99–134.
|
inline |
Return the coefficient count used by one backsolve/multiply.
(nx_+degree_-1)*nm_ complex coefficients.