ImpactX
Public Types | Public Member Functions | Static Public Attributes | Private Attributes | List of all members
impactx::SoftSolenoid Struct Reference

#include <SoftSol.H>

Inheritance diagram for impactx::SoftSolenoid:
impactx::elements::BeamOptic< SoftSolenoid > impactx::elements::Thick impactx::elements::Alignment

Public Types

using PType = ImpactXParticleContainer::ParticleType
 

Public Member Functions

 SoftSolenoid (amrex::ParticleReal ds, amrex::ParticleReal bscale, std::vector< amrex::ParticleReal > cos_coef, std::vector< amrex::ParticleReal > sin_coef, amrex::ParticleReal dx=0, amrex::ParticleReal dy=0, amrex::ParticleReal rotation_degree=0, int mapsteps=1, int nslice=1)
 
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, [[maybe_unused]] RefPart const &refpart) const
 
AMREX_GPU_HOST AMREX_FORCE_INLINE void operator() (RefPart &AMREX_RESTRICT refpart) const
 
std::tuple< amrex::ParticleReal, amrex::ParticleReal, amrex::ParticleReal > AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE Sol_Bfield (amrex::ParticleReal const zeval) const
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void map1 (amrex::ParticleReal const tau, RefPart &refpart, [[maybe_unused]] amrex::ParticleReal &zeval) const
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void map2 (amrex::ParticleReal const tau, RefPart &refpart, amrex::ParticleReal &zeval) const
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void map3 (amrex::ParticleReal const tau, RefPart &refpart, amrex::ParticleReal &zeval) const
 
void finalize ()
 
- Public Member Functions inherited from impactx::elements::BeamOptic< SoftSolenoid >
void operator() (ImpactXParticleContainer &pc, int step)
 
void operator() (ImpactXParticleContainer::iterator &pti, RefPart &AMREX_RESTRICT ref_part)
 
- Public Member Functions inherited from impactx::elements::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
 
- Public Member Functions inherited from impactx::elements::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
 
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
 
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
 
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
 

Static Public Attributes

static constexpr auto name = "SoftSolenoid"
 
- Static Public Attributes inherited from impactx::elements::Alignment
static constexpr amrex::ParticleReal degree2rad = ablastr::constant::math::pi / 180.0
 

Private Attributes

amrex::ParticleReal m_bscale
 
int m_mapsteps
 scaling factor for solenoid Bz field More...
 
int m_id
 number of map integration steps per slice More...
 
int m_ncoef = 0
 unique soft solenoid id used for data lookup map More...
 
amrex::ParticleReal * m_cos_h_data = nullptr
 number of Fourier coefficients More...
 
amrex::ParticleReal * m_sin_h_data = nullptr
 non-owning pointer to host cosine coefficients More...
 
amrex::ParticleReal * m_cos_d_data = nullptr
 non-owning pointer to host sine coefficients More...
 
amrex::ParticleReal * m_sin_d_data = nullptr
 non-owning pointer to device cosine coefficients More...
 

Additional Inherited Members

- Public Attributes inherited from impactx::elements::Thick
amrex::ParticleReal m_ds
 
int m_nslice
 segment length in m More...
 
- Public Attributes inherited from impactx::elements::Alignment
amrex::ParticleReal m_dx = 0
 
amrex::ParticleReal m_dy = 0
 horizontal translation error [m] More...
 
amrex::ParticleReal m_rotation = 0
 vertical translation error [m] More...
 

Member Typedef Documentation

◆ PType

Constructor & Destructor Documentation

◆ SoftSolenoid()

impactx::SoftSolenoid::SoftSolenoid ( amrex::ParticleReal  ds,
amrex::ParticleReal  bscale,
std::vector< amrex::ParticleReal >  cos_coef,
std::vector< amrex::ParticleReal >  sin_coef,
amrex::ParticleReal  dx = 0,
amrex::ParticleReal  dy = 0,
amrex::ParticleReal  rotation_degree = 0,
int  mapsteps = 1,
int  nslice = 1 
)
inline

A soft-edge solenoid

Parameters
dsSegment length in m
bscaleScaling factor for on-axis magnetic field Bz in 1/m
cos_coefcosine coefficients in Fourier expansion of on-axis magnetic field Bz
sin_coefsine coefficients in Fourier expansion of on-axis magnetic field Bz
dxhorizontal translation error in m
dyvertical translation error in m
rotation_degreerotation error in the transverse plane [degrees]
mapstepsnumber of integration steps per slice used for map and reference particle push in applied fields
nslicenumber of slices used for the application of space charge

Member Function Documentation

◆ finalize()

void impactx::SoftSolenoid::finalize ( )
inline

Close and deallocate all data and handles.

◆ map1()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void impactx::SoftSolenoid::map1 ( amrex::ParticleReal const  tau,
RefPart refpart,
[[maybe_unused] ] amrex::ParticleReal &  zeval 
) const
inline

This pushes the reference particle and the linear map matrix elements for a solenoid through the symplectic map associated with H_3 in the Hamiltonian splitting H = H_1 + H_2 + H_3.

Parameters
tauMap step size in m
[in,out]refpartreference particle
[in,out]zevalLongitudinal on-axis location in m

◆ map2()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void impactx::SoftSolenoid::map2 ( amrex::ParticleReal const  tau,
RefPart refpart,
amrex::ParticleReal &  zeval 
) const
inline

This pushes the reference particle and the linear map matrix elements for a solenoid through the symplectic map associated with H_2 in the Hamiltonian splitting H = H_1 + H_2 + H_3.

Parameters
tauMap step size in m
[in,out]refpartreference particle
[in,out]zevalLongitudinal on-axis location in m

◆ map3()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void impactx::SoftSolenoid::map3 ( amrex::ParticleReal const  tau,
RefPart refpart,
amrex::ParticleReal &  zeval 
) const
inline

This pushes the reference particle and the linear map matrix elements for a solenoid through the symplectic map associated with H_1 in the Hamiltonian splitting H = H_1 + H_2 + H_3.

Parameters
tauMap step size in m
[in,out]refpartreference particle
[in,out]zevalLongitudinal on-axis location in m

◆ operator()() [1/2]

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void impactx::SoftSolenoid::operator() ( PType &AMREX_RESTRICT  p,
amrex::ParticleReal &AMREX_RESTRICT  px,
amrex::ParticleReal &AMREX_RESTRICT  py,
amrex::ParticleReal &AMREX_RESTRICT  pt,
[[maybe_unused] ] RefPart const &  refpart 
) const
inline

This is a soft-edge solenoid functor, so that a variable of this type can be used like a soft-edge solenoid function.

Parameters
pParticle AoS data for positions and cpu/id
pxparticle momentum in x
pyparticle momentum in y
ptparticle momentum in t
refpartreference particle

◆ operator()() [2/2]

AMREX_GPU_HOST AMREX_FORCE_INLINE void impactx::SoftSolenoid::operator() ( RefPart &AMREX_RESTRICT  refpart) const
inline

This pushes the reference particle.

Parameters
[in,out]refpartreference particle

◆ Sol_Bfield()

std::tuple<amrex::ParticleReal, amrex::ParticleReal, amrex::ParticleReal> AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE impactx::SoftSolenoid::Sol_Bfield ( amrex::ParticleReal const  zeval) const
inline

This evaluates the on-axis magnetic field Bz at a fixed location z, together with certain required integrals and derivatives. The field returned is normalized to a peak value of 1.

Parameters
zevalLongitudinal on-axis location in m

Member Data Documentation

◆ m_bscale

amrex::ParticleReal impactx::SoftSolenoid::m_bscale
private

◆ m_cos_d_data

amrex::ParticleReal* impactx::SoftSolenoid::m_cos_d_data = nullptr
private

non-owning pointer to host sine coefficients

◆ m_cos_h_data

amrex::ParticleReal* impactx::SoftSolenoid::m_cos_h_data = nullptr
private

number of Fourier coefficients

◆ m_id

int impactx::SoftSolenoid::m_id
private

number of map integration steps per slice

◆ m_mapsteps

int impactx::SoftSolenoid::m_mapsteps
private

scaling factor for solenoid Bz field

◆ m_ncoef

int impactx::SoftSolenoid::m_ncoef = 0
private

unique soft solenoid id used for data lookup map

◆ m_sin_d_data

amrex::ParticleReal* impactx::SoftSolenoid::m_sin_d_data = nullptr
private

non-owning pointer to device cosine coefficients

◆ m_sin_h_data

amrex::ParticleReal* impactx::SoftSolenoid::m_sin_h_data = nullptr
private

non-owning pointer to host cosine coefficients

◆ name

constexpr auto impactx::SoftSolenoid::name = "SoftSolenoid"
staticconstexpr

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