10#ifndef IMPACTX_CHRACC_H
11#define IMPACTX_CHRACC_H
43 static constexpr auto type =
"ChrAcc";
74 std::optional<std::string>
name = std::nullopt
88 using BeamOptic::operator();
102 Alignment::compute_constants(refpart);
131 template<
typename T_Real=amrex::ParticleReal,
typename T_IdCpu=u
int64_t>
160 T_Real
const pti_tot2 = powi<2>(pti_tot);
161 T_Real
const ptf_tot2 = powi<2>(ptf_tot);
164 auto const mask = pti_tot2 <= 1_prt || ptf_tot2 <= 1_prt;
167 T_Real
const pzi_tot =
sqrt(powi<2>(pti_tot) - 1_prt);
168 T_Real
const pzf_tot =
sqrt(powi<2>(ptf_tot) - 1_prt);
172 T_Real
const numer = -ptf_tot + pzf_tot;
173 T_Real
const denom = -pti_tot + pzi_tot;
188 xout = cos_theta * x + sin_theta /
m_alpha * px;
189 pxout = -
m_alpha * sin_theta * x + cos_theta * px;
191 yout = cos_theta * y + sin_theta /
m_alpha * py;
192 pyout = -
m_alpha * sin_theta * y + cos_theta * py;
195 tout =
t + (pzf_tot - pzf_ref - pzi_tot + pzi_ref) /
m_ez;
196 tout += (1_prt/pzi_tot - 1_prt/pzf_tot)
208 x = cos_theta * xout + sin_theta * yout;
209 pxout = cos_theta * px + sin_theta * py;
211 y = -sin_theta * xout + cos_theta * yout;
212 pyout = -sin_theta * px + cos_theta * py;
264 refpart.pt = pt -
m_ez*slice_ds;
271 refpart.t =
t + (bgf - bgi)/
m_ez;
274 refpart.x = x + slice_ds*px/bgi;
275 refpart.y = y + slice_ds*py/bgi;
276 refpart.z = z + slice_ds*pz/bgi;
279 refpart.px = px*bgf/bgi;
280 refpart.py = py*bgf/bgi;
281 refpart.pz = pz*bgf/bgi;
284 refpart.s =
s + slice_ds;
288 using LinearTransport::operator();
299 throw std::runtime_error(std::string(
type) +
": Envelope tracking is not yet implemented!");
#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 > log(const GpuComplex< T > &a_z) 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::ParticleReal pt
energy, normalized by rest energy
Definition ReferenceParticle.H:42
Definition ChrUniformAcc.H:42
amrex::ParticleReal m_alpha
Definition ChrUniformAcc.H:311
amrex::ParticleReal m_pti_ref
Definition ChrUniformAcc.H:310
AMREX_GPU_HOST AMREX_FORCE_INLINE Map6x6 transport_map(RefPart const &AMREX_RESTRICT refpart) const
Definition ChrUniformAcc.H:297
void compute_constants(RefPart const &refpart)
Definition ChrUniformAcc.H:97
amrex::ParticleReal m_ez
Definition ChrUniformAcc.H:303
amrex::ParticleReal m_bgi
Definition ChrUniformAcc.H:310
void reverse()
Definition ChrUniformAcc.H:85
amrex::ParticleReal m_ptf_ref
m_ds / nslice();
Definition ChrUniformAcc.H:310
amrex::ParticleReal m_alpha_iez
Definition ChrUniformAcc.H:311
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 ChrUniformAcc.H:133
amrex::ParticleReal m_slice_ds
magnetic field strength in 1/m
Definition ChrUniformAcc.H:309
ChrAcc(amrex::ParticleReal ds, amrex::ParticleReal ez, amrex::ParticleReal bz, 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 ChrUniformAcc.H:64
static constexpr auto type
Definition ChrUniformAcc.H:43
ImpactXParticleContainer::ParticleType PType
Definition ChrUniformAcc.H:44
amrex::ParticleReal m_bgf
Definition ChrUniformAcc.H:310
amrex::ParticleReal m_bz
electric field strength in 1/m
Definition ChrUniformAcc.H:304
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