10#ifndef IMPACTX_CFBEND_H
11#define IMPACTX_CFBEND_H
47 static constexpr auto type =
"CFbend";
77 std::optional<std::string>
name = std::nullopt
91 using BeamOptic::operator();
105 Alignment::compute_constants(refpart);
125 amrex::ParticleReal const cx = gx > 0_prt ? std::cos(omega_x * slice_ds) : std::cosh(omega_x * slice_ds);
126 amrex::ParticleReal const sx = gx > 0_prt ? std::sin(omega_x * slice_ds)/omega_x : std::sinh(omega_x * slice_ds)/omega_x;
127 amrex::ParticleReal const cy = gy > 0_prt ? std::cos(omega_y * slice_ds) : std::cosh(omega_y * slice_ds);
128 amrex::ParticleReal const sy = gy > 0_prt ? std::sin(omega_y * slice_ds)/omega_y : std::sinh(omega_y * slice_ds)/omega_y;
140 m_R16 = -(1_prt - cx) * igbrc;
150 m_R56 = slice_ds * ibetgam2 + (sx - slice_ds) * igb2r2;
170 m_A13 = (G*h*gyro_const2*gy*cy*sinG + gy*(powi<2>(G*h)*(gamma - 1_prt)*gamma - gy*gyro_const1 )*sy*cosG) * factor;
171 m_A14 = (G*h*gyro_const2*gy*sy*sinG + (powi<2>(G*h)*(gamma - 1_prt)*gamma - gy*gyro_const1)*(1_prt - cosG*cy))*factor;
172 m_A21 = -gyro_const1 * gx * sx;
173 m_A22 = -gyro_const1 * (1_prt - cx);
174 m_A26 = G*h*beta*gamma*slice_ds - h*gyro_const1*sx/(beta);
175 m_A33 = -((-gy*gyro_const1 + powi<2>(G*h)*gamma*(gamma - 1_prt))*gy*sy*sinG -gy*G*h*gyro_const2*(1_prt - cosG*cy))*factor;
176 m_A34 = ((-gy*gyro_const1 + powi<2>(G*h)*gamma*(gamma - 1_prt)) * cy*sinG + G*h*gyro_const2*gy*cosG*sy)*factor;
192 template<
typename T_Real=amrex::ParticleReal,
typename T_IdCpu=u
int64_t>
276 refpart.px = px*cos_theta - pz*sin_theta;
278 refpart.pz = pz*cos_theta + px*sin_theta;
281 refpart.x = x + (refpart.pz - pz)/B;
282 refpart.y = y + (theta/B)*py;
283 refpart.z = z - (refpart.px - px)/B;
284 refpart.t =
t - (theta/B)*pt;
287 refpart.s =
s + slice_ds;
305 template<
typename T_Real=amrex::ParticleReal,
typename T_IdCpu=u
int64_t>
325 T_Real lambdax = 0_prt;
326 T_Real lambday = 0_prt;
327 T_Real lambdaz = 0_prt;
346 (*this)(x, y,
t, px, py, pt, idcpu, refpart);
352 using LinearTransport::operator();
398 R(1,1) = gx > 0_prt ? cosx : coshx;
399 R(1,2) = gx > 0_prt ? sinx / omega_x : sinhx / omega_x;
400 R(1,6) = gx > 0_prt ? -(1_prt - cosx) * igbrc : -(1_prt - coshx) * igbrc;
401 R(2,1) = gx > 0_prt ? -omega_x * sinx : omega_x * sinhx;
402 R(2,2) = gx > 0_prt ? cosx : coshx;
403 R(2,6) = gx > 0_prt ? -sinx * iobrc : -sinhx * iobrc;
404 R(3,3) = gy > 0_prt ? cosy : coshy;
405 R(3,4) = gy > 0_prt ? siny / omega_y : sinhy / omega_y;
406 R(4,3) = gy > 0_prt ? -omega_y * siny : omega_y * sinhy;
407 R(4,4) = gy > 0_prt ? cosy : coshy;
408 R(5,1) = gx > 0_prt ? sinx * iobrc : sinhx * iobrc;
409 R(5,2) = gx > 0_prt ? (1_prt - cosx) * igbrc : (1_prt - coshx) * igbrc;
410 R(5,6) = gx > 0_prt ?
411 slice_ds * ibetgam2 + (sinx - omega_x * slice_ds) * igobr :
412 slice_ds * ibetgam2 + (sinhx - omega_x * slice_ds) * igobr;
423 amrex::ParticleReal m_R11,
m_R12,
m_R16,
m_R21,
m_R22,
m_R26,
m_R33,
m_R34,
m_R43,
m_R44,
m_R51,
m_R52,
m_R56;
#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::ParticleReal pt
energy, normalized by rest energy
Definition ReferenceParticle.H:42
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
amrex::ParticleReal m_R21
Definition CFbend.H:423
amrex::ParticleReal m_A22
Definition CFbend.H:424
void compute_constants(RefPart const &refpart)
Definition CFbend.H:100
void reverse()
Definition CFbend.H:88
amrex::ParticleReal m_A26
Definition CFbend.H:424
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 CFbend.H:307
amrex::ParticleReal m_R43
Definition CFbend.H:423
static constexpr auto type
Definition CFbend.H:47
amrex::ParticleReal m_R11
quadrupole strength in m^(-2)
Definition CFbend.H:423
amrex::ParticleReal m_rc
Definition CFbend.H:417
amrex::ParticleReal m_R44
Definition CFbend.H:423
amrex::ParticleReal m_A21
Definition CFbend.H:424
amrex::ParticleReal m_A13
Definition CFbend.H:424
CFbend(amrex::ParticleReal ds, amrex::ParticleReal rc, amrex::ParticleReal k, 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 CFbend.H:67
amrex::ParticleReal m_A33
Definition CFbend.H:424
amrex::ParticleReal m_R56
Definition CFbend.H:423
ImpactXParticleContainer::ParticleType PType
Definition CFbend.H:48
amrex::ParticleReal m_R33
Definition CFbend.H:423
amrex::ParticleReal m_k
bend radius in m
Definition CFbend.H:418
amrex::ParticleReal m_R16
Definition CFbend.H:423
amrex::ParticleReal m_lambday
Definition CFbend.H:424
amrex::ParticleReal m_R52
Definition CFbend.H:423
amrex::ParticleReal m_R26
Definition CFbend.H:423
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 CFbend.H:194
amrex::ParticleReal m_R51
Definition CFbend.H:423
amrex::ParticleReal m_A34
Definition CFbend.H:424
amrex::ParticleReal m_R34
Definition CFbend.H:423
amrex::ParticleReal m_R12
Definition CFbend.H:423
amrex::ParticleReal m_R22
Definition CFbend.H:423
amrex::ParticleReal m_A14
Definition CFbend.H:424
AMREX_GPU_HOST AMREX_FORCE_INLINE Map6x6 transport_map(RefPart const &AMREX_RESTRICT refpart) const
Definition CFbend.H:361
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