10#ifndef IMPACTX_SBEND_H
11#define IMPACTX_SBEND_H
44 static constexpr auto type =
"Sbend";
60 amrex::ParticleReal
ds,
61 amrex::ParticleReal
rc,
62 amrex::ParticleReal
dx = 0,
63 amrex::ParticleReal
dy = 0,
64 amrex::ParticleReal rotation_degree = 0,
68 std::optional<std::string>
name = std::nullopt
82 using namespace amrex::literals;
90 using BeamOptic::operator();
101 using namespace amrex::literals;
104 Alignment::compute_constants(refpart);
107 amrex::ParticleReal
const slice_ds =
m_ds /
nslice();
110 amrex::ParticleReal
const ibet = 1.0_prt / refpart.
beta();
111 amrex::ParticleReal
const ibetagam2 = 1_prt / powi<2>(refpart.
beta_gamma());
121 m_R56 = slice_ds * ibetagam2;
126 amrex::ParticleReal
const theta = slice_ds /
m_rc;
131 m_R16 = -
m_rc * ibet * (1.0_prt - cos_theta);
134 m_R26 = -sin_theta * ibet;
138 m_R56 =
m_rc * (-theta + sin_theta * ibet * ibet);
155 template<
typename T_Real=amrex::ParticleReal,
typename T_IdCpu=u
int64_t>
168 using namespace amrex::literals;
180 T_Real
const pyout = py;
181 T_Real
const ptout = pt;
184 T_Real
const R22 =
m_R11;
185 T_Real
const R51 = -
m_R26;
186 T_Real
const R52 = -
m_R16;
230 using namespace amrex::literals;
234 amrex::ParticleReal
const x = refpart.x;
235 amrex::ParticleReal
const px = refpart.px;
236 amrex::ParticleReal
const y = refpart.y;
237 amrex::ParticleReal
const py = refpart.py;
238 amrex::ParticleReal
const z = refpart.z;
239 amrex::ParticleReal
const pz = refpart.pz;
240 amrex::ParticleReal
const t = refpart.t;
241 amrex::ParticleReal
const pt = refpart.pt;
242 amrex::ParticleReal
const s = refpart.s;
245 amrex::ParticleReal
const slice_ds =
m_ds /
nslice();
248 if (
m_rc == 0.0_prt) {
250 amrex::ParticleReal
const step = slice_ds /std::sqrt(powi<2>(pt)-1.0_prt);
251 refpart.x = x + step*px;
252 refpart.y = y + step*py;
253 refpart.z = z + step*pz;
254 refpart.t =
t - step*pt;
259 amrex::ParticleReal
const theta = slice_ds/
m_rc;
260 amrex::ParticleReal
const B = std::sqrt(powi<2>(pt)-1.0_prt)/
m_rc;
266 refpart.px = px*cos_theta - pz*sin_theta;
268 refpart.pz = pz*cos_theta + px*sin_theta;
271 refpart.x = x + (refpart.pz - pz)/B;
272 refpart.y = y + (theta/B)*py;
273 refpart.z = z - (refpart.px - px)/B;
274 refpart.t =
t - (theta/B)*pt;
279 refpart.s =
s + slice_ds;
284 using LinearTransport::operator();
294 using namespace amrex::literals;
298 amrex::ParticleReal
const slice_ds =
m_ds /
nslice();
301 amrex::ParticleReal
const pt_ref = refpart.pt;
302 amrex::ParticleReal
const betgam2 = powi<2>(pt_ref) - 1.0_prt;
303 amrex::ParticleReal
const bet = std::sqrt(betgam2/(1.0_prt + betgam2));
312 R(5,6) = slice_ds / betgam2;
317 amrex::ParticleReal
const theta = slice_ds/
m_rc;
322 R(1,2) =
m_rc*sin_theta;
323 R(1,6) = - (
m_rc/bet)*(1.0_prt - cos_theta);
324 R(2,1) = -sin_theta/
m_rc;
326 R(2,6) = - sin_theta/bet;
328 R(5,1) = sin_theta/bet;
329 R(5,2) =
m_rc/bet*(1.0_prt - cos_theta);
330 R(5,6) =
m_rc*(-theta+sin_theta/(bet*bet));
#define AMREX_FORCE_INLINE
#define AMREX_GPU_HOST_DEVICE
T_ParticleType ParticleType
__host__ __device__ std::pair< double, double > sincos(double x)
constexpr T powi(T x) noexcept
@ s
fixed s as the independent variable
Definition ImpactXParticleContainer.H:37
@ t
fixed t as the independent variable
Definition ImpactXParticleContainer.H:38
amrex::SmallMatrix< amrex::ParticleReal, 6, 6, amrex::Order::F, 1 > Map6x6
Definition CovarianceMatrix.H:20
static constexpr __host__ __device__ SmallMatrix< T, NRows, NCols, ORDER, StartIndex > Identity() noexcept
Definition ReferenceParticle.H:31
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::ParticleReal beta_gamma() const
Definition ReferenceParticle.H:110
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::ParticleReal beta() const
Definition ReferenceParticle.H:94
ImpactXParticleContainer::ParticleType PType
Definition Sbend.H:45
amrex::ParticleReal m_R16
Definition Sbend.H:342
static constexpr auto type
Definition Sbend.H:44
amrex::ParticleReal m_R11
bend radius in m
Definition Sbend.H:342
amrex::ParticleReal m_R21
Definition Sbend.H:342
amrex::ParticleReal m_R34
Definition Sbend.H:342
amrex::ParticleReal m_R12
Definition Sbend.H:342
amrex::ParticleReal m_rc
Definition Sbend.H:337
amrex::ParticleReal m_R26
Definition Sbend.H:342
void compute_constants(RefPart const &refpart)
Definition Sbend.H:99
Sbend(amrex::ParticleReal ds, amrex::ParticleReal rc, amrex::ParticleReal dx=0, amrex::ParticleReal dy=0, amrex::ParticleReal rotation_degree=0, amrex::ParticleReal aperture_x=0, amrex::ParticleReal aperture_y=0, int nslice=1, std::optional< std::string > name=std::nullopt)
Definition Sbend.H:59
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::ParticleReal rc(RefPart const &refpart) const
Definition Sbend.H:80
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void operator()(T_Real &AMREX_RESTRICT x, T_Real &AMREX_RESTRICT y, T_Real &AMREX_RESTRICT t, T_Real &AMREX_RESTRICT px, T_Real &AMREX_RESTRICT py, T_Real &AMREX_RESTRICT pt, T_IdCpu &AMREX_RESTRICT idcpu, RefPart const &AMREX_RESTRICT refpart) const
Definition Sbend.H:157
AMREX_GPU_HOST AMREX_FORCE_INLINE Map6x6 transport_map(RefPart const &AMREX_RESTRICT refpart) const
Definition Sbend.H:292
amrex::ParticleReal m_R56
Definition Sbend.H:342
Definition alignment.H:27
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void shift_out(T_Real &AMREX_RESTRICT x, T_Real &AMREX_RESTRICT y, T_Real &AMREX_RESTRICT px, T_Real &AMREX_RESTRICT py) const
Definition alignment.H:109
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::ParticleReal dy() const
Definition alignment.H:146
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::ParticleReal dx() const
Definition alignment.H:136
Alignment(amrex::ParticleReal dx, amrex::ParticleReal dy, amrex::ParticleReal rotation_degree)
Definition alignment.H:36
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void shift_in(T_Real &AMREX_RESTRICT x, T_Real &AMREX_RESTRICT y, T_Real &AMREX_RESTRICT px, T_Real &AMREX_RESTRICT py) const
Definition alignment.H:78
Definition beamoptic.H:219
Definition lineartransport.H:29
AMREX_GPU_HOST Named(std::optional< std::string > name)
Definition named.H:57
AMREX_FORCE_INLINE std::string name() const
Definition named.H:122
Definition nofinalize.H:22
Definition pipeaperture.H:26
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void apply_aperture(T_Real &AMREX_RESTRICT x, T_Real &AMREX_RESTRICT y, T_IdCpu &AMREX_RESTRICT idcpu) const
Definition pipeaperture.H:59
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::ParticleReal aperture_x() const
Definition pipeaperture.H:90
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::ParticleReal aperture_y() const
Definition pipeaperture.H:101
PipeAperture(amrex::ParticleReal aperture_x, amrex::ParticleReal aperture_y)
Definition pipeaperture.H:32
Thick(amrex::ParticleReal ds, int nslice)
Definition thick.H:30
amrex::ParticleReal m_ds
Definition thick.H:58
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