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

#include <ChrUniformAcc.H>

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

Public Types

using PType = ImpactXParticleContainer::ParticleType

Public Member Functions

 ChrAcc (amrex::ParticleReal ds, amrex::ParticleReal ez, amrex::ParticleReal bz, 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)
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 &AMREX_RESTRICT py, T_Real &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
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< ChrAcc >
void operator() (ImpactXParticleContainer &pc, int step, int period)
Public Member Functions inherited from impactx::elements::mixin::LinearTransport< ChrAcc >
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::NoFinalize
void finalize ()

Public Attributes

amrex::ParticleReal m_ez
amrex::ParticleReal m_bz
 electric field strength in 1/m
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 = "ChrAcc"
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< ChrAcc >
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 strength in 1/m
amrex::ParticleReal m_ptf_ref
 m_ds / nslice();
amrex::ParticleReal m_pti_ref
amrex::ParticleReal m_bgf
amrex::ParticleReal m_bgi
amrex::ParticleReal m_alpha
amrex::ParticleReal m_alpha_iez

Member Typedef Documentation

◆ PType

Constructor & Destructor Documentation

◆ ChrAcc()

impactx::elements::ChrAcc::ChrAcc ( amrex::ParticleReal ds,
amrex::ParticleReal ez,
amrex::ParticleReal bz,
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

Acceleration in a uniform field Ez, with a uniform solenoidal field Bz.

The Hamiltonian is expanded through second order in the transverse variables (x,px,y,py), with the exact pt dependence retained.

Parameters
dsSegment length in m.
ezelectric field strength in m^(-1) = (charge * electric field Ez in V/m) / (m*c^2)
bzmagnetic field strength in m^(-1) = (charge * magnetic field Bz in T) / (m*c)
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::ChrAcc::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::ChrAcc::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::ChrAcc::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
inline

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

The

See also
compute_constants method must be called before pushing particles through this operator.
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)

◆ reverse()

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

Reverse the element (negate ds)

◆ transport_map()

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

This function returns the linear transport map.

Jacobian at the reference trajectory of the ChrAcc push (see

See also
operator()). The nonlinear push composes, in order: (1) static->dynamic unit conversion: diag(1, bgi, 1, bgi, 1, bgi) acting on (x, px, y, py, t, pt); (2) solenoid-like focusing by phase advance theta (cf. Sol); (3) rotation by the same theta in the (x, y) plane; (4) dynamic->static unit conversion: diag(1, 1/bgf, 1, 1/bgf, 1, 1/bgf) on the output; plus a symplectic correction to t. Here theta = (alpha/ez) * log((pzf_ref - ptf_ref)/(pzi_ref - pti_ref)) with alpha = Bz/2, ez the normalized longitudinal electric field, pzi_ref = sqrt(pti_ref^2 - 1), pzf_ref = sqrt(ptf_ref^2 - 1), and (pti_ref, ptf_ref) = (initial, final) reference pt on this slice.

This routine is called after the reference particle has been advanced by one slice (see diagnostics/LinearMap.cpp), so refpart.pt holds ptf_ref and pti_ref = ptf_ref + ez * slice_ds.

The closed-form linear map was derived with SymPy by Jacobian of the exact push at (x, px, y, py, t, pt) = 0. Writing c = cos(theta0), s = sin(theta0) with theta0 the reference phase advance above, the nonzero entries are R(1,1) = c^2, R(1,2) = bgi * c*s / alpha, R(1,3) = c*s, R(1,4) = bgi * s^2 / alpha, R(2,1) = -alpha * c*s / bgf, R(2,2) = (bgi/bgf) * c^2, R(2,3) = -alpha * s^2 / bgf, R(2,4) = (bgi/bgf) * c*s, R(3,1) = -c*s, R(3,2) = -bgi * s^2 / alpha, R(3,3) = c^2, R(3,4) = bgi * c*s / alpha, R(4,1) = alpha * s^2 / bgf, R(4,2) = -(bgi/bgf) * c*s, R(4,3) = -alpha * c*s / bgf, R(4,4) = (bgi/bgf) * c^2, R(5,5) = 1, R(5,6) = (bgi/ez) * (ptf_ref/pzf_ref - pti_ref/pzi_ref), R(6,6) = bgi/bgf. All other entries are zero. The quadratic-in-(px, py, x, y) part of the t correction vanishes at linear order.

References:

  • A. J. Dragt, Lie Methods for Nonlinear Dynamics with Applications to Accelerator Physics, Univ. of Maryland, 2020 (MaryLie documentation), chapter on uniform-Ez acceleration with solenoidal focusing;
  • H. Wiedemann, Particle Accelerator Physics, 4th ed., Springer 2015, chapters on electrostatic acceleration and solenoid focusing;
  • The Hamiltonian and nonlinear push follow Chad Mitchell's formulation already implemented in
    See also
    operator().
    Ideal behavior only: alignment and rotation errors and feed-down from an off-axis reference orbit are ignored.
Parameters
[in]refpartreference particle after this slice's reference advance (pt = ptf_ref)
Returns
6x6 transport matrix

Member Data Documentation

◆ m_alpha

amrex::ParticleReal impactx::elements::ChrAcc::m_alpha
private

◆ m_alpha_iez

amrex::ParticleReal impactx::elements::ChrAcc::m_alpha_iez
private

◆ m_bgf

amrex::ParticleReal impactx::elements::ChrAcc::m_bgf
private

◆ m_bgi

amrex::ParticleReal impactx::elements::ChrAcc::m_bgi
private

◆ m_bz

amrex::ParticleReal impactx::elements::ChrAcc::m_bz

electric field strength in 1/m

◆ m_ez

amrex::ParticleReal impactx::elements::ChrAcc::m_ez

◆ m_ptf_ref

amrex::ParticleReal impactx::elements::ChrAcc::m_ptf_ref
private

m_ds / nslice();

◆ m_pti_ref

amrex::ParticleReal impactx::elements::ChrAcc::m_pti_ref
private

◆ m_slice_ds

amrex::ParticleReal impactx::elements::ChrAcc::m_slice_ds
private

magnetic field strength in 1/m

◆ type

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

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