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

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.
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ InterfaceSolverInOrb5() [1/2]

orb5x::InterfaceSolverInOrb5::InterfaceSolverInOrb5 ( )

Construct an inactive solver interface with no communicator ownership.

◆ ~InterfaceSolverInOrb5()

orb5x::InterfaceSolverInOrb5::~InterfaceSolverInOrb5 ( )

Destroy solver resources and any owned assembly communicator.

◆ InterfaceSolverInOrb5() [2/2]

orb5x::InterfaceSolverInOrb5::InterfaceSolverInOrb5 ( const InterfaceSolverInOrb5 &  )
delete

Process-wide interface state is noncopyable.

Member Function Documentation

◆ backsolve_mass_f()

static void orb5x::InterfaceSolverInOrb5::backsolve_mass_f ( Kokkos::View< Complex * > &  rhs_f,
int  globalk 
)
static

Apply the inverse mass matrix in place.

Parameters
[in,out]rhs_fFourier coefficient vector replaced by the solution.
[in]globalkSigned global toroidal mode number.

◆ backsolve_rhs_f()

static void orb5x::InterfaceSolverInOrb5::backsolve_rhs_f ( Kokkos::View< Complex * > &  rhs_f,
int  globalk,
int  matnum 
)
static

Solve one Fourier-mode field system in place.

Parameters
[in,out]rhs_fFourier RHS replaced by its solution.
[in]globalkSigned global toroidal mode number.
[in]matnumFactorized field-matrix selector.

◆ backsolveMassF()

void orb5x::InterfaceSolverInOrb5::backsolveMassF ( Kokkos::View< Complex * > &  rhs_f,
int  globalk 
)

Instance implementation of backsolve_mass_f().

Parameters
[in,out]rhs_fFourier vector replaced by the inverse-mass result.
[in]globalkSigned global toroidal mode number.

◆ backsolveRhsF()

void orb5x::InterfaceSolverInOrb5::backsolveRhsF ( Kokkos::View< Complex * > &  rhs_f,
int  globalk,
int  matnum 
)

Instance implementation of backsolve_rhs_f().

Parameters
[in,out]rhs_fFourier RHS replaced by its solution.
[in]globalkSigned global toroidal mode number.
[in]matnumFactorized field-matrix selector.

◆ computeLoadBalancing()

static void orb5x::InterfaceSolverInOrb5::computeLoadBalancing ( int  nphip,
int  nfilt1,
int  nfilt2,
int  deltan,
int  nsd,
std::vector< int > &  loadbalancing_mpi,
std::vector< int > &  rank_cart,
int &  nbcart_busy 
)
static

Compute MPI rank selection and Cartesian-rank mapping for matrix assembly.

Parameters
[in]nphipToroidal planes per spatial subdomain.
[in]nfilt1Lowest retained toroidal mode.
[in]nfilt2Highest retained toroidal mode.
[in]deltanMode stride.
[in]nsdNumber of spatial-domain ranks.
[out]loadbalancing_mpiSelected world/cartesian ranks performing assembly.
[out]rank_cartCartesian ranks in communicator order.
[out]nbcart_busyNumber of ranks assigned useful work.
Fortran reference interfaceSolverInOrb5.F90, lines 213–233.

◆ degree()

int orb5x::InterfaceSolverInOrb5::degree ( ) const
inline
Returns
B-spline order.

◆ destroy()

void orb5x::InterfaceSolverInOrb5::destroy ( )

Release all instance-owned solver and communicator resources.

◆ destroyNewSolver()

static void orb5x::InterfaceSolverInOrb5::destroyNewSolver ( )
static

Destroy the process-wide solver, basis, filters, matrices, and MPI communicator.

◆ determineLocalModes()

static void orb5x::InterfaceSolverInOrb5::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 
)
static

Determine rank-local toroidal modes for assembly and backsolve.

Parameters
[in]nphipToroidal planes per spatial rank.
[in]nfilt1Lowest retained signed toroidal mode.
[in]nfilt2Highest retained signed toroidal mode.
[in]deltanMode stride.
[in]nzNumber of global toroidal intervals.
[in]colorAssembly load-balancing color.
[in]me_sdSpatial-domain rank.
[out]isnfiltlocalGlobal-mode mask assembled by this color.
[out]isnfiltlocalysolvedGlobal-mode mask backsolved locally.
[out]nfiltlocalPacked signed local mode numbers.
[out]NBmodeslocalNumber of packed local modes.
[out]localassemblyWhether this rank participates in matrix assembly.
Fortran reference interfaceSolverInOrb5.F90, lines 290–315.

◆ init()

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.

Parameters
[in]nxNumber of radial intervals.
[in]nyNumber of poloidal intervals.
[in]nzNumber of global toroidal intervals.
[in]degreeB-spline order/number of local nonzero basis functions.
[in]nfilt1Lowest retained signed toroidal mode.
[in]nfilt2Highest retained signed toroidal mode.
[in]deltanToroidal-mode stride.
[in]dmHalf-width of poloidal mode coupling/filtering.
[in]nsel_poissonQuasineutrality model selector.
[in]nsel_ampereAmpere model selector.
[in]nsel_control_variateControl-variate selector.
[in]inner_BCInner radial boundary-condition selector.
[in]xminLower radial coordinate.
[in]xmaxUpper radial coordinate.
[in]yminLower poloidal angle [rad].
[in]ymaxUpper poloidal angle [rad].
[in]aReference minor radius in solver normalization.
[in]nphipNumber of toroidal planes owned by one spatial rank.
Fortran reference interfaceSolverInOrb5.F90:initNewSolverInOrb5.

◆ initNewSolverInOrb5()

static void orb5x::InterfaceSolverInOrb5::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 
)
static

Initialize the process-wide finite-element field solver.

Parameters
[in]nxNumber of radial intervals.
[in]nyNumber of poloidal intervals.
[in]nzNumber of global toroidal intervals.
[in]degreeB-spline order/number of local nonzero basis functions.
[in]nfilt1Lowest retained signed toroidal mode.
[in]nfilt2Highest retained signed toroidal mode.
[in]deltanToroidal-mode stride.
[in]dmHalf-width of poloidal mode coupling/filtering.
[in]nsel_poissonQuasineutrality model selector.
[in]nsel_ampereAmpere model selector.
[in]nsel_control_variateControl-variate selector.
[in]inner_BCInner radial boundary-condition selector.
[in]xminLower radial coordinate.
[in]xmaxUpper radial coordinate.
[in]yminLower poloidal angle [rad].
[in]ymaxUpper poloidal angle [rad].
[in]aReference minor radius in solver normalization.
[in]nphipNumber of toroidal planes owned by one spatial rank.
Fortran reference interfaceSolverInOrb5.F90:initNewSolverInOrb5.

◆ innerBC()

int orb5x::InterfaceSolverInOrb5::innerBC ( ) const
inline
Returns
Inner boundary-condition selector.

◆ isInitialized()

bool orb5x::InterfaceSolverInOrb5::isInitialized ( ) const
inline
Returns
true when all solver resources are active.

◆ multiMatrix()

int orb5x::InterfaceSolverInOrb5::multiMatrix ( ) const
inline
Returns
Multi-matrix configuration selector/count.

◆ multiply_mass_f()

static void orb5x::InterfaceSolverInOrb5::multiply_mass_f ( Kokkos::View< Complex * > &  arr_f,
int  globalk 
)
static

Multiply a Fourier coefficient vector by the mass matrix in place.

Parameters
[in,out]arr_fCoefficient vector replaced by its mass projection.
[in]globalkSigned global toroidal mode number.

◆ multiplyMassF()

void orb5x::InterfaceSolverInOrb5::multiplyMassF ( Kokkos::View< Complex * > &  arr_f,
int  globalk 
)

Instance implementation of multiply_mass_f().

Parameters
[in,out]arr_fFourier vector replaced by its mass projection.
[in]globalkSigned global toroidal mode number.

◆ nm()

int orb5x::InterfaceSolverInOrb5::nm ( ) const
inline
Returns
Retained poloidal-mode count.

◆ nx()

int orb5x::InterfaceSolverInOrb5::nx ( ) const
inline
Returns
Radial interval count.

◆ ny()

int orb5x::InterfaceSolverInOrb5::ny ( ) const
inline
Returns
Poloidal interval count.

◆ operator=()

InterfaceSolverInOrb5 & orb5x::InterfaceSolverInOrb5::operator= ( const InterfaceSolverInOrb5 &  )
delete

Copy assignment is disabled.

◆ readSolverHackNamelist()

static void orb5x::InterfaceSolverInOrb5::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 
)
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.

Parameters
[in]input_pathORB5 input/namelist file path.
[in,out]phase_factorField-aligned phase-factor override.
[in,out]force_no_adiabaticDisable adiabatic response when true.
[in,out]force_no_polarizationDisable polarization response when true.
[in,out]force_no_zonalDisable zonal response when true.
[in,out]counter_freqCompatibility diagnostic frequency.
[in,out]old_parallelizationSelect the legacy assembly distribution.
[in,out]testcaseAnalytic solver test-case selector.
[in,out]oldAvgJacSelect the legacy averaged-Jacobian treatment.
[in,out]internal_boundaryInternal radial-boundary selector.
[in,out]multi_matrixMulti-matrix configuration selector/count.
[in,out]lapl_boundary_termsInclude explicit Laplacian boundary terms.
Fortran reference interfaceSolverInOrb5.F90, lines 99–134.

◆ subarraySize()

int orb5x::InterfaceSolverInOrb5::subarraySize ( ) const
inline

Return the coefficient count used by one backsolve/multiply.

Returns
(nx_+degree_-1)*nm_ complex coefficients.

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