10#ifndef IMPACTX_SBEND_H
11#define IMPACTX_SBEND_H
46 static constexpr auto type =
"Sbend";
70 std::optional<std::string>
name = std::nullopt
95 using BeamOptic::operator();
109 Alignment::compute_constants(refpart);
124 m_R11 = (h == 0_prt) ? 1_prt : cos_theta;
125 m_R12 = (h == 0_prt) ? slice_ds :
m_rc * sin_theta;
126 m_R16 = (h == 0_prt) ? 0_prt : -
m_rc * ibet * (1_prt - cos_theta);
127 m_R21 = (h == 0_prt) ? 0_prt :-sin_theta * h;
129 m_R26 = (h == 0_prt) ? 0_prt : -sin_theta * ibet;
130 m_R34 = (h == 0_prt) ? slice_ds :
m_rc * theta;
133 m_R56 = (h == 0_prt) ? slice_ds * ibetagam2 :
m_rc * (-theta + sin_theta * ibet * ibet);
149 m_A14 = (gamma - 1_prt)/gamma * (1_prt - cos_Gtheta);
150 m_A21 = -gyro_const * h * sin_theta;
151 m_A22 = -gyro_const * (1_prt - cos_theta);
152 m_A26 = -gyro_const * ibet * sin_theta + G * beta * gamma * theta;
153 m_A34 = (gamma - 1_prt)/gamma * sin_Gtheta;
170 template<
typename T_Real=amrex::ParticleReal,
typename T_IdCpu=u
int64_t>
195 T_Real
const pyout = py;
196 T_Real
const ptout = pt;
199 T_Real
const R22 =
m_R11;
200 T_Real
const R51 = -
m_R26;
201 T_Real
const R52 = -
m_R16;
263 if (
m_rc == 0.0_prt) {
266 refpart.x = x + step*px;
267 refpart.y = y + step*py;
268 refpart.z = z + step*pz;
269 refpart.t =
t - step*pt;
281 refpart.px = px*cos_theta - pz*sin_theta;
283 refpart.pz = pz*cos_theta + px*sin_theta;
286 refpart.x = x + (refpart.pz - pz)/B;
287 refpart.y = y + (theta/B)*py;
288 refpart.z = z - (refpart.px - px)/B;
289 refpart.t =
t - (theta/B)*pt;
294 refpart.s =
s + slice_ds;
299 using LinearTransport::operator();
327 R(5,6) = slice_ds / betgam2;
337 R(1,2) =
m_rc*sin_theta;
338 R(1,6) = - (
m_rc/bet)*(1.0_prt - cos_theta);
339 R(2,1) = -sin_theta/
m_rc;
341 R(2,6) = - sin_theta/bet;
343 R(5,1) = sin_theta/bet;
344 R(5,2) =
m_rc/bet*(1.0_prt - cos_theta);
345 R(5,6) =
m_rc*(-theta+sin_theta/(bet*bet));
366 template<
typename T_Real=amrex::ParticleReal,
typename T_IdCpu=u
int64_t>
385 T_Real lambdax = 0_prt;
386 T_Real lambday = 0_prt;
387 T_Real lambdaz = 0_prt;
390 lambdax =
m_A14 * py;
392 lambdaz =
m_A34 * py;
406 (*this)(x, y,
t, px, py, pt, idcpu, refpart);
#define AMREX_FORCE_INLINE
#define AMREX_GPU_HOST_DEVICE
#define IMPACTX_PUSH_EXTERN_TEMPLATE(ElementType)
Definition PushAll.H:78
T_ParticleType ParticleType
amrex_particle_real ParticleReal
__host__ __device__ std::pair< double, double > sincos(double x)
constexpr T powi(T x) noexcept
@ s
fixed s as the independent variable
Definition ImpactXParticleContainer.H:37
@ t
fixed t as the independent variable
Definition ImpactXParticleContainer.H:38
amrex::SmallMatrix< amrex::ParticleReal, 6, 6, amrex::Order::F, 1 > Map6x6
Definition CovarianceMatrix.H:20
static constexpr __host__ __device__ SmallMatrix< T, NRows, NCols, ORDER, StartIndex > Identity() noexcept
Definition ReferenceParticle.H:33
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::ParticleReal beta_gamma() const
Definition ReferenceParticle.H:168
amrex::ParticleReal gyromagnetic_anomaly
anomalous magnetic moment [unitless]
Definition ReferenceParticle.H:45
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::ParticleReal beta() const
Definition ReferenceParticle.H:152
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::ParticleReal gamma() const
Definition ReferenceParticle.H:140
ImpactXParticleContainer::ParticleType PType
Definition Sbend.H:47
amrex::ParticleReal m_R16
Definition Sbend.H:414
amrex::ParticleReal m_lambday
Definition Sbend.H:415
static constexpr auto type
Definition Sbend.H:46
amrex::ParticleReal m_A14
Definition Sbend.H:415
amrex::ParticleReal m_R11
bend radius in m
Definition Sbend.H:414
amrex::ParticleReal m_R21
Definition Sbend.H:414
amrex::ParticleReal m_R34
Definition Sbend.H:414
amrex::ParticleReal m_R12
Definition Sbend.H:414
amrex::ParticleReal m_A22
Definition Sbend.H:415
amrex::ParticleReal m_rc
Definition Sbend.H:409
amrex::ParticleReal m_R26
Definition Sbend.H:414
amrex::ParticleReal m_A34
Definition Sbend.H:415
void compute_constants(RefPart const &refpart)
Definition Sbend.H:104
Sbend(amrex::ParticleReal ds, amrex::ParticleReal rc, amrex::ParticleReal dx=0, amrex::ParticleReal dy=0, amrex::ParticleReal rotation_degree=0, amrex::ParticleReal aperture_x=0, amrex::ParticleReal aperture_y=0, int nslice=1, std::optional< std::string > name=std::nullopt)
Definition Sbend.H:61
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::ParticleReal rc(RefPart const &refpart) const
Definition Sbend.H:82
amrex::ParticleReal m_A26
Definition Sbend.H:415
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void operator()(T_Real &AMREX_RESTRICT x, T_Real &AMREX_RESTRICT y, T_Real &AMREX_RESTRICT t, T_Real &AMREX_RESTRICT px, T_Real &AMREX_RESTRICT py, T_Real &AMREX_RESTRICT pt, T_IdCpu &AMREX_RESTRICT idcpu, RefPart const &AMREX_RESTRICT refpart) const
Definition Sbend.H:172
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void spin_and_phasespace_push(T_Real &AMREX_RESTRICT x, T_Real &AMREX_RESTRICT y, T_Real &AMREX_RESTRICT t, T_Real &AMREX_RESTRICT px, T_Real &AMREX_RESTRICT py, T_Real &AMREX_RESTRICT pt, T_Real &AMREX_RESTRICT sx, T_Real &AMREX_RESTRICT sy, T_Real &AMREX_RESTRICT sz, T_IdCpu &AMREX_RESTRICT idcpu, RefPart const &AMREX_RESTRICT refpart) const
Definition Sbend.H:368
amrex::ParticleReal m_A21
Definition Sbend.H:415
void reverse()
Definition Sbend.H:92
AMREX_GPU_HOST AMREX_FORCE_INLINE Map6x6 transport_map(RefPart const &AMREX_RESTRICT refpart) const
Definition Sbend.H:307
amrex::ParticleReal m_R56
Definition Sbend.H:414
Definition alignment.H:27
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void shift_out(T_Real &AMREX_RESTRICT x, T_Real &AMREX_RESTRICT y, T_Real &AMREX_RESTRICT px, T_Real &AMREX_RESTRICT py) const
Definition alignment.H:109
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::ParticleReal dy() const
Definition alignment.H:146
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::ParticleReal dx() const
Definition alignment.H:136
Alignment(amrex::ParticleReal dx, amrex::ParticleReal dy, amrex::ParticleReal rotation_degree)
Definition alignment.H:36
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void shift_in(T_Real &AMREX_RESTRICT x, T_Real &AMREX_RESTRICT y, T_Real &AMREX_RESTRICT px, T_Real &AMREX_RESTRICT py) const
Definition alignment.H:78
Definition beamoptic.H:436
Definition lineartransport.H:50
AMREX_GPU_HOST Named(std::optional< std::string > name)
Definition named.H:57
AMREX_FORCE_INLINE std::string name() const
Definition named.H:122
Definition nofinalize.H:22
Definition pipeaperture.H:26
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void apply_aperture(T_Real &AMREX_RESTRICT x, T_Real &AMREX_RESTRICT y, T_IdCpu &AMREX_RESTRICT idcpu) const
Definition pipeaperture.H:59
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::ParticleReal aperture_x() const
Definition pipeaperture.H:90
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::ParticleReal aperture_y() const
Definition pipeaperture.H:101
PipeAperture(amrex::ParticleReal aperture_x, amrex::ParticleReal aperture_y)
Definition pipeaperture.H:32
Definition spintransport.H:36
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void rotate_spin(T_Real const &AMREX_RESTRICT lambdax, T_Real const &AMREX_RESTRICT lambday, T_Real const &AMREX_RESTRICT lambdaz, T_Real &AMREX_RESTRICT sx, T_Real &AMREX_RESTRICT sy, T_Real &AMREX_RESTRICT sz) const
Definition spintransport.H:48
Thick(amrex::ParticleReal ds, int nslice)
Definition thick.H:30
amrex::ParticleReal m_ds
Definition thick.H:68
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