XGCa
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Functions
distribute_f0g.cpp File Reference
#include "timer_macro.hpp"
#include "send_particles.hpp"
#include "domain_decomposition.hpp"
#include "globals.hpp"
#include "quadratic_weights.hpp"
#include "distribute_f0g.hpp"
#include "petscdmplex.h"
#include "petscds.h"
#include "petscdmswarm.h"
#include "petscksp.h"
Include dependency graph for distribute_f0g.cpp:

Functions

template<class Device >
KOKKOS_INLINE_FUNCTION void distribute_f0g_c (const TmpSpecies< Device > &tmp_species, 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, const Kokkos::View< double ****, Kokkos::LayoutRight, DeviceType > &df0g, const Kokkos::View< double ****, Kokkos::LayoutRight, DeviceType > &n, const Kokkos::View< double ***, Kokkos::LayoutRight, DeviceType > &df0g_delete, int iw0, int nw, int i_item)
 
void distribute_f0g_c_pseudo_inv (const TmpSpecies< DeviceType > &tmp_species, const Simulation< DeviceType > &sml, const Grid< DeviceType > &grid, const MagneticField< DeviceType > &magnetic_field, const Species< DeviceType > &species, const VelocityGrid &vgrid, const DomainDecomposition< DeviceType > &pol_decomp, int isp_non_ad, const Kokkos::View< double ****, Kokkos::LayoutRight, DeviceType > &df0g, const Kokkos::View< double ****, Kokkos::LayoutRight, Kokkos::HostSpace > df0g_h, const Kokkos::View< double ****, Kokkos::LayoutRight, DeviceType > &n, const Kokkos::View< double ***, Kokkos::LayoutRight, DeviceType > &df0g_delete, const Kokkos::View< double ***, Kokkos::LayoutRight, Kokkos::HostSpace > df0g_delete_h, int iw0, int nw, DMWrapper &pseudo_inv_dm, Pseudo_inverse< DeviceType > &pseudo_inv)
 
double * get_grid_vol_loc ()
 
void pre_distribute_f0g (int sp_type, double *df0g_h, double *n_h, int *iw0, int *nw)
 
void post_distribute_f0g (int sp_type, double *df0g_h, double *df0g_delete_h)
 
void distribute_f0g (const Simulation< DeviceType > &sml, const Grid< DeviceType > &grid, const MagneticField< DeviceType > &magnetic_field, Species< DeviceType > &species, const TmpSpecies< DeviceType > &tmp_species, const VelocityGrid &vgrid, const DomainDecomposition< DeviceType > &pol_decomp, int isp_non_ad, DMWrapper &pseudo_inv_dm, Pseudo_inverse< DeviceType > &pseudo_inv)
 
void all_species_distribute_f0g (const Simulation< DeviceType > &sml, const Grid< DeviceType > &grid, const MagneticField< DeviceType > &magnetic_field, Plasma &plasma, const VelocityGrid &vgrid, const DomainDecomposition< DeviceType > &pol_decomp, DMWrapper &pseudo_inv_dm, Pseudo_inverse< DeviceType > &pseudo_inv)
 

Function Documentation

void all_species_distribute_f0g ( const Simulation< DeviceType > &  sml,
const Grid< DeviceType > &  grid,
const MagneticField< DeviceType > &  magnetic_field,
Plasma plasma,
const VelocityGrid vgrid,
const DomainDecomposition< DeviceType > &  pol_decomp,
DMWrapper pseudo_inv_dm,
Pseudo_inverse< DeviceType > &  pseudo_inv 
)

Loops over all non-adiabatic species and adjusts particle weight to distribute f0g distribution function to particles

Parameters
[in]smlcontains simulation control parameters
[in]gridis the spatial grid
[in]magnetic_fieldis the magnetic field
[in]plasmacontains all species info
[in]vgridcontains the velocity grid dimensions
[in]pol_decompcontains poloidal decomposition info
[in]pseudo_inv_dmis the pseudo-inverse mesh object
[in]pseudo_invis the pseudo-inverse object (contains pseudo-inverse arrays)
Returns
void

Here is the call graph for this function:

Here is the caller graph for this function:

void distribute_f0g ( const Simulation< DeviceType > &  sml,
const Grid< DeviceType > &  grid,
const MagneticField< DeviceType > &  magnetic_field,
Species< DeviceType > &  species,
const TmpSpecies< DeviceType > &  tmp_species,
const VelocityGrid vgrid,
const DomainDecomposition< DeviceType > &  pol_decomp,
int  isp_non_ad,
DMWrapper pseudo_inv_dm,
Pseudo_inverse< DeviceType > &  pseudo_inv 
)

Copies f0 data to device, then adjusts particle weight to distribute f0g distribution function to particles

Parameters
[in]smlcontains simulation control parameters
[in]gridis the spatial grid
[in]magnetic_fieldis the magnetic field
[in]speciescontains species parameters
[in,out]tmp_speciescontains the particle data
[in]vgridcontains the velocity grid dimensions
[in]pol_decompcontains poloidal decomposition info
[in]isp_non_adis a separate index tracking non-adiabatic species since if electrons are adiabatic, the Fortran arrays will start at 1 instead of 0 and the pointers need to account for that
[in]pseudo_inv_dmis the pseudo-inverse mesh object
[in]pseudo_invis the pseudo-inverse object (contains pseudo-inverse arrays)
Returns
void

Here is the call graph for this function:

Here is the caller graph for this function:

template<class Device >
KOKKOS_INLINE_FUNCTION void distribute_f0g_c ( const TmpSpecies< Device > &  tmp_species,
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,
const Kokkos::View< double ****, Kokkos::LayoutRight, DeviceType > &  df0g,
const Kokkos::View< double ****, Kokkos::LayoutRight, DeviceType > &  n,
const Kokkos::View< double ***, Kokkos::LayoutRight, DeviceType > &  df0g_delete,
int  iw0,
int  nw,
int  i_item 
)

Adjusts particle weight to distribute f0g distribution function to particles, and marks cells for deletion if a particle is found there

Parameters
[in,out]tmp_speciescontains the particle data
[in]smlcontains simulation control parameters
[in]gridis the spatial grid
[in]magnetic_fieldis the magnetic field
[in]speciescontains species parameters
[in]vgridcontains the velocity grid dimensions
[in]pol_decompcontains poloidal decomposition info
[in]df0gis the part of the distribution function being transferred to particles
[in]nis the normalization for mesh-particle interpolation
[out]df0g_deletetracks which cells successfully transferred their distribution to particles
[in]iw0and nw are indices to manage how averaging works with XGCA vs XGC1
[in]nwand iw0 are indices to manage how averaging works with XGCA vs XGC1
[in]i_itemis the particle or particle vector index
Returns
void

Here is the call graph for this function:

Here is the caller graph for this function:

void distribute_f0g_c_pseudo_inv ( const TmpSpecies< DeviceType > &  tmp_species,
const Simulation< DeviceType > &  sml,
const Grid< DeviceType > &  grid,
const MagneticField< DeviceType > &  magnetic_field,
const Species< DeviceType > &  species,
const VelocityGrid vgrid,
const DomainDecomposition< DeviceType > &  pol_decomp,
int  isp_non_ad,
const Kokkos::View< double ****, Kokkos::LayoutRight, DeviceType > &  df0g,
const Kokkos::View< double ****, Kokkos::LayoutRight, Kokkos::HostSpace >  df0g_h,
const Kokkos::View< double ****, Kokkos::LayoutRight, DeviceType > &  n,
const Kokkos::View< double ***, Kokkos::LayoutRight, DeviceType > &  df0g_delete,
const Kokkos::View< double ***, Kokkos::LayoutRight, Kokkos::HostSpace >  df0g_delete_h,
int  iw0,
int  nw,
DMWrapper pseudo_inv_dm,
Pseudo_inverse< DeviceType > &  pseudo_inv 
)

Adjusts particle weight to distribute f0g distribution function to particles, and marks cells for deletion if a particle is found there Pseudo-inverse version. (Implementation based on PETSc v3.17.0 example petsc/src/dm/impls/swarm/tests/ex7.c)

Parameters
[in,out]tmp_speciescontains the particle data
[in]smlcontains simulation control parameters
[in]gridspatial grid object
[in]magnetic_fieldmagnetic field object
[in]speciescontains species parameters
[in]vgridcontains the velocity grid dimensions
[in]pol_decompcontains poloidal decomposition info
[in]isp_non_adnon-adiabatic species index
[in]df0gis the part of the distribution function being transferred to particles
[in]df0g_hhost version of df0g
[in]nis the normalization for mesh-particle interpolation
[out]df0g_deletetracks which cells successfully transferred their distribution to particles
[out]df0g_delete_hhost version of df0g_delete
[in]iw0and nw are indices to manage how averaging works with XGCa vs XGC1
[in]nwand iw0 are indices to manage how averaging works with XGCa vs XGC1
[in]pseudo_inv_dmpseudo-inverse mesh object
[in]pseudo_invpseudo-inverse object (contains pseudo-inverse arrays)
Returns
void

Here is the call graph for this function:

Here is the caller graph for this function:

double* get_grid_vol_loc ( )

Here is the caller graph for this function:

void post_distribute_f0g ( int  sp_type,
double *  df0g_h,
double *  df0g_delete_h 
)
void pre_distribute_f0g ( int  sp_type,
double *  df0g_h,
double *  n_h,
int *  iw0,
int *  nw 
)