OPAL (Object Oriented Parallel Accelerator Library) 2022.1
OPAL
|
#include <MultipoleTCurvedVarRadius.h>
Public Member Functions | |
MultipoleTCurvedVarRadius (const std::string &name) | |
MultipoleTCurvedVarRadius (const MultipoleTCurvedVarRadius &right) | |
~MultipoleTCurvedVarRadius () | |
virtual ElementBase * | clone () const override |
void | accept (BeamlineVisitor &visitor) const override |
VarRadiusGeometry & | getGeometry () override |
const VarRadiusGeometry & | getGeometry () 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 () | |
EMField & | getField () |
const EMField & | getField () 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 EMField & | getField ()=0 |
Return field. More... | |
virtual const EMField & | getField () 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 ElementBase & | getDesign () 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 BGeometryBase & | getGeometry ()=0 |
Get geometry. More... | |
virtual const BGeometryBase & | getGeometry () 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 Channel * | getChannel (const std::string &aKey, bool create=false) |
Construct a read/write channel. More... | |
virtual const ConstChannel * | getConstChannel (const std::string &aKey) const |
Construct a read-only channel. More... | |
virtual void | accept (BeamlineVisitor &visitor) const =0 |
Apply visitor. More... | |
virtual ElementBase * | clone () const =0 |
Return clone. More... | |
virtual ElementBase * | copyStructure () |
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 BoundaryGeometry * | getBoundaryGeometry () 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 WakeFunction * | getWake () 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 |
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::RecursionRelationTwo > | recursion_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 |
RCObject & | operator= (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 |
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.
|
explicit |
Constructor
name | -> User-defined name |
Definition at line 37 of file MultipoleTCurvedVarRadius.cpp.
Referenced by clone().
MultipoleTCurvedVarRadius::MultipoleTCurvedVarRadius | ( | const MultipoleTCurvedVarRadius & | right | ) |
Copy constructor
Definition at line 44 of file MultipoleTCurvedVarRadius.cpp.
References Component::RefPartBunch_m.
MultipoleTCurvedVarRadius::~MultipoleTCurvedVarRadius | ( | ) |
Destructor
Definition at line 54 of file MultipoleTCurvedVarRadius.cpp.
|
inlineoverridevirtual |
Accept a beamline visitor
Implements ElementBase.
Definition at line 163 of file MultipoleTCurvedVarRadius.h.
References BeamlineVisitor::visitMultipoleTCurvedVarRadius().
|
overridevirtual |
Inheritable copy constructor
Implements ElementBase.
Definition at line 57 of file MultipoleTCurvedVarRadius.cpp.
References MultipoleTCurvedVarRadius().
Referenced by ParallelCyclotronTracker::visitMultipoleTCurvedVarRadius().
|
inlineoverridevirtual |
Get the bending angle of the magnet
Reimplemented from MultipoleTBase.
Definition at line 188 of file MultipoleTCurvedVarRadius.h.
References angle_m.
|
overrideprivatevirtual |
Calculate fn(x, s) by expanding the differential operator (from Laplacian and scalar potential) in terms of polynomials
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.
|
inlineoverridevirtual |
Return the cell geometry
Implements ElementBase.
Definition at line 180 of file MultipoleTCurvedVarRadius.h.
References varRadiusGeometry_m.
|
inlineoverridevirtual |
Return the cell geometry
Implements ElementBase.
Definition at line 176 of file MultipoleTCurvedVarRadius.h.
References varRadiusGeometry_m.
Referenced by OpalMultipoleTCurvedVarRadius::update().
|
inline |
Get highest power of x in polynomial expansions
Definition at line 172 of file MultipoleTCurvedVarRadius.h.
References maxOrderX_m.
|
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
s | -> Coordinate s |
Implements MultipoleTBase.
Definition at line 103 of file MultipoleTCurvedVarRadius.cpp.
References angle_m, MultipoleTBase::getFringeDeriv(), and MultipoleTBase::getLength().
Referenced by getScaleFactor().
|
overrideprivatevirtual |
Returns the scale factor \( h_s = 1 + x / \rho(s) \)
x | -> Coordinate x |
s | -> Coordinate s |
Implements MultipoleTBase.
Definition at line 112 of file MultipoleTCurvedVarRadius.cpp.
References getRadius().
|
inlineoverridevirtual |
Initialise the MultipoleT
bunch | -> Bunch the global bunch object |
startField | -> Not used |
endField | -> Not used |
Reimplemented from MultipoleTBase.
Definition at line 192 of file MultipoleTCurvedVarRadius.h.
References angle_m, MultipoleTBase::getBoundingBoxLength(), MultipoleTBase::getFringeLength(), MultipoleTBase::getLength(), Component::RefPartBunch_m, VarRadiusGeometry::setElementLength(), VarRadiusGeometry::setLambdaLeft(), VarRadiusGeometry::setLambdaRight(), VarRadiusGeometry::setRadius(), VarRadiusGeometry::setS0(), and varRadiusGeometry_m.
|
private |
|
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().
|
overridevirtual |
Set the number of terms used in calculation of field components
Maximum power of z in Bz is 2 * maxOrder_m
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().
|
inline |
Set the number of terms used in polynomial expansions
maxXOrder | -> Number of terms in expansion in z |
Definition at line 167 of file MultipoleTCurvedVarRadius.h.
References maxOrderX_m.
Referenced by OpalMultipoleTCurvedVarRadius::update().
|
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().
|
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.
|
private |
Definition at line 138 of file MultipoleTCurvedVarRadius.h.
Referenced by getBendAngle(), getFn(), getRadius(), initialise(), setBendAngle(), transformBField(), and transformCoords().
|
private |
Highest order of polynomial expansions in x
Definition at line 129 of file MultipoleTCurvedVarRadius.h.
Referenced by getMaxXOrder(), setMaxOrder(), and setMaxXOrder().
|
private |
Objects for storing differential operator acting on Fn
Definition at line 131 of file MultipoleTCurvedVarRadius.h.
Referenced by getFn(), and setMaxOrder().
|
private |
Geometry
Definition at line 133 of file MultipoleTCurvedVarRadius.h.
Referenced by getGeometry(), and initialise().