OPAL (Object Oriented Parallel Accelerator Library)
2021.1.99
OPAL
|
#include <ScalingFFAMagnet.h>
Public Member Functions | |
ScalingFFAMagnet (const std::string &name) | |
~ScalingFFAMagnet () | |
ElementBase * | clone () const override |
bool | apply (const size_t &i, const double &t, Vector_t &E, Vector_t &B) override |
bool | apply (const Vector_t &R, const Vector_t &P, const double &t, Vector_t &E, Vector_t &B) override |
bool | getFieldValue (const Vector_t &R, Vector_t &B) const |
bool | getFieldValueCylindrical (const Vector_t &R, Vector_t &B) const |
void | initialise (PartBunchBase< double, 3 > *bunch, double &startField, double &endField) override |
void | initialise () |
void | finalise () override |
bool | bends () const override |
void | getDimensions (double &, double &) const override |
BGeometryBase & | getGeometry () override |
const BGeometryBase & | getGeometry () const override |
EMField & | getField () override |
const EMField & | getField () const override |
void | accept (BeamlineVisitor &visitor) const override |
double | getTanDelta () const |
void | setTanDelta (double tanDelta) |
double | getFieldIndex () const |
void | setFieldIndex (double k) |
double | getDipoleConstant () const |
void | setDipoleConstant (double Bz) |
double | getR0 () const |
void | setR0 (double r0) |
Vector_t | getCentre () const |
void | setCentre (Vector_t centre) |
endfieldmodel::EndFieldModel * | getEndField () const |
void | setEndField (endfieldmodel::EndFieldModel *endField) |
size_t | getMaxOrder () const |
void | setMaxOrder (size_t maxOrder) |
double | getPhiStart () const |
void | setPhiStart (double phiStart) |
double | getPhiEnd () const |
void | setPhiEnd (double phiEnd) |
double | getRMin () const |
void | setRMin (double rMin) |
double | getRMax () const |
void | setRMax (double rMax) |
double | getAzimuthalExtent () const |
void | setAzimuthalExtent (double azimuthalExtent) |
double | getVerticalExtent () const |
void | setVerticalExtent (double verticalExtent) |
std::vector< std::vector< double > > | getDfCoefficients () |
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 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... | |
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 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 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< 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 | |
void | calculateDfCoefficients () |
ScalingFFAMagnet (const ScalingFFAMagnet &right) | |
ScalingFFAMagnet & | operator= (const ScalingFFAMagnet &rhs) |
Private Attributes | |
PlanarArcGeometry | planarArcGeometry_m |
BMultipoleField | dummy |
size_t | maxOrder_m = 0 |
double | tanDelta_m = 0. |
double | k_m = 0. |
double | Bz_m = 0. |
double | r0_m = 0. |
double | rMin_m = 0. |
double | rMax_m = 0. |
double | phiStart_m = 0. |
double | phiEnd_m = 0. |
double | azimuthalExtent_m = 0. |
double | verticalExtent_m = 0. |
Vector_t | centre_m |
endfieldmodel::EndFieldModel * | endField_m = NULL |
const double | fp_tolerance = 1e-18 |
std::vector< std::vector< double > > | dfCoefficients_m |
Sector bending magnet with an FFA-style field index and spiral end shape
Definition at line 39 of file ScalingFFAMagnet.h.
|
explicit |
Construct a new ScalingFFAMagnet
name | User-defined name of the ScalingFFAMagnet |
Definition at line 34 of file ScalingFFAMagnet.cpp.
Referenced by clone().
ScalingFFAMagnet::~ScalingFFAMagnet | ( | ) |
|
private |
Copy constructor
Definition at line 39 of file ScalingFFAMagnet.cpp.
References Bz_m, endfieldmodel::EndFieldModel::clone(), endField_m, r0_m, and Component::RefPartBunch_m.
|
overridevirtual |
Accept a beamline visitor
Implements ElementBase.
Definition at line 105 of file ScalingFFAMagnet.cpp.
References BeamlineVisitor::visitScalingFFAMagnet().
|
overridevirtual |
Calculate the field at the position of the ith particle
i | index of the particle event override; field is calculated at this position |
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 73 of file ScalingFFAMagnet.cpp.
References PartBunchBase< T, Dim >::P, PartBunchBase< T, Dim >::R, and Component::RefPartBunch_m.
|
overridevirtual |
Calculate the field at some arbitrary position
R | position in the local coordinate system of the bend |
P | not used |
t | not used |
E | not used |
B | calculated magnetic field |
Reimplemented from Component.
Definition at line 170 of file ScalingFFAMagnet.cpp.
References getFieldValue(), and Attrib::Distribution::R.
|
inlineoverridevirtual |
Return true - ScalingFFAMagnet always bends the reference particle
Implements Component.
Definition at line 93 of file ScalingFFAMagnet.cpp.
|
private |
Calculate the df coefficients, ready for field generation
Must be called following any update to the the field parameters, in order for correct field to be calculated.
Definition at line 175 of file ScalingFFAMagnet.cpp.
References dfCoefficients_m, k_m, maxOrder_m, Hypervolume::n, and tanDelta_m.
Referenced by initialise().
|
overridevirtual |
Inheritable copy constructor
Implements ElementBase.
Definition at line 59 of file ScalingFFAMagnet.cpp.
References initialise(), and ScalingFFAMagnet().
|
overridevirtual |
Finalise the ScalingFFAMagnet - sets bunch to NULL
Implements Component.
Definition at line 89 of file ScalingFFAMagnet.cpp.
References Component::RefPartBunch_m.
|
inline |
Get the maximum azimuthal displacement from \psi=0
Definition at line 219 of file ScalingFFAMagnet.h.
References azimuthalExtent_m.
|
inline |
Get the centre of the sector
Definition at line 158 of file ScalingFFAMagnet.h.
References centre_m.
|
inline |
Return the calculated df coefficients
Definition at line 234 of file ScalingFFAMagnet.h.
References dfCoefficients_m.
|
inlineoverridevirtual |
|
inline |
|
inline |
Get the fringe field
Returns the fringe field model; ScalingFFAMagnet retains ownership of the returned memory.
Definition at line 168 of file ScalingFFAMagnet.h.
References endField_m.
Referenced by OpalScalingFFAMagnet::update().
|
overridevirtual |
Return a dummy (0.) field value (what is this for?)
Implements Component.
Definition at line 69 of file ScalingFFAMagnet.cpp.
References dummy.
|
overridevirtual |
Return a dummy (0.) field value (what is this for?)
Implements Component.
Definition at line 65 of file ScalingFFAMagnet.cpp.
References dummy.
|
inline |
Calculate the field at some arbitrary position in cartesian coordinates
R | position in the local coordinate system of the bend, in cartesian coordinates defined like (x, y, z) |
B | calculated magnetic field defined like (Bx, By, Bz) |
Definition at line 110 of file ScalingFFAMagnet.cpp.
References atan2(), centre_m, cos(), getFieldValueCylindrical(), Attrib::Distribution::R, sin(), and sqrt().
Referenced by apply().
Calculate the field at some arbitrary position in cylindrical coordinates
R | position in the local coordinate system of the bend, in cylindrical polar coordinates defined like (r, y, phi) |
B | calculated magnetic field defined like (Br, By, Bphi) |
Definition at line 126 of file ScalingFFAMagnet.cpp.
Referenced by getFieldValue().
|
overridevirtual |
Return the cell geometry
Implements ElementBase.
Definition at line 101 of file ScalingFFAMagnet.cpp.
References planarArcGeometry_m.
|
overridevirtual |
Return the cell geometry
Implements ElementBase.
Definition at line 97 of file ScalingFFAMagnet.cpp.
References planarArcGeometry_m.
|
inline |
Get the maximum power of y modelled in the off-midplane expansion;
Definition at line 179 of file ScalingFFAMagnet.h.
References maxOrder_m.
|
inline |
Get the offset of the magnet end from the start
Definition at line 195 of file ScalingFFAMagnet.h.
References phiEnd_m.
|
inline |
Get the offset of the magnet centre from the start
Definition at line 187 of file ScalingFFAMagnet.h.
References phiStart_m.
|
inline |
|
inline |
|
inline |
|
inline |
Get tan delta - delta is the spiral angle
Definition at line 134 of file ScalingFFAMagnet.h.
References tanDelta_m.
|
inline |
Get the maximum vertical displacement from the midplane
Definition at line 227 of file ScalingFFAMagnet.h.
References verticalExtent_m.
void ScalingFFAMagnet::initialise | ( | ) |
Initialise the ScalingFFAMagnet
Sets up the field expansion and the geometry; call after changing any field parameters
Definition at line 78 of file ScalingFFAMagnet.cpp.
References calculateDfCoefficients(), phiEnd_m, planarArcGeometry_m, r0_m, PlanarArcGeometry::setCurvature(), and PlanarArcGeometry::setElementLength().
Referenced by initialise().
|
overridevirtual |
Initialise the ScalingFFAMagnet
bunch | the global bunch object |
startField | not used |
endField | not used |
Implements Component.
Definition at line 84 of file ScalingFFAMagnet.cpp.
References initialise(), and Component::RefPartBunch_m.
Referenced by clone(), and OpalScalingFFAMagnet::update().
|
private |
|
inline |
Set the maximum azimuthal displacement from \psi=0
Definition at line 223 of file ScalingFFAMagnet.h.
References azimuthalExtent_m.
Referenced by OpalScalingFFAMagnet::update().
|
inline |
Set the centre of the sector
Definition at line 161 of file ScalingFFAMagnet.h.
References centre_m.
Referenced by OpalScalingFFAMagnet::update().
|
inline |
Set the dipole constant B_0
Definition at line 149 of file ScalingFFAMagnet.h.
References Bz_m.
Referenced by OpalScalingFFAMagnet::update().
void ScalingFFAMagnet::setEndField | ( | endfieldmodel::EndFieldModel * | endField | ) |
Set the fringe field
Definition at line 198 of file ScalingFFAMagnet.cpp.
References endField_m.
Referenced by OpalScalingFFAMagnet::OpalScalingFFAMagnet().
|
inline |
Set the field index k
Definition at line 143 of file ScalingFFAMagnet.h.
References k_m.
Referenced by OpalScalingFFAMagnet::update().
|
inline |
Set the maximum power of y modelled in the off-midplane expansion;
Definition at line 183 of file ScalingFFAMagnet.h.
References maxOrder_m.
Referenced by OpalScalingFFAMagnet::update().
|
inline |
Set the offset of the magnet end from the start
Definition at line 199 of file ScalingFFAMagnet.h.
References phiEnd_m.
Referenced by OpalScalingFFAMagnet::update().
|
inline |
Set the offset of the magnet centre from the start
Definition at line 191 of file ScalingFFAMagnet.h.
References phiStart_m.
Referenced by OpalScalingFFAMagnet::update().
|
inline |
Set the radius constant R_0
Definition at line 155 of file ScalingFFAMagnet.h.
References r0_m.
Referenced by OpalScalingFFAMagnet::update().
|
inline |
Set the maximum radius
Definition at line 215 of file ScalingFFAMagnet.h.
References rMax_m.
Referenced by OpalScalingFFAMagnet::update().
|
inline |
Set the maximum radius
Definition at line 207 of file ScalingFFAMagnet.h.
References rMin_m.
Referenced by OpalScalingFFAMagnet::update().
|
inline |
Set tan delta - delta is the spiral angle
Definition at line 137 of file ScalingFFAMagnet.h.
References tanDelta_m.
Referenced by OpalScalingFFAMagnet::update().
|
inline |
Set the maximum vertical displacement from the midplane
Definition at line 231 of file ScalingFFAMagnet.h.
References verticalExtent_m.
Referenced by OpalScalingFFAMagnet::update().
|
private |
Definition at line 260 of file ScalingFFAMagnet.h.
Referenced by getAzimuthalExtent(), and setAzimuthalExtent().
|
private |
Definition at line 254 of file ScalingFFAMagnet.h.
Referenced by getDipoleConstant(), ScalingFFAMagnet(), and setDipoleConstant().
|
private |
Definition at line 262 of file ScalingFFAMagnet.h.
Referenced by getCentre(), getFieldValue(), and setCentre().
|
private |
Definition at line 265 of file ScalingFFAMagnet.h.
Referenced by calculateDfCoefficients(), and getDfCoefficients().
|
private |
Definition at line 249 of file ScalingFFAMagnet.h.
Referenced by getField().
|
private |
Definition at line 263 of file ScalingFFAMagnet.h.
Referenced by getEndField(), ScalingFFAMagnet(), setEndField(), and ~ScalingFFAMagnet().
|
private |
Definition at line 264 of file ScalingFFAMagnet.h.
|
private |
Definition at line 253 of file ScalingFFAMagnet.h.
Referenced by calculateDfCoefficients(), getFieldIndex(), and setFieldIndex().
|
private |
Definition at line 251 of file ScalingFFAMagnet.h.
Referenced by calculateDfCoefficients(), getMaxOrder(), and setMaxOrder().
|
private |
Definition at line 259 of file ScalingFFAMagnet.h.
Referenced by getPhiEnd(), initialise(), and setPhiEnd().
|
private |
Definition at line 258 of file ScalingFFAMagnet.h.
Referenced by getPhiStart(), and setPhiStart().
|
private |
Definition at line 248 of file ScalingFFAMagnet.h.
Referenced by getGeometry(), and initialise().
|
private |
Definition at line 255 of file ScalingFFAMagnet.h.
Referenced by getFieldValueCylindrical(), getR0(), initialise(), ScalingFFAMagnet(), and setR0().
|
private |
Definition at line 257 of file ScalingFFAMagnet.h.
Referenced by getFieldValueCylindrical(), getRMax(), and setRMax().
|
private |
Definition at line 256 of file ScalingFFAMagnet.h.
|
private |
Definition at line 252 of file ScalingFFAMagnet.h.
Referenced by calculateDfCoefficients(), getTanDelta(), and setTanDelta().
|
private |
Definition at line 261 of file ScalingFFAMagnet.h.
Referenced by getVerticalExtent(), and setVerticalExtent().