10 #ifndef IMPACTX_QUAD_H 11 #define IMPACTX_QUAD_H 29 static constexpr
auto name =
"Quad";
41 Quad( amrex::ParticleReal
const ds, amrex::ParticleReal
const k,
48 using BeamOptic::operator();
60 PType& AMREX_RESTRICT p,
61 amrex::ParticleReal & AMREX_RESTRICT px,
62 amrex::ParticleReal & AMREX_RESTRICT py,
63 amrex::ParticleReal & AMREX_RESTRICT pt,
64 RefPart const & refpart)
const {
66 using namespace amrex::literals;
69 amrex::ParticleReal
const x = p.pos(0);
70 amrex::ParticleReal
const y = p.pos(1);
71 amrex::ParticleReal
const t = p.pos(2);
74 amrex::ParticleReal
const slice_ds =
m_ds /
nslice();
77 amrex::ParticleReal
const pt_ref = refpart.
pt;
78 amrex::ParticleReal
const betgam2 =
pow(pt_ref, 2) - 1.0_prt;
81 amrex::ParticleReal
const omega =
sqrt(std::abs(
m_k));
84 amrex::ParticleReal pxout = px;
85 amrex::ParticleReal pyout = py;
86 amrex::ParticleReal ptout = pt;
90 p.pos(0) = cos(omega*slice_ds)*x + sin(omega*slice_ds)/omega*px;
91 pxout = -omega*sin(omega*slice_ds)*x + cos(omega*slice_ds)*px;
93 p.pos(1) = cosh(omega*slice_ds)*y + sinh(omega*slice_ds)/omega*py;
94 pyout = omega*sinh(omega*slice_ds)*y + cosh(omega*slice_ds)*py;
96 p.pos(2) = t + (slice_ds/betgam2)*pt;
100 p.pos(0) = cosh(omega*slice_ds)*x + sinh(omega*slice_ds)/omega*px;
101 pxout = omega*sinh(omega*slice_ds)*x + cosh(omega*slice_ds)*px;
103 p.pos(1) = cos(omega*slice_ds)*y + sin(omega*slice_ds)/omega*py;
104 pyout = -omega*sin(omega*slice_ds)*y + cos(omega*slice_ds)*py;
106 p.pos(2) = t + (slice_ds/betgam2)*pt;
124 using namespace amrex::literals;
127 amrex::ParticleReal
const x = refpart.x;
128 amrex::ParticleReal
const px = refpart.px;
129 amrex::ParticleReal
const y = refpart.y;
130 amrex::ParticleReal
const py = refpart.py;
131 amrex::ParticleReal
const z = refpart.z;
132 amrex::ParticleReal
const pz = refpart.pz;
133 amrex::ParticleReal
const t = refpart.t;
134 amrex::ParticleReal
const pt = refpart.pt;
135 amrex::ParticleReal
const s = refpart.s;
138 amrex::ParticleReal
const slice_ds =
m_ds /
nslice();
141 amrex::ParticleReal
const step = slice_ds /
sqrt(
pow(pt,2)-1.0_prt);
144 refpart.x = x + step*px;
145 refpart.y = y + step*py;
146 refpart.z = z + step*pz;
147 refpart.t = t - step*pt;
150 refpart.s = s + slice_ds;
159 #endif // IMPACTX_QUAD_H
Definition: ImpactX.cpp:31
Quad(amrex::ParticleReal const ds, amrex::ParticleReal const k, int const nslice)
Definition: Quad.H:41
amrex::ParticleReal m_k
Definition: Quad.H:154
Definition: beamoptic.H:131
static constexpr auto name
Definition: Quad.H:29
amrex::ParticleReal pt
energy deviation, normalized by rest energy
Definition: ReferenceParticle.H:39
#define AMREX_FORCE_INLINE
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: Quad.H:59
#define AMREX_GPU_HOST_DEVICE
Particle< NStructReal, NStructInt > ParticleType
Thick(amrex::ParticleReal const ds, int const nslice)
Definition: thick.H:30
Definition: ReferenceParticle.H:29
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 amrex::ParticleReal ds() const
Definition: thick.H:50
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE int nslice() const
Definition: thick.H:40
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE GpuComplex< T > sqrt(const GpuComplex< T > &a_z) noexcept
amrex::ParticleReal m_ds
Definition: thick.H:56