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

#include <MultipoleT.h>

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

Public Member Functions

 MultipoleT (const std::string &name)
 
 MultipoleT (const MultipoleT &right)
 
 ~MultipoleT ()
 
ElementBaseclone () const override
 
EMFieldgetField () override
 
const EMFieldgetField () const override
 
void getDimensions (double &zBegin, double &zEnd) const override
 
bool apply (const Vector_t &R, const Vector_t &P, const double &t, Vector_t &E, Vector_t &B) override
 
bool apply (const size_t &i, const double &t, Vector_t &E, Vector_t &B) override
 
void initialise (PartBunchBase< double, 3 > *, double &startField, double &endField) override
 
void initialise ()
 
void finalise () override
 
bool bends () const override
 
PlanarArcGeometrygetGeometry () override
 
const PlanarArcGeometrygetGeometry () const override
 
void accept (BeamlineVisitor &visitor) const override
 
double getDipoleConstant () const
 
void setDipoleConstant (double B0)
 
std::size_t getMaxOrder () const
 
void setMaxOrder (std::size_t maxOrder)
 
std::size_t getMaxXOrder () const
 
void setMaxXOrder (std::size_t maxXOrder)
 
std::size_t getTransMaxOrder () const
 
void setTransMaxOrder (std::size_t transMaxOrder)
 
void setTransProfile (std::size_t n, double Bn)
 
double getTransProfile (int n) const
 
std::vector< double > getTransProfile () const
 
bool setFringeField (double s0, double lambda_left, double lambda_right)
 
std::vector< double > getFringeLength () const
 
void setBendAngle (double angle)
 
double getBendAngle () const
 
void setEntranceAngle (double entranceAngle)
 
double getEntranceAngle () const
 
double getBendRadius () const
 
void setLength (double length)
 
double getLength () const
 
double getChordLength () const
 
void setAperture (double vertAp, double horizAp)
 
std::vector< double > getAperture () const
 
void setRotation (double rot)
 
double getRotation () const
 
void setVarRadius ()
 
bool getVarRadius () const
 
double getBoundingBoxLength () const
 
void setBoundingBoxLength (const double &boundingBoxLength)
 
- 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 void addKR (int i, double t, Vector_t &K)
 
virtual void addKT (int i, double t, Vector_t &K)
 
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 &R, const double &t, Vector_t &A, double &phi)
 
virtual double getDesignEnergy () const
 
virtual void setDesignEnergy (const double &energy, bool changeable)
 
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 ElementImagegetImage () const
 Construct an image. 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...
 
virtual ElementBasemakeAlignWrapper ()
 Allow misalignment. More...
 
virtual ElementBasemakeFieldWrapper ()
 Allow field errors. More...
 
virtual ElementBasemakeWrappers ()
 Allow errors. More...
 
virtual ElementBaseremoveAlignWrapper ()
 Remove align wrapper. More...
 
virtual const ElementBaseremoveAlignWrapper () const
 Remove align wrapper. More...
 
virtual ElementBaseremoveFieldWrapper ()
 Remove field wrapper. More...
 
virtual const ElementBaseremoveFieldWrapper () const
 Remove field wrapper. More...
 
virtual ElementBaseremoveWrappers ()
 Return the design element. More...
 
virtual const ElementBaseremoveWrappers () const
 Return the design element. 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
ParticleMatterInteractionHandler
getParticleMatterInteraction () const
 
virtual bool hasParticleMatterInteraction () const
 
ElemType getElType () const
 returns element type as enumeration needed in the envelope tracker More...
 
void setElType (ElemType elt)
 set the element type as enumeration needed in the envelope tracker More...
 
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 (double x, double y, double s)
 
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
 
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

MultipoleT operator= (const MultipoleT &rhs)
 
Vector_t rotateFrame (const Vector_t &R)
 
Vector_t rotateFrameInverse (Vector_t &B)
 
Vector_t transformCoords (const Vector_t &R)
 
double getBx (const Vector_t &R)
 
double getBz (const Vector_t &R)
 
double getBs (const Vector_t &R)
 
double getFringeDeriv (int n, double s)
 
double getTransDeriv (std::size_t n, double x)
 
bool insideAperture (const Vector_t &R)
 
double getRadius (double s)
 
double getScaleFactor (double x, double s)
 
double getFnDerivX (std::size_t n, double x, double s)
 
double getFnDerivS (std::size_t n, double x, double s)
 
double getFn (std::size_t n, double x, double s)
 

Private Attributes

endfieldmodel::Tanh fringeField_l
 
endfieldmodel::Tanh fringeField_r
 
std::size_t maxOrder_m = 0
 
std::size_t maxOrderX_m = 0
 
std::vector
< polynomial::RecursionRelationTwo
recursion_VarRadius_m
 
std::vector
< polynomial::RecursionRelation
recursion_ConstRadius_m
 
std::size_t transMaxOrder_m = 0
 
std::vector< double > transProfile_m
 
PlanarArcGeometry planarArcGeometry_m
 
double length_m
 
double angle_m
 
double entranceAngle_m
 
double rotation_m
 
bool variableRadius_m
 
double boundingBoxLength_m
 
double verticalApert_m
 
double horizApert_m
 
BMultipoleField dummy
 

Additional Inherited Members

- Public Types inherited from ElementBase
enum  ApertureType { RECTANGULAR, ELLIPTICAL, CONIC_RECTANGULAR, CONIC_ELLIPTICAL }
 
enum  ElementType {
  ALIGNWRAPPER, BEAMBEAM, BEAMBEAM3D, BEAMLINE,
  BEAMSTRIPPING, CCOLLIMATOR, CORRECTOR, CORRECTORWRAPPER,
  CYCLOTRON, CYCLOTRONWRAPPER, CYCLOTRONVALLEY, DEGRADER,
  DIAGNOSTIC, DRIFT, FLEXIBLECOLLIMATOR, INTEGRATOR,
  LAMBERTSON, MARKER, MONITOR, MPSPLITINTEGRATOR,
  MULTIPOLE, MULTIPOLET, MULTIPOLEWRAPPER, OFFSET,
  PARALLELPLATE, PATCH, PROBE, RBEND,
  RBEND3D, RBENDWRAPPER, RFCAVITY, RFQUADRUPOLE,
  RING, SBEND3D, SBEND, SBENDWRAPPER,
  SEPARATOR, SEPTUM, SOLENOID, SOURCE,
  STRIPPER, TRAVELINGWAVE, VARIABLERFCAVITY, ANY
}
 
- Static Public Member Functions inherited from ElementBase
static std::string getTypeString (ElementType type)
 
- Protected Member Functions inherited from ElementBase
bool isInsideTransverse (const Vector_t &r, double f=1) 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


MultipoleT defines a straight or curved 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 89 of file MultipoleT.h.

Constructor & Destructor Documentation

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

Constructor

Parameters
name-> User-defined name

Definition at line 40 of file MultipoleT.cpp.

Referenced by clone().

MultipoleT::MultipoleT ( const MultipoleT right)

Copy constructor

Definition at line 58 of file MultipoleT.cpp.

References Component::RefPartBunch_m.

MultipoleT::~MultipoleT ( )

Destructor

Definition at line 81 of file MultipoleT.cpp.

Member Function Documentation

void MultipoleT::accept ( BeamlineVisitor visitor) const
overridevirtual

Accept a beamline visitor

Implements ElementBase.

Definition at line 403 of file MultipoleT.cpp.

References BeamlineVisitor::visitMultipoleT().

Here is the call graph for this function:

bool MultipoleT::apply ( const Vector_t R,
const Vector_t P,
const double &  t,
Vector_t E,
Vector_t B 
)
overridevirtual

Calculate the field at some arbitrary position If particle is outside field map true is returned, otherwise false is returned

Parameters
R-> Position in the lab coordinate system of the multipole
P-> Not used
t-> Time at which the field is to be calculated
E-> Calculated electric field - always 0 (no E-field)
B-> Calculated magnetic field

Rotate coordinates around the central axis of the magnet

If magnet is not straight go to local Frenet-Serret coordinates

Transform B-field from local to lab coordinates

Reimplemented from Component.

Definition at line 94 of file MultipoleT.cpp.

References angle_m, cos(), cosh(), fringeField_l, fringeField_r, getBs(), getBx(), getBz(), endfieldmodel::Tanh::getLambda(), endfieldmodel::Tanh::getX0(), insideAperture(), length_m, log(), rotateFrame(), sin(), tanh(), transformCoords(), variableRadius_m, and X.

Referenced by apply().

Here is the call graph for this function:

bool MultipoleT::apply ( const size_t &  i,
const double &  t,
Vector_t E,
Vector_t B 
)
overridevirtual

Calculate the field at the position of the ith particle

Parameters
i-> Index of the particle event override; field is calculated at this position If particle is outside field map true is returned, otherwise false is returned
t-> Time at which the field is to be calculated
E-> Calculated electric field - always 0 (no E-field)
B-> Calculated magnetic field

Reimplemented from Component.

Definition at line 135 of file MultipoleT.cpp.

References apply(), PartBunchBase< T, Dim >::P, PartBunchBase< T, Dim >::R, and Component::RefPartBunch_m.

Here is the call graph for this function:

bool MultipoleT::bends ( ) const
overridevirtual

Return true if dipole component not zero

Implements Component.

Definition at line 544 of file MultipoleT.cpp.

References transProfile_m.

ElementBase * MultipoleT::clone ( ) const
overridevirtual

Inheritable copy constructor

Implements ElementBase.

Definition at line 84 of file MultipoleT.cpp.

References initialise(), and MultipoleT().

Referenced by ParallelCyclotronTracker::visitMultipoleT().

Here is the call graph for this function:

void MultipoleT::finalise ( )
overridevirtual

Finalise the MultipoleT - sets bunch to NULL

Implements Component.

Definition at line 90 of file MultipoleT.cpp.

References Component::RefPartBunch_m.

std::vector< double > MultipoleT::getAperture ( ) const

Get the aperture dimensions Returns a vector of 2 doubles

Definition at line 415 of file MultipoleT.cpp.

References horizApert_m, and verticalApert_m.

Referenced by OpalMultipoleT::fillRegisteredAttributes().

double MultipoleT::getBendAngle ( ) const
inline

Get the bending angle of the magnet

Definition at line 418 of file MultipoleT.h.

References angle_m.

double MultipoleT::getBendRadius ( ) const

Get the bending radius
Not used, when needed radius is found from length_m / angle_m

double MultipoleT::getBoundingBoxLength ( ) const
inline

Get distance between centre of magnet and entrance

Definition at line 430 of file MultipoleT.h.

References boundingBoxLength_m.

Referenced by OpalMultipoleT::fillRegisteredAttributes().

double MultipoleT::getBs ( const Vector_t R)
private

Returns the component of the field along the central axis 1/h_s * sum_n z^(2n+1) / (2n+1)! f_n

Definition at line 319 of file MultipoleT.cpp.

References angle_m, Physics::e, getFnDerivS(), getFringeDeriv(), getScaleFactor(), getTransDeriv(), maxOrder_m, Hypervolume::n, and variableRadius_m.

Referenced by apply().

Here is the call graph for this function:

double MultipoleT::getBx ( const Vector_t R)
private

Get field component methods

Returns the radial component of the field sum_n z^(2n+1) / (2n+1)! * f_n

Definition at line 286 of file MultipoleT.cpp.

References angle_m, Physics::e, getFnDerivX(), getFringeDeriv(), getTransDeriv(), maxOrder_m, Hypervolume::n, and variableRadius_m.

Referenced by apply().

Here is the call graph for this function:

double MultipoleT::getBz ( const Vector_t R)
private

Returns the vertical field component sum_n f_n * z^(2n) / (2n)!

Definition at line 255 of file MultipoleT.cpp.

References angle_m, Physics::e, getFn(), getFringeDeriv(), getTransDeriv(), maxOrder_m, Hypervolume::n, and variableRadius_m.

Referenced by apply().

Here is the call graph for this function:

double MultipoleT::getChordLength ( ) const

Not used

void MultipoleT::getDimensions ( double &  zBegin,
double &  zEnd 
) const
overridevirtual

Not implemented

Implements Component.

Definition at line 407 of file MultipoleT.cpp.

double MultipoleT::getDipoleConstant ( ) const
inline

Get the dipole constant B_0

Definition at line 379 of file MultipoleT.h.

References transProfile_m.

double MultipoleT::getEntranceAngle ( ) const
inline

Get the entrance angle

Definition at line 367 of file MultipoleT.h.

References entranceAngle_m.

Referenced by OpalMultipoleT::fillRegisteredAttributes().

EMField & MultipoleT::getField ( )
overridevirtual

Return a dummy field value

Implements Component.

Definition at line 556 of file MultipoleT.cpp.

References dummy.

const EMField & MultipoleT::getField ( ) const
overridevirtual

Return a dummy field value

Implements Component.

Definition at line 560 of file MultipoleT.cpp.

References dummy.

double MultipoleT::getFn ( std::size_t  n,
double  x,
double  s 
)
private

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

Definition at line 477 of file MultipoleT.cpp.

References angle_m, getFringeDeriv(), getTransDeriv(), length_m, recursion_ConstRadius_m, recursion_VarRadius_m, and variableRadius_m.

Referenced by getBz(), getFnDerivS(), and getFnDerivX().

Here is the call graph for this function:

double MultipoleT::getFnDerivS ( std::size_t  n,
double  x,
double  s 
)
private

Calculate partial derivative of fn wrt s using a 5-point finite difference formuln Error of order stepSize^4

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

Definition at line 463 of file MultipoleT.cpp.

References Physics::e, getFn(), getFringeDeriv(), and getTransDeriv().

Referenced by getBs().

Here is the call graph for this function:

double MultipoleT::getFnDerivX ( std::size_t  n,
double  x,
double  s 
)
private

Calculate partial derivative of fn wrt x using a 5-point finite difference formula
Error of order stepSize^4

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

Definition at line 449 of file MultipoleT.cpp.

References Physics::e, getFn(), getFringeDeriv(), and getTransDeriv().

Referenced by getBx().

Here is the call graph for this function:

double MultipoleT::getFringeDeriv ( int  n,
double  s 
)
private

Returns the value of the fringe field n-th derivative at s

Parameters
n-> nth derivative
s-> Coordinate s

Definition at line 353 of file MultipoleT.cpp.

References fringeField_l, fringeField_r, endfieldmodel::Tanh::getNegTanh(), endfieldmodel::Tanh::getTanh(), tanhderiv::integrate(), and Hypervolume::n.

Referenced by getBs(), getBx(), getBz(), getFn(), getFnDerivS(), getFnDerivX(), and getRadius().

Here is the call graph for this function:

std::vector< double > MultipoleT::getFringeLength ( ) const

Return vector of 2 doubles [left fringe length, right fringelength]

Definition at line 422 of file MultipoleT.cpp.

References fringeField_l, fringeField_r, and endfieldmodel::Tanh::getLambda().

Referenced by OpalMultipoleT::fillRegisteredAttributes().

Here is the call graph for this function:

PlanarArcGeometry & MultipoleT::getGeometry ( )
overridevirtual

Return the cell geometry

Implements ElementBase.

Definition at line 548 of file MultipoleT.cpp.

References planarArcGeometry_m.

const PlanarArcGeometry & MultipoleT::getGeometry ( ) const
overridevirtual

Return the cell geometry

Implements ElementBase.

Definition at line 552 of file MultipoleT.cpp.

References planarArcGeometry_m.

double MultipoleT::getLength ( ) const
inline

Get the length of the magnet

Definition at line 426 of file MultipoleT.h.

References length_m.

std::size_t MultipoleT::getMaxOrder ( ) const
inline

Get the number of terms used in calculation of field components

Definition at line 383 of file MultipoleT.h.

References maxOrder_m.

Referenced by OpalMultipoleT::fillRegisteredAttributes().

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

Get highest power of x in polynomial expansions

Definition at line 388 of file MultipoleT.h.

References maxOrderX_m.

Referenced by OpalMultipoleT::fillRegisteredAttributes().

double MultipoleT::getRadius ( double  s)
private

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

Parameters
s-> Coordinate s

Definition at line 429 of file MultipoleT.cpp.

References angle_m, getFringeDeriv(), length_m, and variableRadius_m.

Referenced by getScaleFactor().

Here is the call graph for this function:

double MultipoleT::getRotation ( ) const
inline

Get the angle of rotation of the magnet around its axis

Definition at line 406 of file MultipoleT.h.

References rotation_m.

Referenced by OpalMultipoleT::fillRegisteredAttributes().

double MultipoleT::getScaleFactor ( double  x,
double  s 
)
private

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

Parameters
x-> Coordinate x
s-> Coordinate s

Definition at line 441 of file MultipoleT.cpp.

References angle_m, getRadius(), length_m, and variableRadius_m.

Referenced by getBs().

Here is the call graph for this function:

double MultipoleT::getTransDeriv ( std::size_t  n,
double  x 
)
private

Returns the value of the transverse field n-th derivative at x

Parameters
n-> nth derivative
x-> Coordinate x

Sets a vector of the coefficients in the polynomial expansion of transverse profile; shifts them to the left and multiply by corresponding power each time to take derivative once; repeats until desired derivative is reached

Definition at line 366 of file MultipoleT.cpp.

References Hypervolume::n, transMaxOrder_m, and transProfile_m.

Referenced by getBs(), getBx(), getBz(), getFn(), getFnDerivS(), and getFnDerivX().

std::size_t MultipoleT::getTransMaxOrder ( ) const
inline

Get the maximum order in the given transverse profile

Definition at line 397 of file MultipoleT.h.

References transMaxOrder_m.

Referenced by OpalMultipoleT::fillRegisteredAttributes().

double MultipoleT::getTransProfile ( int  n) const
inline

Get transverse profile

Parameters
n-> Power of x

Definition at line 371 of file MultipoleT.h.

References Hypervolume::n, and transProfile_m.

Referenced by OpalMultipoleT::fillRegisteredAttributes().

std::vector< double > MultipoleT::getTransProfile ( ) const
inline

Get all terms of transverse profile

Definition at line 375 of file MultipoleT.h.

References transProfile_m.

bool MultipoleT::getVarRadius ( ) const
inline

Get the value of variableRadius_m

Definition at line 359 of file MultipoleT.h.

References variableRadius_m.

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

Initialise the MultipoleT

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

Implements Component.

Definition at line 537 of file MultipoleT.cpp.

References initialise(), and Component::RefPartBunch_m.

Referenced by clone(), and OpalMultipoleT::update().

Here is the call graph for this function:

void MultipoleT::initialise ( )

Initialises the geometry

Definition at line 532 of file MultipoleT.cpp.

References angle_m, boundingBoxLength_m, length_m, planarArcGeometry_m, PlanarArcGeometry::setCurvature(), and PlanarArcGeometry::setElementLength().

Referenced by initialise().

Here is the call graph for this function:

bool MultipoleT::insideAperture ( const Vector_t R)
private

Tests if inside the magnet

Parameters
R-> Coordinate vector

Definition at line 172 of file MultipoleT.cpp.

References abs(), horizApert_m, and verticalApert_m.

Referenced by apply().

Here is the call graph for this function:

MultipoleT MultipoleT::operator= ( const MultipoleT rhs)
private
Vector_t MultipoleT::rotateFrame ( const Vector_t R)
private

Rotate frame for skew elements Consecutive rotations: 1st -> about central axis 2nd -> azimuthal rotation

Parameters
R-> Vector to be rotated

Apply two 2D rotation matrices to coordinate vector Rotate around central axis => skew fields Rotate azymuthaly => entrance angle

Definition at line 140 of file MultipoleT.cpp.

References cos(), entranceAngle_m, rotation_m, and sin().

Referenced by apply().

Here is the call graph for this function:

Vector_t MultipoleT::rotateFrameInverse ( Vector_t B)
private

Inverse of the 1st rotation in rotateFrame() method
Used to rotate B field back to global coordinate system

This function represents the inverse of the rotation around the central axis performed by rotateFrame() method Used to rotate B field back to global coordinate system

Definition at line 160 of file MultipoleT.cpp.

References cos(), rotation_m, and sin().

Here is the call graph for this function:

void MultipoleT::setAperture ( double  vertAp,
double  horizAp 
)

Set the aperture dimensions This element only supports a rectangular aperture

Parameters
vertAp-> Vertical aperture length
horizAp-> Horisontal aperture length

Definition at line 410 of file MultipoleT.cpp.

References horizApert_m, and verticalApert_m.

Referenced by OpalMultipoleT::update().

void MultipoleT::setBendAngle ( double  angle)
inline

Set the bending angle of the magnet

Definition at line 414 of file MultipoleT.h.

References angle_m.

Referenced by OpalMultipoleT::update().

void MultipoleT::setBoundingBoxLength ( const double &  boundingBoxLength)
inline

Set distance between centre of magnet and enctrance

Parameters
boundingBoxLength-> Distance between centre and entrance

Definition at line 434 of file MultipoleT.h.

References boundingBoxLength_m.

Referenced by OpalMultipoleT::update().

void MultipoleT::setDipoleConstant ( double  B0)

Set the dipole constant B_0

Definition at line 396 of file MultipoleT.cpp.

References transMaxOrder_m, and transProfile_m.

void MultipoleT::setEntranceAngle ( double  entranceAngle)
inline

Set the entrance angle

Parameters
entranceAngle-> Entrance angle

Definition at line 363 of file MultipoleT.h.

References entranceAngle_m.

Referenced by OpalMultipoleT::update().

bool MultipoleT::setFringeField ( double  s0,
double  lambda_left,
double  lambda_right 
)

Set fringe field model
Tanh model used here

\[ 1/2 * \left [tanh \left( \frac{s + s_0}{\lambda_{left}} \right) - tanh \left( \frac{s - s_0}{\lambda_{right}} \right) \right] \]

Parameters
s0-> Centre field length
\lambda_{left}-> Left end field length
\lambda_{right}-> Right end field length

Definition at line 243 of file MultipoleT.cpp.

References fringeField_l, fringeField_r, and maxOrder_m.

Referenced by OpalMultipoleT::update().

void MultipoleT::setLength ( double  length)
inline

Set the length of the magnet
If straight-> Actual length
If curved -> Arc length

Definition at line 422 of file MultipoleT.h.

References abs(), and length_m.

Referenced by OpalMultipoleT::update().

Here is the call graph for this function:

void MultipoleT::setMaxOrder ( std::size_t  maxOrder)

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

Definition at line 212 of file MultipoleT.cpp.

References angle_m, maxOrder_m, maxOrderX_m, recursion_ConstRadius_m, recursion_VarRadius_m, polynomial::RecursionRelation::resizeX(), polynomial::RecursionRelationTwo::resizeX(), transMaxOrder_m, polynomial::RecursionRelation::truncate(), polynomial::RecursionRelationTwo::truncate(), and variableRadius_m.

Referenced by OpalMultipoleT::update().

Here is the call graph for this function:

void MultipoleT::setMaxXOrder ( 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 393 of file MultipoleT.h.

References maxOrderX_m.

Referenced by OpalMultipoleT::update().

void MultipoleT::setRotation ( double  rot)
inline

Set the angle of rotation of the magnet around its axis
To make skew components

Parameters
rot-> Angle of rotation

Definition at line 410 of file MultipoleT.h.

References rotation_m.

Referenced by OpalMultipoleT::update().

void MultipoleT::setTransMaxOrder ( std::size_t  transMaxOrder)
inline

Set the maximum order in the given transverse profile

Parameters
transMaxOrder-> Highest power of x in field expansion

Definition at line 401 of file MultipoleT.h.

References transMaxOrder_m, and transProfile_m.

Referenced by OpalMultipoleT::update().

void MultipoleT::setTransProfile ( std::size_t  n,
double  Bn 
)

Set transverse profile T(x) T(x) = B_0 + B1 x + B2 x^2 + B3 x^3 + ...

Parameters
n-> Order of the term (d^n/dx^n) to be set
Bn-> Value of transverse profile coefficient

Definition at line 235 of file MultipoleT.cpp.

References Hypervolume::n, transMaxOrder_m, and transProfile_m.

Referenced by OpalMultipoleT::update().

void MultipoleT::setVarRadius ( )
inline

Set variable radius flag to true

Definition at line 355 of file MultipoleT.h.

References variableRadius_m.

Referenced by OpalMultipoleT::update().

Vector_t MultipoleT::transformCoords ( const Vector_t R)
private

Transform to Frenet-Serret coordinates for sector magnets

Definition at line 181 of file MultipoleT.cpp.

References Physics::alpha, angle_m, atan(), fringeField_l, fringeField_r, endfieldmodel::Tanh::getLambda(), coordinatetransform::CoordinateTransform::getTransformation(), endfieldmodel::Tanh::getX0(), length_m, sin(), variableRadius_m, and X.

Referenced by apply().

Here is the call graph for this function:

Member Data Documentation

double MultipoleT::angle_m
private
double MultipoleT::boundingBoxLength_m
private

Distance between centre of magnet and entrance

Definition at line 289 of file MultipoleT.h.

Referenced by getBoundingBoxLength(), initialise(), and setBoundingBoxLength().

BMultipoleField MultipoleT::dummy
private

Not implemented

Definition at line 299 of file MultipoleT.h.

Referenced by getField().

double MultipoleT::entranceAngle_m
private

Definition at line 284 of file MultipoleT.h.

Referenced by getEntranceAngle(), rotateFrame(), and setEntranceAngle().

endfieldmodel::Tanh MultipoleT::fringeField_l
private

Definition at line 251 of file MultipoleT.h.

Referenced by apply(), getFringeDeriv(), getFringeLength(), setFringeField(), and transformCoords().

endfieldmodel::Tanh MultipoleT::fringeField_r
private

Definition at line 252 of file MultipoleT.h.

Referenced by apply(), getFringeDeriv(), getFringeLength(), setFringeField(), and transformCoords().

double MultipoleT::horizApert_m
private

Definition at line 297 of file MultipoleT.h.

Referenced by getAperture(), insideAperture(), and setAperture().

double MultipoleT::length_m
private

Magnet parameters

Definition at line 282 of file MultipoleT.h.

Referenced by apply(), getFn(), getLength(), getRadius(), getScaleFactor(), initialise(), setLength(), and transformCoords().

std::size_t MultipoleT::maxOrder_m = 0
private

Field expansion parameters
Number of terms in z expansion used in calculating field components

Definition at line 256 of file MultipoleT.h.

Referenced by getBs(), getBx(), getBz(), getMaxOrder(), setFringeField(), and setMaxOrder().

std::size_t MultipoleT::maxOrderX_m = 0
private

Highest order of polynomial expansions in x

Definition at line 258 of file MultipoleT.h.

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

PlanarArcGeometry MultipoleT::planarArcGeometry_m
private

Geometry

Definition at line 267 of file MultipoleT.h.

Referenced by getGeometry(), and initialise().

std::vector<polynomial::RecursionRelation> MultipoleT::recursion_ConstRadius_m
private

Definition at line 261 of file MultipoleT.h.

Referenced by getFn(), and setMaxOrder().

std::vector<polynomial::RecursionRelationTwo> MultipoleT::recursion_VarRadius_m
private

Objects for storing differential operator acting on Fn

Definition at line 260 of file MultipoleT.h.

Referenced by getFn(), and setMaxOrder().

double MultipoleT::rotation_m
private

Definition at line 285 of file MultipoleT.h.

Referenced by getRotation(), rotateFrame(), rotateFrameInverse(), and setRotation().

std::size_t MultipoleT::transMaxOrder_m = 0
private

Highest power in given mid-plane field

Definition at line 263 of file MultipoleT.h.

Referenced by getTransDeriv(), getTransMaxOrder(), setDipoleConstant(), setMaxOrder(), setTransMaxOrder(), and setTransProfile().

std::vector<double> MultipoleT::transProfile_m
private

List of transverse profile coefficients

Definition at line 265 of file MultipoleT.h.

Referenced by bends(), getDipoleConstant(), getTransDeriv(), getTransProfile(), setDipoleConstant(), setTransMaxOrder(), and setTransProfile().

bool MultipoleT::variableRadius_m
private

Variable radius flag

Definition at line 287 of file MultipoleT.h.

Referenced by apply(), getBs(), getBx(), getBz(), getFn(), getRadius(), getScaleFactor(), getVarRadius(), setMaxOrder(), setVarRadius(), and transformCoords().

double MultipoleT::verticalApert_m
private

Assume rectangular aperture with these dimensions

Definition at line 296 of file MultipoleT.h.

Referenced by getAperture(), insideAperture(), and setAperture().


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