8 #ifndef QED_PHOTON_EMISSION_H_ 9 #define QED_PHOTON_EMISSION_H_ 51 template <
typename PData>
52 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
53 bool operator() (
const PData& ptd,
int const i, amrex::RandomEngine
const&)
const noexcept
55 using namespace amrex;
57 const amrex::ParticleReal opt_depth =
59 return (opt_depth < 0.0_rt);
90 int const opt_depth_runtime_comp,
93 amrex::FArrayBox
const& exfab,
94 amrex::FArrayBox
const& eyfab,
95 amrex::FArrayBox
const& ezfab,
96 amrex::FArrayBox
const& bxfab,
97 amrex::FArrayBox
const& byfab,
98 amrex::FArrayBox
const& bzfab,
99 amrex::Array<amrex::Real,3> v_galilean,
111 template <
typename DstData,
typename SrcData>
112 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
113 void operator() (DstData& dst, SrcData& src,
int i_src,
int i_dst)
const noexcept
115 using namespace amrex;
118 amrex::ParticleReal xp, yp, zp;
119 m_get_position(i_src, xp, yp, zp);
121 amrex::ParticleReal ex = 0._rt, ey = 0._rt, ez = 0._rt;
122 m_get_externalE(i_src, ex, ey, ez);
124 amrex::ParticleReal bx = 0._rt, by = 0._rt, bz = 0._rt;
125 m_get_externalB(i_src, bx, by, bz);
128 m_ex_arr, m_ey_arr, m_ez_arr, m_bx_arr, m_by_arr, m_bz_arr,
129 m_ex_type, m_ey_type, m_ez_type, m_bx_type, m_by_type, m_bz_type,
130 m_dx_arr, m_xyzmin_arr, m_lo, m_n_rz_azimuthal_modes,
131 m_nox, m_galerkin_interpolation);
134 auto& uy = src.m_rdata[
PIdx::uy][i_src];
136 auto& g_ux = dst.m_rdata[
PIdx::ux][i_dst];
137 auto& g_uy = dst.m_rdata[
PIdx::uy][i_dst];
138 auto& g_uz = dst.m_rdata[
PIdx::uz][i_dst];
147 m_opt_depth_functor();
200 template <
typename PTile>
203 const int old_size,
const int num_added,
204 const amrex::ParticleReal energy_threshold)
206 auto pp = ptile.GetArrayOfStructs()().
data() + old_size;
208 const auto& soa = ptile.GetStructOfArrays();
209 const auto p_ux = soa.GetRealData(
PIdx::ux).data() + old_size;
210 const auto p_uy = soa.GetRealData(
PIdx::uy).data() + old_size;
211 const auto p_uz = soa.GetRealData(
PIdx::uz).data() + old_size;
214 const auto energy_threshold2 = std::max(
215 energy_threshold*energy_threshold,
216 std::numeric_limits<amrex::ParticleReal>::min());
218 amrex::ParallelFor(num_added, [=] AMREX_GPU_DEVICE (
int ip) noexcept
222 const auto ux = p_ux[ip];
223 const auto uy = p_uy[ip];
224 const auto uz = p_uz[ip];
228 constexpr amrex::ParticleReal me_c = PhysConst::m_e*PhysConst::c;
229 const auto phot_energy2 = (
ux*
ux + uy*uy +
uz*
uz)*me_c*me_c;
231 if (phot_energy2 < energy_threshold2){
238 #endif //QED_PHOTON_EMISSION_H_
int m_opt_depth_runtime_comp
Definition: QEDPhotonEmission.H:63
data
Definition: run_alltests_1node.py:320
Definition: QuantumSyncEngineWrapper.H:65
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:53
Functor that can be used to assign the external B field to a particle inside a ParallelFor kernel...
Definition: GetExternalFields.H:68
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 long n_rz_azimuthal_modes)
Field gather for a single particle.
Definition: FieldGather.H:38
i
Definition: check_interp_points_and_weights.py:171
Definition: WarpXParticleContainer.H:37
Definition: WarpXParticleContainer.H:37
Definition: WarpXParticleContainer.H:37
Definition: QuantumSyncEngineWrapper.H:168
PhotonEmissionFilterFunc(int const opt_depth_runtime_comp)
Constructor of the PhotonEmissionFilterFunc functor.
Definition: QEDPhotonEmission.H:39
Functor that can be used to extract the positions of the macroparticles inside a ParallelFor kernel...
Definition: GetAndSetPosition.H:25
Filter functor for the QED photon emission process.
Definition: QEDPhotonEmission.H:30
def ux
Definition: read_lab_particles.py:28
Definition: WarpXParticleContainer.H:76
Functor that can be used to assign the external E field to a particle inside a ParallelFor kernel...
Definition: GetExternalFields.H:58
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:201