8#ifndef WARPX_TWO_PRODUCT_UTIL_H
9#define WARPX_TWO_PRODUCT_UTIL_H
52 void TwoProductComputeProductMomenta (
70 const bool isotropic_scattering,
95 m1_in*m1_in*c_sq + p1x_in*p1x_in + p1y_in*p1y_in + p1z_in*p1z_in);
97 m2_in*m2_in*c_sq + p2x_in*p2x_in + p2y_in*p2y_in + p2z_in*p2z_in);
116 - E_rest_in + E_rest_out + E_reaction);
124 +
powi<2>(m1_out - m2_out)*c_sq*0.25_prt *
powi<2>( E_ratio - 1._prt/E_ratio );
136 if (isotropic_scattering) {
146 if ( vc_sq > std::numeric_limits<amrex::ParticleReal>::min() )
153 p1x_star_in = p1x_in + vcx * factor;
154 p1y_star_in = p1y_in + vcy * factor;
155 p1z_star_in = p1z_in + vcz * factor;
159 p1x_star_in = p1x_in;
160 p1y_star_in = p1y_in;
161 p1z_star_in = p1z_in;
163 amrex::ParticleReal p1_star_in = std::sqrt(p1x_star_in*p1x_star_in + p1y_star_in*p1y_star_in + p1z_star_in*p1z_star_in);
168 px_star_out = p1x_star_in * scaling;
169 py_star_out = p1y_star_in * scaling;
170 pz_star_out = p1z_star_in * scaling;
177 if ( vc_sq > std::numeric_limits<amrex::ParticleReal>::min() )
183 p1x_out = px_star_out + vcx * factor;
184 p1y_out = py_star_out + vcy * factor;
185 p1z_out = pz_star_out + vcz * factor;
189 p1x_out = px_star_out;
190 p1y_out = py_star_out;
191 p1z_out = pz_star_out;
201 u1x_out = (m1_out == 0) ? p1x_out/me : p1x_out/m1_out;
202 u1y_out = (m1_out == 0) ? p1y_out/me : p1y_out/m1_out;
203 u1z_out = (m1_out == 0) ? p1z_out/me : p1z_out/m1_out;
204 u2x_out = (m2_out == 0) ? p2x_out/me : p2x_out/m2_out;
205 u2y_out = (m2_out == 0) ? p2y_out/me : p2y_out/m2_out;
206 u2z_out = (m2_out == 0) ? p2z_out/me : p2z_out/m2_out;
#define AMREX_GPU_HOST_DEVICE
amrex_particle_real ParticleReal
AMREX_GPU_HOST_DEVICE AMREX_INLINE void RandomizeVelocity(amrex::ParticleReal &ux, amrex::ParticleReal &uy, amrex::ParticleReal &uz, const amrex::ParticleReal vp, amrex::RandomEngine const &engine)
Function to perform scattering of a particle that results in a random velocity vector with given magn...
Definition ParticleUtils.H:218
constexpr auto c
vacuum speed of light [m/s]
Definition constant.H:153
constexpr auto m_e
electron mass [kg]
Definition constant.H:165
constexpr T powi(T x) noexcept