10 #ifndef IMPACTX_SBEND_H
11 #define IMPACTX_SBEND_H
31 static constexpr
auto name =
"Sbend";
40 Sbend( amrex::ParticleReal
const ds, amrex::ParticleReal
const rc,
47 using BeamOptic::operator();
59 PType& AMREX_RESTRICT p,
60 amrex::ParticleReal & AMREX_RESTRICT px,
61 amrex::ParticleReal & AMREX_RESTRICT py,
62 amrex::ParticleReal & AMREX_RESTRICT pt,
63 RefPart const & refpart)
const {
65 using namespace amrex::literals;
68 amrex::ParticleReal
const x = p.pos(
RealAoS::x);
69 amrex::ParticleReal
const y = p.pos(
RealAoS::y);
70 amrex::ParticleReal
const t = p.pos(
RealAoS::t);
73 amrex::ParticleReal pxout = px;
74 amrex::ParticleReal pyout = py;
75 amrex::ParticleReal ptout = pt;
78 amrex::ParticleReal
const slice_ds =
m_ds /
nslice();
81 amrex::ParticleReal
const pt_ref = refpart.
pt;
82 amrex::ParticleReal
const betgam2 =
pow(pt_ref, 2) - 1.0_prt;
83 amrex::ParticleReal
const bet =
sqrt(betgam2/(1.0_prt + betgam2));
87 amrex::ParticleReal
const theta = slice_ds/
m_rc;
88 amrex::ParticleReal
const sin_theta = sin(theta);
89 amrex::ParticleReal
const cos_theta = cos(theta);
93 - (
m_rc/bet)*(1.0_prt - cos_theta)*pt;
95 pxout = -sin_theta/
m_rc*x + cos_theta*px - sin_theta/bet*pt;
101 p.pos(
RealAoS::t) = sin_theta/bet*x +
m_rc/bet*(1.0_prt - cos_theta)*px + t
102 +
m_rc*(-theta+sin_theta/(bet*bet))*pt;
120 using namespace amrex::literals;
123 amrex::ParticleReal
const x = refpart.x;
124 amrex::ParticleReal
const px = refpart.px;
125 amrex::ParticleReal
const y = refpart.y;
126 amrex::ParticleReal
const py = refpart.py;
127 amrex::ParticleReal
const z = refpart.z;
128 amrex::ParticleReal
const pz = refpart.pz;
129 amrex::ParticleReal
const t = refpart.t;
130 amrex::ParticleReal
const pt = refpart.pt;
131 amrex::ParticleReal
const s = refpart.s;
134 amrex::ParticleReal
const slice_ds =
m_ds /
nslice();
137 amrex::ParticleReal
const theta = slice_ds/
m_rc;
138 amrex::ParticleReal
const B =
sqrt(
pow(pt,2)-1.0_prt)/
m_rc;
142 amrex::ParticleReal
const sin_theta = sin(theta);
143 amrex::ParticleReal
const cos_theta = cos(theta);
146 refpart.px = px*cos_theta - pz*sin_theta;
148 refpart.pz = pz*cos_theta + px*sin_theta;
151 refpart.x = x + (refpart.pz - pz)/B;
152 refpart.y = y + (theta/B)*py;
153 refpart.z = z - (refpart.px - px)/B;
154 refpart.t = t - (theta/B)*pt;
157 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
@ 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::ParticleReal pt
energy deviation, normalized by rest energy
Definition: ReferenceParticle.H:39
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:58
static constexpr auto name
Definition: Sbend.H:31
amrex::ParticleReal m_rc
Definition: Sbend.H:162
ImpactXParticleContainer::ParticleType PType
Definition: Sbend.H:32
Sbend(amrex::ParticleReal const ds, amrex::ParticleReal const rc, int const nslice)
Definition: Sbend.H:40
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