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

Generate and manage gyroaveraging points around particle guiding centers. More...

#include "larmor.hpp"

Static Public Member Functions

static void advance_atts_offset (int isp)
 Advance one offset by atts_npart.
 
static void advance_atts_offset_disp ()
 Advance every offset by its last represented-particle count.
 
static void assign_larmor_atts (int isp, int lnaveg, Real alp, Real rhog, Real sigma, Real chi, Real phi, Real wgc, Real pzomgc, int larmor_start, Kokkos::View< Real **, Kokkos::LayoutLeft, Kokkos::HostSpace > *atts_host_override=nullptr)
 Fill one guiding center's ring of gyropoint attributes.
 
static void destroyStaticViews ()
 Release all static Kokkos storage before Kokkos::finalize().
 
static MarkerType & get_marker_type (int isp)
 Access mutable per-species gyropoint storage.
 
static SortingClass * get_sorting (int isp)
 Access a species' optional spatial sorter.
 
static const Kokkos::View< Real ** > & get_zcos2_view ()
 Access cosine ring-phase table.
 
static const Kokkos::View< Real ** > & get_zsin2_view ()
 Access sine ring-phase table.
 
static void init_larmor (int step)
 Perform staged Larmor-module initialization.
 
static void initlarmor (int step)
 Fortran-compatible alias of init_larmor().
 
static void reallocate_larmor (int isp)
 Replace a species' arrays and sorter with larger empty storage.
 
static void reset_atts_offset (int isp)
 Reset one species' particle-batch offset.
 
static void reset_atts_offset_disp ()
 Reset particle-batch offsets for every species to zero.
 
static void set_larmor_max (int isp, int larmor_index, int np)
 Set initial capacity from a predicted gyropoint count.
 
static void set_n_larmor_tot (int isp, int larmor_index, int np)
 Store active gyropoint and represented-particle counts.
 
static bool should_enlarge_larmor (int isp)
 Test whether a species is approaching gyropoint capacity.
 
static void sort_larmor_points ()
 Build and apply spatial sorting for every eligible kinetic species.
 

Static Public Attributes

static int CdC_ATT
 One-based d(chi_point)/d(chi_GC) column.
 
static int CdS_ATT
 One-based d(chi_point)/d(sigma_GC) column.
 
static int CHI_ATT
 One-based gyropoint chi column [rad].
 
static int FIELD_ATT
 One-based base field column, followed by three gradients.
 
static int N_ATTS
 Runtime attribute-column count (12 electrostatic, 13 EM).
 
static int PHI_ATT
 One-based gyropoint phi column [rad].
 
static int SdC_ATT
 One-based d(sigma_point)/d(chi_GC) column.
 
static int SdS_ATT
 One-based d(sigma_point)/d(sigma_GC) column.
 
static int SIG_ATT
 One-based gyropoint sigma column.
 
static int WCF_ATT
 One-based current weight, or zero in electrostatic runs.
 
static int WGT_ATT
 One-based per-gyropoint weight column.
 

Detailed Description

Generate and manage gyroaveraging points around particle guiding centers.

LarmorModule converts guiding-center (sigma,chi,phi) coordinates and a normalized gyroradius into uniformly phased ring points. It stores the coordinate-map derivatives needed by field gather/deposition and divides guiding-center weights across the ring. Drift-kinetic species bypass this storage; gyrokinetic species may optionally sort points in (sigma,chi,phi) for locality.

Member Function Documentation

◆ advance_atts_offset()

static void orb5x::LarmorModule::advance_atts_offset ( int  isp)
static

Advance one offset by atts_npart.

Parameters
[in]ispZero-based species index.

◆ advance_atts_offset_disp()

static void orb5x::LarmorModule::advance_atts_offset_disp ( )
static

Advance every offset by its last represented-particle count.

◆ assign_larmor_atts()

static void orb5x::LarmorModule::assign_larmor_atts ( int  isp,
int  lnaveg,
Real  alp,
Real  rhog,
Real  sigma,
Real  chi,
Real  phi,
Real  wgc,
Real  pzomgc,
int  larmor_start,
Kokkos::View< Real **, Kokkos::LayoutLeft, Kokkos::HostSpace > *  atts_host_override = nullptr 
)
static

Fill one guiding center's ring of gyropoint attributes.

Parameters
[in]ispZero-based species index.
[in]lnavegNumber of uniformly spaced ring points.
[in]alpGyrophase offset [rad].
[in]rhogNormalized gyroradius used with equilibrium mapping coefficients.
[in]sigmaGuiding-center radial coordinate.
[in]chiGuiding-center poloidal angle [rad].
[in]phiGuiding-center toroidal angle [rad].
[in]wgcGuiding-center deposition/gather weight, divided by lnaveg.
[in]pzomgcParallel canonical momentum factor multiplying current weight.
[in]larmor_startZero-based first output row.
[in,out]atts_host_overrideOptional host matrix to fill instead of the species' device-backed storage.

Invalid species, non-positive ring size, out-of-table sizes, and empty clipped row ranges return without modification.

◆ destroyStaticViews()

static void orb5x::LarmorModule::destroyStaticViews ( )
static

Release all static Kokkos storage before Kokkos::finalize().

◆ get_marker_type()

static MarkerType & orb5x::LarmorModule::get_marker_type ( int  isp)
static

Access mutable per-species gyropoint storage.

Parameters
[in]ispZero-based species index.
Returns
Reference to the species storage.
Exceptions
std::runtime_errorFor an invalid index.

◆ get_sorting()

static SortingClass * orb5x::LarmorModule::get_sorting ( int  isp)
static

Access a species' optional spatial sorter.

Parameters
[in]ispZero-based species index.
Returns
Sorter pointer, possibly null when sorting/species gyration is disabled.
Exceptions
std::runtime_errorFor an invalid index.

◆ get_zcos2_view()

static const Kokkos::View< Real ** > & orb5x::LarmorModule::get_zcos2_view ( )
static

Access cosine ring-phase table.

Returns
Read-only View [point][ring size-1] sharing module storage.

◆ get_zsin2_view()

static const Kokkos::View< Real ** > & orb5x::LarmorModule::get_zsin2_view ( )
static

Access sine ring-phase table.

Returns
Read-only View [point][ring size-1] sharing module storage.

◆ init_larmor()

static void orb5x::LarmorModule::init_larmor ( int  step)
static

Perform staged Larmor-module initialization.

Parameters
[in]step1 creates per-species containers; 2 builds angle tables, runtime attribute indices, storage, and optional sorters.
Exceptions
std::runtime_errorIf navg_max or a required species capacity is non-positive during step 2.

Referenced by initlarmor().

◆ initlarmor()

static void orb5x::LarmorModule::initlarmor ( int  step)
inlinestatic

Fortran-compatible alias of init_larmor().

Parameters
[in]stepInitialization stage.

References init_larmor().

◆ reallocate_larmor()

static void orb5x::LarmorModule::reallocate_larmor ( int  isp)
static

Replace a species' arrays and sorter with larger empty storage.

Parameters
[in]ispZero-based species index; invalid indices are ignored.
Warning
Existing gyropoint attributes are discarded, so call only before refill.

◆ reset_atts_offset()

static void orb5x::LarmorModule::reset_atts_offset ( int  isp)
static

Reset one species' particle-batch offset.

Parameters
[in]ispZero-based species index.

◆ reset_atts_offset_disp()

static void orb5x::LarmorModule::reset_atts_offset_disp ( )
static

Reset particle-batch offsets for every species to zero.

◆ set_larmor_max()

static void orb5x::LarmorModule::set_larmor_max ( int  isp,
int  larmor_index,
int  np 
)
static

Set initial capacity from a predicted gyropoint count.

Parameters
[in]ispZero-based species index.
[in]larmor_indexPredicted active gyropoints.
[in]npRepresented guiding-center count.
Note
Capacity is floor(larmor_index*larmor_size_margin).

◆ set_n_larmor_tot()

static void orb5x::LarmorModule::set_n_larmor_tot ( int  isp,
int  larmor_index,
int  np 
)
static

Store active gyropoint and represented-particle counts.

Parameters
[in]ispZero-based species index.
[in]larmor_indexActive gyropoint count.
[in]npGuiding-center particle count represented by this batch.

◆ should_enlarge_larmor()

static bool orb5x::LarmorModule::should_enlarge_larmor ( int  isp)
static

Test whether a species is approaching gyropoint capacity.

Parameters
[in]ispZero-based species index.
Returns
True above the configured warning threshold; false for invalid indices.

◆ sort_larmor_points()

static void orb5x::LarmorModule::sort_larmor_points ( )
static

Build and apply spatial sorting for every eligible kinetic species.

Exceptions
std::runtime_errorFor missing sorters or negative active counts.

Member Data Documentation

◆ CdC_ATT

int orb5x::LarmorModule::CdC_ATT
static

One-based d(chi_point)/d(chi_GC) column.

◆ CdS_ATT

int orb5x::LarmorModule::CdS_ATT
static

One-based d(chi_point)/d(sigma_GC) column.

◆ CHI_ATT

int orb5x::LarmorModule::CHI_ATT
static

One-based gyropoint chi column [rad].

◆ FIELD_ATT

int orb5x::LarmorModule::FIELD_ATT
static

One-based base field column, followed by three gradients.

◆ N_ATTS

int orb5x::LarmorModule::N_ATTS
static

Runtime attribute-column count (12 electrostatic, 13 EM).

◆ PHI_ATT

int orb5x::LarmorModule::PHI_ATT
static

One-based gyropoint phi column [rad].

◆ SdC_ATT

int orb5x::LarmorModule::SdC_ATT
static

One-based d(sigma_point)/d(chi_GC) column.

◆ SdS_ATT

int orb5x::LarmorModule::SdS_ATT
static

One-based d(sigma_point)/d(sigma_GC) column.

◆ SIG_ATT

int orb5x::LarmorModule::SIG_ATT
static

One-based gyropoint sigma column.

◆ WCF_ATT

int orb5x::LarmorModule::WCF_ATT
static

One-based current weight, or zero in electrostatic runs.

◆ WGT_ATT

int orb5x::LarmorModule::WGT_ATT
static

One-based per-gyropoint weight column.


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