OPAL (Object Oriented Parallel Accelerator Library) 2022.1
OPAL
Public Member Functions | Private Member Functions | Private Attributes | List of all members
MultipoleTCurvedVarRadius Class Reference

#include <MultipoleTCurvedVarRadius.h>

Inheritance diagram for MultipoleTCurvedVarRadius:
Inheritance graph
[legend]
Collaboration diagram for MultipoleTCurvedVarRadius:
Collaboration graph
[legend]

Public Member Functions

 MultipoleTCurvedVarRadius (const std::string &name)
 
 MultipoleTCurvedVarRadius (const MultipoleTCurvedVarRadius &right)
 
 ~MultipoleTCurvedVarRadius ()
 
virtual ElementBaseclone () const override
 
void accept (BeamlineVisitor &visitor) const override
 
VarRadiusGeometrygetGeometry () override
 
const VarRadiusGeometrygetGeometry () const override
 
virtual void setMaxOrder (const std::size_t &maxOrder) override
 
std::size_t getMaxXOrder () const
 
void setMaxXOrder (const std::size_t &maxXOrder)
 
virtual void setBendAngle (const double &angle) override
 
virtual double getBendAngle () const override
 
virtual void initialise (PartBunchBase< double, 3 > *bunch, double &startField, double &endField) override
 
- Public Member Functions inherited from MultipoleTBase
 MultipoleTBase ()
 
 MultipoleTBase (const std::string &name)
 
 MultipoleTBase (const MultipoleTBase &right)
 
 ~MultipoleTBase ()
 
EMFieldgetField ()
 
const EMFieldgetField () const
 
bool apply (const Vector_t &R, const Vector_t &P, const double &t, Vector_t &E, Vector_t &B)
 
bool apply (const size_t &i, const double &t, Vector_t &E, Vector_t &B)
 
void initialise (PartBunchBase< double, 3 > *, double &startField, double &endField)
 
void finalise ()
 
bool bends () const
 
double getDipoleConstant () const
 
void setDipoleConstant (const double &B0)
 
std::size_t getMaxOrder () const
 
virtual void setMaxOrder (const std::size_t &maxOrder)
 
std::size_t getTransMaxOrder () const
 
void setTransMaxOrder (const std::size_t &transMaxOrder)
 
void setTransProfile (const std::size_t &n, const double &Bn)
 
double getTransProfile (const std::size_t &n) const
 
std::vector< double > getTransProfile () const
 
bool setFringeField (const double &s0, const double &lambda_left, const double &lambda_right)
 
std::vector< double > getFringeLength () const
 
void setEntranceAngle (const double &entranceAngle)
 
virtual void setBendAngle (const double &angle)
 
virtual double getBendAngle () const
 
double getEntranceAngle () const
 
void setLength (const double &length)
 
double getLength () const
 
void setAperture (const double &vertAp, const double &horizAp)
 
std::vector< double > getAperture () const
 
void setRotation (const double &rot)
 
double getRotation () const
 
double getBoundingBoxLength () const
 
void setBoundingBoxLength (const double &boundingBoxLength)
 
virtual void getDimensions (double &zBegin, double &zEnd) const
 
- Public Member Functions inherited from Component
 Component (const std::string &name)
 Constructor with given name. More...
 
 Component ()
 
 Component (const Component &right)
 
virtual ~Component ()
 
virtual EMFieldgetField ()=0
 Return field. More...
 
virtual const EMFieldgetField () const =0
 Return field. More...
 
EVector Efield (const Point3D &P) const
 Return the field in a point. More...
 
BVector Bfield (const Point3D &P) const
 Return the field in a point. More...
 
EVector Efield (const Point3D &P, double t) const
 Return the field in a point. More...
 
BVector Bfield (const Point3D &P, double t) const
 Return the field in a point. More...
 
EBVectors EBfield (const Point3D &P) const
 Return the field in a point. More...
 
EBVectors EBfield (const Point3D &P, double t) const
 Return the field in a point. More...
 
virtual bool apply (const size_t &i, const double &t, Vector_t &E, Vector_t &B)
 
virtual bool apply (const Vector_t &R, const Vector_t &P, const double &t, Vector_t &E, Vector_t &B)
 
virtual bool applyToReferenceParticle (const Vector_t &R, const Vector_t &P, const double &t, Vector_t &E, Vector_t &B)
 
virtual bool getPotential (const Vector_t &, const double &, Vector_t &, double &)
 
virtual double getDesignEnergy () const
 
virtual void setDesignEnergy (const double &energy, bool changeable=true)
 
virtual void initialise (PartBunchBase< double, 3 > *bunch, double &startField, double &endField)=0
 
virtual void finalise ()=0
 
virtual bool bends () const =0
 
virtual void goOnline (const double &kineticEnergy)
 
virtual void goOffline ()
 
virtual bool Online ()
 
virtual void getDimensions (double &zBegin, double &zEnd) const =0
 
virtual ElementType getType () const
 Get element type std::string. More...
 
virtual const ElementBasegetDesign () const
 Return design element. More...
 
virtual void trackBunch (PartBunchBase< double, 3 > *bunch, const PartData &, bool revBeam, bool revTrack) const
 Track particle bunch. More...
 
virtual void trackMap (FVps< double, 6 > &map, const PartData &, bool revBeam, bool revTrack) const
 Track a map. More...
 
void setExitFaceSlope (const double &)
 
- Public Member Functions inherited from ElementBase
 ElementBase (const std::string &name)
 Constructor with given name. More...
 
 ElementBase ()
 
 ElementBase (const ElementBase &)
 
virtual ~ElementBase ()
 
virtual const std::string & getName () const
 Get element name. More...
 
virtual void setName (const std::string &name)
 Set element name. More...
 
virtual ElementType getType () const =0
 Get element type std::string. More...
 
std::string getTypeString () const
 
virtual BGeometryBasegetGeometry ()=0
 Get geometry. More...
 
virtual const BGeometryBasegetGeometry () const =0
 Get geometry. More...
 
virtual double getArcLength () const
 Get arc length. More...
 
virtual double getElementLength () const
 Get design length. More...
 
virtual void setElementLength (double length)
 Set design length. More...
 
virtual void getElementDimensions (double &begin, double &end) const
 
virtual double getOrigin () const
 Get origin position. More...
 
virtual double getEntrance () const
 Get entrance position. More...
 
virtual double getExit () const
 Get exit position. More...
 
virtual Euclid3D getTransform (double fromS, double toS) const
 Get transform. More...
 
virtual Euclid3D getTransform (double s) const
 Get transform. More...
 
virtual Euclid3D getTotalTransform () const
 Get transform. More...
 
virtual Euclid3D getEntranceFrame () const
 Get transform. More...
 
virtual Euclid3D getExitFrame () const
 Get transform. More...
 
virtual Euclid3D getEntrancePatch () const
 Get patch. More...
 
virtual Euclid3D getExitPatch () const
 Get patch. More...
 
virtual double getAttribute (const std::string &aKey) const
 Get attribute value. More...
 
virtual bool hasAttribute (const std::string &aKey) const
 Test for existence of an attribute. More...
 
virtual void removeAttribute (const std::string &aKey)
 Remove an existing attribute. More...
 
virtual void setAttribute (const std::string &aKey, double val)
 Set value of an attribute. More...
 
virtual ChannelgetChannel (const std::string &aKey, bool create=false)
 Construct a read/write channel. More...
 
virtual const ConstChannelgetConstChannel (const std::string &aKey) const
 Construct a read-only channel. More...
 
virtual void accept (BeamlineVisitor &visitor) const =0
 Apply visitor. More...
 
virtual ElementBaseclone () const =0
 Return clone. More...
 
virtual ElementBasecopyStructure ()
 Make a structural copy. More...
 
bool isSharable () const
 Test if the element can be shared. More...
 
virtual void makeSharable ()
 Set sharable flag. More...
 
bool update (const AttributeSet &)
 Update element. More...
 
virtual void setBoundaryGeometry (BoundaryGeometry *geo)
 
virtual BoundaryGeometrygetBoundaryGeometry () const
 return the attached boundary geometrt object if there is any More...
 
virtual bool hasBoundaryGeometry () const
 
virtual void setWake (WakeFunction *wf)
 attach a wake field to the element More...
 
virtual WakeFunctiongetWake () const
 return the attached wake object if there is any More...
 
virtual bool hasWake () const
 
virtual void setParticleMatterInteraction (ParticleMatterInteractionHandler *spys)
 
virtual ParticleMatterInteractionHandlergetParticleMatterInteraction () const
 
virtual bool hasParticleMatterInteraction () const
 
void setCSTrafoGlobal2Local (const CoordinateSystemTrafo &ori)
 
CoordinateSystemTrafo getCSTrafoGlobal2Local () const
 
void releasePosition ()
 
void fixPosition ()
 
bool isPositioned () const
 
virtual CoordinateSystemTrafo getEdgeToBegin () const
 
virtual CoordinateSystemTrafo getEdgeToEnd () const
 
void setAperture (const ApertureType &type, const std::vector< double > &args)
 
std::pair< ApertureType, std::vector< double > > getAperture () const
 
virtual bool isInside (const Vector_t &r) const
 
void setMisalignment (const CoordinateSystemTrafo &cst)
 
void getMisalignment (double &x, double &y, double &s) const
 
CoordinateSystemTrafo getMisalignment () const
 
void setActionRange (const std::queue< std::pair< double, double > > &range)
 
void setCurrentSCoordinate (double s)
 
void setRotationAboutZ (double rotation)
 Set rotation about z axis in bend frame. More...
 
double getRotationAboutZ () const
 
virtual BoundingBox getBoundingBoxInLabCoords () const
 
virtual int getRequiredNumberOfTimeSteps () const
 
void setOutputFN (std::string fn)
 Set output filename. More...
 
std::string getOutputFN () const
 Get output filename. More...
 
void setFlagDeleteOnTransverseExit (bool=true)
 
bool getFlagDeleteOnTransverseExit () const
 
void setElementPosition (double elemedge)
 Access to ELEMEDGE attribute. More...
 
double getElementPosition () const
 
bool isElementPositionSet () const
 
- Public Member Functions inherited from RCObject
int addReference () const
 Increment reference count. More...
 
int removeReference () const
 Decrement the reference count. More...
 
bool isShared () const
 Test for sharing. More...
 

Private Member Functions

MultipoleTCurvedVarRadius operator= (const MultipoleTCurvedVarRadius &rhs)
 
virtual void transformCoords (Vector_t &R) override
 
virtual void transformBField (Vector_t &B, const Vector_t &R) override
 
virtual double getRadius (const double &s) override
 
virtual double getScaleFactor (const double &x, const double &s) override
 
virtual double getFn (const std::size_t &n, const double &x, const double &s) override
 

Private Attributes

std::size_t maxOrderX_m
 
std::vector< polynomial::RecursionRelationTworecursion_m
 
VarRadiusGeometry varRadiusGeometry_m
 
double angle_m
 

Additional Inherited Members

- Static Public Member Functions inherited from ElementBase
static std::string getTypeString (ElementType type)
 
- Protected Member Functions inherited from MultipoleTBase
double getFringeDeriv (const std::size_t &n, const double &s)
 
double getTransDeriv (const std::size_t &n, const double &x)
 
- Protected Member Functions inherited from ElementBase
bool isInsideTransverse (const Vector_t &r) const
 
- Protected Member Functions inherited from RCObject
 RCObject ()
 Default constructor. More...
 
 RCObject (const RCObject &)
 Copy constructor. More...
 
virtual ~RCObject ()=0
 
RCObjectoperator= (const RCObject &right)
 
- Protected Attributes inherited from Component
double exit_face_slope_m
 
PartBunchBase< double, 3 > * RefPartBunch_m
 
bool online_m
 
- Protected Attributes inherited from ElementBase
bool shareFlag
 
CoordinateSystemTrafo csTrafoGlobal2Local_m
 
CoordinateSystemTrafo misalignment_m
 
std::pair< ApertureType, std::vector< double > > aperture_m
 
double elementEdge_m
 
double rotationZAxis_m
 
- Static Protected Attributes inherited from Component
static const std::vector< double > defaultAperture_m
 

Detailed Description


MultipoleTCurvedVarRadius defines a curved combined function magnet with
variable radius of curvature (up to arbitrary multipole component)
with fringe fields


Class category: AbsBeamline
$Author: Titus Dascalu, Martin Duy Tat, Chris Rogers


The field is obtained from the scalar potential

\[ V = f_0(x,s) z + f_1 (x,s) \frac{z^3}{3!} + f_2 (x,s) \frac{z^5}{5!} + ... \]


(x,z,s) -> Frenet-Serret local coordinates along the magnet
z -> vertical component
assume mid-plane symmetry
set field on mid-plane -> \( B_z = f_0(x,s) = T(x) \cdot S(s) \)
T(x) -> transverse profile; this is a polynomial describing the field expansion on the mid-plane inside the magnet (not in the fringe field); 1st term is the dipole strength, 2nd term is the quadrupole gradient * x, etc.
-> when setting the magnet, one gives the multipole coefficients of this polynomial (i.e. dipole strength,
quadrupole gradient, etc.)

----------— example --------------------------------------------—
Setting a combined function magnet with dipole, quadrupole and sextupole components:
\( T(x) = B_0 + B_1 \cdot x + B_2 \cdot x^2 \)
user gives \( B_0, B_1, B_2 \)
----------— example end ----------------------------------------—

S(s) -> fringe field
recursion -> \( f_n (x,s) = (-1)^n \cdot \sum_{i=0}^{n} C_n^i \cdot T^{(2i)} \cdot S^{(2n-2i)} \)
for curved magnets the above recursion is more complicated
\( C_n^i \) -> binomial coeff; \( T^{(n)} \) -> n-th derivative


Definition at line 85 of file MultipoleTCurvedVarRadius.h.

Constructor & Destructor Documentation

◆ MultipoleTCurvedVarRadius() [1/2]

MultipoleTCurvedVarRadius::MultipoleTCurvedVarRadius ( const std::string &  name)
explicit

Constructor

Parameters
name-> User-defined name

Definition at line 37 of file MultipoleTCurvedVarRadius.cpp.

Referenced by clone().

◆ MultipoleTCurvedVarRadius() [2/2]

MultipoleTCurvedVarRadius::MultipoleTCurvedVarRadius ( const MultipoleTCurvedVarRadius right)

Copy constructor

Definition at line 44 of file MultipoleTCurvedVarRadius.cpp.

References Component::RefPartBunch_m.

◆ ~MultipoleTCurvedVarRadius()

MultipoleTCurvedVarRadius::~MultipoleTCurvedVarRadius ( )

Destructor

Definition at line 54 of file MultipoleTCurvedVarRadius.cpp.

Member Function Documentation

◆ accept()

void MultipoleTCurvedVarRadius::accept ( BeamlineVisitor visitor) const
inlineoverridevirtual

Accept a beamline visitor

Implements ElementBase.

Definition at line 163 of file MultipoleTCurvedVarRadius.h.

References BeamlineVisitor::visitMultipoleTCurvedVarRadius().

Here is the call graph for this function:

◆ clone()

ElementBase * MultipoleTCurvedVarRadius::clone ( ) const
overridevirtual

Inheritable copy constructor

Implements ElementBase.

Definition at line 57 of file MultipoleTCurvedVarRadius.cpp.

References MultipoleTCurvedVarRadius().

Referenced by ParallelCyclotronTracker::visitMultipoleTCurvedVarRadius().

Here is the call graph for this function:

◆ getBendAngle()

double MultipoleTCurvedVarRadius::getBendAngle ( ) const
inlineoverridevirtual

Get the bending angle of the magnet

Reimplemented from MultipoleTBase.

Definition at line 188 of file MultipoleTCurvedVarRadius.h.

References angle_m.

◆ getFn()

double MultipoleTCurvedVarRadius::getFn ( const std::size_t &  n,
const double &  x,
const double &  s 
)
overrideprivatevirtual

Calculate fn(x, s) by expanding the differential operator (from Laplacian and scalar potential) in terms of polynomials

Parameters
n-> nth derivative
x-> Coordinate x
s-> Coordinate s

Implements MultipoleTBase.

Definition at line 117 of file MultipoleTCurvedVarRadius.cpp.

References angle_m, MultipoleTBase::getFringeDeriv(), MultipoleTBase::getLength(), MultipoleTBase::getTransDeriv(), Hypervolume::n, and recursion_m.

Here is the call graph for this function:

◆ getGeometry() [1/2]

const VarRadiusGeometry & MultipoleTCurvedVarRadius::getGeometry ( ) const
inlineoverridevirtual

Return the cell geometry

Implements ElementBase.

Definition at line 180 of file MultipoleTCurvedVarRadius.h.

References varRadiusGeometry_m.

◆ getGeometry() [2/2]

VarRadiusGeometry & MultipoleTCurvedVarRadius::getGeometry ( )
inlineoverridevirtual

Return the cell geometry

Implements ElementBase.

Definition at line 176 of file MultipoleTCurvedVarRadius.h.

References varRadiusGeometry_m.

Referenced by OpalMultipoleTCurvedVarRadius::update().

◆ getMaxXOrder()

std::size_t MultipoleTCurvedVarRadius::getMaxXOrder ( ) const
inline

Get highest power of x in polynomial expansions

Definition at line 172 of file MultipoleTCurvedVarRadius.h.

References maxOrderX_m.

◆ getRadius()

double MultipoleTCurvedVarRadius::getRadius ( const double &  s)
overrideprivatevirtual

Radius of curvature
If radius of curvature is infinite, -1 is returned
\( \rho(s) = rho(0) * S(0) / S(s) \) where S(s) is the fringe field

Parameters
s-> Coordinate s

Implements MultipoleTBase.

Definition at line 103 of file MultipoleTCurvedVarRadius.cpp.

References angle_m, MultipoleTBase::getFringeDeriv(), and MultipoleTBase::getLength().

Referenced by getScaleFactor().

Here is the call graph for this function:

◆ getScaleFactor()

double MultipoleTCurvedVarRadius::getScaleFactor ( const double &  x,
const double &  s 
)
overrideprivatevirtual

Returns the scale factor \( h_s = 1 + x / \rho(s) \)

Parameters
x-> Coordinate x
s-> Coordinate s

Implements MultipoleTBase.

Definition at line 112 of file MultipoleTCurvedVarRadius.cpp.

References getRadius().

Here is the call graph for this function:

◆ initialise()

void MultipoleTCurvedVarRadius::initialise ( PartBunchBase< double, 3 > *  bunch,
double &  startField,
double &  endField 
)
inlineoverridevirtual

◆ operator=()

MultipoleTCurvedVarRadius MultipoleTCurvedVarRadius::operator= ( const MultipoleTCurvedVarRadius rhs)
private

◆ setBendAngle()

void MultipoleTCurvedVarRadius::setBendAngle ( const double &  angle)
inlineoverridevirtual

Set the bending angle of the magnet

Reimplemented from MultipoleTBase.

Definition at line 184 of file MultipoleTCurvedVarRadius.h.

References angle_m.

Referenced by OpalMultipoleTCurvedVarRadius::update().

◆ setMaxOrder()

void MultipoleTCurvedVarRadius::setMaxOrder ( const std::size_t &  maxOrder)
overridevirtual

Set the number of terms used in calculation of field components
Maximum power of z in Bz is 2 * maxOrder_m

Parameters
maxOrder-> Number of terms in expansion in z

Reimplemented from MultipoleTBase.

Definition at line 91 of file MultipoleTCurvedVarRadius.cpp.

References MultipoleTBase::getTransMaxOrder(), maxOrderX_m, recursion_m, polynomial::RecursionRelationTwo::resizeX(), MultipoleTBase::setMaxOrder(), and polynomial::RecursionRelationTwo::truncate().

Referenced by OpalMultipoleTCurvedVarRadius::update().

Here is the call graph for this function:

◆ setMaxXOrder()

void MultipoleTCurvedVarRadius::setMaxXOrder ( const std::size_t &  maxXOrder)
inline

Set the number of terms used in polynomial expansions

Parameters
maxXOrder-> Number of terms in expansion in z

Definition at line 167 of file MultipoleTCurvedVarRadius.h.

References maxOrderX_m.

Referenced by OpalMultipoleTCurvedVarRadius::update().

◆ transformBField()

void MultipoleTCurvedVarRadius::transformBField ( Vector_t B,
const Vector_t R 
)
overrideprivatevirtual

Transform B-field from Frenet-Serret coordinates to lab coordinates

Implements MultipoleTBase.

Definition at line 74 of file MultipoleTCurvedVarRadius.cpp.

References angle_m, cos(), cosh(), MultipoleTBase::getFringeLength(), MultipoleTBase::getLength(), log(), Attrib::Distribution::R, sin(), and tanh().

Here is the call graph for this function:

◆ transformCoords()

void MultipoleTCurvedVarRadius::transformCoords ( Vector_t R)
overrideprivatevirtual

Transform to Frenet-Serret coordinates for sector magnets

Implements MultipoleTBase.

Definition at line 61 of file MultipoleTCurvedVarRadius.cpp.

References angle_m, MultipoleTBase::getFringeLength(), MultipoleTBase::getLength(), coordinatetransform::CoordinateTransform::getTransformation(), and Attrib::Distribution::R.

Here is the call graph for this function:

Member Data Documentation

◆ angle_m

double MultipoleTCurvedVarRadius::angle_m
private

◆ maxOrderX_m

std::size_t MultipoleTCurvedVarRadius::maxOrderX_m
private

Highest order of polynomial expansions in x

Definition at line 129 of file MultipoleTCurvedVarRadius.h.

Referenced by getMaxXOrder(), setMaxOrder(), and setMaxXOrder().

◆ recursion_m

std::vector<polynomial::RecursionRelationTwo> MultipoleTCurvedVarRadius::recursion_m
private

Objects for storing differential operator acting on Fn

Definition at line 131 of file MultipoleTCurvedVarRadius.h.

Referenced by getFn(), and setMaxOrder().

◆ varRadiusGeometry_m

VarRadiusGeometry MultipoleTCurvedVarRadius::varRadiusGeometry_m
private

Geometry

Definition at line 133 of file MultipoleTCurvedVarRadius.h.

Referenced by getGeometry(), and initialise().


The documentation for this class was generated from the following files: