10 #ifndef IMPACTX_SHORTRF_H
11 #define IMPACTX_SHORTRF_H
31 static constexpr
auto name =
"ShortRF";
43 ShortRF( amrex::ParticleReal
const V, amrex::ParticleReal
const freq,
44 amrex::ParticleReal
const phase )
50 using BeamOptic::operator();
63 PType& AMREX_RESTRICT p,
64 amrex::ParticleReal & AMREX_RESTRICT px,
65 amrex::ParticleReal & AMREX_RESTRICT py,
66 amrex::ParticleReal & AMREX_RESTRICT pt,
67 RefPart const & refpart)
const {
69 using namespace amrex::literals;
72 amrex::ParticleReal
const x = p.pos(
RealAoS::x);
73 amrex::ParticleReal
const y = p.pos(
RealAoS::y);
74 amrex::ParticleReal
const t = p.pos(
RealAoS::t);
79 amrex::ParticleReal
const k = (2.0_prt*
pi/
c)*
m_freq;
80 amrex::ParticleReal
const phi =
m_phase*(
pi/180.0_prt);
83 amrex::ParticleReal
const ptf_ref = refpart.
pt;
84 amrex::ParticleReal
const pti_ref = ptf_ref +
m_V*cos(phi);
85 amrex::ParticleReal
const bgf =
sqrt(
pow(ptf_ref, 2) - 1.0_prt);
86 amrex::ParticleReal
const bgi =
sqrt(
pow(pti_ref, 2) - 1.0_prt);
94 amrex::ParticleReal pxout = px;
95 amrex::ParticleReal pyout = py;
96 amrex::ParticleReal ptout = pt;
106 ptout = pt -
m_V*cos(k*t + phi) +
m_V*cos(phi);
121 using Thin::operator();
130 using namespace amrex::literals;
133 amrex::ParticleReal
const x = refpart.x;
134 amrex::ParticleReal
const px = refpart.px;
135 amrex::ParticleReal
const y = refpart.y;
136 amrex::ParticleReal
const py = refpart.py;
137 amrex::ParticleReal
const z = refpart.z;
138 amrex::ParticleReal
const pz = refpart.pz;
139 amrex::ParticleReal
const t = refpart.t;
140 amrex::ParticleReal
const pt = refpart.pt;
144 amrex::ParticleReal
const phi =
m_phase*(
pi/180.0_prt);
147 amrex::ParticleReal
const bgi =
sqrt(
pow(pt, 2) - 1.0_prt);
150 refpart.pt = pt -
m_V*cos(phi);
153 amrex::ParticleReal
const ptf = refpart.pt;
154 amrex::ParticleReal
const bgf =
sqrt(
pow(ptf, 2) - 1.0_prt);
163 refpart.px = px*bgf/bgi;
164 refpart.py = py*bgf/bgi;
165 refpart.pz = pz*bgf/bgi;
#define AMREX_FORCE_INLINE
#define AMREX_GPU_HOST_DEVICE
T_ParticleType ParticleType
static constexpr amrex::Real pi
constexpr std::enable_if_t< std::is_floating_point< T >::value, T > pi()
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE GpuComplex< T > pow(const GpuComplex< T > &a_z, const T &a_y) noexcept
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE GpuComplex< T > sqrt(const GpuComplex< T > &a_z) noexcept
Definition: ImpactX.cpp:33
@ x
position in x [m] (at fixed s OR fixed t)
Definition: ImpactXParticleContainer.H:42
@ y
position in y [m] (at fixed s OR fixed t)
Definition: ImpactXParticleContainer.H:43
@ t
c * time-of-flight [m] (at fixed s)
Definition: ImpactXParticleContainer.H:44
Definition: ReferenceParticle.H:30
amrex::ParticleReal pt
energy, normalized by rest energy
Definition: ReferenceParticle.H:39
amrex::ParticleReal m_V
Definition: ShortRF.H:171
ShortRF(amrex::ParticleReal const V, amrex::ParticleReal const freq, amrex::ParticleReal const phase)
Definition: ShortRF.H:43
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void operator()(PType &AMREX_RESTRICT p, amrex::ParticleReal &AMREX_RESTRICT px, amrex::ParticleReal &AMREX_RESTRICT py, amrex::ParticleReal &AMREX_RESTRICT pt, RefPart const &refpart) const
Definition: ShortRF.H:62
static constexpr auto name
Definition: ShortRF.H:31
amrex::ParticleReal m_phase
RF frequency in Hz.
Definition: ShortRF.H:173
ImpactXParticleContainer::ParticleType PType
Definition: ShortRF.H:32
amrex::ParticleReal m_freq
normalized (max) RF voltage drop.
Definition: ShortRF.H:172
Definition: beamoptic.H:135
Definition: nofinalize.H:22