10 #ifndef IMPACTX_CHRACC_H
11 #define IMPACTX_CHRACC_H
33 static constexpr
auto name =
"ChrAcc";
52 amrex::ParticleReal
ds,
53 amrex::ParticleReal ez,
54 amrex::ParticleReal bz,
55 amrex::ParticleReal
dx = 0,
56 amrex::ParticleReal
dy = 0,
57 amrex::ParticleReal rotation_degree = 0,
67 using BeamOptic::operator();
79 PType& AMREX_RESTRICT p,
80 amrex::ParticleReal & AMREX_RESTRICT px,
81 amrex::ParticleReal & AMREX_RESTRICT py,
82 amrex::ParticleReal & AMREX_RESTRICT pt,
86 using namespace amrex::literals;
92 amrex::ParticleReal
const x = p.pos(
RealAoS::x);
93 amrex::ParticleReal
const y = p.pos(
RealAoS::y);
97 amrex::ParticleReal
const slice_ds =
m_ds /
nslice();
100 amrex::ParticleReal
const ptf_ref = refpart.
pt;
101 amrex::ParticleReal
const pti_ref = ptf_ref +
m_ez*slice_ds;
102 amrex::ParticleReal
const bgf =
sqrt(
pow(ptf_ref, 2) - 1.0_prt);
103 amrex::ParticleReal
const bgi =
sqrt(
pow(pti_ref, 2) - 1.0_prt);
111 amrex::ParticleReal
const pti_tot = pti_ref + pt;
112 amrex::ParticleReal
const ptf_tot = ptf_ref + pt;
113 amrex::ParticleReal
const pzi_tot =
sqrt(
pow(pti_tot,2)-1_prt);
114 amrex::ParticleReal
const pzf_tot =
sqrt(
pow(ptf_tot,2)-1_prt);
115 amrex::ParticleReal
const pzi_ref =
sqrt(
pow(pti_ref,2)-1_prt);
116 amrex::ParticleReal
const pzf_ref =
sqrt(
pow(ptf_ref,2)-1_prt);
118 amrex::ParticleReal
const numer = -ptf_tot + pzf_tot;
119 amrex::ParticleReal
const denom = -pti_tot + pzi_tot;
122 amrex::ParticleReal
const alpha =
m_bz/2.0_prt;
123 amrex::ParticleReal
const theta =
alpha/
m_ez*
log(numer/denom);
126 amrex::ParticleReal xout = x;
127 amrex::ParticleReal yout = y;
128 amrex::ParticleReal tout =
t;
129 amrex::ParticleReal pxout = px;
130 amrex::ParticleReal pyout = py;
131 amrex::ParticleReal ptout = pt;
134 xout = cos(theta)*x + sin(theta)/
alpha*px;
135 pxout = -
alpha*sin(theta)*x + cos(theta)*px;
137 yout = cos(theta)*y + sin(theta)/
alpha*py;
138 pyout = -
alpha*sin(theta)*y + cos(theta)*py;
141 tout =
t + (pzf_tot - pzf_ref - pzi_tot + pzi_ref)/
m_ez;
142 tout = tout + (1_prt/pzi_tot - 1_prt/pzf_tot)*(
pow(py-
alpha*x,2)+
pow(px+
alpha*y,2))/(2_prt*
m_ez);
151 p.pos(
RealAoS::x) = cos(theta)*xout + sin(theta)*yout;
152 pxout = cos(theta)*px + sin(theta)*py;
154 p.pos(
RealAoS::y) = -sin(theta)*xout + cos(theta)*yout;
155 pyout = -sin(theta)*px + cos(theta)*py;
181 using namespace amrex::literals;
184 amrex::ParticleReal
const x = refpart.x;
185 amrex::ParticleReal
const px = refpart.px;
186 amrex::ParticleReal
const y = refpart.y;
187 amrex::ParticleReal
const py = refpart.py;
188 amrex::ParticleReal
const z = refpart.z;
189 amrex::ParticleReal
const pz = refpart.pz;
190 amrex::ParticleReal
const t = refpart.t;
191 amrex::ParticleReal
const pt = refpart.pt;
192 amrex::ParticleReal
const s = refpart.s;
195 amrex::ParticleReal
const slice_ds =
m_ds /
nslice();
198 amrex::ParticleReal
const bgi =
sqrt(
pow(pt, 2) - 1.0_prt);
201 refpart.pt = pt -
m_ez*slice_ds;
204 amrex::ParticleReal
const ptf = refpart.pt;
205 amrex::ParticleReal
const bgf =
sqrt(
pow(ptf, 2) - 1.0_prt);
208 refpart.t =
t + (bgf - bgi)/
m_ez;
211 refpart.x = x + slice_ds*px/bgi;
212 refpart.y = y + slice_ds*py/bgi;
213 refpart.z = z + slice_ds*pz/bgi;
216 refpart.px = px*bgf/bgi;
217 refpart.py = py*bgf/bgi;
218 refpart.pz = pz*bgf/bgi;
221 refpart.s =
s + slice_ds;
#define AMREX_FORCE_INLINE
#define AMREX_GPU_HOST_DEVICE
T_ParticleType ParticleType
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE GpuComplex< T > log(const GpuComplex< T > &a_z) noexcept
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:35
@ t
fixed t as the independent variable
Definition: ChrUniformAcc.H:32
amrex::ParticleReal m_bz
electric field strength in 1/m
Definition: ChrUniformAcc.H:225
ImpactXParticleContainer::ParticleType PType
Definition: ChrUniformAcc.H:34
amrex::ParticleReal m_ez
Definition: ChrUniformAcc.H:224
ChrAcc(amrex::ParticleReal ds, amrex::ParticleReal ez, amrex::ParticleReal bz, amrex::ParticleReal dx=0, amrex::ParticleReal dy=0, amrex::ParticleReal rotation_degree=0, int nslice=1)
Definition: ChrUniformAcc.H:51
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: ChrUniformAcc.H:78
static constexpr auto name
Definition: ChrUniformAcc.H:33
@ x
position in x [m] (at fixed s OR fixed t)
Definition: ImpactXParticleContainer.H:49
@ y
position in y [m] (at fixed s OR fixed t)
Definition: ImpactXParticleContainer.H:50
@ t
c * time-of-flight [m] (at fixed s)
Definition: ImpactXParticleContainer.H:51
Definition: ReferenceParticle.H:30
amrex::ParticleReal pt
energy, normalized by rest energy
Definition: ReferenceParticle.H:39
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
Thick(amrex::ParticleReal ds, int nslice)
Definition: thick.H:30
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
amrex::ParticleReal m_ds
Definition: thick.H:58