XGC1
|
#include <Kokkos_Core.hpp>
#include "timer_macro.hpp"
#include "space_settings.hpp"
#include "globals.hpp"
#include "sml.hpp"
#include "plasma.hpp"
#include "domain_decomposition.hpp"
#include "distribution.hpp"
#include "velocity_grid.hpp"
#include "collisions.hpp"
#include "update_ptl_weights.hpp"
#include "update_f0.hpp"
#include "update_analytic_f0_old.hpp"
#include "update_analytic_f0.hpp"
#include "distribute_f0g.hpp"
#include "resampling.hpp"
#include "pseudo_inverse.hpp"
#include "checkpoint.hpp"
#include "vgrid_distribution.hpp"
#include "diffusion.hpp"
#include "toroidal_average.hpp"
#include "moments.hpp"
#include "f_source.hpp"
#include "current_drive.hpp"
#include "diag_f0.hpp"
#include "diag_3d_f0_f.hpp"
#include "diagnostics.hpp"
#include "pellet.hpp"
#include "heat_torque.hpp"
#include "neutrals.hpp"
#include "set_nans_to_zero.hpp"
#include "get_total_f.hpp"
Functions | |
void | f_nan_check (double *f0_f) |
int | get_resamp_tile_size () |
void | f0_upsampling_set_params () |
void | f0_upsampling_restore_params () |
int | do_f0_upsampling () |
void | f_source (const Simulation< DeviceType > &sml, const Grid< DeviceType > &grid, const MagneticField< DeviceType > &magnetic_field, ElectricField< DeviceType > &electric_field, DomainDecomposition< DeviceType > &pol_decomp, const VelocityGrid &vgrid, const Charges &charges, Plasma &plasma, Smoothing &smoothing, PerturbedBField< DeviceType > &perturbed_B_field, const Neutrals< DeviceType > &neutrals, Sources &sources, DMWrapper &pseudo_inv_dm, Diagnostics &diagnostics) |
Applies multiple non-Hamiltonian source terms (collisions, neutrals, heat/torque, diffusion, radiative cooling, etc.) that modify the distribution function. More... | |
int do_f0_upsampling | ( | ) |
void f0_upsampling_restore_params | ( | ) |
void f0_upsampling_set_params | ( | ) |
void f_nan_check | ( | double * | f0_f | ) |
void f_source | ( | const Simulation< DeviceType > & | sml, |
const Grid< DeviceType > & | grid, | ||
const MagneticField< DeviceType > & | magnetic_field, | ||
ElectricField< DeviceType > & | electric_field, | ||
DomainDecomposition< DeviceType > & | pol_decomp, | ||
const VelocityGrid & | vgrid, | ||
const Charges & | charges, | ||
Plasma & | plasma, | ||
Smoothing & | smoothing, | ||
PerturbedBField< DeviceType > & | perturbed_B_field, | ||
const Neutrals< DeviceType > & | neutrals, | ||
Sources & | sources, | ||
DMWrapper & | pseudo_inv_dm, | ||
Diagnostics & | diagnostics | ||
) |
Applies multiple non-Hamiltonian source terms (collisions, neutrals, heat/torque, diffusion, radiative cooling, etc.) that modify the distribution function.
The function orchestrates the entire "source" step in the kinetic equation, including:
f0_df0g
and accumulating them in f0_df0g_cumul
If sources are not triggered, the function simply updates particle weights.
Key steps and notes:
f0_df0g
). These changes are then accumulated (in f0_df0g_cumul
) and zeroed out (in f0_df0g
) via accumulate_df0g_and_reset_to_zero.DeviceType | The device (execution space) on which the simulation primarily runs. |
[in] | sml | Top-level simulation parameters and flags (time step, step count, upsampling flags, etc.). |
[in] | grid | The spatial grid object containing geometry, number of planes, and mapping information. |
[in] | magnetic_field | Access to magnetic-field geometry, used by certain sources and moment calculations. |
[in,out] | electric_field | Electric field object, which can be modified by routines such as current-drive sources. |
[in,out] | pol_decomp | Domain decomposition information for poloidal planes (may be used in parallel loops or moment calculations). |
[in] | vgrid | Velocity-space grid (including resolution, bounds, and pseudo-inverse setup flags). |
[in] | charges | Contains charge/mass information for different species. |
[in,out] | plasma | Main plasma container for all species; holds distribution functions, particle data, and moments. |
[in,out] | perturbed_B_field | Optional container for perturbed magnetic fields used in certain advanced calculations (e.g., 3D modes). |
[in] | neutrals | Data structure holding neutral densities and reaction rates for neutral-particle recycling or atomic physics processes. |
[in,out] | sources | Controls which source terms (collisions, diffusion, neutral recycling, pellet injection, etc.) are active, along with their parameters. |
[in,out] | pseudo_inv_dm | Data manager for pseudo-inverse velocity mapping, needed for distributing f0 changes to particles correctly. |
[in,out] | diagnostics | Manages diagnostic output for f0, df, distribution function moments, and other user-defined checks. |
f0_df0g
are always accumulated into f0_df0g_cumul
before being distributed to the particle representation.int get_resamp_tile_size | ( | ) |