WarpX
Functions
FieldGather.H File Reference
#include "Particles/Gather/GetExternalFields.H"
#include "Particles/Pusher/GetAndSetPosition.H"
#include "Particles/ShapeFactors.H"
#include "Utils/WarpX_Complex.H"
#include <AMReX.H>

Go to the source code of this file.

Functions

template<int depos_order, int galerkin_interpolation>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void doGatherShapeN (const amrex::ParticleReal xp, const amrex::ParticleReal yp, const amrex::ParticleReal zp, amrex::ParticleReal &Exp, amrex::ParticleReal &Eyp, amrex::ParticleReal &Ezp, amrex::ParticleReal &Bxp, amrex::ParticleReal &Byp, amrex::ParticleReal &Bzp, amrex::Array4< amrex::Real const > const &ex_arr, amrex::Array4< amrex::Real const > const &ey_arr, amrex::Array4< amrex::Real const > const &ez_arr, amrex::Array4< amrex::Real const > const &bx_arr, amrex::Array4< amrex::Real const > const &by_arr, amrex::Array4< amrex::Real const > const &bz_arr, const amrex::IndexType ex_type, const amrex::IndexType ey_type, const amrex::IndexType ez_type, const amrex::IndexType bx_type, const amrex::IndexType by_type, const amrex::IndexType bz_type, const amrex::GpuArray< amrex::Real, 3 > &dx, const amrex::GpuArray< amrex::Real, 3 > &xyzmin, const amrex::Dim3 &lo, const int n_rz_azimuthal_modes)
 Field gather for a single particle. More...
 
template<int depos_order>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void doGatherShapeNEsirkepovStencilImplicit ([[maybe_unused]] const amrex::ParticleReal xp_n, [[maybe_unused]] const amrex::ParticleReal yp_n, const amrex::ParticleReal zp_n, [[maybe_unused]] const amrex::ParticleReal xp_nph, [[maybe_unused]] const amrex::ParticleReal yp_nph, const amrex::ParticleReal zp_nph, amrex::ParticleReal &Exp, amrex::ParticleReal &Eyp, amrex::ParticleReal &Ezp, amrex::ParticleReal &Bxp, amrex::ParticleReal &Byp, amrex::ParticleReal &Bzp, amrex::Array4< amrex::Real const > const &Ex_arr, amrex::Array4< amrex::Real const > const &Ey_arr, amrex::Array4< amrex::Real const > const &Ez_arr, amrex::Array4< amrex::Real const > const &Bx_arr, amrex::Array4< amrex::Real const > const &By_arr, amrex::Array4< amrex::Real const > const &Bz_arr, [[maybe_unused]] const amrex::IndexType Ex_type, [[maybe_unused]] const amrex::IndexType Ey_type, [[maybe_unused]] const amrex::IndexType Ez_type, [[maybe_unused]] const amrex::IndexType Bx_type, [[maybe_unused]] const amrex::IndexType By_type, [[maybe_unused]] const amrex::IndexType Bz_type, const amrex::GpuArray< amrex::Real, 3 > &dx, const amrex::GpuArray< amrex::Real, 3 > &xyzmin, const amrex::Dim3 &lo, const int n_rz_azimuthal_modes)
 Energy conserving field gather for thread thread_num for the implicit scheme This uses the same stencil for the gather that is used for Esirkepov current deposition. More...
 
template<int depos_order>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void doGatherPicnicShapeN ([[maybe_unused]] const amrex::ParticleReal xp_n, [[maybe_unused]] const amrex::ParticleReal yp_n, const amrex::ParticleReal zp_n, [[maybe_unused]] const amrex::ParticleReal xp_nph, [[maybe_unused]] const amrex::ParticleReal yp_nph, const amrex::ParticleReal zp_nph, amrex::ParticleReal &Exp, amrex::ParticleReal &Eyp, amrex::ParticleReal &Ezp, amrex::ParticleReal &Bxp, amrex::ParticleReal &Byp, amrex::ParticleReal &Bzp, amrex::Array4< amrex::Real const > const &Ex_arr, amrex::Array4< amrex::Real const > const &Ey_arr, amrex::Array4< amrex::Real const > const &Ez_arr, amrex::Array4< amrex::Real const > const &Bx_arr, amrex::Array4< amrex::Real const > const &By_arr, amrex::Array4< amrex::Real const > const &Bz_arr, [[maybe_unused]] const amrex::IndexType Ex_type, [[maybe_unused]] const amrex::IndexType Ey_type, [[maybe_unused]] const amrex::IndexType Ez_type, [[maybe_unused]] const amrex::IndexType Bx_type, [[maybe_unused]] const amrex::IndexType By_type, [[maybe_unused]] const amrex::IndexType Bz_type, const amrex::GpuArray< amrex::Real, 3 > &dx, const amrex::GpuArray< amrex::Real, 3 > &xyzmin, const amrex::Dim3 &lo, const int n_rz_azimuthal_modes)
 Energy conserving field gather for thread thread_num for the implicit scheme This uses the same stencil for the gather that is used for Villasenor current deposition. The magnetic field is deposited using direct deposition. More...
 
template<int depos_order, int lower_in_v>
void doGatherShapeN (const GetParticlePosition< PIdx > &getPosition, const GetExternalEBField &getExternalEB, amrex::ParticleReal *const Exp, amrex::ParticleReal *const Eyp, amrex::ParticleReal *const Ezp, amrex::ParticleReal *const Bxp, amrex::ParticleReal *const Byp, amrex::ParticleReal *const Bzp, amrex::FArrayBox const *const exfab, amrex::FArrayBox const *const eyfab, amrex::FArrayBox const *const ezfab, amrex::FArrayBox const *const bxfab, amrex::FArrayBox const *const byfab, amrex::FArrayBox const *const bzfab, const long np_to_gather, const std::array< amrex::Real, 3 > &dx, const std::array< amrex::Real, 3 > xyzmin, const amrex::Dim3 lo, const int n_rz_azimuthal_modes)
 Field gather for particles. More...
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void doGatherShapeN (const amrex::ParticleReal xp, const amrex::ParticleReal yp, const amrex::ParticleReal zp, amrex::ParticleReal &Exp, amrex::ParticleReal &Eyp, amrex::ParticleReal &Ezp, amrex::ParticleReal &Bxp, amrex::ParticleReal &Byp, amrex::ParticleReal &Bzp, amrex::Array4< amrex::Real const > const &ex_arr, amrex::Array4< amrex::Real const > const &ey_arr, amrex::Array4< amrex::Real const > const &ez_arr, amrex::Array4< amrex::Real const > const &bx_arr, amrex::Array4< amrex::Real const > const &by_arr, amrex::Array4< amrex::Real const > const &bz_arr, const amrex::IndexType ex_type, const amrex::IndexType ey_type, const amrex::IndexType ez_type, const amrex::IndexType bx_type, const amrex::IndexType by_type, const amrex::IndexType bz_type, const amrex::GpuArray< amrex::Real, 3 > &dx_arr, const amrex::GpuArray< amrex::Real, 3 > &xyzmin_arr, const amrex::Dim3 &lo, const int n_rz_azimuthal_modes, const int nox, const bool galerkin_interpolation)
 Field gather for a single particle. More...
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void doGatherShapeNImplicit (const amrex::ParticleReal xp_n, const amrex::ParticleReal yp_n, const amrex::ParticleReal zp_n, const amrex::ParticleReal xp_nph, const amrex::ParticleReal yp_nph, const amrex::ParticleReal zp_nph, amrex::ParticleReal &Exp, amrex::ParticleReal &Eyp, amrex::ParticleReal &Ezp, amrex::ParticleReal &Bxp, amrex::ParticleReal &Byp, amrex::ParticleReal &Bzp, amrex::Array4< amrex::Real const > const &ex_arr, amrex::Array4< amrex::Real const > const &ey_arr, amrex::Array4< amrex::Real const > const &ez_arr, amrex::Array4< amrex::Real const > const &bx_arr, amrex::Array4< amrex::Real const > const &by_arr, amrex::Array4< amrex::Real const > const &bz_arr, const amrex::IndexType ex_type, const amrex::IndexType ey_type, const amrex::IndexType ez_type, const amrex::IndexType bx_type, const amrex::IndexType by_type, const amrex::IndexType bz_type, const amrex::GpuArray< amrex::Real, 3 > &dx_arr, const amrex::GpuArray< amrex::Real, 3 > &xyzmin_arr, const amrex::Dim3 &lo, const int n_rz_azimuthal_modes, const int nox, const int depos_type)
 Field gather for a single particle. More...
 

Function Documentation

◆ doGatherPicnicShapeN()

template<int depos_order>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void doGatherPicnicShapeN ( [[maybe_unused] ] const amrex::ParticleReal  xp_n,
[[maybe_unused] ] const amrex::ParticleReal  yp_n,
const amrex::ParticleReal  zp_n,
[[maybe_unused] ] const amrex::ParticleReal  xp_nph,
[[maybe_unused] ] const amrex::ParticleReal  yp_nph,
const amrex::ParticleReal  zp_nph,
amrex::ParticleReal &  Exp,
amrex::ParticleReal &  Eyp,
amrex::ParticleReal &  Ezp,
amrex::ParticleReal &  Bxp,
amrex::ParticleReal &  Byp,
amrex::ParticleReal &  Bzp,
amrex::Array4< amrex::Real const > const &  Ex_arr,
amrex::Array4< amrex::Real const > const &  Ey_arr,
amrex::Array4< amrex::Real const > const &  Ez_arr,
amrex::Array4< amrex::Real const > const &  Bx_arr,
amrex::Array4< amrex::Real const > const &  By_arr,
amrex::Array4< amrex::Real const > const &  Bz_arr,
[[maybe_unused] ] const amrex::IndexType  Ex_type,
[[maybe_unused] ] const amrex::IndexType  Ey_type,
[[maybe_unused] ] const amrex::IndexType  Ez_type,
[[maybe_unused] ] const amrex::IndexType  Bx_type,
[[maybe_unused] ] const amrex::IndexType  By_type,
[[maybe_unused] ] const amrex::IndexType  Bz_type,
const amrex::GpuArray< amrex::Real, 3 > &  dx,
const amrex::GpuArray< amrex::Real, 3 > &  xyzmin,
const amrex::Dim3 lo,
const int  n_rz_azimuthal_modes 
)

Energy conserving field gather for thread thread_num for the implicit scheme This uses the same stencil for the gather that is used for Villasenor current deposition. The magnetic field is deposited using direct deposition.

Template Parameters
depos_orderParticle shape order
Parameters
xp_n,yp_n,zp_nParticle position coordinates at start of step
xp_nph,yp_nph,zp_nphParticle position coordinates at half step
Exp,Eyp,EzpElectric field on particles.
Bxp,Byp,BzpMagnetic field on particles.
Ex_arr,Ey_arr,Ez_arrArray4 of the electric field, either full array or tile.
Bx_arr,By_arr,Bz_arrArray4 of the magnetic field, either full array or tile.
Ex_type,Ey_type,Ez_typeIndexType of the electric field
Bx_type,By_type,Bz_typeIndexType of the magnetic field
dx3D cell spacing
xyzminPhysical lower bounds of domain in x, y, z.
loIndex lower bounds of domain.
n_rz_azimuthal_modesNumber of azimuthal modes when using RZ geometry

◆ doGatherShapeN() [1/3]

template<int depos_order, int galerkin_interpolation>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void doGatherShapeN ( const amrex::ParticleReal  xp,
const amrex::ParticleReal  yp,
const amrex::ParticleReal  zp,
amrex::ParticleReal &  Exp,
amrex::ParticleReal &  Eyp,
amrex::ParticleReal &  Ezp,
amrex::ParticleReal &  Bxp,
amrex::ParticleReal &  Byp,
amrex::ParticleReal &  Bzp,
amrex::Array4< amrex::Real const > const &  ex_arr,
amrex::Array4< amrex::Real const > const &  ey_arr,
amrex::Array4< amrex::Real const > const &  ez_arr,
amrex::Array4< amrex::Real const > const &  bx_arr,
amrex::Array4< amrex::Real const > const &  by_arr,
amrex::Array4< amrex::Real const > const &  bz_arr,
const amrex::IndexType  ex_type,
const amrex::IndexType  ey_type,
const amrex::IndexType  ez_type,
const amrex::IndexType  bx_type,
const amrex::IndexType  by_type,
const amrex::IndexType  bz_type,
const amrex::GpuArray< amrex::Real, 3 > &  dx,
const amrex::GpuArray< amrex::Real, 3 > &  xyzmin,
const amrex::Dim3 lo,
const int  n_rz_azimuthal_modes 
)

Field gather for a single particle.

Template Parameters
depos_orderParticle shape order
galerkin_interpolationLower the order of the particle shape by this value (0/1) for the parallel field component
Parameters
xp,yp,zpParticle position coordinates
Exp,Eyp,EzpElectric field on particles.
Bxp,Byp,BzpMagnetic field on particles.
ex_arr,ey_arr,ez_arrArray4 of the electric field, either full array or tile.
bx_arr,by_arr,bz_arrArray4 of the magnetic field, either full array or tile.
ex_type,ey_type,ez_typeIndexType of the electric field
bx_type,by_type,bz_typeIndexType of the magnetic field
dx3D cell spacing
xyzminPhysical lower bounds of domain in x, y, z.
loIndex lower bounds of domain.
n_rz_azimuthal_modesNumber of azimuthal modes when using RZ geometry

◆ doGatherShapeN() [2/3]

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void doGatherShapeN ( const amrex::ParticleReal  xp,
const amrex::ParticleReal  yp,
const amrex::ParticleReal  zp,
amrex::ParticleReal &  Exp,
amrex::ParticleReal &  Eyp,
amrex::ParticleReal &  Ezp,
amrex::ParticleReal &  Bxp,
amrex::ParticleReal &  Byp,
amrex::ParticleReal &  Bzp,
amrex::Array4< amrex::Real const > const &  ex_arr,
amrex::Array4< amrex::Real const > const &  ey_arr,
amrex::Array4< amrex::Real const > const &  ez_arr,
amrex::Array4< amrex::Real const > const &  bx_arr,
amrex::Array4< amrex::Real const > const &  by_arr,
amrex::Array4< amrex::Real const > const &  bz_arr,
const amrex::IndexType  ex_type,
const amrex::IndexType  ey_type,
const amrex::IndexType  ez_type,
const amrex::IndexType  bx_type,
const amrex::IndexType  by_type,
const amrex::IndexType  bz_type,
const amrex::GpuArray< amrex::Real, 3 > &  dx_arr,
const amrex::GpuArray< amrex::Real, 3 > &  xyzmin_arr,
const amrex::Dim3 lo,
const int  n_rz_azimuthal_modes,
const int  nox,
const bool  galerkin_interpolation 
)

Field gather for a single particle.

Parameters
xp,yp,zpParticle position coordinates
Exp,Eyp,EzpElectric field on particles.
Bxp,Byp,BzpMagnetic field on particles.
ex_arr,ey_arr,ez_arrArray4 of the electric field, either full array or tile.
bx_arr,by_arr,bz_arrArray4 of the magnetic field, either full array or tile.
ex_type,ey_type,ez_typeIndexType of the electric field
bx_type,by_type,bz_typeIndexType of the magnetic field
dx_arr3D cell spacing
xyzmin_arrPhysical lower bounds of domain in x, y, z.
loIndex lower bounds of domain.
n_rz_azimuthal_modesNumber of azimuthal modes when using RZ geometry
noxorder of the particle shape function
galerkin_interpolationwhether to use lower order in v

◆ doGatherShapeN() [3/3]

template<int depos_order, int lower_in_v>
void doGatherShapeN ( const GetParticlePosition< PIdx > &  getPosition,
const GetExternalEBField getExternalEB,
amrex::ParticleReal *const  Exp,
amrex::ParticleReal *const  Eyp,
amrex::ParticleReal *const  Ezp,
amrex::ParticleReal *const  Bxp,
amrex::ParticleReal *const  Byp,
amrex::ParticleReal *const  Bzp,
amrex::FArrayBox const *const  exfab,
amrex::FArrayBox const *const  eyfab,
amrex::FArrayBox const *const  ezfab,
amrex::FArrayBox const *const  bxfab,
amrex::FArrayBox const *const  byfab,
amrex::FArrayBox const *const  bzfab,
const long  np_to_gather,
const std::array< amrex::Real, 3 > &  dx,
const std::array< amrex::Real, 3 >  xyzmin,
const amrex::Dim3  lo,
const int  n_rz_azimuthal_modes 
)

Field gather for particles.

Template Parameters
depos_orderdeposition order
lower_in_vlower shape order in parallel direction (Galerkin)
Parameters
getPositionA functor for returning the particle position.
getExternalEBA functor for assigning the external E and B fields.
Exp,Eyp,EzpPointer to array of electric field on particles.
Bxp,Byp,BzpPointer to array of magnetic field on particles.
exfab,eyfab,ezfabArray4 of the electric field, either full array or tile.
bxfab,byfab,bzfabArray4 of the magnetic field, either full array or tile.
np_to_gatherNumber of particles for which field is gathered.
dx3D cell size
xyzminPhysical lower bounds of domain.
loIndex lower bounds of domain.
n_rz_azimuthal_modesNumber of azimuthal modes when using RZ geometry

◆ doGatherShapeNEsirkepovStencilImplicit()

template<int depos_order>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void doGatherShapeNEsirkepovStencilImplicit ( [[maybe_unused] ] const amrex::ParticleReal  xp_n,
[[maybe_unused] ] const amrex::ParticleReal  yp_n,
const amrex::ParticleReal  zp_n,
[[maybe_unused] ] const amrex::ParticleReal  xp_nph,
[[maybe_unused] ] const amrex::ParticleReal  yp_nph,
const amrex::ParticleReal  zp_nph,
amrex::ParticleReal &  Exp,
amrex::ParticleReal &  Eyp,
amrex::ParticleReal &  Ezp,
amrex::ParticleReal &  Bxp,
amrex::ParticleReal &  Byp,
amrex::ParticleReal &  Bzp,
amrex::Array4< amrex::Real const > const &  Ex_arr,
amrex::Array4< amrex::Real const > const &  Ey_arr,
amrex::Array4< amrex::Real const > const &  Ez_arr,
amrex::Array4< amrex::Real const > const &  Bx_arr,
amrex::Array4< amrex::Real const > const &  By_arr,
amrex::Array4< amrex::Real const > const &  Bz_arr,
[[maybe_unused] ] const amrex::IndexType  Ex_type,
[[maybe_unused] ] const amrex::IndexType  Ey_type,
[[maybe_unused] ] const amrex::IndexType  Ez_type,
[[maybe_unused] ] const amrex::IndexType  Bx_type,
[[maybe_unused] ] const amrex::IndexType  By_type,
[[maybe_unused] ] const amrex::IndexType  Bz_type,
const amrex::GpuArray< amrex::Real, 3 > &  dx,
const amrex::GpuArray< amrex::Real, 3 > &  xyzmin,
const amrex::Dim3 lo,
const int  n_rz_azimuthal_modes 
)

Energy conserving field gather for thread thread_num for the implicit scheme This uses the same stencil for the gather that is used for Esirkepov current deposition.

Template Parameters
depos_orderParticle shape order
Parameters
xp_n,yp_n,zp_nParticle position coordinates at start of step
xp_nph,yp_nph,zp_nphParticle position coordinates at half step
Exp,Eyp,EzpElectric field on particles.
Bxp,Byp,BzpMagnetic field on particles.
Ex_arr,Ey_arr,Ez_arrArray4 of the electric field, either full array or tile.
Bx_arr,By_arr,Bz_arrArray4 of the magnetic field, either full array or tile.
Ex_type,Ey_type,Ez_typeIndexType of the electric field
Bx_type,By_type,Bz_typeIndexType of the magnetic field
dx3D cell spacing
xyzminPhysical lower bounds of domain in x, y, z.
loIndex lower bounds of domain.
n_rz_azimuthal_modesNumber of azimuthal modes when using RZ geometry

◆ doGatherShapeNImplicit()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void doGatherShapeNImplicit ( const amrex::ParticleReal  xp_n,
const amrex::ParticleReal  yp_n,
const amrex::ParticleReal  zp_n,
const amrex::ParticleReal  xp_nph,
const amrex::ParticleReal  yp_nph,
const amrex::ParticleReal  zp_nph,
amrex::ParticleReal &  Exp,
amrex::ParticleReal &  Eyp,
amrex::ParticleReal &  Ezp,
amrex::ParticleReal &  Bxp,
amrex::ParticleReal &  Byp,
amrex::ParticleReal &  Bzp,
amrex::Array4< amrex::Real const > const &  ex_arr,
amrex::Array4< amrex::Real const > const &  ey_arr,
amrex::Array4< amrex::Real const > const &  ez_arr,
amrex::Array4< amrex::Real const > const &  bx_arr,
amrex::Array4< amrex::Real const > const &  by_arr,
amrex::Array4< amrex::Real const > const &  bz_arr,
const amrex::IndexType  ex_type,
const amrex::IndexType  ey_type,
const amrex::IndexType  ez_type,
const amrex::IndexType  bx_type,
const amrex::IndexType  by_type,
const amrex::IndexType  bz_type,
const amrex::GpuArray< amrex::Real, 3 > &  dx_arr,
const amrex::GpuArray< amrex::Real, 3 > &  xyzmin_arr,
const amrex::Dim3 lo,
const int  n_rz_azimuthal_modes,
const int  nox,
const int  depos_type 
)

Field gather for a single particle.

Parameters
xp_n,yp_n,zp_nParticle position coordinates at start of step
xp_nph,yp_nph,zp_nphParticle position coordinates at half time level (n + half)
Exp,Eyp,EzpElectric field on particles.
Bxp,Byp,BzpMagnetic field on particles.
ex_arr,ey_arr,ez_arrArray4 of the electric field, either full array or tile.
bx_arr,by_arr,bz_arrArray4 of the magnetic field, either full array or tile.
ex_type,ey_type,ez_typeIndexType of the electric field
bx_type,by_type,bz_typeIndexType of the magnetic field
dx_arr3D cell spacing
xyzmin_arrPhysical lower bounds of domain in x, y, z.
loIndex lower bounds of domain.
n_rz_azimuthal_modesNumber of azimuthal modes when using RZ geometry
noxorder of the particle shape function
gather_typeinteger identifier for which algorithm to use
galerkin_interpolationwhether to use lower order in v