10 #ifndef IMPACTX_EXACTDRIFT_H
11 #define IMPACTX_EXACTDRIFT_H
31 static constexpr
auto name =
"ExactDrift";
45 using BeamOptic::operator();
58 PType& AMREX_RESTRICT p,
59 amrex::ParticleReal & AMREX_RESTRICT px,
60 amrex::ParticleReal & AMREX_RESTRICT py,
61 amrex::ParticleReal & AMREX_RESTRICT pt,
62 RefPart const & refpart)
const {
64 using namespace amrex::literals;
67 amrex::ParticleReal
const x = p.pos(
RealAoS::x);
68 amrex::ParticleReal
const y = p.pos(
RealAoS::y);
69 amrex::ParticleReal
const t = p.pos(
RealAoS::t);
72 amrex::ParticleReal
const pxout = px;
73 amrex::ParticleReal
const pyout = py;
74 amrex::ParticleReal
const ptout = pt;
77 amrex::ParticleReal
const slice_ds =
m_ds /
nslice();
80 amrex::ParticleReal
const bet = refpart.
beta();
81 amrex::ParticleReal
const betgam = refpart.
beta_gamma();
84 amrex::ParticleReal
const pzden =
sqrt(
pow(pt-1_prt/bet,2) -
85 1_prt/
pow(betgam,2) -
pow(px,2) -
pow(py,2));
92 p.pos(
RealAoS::t) = t - slice_ds * (1_prt/bet +
93 (pt-1_prt/bet)/pzden);
110 using namespace amrex::literals;
113 amrex::ParticleReal
const x = refpart.x;
114 amrex::ParticleReal
const px = refpart.px;
115 amrex::ParticleReal
const y = refpart.y;
116 amrex::ParticleReal
const py = refpart.py;
117 amrex::ParticleReal
const z = refpart.z;
118 amrex::ParticleReal
const pz = refpart.pz;
119 amrex::ParticleReal
const t = refpart.t;
120 amrex::ParticleReal
const pt = refpart.pt;
121 amrex::ParticleReal
const s = refpart.s;
124 amrex::ParticleReal
const slice_ds =
m_ds /
nslice();
127 amrex::ParticleReal
const step = slice_ds /
sqrt(
pow(pt,2)-1.0_prt);
130 refpart.x = x + step*px;
131 refpart.y = y + step*py;
132 refpart.z = z + step*pz;
133 refpart.t = t - step*pt;
136 refpart.s =
s + slice_ds;
#define AMREX_FORCE_INLINE
#define AMREX_GPU_HOST_DEVICE
T_ParticleType ParticleType
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE GpuComplex< T > pow(const GpuComplex< T > &a_z, const T &a_y) noexcept
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE GpuComplex< T > sqrt(const GpuComplex< T > &a_z) noexcept
Definition: ImpactX.cpp:33
Definition: ExactDrift.H:30
static constexpr auto name
Definition: ExactDrift.H:31
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void operator()(PType &AMREX_RESTRICT p, amrex::ParticleReal &AMREX_RESTRICT px, amrex::ParticleReal &AMREX_RESTRICT py, amrex::ParticleReal &AMREX_RESTRICT pt, RefPart const &refpart) const
Definition: ExactDrift.H:57
ExactDrift(amrex::ParticleReal const ds, int const nslice)
Definition: ExactDrift.H:39
ImpactXParticleContainer::ParticleType PType
Definition: ExactDrift.H:32
@ x
position in x [m] (at fixed s OR fixed t)
Definition: ImpactXParticleContainer.H:42
@ y
position in y [m] (at fixed s OR fixed t)
Definition: ImpactXParticleContainer.H:43
@ t
c * time-of-flight [m] (at fixed s)
Definition: ImpactXParticleContainer.H:44
Definition: ReferenceParticle.H:30
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::ParticleReal beta_gamma() const
Definition: ReferenceParticle.H:79
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::ParticleReal beta() const
Definition: ReferenceParticle.H:64
Definition: beamoptic.H:135
Definition: nofinalize.H:22
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::ParticleReal ds() const
Definition: thick.H:50
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE int nslice() const
Definition: thick.H:40
amrex::ParticleReal m_ds
Definition: thick.H:56
Thick(amrex::ParticleReal const ds, int const nslice)
Definition: thick.H:30