10 #ifndef IMPACTX_CHRACC_H
11 #define IMPACTX_CHRACC_H
31 static constexpr
auto name =
"ChrAcc";
46 ChrAcc( amrex::ParticleReal
const ds, amrex::ParticleReal
const ez,
47 amrex::ParticleReal
const bz,
int const nslice )
53 using BeamOptic::operator();
65 PType& AMREX_RESTRICT p,
66 amrex::ParticleReal & AMREX_RESTRICT px,
67 amrex::ParticleReal & AMREX_RESTRICT py,
68 amrex::ParticleReal & AMREX_RESTRICT pt,
69 RefPart const & refpart)
const {
71 using namespace amrex::literals;
74 amrex::ParticleReal
const x = p.pos(
RealAoS::x);
75 amrex::ParticleReal
const y = p.pos(
RealAoS::y);
76 amrex::ParticleReal
const t = p.pos(
RealAoS::t);
79 amrex::ParticleReal
const slice_ds =
m_ds /
nslice();
82 amrex::ParticleReal
const ptf_ref = refpart.
pt;
83 amrex::ParticleReal
const pti_ref = ptf_ref +
m_ez*slice_ds;
84 amrex::ParticleReal
const bgf =
sqrt(
pow(ptf_ref, 2) - 1.0_prt);
85 amrex::ParticleReal
const bgi =
sqrt(
pow(pti_ref, 2) - 1.0_prt);
93 amrex::ParticleReal
const pti_tot = pti_ref + pt;
94 amrex::ParticleReal
const ptf_tot = ptf_ref + pt;
95 amrex::ParticleReal
const pzi_tot =
sqrt(
pow(pti_tot,2)-1_prt);
96 amrex::ParticleReal
const pzf_tot =
sqrt(
pow(ptf_tot,2)-1_prt);
97 amrex::ParticleReal
const pzi_ref =
sqrt(
pow(pti_ref,2)-1_prt);
98 amrex::ParticleReal
const pzf_ref =
sqrt(
pow(ptf_ref,2)-1_prt);
100 amrex::ParticleReal
const numer = -ptf_tot + pzf_tot;
101 amrex::ParticleReal
const denom = -pti_tot + pzi_tot;
104 amrex::ParticleReal
const alpha =
m_bz/2.0_prt;
105 amrex::ParticleReal
const theta =
alpha/
m_ez*
log(numer/denom);
108 amrex::ParticleReal xout = x;
109 amrex::ParticleReal yout = y;
110 amrex::ParticleReal tout = t;
111 amrex::ParticleReal pxout = px;
112 amrex::ParticleReal pyout = py;
113 amrex::ParticleReal ptout = pt;
116 xout = cos(theta)*x + sin(theta)/
alpha*px;
117 pxout = -
alpha*sin(theta)*x + cos(theta)*px;
119 yout = cos(theta)*y + sin(theta)/
alpha*py;
120 pyout = -
alpha*sin(theta)*y + cos(theta)*py;
123 tout = t + (pzf_tot - pzf_ref - pzi_tot + pzi_ref)/
m_ez;
124 tout = tout + (1_prt/pzi_tot - 1_prt/pzf_tot)*(
pow(py-
alpha*x,2)+
pow(px+
alpha*y,2))/(2_prt*
m_ez);
133 p.pos(
RealAoS::x) = cos(theta)*xout + sin(theta)*yout;
134 pxout = cos(theta)*px + sin(theta)*py;
136 p.pos(
RealAoS::y) = -sin(theta)*xout + cos(theta)*yout;
137 pyout = -sin(theta)*px + cos(theta)*py;
161 using namespace amrex::literals;
164 amrex::ParticleReal
const x = refpart.x;
165 amrex::ParticleReal
const px = refpart.px;
166 amrex::ParticleReal
const y = refpart.y;
167 amrex::ParticleReal
const py = refpart.py;
168 amrex::ParticleReal
const z = refpart.z;
169 amrex::ParticleReal
const pz = refpart.pz;
170 amrex::ParticleReal
const t = refpart.t;
171 amrex::ParticleReal
const pt = refpart.pt;
172 amrex::ParticleReal
const s = refpart.s;
175 amrex::ParticleReal
const slice_ds =
m_ds /
nslice();
178 amrex::ParticleReal
const bgi =
sqrt(
pow(pt, 2) - 1.0_prt);
181 refpart.pt = pt -
m_ez*slice_ds;
184 amrex::ParticleReal
const ptf = refpart.pt;
185 amrex::ParticleReal
const bgf =
sqrt(
pow(ptf, 2) - 1.0_prt);
188 refpart.t = t + (bgf - bgi)/
m_ez;
191 refpart.x = x + slice_ds*px/bgi;
192 refpart.y = y + slice_ds*py/bgi;
193 refpart.z = z + slice_ds*pz/bgi;
196 refpart.px = px*bgf/bgi;
197 refpart.py = py*bgf/bgi;
198 refpart.pz = pz*bgf/bgi;
201 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:33
Definition: ChrUniformAcc.H:30
ChrAcc(amrex::ParticleReal const ds, amrex::ParticleReal const ez, amrex::ParticleReal const bz, int const nslice)
Definition: ChrUniformAcc.H:46
amrex::ParticleReal m_bz
electric field strength in 1/m
Definition: ChrUniformAcc.H:206
ImpactXParticleContainer::ParticleType PType
Definition: ChrUniformAcc.H:32
amrex::ParticleReal m_ez
Definition: ChrUniformAcc.H:205
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:64
static constexpr auto name
Definition: ChrUniformAcc.H:31
@ 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
Definition: beamoptic.H:135
Definition: nofinalize.H:22
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::ParticleReal ds() const
Definition: thick.H:50
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE int nslice() const
Definition: thick.H:40
amrex::ParticleReal m_ds
Definition: thick.H:56
Thick(amrex::ParticleReal const ds, int const nslice)
Definition: thick.H:30