Own particle state and orchestrate marker loading, push, migration, and deposition. More...
#include "part.hpp"
Collaboration diagram for orb5x::ParticleModule:Public Member Functions | |
| Real | b_star (Real st, Real chit, Real b, Real ut, Real tprime, Real addpBst, int isp) |
Evaluate the normalized guiding-center B* denominator. | |
| void | bcpart (int isp, bool run_on_device) |
| Apply radial and toroidal boundary conditions to one species. | |
| void | bcpart_disp (bool run_on_device) |
| Apply particle boundary conditions to all kinetic species. | |
| void | calc_dist (int isp, Real sigmat, Real chit, Real ut, Real mu, Real psi0_corr, Real &distribution, Real *bst=nullptr, Real *dist_coeff=nullptr, Real *diff_t_vpll=nullptr) |
| Evaluate the represented distribution at one phase-space point. | |
| void | charge_deposition_passing_electrons_disp (int isp, const int *lb, const int *ub, Kokkos::View< Real ** > &rho_passing) |
| Deposit the passing-electron adiabatic response on a 2-D mesh. | |
| void | check_ffinit (int isp) |
| Validation routine for FFINIT consistency Matching Fortran part.F90 lines 1497-1514. | |
| void | compute_all_larmor_positions (int isp) |
| Fill all gyropoint positions for one species. | |
| void | compute_all_larmor_positions_disp (bool comp_dk) |
| Fill Larmor-point positions for all eligible species. | |
| void | compute_moments_3d (int isp) |
| Compute all configured three-dimensional moments for one species. | |
| void | compute_psi0_corr_disp (bool flag) |
| Compute canonical-Maxwellian flux corrections for all species. | |
| void | compute_reduced_weights (int isp, const Kokkos::View< Real ** > &pic1_loc, const Kokkos::View< Real ** > &pic2_loc, const Kokkos::View< bool ** > &pic3_loc, const Kokkos::View< int * > &npart_view, int nsel_att) |
| Compute reduced deposition weights from explicit marker arrays. | |
| void | compute_reduced_weights_disp (int isp, int nsel_att) |
| Dispatch control-variate weight reduction for a species. | |
| void | deposit_bsplines (int isp, int npart_loc, const Kokkos::View< Real ** > &pic1_loc, const Kokkos::View< Real ** > &pic2_loc) |
| Deposit markers into PSZS tensor-product spline coordinates. | |
| void | diagnose_particles (int isp) |
| Compute configured particle moments for one species. | |
| void | gauss_list_init (int isp, Kokkos::View< Real ** > &pert_table, int &nperts) |
| Gaussian perturbation list loading from file Matching Fortran part.F90 lines 8330-8355. | |
| void | get_field_disp (const FieldType &field, int istep, bool nl_main_substep, int i_att) |
| Gather one field and its gradients to all guiding centers/gyropoints. | |
| Real | get_KE (int isp) |
| Sum normalized kinetic energy over one local species. | |
| void | get_larmor_indices_disp (bool initflag=false, bool adapt_only=false) |
| Compute Larmor ring sizes/offsets for all eligible species. | |
| void | get_pos (int isp, int ip, Real *pos) |
| Return one marker's physical position coordinates. | |
| void | get_properties (int isp, int ip, Real *props) |
| Fill the standard property vector for one stored marker. | |
| void | get_toroidal_momentum (int isp, Real st, Real chit, Real ut, Real mut, Real psi_correction, Real tsubB, Real &psit_prof, Real &psit_pot) |
| Compute canonical flux labels used by profiles and potential terms. | |
| Real | get_vpaob_ba (Real psi, Real mu, Real en, Real v_pll, int isp) |
| Get bounce-averaged v_parallel/B from precomputed lookup table. | |
| void | grid_pic (int isp, bool run_on_device) |
| Deposit the configured primary quantity for one species. | |
| void | grid_pic (int isp, int nsel_att, bool reduce_flag, const int *lb, const int *ub, Kokkos::View< Real ***, Kokkos::LayoutStride > assign1, int i_att) |
| Charge/current deposition on grid (matching Fortran grid_pic, part.F90 lines 7771-7920) | |
| void | grid_pic_diagnostic (int isp, int nsel_att, const int *lb, const int *ub, Kokkos::View< Real *** > &assign1) |
| Diagnostic charge/current deposition on grid (matching Fortran grid_pic_diagnostic, part.F90 lines 8190-8272) | |
| void | helical_flux_label (Real sigmat, Real xiang, int &irloc, Real &dr_flux_inv, int &ipol) |
| Map a marker to magnetic-island radial and poloidal diagnostic bins. | |
| void | init_particles () |
| Allocate particle storage and build bounce-averaged momentum tables. | |
| void | init_push_diagnostics () |
| Initialize bin measures and scratch used by in-push diagnostics. | |
| void | init_test_particles (int isp) |
| Allocate test-particle state for one species. | |
| void | l5_auto_init (int isp, Kokkos::View< Real ** > &l5_s_array) |
| LIGKA mode automatic initialization Matching Fortran part.F90 lines 8284-8328. | |
| void | load_particles () |
| Generate or restore the initial marker distribution for every species. | |
| void | load_test_particles (int isp) |
| Load configured test-particle initial conditions for one species. | |
| void | parmove (int iter, bool run_on_device, bool work1flag, bool work2flag, bool work3flag=false, bool work5flag=false, bool work6flag=false, bool work7flag=false, bool work8flag=false, bool work9flag=false) |
| Migrate every species and selected work arrays across toroidal domains. | |
| void | part_grid (int isp, int nsel_att, bool reduce_flag, int i_att, const int *lb, const int *ub, Kokkos::View< Real ***, Kokkos::LayoutStride > assign1, Kokkos::View< Real ** > *assign1_passing=nullptr) |
| Charge or current deposition wrapper routine Matching Fortran part.F90 lines 8698-8727 (external part_grid subroutine) | |
| ParticleModule ()=default | |
| Construct an uninitialized particle owner. | |
| void | postpush_disp () |
| Run post-push full-f updates for all applicable species. | |
| void | postpush_fullf (int isp) |
| Recompute full-f weights after a push for one species. | |
| void | print_test_particles (int step) |
| Emit configured test-particle diagnostics for a timestep. | |
| void | pszs_calc () |
| Dispatch phase-space zonal-structure accumulation. | |
| void | pszs_setboundaries (int isp, Real *lb, Real *ub) |
| PSZS boundary setup from particle distribution Matching Fortran part.F90 lines 8442-8549 Sets up boundaries for Phase Space Zone Sampling diagnostics. | |
| void | pullback () |
| Convert mixed-variable electromagnetic particle state to symplectic form. | |
| void | push_disp (int iter) |
| Advance all kinetic species through one configured push substep. | |
| Real | q_of_s (Real s) |
| Evaluate the equilibrium safety factor at normalized radius s. | |
| void | quadtree_smoothing_disp () |
| Apply configured phase-space quadtree smoothing to all species. | |
| void | quadtree_smoothing_interface (int isp, bool diagnose_) |
| Smooth one species and optionally populate smoothing diagnostics. | |
| void | read_write_particle_data (int flag, int datn) |
| Read or write particle checkpoint state. | |
| void | set_weights_to_zero_at_t0 () |
| Set perturbation weights to zero at the initial time when configured. | |
| void | sort_gc_2D_disp () |
| Sort guiding centers in the radial/poloidal plane. | |
| void | sort_gc_3D_disp () |
| Sort guiding centers in local three-dimensional spatial bins. | |
| void | str_diagnostic_start () |
| Initialize strong flow diagnostic output files Matching Fortran part.F90 lines 4726-4750 Opens output files for psi, energy, kappa, rhs diagnostics. | |
| void | strong_diagnostic_output (int isp, int ip, Real psi0t, Real temp2, Real ze, Real vecrossb_f2, Real pot_equil, Real zf0, Real zvth2_inv, Real dpotdpsi, Real vdr, Real rhs) |
| Record per-marker quantities used to inspect the strong-flow model. | |
| void | test_particle_output (int isp, int ip, Real psi0t, Real ze, Real pot_equil, Real wt, Real zvth2, Real nval, Real pvol, Real zf0) |
| Store the configured diagnostic record for one test marker. | |
| void | trap_detrap_disp () |
| Update trapped/passing state transitions for all applicable species. | |
| void | unsort_gc_3D_disp () |
| Restore drift-kinetic marker arrays to their pre-sort order. | |
| void | update_ffinit_or_pvol () |
| Refresh stored initial-f or phase-volume values after weight changes. | |
| bool | uses_modified_toroidal_momentum (int isp) const |
| Test whether a species uses a modified canonical momentum definition. | |
| void | vpa_quants (Real psi, Real mu, Real en_star, Real v_pll, int isp, Real &fvpllb, Real &dfvpllb_den, Real &dfvpllb_dpsi) |
Interpolate bounce-averaged v_parallel/B and its derivatives. | |
| ~ParticleModule () | |
| Release owned sorters and Kokkos-view containers. | |
Static Public Member Functions | |
| static void | compute_deposition_attributes_dk (const Kokkos::View< Real * > &u, const Kokkos::View< Real * > &w, Kokkos::View< Real * > &uw, int n) |
| Compute deposition attributes for drift-kinetic models Matching Fortran part.F90 lines 2717-2733. | |
| static Real | compute_psi0_corr_one_particle (int isp, Real st, Real chit, Real mut, Real ut) |
| Compute one marker's canonical-Maxwellian flux correction. | |
| static Real | compute_vf0 (int isp, Real zvth2, Real nval, Real ze, Real zecor, Real b, Real pot_equil, Real pot_equil0, Real psit, Real ut, Real mut) |
| Compute equilibrium distribution function f0. | |
| static std::vector< Real > | cross_product (const std::vector< Real > &a, const std::vector< Real > &b) |
| Form the Cartesian cross product of two three-component vectors. | |
| static void | destroyStaticViews () |
Release file-scope static Kokkos Views before Kokkos::finalize(). | |
| static void | distrib_2D_loadRZ (const std::vector< Real > &rev2, const std::vector< Real > &rev3, const std::vector< std::vector< Real > > &prob, const std::vector< Real > &xg, const std::vector< Real > &yg, const std::vector< Real > &fdistx, Real dx, Real dy, std::vector< Real > &xp, std::vector< Real > &yp) |
| Invert a precomputed 2-D loading distribution. | |
| static void | get_dist_derivs (Real f0, Real ut, Real mut, Real b, Real epsilon_hat, Real ze, Real zvth2, Real nval, Real Epsi, Real psit, Real ngrad, Real tgrad, Real, Real, int isp, Real &df0_dek, Real &df0_du, Real &df0_dpsi_prof, Real &df0_dchi_prof, Real &df0_dpsi_pot, Real zecor, Real pot_equil, Real pot_equil0, Real chit) |
| Differentiate the configured equilibrium distribution. | |
| static int | get_i_cantormom (int isp) |
| Return the pic2 column containing canonical toroidal momentum. | |
| static Real | get_kinetic_energy (Real ut, Real mut, Real b) |
Return normalized kinetic energy u^2/2 + mu*B. | |
| static int | get_n_larmor_pts (int isp, int nsel_gyr_local, Real rhog) |
| Select the ring-point count for one gyroradius. | |
| static Real | get_properties_en (int isp, Real st, Real chit, Real ut, Real mut, Real vpval) |
| Compute the energy-like marker property used by get_properties(). | |
| static void | get_rhs (int ip, int isp, Real pvol, Real vdr, Real vdchi, const std::vector< Real > &vgc, const std::vector< Real > &vin, Real vpval, const std::vector< Real > &genelec, Real dvpadt0, Real dvpadt1, Real gyroapar, Real ze, Real zecor, Real dH0_dt_correction, Real pot_equil, Real pot_equil0, Real distribution, Real ut, Real mut, Real b, Real zvth2, Real nval, Real Epsi, Real psi0t, Real ngrad, Real tgrad, Real vpgrad, Real dfvpllb_dpsi, Real dfvpllb_den, Real &rhs, Real &dpotdpsi, Real &omegasq_corr, Real &df0_dpsi_prof, Real &df0_dchi_prof, Real &dpsi_prof_dt, Real &dchi_prof_dt, int rhs_type, const std::vector< Real > &mgradphi, const std::vector< Real > &vgb, const std::vector< Real > &vpressure, const std::vector< Real > &mgradapar, const std::vector< Real > &hh_sympl, Real chit, Real dchi_dt1, int iter, Real ffinit, Real dPsidt0) |
| Assemble the selected delta-f weight-equation right-hand side. | |
| static void | init_distrib_2D_loadRZ (FieldsVariables *fields, Real lenx, Real leny, int isp, std::vector< std::vector< Real > > &prob, std::vector< Real > &xg, std::vector< Real > &yg, std::vector< Real > &fdistx, Real &dx, Real &dy) |
Build the cumulative 2-D (R,Z) loading distribution. | |
| static void | perp_curl_ue (Real s, Real chi, Real &smodstar, Real &chimodstar, Real &phimodstar) |
| Evaluate the perpendicular electron-flow curl projection. | |
| static Real | reverse_hammersley (int nbase, int64_t i) |
| Compute a radical-inverse element of a Hammersley sequence. | |
| static void | strong_flow_terms (int isp, Real sigmat, Real chit, Real bstar_inv, const std::vector< Real > &genelec, Real pztomobstar, const std::vector< Real > &bgrb, const std::vector< Real > &addp, Real expt_back, Real eypt_back, const std::vector< Real > &exh, Real ut, Real mut, const std::vector< Real > &hh, Real &dvpadt1_str, Real &dvpadt0_str, std::vector< Real > &vgc) |
Add equilibrium-E x B strong-flow terms to the characteristics. | |
| static Real | vf0 (int isp, Real zvth2, Real nval, Real ze, Real zecor, Real b, Real pot_equil, Real pot_equil0, Real psit, Real ut, Real mut, int nsel_f0_override=-1) |
| Evaluate the selected normalized equilibrium distribution f0. | |
| static Real | vf0_chi_prof (Real zf0, Real, Real, Real ze, Real, Real, Real, Real, Real ut, Real, Real psit, int isp, Real zvth2, Real nval, Real zecor, Real pot_equil, Real pot_equil0, Real mut, Real chit) |
| Evaluate the poloidal-profile derivative of f0. | |
| static Real | vf0_local_maxwellian_simple (Real zvth2, Real nval, Real ze) |
| Evaluate a local Maxwellian from thermal scale, density, and energy. | |
| static Real | vf0_psi_prof (Real zf0, Real ngrad, Real epsilon_hat, Real ze, Real b, Real kappa_str, Real zvth2_inv, Real tgrad, Real ut, Real psi0_inv, Real psit, int isp, Real zvth2, Real nval, Real zecor, Real pot_equil, Real pot_equil0, Real mut, Real chit) |
| Evaluate the radial-profile derivative of f0. | |
| static Real | vf0dek (Real zf0, Real zvth2, Real ze, Real psit, int isp, Real nval, Real zecor, Real b, Real pot_equil, Real pot_equil0, Real ut, Real mut, Real chit) |
Evaluate df0/dE for the configured distribution family. | |
| static Real | vf0du (Real zf0, Real ut, Real, Real zvth2, Real nval, Real psit, int isp, Real ze, Real zecor, Real pot_equil, Real pot_equil0, Real mut, Real chit) |
Evaluate df0/du for the configured distribution family. | |
| static Real | ze_correction (Real ut, Real vpval) |
| Return the mixed-coordinate kinetic-energy correction. | |
Public Attributes | |
| Kokkos::View< Real * > | bin_surf_inv |
| Inverse diagnostic surface measure by radial bin. | |
| Kokkos::View< Real * > | bin_vol_inv |
| Inverse diagnostic volume by radial bin. | |
| Kokkos::View< Complex *** > | cfield_out_3D |
| Complex three-dimensional particle-moment field. | |
| Kokkos::View< Complex *** > | cfield_out_3D_fft |
| Fourier representation of 3-D moment field. | |
| Kokkos::View< Real * > | dens0 |
Marker density normalization nptot/volanu by species. | |
| Real | dmu_bin = 0.0 |
| Magnetic-moment bin spacing. | |
| Real | dmu_bin_2 = 0.0 |
| Half magnetic-moment bin spacing. | |
| Real | dpsi_bin = 0.0 |
| Normalized flux-bin spacing. | |
| Real | dr_flux_inv = 0.0 |
| Inverse radial diagnostic-bin width. | |
| Real | dth_inv = 0.0 |
| Inverse poloidal diagnostic-bin width [rad^-1]. | |
| Real | ftrap = 0.0 |
| Trapped-particle fraction from the most recent loading calculation. | |
| std::vector< Real > | integral_f0_global |
| Monte-Carlo estimate of integrated equilibrium f0. | |
| int | irloc_in = 0 |
| Cached inner radial diagnostic-bin index. | |
| int | lb_wx = 0 |
| Lowest spline work-column offset. | |
| int | MAX_PIC2 = 0 |
| Number of time-independent real particle properties. | |
| int | MAX_PIC5 = 0 |
| Single-precision diagnostic-property count. | |
| int | MAX_WORK = 0 |
| Number of columns allocated in primary real work arrays. | |
| int | MAX_WORK_FIELDS = 0 |
| Leading work columns reserved for gathered fields. | |
| int | MAX_WORK_REV = 0 |
| Columns in temporary reduced-weight work storage. | |
| std::vector< Moments3DClass > | moments_3d_array |
| Configured 3-D moment metadata. | |
| Real | mu_max = 0.0 |
| Upper normalized magnetic-moment lookup bound. | |
| Real | mu_min = 0.0 |
| Lower normalized magnetic-moment lookup bound. | |
| std::vector< Real > | mumax_global |
| Global maximum loaded normalized magnetic moment. | |
| Kokkos::View< Real ** > | n_vel_1D |
| Velocity-space marker histogram by species/bin. | |
| Kokkos::View< Real ** > | n_vel_trap_1D |
| Trapped-marker velocity histogram. | |
| int | NBIN_MU_F0 = 0 |
| Number of magnetic-moment bins in f0/momentum tables. | |
| int | NLARM_PIC2 = 0 |
| pic2 column storing each marker's Larmor-ring size. | |
| Kokkos::View< int * > | npart |
| Active local marker count by zero-based species. | |
| Kokkos::View< int * > | npmx |
| Allocated local marker capacity by species. | |
| Kokkos::View< Real * > | nptot_inv |
| Reciprocal total marker count by species. | |
| Kokkos::View< int * > | ntest |
| Number of test particles by species. | |
| int | ntrap = 0 |
| Trapped marker count from the most recent calculation. | |
| int | num_mesh = 0 |
| Total quadtree mesh-cell count. | |
| std::vector< PointerMarkers > | pic1 |
| Evolving marker coordinates, velocity, and weights by species. | |
| std::vector< PointerMarkers > | pic2 |
| Time-independent invariants/loading data by species. | |
| std::vector< PointerMarkersLogic > | pic3 |
| Logical marker state such as trapping flags. | |
| std::vector< PointerMarkersI8 > | pic4 |
| 64-bit marker identifiers. | |
| std::vector< PointerMarkersR4 > | pic5 |
| Single-precision diagnostic marker moments. | |
| std::vector< PointerMarkers > | pion_1 |
| Saved ion marker state used by selected algorithms. | |
| Kokkos::View< Real * > | ppsum_buff_real |
| Contiguous scratch for MPI real reductions. | |
| Real | psi0_inv = 0.0 |
| Inverse reference flux used by profile diagnostics. | |
| Real | psi_max = 1.0 |
| Upper normalized flux bound of momentum lookup tables. | |
| Real | psi_min = 0.0 |
| Lower normalized flux bound of momentum lookup tables. | |
| int | qt_num_chi = 0 |
| Quadtree poloidal-cell count. | |
| int | qt_num_s = 0 |
| Quadtree radial-cell count. | |
| Kokkos::View< bool * > | qt_toggle_flag |
| Per-species alternating smoothing-pass flag. | |
| std::vector< PointerQuadtree > | qtree |
| Per-species quadtree smoothing storage. | |
| Kokkos::View< Real *** > | rho_passing_omp |
| Per-thread passing-electron deposition scratch. | |
| std::vector< std::unique_ptr< SortingClass > > | sortings |
| Guiding-center sorter owned per species. | |
| std::vector< Real > | sum_ekin_markers_global |
| Global marker total kinetic-energy sum. | |
| std::vector< Real > | sum_pekin_markers_global |
| Global marker parallel kinetic-energy sum. | |
| Kokkos::View< Real * > | Total_weight |
| Local/global-normalized total marker weight by species. | |
| int | ub_wx = 0 |
| Highest spline work-column offset. | |
| std::vector< Real > | umax_global |
| Global maximum loaded parallel velocity by species. | |
| std::vector< Real > | umin_global |
| Global minimum loaded parallel velocity by species. | |
| Kokkos::View< Real ** > | vpbi |
| Interpolation table and derivative data for vpa_quants(). | |
| Kokkos::View< Real **, Kokkos::LayoutLeft, Kokkos::HostSpace > | vpbi_host_cache |
| Host cache of vpbi. | |
| Kokkos::View< Real ** > | vpll_momentum_bins |
| Bounce-averaged v_parallel/B table by phase-space bin. | |
| Kokkos::View< Real **, Kokkos::LayoutLeft, Kokkos::HostSpace > | vpll_momentum_bins_host_cache |
| Host cache of momentum table. | |
| std::vector< PointerMarkers > | work1 |
| Primary push/gather workspace by species. | |
| std::vector< PointerMarkers > | work2 |
| Secondary push/gather workspace by species. | |
| std::vector< PointerMarkers > | work3 |
| GL4 stage workspace. | |
| std::vector< PointerMarkers > | work5 |
| GL4 stage workspace. | |
| std::vector< PointerMarkers > | work6 |
| GL4 stage workspace. | |
| std::vector< PointerMarkers > | work7 |
| GL4 stage workspace. | |
| std::vector< PointerMarkers > | work8 |
| GL4 stage workspace. | |
| std::vector< PointerMarkers > | work9 |
| GL4 stage workspace. | |
| std::vector< PointerMarkers > | work_rev |
| Reduced-weight/reversal workspace, allocated on demand. | |
| std::vector< PointerMarkers > | work_temp |
| Temporary per-marker workspace. | |
| std::vector< Real > | zsmax_global |
| Global maximum loaded radial coordinate s. | |
| std::vector< Real > | zsum_global |
| Global phase-space-volume sum by species. | |
Static Public Attributes | |
| static constexpr int | qt_num_s_per_ns = 2 |
| Quadtree radial refinement per field interval. | |
Own particle state and orchestrate marker loading, push, migration, and deposition.
One ParticleModule manages all configured species. Species and particle indices are zero-based in C++; property constants from prec_const.hpp are also used as zero-based columns. Marker values follow ORB5X normalization: s=sqrt(psi), angles are radians, time is normalized to the reference ion cyclotron frequency, velocities to the reference thermal/sound scale, and magnetic moment and weights to the configured species normalization.
The module owns Kokkos Views, per-species sorting and quadtree state, restart serialization, and the bridge to field gather/deposition. It relies on initialized global equilibrium, field, solver, diagnostic, parallel, and species state.
|
default |
Construct an uninitialized particle owner.
| orb5x::ParticleModule::~ParticleModule | ( | ) |
Release owned sorters and Kokkos-view containers.
| Real orb5x::ParticleModule::b_star | ( | Real | st, |
| Real | chit, | ||
| Real | b, | ||
| Real | ut, | ||
| Real | tprime, | ||
| Real | addpBst, | ||
| int | isp | ||
| ) |
Evaluate the normalized guiding-center B* denominator.
| [in] | st | Radial coordinate s. |
| [in] | chit | Poloidal angle [rad]. |
| [in] | b | Magnetic-field magnitude. |
| [in] | ut | Parallel velocity/momentum coordinate. |
| [in] | tprime | Species temperature/profile factor used by the model. |
| [in] | addpBst | Geometric B* correction. |
| [in] | isp | Zero-based species index. |
B* value used in the equations of motion. | void orb5x::ParticleModule::bcpart | ( | int | isp, |
| bool | run_on_device | ||
| ) |
Apply radial and toroidal boundary conditions to one species.
| [in] | isp | Zero-based species index. |
| [in] | run_on_device | Select device-capable execution. |
| void orb5x::ParticleModule::bcpart_disp | ( | bool | run_on_device | ) |
Apply particle boundary conditions to all kinetic species.
| [in] | run_on_device | Select the Kokkos device-capable path where supported. |
| void orb5x::ParticleModule::calc_dist | ( | int | isp, |
| Real | sigmat, | ||
| Real | chit, | ||
| Real | ut, | ||
| Real | mu, | ||
| Real | psi0_corr, | ||
| Real & | distribution, | ||
| Real * | bst = nullptr, |
||
| Real * | dist_coeff = nullptr, |
||
| Real * | diff_t_vpll = nullptr |
||
| ) |
Evaluate the represented distribution at one phase-space point.
| [in] | isp | Zero-based species index. |
| [in] | sigmat | Radial coordinate s. |
| [in] | chit | Poloidal angle [rad]. |
| [in] | ut | Parallel velocity coordinate. |
| [in] | mu | Normalized magnetic moment. |
| [in] | psi0_corr | Canonical-flux correction. |
| [out] | distribution | Distribution value in normalized phase-space units. |
| [out] | bst | Optional magnetic-field magnitude. |
| [out] | dist_coeff | Optional marker-to-distribution coefficient. |
| [out] | diff_t_vpll | Optional derivative with respect to parallel velocity. |
| void orb5x::ParticleModule::charge_deposition_passing_electrons_disp | ( | int | isp, |
| const int * | lb, | ||
| const int * | ub, | ||
| Kokkos::View< Real ** > & | rho_passing | ||
| ) |
Deposit the passing-electron adiabatic response on a 2-D mesh.
| [in] | isp | Zero-based electron-species index. |
| [in] | lb | Lower mesh bounds. |
| [in] | ub | Upper mesh bounds. |
| [out] | rho_passing | Passing-electron charge-density coefficients. |
| void orb5x::ParticleModule::check_ffinit | ( | int | isp | ) |
Validation routine for FFINIT consistency Matching Fortran part.F90 lines 1497-1514.
| isp | Species index (0-based in C++) |
| void orb5x::ParticleModule::compute_all_larmor_positions | ( | int | isp | ) |
Fill all gyropoint positions for one species.
| [in] | isp | Zero-based species index. |
| void orb5x::ParticleModule::compute_all_larmor_positions_disp | ( | bool | comp_dk | ) |
Fill Larmor-point positions for all eligible species.
| [in] | comp_dk | Also process drift-kinetic deposition attributes. |
|
static |
Compute deposition attributes for drift-kinetic models Matching Fortran part.F90 lines 2717-2733.
| u | Marker parallel momenta |
| w | Marker weights |
| uw | Output: Product of u and w |
| n | Number of markers |
| void orb5x::ParticleModule::compute_moments_3d | ( | int | isp | ) |
Compute all configured three-dimensional moments for one species.
| [in] | isp | Zero-based species index. |
| void orb5x::ParticleModule::compute_psi0_corr_disp | ( | bool | flag | ) |
Compute canonical-Maxwellian flux corrections for all species.
| [in] | flag | Enables or clears the correction according to run mode. |
|
static |
Compute one marker's canonical-Maxwellian flux correction.
| [in] | isp | Zero-based species index. |
| [in] | st | Marker radial coordinate s=sqrt(psi). |
| [in] | chit | Marker poloidal angle [rad]. |
| [in] | mut | Normalized magnetic moment. |
| [in] | ut | Normalized parallel marker coordinate. |
| void orb5x::ParticleModule::compute_reduced_weights | ( | int | isp, |
| const Kokkos::View< Real ** > & | pic1_loc, | ||
| const Kokkos::View< Real ** > & | pic2_loc, | ||
| const Kokkos::View< bool ** > & | pic3_loc, | ||
| const Kokkos::View< int * > & | npart_view, | ||
| int | nsel_att | ||
| ) |
Compute reduced deposition weights from explicit marker arrays.
| [in] | isp | Zero-based species index. |
| [in] | pic1_loc | Evolving marker properties. |
| [in] | pic2_loc | Invariant marker properties. |
| [in] | pic3_loc | Logical marker properties. |
| [in] | npart_view | Active counts by species. |
| [in] | nsel_att | Charge/current selector determining the correction. |
| void orb5x::ParticleModule::compute_reduced_weights_disp | ( | int | isp, |
| int | nsel_att | ||
| ) |
Dispatch control-variate weight reduction for a species.
| [in] | isp | Zero-based species index. |
| [in] | nsel_att | Charge/current attribute selector. |
|
static |
Compute equilibrium distribution function f0.
Public wrapper for the internal vf0 function, used by PSZS diagnostics.
| isp | Species index (0-based) |
| zvth2 | Thermal velocity squared |
| nval | Density profile value |
| ze | Kinetic energy |
| zecor | Energy correction |
| b | Magnetic field magnitude |
| pot_equil | Equilibrium potential |
| pot_equil0 | Reference equilibrium potential |
| psit | Toroidal flux coordinate |
| ut | Parallel velocity |
| mut | Magnetic moment |
|
static |
Form the Cartesian cross product of two three-component vectors.
| [in] | a | Left operand; its first three elements are used. |
| [in] | b | Right operand; its first three elements are used. |
a cross b. part.F90; both input vectors must contain at least three elements. | void orb5x::ParticleModule::deposit_bsplines | ( | int | isp, |
| int | npart_loc, | ||
| const Kokkos::View< Real ** > & | pic1_loc, | ||
| const Kokkos::View< Real ** > & | pic2_loc | ||
| ) |
Deposit markers into PSZS tensor-product spline coordinates.
| [in] | isp | Zero-based species index. |
| [in] | npart_loc | Number of leading local markers. |
| [in] | pic1_loc | Evolving marker properties. |
| [in] | pic2_loc | Invariant marker properties. |
|
static |
Release file-scope static Kokkos Views before Kokkos::finalize().
| void orb5x::ParticleModule::diagnose_particles | ( | int | isp | ) |
Compute configured particle moments for one species.
| [in] | isp | Zero-based species index. |
|
static |
Invert a precomputed 2-D loading distribution.
| [in] | rev2 | Uniform/quasi-random values selecting R. |
| [in] | rev3 | Uniform/quasi-random values selecting conditional Z. |
| [in] | prob | Conditional cumulative distribution. |
| [in] | xg | R grid. |
| [in] | yg | Z grid. |
| [in] | fdistx | Marginal cumulative R distribution. |
| [in] | dx | R spacing. |
| [in] | dy | Z spacing. |
| [out] | xp | Loaded R coordinates. |
| [out] | yp | Loaded Z coordinates. |
| void orb5x::ParticleModule::gauss_list_init | ( | int | isp, |
| Kokkos::View< Real ** > & | pert_table, | ||
| int & | nperts | ||
| ) |
Gaussian perturbation list loading from file Matching Fortran part.F90 lines 8330-8355.
| isp | Species index (0-based) |
| pert_table | Output: Table of perturbation parameters |
| nperts | Output: Number of perturbations loaded |
|
static |
Differentiate the configured equilibrium distribution.
Outputs derivatives with respect to kinetic energy, parallel velocity, radial and poloidal profiles, and equilibrium potential in ORB5X normalized coordinates. Inputs use the same normalization as vf0().
| [in] | f0 | Equilibrium distribution value at the marker. |
| [in] | ut | Normalized parallel marker coordinate. |
| [in] | mut | Normalized magnetic moment. |
| [in] | b | Normalized magnetic-field magnitude. |
| [in] | epsilon_hat | Species gyroradius/charge normalization factor. |
| [in] | ze | Marker kinetic energy. |
| [in] | zvth2 | Local squared thermal-speed scale. |
| [in] | nval | Local normalized density. |
| [in] | Epsi | Radial derivative of equilibrium potential. |
| [in] | psit | Flux coordinate used by the profiles. |
| [in] | ngrad | Logarithmic density gradient. |
| [in] | tgrad | Logarithmic temperature gradient. |
| [in] | isp | Zero-based species index. |
| [out] | df0_dek | Derivative with respect to kinetic energy. |
| [out] | df0_du | Derivative with respect to parallel coordinate. |
| [out] | df0_dpsi_prof | Radial profile contribution. |
| [out] | df0_dchi_prof | Poloidal profile contribution. |
| [out] | df0_dpsi_pot | Equilibrium-potential contribution. |
| [in] | zecor | Mixed-variable energy correction. |
| [in] | pot_equil | Equilibrium potential at the marker. |
| [in] | pot_equil0 | Reference equilibrium potential. |
| [in] | chit | Poloidal angle [rad]. |
| void orb5x::ParticleModule::get_field_disp | ( | const FieldType & | field, |
| int | istep, | ||
| bool | nl_main_substep, | ||
| int | i_att | ||
| ) |
Gather one field and its gradients to all guiding centers/gyropoints.
| [in] | field | Mesh field and spline coefficients to evaluate. |
| [in] | istep | Field time-level selector. |
| [in] | nl_main_substep | Whether this is the principal integrator substep. |
| [in] | i_att | Destination field-attribute slot. |
|
static |
Return the pic2 column containing canonical toroidal momentum.
| [in] | isp | Zero-based species index. |
| Real orb5x::ParticleModule::get_KE | ( | int | isp | ) |
Sum normalized kinetic energy over one local species.
| [in] | isp | Zero-based species index. |
Return normalized kinetic energy u^2/2 + mu*B.
| [in] | ut | Normalized parallel velocity. |
| [in] | mut | Normalized magnetic moment. |
| [in] | b | Normalized magnetic-field magnitude. |
| void orb5x::ParticleModule::get_larmor_indices_disp | ( | bool | initflag = false, |
| bool | adapt_only = false |
||
| ) |
Compute Larmor ring sizes/offsets for all eligible species.
| [in] | initflag | Set initial capacities instead of active counts. |
| [in] | adapt_only | Restrict work to adaptive-gyroaveraging species. |
|
static |
Select the ring-point count for one gyroradius.
| [in] | isp | Zero-based species index. |
| [in] | nsel_gyr_local | Adaptive/fixed/drift-kinetic gyroaveraging selector. |
| [in] | rhog | Normalized gyroradius. |
| void orb5x::ParticleModule::get_pos | ( | int | isp, |
| int | ip, | ||
| Real * | pos | ||
| ) |
Return one marker's physical position coordinates.
| [in] | isp | Zero-based species index. |
| [in] | ip | Zero-based local marker index. |
| [out] | pos | Caller buffer receiving (R,phi,Z) in normalized geometry units. |
| void orb5x::ParticleModule::get_properties | ( | int | isp, |
| int | ip, | ||
| Real * | props | ||
| ) |
Fill the standard property vector for one stored marker.
| [in] | isp | Zero-based species index. |
| [in] | ip | Zero-based local marker index. |
| [out] | props | Caller-provided property buffer in the established diagnostic layout. |
|
static |
Compute the energy-like marker property used by get_properties().
| [in] | isp | Zero-based species index. |
| [in] | st | Marker radial coordinate s=sqrt(psi). |
| [in] | chit | Marker poloidal angle [rad]. |
| [in] | ut | Normalized parallel marker coordinate. |
| [in] | mut | Normalized magnetic moment. |
| [in] | vpval | Bounce-averaged parallel-flow profile value. |
|
static |
Assemble the selected delta-f weight-equation right-hand side.
This is the C++ counterpart of get_rhs in part.F90. It combines the phase-space characteristics with profile derivatives, Hamiltonian terms, strong-flow corrections, and the configured weight formulation. All dimensional quantities use ORB5X normalization.
| [in] | ip | Zero-based local marker index (retained for Fortran parity). |
| [in] | isp | Zero-based species index. |
| [in] | pvol | Marker phase-space volume. |
| [in] | vdr | Radial characteristic ds/dt. |
| [in] | vdchi | Poloidal characteristic dchi/dt. |
| [in] | vgc | Three-component guiding-center characteristic. |
| [in] | vin | Equilibrium characteristic used by the control variate. |
| [in] | vpval | Bounce-averaged parallel-velocity profile value. |
| [in] | genelec | Electron-flow/electric-gradient contribution. |
| [in] | dvpadt0 | Equilibrium parallel acceleration. |
| [in] | dvpadt1 | Perturbed parallel acceleration. |
| [in] | gyroapar | Gyroaveraged parallel vector potential. |
| [in] | ze | Marker kinetic energy. |
| [in] | zecor | Mixed-variable energy correction. |
| [in] | dH0_dt_correction | Explicit equilibrium-Hamiltonian correction. |
| [in] | pot_equil | Equilibrium potential at the marker. |
| [in] | pot_equil0 | Reference equilibrium potential. |
| [in] | distribution | Equilibrium distribution f0 at the marker. |
| [in] | ut | Normalized parallel marker coordinate. |
| [in] | mut | Normalized magnetic moment. |
| [in] | b | Normalized magnetic-field magnitude. |
| [in] | zvth2 | Local squared thermal-speed scale. |
| [in] | nval | Local normalized density-profile value. |
| [in] | Epsi | Radial derivative of the equilibrium potential. |
| [in] | psi0t | Canonical/profile flux coordinate. |
| [in] | ngrad | Logarithmic density-profile gradient. |
| [in] | tgrad | Logarithmic temperature-profile gradient. |
| [in] | vpgrad | Radial gradient of the parallel-flow profile. |
| [in] | dfvpllb_dpsi | Radial derivative of the bounce-averaged factor. |
| [in] | dfvpllb_den | Energy derivative of the bounce-averaged factor. |
| [out] | rhs | Selected normalized weight-equation right-hand side. |
| [out] | dpotdpsi | Effective radial potential derivative. |
| [out] | omegasq_corr | Rotation-frequency-squared correction. |
| [out] | df0_dpsi_prof | Profile contribution to df0/dpsi. |
| [out] | df0_dchi_prof | Profile contribution to df0/dchi. |
| [out] | dpsi_prof_dt | Profile-flux characteristic. |
| [out] | dchi_prof_dt | Profile-poloidal characteristic. |
| [in] | rhs_type | Selector for the supported weight formulation. |
| [in] | mgradphi | Contravariant gradient of electrostatic potential. |
| [in] | vgb | Magnetic-drift characteristic. |
| [in] | vpressure | Pressure-gradient characteristic. |
| [in] | mgradapar | Contravariant gradient of parallel vector potential. |
| [in] | hh_sympl | Symplectic unit-field characteristic. |
| [in] | chit | Marker poloidal angle [rad]. |
| [in] | dchi_dt1 | Perturbed poloidal characteristic. |
| [in] | iter | Time-integration stage selector. |
| [in] | ffinit | Stored initial distribution value. |
| [in] | dPsidt0 | Equilibrium canonical-flux time derivative. |
| void orb5x::ParticleModule::get_toroidal_momentum | ( | int | isp, |
| Real | st, | ||
| Real | chit, | ||
| Real | ut, | ||
| Real | mut, | ||
| Real | psi_correction, | ||
| Real | tsubB, | ||
| Real & | psit_prof, | ||
| Real & | psit_pot | ||
| ) |
Compute canonical flux labels used by profiles and potential terms.
| [in] | isp | Zero-based species index. |
| [in] | st | Radial coordinate s. |
| [in] | chit | Poloidal angle [rad]. |
| [in] | ut | Parallel velocity/momentum coordinate. |
| [in] | mut | Magnetic moment. |
| [in] | psi_correction | Canonical-flux correction. |
| [in] | tsubB | Profile/equilibrium factor. |
| [out] | psit_prof | Flux coordinate used for profiles. |
| [out] | psit_pot | Flux coordinate used for equilibrium potential. |
Get bounce-averaged v_parallel/B from precomputed lookup table.
Matching Fortran part.F90 lines 6674-6710.
| psi | Flux coordinate (psi = sigma^2) |
| mu | Magnetic moment |
| en | Energy (0.5*u^2 + mu*B) |
| v_pll | Parallel velocity (for sign determination) |
| isp | Species index (0-based in C++) |
| void orb5x::ParticleModule::grid_pic | ( | int | isp, |
| bool | run_on_device | ||
| ) |
Deposit the configured primary quantity for one species.
| [in] | isp | Zero-based species index. |
| [in] | run_on_device | Select device-capable deposition. |
| void orb5x::ParticleModule::grid_pic | ( | int | isp, |
| int | nsel_att, | ||
| bool | reduce_flag, | ||
| const int * | lb, | ||
| const int * | ub, | ||
| Kokkos::View< Real ***, Kokkos::LayoutStride > | assign1, | ||
| int | i_att | ||
| ) |
Charge/current deposition on grid (matching Fortran grid_pic, part.F90 lines 7771-7920)
Handles both drift-kinetic (DK) and gyrokinetic species:
Uses part_fields::deposition (matching Fortran interface deposition, part_fields.F90 lines 25-27)
| isp | Species index (0-based in C++) |
| nsel_att | Which attribute to be deposited (NSEL_CHARGE=0 or NSEL_CURRENT=1) |
| reduce_flag | Reduce the weights by the adiabatic density/current |
| lb | Lower indices of the deposition arrays (size 4) |
| ub | Upper indices of the deposition arrays (size 4) |
| assign1 | Output: deposited quantity array |
| i_att | Iteration over atts arrays (1-based, matching Fortran) |
| void orb5x::ParticleModule::grid_pic_diagnostic | ( | int | isp, |
| int | nsel_att, | ||
| const int * | lb, | ||
| const int * | ub, | ||
| Kokkos::View< Real *** > & | assign1 | ||
| ) |
Diagnostic charge/current deposition on grid (matching Fortran grid_pic_diagnostic, part.F90 lines 8190-8272)
Uses pic5 (Real32) marker attributes for diagnostic moment deposition. Normalization: 1/dens0 * nphi/TWOPI (differs from grid_pic which uses charge/dens0). Also uses part_fields::deposition.
| isp | Species index (0-based in C++) |
| nsel_att | Which pic5 attribute to deposit |
| lb | Lower indices of the deposition arrays (size 3 or 4) |
| ub | Upper indices of the deposition arrays (size 3 or 4) |
| assign1 | Output: deposited quantity array |
| void orb5x::ParticleModule::helical_flux_label | ( | Real | sigmat, |
| Real | xiang, | ||
| int & | irloc, | ||
| Real & | dr_flux_inv, | ||
| int & | ipol | ||
| ) |
Map a marker to magnetic-island radial and poloidal diagnostic bins.
| [in] | sigmat | Marker radial coordinate s. |
| [in] | xiang | Marker helical angle [rad]. |
| [out] | irloc | Radial island-bin index. |
| [out] | dr_flux_inv | Local inverse helical-flux bin width. |
| [out] | ipol | Poloidal/helical angular-bin index. |
|
static |
Build the cumulative 2-D (R,Z) loading distribution.
| [in] | fields | Initialized field-grid parameters. |
| [in] | lenx | R-domain length in normalized geometry units. |
| [in] | leny | Z-domain length. |
| [in] | isp | Zero-based species index. |
| [out] | prob | Conditional cumulative distribution in Z for each R bin. |
| [out] | xg | R grid. |
| [out] | yg | Z grid. |
| [out] | fdistx | Marginal cumulative distribution in R. |
| [out] | dx | R-grid spacing. |
| [out] | dy | Z-grid spacing. |
| void orb5x::ParticleModule::init_particles | ( | ) |
Allocate particle storage and build bounce-averaged momentum tables.
| void orb5x::ParticleModule::init_push_diagnostics | ( | ) |
Initialize bin measures and scratch used by in-push diagnostics.
| void orb5x::ParticleModule::init_test_particles | ( | int | isp | ) |
Allocate test-particle state for one species.
| [in] | isp | Zero-based species index. |
| void orb5x::ParticleModule::l5_auto_init | ( | int | isp, |
| Kokkos::View< Real ** > & | l5_s_array | ||
| ) |
LIGKA mode automatic initialization Matching Fortran part.F90 lines 8284-8328.
| isp | Species index (0-based) |
| l5_s_array | Output: Array of radial positions for LIGKA modes |
| void orb5x::ParticleModule::load_particles | ( | ) |
Generate or restore the initial marker distribution for every species.
| void orb5x::ParticleModule::load_test_particles | ( | int | isp | ) |
Load configured test-particle initial conditions for one species.
| [in] | isp | Zero-based species index. |
| void orb5x::ParticleModule::parmove | ( | int | iter, |
| bool | run_on_device, | ||
| bool | work1flag, | ||
| bool | work2flag, | ||
| bool | work3flag = false, |
||
| bool | work5flag = false, |
||
| bool | work6flag = false, |
||
| bool | work7flag = false, |
||
| bool | work8flag = false, |
||
| bool | work9flag = false |
||
| ) |
Migrate every species and selected work arrays across toroidal domains.
| [in] | iter | Substep index recorded by migration diagnostics. |
| [in] | run_on_device | Compatibility/device-path selector. |
| [in] | work1flag | Migrate work1 records. |
| [in] | work2flag | Migrate work2 records. |
| [in] | work3flag | Migrate GL4 work3 records. |
| [in] | work5flag | Migrate GL4 work5 records. |
| [in] | work6flag | Migrate GL4 work6 records. |
| [in] | work7flag | Migrate GL4 work7 records. |
| [in] | work8flag | Migrate GL4 work8 records. |
| [in] | work9flag | Migrate GL4 work9 records. |
| void orb5x::ParticleModule::part_grid | ( | int | isp, |
| int | nsel_att, | ||
| bool | reduce_flag, | ||
| int | i_att, | ||
| const int * | lb, | ||
| const int * | ub, | ||
| Kokkos::View< Real ***, Kokkos::LayoutStride > | assign1, | ||
| Kokkos::View< Real ** > * | assign1_passing = nullptr |
||
| ) |
Charge or current deposition wrapper routine Matching Fortran part.F90 lines 8698-8727 (external part_grid subroutine)
This is the main entry point for particle deposition, wrapping:
| isp | Species index (0-based in C++) |
| nsel_att | Attribute selector for deposition (NSEL_CHARGE, NSEL_CURRENT, etc.) |
| reduce_flag | If true, compute reduced weights before deposition |
| i_att | Iteration counter over atts arrays (1-based in Fortran, 0-based here) |
| lb | Lower bounds of charge arrays (size 4) |
| ub | Upper bounds of charge arrays (size 4) |
| assign1 | Output: Deposited quantity array [lb(1):ub(1), lb(2):ub(2), lb(3):ub(3)] |
| assign1_passing | Optional output: Passing electron charge array [lb(1):ub(1), lb(2):ub(2)] |
|
static |
Evaluate the perpendicular electron-flow curl projection.
Computes the contravariant components of h x (h x curl(u_e)) from the initialized equilibrium and electron-fluid fields, matching perp_curl_ue in part.F90.
| [in] | s | Normalized radial coordinate, s=sqrt(psi). |
| [in] | chi | Poloidal angle [rad]. |
| [out] | smodstar | Radial contravariant component. |
| [out] | chimodstar | Poloidal contravariant component. |
| [out] | phimodstar | Toroidal contravariant component. |
| void orb5x::ParticleModule::postpush_disp | ( | ) |
Run post-push full-f updates for all applicable species.
| void orb5x::ParticleModule::postpush_fullf | ( | int | isp | ) |
Recompute full-f weights after a push for one species.
| [in] | isp | Zero-based species index. |
| void orb5x::ParticleModule::print_test_particles | ( | int | step | ) |
Emit configured test-particle diagnostics for a timestep.
| [in] | step | Global timestep index written with the diagnostic records. |
| void orb5x::ParticleModule::pszs_calc | ( | ) |
Dispatch phase-space zonal-structure accumulation.
PSZS boundary setup from particle distribution Matching Fortran part.F90 lines 8442-8549 Sets up boundaries for Phase Space Zone Sampling diagnostics.
| isp | Species index (0-based) |
| lb | Lower bounds array (size 3) |
| ub | Upper bounds array (size 3) |
| void orb5x::ParticleModule::pullback | ( | ) |
Convert mixed-variable electromagnetic particle state to symplectic form.
| void orb5x::ParticleModule::push_disp | ( | int | iter | ) |
Advance all kinetic species through one configured push substep.
| [in] | iter | Substep/stage selector used by the time integrator. |
Evaluate the equilibrium safety factor at normalized radius s.
| [in] | s | Normalized radial coordinate, s=sqrt(psi). |
| void orb5x::ParticleModule::quadtree_smoothing_disp | ( | ) |
Apply configured phase-space quadtree smoothing to all species.
| void orb5x::ParticleModule::quadtree_smoothing_interface | ( | int | isp, |
| bool | diagnose_ | ||
| ) |
Smooth one species and optionally populate smoothing diagnostics.
| [in] | isp | Zero-based species index. |
| [in] | diagnose_ | Enable diagnostic accumulation for this pass. |
| void orb5x::ParticleModule::read_write_particle_data | ( | int | flag, |
| int | datn | ||
| ) |
Read or write particle checkpoint state.
| [in] | flag | I/O/backend selector used by the restart protocol. |
| [in] | datn | Alternating restart generation, 0 or 1. |
|
static |
Compute a radical-inverse element of a Hammersley sequence.
| [in] | nbase | Integer base greater than one. |
| [in] | i | Non-negative sequence index. |
[0,1). | void orb5x::ParticleModule::set_weights_to_zero_at_t0 | ( | ) |
Set perturbation weights to zero at the initial time when configured.
| void orb5x::ParticleModule::sort_gc_2D_disp | ( | ) |
Sort guiding centers in the radial/poloidal plane.
| void orb5x::ParticleModule::sort_gc_3D_disp | ( | ) |
Sort guiding centers in local three-dimensional spatial bins.
| void orb5x::ParticleModule::str_diagnostic_start | ( | ) |
Initialize strong flow diagnostic output files Matching Fortran part.F90 lines 4726-4750 Opens output files for psi, energy, kappa, rhs diagnostics.
| void orb5x::ParticleModule::strong_diagnostic_output | ( | int | isp, |
| int | ip, | ||
| Real | psi0t, | ||
| Real | temp2, | ||
| Real | ze, | ||
| Real | vecrossb_f2, | ||
| Real | pot_equil, | ||
| Real | zf0, | ||
| Real | zvth2_inv, | ||
| Real | dpotdpsi, | ||
| Real | vdr, | ||
| Real | rhs | ||
| ) |
Record per-marker quantities used to inspect the strong-flow model.
| [in] | isp | Zero-based species index. |
| [in] | ip | Zero-based local marker index. |
| [in] | psi0t | Canonical/profile flux coordinate. |
| [in] | temp2 | Local squared thermal-speed scale. |
| [in] | ze | Marker kinetic energy. |
| [in] | vecrossb_f2 | Squared equilibrium E x B speed contribution. |
| [in] | pot_equil | Equilibrium potential at the marker. |
| [in] | zf0 | Equilibrium distribution value. |
| [in] | zvth2_inv | Inverse local squared thermal speed. |
| [in] | dpotdpsi | Effective radial potential derivative. |
| [in] | vdr | Radial characteristic. |
| [in] | rhs | Weight-equation right-hand side. |
strong_diagnostic_output in part.F90.
|
static |
Add equilibrium-E x B strong-flow terms to the characteristics.
Implements the strong_flow_terms algebra from part.F90. Vector arguments are three-component contravariant quantities in ORB5X's normalized magnetic coordinates.
| [in] | isp | Zero-based species index. |
| [in] | sigmat | Marker radial coordinate s=sqrt(psi). |
| [in] | chit | Marker poloidal angle [rad]. |
| [in] | bstar_inv | Inverse normalized guiding-center B* denominator. |
| [in] | genelec | Electron-flow/electric contribution to the gradient. |
| [in] | pztomobstar | Species canonical-momentum factor divided by B*. |
| [in] | bgrb | Contravariant magnetic-gradient drift vector. |
| [in] | addp | Contravariant geometric correction vector. |
| [in] | expt_back | Radial equilibrium electric-field component. |
| [in] | eypt_back | Poloidal equilibrium electric-field component. |
| [in] | exh | Contravariant equilibrium E x h vector. |
| [in] | ut | Normalized parallel marker coordinate. |
| [in] | mut | Normalized magnetic moment. |
| [in] | hh | Contravariant unit-field vector. |
| [out] | dvpadt1_str | Perturbed strong-flow contribution to du/dt. |
| [out] | dvpadt0_str | Equilibrium strong-flow contribution to du/dt. |
| [in,out] | vgc | Guiding-center velocity to which strong-flow terms are added. |
| void orb5x::ParticleModule::test_particle_output | ( | int | isp, |
| int | ip, | ||
| Real | psi0t, | ||
| Real | ze, | ||
| Real | pot_equil, | ||
| Real | wt, | ||
| Real | zvth2, | ||
| Real | nval, | ||
| Real | pvol, | ||
| Real | zf0 | ||
| ) |
Store the configured diagnostic record for one test marker.
| [in] | isp | Zero-based species index. |
| [in] | ip | Zero-based local marker index. |
| [in] | psi0t | Canonical/profile flux coordinate. |
| [in] | ze | Marker kinetic energy. |
| [in] | pot_equil | Equilibrium potential at the marker. |
| [in] | wt | Marker perturbation weight. |
| [in] | zvth2 | Local squared thermal-speed scale. |
| [in] | nval | Local normalized density. |
| [in] | pvol | Marker phase-space volume. |
| [in] | zf0 | Equilibrium distribution value. |
test_particle_output in part.F90. | void orb5x::ParticleModule::trap_detrap_disp | ( | ) |
Update trapped/passing state transitions for all applicable species.
| void orb5x::ParticleModule::unsort_gc_3D_disp | ( | ) |
Restore drift-kinetic marker arrays to their pre-sort order.
| void orb5x::ParticleModule::update_ffinit_or_pvol | ( | ) |
Refresh stored initial-f or phase-volume values after weight changes.
| bool orb5x::ParticleModule::uses_modified_toroidal_momentum | ( | int | isp | ) | const |
Test whether a species uses a modified canonical momentum definition.
| [in] | isp | Zero-based species index. |
true for species whose profile model modifies toroidal momentum.
|
static |
Evaluate the selected normalized equilibrium distribution f0.
| [in] | isp | Zero-based species index. |
| [in] | zvth2 | Local squared thermal-speed scale. |
| [in] | nval | Local normalized density. |
| [in] | ze | Kinetic energy. |
| [in] | zecor | Energy correction. |
| [in] | b | Magnetic-field magnitude. |
| [in] | pot_equil | Local equilibrium potential. |
| [in] | pot_equil0 | Reference equilibrium potential. |
| [in] | psit | Flux coordinate used by profiles. |
| [in] | ut | Parallel velocity coordinate. |
| [in] | mut | Magnetic moment. |
| [in] | nsel_f0_override | Distribution selector, or -1 for species input. |
|
static |
Evaluate the poloidal-profile derivative of f0.
| [in] | zf0 | Equilibrium distribution value. |
| [in] | ze | Marker kinetic energy. |
| [in] | ut | Normalized parallel marker coordinate. |
| [in] | psit | Profile flux coordinate. |
| [in] | isp | Zero-based species index. |
| [in] | zvth2 | Local squared thermal-speed scale. |
| [in] | nval | Local normalized density. |
| [in] | zecor | Mixed-variable energy correction. |
| [in] | pot_equil | Equilibrium potential at the marker. |
| [in] | pot_equil0 | Reference equilibrium potential. |
| [in] | mut | Normalized magnetic moment. |
| [in] | chit | Poloidal angle [rad]. |
f0.
|
static |
Evaluate a local Maxwellian from thermal scale, density, and energy.
| [in] | zvth2 | Local squared thermal-speed scale. |
| [in] | nval | Local normalized density. |
| [in] | ze | Normalized kinetic energy. |
|
static |
Evaluate the radial-profile derivative of f0.
| [in] | zf0 | Equilibrium distribution value. |
| [in] | ngrad | Logarithmic density gradient. |
| [in] | epsilon_hat | Species normalization factor. |
| [in] | ze | Marker kinetic energy. |
| [in] | b | Normalized magnetic-field magnitude. |
| [in] | kappa_str | Strong-flow profile factor. |
| [in] | zvth2_inv | Inverse squared thermal-speed scale. |
| [in] | tgrad | Logarithmic temperature gradient. |
| [in] | ut | Normalized parallel marker coordinate. |
| [in] | psi0_inv | Inverse reference flux scale. |
| [in] | psit | Profile flux coordinate. |
| [in] | isp | Zero-based species index. |
| [in] | zvth2 | Local squared thermal-speed scale. |
| [in] | nval | Local normalized density. |
| [in] | zecor | Mixed-variable energy correction. |
| [in] | pot_equil | Equilibrium potential at the marker. |
| [in] | pot_equil0 | Reference equilibrium potential. |
| [in] | mut | Normalized magnetic moment. |
| [in] | chit | Poloidal angle [rad]. |
f0.
|
static |
Evaluate df0/dE for the configured distribution family.
| [in] | zf0 | Equilibrium distribution value. |
| [in] | zvth2 | Local squared thermal-speed scale. |
| [in] | ze | Marker kinetic energy. |
| [in] | psit | Profile flux coordinate. |
| [in] | isp | Zero-based species index. |
| [in] | nval | Local normalized density. |
| [in] | zecor | Mixed-variable energy correction. |
| [in] | b | Normalized magnetic-field magnitude. |
| [in] | pot_equil | Equilibrium potential at the marker. |
| [in] | pot_equil0 | Reference equilibrium potential. |
| [in] | ut | Normalized parallel marker coordinate. |
| [in] | mut | Normalized magnetic moment. |
| [in] | chit | Poloidal angle [rad]. |
|
static |
Evaluate df0/du for the configured distribution family.
| [in] | zf0 | Equilibrium distribution value. |
| [in] | ut | Normalized parallel marker coordinate. |
| [in] | zvth2 | Local squared thermal-speed scale. |
| [in] | nval | Local normalized density. |
| [in] | psit | Profile flux coordinate. |
| [in] | isp | Zero-based species index. |
| [in] | ze | Marker kinetic energy. |
| [in] | zecor | Mixed-variable energy correction. |
| [in] | pot_equil | Equilibrium potential at the marker. |
| [in] | pot_equil0 | Reference equilibrium potential. |
| [in] | mut | Normalized magnetic moment. |
| [in] | chit | Poloidal angle [rad]. |
epsilon_hat argument is retained for Fortran parity. | void orb5x::ParticleModule::vpa_quants | ( | Real | psi, |
| Real | mu, | ||
| Real | en_star, | ||
| Real | v_pll, | ||
| int | isp, | ||
| Real & | fvpllb, | ||
| Real & | dfvpllb_den, | ||
| Real & | dfvpllb_dpsi | ||
| ) |
Interpolate bounce-averaged v_parallel/B and its derivatives.
| [in] | psi | Toroidal-flux coordinate, equal to s^2. |
| [in] | mu | Normalized magnetic moment. |
| [in] | en_star | Energy coordinate used by the lookup table. |
| [in] | v_pll | Parallel velocity, whose sign selects the orbit branch. |
| [in] | isp | Zero-based species index. |
| [out] | fvpllb | Interpolated bounce-averaged v_parallel/B factor. |
| [out] | dfvpllb_den | Derivative with respect to energy. |
| [out] | dfvpllb_dpsi | Derivative with respect to toroidal flux. |
vpa_quants interpolation in part.F90. Return the mixed-coordinate kinetic-energy correction.
| [in] | ut | Mixed-variable parallel coordinate. |
| [in] | vpval | Physical parallel velocity. |
(vpval^2-ut^2)/2 in normalized energy units. | Kokkos::View<Real*> orb5x::ParticleModule::bin_surf_inv |
Inverse diagnostic surface measure by radial bin.
| Kokkos::View<Real*> orb5x::ParticleModule::bin_vol_inv |
Inverse diagnostic volume by radial bin.
| Kokkos::View<Complex***> orb5x::ParticleModule::cfield_out_3D |
Complex three-dimensional particle-moment field.
| Kokkos::View<Complex***> orb5x::ParticleModule::cfield_out_3D_fft |
Fourier representation of 3-D moment field.
| Kokkos::View<Real*> orb5x::ParticleModule::dens0 |
Marker density normalization nptot/volanu by species.
| Real orb5x::ParticleModule::dmu_bin = 0.0 |
Magnetic-moment bin spacing.
| Real orb5x::ParticleModule::dmu_bin_2 = 0.0 |
Half magnetic-moment bin spacing.
| Real orb5x::ParticleModule::dpsi_bin = 0.0 |
Normalized flux-bin spacing.
| Real orb5x::ParticleModule::dr_flux_inv = 0.0 |
Inverse radial diagnostic-bin width.
| Real orb5x::ParticleModule::dth_inv = 0.0 |
Inverse poloidal diagnostic-bin width [rad^-1].
| Real orb5x::ParticleModule::ftrap = 0.0 |
Trapped-particle fraction from the most recent loading calculation.
| std::vector<Real> orb5x::ParticleModule::integral_f0_global |
Monte-Carlo estimate of integrated equilibrium f0.
| int orb5x::ParticleModule::irloc_in = 0 |
Cached inner radial diagnostic-bin index.
| int orb5x::ParticleModule::lb_wx = 0 |
Lowest spline work-column offset.
| int orb5x::ParticleModule::MAX_PIC2 = 0 |
Number of time-independent real particle properties.
| int orb5x::ParticleModule::MAX_PIC5 = 0 |
Single-precision diagnostic-property count.
| int orb5x::ParticleModule::MAX_WORK = 0 |
Number of columns allocated in primary real work arrays.
| int orb5x::ParticleModule::MAX_WORK_FIELDS = 0 |
Leading work columns reserved for gathered fields.
| int orb5x::ParticleModule::MAX_WORK_REV = 0 |
Columns in temporary reduced-weight work storage.
| std::vector<Moments3DClass> orb5x::ParticleModule::moments_3d_array |
Configured 3-D moment metadata.
| Real orb5x::ParticleModule::mu_max = 0.0 |
Upper normalized magnetic-moment lookup bound.
| Real orb5x::ParticleModule::mu_min = 0.0 |
Lower normalized magnetic-moment lookup bound.
| std::vector<Real> orb5x::ParticleModule::mumax_global |
Global maximum loaded normalized magnetic moment.
| Kokkos::View<Real**> orb5x::ParticleModule::n_vel_1D |
Velocity-space marker histogram by species/bin.
| Kokkos::View<Real**> orb5x::ParticleModule::n_vel_trap_1D |
Trapped-marker velocity histogram.
| int orb5x::ParticleModule::NBIN_MU_F0 = 0 |
Number of magnetic-moment bins in f0/momentum tables.
| int orb5x::ParticleModule::NLARM_PIC2 = 0 |
pic2 column storing each marker's Larmor-ring size.
| Kokkos::View<int*> orb5x::ParticleModule::npart |
Active local marker count by zero-based species.
| Kokkos::View<int*> orb5x::ParticleModule::npmx |
Allocated local marker capacity by species.
| Kokkos::View<Real*> orb5x::ParticleModule::nptot_inv |
Reciprocal total marker count by species.
| Kokkos::View<int*> orb5x::ParticleModule::ntest |
Number of test particles by species.
| int orb5x::ParticleModule::ntrap = 0 |
Trapped marker count from the most recent calculation.
| int orb5x::ParticleModule::num_mesh = 0 |
Total quadtree mesh-cell count.
| std::vector<PointerMarkers> orb5x::ParticleModule::pic1 |
Evolving marker coordinates, velocity, and weights by species.
| std::vector<PointerMarkers> orb5x::ParticleModule::pic2 |
Time-independent invariants/loading data by species.
| std::vector<PointerMarkersLogic> orb5x::ParticleModule::pic3 |
Logical marker state such as trapping flags.
| std::vector<PointerMarkersI8> orb5x::ParticleModule::pic4 |
64-bit marker identifiers.
| std::vector<PointerMarkersR4> orb5x::ParticleModule::pic5 |
Single-precision diagnostic marker moments.
| std::vector<PointerMarkers> orb5x::ParticleModule::pion_1 |
Saved ion marker state used by selected algorithms.
| Kokkos::View<Real*> orb5x::ParticleModule::ppsum_buff_real |
Contiguous scratch for MPI real reductions.
| Real orb5x::ParticleModule::psi0_inv = 0.0 |
Inverse reference flux used by profile diagnostics.
| Real orb5x::ParticleModule::psi_max = 1.0 |
Upper normalized flux bound of momentum lookup tables.
| Real orb5x::ParticleModule::psi_min = 0.0 |
Lower normalized flux bound of momentum lookup tables.
| int orb5x::ParticleModule::qt_num_chi = 0 |
Quadtree poloidal-cell count.
| int orb5x::ParticleModule::qt_num_s = 0 |
Quadtree radial-cell count.
|
staticconstexpr |
Quadtree radial refinement per field interval.
| Kokkos::View<bool*> orb5x::ParticleModule::qt_toggle_flag |
Per-species alternating smoothing-pass flag.
| std::vector<PointerQuadtree> orb5x::ParticleModule::qtree |
Per-species quadtree smoothing storage.
| Kokkos::View<Real***> orb5x::ParticleModule::rho_passing_omp |
Per-thread passing-electron deposition scratch.
| std::vector<std::unique_ptr<SortingClass> > orb5x::ParticleModule::sortings |
Guiding-center sorter owned per species.
| std::vector<Real> orb5x::ParticleModule::sum_ekin_markers_global |
Global marker total kinetic-energy sum.
| std::vector<Real> orb5x::ParticleModule::sum_pekin_markers_global |
Global marker parallel kinetic-energy sum.
| Kokkos::View<Real*> orb5x::ParticleModule::Total_weight |
Local/global-normalized total marker weight by species.
| int orb5x::ParticleModule::ub_wx = 0 |
Highest spline work-column offset.
| std::vector<Real> orb5x::ParticleModule::umax_global |
Global maximum loaded parallel velocity by species.
| std::vector<Real> orb5x::ParticleModule::umin_global |
Global minimum loaded parallel velocity by species.
| Kokkos::View<Real**> orb5x::ParticleModule::vpbi |
Interpolation table and derivative data for vpa_quants().
| Kokkos::View<Real**, Kokkos::LayoutLeft, Kokkos::HostSpace> orb5x::ParticleModule::vpbi_host_cache |
Host cache of vpbi.
| Kokkos::View<Real**> orb5x::ParticleModule::vpll_momentum_bins |
Bounce-averaged v_parallel/B table by phase-space bin.
| Kokkos::View<Real**, Kokkos::LayoutLeft, Kokkos::HostSpace> orb5x::ParticleModule::vpll_momentum_bins_host_cache |
Host cache of momentum table.
| std::vector<PointerMarkers> orb5x::ParticleModule::work1 |
Primary push/gather workspace by species.
| std::vector<PointerMarkers> orb5x::ParticleModule::work2 |
Secondary push/gather workspace by species.
| std::vector<PointerMarkers> orb5x::ParticleModule::work3 |
GL4 stage workspace.
| std::vector<PointerMarkers> orb5x::ParticleModule::work5 |
GL4 stage workspace.
| std::vector<PointerMarkers> orb5x::ParticleModule::work6 |
GL4 stage workspace.
| std::vector<PointerMarkers> orb5x::ParticleModule::work7 |
GL4 stage workspace.
| std::vector<PointerMarkers> orb5x::ParticleModule::work8 |
GL4 stage workspace.
| std::vector<PointerMarkers> orb5x::ParticleModule::work9 |
GL4 stage workspace.
| std::vector<PointerMarkers> orb5x::ParticleModule::work_rev |
Reduced-weight/reversal workspace, allocated on demand.
| std::vector<PointerMarkers> orb5x::ParticleModule::work_temp |
Temporary per-marker workspace.
| std::vector<Real> orb5x::ParticleModule::zsmax_global |
Global maximum loaded radial coordinate s.
| std::vector<Real> orb5x::ParticleModule::zsum_global |
Global phase-space-volume sum by species.