10#ifndef IMPACTX_EXACTSBEND_H
11#define IMPACTX_EXACTSBEND_H
43 static constexpr auto type =
"ExactSbend";
80 std::optional<std::string>
name = std::nullopt
103 using BeamOptic::operator();
118 Alignment::compute_constants(refpart);
150 template<
typename T_Real=amrex::ParticleReal,
typename T_IdCpu=u
int64_t>
172 T_Real
const xout = x;
173 T_Real
const yout = y;
174 T_Real
const tout =
t;
184 T_Real
const inv_pzden = 1_prt /
sqrt(
207 T_Real
const pperp2 = powi<2>(pt)-2.0_prt *
m_ibeta * pt - powi<2>(py)+1.0_prt;
208 T_Real
const px2 = powi<2>(px);
210 auto const mask = pperp2 <= px2;
213 T_Real
const pperp =
sqrt(pperp2);
214 T_Real
const pzi =
sqrt(powi<2>(pperp) - powi<2>(px));
215 T_Real
const rho =
m_rc + xout;
223 T_Real
const px2f = powi<2>(pxout);
225 auto const mask2 = pperp2 <= px2f;
228 T_Real
const pzf =
sqrt(powi<2>(pperp)-powi<2>(pxout));
229 T_Real
const theta =
m_slice_phi + asin(px/pperp) - asin(pxout/pperp);
233 y = yout + theta *
m_rc * py;
279 refpart.x = x + step*px;
280 refpart.y = y + step*py;
281 refpart.z = z + step*pz;
282 refpart.t =
t - step*pt;
296 refpart.px = px*cos_theta - pz*sin_theta;
298 refpart.pz = pz*cos_theta + px*sin_theta;
301 refpart.x = x + (refpart.pz - pz)/B;
302 refpart.y = y + (theta/B)*py;
303 refpart.z = z - (refpart.px - px)/B;
304 refpart.t =
t - (theta/B)*pt;
309 refpart.s =
s + slice_ds;
313 using LinearTransport::operator();
342 R(5,6) = slice_ds / betgam2;
352 R(1,2) =
m_rc * sin_theta;
353 R(1,6) = - (
m_rc / bet) * (1_prt - cos_theta);
354 R(2,1) = -sin_theta /
m_rc;
356 R(2,6) = - sin_theta / bet;
357 R(3,4) =
m_rc * theta;
358 R(5,1) = sin_theta / bet;
359 R(5,2) =
m_rc / bet * (1_prt - cos_theta);
360 R(5,6) =
m_rc * (-theta + sin_theta / (bet * bet));
#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
__host__ __device__ GpuComplex< T > sqrt(const GpuComplex< T > &a_z) 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
__host__ __device__ void make_invalid() const noexcept
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_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::ParticleReal rigidity_Tm() const
Definition ReferenceParticle.H:261
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::ParticleReal beta() const
Definition ReferenceParticle.H:152
Definition ExactSbend.H:42
amrex::ParticleReal m_rc
Definition ExactSbend.H:372
AMREX_GPU_HOST AMREX_FORCE_INLINE Map6x6 transport_map(RefPart const &AMREX_RESTRICT refpart) const
Definition ExactSbend.H:322
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::ParticleReal rc(RefPart const &refpart) const
Definition ExactSbend.H:92
amrex::ParticleReal m_cos_phi
Definition ExactSbend.H:372
amrex::ParticleReal m_slice_ds
magnetic field in T
Definition ExactSbend.H:372
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 ExactSbend.H:152
void reverse()
Definition ExactSbend.H:100
amrex::ParticleReal m_sin_phi
Definition ExactSbend.H:372
ImpactXParticleContainer::ParticleType PType
Definition ExactSbend.H:45
ExactSbend(amrex::ParticleReal ds, amrex::ParticleReal phi, amrex::ParticleReal B, 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 ExactSbend.H:70
static constexpr amrex::ParticleReal degree2rad
Definition ExactSbend.H:44
amrex::ParticleReal m_ibetagam2
Definition ExactSbend.H:372
amrex::ParticleReal m_ibeta
Definition ExactSbend.H:372
void compute_constants(RefPart const &refpart)
Definition ExactSbend.H:113
amrex::ParticleReal m_slice_phi
Definition ExactSbend.H:372
static constexpr auto type
Definition ExactSbend.H:43
amrex::ParticleReal m_B
bend angle in radians
Definition ExactSbend.H:367
amrex::ParticleReal m_phi
Definition ExactSbend.H:366
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
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