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

#include <MultipoleTStraight.h>

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

Public Member Functions

 MultipoleTStraight (const std::string &name)
 
 MultipoleTStraight (const MultipoleTStraight &right)
 
 ~MultipoleTStraight ()
 
virtual ElementBaseclone () const override
 
void accept (BeamlineVisitor &visitor) const override
 
virtual void setMaxOrder (const std::size_t &maxOrder) override
 
StraightGeometrygetGeometry () override
 
const StraightGeometrygetGeometry () 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 finalise ()
 
bool bends () const
 
double getDipoleConstant () const
 
void setDipoleConstant (const double &B0)
 
std::size_t getMaxOrder () const
 
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 ()
 
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 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 goOnline (const double &kineticEnergy)
 
virtual void goOffline ()
 
virtual bool Online ()
 
virtual ElementBase::ElementType getType () const
 Get element type std::string. More...
 
virtual void setComponentType (std::string)
 
virtual std::string getComponentType () const
 
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...
 
std::string getTypeString () const
 
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 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< ElementBase::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 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

MultipoleTStraight operator= (const MultipoleTStraight &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 getBx (const Vector_t &R) override
 
virtual double getBs (const Vector_t &R) override
 
virtual double getFn (const std::size_t &n, const double &x, const double &s) override
 

Private Attributes

StraightGeometry straightGeometry_m
 

Additional Inherited Members

- Public Types inherited from ElementBase
enum  ApertureType { RECTANGULAR , ELLIPTICAL , CONIC_RECTANGULAR , CONIC_ELLIPTICAL }
 
enum  ElementType {
  BEAMLINE , CCOLLIMATOR , CORRECTOR , CYCLOTRON ,
  DEGRADER , DRIFT , FLEXIBLECOLLIMATOR , MARKER ,
  MONITOR , MPSPLITINTEGRATOR , MULTIPOLE , MULTIPOLET ,
  OFFSET , PROBE , RBEND , RBEND3D ,
  RFCAVITY , RING , SBEND3D , SBEND ,
  SEPTUM , SOLENOID , SOURCE , STRIPPER ,
  TRAVELINGWAVE , UNDULATOR , VACUUM , VARIABLERFCAVITY ,
  ANY
}
 
- 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


MultipoleTiStraight defines a straight combined function magnet (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 82 of file MultipoleTStraight.h.

Constructor & Destructor Documentation

◆ MultipoleTStraight() [1/2]

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

Constructor

Parameters
name-> User-defined name

Definition at line 36 of file MultipoleTStraight.cpp.

Referenced by clone().

◆ MultipoleTStraight() [2/2]

MultipoleTStraight::MultipoleTStraight ( const MultipoleTStraight right)

Copy constructor

Definition at line 41 of file MultipoleTStraight.cpp.

References Component::RefPartBunch_m.

◆ ~MultipoleTStraight()

MultipoleTStraight::~MultipoleTStraight ( )

Destructor

Definition at line 48 of file MultipoleTStraight.cpp.

Member Function Documentation

◆ accept()

void MultipoleTStraight::accept ( BeamlineVisitor visitor) const
inlineoverridevirtual

Accept a beamline visitor

Implements ElementBase.

Definition at line 153 of file MultipoleTStraight.h.

References BeamlineVisitor::visitMultipoleTStraight().

Here is the call graph for this function:

◆ clone()

ElementBase * MultipoleTStraight::clone ( ) const
overridevirtual

Inheritable copy constructor

Implements ElementBase.

Definition at line 51 of file MultipoleTStraight.cpp.

References MultipoleTStraight().

Referenced by ParallelCyclotronTracker::visitMultipoleTStraight().

Here is the call graph for this function:

◆ getBs()

double MultipoleTStraight::getBs ( const Vector_t R)
overrideprivatevirtual

Get s-component of the B-field
This function has been overloaded because calculating
the B-field directly is quicker and more accurate

Reimplemented from MultipoleTBase.

Definition at line 77 of file MultipoleTStraight.cpp.

References MultipoleTBase::getFringeDeriv(), MultipoleTBase::getMaxOrder(), MultipoleTBase::getTransDeriv(), Hypervolume::n, and Attrib::Distribution::R.

Here is the call graph for this function:

◆ getBx()

double MultipoleTStraight::getBx ( const Vector_t R)
overrideprivatevirtual

Get x-component of the B-field
This function has been overloaded because calculating
the B-field directly is quicker and more accurate

Reimplemented from MultipoleTBase.

Definition at line 63 of file MultipoleTStraight.cpp.

References MultipoleTBase::getFringeDeriv(), MultipoleTBase::getMaxOrder(), MultipoleTBase::getTransDeriv(), Hypervolume::n, and Attrib::Distribution::R.

Here is the call graph for this function:

◆ getFn()

double MultipoleTStraight::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 91 of file MultipoleTStraight.cpp.

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

Here is the call graph for this function:

◆ getGeometry() [1/2]

const StraightGeometry & MultipoleTStraight::getGeometry ( ) const
inlineoverridevirtual

Return the cell geometry

Implements ElementBase.

Definition at line 173 of file MultipoleTStraight.h.

References straightGeometry_m.

◆ getGeometry() [2/2]

StraightGeometry & MultipoleTStraight::getGeometry ( )
inlineoverridevirtual

Return the cell geometry

Implements ElementBase.

Definition at line 169 of file MultipoleTStraight.h.

References straightGeometry_m.

Referenced by OpalMultipoleTStraight::update().

◆ getRadius()

double MultipoleTStraight::getRadius ( const double &  s)
inlineoverrideprivatevirtual

Radius of curvature
Straight magnet, infinite radius, infinity (1.0e300) is returned

Parameters
s-> Coordinate s

Implements MultipoleTBase.

Definition at line 160 of file MultipoleTStraight.h.

◆ getScaleFactor()

double MultipoleTStraight::getScaleFactor ( const double &  x,
const double &  s 
)
inlineoverrideprivatevirtual

Returns the scale factor \( h_s = 1\)

Parameters
x-> Coordinate x
s-> Coordinate s

Implements MultipoleTBase.

Definition at line 164 of file MultipoleTStraight.h.

◆ initialise()

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

Initialise the MultipoleT

Parameters
bunch-> Bunch the global bunch object
startField-> Not used
endField-> Not used

Reimplemented from MultipoleTBase.

Definition at line 177 of file MultipoleTStraight.h.

References MultipoleTBase::getBoundingBoxLength(), Component::RefPartBunch_m, StraightGeometry::setElementLength(), and straightGeometry_m.

Here is the call graph for this function:

◆ operator=()

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

◆ setMaxOrder()

void MultipoleTStraight::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 59 of file MultipoleTStraight.cpp.

References MultipoleTBase::setMaxOrder().

Referenced by OpalMultipoleTStraight::update().

Here is the call graph for this function:

◆ transformBField()

void MultipoleTStraight::transformBField ( Vector_t B,
const Vector_t R 
)
inlineoverrideprivatevirtual

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

Implements MultipoleTBase.

Definition at line 157 of file MultipoleTStraight.h.

◆ transformCoords()

void MultipoleTStraight::transformCoords ( Vector_t R)
overrideprivatevirtual

Transform to Frenet-Serret coordinates for sector magnets

Implements MultipoleTBase.

Definition at line 55 of file MultipoleTStraight.cpp.

Member Data Documentation

◆ straightGeometry_m

StraightGeometry MultipoleTStraight::straightGeometry_m
private

Geometry

Definition at line 116 of file MultipoleTStraight.h.

Referenced by getGeometry(), and initialise().


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