29 static constexpr
auto name =
"Sol";
39 Sol( amrex::ParticleReal
const ds, amrex::ParticleReal
const ks,
46 using BeamOptic::operator();
58 PType& AMREX_RESTRICT p,
59 amrex::ParticleReal & AMREX_RESTRICT px,
60 amrex::ParticleReal & AMREX_RESTRICT py,
61 amrex::ParticleReal & AMREX_RESTRICT pt,
62 RefPart const & refpart)
const {
64 using namespace amrex::literals;
67 amrex::ParticleReal
const x = p.pos(0);
68 amrex::ParticleReal
const y = p.pos(1);
69 amrex::ParticleReal
const t = p.pos(2);
72 amrex::ParticleReal
const slice_ds =
m_ds /
nslice();
75 amrex::ParticleReal
const pt_ref = refpart.
pt;
76 amrex::ParticleReal
const betgam2 =
pow(pt_ref, 2) - 1.0_prt;
80 amrex::ParticleReal
const alpha =
m_ks/2.0_prt;
81 amrex::ParticleReal
const theta = alpha*slice_ds;
84 amrex::ParticleReal xout = x;
85 amrex::ParticleReal yout = y;
86 amrex::ParticleReal tout = t;
87 amrex::ParticleReal pxout = px;
88 amrex::ParticleReal pyout = py;
89 amrex::ParticleReal ptout = pt;
92 xout = cos(theta)*x + sin(theta)/alpha*px;
93 pxout = -alpha*sin(theta)*x + cos(theta)*px;
95 yout = cos(theta)*y + sin(theta)/alpha*py;
96 pyout = -alpha*sin(theta)*y + cos(theta)*py;
98 tout = t + (slice_ds/betgam2)*pt;
107 p.pos(0) = cos(theta)*xout + sin(theta)*yout;
108 pxout = cos(theta)*px + sin(theta)*py;
110 p.pos(1) = -sin(theta)*xout + cos(theta)*yout;
111 pyout = -sin(theta)*px + cos(theta)*py;
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;
141 amrex::ParticleReal
const s = refpart.s;
144 amrex::ParticleReal
const slice_ds =
m_ds /
nslice();
147 amrex::ParticleReal
const step = slice_ds /
sqrt(
pow(pt,2)-1.0_prt);
150 refpart.x = x + step*px;
151 refpart.y = y + step*py;
152 refpart.z = z + step*pz;
153 refpart.t = t - step*pt;
156 refpart.s = s + slice_ds;
165 #endif // IMPACTX_SOL_H
amrex::ParticleReal m_ks
Definition: Sol.H:160
Definition: ImpactX.cpp:31
Sol(amrex::ParticleReal const ds, amrex::ParticleReal const ks, int const nslice)
Definition: Sol.H:39
Definition: beamoptic.H:131
amrex::ParticleReal pt
energy deviation, normalized by rest energy
Definition: ReferenceParticle.H:39
#define AMREX_FORCE_INLINE
#define AMREX_GPU_HOST_DEVICE
Particle< NStructReal, NStructInt > ParticleType
static constexpr auto name
Definition: Sol.H:29
Thick(amrex::ParticleReal const ds, int const nslice)
Definition: thick.H:30
Definition: ReferenceParticle.H:29
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 amrex::ParticleReal ds() const
Definition: thick.H:50
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE int nslice() const
Definition: thick.H:40
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE GpuComplex< T > sqrt(const GpuComplex< T > &a_z) noexcept
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: Sol.H:57
amrex::ParticleReal m_ds
Definition: thick.H:56