10 #ifndef IMPACTX_CHRQUAD_H
11 #define IMPACTX_CHRQUAD_H
32 static constexpr
auto name =
"ChrQuad";
51 ChrQuad( amrex::ParticleReal
const ds, amrex::ParticleReal
const k,
52 int const unit,
int const nslice )
58 using BeamOptic::operator();
70 PType& AMREX_RESTRICT p,
71 amrex::ParticleReal & AMREX_RESTRICT px,
72 amrex::ParticleReal & AMREX_RESTRICT py,
73 amrex::ParticleReal & AMREX_RESTRICT pt,
74 RefPart const & refpart)
const {
76 using namespace amrex::literals;
79 amrex::ParticleReal
const x = p.pos(
RealAoS::x);
80 amrex::ParticleReal
const y = p.pos(
RealAoS::y);
81 amrex::ParticleReal
const t = p.pos(
RealAoS::t);
84 amrex::ParticleReal
const slice_ds =
m_ds /
nslice();
87 amrex::ParticleReal
const bet = refpart.
beta();
90 amrex::ParticleReal g =
m_k;
96 amrex::ParticleReal delta1;
97 delta1 =
sqrt(1_prt - 2_prt*pt/bet +
pow(pt,2));
98 amrex::ParticleReal delta = delta1 - 1_prt;
102 amrex::ParticleReal
const omega =
sqrt(std::abs(g)/delta1);
105 amrex::ParticleReal pxout = px;
106 amrex::ParticleReal pyout = py;
107 amrex::ParticleReal ptout = pt;
110 amrex::ParticleReal q1 = x;
111 amrex::ParticleReal q2 = y;
112 amrex::ParticleReal p1 = px;
113 amrex::ParticleReal p2 = py;
118 sin(omega*slice_ds)/(omega*delta1)*px;
119 pxout = -omega*delta1*sin(omega*slice_ds)*x + cos(omega*slice_ds)*px;
122 sinh(omega*slice_ds)/(omega*delta1)*py;
123 pyout = omega*delta1*sinh(omega*slice_ds)*y + cosh(omega*slice_ds)*py;
128 sinh(omega*slice_ds)/(omega*delta1)*px;
129 pxout = omega*delta1*sinh(omega*slice_ds)*x + cosh(omega*slice_ds)*px;
132 sin(omega*slice_ds)/(omega*delta1)*py;
133 pyout = -omega*delta1*sin(omega*slice_ds)*y + cos(omega*slice_ds)*py;
145 amrex::ParticleReal term = pt + delta/bet;
146 amrex::ParticleReal t0 = t - term*slice_ds/delta1;
148 amrex::ParticleReal
w = omega*delta1;
149 amrex::ParticleReal term1 = -(
pow(p2,2)+
pow(q2,2)*
pow(
w,2))*sinh(2_prt*slice_ds*omega);
150 amrex::ParticleReal term2 = -(
pow(p1,2)-
pow(q1,2)*
pow(
w,2))*sin(2_prt*slice_ds*omega);
151 amrex::ParticleReal term3 = -2_prt*q2*p2*
w*cosh(2_prt*slice_ds*omega);
152 amrex::ParticleReal term4 = -2_prt*q1*p1*
w*cos(2_prt*slice_ds*omega);
153 amrex::ParticleReal term5 = 2_prt*omega*(q1*p1*delta1 + q2*p2*delta1
155 p.pos(
RealAoS::t) = t0 + (-1_prt+bet*pt)/(8_prt*bet*
pow(delta1,3)*omega)
156 *(term1+term2+term3+term4+term5);
174 using namespace amrex::literals;
177 amrex::ParticleReal
const x = refpart.x;
178 amrex::ParticleReal
const px = refpart.px;
179 amrex::ParticleReal
const y = refpart.y;
180 amrex::ParticleReal
const py = refpart.py;
181 amrex::ParticleReal
const z = refpart.z;
182 amrex::ParticleReal
const pz = refpart.pz;
183 amrex::ParticleReal
const t = refpart.t;
184 amrex::ParticleReal
const pt = refpart.pt;
185 amrex::ParticleReal
const s = refpart.s;
188 amrex::ParticleReal
const slice_ds =
m_ds /
nslice();
191 amrex::ParticleReal
const step = slice_ds /
sqrt(
pow(pt,2)-1.0_prt);
194 refpart.x = x + step*px;
195 refpart.y = y + step*py;
196 refpart.z = z + step*pz;
197 refpart.t = t - step*pt;
200 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:32
ImpactXParticleContainer::ParticleType PType
Definition: ChrQuad.H:33
static constexpr auto name
Definition: ChrQuad.H:32
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: ChrQuad.H:69
amrex::ParticleReal m_k
Definition: ChrQuad.H:204
ChrQuad(amrex::ParticleReal const ds, amrex::ParticleReal const k, int const unit, int const nslice)
Definition: ChrQuad.H:51
int m_unit
quadrupole strength in 1/m^2 (or T/m)
Definition: ChrQuad.H:205
@ 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 rigidity_Tm() const
Definition: ReferenceParticle.H:169
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