10 #ifndef IMPACTX_SBEND_H
11 #define IMPACTX_SBEND_H
34 static constexpr
auto name =
"Sbend";
47 amrex::ParticleReal
ds,
48 amrex::ParticleReal rc,
49 amrex::ParticleReal
dx = 0,
50 amrex::ParticleReal
dy = 0,
51 amrex::ParticleReal rotation_degree = 0,
61 using BeamOptic::operator();
73 PType& AMREX_RESTRICT p,
74 amrex::ParticleReal & AMREX_RESTRICT px,
75 amrex::ParticleReal & AMREX_RESTRICT py,
76 amrex::ParticleReal & AMREX_RESTRICT pt,
77 RefPart const & refpart)
const {
79 using namespace amrex::literals;
85 amrex::ParticleReal
const x = p.pos(
RealAoS::x);
86 amrex::ParticleReal
const y = p.pos(
RealAoS::y);
90 amrex::ParticleReal pxout = px;
91 amrex::ParticleReal
const pyout = py;
92 amrex::ParticleReal
const ptout = pt;
95 amrex::ParticleReal
const slice_ds =
m_ds /
nslice();
98 amrex::ParticleReal
const pt_ref = refpart.
pt;
99 amrex::ParticleReal
const betgam2 =
pow(pt_ref, 2) - 1.0_prt;
100 amrex::ParticleReal
const bet =
sqrt(betgam2/(1.0_prt + betgam2));
103 amrex::ParticleReal
const theta = slice_ds/
m_rc;
108 - (
m_rc/bet)*(1.0_prt - cos_theta)*pt;
110 pxout = -sin_theta/
m_rc*x + cos_theta*px - sin_theta/bet*pt;
116 p.pos(
RealAoS::t) = sin_theta/bet*x +
m_rc/bet*(1.0_prt - cos_theta)*px +
t
117 +
m_rc*(-theta+sin_theta/(bet*bet))*pt;
137 using namespace amrex::literals;
140 amrex::ParticleReal
const x = refpart.x;
141 amrex::ParticleReal
const px = refpart.px;
142 amrex::ParticleReal
const y = refpart.y;
143 amrex::ParticleReal
const py = refpart.py;
144 amrex::ParticleReal
const z = refpart.z;
145 amrex::ParticleReal
const pz = refpart.pz;
146 amrex::ParticleReal
const t = refpart.t;
147 amrex::ParticleReal
const pt = refpart.pt;
148 amrex::ParticleReal
const s = refpart.s;
151 amrex::ParticleReal
const slice_ds =
m_ds /
nslice();
154 amrex::ParticleReal
const theta = slice_ds/
m_rc;
155 amrex::ParticleReal
const B =
sqrt(
pow(pt,2)-1.0_prt)/
m_rc;
161 refpart.px = px*cos_theta - pz*sin_theta;
163 refpart.pz = pz*cos_theta + px*sin_theta;
166 refpart.x = x + (refpart.pz - pz)/B;
167 refpart.y = y + (theta/B)*py;
168 refpart.z = z - (refpart.px - px)/B;
169 refpart.t =
t - (theta/B)*pt;
172 refpart.s =
s + slice_ds;
#define AMREX_FORCE_INLINE
#define AMREX_GPU_HOST_DEVICE
T_ParticleType ParticleType
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE std::pair< double, double > sincos(double x)
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:36
@ t
fixed t as the independent variable
@ x
position in x [m] (at fixed s OR fixed t)
Definition: ImpactXParticleContainer.H:48
@ y
position in y [m] (at fixed s OR fixed t)
Definition: ImpactXParticleContainer.H:49
@ t
c * time-of-flight [m] (at fixed s)
Definition: ImpactXParticleContainer.H:50
Definition: ReferenceParticle.H:30
amrex::ParticleReal pt
energy, normalized by rest energy
Definition: ReferenceParticle.H:39
Sbend(amrex::ParticleReal ds, amrex::ParticleReal rc, amrex::ParticleReal dx=0, amrex::ParticleReal dy=0, amrex::ParticleReal rotation_degree=0, int nslice=1)
Definition: Sbend.H:46
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:72
static constexpr auto name
Definition: Sbend.H:34
amrex::ParticleReal m_rc
Definition: Sbend.H:177
ImpactXParticleContainer::ParticleType PType
Definition: Sbend.H:35
Definition: alignment.H:27
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void shift_out(amrex::ParticleReal &AMREX_RESTRICT x, amrex::ParticleReal &AMREX_RESTRICT y, amrex::ParticleReal &AMREX_RESTRICT px, amrex::ParticleReal &AMREX_RESTRICT py) const
Definition: alignment.H:91
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::ParticleReal dx() const
Definition: alignment.H:120
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void shift_in(amrex::ParticleReal &AMREX_RESTRICT x, amrex::ParticleReal &AMREX_RESTRICT y, amrex::ParticleReal &AMREX_RESTRICT px, amrex::ParticleReal &AMREX_RESTRICT py) const
Definition: alignment.H:61
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::ParticleReal dy() const
Definition: alignment.H:130
Definition: beamoptic.H:135
Definition: nofinalize.H:22
Thick(amrex::ParticleReal ds, int nslice)
Definition: thick.H:30
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::ParticleReal ds() const
Definition: thick.H:53
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE int nslice() const
Definition: thick.H:43
amrex::ParticleReal m_ds
Definition: thick.H:58