10 #ifndef IMPACTX_SHORTRF_H
11 #define IMPACTX_SHORTRF_H
33 static constexpr
auto name =
"ShortRF";
49 amrex::ParticleReal V,
50 amrex::ParticleReal freq,
51 amrex::ParticleReal phase,
52 amrex::ParticleReal
dx = 0,
53 amrex::ParticleReal
dy = 0,
54 amrex::ParticleReal rotation_degree = 0
62 using BeamOptic::operator();
75 PType& AMREX_RESTRICT p,
76 amrex::ParticleReal & AMREX_RESTRICT px,
77 amrex::ParticleReal & AMREX_RESTRICT py,
78 amrex::ParticleReal & AMREX_RESTRICT pt,
79 RefPart const & refpart)
const {
81 using namespace amrex::literals;
87 amrex::ParticleReal
const x = p.pos(
RealAoS::x);
88 amrex::ParticleReal
const y = p.pos(
RealAoS::y);
94 amrex::ParticleReal
const k = (2.0_prt*
pi/
c)*
m_freq;
95 amrex::ParticleReal
const phi =
m_phase*(
pi/180.0_prt);
98 amrex::ParticleReal
const ptf_ref = refpart.
pt;
99 amrex::ParticleReal
const pti_ref = ptf_ref +
m_V*cos(phi);
100 amrex::ParticleReal
const bgf =
sqrt(
pow(ptf_ref, 2) - 1.0_prt);
101 amrex::ParticleReal
const bgi =
sqrt(
pow(pti_ref, 2) - 1.0_prt);
109 amrex::ParticleReal pxout = px;
110 amrex::ParticleReal pyout = py;
111 amrex::ParticleReal ptout = pt;
121 ptout = pt -
m_V*cos(k*
t + phi) +
m_V*cos(phi);
138 using Thin::operator();
147 using namespace amrex::literals;
150 amrex::ParticleReal
const x = refpart.x;
151 amrex::ParticleReal
const px = refpart.px;
152 amrex::ParticleReal
const y = refpart.y;
153 amrex::ParticleReal
const py = refpart.py;
154 amrex::ParticleReal
const z = refpart.z;
155 amrex::ParticleReal
const pz = refpart.pz;
156 amrex::ParticleReal
const t = refpart.t;
157 amrex::ParticleReal
const pt = refpart.pt;
161 amrex::ParticleReal
const phi =
m_phase*(
pi/180.0_prt);
164 amrex::ParticleReal
const bgi =
sqrt(
pow(pt, 2) - 1.0_prt);
167 refpart.pt = pt -
m_V*cos(phi);
170 amrex::ParticleReal
const ptf = refpart.pt;
171 amrex::ParticleReal
const bgf =
sqrt(
pow(ptf, 2) - 1.0_prt);
180 refpart.px = px*bgf/bgi;
181 refpart.py = py*bgf/bgi;
182 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:36
@ t
fixed t as the independent variable
@ x
position in x [m] (at fixed s OR fixed t)
Definition: ImpactXParticleContainer.H:48
@ y
position in y [m] (at fixed s OR fixed t)
Definition: ImpactXParticleContainer.H:49
@ t
c * time-of-flight [m] (at fixed s)
Definition: ImpactXParticleContainer.H:50
Definition: ReferenceParticle.H:30
amrex::ParticleReal pt
energy, normalized by rest energy
Definition: ReferenceParticle.H:39
amrex::ParticleReal m_V
Definition: ShortRF.H:188
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:74
static constexpr auto name
Definition: ShortRF.H:33
amrex::ParticleReal m_phase
RF frequency in Hz.
Definition: ShortRF.H:190
ImpactXParticleContainer::ParticleType PType
Definition: ShortRF.H:34
amrex::ParticleReal m_freq
normalized (max) RF voltage drop.
Definition: ShortRF.H:189
ShortRF(amrex::ParticleReal V, amrex::ParticleReal freq, amrex::ParticleReal phase, amrex::ParticleReal dx=0, amrex::ParticleReal dy=0, amrex::ParticleReal rotation_degree=0)
Definition: ShortRF.H:48
Definition: alignment.H:27
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void shift_out(amrex::ParticleReal &AMREX_RESTRICT x, amrex::ParticleReal &AMREX_RESTRICT y, amrex::ParticleReal &AMREX_RESTRICT px, amrex::ParticleReal &AMREX_RESTRICT py) const
Definition: alignment.H:91
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::ParticleReal dx() const
Definition: alignment.H:120
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void shift_in(amrex::ParticleReal &AMREX_RESTRICT x, amrex::ParticleReal &AMREX_RESTRICT y, amrex::ParticleReal &AMREX_RESTRICT px, amrex::ParticleReal &AMREX_RESTRICT py) const
Definition: alignment.H:61
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::ParticleReal dy() const
Definition: alignment.H:130
Definition: beamoptic.H:135
Definition: nofinalize.H:22