8#ifndef WARPX_PHOTON_CREATION_FUNC_H_
9#define WARPX_PHOTON_CREATION_FUNC_H_
39 using SoaData_type =
typename WarpXParticleContainer::ParticleTileType::ParticleTileDataType;
125 num_added_vec[i] =
static_cast<int>(num_added);
126 tile_products[i]->resize(products_np[i] + num_added);
129 const auto soa_1 = ptile1.getParticleTileData();
130 const auto soa_2 = ptile2.getParticleTileData();
136 soa_products.push_back(tile_products[i]->getParticleTileData());
144 device_soa_products.
begin());
147 device_products_np.
begin());
166 int const i1 =
static_cast<int>(p_pair_indices_1[i]);
167 int const i2 =
static_cast<int>(p_pair_indices_2[i]);
185 amrex::ParticleReal const u1sq_rel = (u1x_rel*u1x_rel + u1y_rel*u1y_rel + u1z_rel*u1z_rel);
197 amrex::ParticleReal const AAmBB = -1.0_prt - 2.0_prt*gamma1_rel*w2*m2/(w1*m1) - w2*m2/(w1*m1)*w2*m2/(w1*m1)
198 +2.0_prt*(gamma1_rel + w2*m2/(w1*m1) - u1_rel/
PhysConst::c)*Ephoton*wp/(w1*m1*c2);
226 u1x_rel *= u1_rel_after/u1_rel;
227 u1y_rel *= u1_rel_after/u1_rel;
228 u1z_rel *= u1_rel_after/u1_rel;
247 if (create_photons) {
250 const auto product_index = products_np_data[0] + p_offsets[i];
251 copy_species1[0](soa_products_data[0], soa_1, i1,
252 static_cast<int>(product_index), engine);
255 soa_products_data[0].m_rdata[
PIdx::w][product_index] = wp;
272 const auto start_index =
int(products_np[i]);
273 const auto stop_index =
int(products_np[i] + num_added_vec[i]);
275 *pc_products[i], start_index, stop_index);
280 return num_added_vec;
CollisionType
Definition BinaryCollisionUtils.H:17
Definition MultiParticleContainer.H:69
bool m_create_photons
Definition PhotonCreationFunc.H:288
PhotonCreationFunc()=default
Default constructor of the PhotonCreationFunc class.
typename WarpXParticleContainer::ParticleType ParticleType
Definition PhotonCreationFunc.H:34
amrex::DenseBins< ParticleTileDataType > ParticleBins
Definition PhotonCreationFunc.H:37
CollisionType m_collision_type
Definition PhotonCreationFunc.H:290
AMREX_INLINE amrex::Vector< int > operator()(const index_type &n_total_pairs, ParticleTileType &ptile1, ParticleTileType &ptile2, const amrex::Vector< WarpXParticleContainer * > &pc_products, ParticleTileType **AMREX_RESTRICT tile_products, const amrex::ParticleReal &m1, const amrex::ParticleReal &m2, const amrex::Vector< amrex::ParticleReal > &, const index_type *AMREX_RESTRICT p_mask, const amrex::Vector< index_type > &products_np, const SmartCopy *AMREX_RESTRICT copy_species1, const SmartCopy *, const index_type *AMREX_RESTRICT p_pair_indices_1, const index_type *AMREX_RESTRICT p_pair_indices_2, const amrex::ParticleReal *AMREX_RESTRICT p_pair_reaction_weight, const amrex::ParticleReal *AMREX_RESTRICT p_product_data) const
operator() of the PhotonCreationFunc class. It creates new photon particles from binary collisions....
Definition PhotonCreationFunc.H:89
int m_num_product_species
Definition PhotonCreationFunc.H:285
typename WarpXParticleContainer::ParticleTileType ParticleTileType
Definition PhotonCreationFunc.H:35
typename WarpXParticleContainer::ParticleTileType::ParticleTileDataType SoaData_type
Definition PhotonCreationFunc.H:39
typename ParticleBins::index_type index_type
Definition PhotonCreationFunc.H:38
typename ParticleTileType::ParticleTileDataType ParticleTileDataType
Definition PhotonCreationFunc.H:36
iterator begin() noexcept
std::conditional_t< is_rtsoa_pc, ParticleTileRT< typename ParticleType::RealType, typename ParticleType::IntType >, ParticleTile< ParticleType, NArrayReal, NArrayInt, Allocator > > ParticleTileType
T_ParticleType ParticleType
amrex_particle_real ParticleReal
T ExclusiveSum(N n, T const *in, T *out, RetSum a_ret_sum=retSum)
PODVector< T, ArenaAllocator< T > > DeviceVector
void DefaultInitializeRuntimeAttributes(PTile &ptile, const DstPC &pc, int start, int stop, const int n_external_attr_real=0, const int n_external_attr_int=0, const bool do_qed_comps=false)
Default initialize runtime attributes in a tile. This routine does not initialize the first n_externa...
Definition DefaultInitialization.H:111
AMREX_GPU_HOST_DEVICE AMREX_INLINE void doLorentzTransformWithP(amrex::ParticleReal &px, amrex::ParticleReal &py, amrex::ParticleReal &pz, amrex::ParticleReal mass, amrex::ParticleReal const Ux, amrex::ParticleReal const Uy, amrex::ParticleReal const Uz)
Perform a Lorentz transformation of the given momentum to a frame moving with gamma*velocity (Ux,...
Definition ParticleUtils.H:156
AMREX_GPU_HOST_DEVICE AMREX_INLINE void doLorentzTransformWithU(amrex::ParticleReal &ux, amrex::ParticleReal &uy, amrex::ParticleReal &uz, amrex::ParticleReal const Ux, amrex::ParticleReal const Uy, amrex::ParticleReal const Uz)
Perform a Lorentz transformation of the given velocity to a frame moving with gamma*velocity (Ux,...
Definition ParticleUtils.H:119
constexpr auto c
vacuum speed of light [m/s]
Definition constant.H:153
constexpr auto c2
square of the vacuum speed of light [m^2/s^2]
Definition constant.H:214
constexpr auto m_e
electron mass [kg]
Definition constant.H:165
void synchronize() noexcept
void copyAsync(HostToDevice, InIter begin, InIter end, OutIter result) noexcept
static constexpr HostToDevice hostToDevice
void streamSynchronize() noexcept
AMREX_ATTRIBUTE_FLATTEN_FOR void ParallelForRNG(T n, L const &f) noexcept
@ uz
Definition WarpXParticleContainer.H:70
@ w
Definition WarpXParticleContainer.H:70
@ uy
Definition WarpXParticleContainer.H:70
@ ux
Definition WarpXParticleContainer.H:70
This is a functor for performing a "smart copy" that works in both host and device code.
Definition SmartCopy.H:34