8 #ifndef QED_PHOTON_EMISSION_H_ 9 #define QED_PHOTON_EMISSION_H_ 18 #include <AMReX_Array.H> 19 #include <AMReX_Array4.H> 20 #include <AMReX_Dim3.H> 21 #include <AMReX_Extension.H> 22 #include <AMReX_GpuLaunch.H> 23 #include <AMReX_GpuQualifiers.H> 24 #include <AMReX_IndexType.H> 25 #include <AMReX_REAL.H> 27 #include <AMReX_BaseFwd.H> 63 template <
typename PData>
64 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
65 bool operator() (
const PData& ptd,
int const i, amrex::RandomEngine
const&)
const noexcept
67 using namespace amrex;
69 const amrex::ParticleReal opt_depth =
71 return (opt_depth < 0.0_rt);
102 int const opt_depth_runtime_comp,
105 amrex::FArrayBox
const& exfab,
106 amrex::FArrayBox
const& eyfab,
107 amrex::FArrayBox
const& ezfab,
108 amrex::FArrayBox
const& bxfab,
109 amrex::FArrayBox
const& byfab,
110 amrex::FArrayBox
const& bzfab,
111 amrex::Array<amrex::Real,3> v_galilean,
124 template <
typename DstData,
typename SrcData>
125 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
126 void operator() (DstData& dst, SrcData& src,
int i_src,
int i_dst,
127 amrex::RandomEngine
const& engine)
const noexcept
129 using namespace amrex;
132 amrex::ParticleReal xp, yp, zp;
133 m_get_position(i_src, xp, yp, zp);
135 amrex::ParticleReal ex = 0._rt, ey = 0._rt, ez = 0._rt;
136 m_get_externalE(i_src, ex, ey, ez);
138 amrex::ParticleReal bx = 0._rt, by = 0._rt, bz = 0._rt;
139 m_get_externalB(i_src, bx, by, bz);
142 m_ex_arr, m_ey_arr, m_ez_arr, m_bx_arr, m_by_arr, m_bz_arr,
143 m_ex_type, m_ey_type, m_ez_type, m_bx_type, m_by_type, m_bz_type,
144 m_dx_arr, m_xyzmin_arr, m_lo, m_n_rz_azimuthal_modes,
145 m_nox, m_galerkin_interpolation);
148 auto& uy = src.m_rdata[
PIdx::uy][i_src];
150 auto& g_ux = dst.m_rdata[
PIdx::ux][i_dst];
151 auto& g_uy = dst.m_rdata[
PIdx::uy][i_dst];
152 auto& g_uz = dst.m_rdata[
PIdx::uz][i_dst];
162 m_opt_depth_functor(engine);
215 template <
typename PTile>
218 const int old_size,
const int num_added,
219 const amrex::ParticleReal energy_threshold)
221 auto pp = ptile.GetArrayOfStructs()().
data() + old_size;
223 const auto& soa = ptile.GetStructOfArrays();
224 const auto p_ux = soa.GetRealData(
PIdx::ux).data() + old_size;
225 const auto p_uy = soa.GetRealData(
PIdx::uy).data() + old_size;
226 const auto p_uz = soa.GetRealData(
PIdx::uz).data() + old_size;
229 const auto energy_threshold2 = std::max(
230 energy_threshold*energy_threshold,
231 std::numeric_limits<amrex::ParticleReal>::min());
233 amrex::ParallelFor(num_added, [=] AMREX_GPU_DEVICE (
int ip) noexcept
237 const auto ux = p_ux[ip];
238 const auto uy = p_uy[ip];
239 const auto uz = p_uz[ip];
243 constexpr amrex::ParticleReal me_c = PhysConst::m_e*PhysConst::c;
244 const auto phot_energy2 = (
ux*
ux + uy*uy +
uz*
uz)*me_c*me_c;
246 if (phot_energy2 < energy_threshold2){
253 #endif //QED_PHOTON_EMISSION_H_
Definition: WarpXParticleContainer_fwd.H:28
int m_opt_depth_runtime_comp
Definition: QEDPhotonEmission.H:75
data
Definition: run_alltests_1node.py:320
Definition: QuantumSyncEngineWrapper.H:77
Definition: WarpXParticleContainer_fwd.H:28
def uz
Definition: read_lab_particles.py:29
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool operator()(const PData &ptd, int const i, amrex::RandomEngine const &) const noexcept
Functor call. This method determines if a given (electron or positron) particle should undergo QED ph...
Definition: QEDPhotonEmission.H:65
Functor that can be used to assign the external B field to a particle inside a ParallelFor kernel...
Definition: GetExternalFields.H:159
Definition: WarpXParticleContainer_fwd.H:28
i
Definition: check_interp_points_and_weights.py:171
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.
Definition: FieldGather.H:38
Definition: QuantumSyncEngineWrapper.H:180
PhotonEmissionFilterFunc(int const opt_depth_runtime_comp)
Constructor of the PhotonEmissionFilterFunc functor.
Definition: QEDPhotonEmission.H:51
Functor that can be used to extract the positions of the macroparticles inside a ParallelFor kernel...
Definition: GetAndSetPosition.H:48
Filter functor for the QED photon emission process.
Definition: QEDPhotonEmission.H:42
def ux
Definition: read_lab_particles.py:28
Definition: WarpXParticleContainer.H:58
Functor that can be used to assign the external E field to a particle inside a ParallelFor kernel...
Definition: GetExternalFields.H:149
Definition: BreitWheelerEngineWrapper.H:35
void cleanLowEnergyPhotons(PTile &ptile, const int old_size, const int num_added, const amrex::ParticleReal energy_threshold)
Free function to call to remove immediately low energy photons by setting their ID to -1...
Definition: QEDPhotonEmission.H:216