10#ifndef IMPACTX_SHORTRF_H
11#define IMPACTX_SHORTRF_H
40 static constexpr auto type =
"ShortRF";
57 amrex::ParticleReal V,
58 amrex::ParticleReal freq,
59 amrex::ParticleReal phase,
60 amrex::ParticleReal
dx = 0,
61 amrex::ParticleReal
dy = 0,
62 amrex::ParticleReal rotation_degree = 0,
63 std::optional<std::string>
name = std::nullopt
72 using BeamOptic::operator();
83 using namespace amrex::literals;
86 Alignment::compute_constants(refpart);
95 amrex::ParticleReal
const ptf_ref = refpart.
pt;
97 amrex::ParticleReal
const pti_ref = ptf_ref +
m_V_cos_phi;
98 m_bgf = std::sqrt(powi<2>(ptf_ref) - 1.0_prt);
99 m_bgi = std::sqrt(powi<2>(pti_ref) - 1.0_prt);
116 template<
typename T_Real=amrex::ParticleReal,
typename T_IdCpu=u
int64_t>
130 using namespace amrex::literals;
177 using Thin::operator();
186 using namespace amrex::literals;
190 amrex::ParticleReal
const x = refpart.x;
191 amrex::ParticleReal
const px = refpart.px;
192 amrex::ParticleReal
const y = refpart.y;
193 amrex::ParticleReal
const py = refpart.py;
194 amrex::ParticleReal
const z = refpart.z;
195 amrex::ParticleReal
const pz = refpart.pz;
196 amrex::ParticleReal
const t = refpart.t;
197 amrex::ParticleReal
const pt = refpart.pt;
201 amrex::ParticleReal
const phi =
m_phase*(pi/180.0_prt);
204 amrex::ParticleReal
const bgi = std::sqrt(powi<2>(pt) - 1.0_prt);
207 refpart.pt = pt -
m_V * std::cos(phi);
210 amrex::ParticleReal
const ptf = refpart.pt;
211 amrex::ParticleReal
const bgf = std::sqrt(powi<2>(ptf) - 1.0_prt);
220 refpart.px = px*bgf/bgi;
221 refpart.py = py*bgf/bgi;
222 refpart.pz = pz*bgf/bgi;
227 using LinearTransport::operator();
238 using namespace amrex::literals;
244 amrex::ParticleReal
const k = (2.0_prt*pi/c)*
m_freq;
245 amrex::ParticleReal
const phi =
m_phase*(pi/180.0_prt);
248 amrex::ParticleReal
const ptf_ref = refpart.pt;
249 amrex::ParticleReal
const pti_ref = ptf_ref +
m_V * std::cos(phi);
250 amrex::ParticleReal
const bgf = std::sqrt(powi<2>(ptf_ref) - 1.0_prt);
251 amrex::ParticleReal
const bgi = std::sqrt(powi<2>(pti_ref) - 1.0_prt);
260 R(6,5) = k*
m_V*std::sin(phi)/bgf;
#define AMREX_FORCE_INLINE
#define AMREX_GPU_HOST_DEVICE
T_ParticleType ParticleType
static constexpr amrex::Real pi
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 pt
energy, normalized by rest energy
Definition ReferenceParticle.H:40
void compute_constants(RefPart const &refpart)
Definition ShortRF.H:81
amrex::ParticleReal m_V_cos_phi
Definition ShortRF.H:273
amrex::ParticleReal m_V
Definition ShortRF.H:266
static constexpr auto type
Definition ShortRF.H:40
ImpactXParticleContainer::ParticleType PType
Definition ShortRF.H:41
amrex::ParticleReal m_freq
normalized (max) RF voltage drop.
Definition ShortRF.H:267
ShortRF(amrex::ParticleReal V, amrex::ParticleReal freq, amrex::ParticleReal phase, amrex::ParticleReal dx=0, amrex::ParticleReal dy=0, amrex::ParticleReal rotation_degree=0, std::optional< std::string > name=std::nullopt)
Definition ShortRF.H:56
amrex::ParticleReal m_phase
RF frequency in Hz.
Definition ShortRF.H:268
AMREX_GPU_HOST AMREX_FORCE_INLINE Map6x6 transport_map(RefPart const &AMREX_RESTRICT refpart) const
Definition ShortRF.H:236
amrex::ParticleReal m_bgf
Definition ShortRF.H:273
amrex::ParticleReal m_phi
Definition ShortRF.H:273
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 ShortRF.H:118
amrex::ParticleReal m_k
reference RF phase in degrees.
Definition ShortRF.H:273
amrex::ParticleReal m_bgi
Definition ShortRF.H:273
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