8#ifndef WARPX_ADDPLASMAUTILITIES_H_
9#define WARPX_ADDPLASMAUTILITIES_H_
31 x{static_cast<
amrex::ParticleReal>(a.
x)},
32 y{static_cast<
amrex::ParticleReal>(a.
y)},
33 z{static_cast<
amrex::ParticleReal>(a.
z)}
77 return (pcount != 0) ?
AMREX_D_TERM(dx[0],*dx[1],*dx[2])/pcount : 0.0_rt;
87#if defined(WARPX_DIM_3D)
89#elif defined(WARPX_DIM_RZ) || defined(WARPX_DIM_XZ)
90 if (normal_axis == 0) { r /= iv[0]; }
91 else if (normal_axis == 2) { r /= iv[1]; }
92#elif defined(WARPX_DIM_1D_Z)
93 if (normal_axis == 2) { r /= iv[0]; }
94#elif defined(WARPX_DIM_RCYLINDER) || defined(WARPX_DIM_RSPHERE)
95 if (normal_axis == 0) { r /= iv[0]; }
125#if defined(WARPX_DIM_3D)
130#elif defined(WARPX_DIM_RZ) || defined(WARPX_DIM_XZ)
140 scale_fac /= num_ppc_real;
159void rotate_momentum_eb (
167#if defined(WARPX_DIM_3D)
177 amrex::Real const sin_theta = std::sqrt(1._rt-nz*nz);
178 amrex::Real const nperp = std::sqrt(nx*nx + ny*ny);
186 amrex::Real const ux = pu.
x*cos_theta*cos_phi - pu.
y*sin_phi + pu.
z*sin_theta*cos_phi;
187 amrex::Real const uy = pu.
x*cos_theta*sin_phi + pu.
y*cos_phi + pu.
z*sin_theta*sin_phi;
193#elif defined(WARPX_DIM_RZ) || defined(WARPX_DIM_XZ)
215 const amrex::Real num_ppc_real,
const int flux_normal_axis) {
219#if defined(WARPX_DIM_3D)
220 scale_fac /= dx[flux_normal_axis];
221#elif defined(WARPX_DIM_RZ) || defined(WARPX_DIM_XZ)
224 if (flux_normal_axis == 0) { scale_fac /= dx[0]; }
227 if (flux_normal_axis == 2) { scale_fac /= dx[1]; }
230#elif defined(WARPX_DIM_1D_Z)
231 if (flux_normal_axis == 2) { scale_fac /= dx[0]; }
232#elif defined(WARPX_DIM_RCYLINDER) || defined(WARPX_DIM_RSPHERE)
233 if (flux_normal_axis == 0) { scale_fac /= dx[0]; }
245 std::size_t a_num_user_real_attribs,
246 const amrex::Vector< std::unique_ptr<amrex::Parser> >& a_user_int_attrib_parser,
247 const amrex::Vector< std::unique_ptr<amrex::Parser> >& a_user_real_attrib_parser);
255 template <
typename SoAType>
257 const std::vector<std::string>& a_user_int_attribs,
258 const std::vector<std::string>& a_user_real_attribs,
265 m_d_pa_user_int.resize(a_user_int_attribs.size());
266 m_d_pa_user_real.resize(a_user_real_attribs.size());
267 m_d_user_int_attrib_parserexec.resize(a_user_int_attribs.size());
268 m_d_user_real_attrib_parserexec.resize(a_user_real_attribs.size());
271 for (std::size_t ia = 0; ia < a_user_int_attribs.size(); ++ia) {
274 for (std::size_t ia = 0; ia < a_user_real_attribs.size(); ++ia) {
312 template <
typename SoAType>
314 bool a_has_quantum_sync,
bool a_has_breit_wheeler,
315 const std::shared_ptr<QuantumSynchrotronEngine>& a_shr_p_qs_engine,
316 const std::shared_ptr<BreitWheelerEngine>& a_shr_p_bw_engine)
321 a_shr_p_qs_engine->build_optical_depth_functor();
326 a_shr_p_bw_engine->build_optical_depth_functor();
#define AMREX_FORCE_INLINE
#define AMREX_GPU_HOST_DEVICE
#define AMREX_D_TERM(a, b, c)
#define AMREX_D_DECL(a, b, c)
bool find_overlap_flux(const amrex::RealBox &tile_realbox, const amrex::RealBox &part_realbox, const amrex::GpuArray< amrex::Real, 3 > &dx, const amrex::GpuArray< amrex::Real, 3 > &prob_lo, const PlasmaInjector &plasma_injector, amrex::RealBox &overlap_realbox, amrex::Box &overlap_box, amrex::IntVect &shifted)
Definition AddPlasmaUtilities.cpp:45
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real compute_scale_fac_area_plane(const amrex::GpuArray< amrex::Real, 3 > &dx, const amrex::Real num_ppc_real, const int flux_normal_axis)
Definition AddPlasmaUtilities.H:214
bool find_overlap(const amrex::RealBox &tile_realbox, const amrex::RealBox &part_realbox, const amrex::GpuArray< amrex::Real, 3 > &dx, const amrex::GpuArray< amrex::Real, 3 > &prob_lo, amrex::RealBox &overlap_realbox, amrex::Box &overlap_box, amrex::IntVect &shifted)
Definition AddPlasmaUtilities.cpp:12
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE int compute_area_weights(const amrex::IntVect &iv, const int normal_axis)
Definition AddPlasmaUtilities.H:85
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real compute_scale_fac_volume(const amrex::GpuArray< amrex::Real, 3 > &dx, const amrex::Long pcount)
Definition AddPlasmaUtilities.H:74
Definition BreitWheelerEngineWrapper.H:78
Definition PlasmaInjector.H:39
Definition QuantumSyncEngineWrapper.H:76
amrex_particle_real ParticleReal
PODVector< T, PinnedArenaAllocator< T > > PinnedVector
PODVector< T, ArenaAllocator< T > > DeviceVector
void copyAsync(HostToDevice, InIter begin, InIter end, OutIter result) noexcept
static constexpr HostToDevice hostToDevice
constexpr T powi(T x) noexcept
__host__ __device__ void ignore_unused(const Ts &...)
Definition AddPlasmaUtilities.H:25
amrex::ParticleReal z
Definition AddPlasmaUtilities.H:26
AMREX_GPU_HOST_DEVICE PDim3(PDim3 const &)=default
amrex::ParticleReal x
Definition AddPlasmaUtilities.H:26
AMREX_GPU_HOST_DEVICE PDim3(PDim3 &&)=default
AMREX_GPU_HOST_DEVICE ~PDim3()=default
AMREX_GPU_HOST_DEVICE PDim3 & operator=(PDim3 &&)=default
amrex::ParticleReal y
Definition AddPlasmaUtilities.H:26
AMREX_GPU_HOST_DEVICE PDim3 & operator=(PDim3 const &)=default
AMREX_GPU_HOST_DEVICE PDim3(const amrex::XDim3 &a)
Definition AddPlasmaUtilities.H:30
amrex::ParserExecutor< 7 > const * getUserRealParserExecData() const
Definition AddPlasmaUtilities.cpp:154
amrex::ParticleReal ** getUserRealDataPtrs()
Definition AddPlasmaUtilities.cpp:138
PlasmaParserHelper(SoAType &a_soa, std::size_t old_size, const std::vector< std::string > &a_user_int_attribs, const std::vector< std::string > &a_user_real_attribs, const PlasmaParserWrapper &wrapper)
Definition AddPlasmaUtilities.H:256
const PlasmaParserWrapper * m_wrapper_ptr
Definition AddPlasmaUtilities.H:306
amrex::ParserExecutor< 7 > const * getUserIntParserExecData() const
Definition AddPlasmaUtilities.cpp:146
amrex::Gpu::PinnedVector< amrex::ParticleReal * > m_pa_user_real_pinned
Definition AddPlasmaUtilities.H:296
amrex::Gpu::PinnedVector< int * > m_pa_user_int_pinned
Definition AddPlasmaUtilities.H:295
int ** getUserIntDataPtrs()
Definition AddPlasmaUtilities.cpp:130
Definition AddPlasmaUtilities.H:243
amrex::Gpu::PinnedVector< amrex::ParserExecutor< 7 > > m_user_int_attrib_parserexec_pinned
Definition AddPlasmaUtilities.H:249
PlasmaParserWrapper(std::size_t a_num_user_int_attribs, std::size_t a_num_user_real_attribs, const amrex::Vector< std::unique_ptr< amrex::Parser > > &a_user_int_attrib_parser, const amrex::Vector< std::unique_ptr< amrex::Parser > > &a_user_real_attrib_parser)
Definition AddPlasmaUtilities.cpp:113
amrex::Gpu::PinnedVector< amrex::ParserExecutor< 7 > > m_user_real_attrib_parserexec_pinned
Definition AddPlasmaUtilities.H:250
QuantumSynchrotronGetOpticalDepth quantum_sync_get_opt
Definition AddPlasmaUtilities.H:337
QEDHelper(SoAType &a_soa, std::size_t old_size, bool a_has_quantum_sync, bool a_has_breit_wheeler, const std::shared_ptr< QuantumSynchrotronEngine > &a_shr_p_qs_engine, const std::shared_ptr< BreitWheelerEngine > &a_shr_p_bw_engine)
Definition AddPlasmaUtilities.H:313
amrex::ParticleReal * p_optical_depth_BW
Definition AddPlasmaUtilities.H:332
bool has_breit_wheeler
Definition AddPlasmaUtilities.H:335
bool has_quantum_sync
Definition AddPlasmaUtilities.H:334
amrex::ParticleReal * p_optical_depth_QSR
Definition AddPlasmaUtilities.H:331
BreitWheelerGetOpticalDepth breit_wheeler_get_opt
Definition AddPlasmaUtilities.H:338