10 #ifndef IMPACTX_SBEND_H 11 #define IMPACTX_SBEND_H 25 static constexpr
auto name =
"Sbend";
34 Sbend( amrex::ParticleReal
const ds, amrex::ParticleReal
const rc,
50 PType& AMREX_RESTRICT p,
51 amrex::ParticleReal & AMREX_RESTRICT px,
52 amrex::ParticleReal & AMREX_RESTRICT py,
53 amrex::ParticleReal & AMREX_RESTRICT pt,
56 using namespace amrex::literals;
59 amrex::ParticleReal
const x = p.pos(0);
60 amrex::ParticleReal
const y = p.pos(1);
61 amrex::ParticleReal
const t = p.pos(2);
64 amrex::ParticleReal pxout = px;
65 amrex::ParticleReal pyout = py;
66 amrex::ParticleReal ptout = pt;
69 amrex::ParticleReal
const slice_ds =
m_ds /
nslice();
72 amrex::ParticleReal
const pt_ref = refpart.
pt;
73 amrex::ParticleReal
const betgam2 =
pow(pt_ref, 2) - 1.0_prt;
74 amrex::ParticleReal
const bet =
sqrt(betgam2/(1.0_prt + betgam2));
78 amrex::ParticleReal
const theta = slice_ds/
m_rc;
79 amrex::ParticleReal
const sin_theta = sin(theta);
80 amrex::ParticleReal
const cos_theta = cos(theta);
83 p.pos(0) = cos_theta*x +
m_rc*sin_theta*px
84 - (
m_rc/bet)*(1.0_prt - cos_theta)*pt;
86 pxout = -sin_theta/
m_rc*x + cos_theta*px - sin_theta/bet*pt;
88 p.pos(1) = y +
m_rc*theta*py;
92 p.pos(2) = sin_theta/bet*x +
m_rc/bet*(1.0_prt - cos_theta)*px + t
93 +
m_rc*(-theta+sin_theta/(bet*bet))*pt;
110 RefPart & AMREX_RESTRICT refpart)
const {
112 using namespace amrex::literals;
115 amrex::ParticleReal
const x = refpart.x;
116 amrex::ParticleReal
const px = refpart.px;
117 amrex::ParticleReal
const y = refpart.y;
118 amrex::ParticleReal
const py = refpart.py;
119 amrex::ParticleReal
const z = refpart.z;
120 amrex::ParticleReal
const pz = refpart.pz;
121 amrex::ParticleReal
const t = refpart.t;
122 amrex::ParticleReal
const pt = refpart.pt;
123 amrex::ParticleReal
const s = refpart.s;
126 amrex::ParticleReal
const slice_ds =
m_ds /
nslice();
129 amrex::ParticleReal
const theta = slice_ds/
m_rc;
130 amrex::ParticleReal
const B =
sqrt(
pow(pt,2)-1.0_prt)/
m_rc;
134 amrex::ParticleReal
const sin_theta = sin(theta);
135 amrex::ParticleReal
const cos_theta = cos(theta);
138 refpart.px = px*cos_theta - pz*sin_theta;
140 refpart.pz = pz*cos_theta + px*sin_theta;
143 refpart.x = x + (refpart.pz - pz)/B;
144 refpart.y = y + (theta/B)*py;
145 refpart.z = z - (refpart.px - px)/B;
146 refpart.t = t - (theta/B)*pt;
149 refpart.s = s + slice_ds;
168 amrex::ParticleReal
ds ()
const 181 #endif // IMPACTX_SBEND_H
Definition: ImpactX.cpp: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: Sbend.H:49
amrex::ParticleReal pt
energy deviation, normalized by rest energy
Definition: ReferenceParticle.H:38
int m_nslice
bend radius in m
Definition: Sbend.H:176
#define AMREX_FORCE_INLINE
static constexpr auto name
Definition: Sbend.H:25
#define AMREX_GPU_HOST_DEVICE
amrex::ParticleReal m_rc
segment length in m
Definition: Sbend.H:175
amrex::ParticleReal m_ds
Definition: Sbend.H:174
Particle< NStructReal, NStructInt > ParticleType
Definition: ReferenceParticle.H:28
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 int nslice() const
Definition: Sbend.H:158
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE GpuComplex< T > sqrt(const GpuComplex< T > &a_z) noexcept
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::ParticleReal ds() const
Definition: Sbend.H:168
Sbend(amrex::ParticleReal const ds, amrex::ParticleReal const rc, int const nslice)
Definition: Sbend.H:34