10 #ifndef IMPACTX_CHRPLASMALENS_H
11 #define IMPACTX_CHRPLASMALENS_H
33 static constexpr
auto name =
"ChrPlasmaLens";
54 amrex::ParticleReal
ds,
55 amrex::ParticleReal k,
57 amrex::ParticleReal
dx = 0,
58 amrex::ParticleReal
dy = 0,
59 amrex::ParticleReal rotation_degree = 0,
69 using BeamOptic::operator();
81 PType& AMREX_RESTRICT p,
82 amrex::ParticleReal & AMREX_RESTRICT px,
83 amrex::ParticleReal & AMREX_RESTRICT py,
84 amrex::ParticleReal & AMREX_RESTRICT pt,
88 using namespace amrex::literals;
94 amrex::ParticleReal
const x = p.pos(
RealAoS::x);
95 amrex::ParticleReal
const y = p.pos(
RealAoS::y);
99 amrex::ParticleReal
const slice_ds =
m_ds /
nslice();
102 amrex::ParticleReal
const bet = refpart.
beta();
105 amrex::ParticleReal g =
m_k;
111 amrex::ParticleReal delta1;
112 delta1 =
sqrt(1_prt - 2_prt*pt/bet +
pow(pt,2));
113 amrex::ParticleReal
const delta = delta1 - 1_prt;
117 amrex::ParticleReal
const omega =
sqrt(std::abs(g)/delta1);
120 amrex::ParticleReal pxout = px;
121 amrex::ParticleReal pyout = py;
122 amrex::ParticleReal
const ptout = pt;
125 amrex::ParticleReal q1 = x;
126 amrex::ParticleReal q2 = y;
127 amrex::ParticleReal p1 = px;
128 amrex::ParticleReal p2 = py;
132 sin(omega*slice_ds)/(omega*delta1)*px;
133 pxout = -omega*delta1*sin(omega*slice_ds)*x + cos(omega*slice_ds)*px;
136 sin(omega*slice_ds)/(omega*delta1)*py;
137 pyout = -omega*delta1*sin(omega*slice_ds)*y + cos(omega*slice_ds)*py;
142 amrex::ParticleReal
const term = pt + delta/bet;
143 amrex::ParticleReal
const t0 =
t - term*slice_ds/delta1;
145 amrex::ParticleReal
const w = omega*delta1;
146 amrex::ParticleReal
const term1 = -(
pow(p2,2)-
pow(q2,2)*
pow(
w,2))*sin(2_prt*slice_ds*omega);
147 amrex::ParticleReal
const term2 = -(
pow(p1,2)-
pow(q1,2)*
pow(
w,2))*sin(2_prt*slice_ds*omega);
148 amrex::ParticleReal
const term3 = -2_prt*q2*p2*
w*cos(2_prt*slice_ds*omega);
149 amrex::ParticleReal
const term4 = -2_prt*q1*p1*
w*cos(2_prt*slice_ds*omega);
150 amrex::ParticleReal
const term5 = 2_prt*omega*(q1*p1*delta1 + q2*p2*delta1
152 p.pos(
RealAoS::t) = t0 + (-1_prt+bet*pt)/(8_prt*bet*
pow(delta1,3)*omega)
153 *(term1+term2+term3+term4+term5);
173 using namespace amrex::literals;
176 amrex::ParticleReal
const x = refpart.x;
177 amrex::ParticleReal
const px = refpart.px;
178 amrex::ParticleReal
const y = refpart.y;
179 amrex::ParticleReal
const py = refpart.py;
180 amrex::ParticleReal
const z = refpart.z;
181 amrex::ParticleReal
const pz = refpart.pz;
182 amrex::ParticleReal
const t = refpart.t;
183 amrex::ParticleReal
const pt = refpart.pt;
184 amrex::ParticleReal
const s = refpart.s;
187 amrex::ParticleReal
const slice_ds =
m_ds /
nslice();
190 amrex::ParticleReal
const step = slice_ds /
sqrt(
pow(pt,2)-1.0_prt);
193 refpart.x = x + step*px;
194 refpart.y = y + step*py;
195 refpart.z = z + step*pz;
196 refpart.t =
t - step*pt;
199 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 > 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: ChrPlasmaLens.H:32
static constexpr auto name
Definition: ChrPlasmaLens.H:33
ImpactXParticleContainer::ParticleType PType
Definition: ChrPlasmaLens.H:34
int m_unit
focusing strength in 1/m^2 (or T/m)
Definition: ChrPlasmaLens.H:203
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: ChrPlasmaLens.H:80
ChrPlasmaLens(amrex::ParticleReal ds, amrex::ParticleReal k, int unit, amrex::ParticleReal dx=0, amrex::ParticleReal dy=0, amrex::ParticleReal rotation_degree=0, int nslice=1)
Definition: ChrPlasmaLens.H:53
amrex::ParticleReal m_k
Definition: ChrPlasmaLens.H:202
@ 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_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::ParticleReal rigidity_Tm() const
Definition: ReferenceParticle.H:169
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::ParticleReal beta() const
Definition: ReferenceParticle.H:64
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