WarpX
Functions
ablastr::particles Namespace Reference

Functions

template<typename T_PC >
static void deposit_charge (typename T_PC::ParIterType &pti, typename T_PC::RealVector const &wp, amrex::Real const charge, int const *const ion_lev, amrex::MultiFab *rho, amrex::FArrayBox &local_rho, int const particle_shape, std::array< amrex::Real, 3 > const &dx, std::array< amrex::Real, 3 > const &xyzmin, int const n_rz_azimuthal_modes=0, std::optional< amrex::IntVect > num_rho_deposition_guards=std::nullopt, std::optional< int > depos_lev=std::nullopt, std::optional< amrex::IntVect > rel_ref_ratio=std::nullopt, long const offset=0, std::optional< long > np_to_deposit=std::nullopt, int const icomp=0, int const nc=1, bool const do_device_synchronize=true)
 
AMREX_GPU_HOST_DEVICE AMREX_INLINE void compute_weights (const amrex::ParticleReal xp, const amrex::ParticleReal yp, const amrex::ParticleReal zp, amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > const &plo, amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > const &dxi, int &i, int &j, int &k, amrex::Real W[AMREX_SPACEDIM][2], int nodal=1) noexcept
 Compute weight of each surrounding node (or cell-centered nodes) in interpolating a nodal ((or a cell-centered node) field to the given coordinates. If nodal=1, then the calculations will be done with respect to the nodes (default). If nodal=0, then the calculations will be done with respect to the cell-centered nodal) More...
 
AMREX_GPU_HOST_DEVICE AMREX_INLINE amrex::Real interp_field_nodal (int i, int j, int k, const amrex::Real W[AMREX_SPACEDIM][2], amrex::Array4< const amrex::Real > const &scalar_field) noexcept
 Interpolate nodal field value based on surrounding indices and weights. More...
 
AMREX_GPU_HOST_DEVICE AMREX_INLINE amrex::Real doGatherScalarFieldNodal (const amrex::ParticleReal xp, const amrex::ParticleReal yp, const amrex::ParticleReal zp, amrex::Array4< const amrex::Real > const &scalar_field, amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > const &dxi, amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > const &lo) noexcept
 Scalar field gather for a single particle. The field has to be defined at the cell nodes (see https://amrex-codes.github.io/amrex/docs_html/Basics.html#id2) More...
 
AMREX_GPU_HOST_DEVICE AMREX_INLINE amrex::GpuArray< amrex::Real, 3 > doGatherVectorFieldNodal (const amrex::ParticleReal xp, const amrex::ParticleReal yp, const amrex::ParticleReal zp, amrex::Array4< const amrex::Real > const &vector_field_x, amrex::Array4< const amrex::Real > const &vector_field_y, amrex::Array4< const amrex::Real > const &vector_field_z, amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > const &dxi, amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > const &lo) noexcept
 Vector field gather for a single particle. The field has to be defined at the cell nodes (see https://amrex-codes.github.io/amrex/docs_html/Basics.html#id2) More...
 
template<typename T_PC >
static std::tuple< amrex::ParticleReal, amrex::ParticleReal, amrex::ParticleReal, amrex::ParticleReal, amrex::ParticleReal, amrex::ParticleReal > MinAndMaxPositions (T_PC const &pc)
 
template<typename T_PC , int T_RealSoAWeight>
static std::tuple< amrex::ParticleReal, amrex::ParticleReal, amrex::ParticleReal, amrex::ParticleReal, amrex::ParticleReal, amrex::ParticleReal > MeanAndStdPositions (T_PC const &pc)
 

Function Documentation

◆ compute_weights()

AMREX_GPU_HOST_DEVICE AMREX_INLINE void ablastr::particles::compute_weights ( const amrex::ParticleReal  xp,
const amrex::ParticleReal  yp,
const amrex::ParticleReal  zp,
amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > const &  plo,
amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > const &  dxi,
int i,
int j,
int k,
amrex::Real  W[AMREX_SPACEDIM][2],
int  nodal = 1 
)
noexcept

Compute weight of each surrounding node (or cell-centered nodes) in interpolating a nodal ((or a cell-centered node) field to the given coordinates. If nodal=1, then the calculations will be done with respect to the nodes (default). If nodal=0, then the calculations will be done with respect to the cell-centered nodal)

This currently only does linear order.

Parameters
xp,yp,zpParticle position coordinates
ploIndex lower bounds of domain.
dxiinverse 3D cell spacing
i,j,kVariables to store indices of position on grid (nodal or cell-centered, depending of the value of nodal)
W2D array of weights to store each neighbouring node (or cell-centered node)
nodalInt that tells if the weights are calculated in respect to the nodes (nodal=1) of the cell-centered nodes (nodal=0)

◆ deposit_charge()

template<typename T_PC >
static void ablastr::particles::deposit_charge ( typename T_PC::ParIterType &  pti,
typename T_PC::RealVector const &  wp,
amrex::Real const  charge,
int const *const  ion_lev,
amrex::MultiFab rho,
amrex::FArrayBox local_rho,
int const  particle_shape,
std::array< amrex::Real, 3 > const &  dx,
std::array< amrex::Real, 3 > const &  xyzmin,
int const  n_rz_azimuthal_modes = 0,
std::optional< amrex::IntVect num_rho_deposition_guards = std::nullopt,
std::optional< int depos_lev = std::nullopt,
std::optional< amrex::IntVect rel_ref_ratio = std::nullopt,
long const  offset = 0,
std::optional< long >  np_to_deposit = std::nullopt,
int const  icomp = 0,
int const  nc = 1,
bool const  do_device_synchronize = true 
)
static

Perform charge deposition for the particles on a tile.

Template Parameters
T_PCa type of amrex::ParticleContainer
Parameters
ptian amrex::ParIter pointing to the tile to operate on
wpvector of the particle weights for those particles.
chargecharge of the particle species
ion_levpointer to array of particle ionization level. This is required to have the charge of each macroparticle since q is a scalar. For non-ionizable species, ion_lev is a null pointer.
rhoMultiFab of the charge density
local_rhotemporary FArrayBox for deposition with OpenMP
particle_shapeshape factor in each direction
dxcell spacing at level lev
xyzminlo corner of the current tile in physical coordinates.
n_rz_azimuthal_modesnumber of azimuthal modes in use, irrelevant outside RZ geometry (default: 0)
num_rho_deposition_guardsnumber of ghost cells to use for rho (default: rho.nGrowVect())
depos_levthe level to deposit the particles to (default: lev)
rel_ref_ratiomesh refinement ratio between lev and depos_lev (default: 1)
offsetindex to start at when looping over particles to deposit (default: 0)
np_to_depositnumber of particles to deposit (default: pti.numParticles())
icompcomponent in MultiFab to start depositing to
ncnumber of components to deposit
do_device_synchronizecall amrex::Gpu::synchronize() for tiny profiler regions (default: true)

◆ doGatherScalarFieldNodal()

AMREX_GPU_HOST_DEVICE AMREX_INLINE amrex::Real ablastr::particles::doGatherScalarFieldNodal ( const amrex::ParticleReal  xp,
const amrex::ParticleReal  yp,
const amrex::ParticleReal  zp,
amrex::Array4< const amrex::Real > const &  scalar_field,
amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > const &  dxi,
amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > const &  lo 
)
noexcept

Scalar field gather for a single particle. The field has to be defined at the cell nodes (see https://amrex-codes.github.io/amrex/docs_html/Basics.html#id2)

Parameters
xp,yp,zpParticle position coordinates
scalar_fieldArray4 of the nodal scalar field, either full array or tile.
dxiinverse 3D cell spacing
loIndex lower bounds of domain.

◆ doGatherVectorFieldNodal()

AMREX_GPU_HOST_DEVICE AMREX_INLINE amrex::GpuArray<amrex::Real, 3> ablastr::particles::doGatherVectorFieldNodal ( const amrex::ParticleReal  xp,
const amrex::ParticleReal  yp,
const amrex::ParticleReal  zp,
amrex::Array4< const amrex::Real > const &  vector_field_x,
amrex::Array4< const amrex::Real > const &  vector_field_y,
amrex::Array4< const amrex::Real > const &  vector_field_z,
amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > const &  dxi,
amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > const &  lo 
)
noexcept

Vector field gather for a single particle. The field has to be defined at the cell nodes (see https://amrex-codes.github.io/amrex/docs_html/Basics.html#id2)

Parameters
xp,yp,zpParticle position coordinates
vector_field_x,vector_field_y,vector_field_zArray4 of nodal scalar fields, either full array or tile.
dxiinverse 3D cell spacing
loIndex lower bounds of domain.

◆ interp_field_nodal()

AMREX_GPU_HOST_DEVICE AMREX_INLINE amrex::Real ablastr::particles::interp_field_nodal ( int  i,
int  j,
int  k,
const amrex::Real  W[AMREX_SPACEDIM][2],
amrex::Array4< const amrex::Real > const &  scalar_field 
)
noexcept

Interpolate nodal field value based on surrounding indices and weights.

Parameters
i,j,kIndices of position on grid
W2D array of weights for each neighbouring node
scalar_fieldArray4 of the nodal scalar field, either full array or tile.

◆ MeanAndStdPositions()

template<typename T_PC , int T_RealSoAWeight>
static std::tuple< amrex::ParticleReal, amrex::ParticleReal, amrex::ParticleReal, amrex::ParticleReal, amrex::ParticleReal, amrex::ParticleReal> ablastr::particles::MeanAndStdPositions ( T_PC const &  pc)
static

Compute the mean and std of the particle position in each dimension

Template Parameters
T_PCa type of amrex::ParticleContainer
T_RealSoAWeight
Parameters
pcthe particle container to operate on
Returns
x_mean, x_std, y_mean, y_std, z_mean, z_std

◆ MinAndMaxPositions()

template<typename T_PC >
static std::tuple< amrex::ParticleReal, amrex::ParticleReal, amrex::ParticleReal, amrex::ParticleReal, amrex::ParticleReal, amrex::ParticleReal> ablastr::particles::MinAndMaxPositions ( T_PC const &  pc)
static

Compute the min and max of the particle position in each dimension

Template Parameters
T_PCa type of amrex::ParticleContainer
Parameters
pcthe particle container to operate on
Returns
x_min, y_min, z_min, x_max, y_max, z_max