ImpactX
Loading...
Searching...
No Matches
impactx::elements::ExactSbend Struct Reference

#include <ExactSbend.H>

Inheritance diagram for impactx::elements::ExactSbend:
amrex::simd::Vectorized< amrex::simd::native_simd_size_particlereal > impactx::elements::mixin::NoFinalize impactx::elements::mixin::SpinTransport impactx::elements::mixin::PipeAperture impactx::elements::mixin::Alignment impactx::elements::mixin::Thick impactx::elements::mixin::LinearTransport< ExactSbend > impactx::elements::mixin::BeamOptic< ExactSbend > impactx::elements::mixin::Named

Public Types

using PType = ImpactXParticleContainer::ParticleType

Public Member Functions

 ExactSbend (amrex::ParticleReal ds, amrex::ParticleReal phi, amrex::ParticleReal B=DEFAULT_B, amrex::ParticleReal dx=DEFAULT_dx, amrex::ParticleReal dy=DEFAULT_dy, amrex::ParticleReal rotation_degree=DEFAULT_rotation_degree, amrex::ParticleReal aperture_x=DEFAULT_aperture_x, amrex::ParticleReal aperture_y=DEFAULT_aperture_y, int nslice=DEFAULT_nslice, std::optional< std::string > name=DEFAULT_name)
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::ParticleReal rc (RefPart const &refpart) const
void reverse ()
void compute_constants (RefPart const &refpart)
template<typename T_Real = amrex::ParticleReal, typename T_IdCpu = uint64_t>
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 const &AMREX_RESTRICT py, T_Real const &AMREX_RESTRICT pt, T_IdCpu &AMREX_RESTRICT idcpu, RefPart const &AMREX_RESTRICT refpart) const
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void operator() (RefPart &AMREX_RESTRICT refpart) const
AMREX_GPU_HOST AMREX_FORCE_INLINE Map6x6 transport_map (RefPart const &AMREX_RESTRICT refpart) const
template<typename T_Real = amrex::ParticleReal, typename T_IdCpu = uint64_t>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void spin_and_phasespace_push (T_Real &AMREX_RESTRICT x, T_Real &AMREX_RESTRICT y, T_Real &AMREX_RESTRICT t, T_Real &AMREX_RESTRICT px, T_Real const &AMREX_RESTRICT py, T_Real const &AMREX_RESTRICT pt, T_Real &AMREX_RESTRICT sx, T_Real &AMREX_RESTRICT sy, T_Real &AMREX_RESTRICT sz, T_IdCpu &AMREX_RESTRICT idcpu, RefPart const &AMREX_RESTRICT refpart) const
Public Member Functions inherited from impactx::elements::mixin::Named
AMREX_GPU_HOST void set_name (std::string const &new_name)
AMREX_GPU_HOST Named (std::optional< std::string > name)
AMREX_GPU_HOST_DEVICE ~Named ()
AMREX_GPU_HOST Named (Named const &other)
AMREX_GPU_HOST Namedoperator= (Named const &other)
AMREX_GPU_HOST_DEVICE Named (Named &&other) noexcept
AMREX_GPU_HOST_DEVICE Namedoperator= (Named &&other) noexcept
AMREX_FORCE_INLINE std::string name () const
AMREX_FORCE_INLINE bool has_name () const
Public Member Functions inherited from impactx::elements::mixin::BeamOptic< ExactSbend >
void operator() (ImpactXParticleContainer &pc, int step, int period)
Public Member Functions inherited from impactx::elements::mixin::LinearTransport< ExactSbend >
AMREX_GPU_HOST AMREX_FORCE_INLINE void operator() (Map6x6 &AMREX_RESTRICT cm, RefPart const &AMREX_RESTRICT ref) const
Public Member Functions inherited from impactx::elements::mixin::Thick
 Thick (amrex::ParticleReal ds, int nslice)
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE int nslice () const
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::ParticleReal ds () const
void reverse ()
Public Member Functions inherited from impactx::elements::mixin::Alignment
 Alignment (amrex::ParticleReal dx, amrex::ParticleReal dy, amrex::ParticleReal rotation_degree)
 Alignment ()=default
 Alignment (Alignment const &)=default
Alignmentoperator= (Alignment const &)=default
 Alignment (Alignment &&)=default
Alignmentoperator= (Alignment &&rhs)=default
 ~Alignment ()=default
void compute_constants (RefPart const &refpart)
template<typename T_Real>
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
template<typename T_Real>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void rotate_in (T_Real &AMREX_RESTRICT sx, T_Real &AMREX_RESTRICT sy) const
template<typename T_Real>
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
template<typename T_Real>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void rotate_out (T_Real &AMREX_RESTRICT sx, T_Real &AMREX_RESTRICT sy) const
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::ParticleReal dx () const
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::ParticleReal dy () const
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::ParticleReal rotation () const
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool misaligned () const
AMREX_GPU_HOST AMREX_FORCE_INLINE Map6x6 rotation_map () const
AMREX_GPU_HOST AMREX_FORCE_INLINE Map6x6 rotate_aligned_map (Map6x6 const &R) const
Public Member Functions inherited from impactx::elements::mixin::PipeAperture
 PipeAperture (amrex::ParticleReal aperture_x, amrex::ParticleReal aperture_y)
 PipeAperture ()=default
 PipeAperture (PipeAperture const &)=default
PipeApertureoperator= (PipeAperture const &)=default
 PipeAperture (PipeAperture &&)=default
PipeApertureoperator= (PipeAperture &&rhs)=default
 ~PipeAperture ()=default
template<typename T_Real = amrex::ParticleReal, typename T_IdCpu = uint64_t>
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
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::ParticleReal aperture_x () const
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::ParticleReal aperture_y () const
Public Member Functions inherited from impactx::elements::mixin::SpinTransport
template<typename T_Real = amrex::ParticleReal>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void rotate_spin (T_Real const &AMREX_RESTRICT lambdax, T_Real const &AMREX_RESTRICT lambday, T_Real const &AMREX_RESTRICT lambdaz, T_Real &AMREX_RESTRICT sx, T_Real &AMREX_RESTRICT sy, T_Real &AMREX_RESTRICT sz) const
template<typename T_Real = amrex::ParticleReal>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void tbmt_precession_vector (T_Real const &AMREX_RESTRICT x, T_Real const &AMREX_RESTRICT ux, T_Real const &AMREX_RESTRICT uy, T_Real const &AMREX_RESTRICT uz, T_Real const &AMREX_RESTRICT gamma, amrex::ParticleReal const &AMREX_RESTRICT h, amrex::ParticleReal const &AMREX_RESTRICT gyro_anomaly, T_Real const &AMREX_RESTRICT Bx, T_Real const &AMREX_RESTRICT By, T_Real const &AMREX_RESTRICT Bz, T_Real const &AMREX_RESTRICT Ex, T_Real const &AMREX_RESTRICT Ey, T_Real const &AMREX_RESTRICT Ez, T_Real &AMREX_RESTRICT Omegax, T_Real &AMREX_RESTRICT Omegay, T_Real &AMREX_RESTRICT Omegaz) const
Public Member Functions inherited from impactx::elements::mixin::NoFinalize
void finalize ()

Public Attributes

amrex::ParticleReal m_phi
amrex::ParticleReal m_B
 bend angle in radians
Public Attributes inherited from impactx::elements::mixin::Thick
amrex::ParticleReal m_ds
int m_nslice
 segment length in m
Public Attributes inherited from impactx::elements::mixin::Alignment
amrex::ParticleReal m_dx = 0
amrex::ParticleReal m_dy = 0
 horizontal translation error [m]
amrex::ParticleReal m_rotation = 0
 vertical translation error [m]
Public Attributes inherited from impactx::elements::mixin::PipeAperture
amrex::ParticleReal m_inv_aperture_x = 0
amrex::ParticleReal m_inv_aperture_y = 0
 inverse of the horizontal aperture size [1/m]

Static Public Attributes

static constexpr auto type = "ExactSbend"
static constexpr amrex::ParticleReal DEFAULT_B = 0
Static Public Attributes inherited from impactx::elements::mixin::Named
static constexpr std::nullopt_t DEFAULT_name = std::nullopt
Static Public Attributes inherited from impactx::elements::mixin::LinearTransport< ExactSbend >
static constexpr bool has_linear_transport
Static Public Attributes inherited from impactx::elements::mixin::Thick
static constexpr int DEFAULT_nslice = 1
Static Public Attributes inherited from impactx::elements::mixin::Alignment
static constexpr amrex::ParticleReal degree2rad
static constexpr amrex::ParticleReal DEFAULT_dx = 0
static constexpr amrex::ParticleReal DEFAULT_dy = 0
static constexpr amrex::ParticleReal DEFAULT_rotation_degree = 0
Static Public Attributes inherited from impactx::elements::mixin::PipeAperture
static constexpr amrex::ParticleReal DEFAULT_aperture_x = 0
static constexpr amrex::ParticleReal DEFAULT_aperture_y = 0
Static Public Attributes inherited from amrex::simd::Vectorized< amrex::simd::native_simd_size_particlereal >
static constexpr int simd_width

Private Attributes

amrex::ParticleReal m_slice_ds
 magnetic field in T
amrex::ParticleReal m_slice_phi
amrex::ParticleReal m_ibeta
amrex::ParticleReal m_ibetagam2
amrex::ParticleReal m_rc
amrex::ParticleReal m_sin_phi
amrex::ParticleReal m_cos_phi
amrex::ParticleReal m_gyro
amrex::ParticleReal m_beta
amrex::ParticleReal m_beta_gamma

Member Typedef Documentation

◆ PType

Constructor & Destructor Documentation

◆ ExactSbend()

impactx::elements::ExactSbend::ExactSbend ( amrex::ParticleReal ds,
amrex::ParticleReal phi,
amrex::ParticleReal B = DEFAULT_B,
amrex::ParticleReal dx = DEFAULT_dx,
amrex::ParticleReal dy = DEFAULT_dy,
amrex::ParticleReal rotation_degree = DEFAULT_rotation_degree,
amrex::ParticleReal aperture_x = DEFAULT_aperture_x,
amrex::ParticleReal aperture_y = DEFAULT_aperture_y,
int nslice = DEFAULT_nslice,
std::optional< std::string > name = DEFAULT_name )
inline

The body of an ideal sector bend, using the exact nonlinear transfer map. The map corresponds to the map described in: D. L. Bruhwiler et al, in Proc. of EPAC 98, pp. 1171-1173 (1998).

In the ultrarelativistic limit, this is equivalent to the map described in: E. Forest et al, Part. Accel. 45, pp. 65-94 (1994).

The model consists of a uniform bending field B_y with a hard edge. Pole faces are normal to the entry and exit velocity of the reference particle.

Parameters
dsSegment length in m.
phiSegment bend angle in degrees.
BMagnetic field strength in T. When B = 0 (default), the reference bending radius is defined by r0 = length / (angle in rad), corresponding to a magnetic field of B = rigidity / r0; otherwise the reference bending radius is defined by r0 = rigidity / B.
dxhorizontal translation error in m
dyvertical translation error in m
rotation_degreerotation error in the transverse plane [degrees]
aperture_xhorizontal half-aperture in m
aperture_yvertical half-aperture in m
nslicenumber of slices used for the application of space charge
namea user defined and not necessarily unique name of the element

Member Function Documentation

◆ compute_constants()

void impactx::elements::ExactSbend::compute_constants ( RefPart const & refpart)
inline

Compute and cache the constants for the push.

In particular, used to pre-compute and cache variables that are independent of the individually tracked particle.

Parameters
refpartreference particle

◆ operator()() [1/2]

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void impactx::elements::ExactSbend::operator() ( RefPart &AMREX_RESTRICT refpart) const
inline

This pushes the reference particle.

Parameters
[in,out]refpartreference particle

◆ operator()() [2/2]

template<typename T_Real = amrex::ParticleReal, typename T_IdCpu = uint64_t>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void impactx::elements::ExactSbend::operator() ( T_Real &AMREX_RESTRICT x,
T_Real &AMREX_RESTRICT y,
T_Real &AMREX_RESTRICT t,
T_Real &AMREX_RESTRICT px,
T_Real const &AMREX_RESTRICT py,
T_Real const &AMREX_RESTRICT pt,
T_IdCpu &AMREX_RESTRICT idcpu,
RefPart const &AMREX_RESTRICT refpart ) const
inline

This is an ExactSbend functor, so that a variable of this type can be used like an ExactSbend function.

Parameters
xparticle position in x
yparticle position in y
tparticle position in t
pxparticle momentum in x
pyparticle momentum in y
ptparticle momentum in t
idcpuparticle global index
refpartreference particle (unused)

◆ rc()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::ParticleReal impactx::elements::ExactSbend::rc ( RefPart const & refpart) const
inline

◆ reverse()

void impactx::elements::ExactSbend::reverse ( )
inline

Reverse the element (negate ds and phi)

◆ spin_and_phasespace_push()

template<typename T_Real = amrex::ParticleReal, typename T_IdCpu = uint64_t>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void impactx::elements::ExactSbend::spin_and_phasespace_push ( T_Real &AMREX_RESTRICT x,
T_Real &AMREX_RESTRICT y,
T_Real &AMREX_RESTRICT t,
T_Real &AMREX_RESTRICT px,
T_Real const &AMREX_RESTRICT py,
T_Real const &AMREX_RESTRICT pt,
T_Real &AMREX_RESTRICT sx,
T_Real &AMREX_RESTRICT sy,
T_Real &AMREX_RESTRICT sz,
T_IdCpu &AMREX_RESTRICT idcpu,
RefPart const &AMREX_RESTRICT refpart ) const
inline

This operator pushes the particle spin.

Parameters
xparticle position in x
yparticle position in y
tparticle position in t
pxparticle momentum in x
pyparticle momentum in y
ptparticle momentum in t
sxparticle spin x-component
syparticle spin y-component
szparticle spin z-component
idcpuparticle global index
refpartreference particle

◆ transport_map()

AMREX_GPU_HOST AMREX_FORCE_INLINE Map6x6 impactx::elements::ExactSbend::transport_map ( RefPart const &AMREX_RESTRICT refpart) const
inline

This function returns the linear transport map.

Parameters
[in]refpartreference particle
Returns
6x6 transport matrix

Member Data Documentation

◆ DEFAULT_B

amrex::ParticleReal impactx::elements::ExactSbend::DEFAULT_B = 0
staticconstexpr

◆ m_B

amrex::ParticleReal impactx::elements::ExactSbend::m_B

bend angle in radians

◆ m_beta

amrex::ParticleReal impactx::elements::ExactSbend::m_beta
private

◆ m_beta_gamma

amrex::ParticleReal impactx::elements::ExactSbend::m_beta_gamma
private

◆ m_cos_phi

amrex::ParticleReal impactx::elements::ExactSbend::m_cos_phi
private

◆ m_gyro

amrex::ParticleReal impactx::elements::ExactSbend::m_gyro
private

◆ m_ibeta

amrex::ParticleReal impactx::elements::ExactSbend::m_ibeta
private

◆ m_ibetagam2

amrex::ParticleReal impactx::elements::ExactSbend::m_ibetagam2
private

◆ m_phi

amrex::ParticleReal impactx::elements::ExactSbend::m_phi

◆ m_rc

amrex::ParticleReal impactx::elements::ExactSbend::m_rc
private

◆ m_sin_phi

amrex::ParticleReal impactx::elements::ExactSbend::m_sin_phi
private

◆ m_slice_ds

amrex::ParticleReal impactx::elements::ExactSbend::m_slice_ds
private

magnetic field in T

◆ m_slice_phi

amrex::ParticleReal impactx::elements::ExactSbend::m_slice_phi
private

◆ type

auto impactx::elements::ExactSbend::type = "ExactSbend"
staticconstexpr

The documentation for this struct was generated from the following file: