10#ifndef IMPACTX_QUADEDGE_H
11#define IMPACTX_QUADEDGE_H
41 static constexpr auto type =
"QuadEdge";
75 amrex::ParticleReal k,
78 amrex::ParticleReal
dx = 0,
79 amrex::ParticleReal
dy = 0,
80 amrex::ParticleReal rotation_degree = 0,
81 std::optional<std::string>
name = std::nullopt
90 using BeamOptic::operator();
101 using namespace amrex::literals;
103 Alignment::compute_constants(refpart);
113 m_a =
static_cast<amrex::ParticleReal
>(
m_flag) * (-1_prt *
m_g / 12.0_prt);
130 template<
typename T_Real=amrex::ParticleReal,
typename T_IdCpu=u
int64_t>
144 using namespace amrex::literals;
152 T_Real
const delta1 = sqrt(1_prt - 2_prt*pt/
m_beta + powi<2>(pt));
153 T_Real a =
m_a / delta1;
163 T_Real x2my2 = x*x - y*y;
164 T_Real x2py2 = x*x + y*y;
165 T_Real denominator = 1_prt - 9_prt*powi<2>(a)*powi<2>(x2my2);
168 xout = x - a * (powi<3>(x) + 3_prt * x * powi<2>(y));
169 yout = y + a * (3_prt * powi<2>(x) * y + powi<3>(y));
171 pxout = (px + 3_prt*a*px*x2py2 - 6_prt*a*py*x*y) / denominator;
172 pyout = (py - 3_prt*a*py*x2py2 + 6_prt*a*px*x*y) / denominator;
175 T_Real f4 = a * ( pxout * (powi<3>(x) + 3_prt*x*powi<2>(y))
176 - pyout * (powi<3>(y) + 3_prt*y*powi<2>(x)) );
177 tout =
t + f4 * (pt - 1_prt/
m_beta) / powi<2>(delta1);
191 using Thin::operator();
194 using LinearTransport::operator();
205 using namespace amrex::literals;
#define AMREX_FORCE_INLINE
#define AMREX_GPU_HOST_DEVICE
T_ParticleType ParticleType
constexpr T powi(T x) noexcept
@ 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:31
amrex::ParticleReal m_a
Definition QuadEdge.H:221
ImpactXParticleContainer::ParticleType PType
Definition QuadEdge.H:42
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 QuadEdge.H:132
amrex::ParticleReal m_k
Definition QuadEdge.H:213
int m_unit
quadrupole focusing strength
Definition QuadEdge.H:214
void compute_constants(RefPart const &refpart)
Definition QuadEdge.H:99
static constexpr auto type
Definition QuadEdge.H:41
amrex::ParticleReal m_beta
Definition QuadEdge.H:222
QuadEdge(amrex::ParticleReal k, int unit, Location flag, amrex::ParticleReal dx=0, amrex::ParticleReal dy=0, amrex::ParticleReal rotation_degree=0, std::optional< std::string > name=std::nullopt)
Definition QuadEdge.H:74
amrex::ParticleReal m_gamma
Definition QuadEdge.H:223
AMREX_GPU_HOST AMREX_FORCE_INLINE Map6x6 transport_map(RefPart const &AMREX_RESTRICT refpart) const
Definition QuadEdge.H:203
amrex::ParticleReal m_g
+1 for entry, or -1 for exit
Definition QuadEdge.H:220
Location m_flag
unit specification for quad strength
Definition QuadEdge.H:215
Location
Definition QuadEdge.H:45
@ exit
for leading (entry) fringe field
Definition QuadEdge.H:47
@ entry
Definition QuadEdge.H:46
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:219
Definition lineartransport.H:29
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