XGCa
|
#include "timer_macro.hpp"
#include "globals.hpp"
#include "sml.hpp"
#include "magnetic_field.hpp"
#include "grid.hpp"
#include "particles.hpp"
#include "plasma.hpp"
#include "domain_decomposition.hpp"
#include "lagrange_weights.hpp"
#include <math.h>
#include "streamed_parallel_for.hpp"
#include "poloidal_sum.hpp"
#include "shift.hpp"
#include "update_f0.hpp"
Functions | |
template<class Device > | |
KOKKOS_INLINE_FUNCTION void | f0_update_f0g (const Grid< Device > &grid, const Species< Device > &species, const VelocityGrid &vgrid, int node, double phi, double smu_n, double vp_n, double df0g, double df2, bool update_f_and_n, const VGridDistribution< DeviceType > &dist, const VGridDistribution< DeviceType > &norm, const VGridDistribution< DeviceType > &f0g) |
template<class Device > | |
KOKKOS_INLINE_FUNCTION void | f0_update_f0g_lagrange (const Grid< Device > &grid, const Species< Device > &species, const VelocityGrid &vgrid, int node, double phi, double smu_n, double vp_n, double df0g, double df2, bool update_f_and_n, int order, const VGridDistribution< DeviceType > &dist, const VGridDistribution< DeviceType > &norm, const VGridDistribution< DeviceType > &f0g) |
template<class Device > | |
KOKKOS_INLINE_FUNCTION void | f0_update_f0_n (const Grid< Device > &grid, const Species< Device > &species, const VelocityGrid &vgrid, int node, double smu_n, double vp_n, int order, const VGridDistribution< DeviceType > &norm, const VGridDistribution< DeviceType > &f0g) |
template<class Device > | |
KOKKOS_INLINE_FUNCTION void | update_f0_sp_c (const Simulation< Device > &sml, const Grid< Device > &grid, const MagneticField< Device > &magnetic_field, const Species< Device > &species, const VelocityGrid &vgrid, const DomainDecomposition< Device > &pol_decomp, double alpha_in, bool update_f_and_n, int i_item, const VGridDistribution< DeviceType > &dist, const VGridDistribution< DeviceType > &norm, const VGridDistribution< DeviceType > &f0g) |
template<class Device > | |
KOKKOS_INLINE_FUNCTION void | update_f0_sp_c_pseudo_inv (const Simulation< Device > &sml, const Grid< Device > &grid, const MagneticField< Device > &magnetic_field, const Species< Device > &species, const VelocityGrid &vgrid, const DomainDecomposition< Device > &pol_decomp, double alpha_in, bool update_f_and_n, const Pseudo_inverse< Device > &pseudo_inv, int i_item, const VGridDistribution< DeviceType > &dist, const VGridDistribution< DeviceType > &norm, const VGridDistribution< DeviceType > &f0g) |
void | f0_update (const Simulation< DeviceType > &sml, const Grid< DeviceType > &grid, const MagneticField< DeviceType > &magnetic_field, Species< DeviceType > &species, const VelocityGrid &vgrid, const DomainDecomposition< DeviceType > &pol_decomp, double alpha_in, Pseudo_inverse< DeviceType > &pseudo_inv, VGridDistribution< DeviceType > &dist, VGridDistribution< DeviceType > &norm, VGridDistribution< DeviceType > &f0g) |
void | f0_update_f0g_pseudo_inv (const Grid< DeviceType > &grid, const MagneticField< DeviceType > &magnetic_field, const Species< DeviceType > &species, const VelocityGrid &vgrid, const DomainDecomposition< DeviceType > &pol_decomp, bool update_f_and_n, DMWrapper &pseudo_inv_dm, Pseudo_inverse< DeviceType > &pseudo_inv, VGridDistribution< DeviceType > &dist, VGridDistribution< DeviceType > &f0g) |
void | update_f0_sp (const Simulation< DeviceType > &sml, const Grid< DeviceType > &grid, const MagneticField< DeviceType > &magnetic_field, Species< DeviceType > &species, const VelocityGrid &vgrid, const DomainDecomposition< DeviceType > &pol_decomp, double alpha_in, DMWrapper &pseudo_inv_dm, Pseudo_inverse< DeviceType > &pseudo_inv, VGridDistribution< DeviceType > &f0_f, VGridDistribution< DeviceType > &f0_n, VGridDistribution< DeviceType > &dfg) |
void | all_species_update_f0 (const Simulation< DeviceType > &sml, const Grid< DeviceType > &grid, const MagneticField< DeviceType > &magnetic_field, Plasma &plasma, const VelocityGrid &vgrid, DomainDecomposition< DeviceType > &pol_decomp, double alpha_in, DMWrapper &pseudo_inv_dm, Pseudo_inverse< DeviceType > &pseudo_inv, VGridDistribution< DeviceType > &f0_f, VGridDistribution< DeviceType > &f0_n, VGridDistribution< DeviceType > &dfg) |
void all_species_update_f0 | ( | const Simulation< DeviceType > & | sml, |
const Grid< DeviceType > & | grid, | ||
const MagneticField< DeviceType > & | magnetic_field, | ||
Plasma & | plasma, | ||
const VelocityGrid & | vgrid, | ||
DomainDecomposition< DeviceType > & | pol_decomp, | ||
double | alpha_in, | ||
DMWrapper & | pseudo_inv_dm, | ||
Pseudo_inverse< DeviceType > & | pseudo_inv, | ||
VGridDistribution< DeviceType > & | f0_f, | ||
VGridDistribution< DeviceType > & | f0_n, | ||
VGridDistribution< DeviceType > & | dfg | ||
) |
void f0_update | ( | const Simulation< DeviceType > & | sml, |
const Grid< DeviceType > & | grid, | ||
const MagneticField< DeviceType > & | magnetic_field, | ||
Species< DeviceType > & | species, | ||
const VelocityGrid & | vgrid, | ||
const DomainDecomposition< DeviceType > & | pol_decomp, | ||
double | alpha_in, | ||
Pseudo_inverse< DeviceType > & | pseudo_inv, | ||
VGridDistribution< DeviceType > & | dist, | ||
VGridDistribution< DeviceType > & | norm, | ||
VGridDistribution< DeviceType > & | f0g | ||
) |
KOKKOS_INLINE_FUNCTION void f0_update_f0_n | ( | const Grid< Device > & | grid, |
const Species< Device > & | species, | ||
const VelocityGrid & | vgrid, | ||
int | node, | ||
double | smu_n, | ||
double | vp_n, | ||
int | order, | ||
const VGridDistribution< DeviceType > & | norm, | ||
const VGridDistribution< DeviceType > & | f0g | ||
) |
Update velocity interpolation normalization factors. Uses Lagrange polynomials of the given order.
[in] | grid | spatial grid object |
[in] | species | contains species parameters |
[in] | vgrid | contains the velocity grid dimensions |
[in] | node | grid node of particle |
[in] | smu_n | smu_n [v_{perpendicular}/v_{thermal}] of particle |
[in] | vp_n | parallel velocity of particle |
[in] | order | the interpolation order (0 = nearest neighbor), (1 = linear), (2 = quadratic), (3 = cubic), .... |
[in,out] | norm | the normalization coefficient used for the grid <–> particle interpolation |
KOKKOS_INLINE_FUNCTION void f0_update_f0g | ( | const Grid< Device > & | grid, |
const Species< Device > & | species, | ||
const VelocityGrid & | vgrid, | ||
int | node, | ||
double | phi, | ||
double | smu_n, | ||
double | vp_n, | ||
double | df0g, | ||
double | df2, | ||
bool | update_f_and_n, | ||
const VGridDistribution< DeviceType > & | dist, | ||
const VGridDistribution< DeviceType > & | norm, | ||
const VGridDistribution< DeviceType > & | f0g | ||
) |
Interpolate weight of one particle to grid distribution bilinearly in velocity space.
[in] | grid | spatial grid object |
[in] | species | contains species parameters |
[in] | vgrid | contains the velocity grid dimensions |
[in] | node | grid node of particle |
[in] | phi | phi of particle |
[in] | smu_n | sqrt(mu) [v_{perpendicular}/v_{thermal}] of particle |
[in] | vp_n | parallel velocity of particle |
[in] | df0g | particle weight multiplied by fraction transferred to distribution function every source time step: alpha*w1*w0 |
[in] | df2 | particle weight: w1*w0 |
[in] | update_f_and_n | whether to add particle weights in the distribution function used for the source routines |
[in,out] | dist | the species distribution being added to the particle contributions |
[in,out] | norm | the normalization coefficient used for the grid <–> particle interpolation |
KOKKOS_INLINE_FUNCTION void f0_update_f0g_lagrange | ( | const Grid< Device > & | grid, |
const Species< Device > & | species, | ||
const VelocityGrid & | vgrid, | ||
int | node, | ||
double | phi, | ||
double | smu_n, | ||
double | vp_n, | ||
double | df0g, | ||
double | df2, | ||
bool | update_f_and_n, | ||
int | order, | ||
const VGridDistribution< DeviceType > & | dist, | ||
const VGridDistribution< DeviceType > & | norm, | ||
const VGridDistribution< DeviceType > & | f0g | ||
) |
Interpolate weight of one particle to grid distribution in velocity space. Uses Lagrange polynomials of the given order.
[in] | grid | spatial grid object |
[in] | species | contains species parameters |
[in] | vgrid | contains the velocity grid dimensions |
[in] | node | grid node of particle |
[in] | phi | phi of particle |
[in] | smu_n | sqrt(mu) [v_{perpendicular}/v_{thermal}] of particle |
[in] | vp_n | parallel velocity of particle |
[in] | df0g | particle weight multiplied by fraction transferred to distribution function every source time step: alpha*w1*w0 |
[in] | df2 | particle weight: w1*w0 |
[in] | update_f_and_n | whether to add particle weights in the distribution function used for the source routines |
[in] | order | the interpolation order (0 = nearest neighbor), (1 = linear), (2 = quadratic), (3 = cubic), .... |
[in,out] | dist | the species distribution being added to the particle contributions |
[in,out] | norm | the normalization coefficient used for the grid <–> particle interpolation |
void f0_update_f0g_pseudo_inv | ( | const Grid< DeviceType > & | grid, |
const MagneticField< DeviceType > & | magnetic_field, | ||
const Species< DeviceType > & | species, | ||
const VelocityGrid & | vgrid, | ||
const DomainDecomposition< DeviceType > & | pol_decomp, | ||
bool | update_f_and_n, | ||
DMWrapper & | pseudo_inv_dm, | ||
Pseudo_inverse< DeviceType > & | pseudo_inv, | ||
VGridDistribution< DeviceType > & | dist, | ||
VGridDistribution< DeviceType > & | f0g | ||
) |
Loop over nodes and interpolate weights to grid distribution. This is pseudo-inverse version with particles -> velocity grid interpolation done with PETSc.
NOTE: This method is slower than the other but may be necessary for a PETSc collision operator.
[in] | grid | spatial grid object |
[in] | magnetic_field | magnetic field object |
[in] | species | contains species parameters |
[in] | vgrid | contains the velocity grid dimensions |
[in] | pol_decomp | contains poloidal decomposition info |
[in] | update_f_and_n | whether to add particle weights in the distribution function used for the source routines |
[in] | pseudo_inv_dm | pseudo-inverse mesh object |
[in] | pseudo_inv | pseudo-inverse object (contains pseudo-inverse arrays) |
[in,out] | dist | the species distribution being added to the particle contributions |
void update_f0_sp | ( | const Simulation< DeviceType > & | sml, |
const Grid< DeviceType > & | grid, | ||
const MagneticField< DeviceType > & | magnetic_field, | ||
Species< DeviceType > & | species, | ||
const VelocityGrid & | vgrid, | ||
const DomainDecomposition< DeviceType > & | pol_decomp, | ||
double | alpha_in, | ||
DMWrapper & | pseudo_inv_dm, | ||
Pseudo_inverse< DeviceType > & | pseudo_inv, | ||
VGridDistribution< DeviceType > & | f0_f, | ||
VGridDistribution< DeviceType > & | f0_n, | ||
VGridDistribution< DeviceType > & | dfg | ||
) |
KOKKOS_INLINE_FUNCTION void update_f0_sp_c | ( | const Simulation< Device > & | sml, |
const Grid< Device > & | grid, | ||
const MagneticField< Device > & | magnetic_field, | ||
const Species< Device > & | species, | ||
const VelocityGrid & | vgrid, | ||
const DomainDecomposition< Device > & | pol_decomp, | ||
double | alpha_in, | ||
bool | update_f_and_n, | ||
int | i_item, | ||
const VGridDistribution< DeviceType > & | dist, | ||
const VGridDistribution< DeviceType > & | norm, | ||
const VGridDistribution< DeviceType > & | f0g | ||
) |
Loop over particles and interpolate weights to grid distribution.
[in] | sml | contains simulation control parameters |
[in] | grid | spatial grid object |
[in] | magnetic_field | magnetic field object |
[in] | species | contains species parameters and particles |
[in] | vgrid | contains the velocity grid dimensions |
[in] | pol_decomp | contains poloidal decomposition info |
[in] | alpha_in | fraction of particle weight transferred to distribution function every source time step |
[in] | update_f_and_n | whether to add particle weights in the distribution function used for the source routines |
[in] | i_item | the particle or particle vector index |
[in,out] | dist | the species distribution being added to the particle contributions |
[in,out] | norm | the normalization coefficient used for the grid <–> particle interpolation |
KOKKOS_INLINE_FUNCTION void update_f0_sp_c_pseudo_inv | ( | const Simulation< Device > & | sml, |
const Grid< Device > & | grid, | ||
const MagneticField< Device > & | magnetic_field, | ||
const Species< Device > & | species, | ||
const VelocityGrid & | vgrid, | ||
const DomainDecomposition< Device > & | pol_decomp, | ||
double | alpha_in, | ||
bool | update_f_and_n, | ||
const Pseudo_inverse< Device > & | pseudo_inv, | ||
int | i_item, | ||
const VGridDistribution< DeviceType > & | dist, | ||
const VGridDistribution< DeviceType > & | norm, | ||
const VGridDistribution< DeviceType > & | f0g | ||
) |
Loop over particles and interpolate weights to grid distribution. Pseudo-inverse version.
[in] | sml | contains simulation control parameters |
[in] | grid | spatial grid object |
[in] | magnetic_field | magnetic field object |
[in] | species | contains species parameters and particles |
[in] | vgrid | contains the velocity grid dimensions |
[in] | pol_decomp | contains poloidal decomposition info |
[in] | alpha_in | fraction of particle weight transferred to distribution function every source time step |
[in] | update_f_and_n | whether to add particle weights in the distribution function used for the source routines |
[in] | pseudo_inv | pseudo-inverse object (contains pseudo-inverse arrays) |
[in] | i_item | the particle or particle vector index |
[in,out] | dist | the species distribution being added to the particle contributions |
[in,out] | norm | the normalization coefficient used for the grid <–> particle interpolation |