8#ifndef LINEAR_COMPTON_INITIALIZE_MOMENTUM_H
9#define LINEAR_COMPTON_INITIALIZE_MOMENTUM_H
24 using SoaData_type = WarpXParticleContainer::ParticleTileType::ParticleTileDataType;
29 using index_type = ParticleBins::index_type;
48 void LorentzTransformMomentum (
56 p_out = gamma * ( p_in - beta * p_parallel_in );
57 px_out = px_in + nx * ( p_parallel_out - p_parallel_in );
58 py_out = py_in + ny * ( p_parallel_out - p_parallel_in );
59 pz_out = pz_in + nz * ( p_parallel_out - p_parallel_in );
77 void LinearComptonInitializeMomentum (
78 const SoaData_type& soa1_in,
const SoaData_type& soa2_in,
79 SoaData_type& soa1_out, SoaData_type& soa2_out,
80 const index_type& idx1_in,
const index_type& idx2_in,
81 const index_type& idx1_out_start,
const index_type& idx2_out_start,
99 amrex::ParticleReal const lepton_u2 = (lepton_ux*lepton_ux + lepton_uy*lepton_uy + lepton_uz*lepton_uz);
106 amrex::ParticleReal const photon_u = std::sqrt(photon_ux*photon_ux + photon_uy*photon_uy + photon_uz*photon_uz);
109 LorentzTransformMomentum(
110 photon_u, photon_ux, photon_uy, photon_uz,
111 photon_u_rest, photon_ux_rest, photon_uy_rest, photon_uz_rest,
112 lepton_gamma, lepton_beta, lepton_nx, lepton_ny, lepton_nz);
121 if (cos_theta*cos_theta < 1.0_prt) {
122 sin_theta = std::sqrt( 1.0_prt - cos_theta*cos_theta );
124 cos_phi = photon_ux_rest * inv_photon_rest_uxy;
125 sin_phi = photon_uy_rest * inv_photon_rest_uxy;
149 x = b - (b + 1._prt)*std::pow(0.5_prt*c0, r1);
154 amrex::ParticleReal const f = ( (1._prt+x*x)*factor + k*k*(1._prt-x)*(1._prt-x) )/(factor*factor*factor);
175 + cos_theta * cos_phi * new_photon_uX_rest
176 - sin_phi * new_photon_uY_rest;
178 + cos_theta * sin_phi * new_photon_uX_rest
179 + cos_phi * new_photon_uY_rest;
181 - sin_theta * new_photon_uX_rest;
185 LorentzTransformMomentum(
186 new_photon_u_rest, new_photon_ux_rest, new_photon_uy_rest, new_photon_uz_rest,
187 new_photon_u, new_photon_ux, new_photon_uy, new_photon_uz,
188 lepton_gamma, lepton_beta, -lepton_nx, -lepton_ny, -lepton_nz);
193 soa1_out.m_rdata[
PIdx::ux][idx1_out_start] = new_photon_ux;
194 soa1_out.m_rdata[
PIdx::uy][idx1_out_start] = new_photon_uy;
195 soa1_out.m_rdata[
PIdx::uz][idx1_out_start] = new_photon_uz;
196 soa1_out.m_rdata[
PIdx::ux][idx1_out_start + 1] = new_photon_ux;
197 soa1_out.m_rdata[
PIdx::uy][idx1_out_start + 1] = new_photon_uy;
198 soa1_out.m_rdata[
PIdx::uz][idx1_out_start + 1] = new_photon_uz;
200 soa2_out.m_rdata[
PIdx::ux][idx2_out_start] = lepton_ux - (new_photon_ux - photon_ux);
201 soa2_out.m_rdata[
PIdx::uy][idx2_out_start] = lepton_uy - (new_photon_uy - photon_uy);
202 soa2_out.m_rdata[
PIdx::uz][idx2_out_start] = lepton_uz - (new_photon_uz - photon_uz);
203 soa2_out.m_rdata[
PIdx::ux][idx2_out_start + 1] = lepton_ux - (new_photon_ux - photon_ux);
204 soa2_out.m_rdata[
PIdx::uy][idx2_out_start + 1] = lepton_uy - (new_photon_uy - photon_uy);
205 soa2_out.m_rdata[
PIdx::uz][idx2_out_start + 1] = lepton_uz - (new_photon_uz - photon_uz);
#define AMREX_GPU_HOST_DEVICE
ParticleTile< ParticleType, NArrayReal, NArrayInt, Allocator > ParticleTileType
T_ParticleType ParticleType
amrex_particle_real ParticleReal
typename WarpXParticleContainer::ParticleTileType ParticleTileType
Definition ParticleUtils.H:22
DenseBins< ParticleTileDataType > ParticleBins
Definition ParticleUtils.cpp:30
typename WarpXParticleContainer::ParticleType ParticleType
Definition ParticleUtils.cpp:29
typename ParticleTileType::ParticleTileDataType ParticleTileDataType
Definition ParticleUtils.H:23
constexpr auto c
vacuum speed of light [m/s]
Definition constant.H:153
constexpr auto inv_c
inverse of the vacuum speed of light [s/m]
Definition constant.H:217
constexpr auto pi
ratio of a circle's circumference to its diameter
Definition constant.H:29
constexpr T powi(T x) noexcept
typename WarpXParticleContainer::ParticleTileType::ParticleTileDataType SoaData_type
Definition VirtualPhotonCreation.H:30
@ uz
Definition WarpXParticleContainer.H:70
@ uy
Definition WarpXParticleContainer.H:70
@ ux
Definition WarpXParticleContainer.H:70