OPAL (Object Oriented Parallel Accelerator Library)
2024.1
OPAL
|
#include <ScalingFFAMagnet.h>
Public Member Functions | |
ScalingFFAMagnet (const std::string &name) | |
~ScalingFFAMagnet () | |
ScalingFFAMagnet * | 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 () |
void | setupEndField () |
void | setEndFieldName (std::string name) |
std::string | getEndFieldName () const |
![]() | |
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 ElementType | getType () const override |
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 &) |
![]() | |
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< 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 |
![]() | |
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. |
double | r0Sign_m = 0.0 |
Vector_t | centre_m |
endfieldmodel::EndFieldModel * | endField_m = nullptr |
std::string | endFieldName_m = "" |
const double | fp_tolerance = 1e-18 |
std::vector< std::vector < double > > | dfCoefficients_m |
Additional Inherited Members | |
![]() | |
static std::string | getTypeString (ElementType type) |
![]() | |
bool | isInsideTransverse (const Vector_t &r) const |
![]() | |
RCObject () | |
Default constructor. More... | |
RCObject (const RCObject &) | |
Copy constructor. More... | |
virtual | ~RCObject ()=0 |
RCObject & | operator= (const RCObject &right) |
![]() | |
double | exit_face_slope_m |
PartBunchBase< double, 3 > * | RefPartBunch_m |
bool | online_m |
![]() | |
bool | shareFlag |
CoordinateSystemTrafo | csTrafoGlobal2Local_m |
CoordinateSystemTrafo | misalignment_m |
std::pair< ApertureType, std::vector< double > > | aperture_m |
double | elementEdge_m |
double | rotationZAxis_m |
![]() | |
static const std::vector< double > | defaultAperture_m |
Sector bending magnet with an FFA-style field index and spiral end shape
Note about placement and end field; in order to get a user-defined end field shape, we do a lookup from user defined end fields, which is pulled from the EndFieldModel object and done by setupEndField(). Because end fields tie into the geometry, this has to be done before placements; but it also needs to be done after parsing has finished. setupEndField() is called by e.g. ParallelCyclotronTracker just before the object is handed to OpalRing for placement.
Definition at line 41 of file ScalingFFAMagnet.h.
|
explicit |
Construct a new ScalingFFAMagnet
name | User-defined name of the ScalingFFAMagnet |
Definition at line 23 of file ScalingFFAMagnet.cpp.
Referenced by clone().
ScalingFFAMagnet::~ScalingFFAMagnet | ( | ) |
|
private |
Copy constructor
Definition at line 30 of file ScalingFFAMagnet.cpp.
References Bz_m, endfieldmodel::EndFieldModel::clone(), endField_m, r0_m, r0Sign_m, and Component::RefPartBunch_m.
|
overridevirtual |
Accept a beamline visitor
Implements ElementBase.
Definition at line 91 of file ScalingFFAMagnet.cpp.
References BeamlineVisitor::visitScalingFFAMagnet().
|
inlineoverridevirtual |
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 300 of file ScalingFFAMagnet.h.
References PartBunchBase< T, Dim >::P, PartBunchBase< T, Dim >::R, and Component::RefPartBunch_m.
|
inlineoverridevirtual |
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 295 of file ScalingFFAMagnet.h.
References getFieldValue().
|
inlineoverridevirtual |
Return true - ScalingFFAMagnet always bends the reference particle
Implements Component.
Definition at line 79 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 160 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 52 of file ScalingFFAMagnet.cpp.
References initialise(), magnet, and ScalingFFAMagnet().
Referenced by ParallelCyclotronTracker::visitScalingFFAMagnet().
|
overridevirtual |
Finalise the ScalingFFAMagnet - sets bunch to nullptr
Implements Component.
Definition at line 75 of file ScalingFFAMagnet.cpp.
References Component::RefPartBunch_m.
|
inline |
Get the maximum azimuthal displacement from =0
Definition at line 223 of file ScalingFFAMagnet.h.
References azimuthalExtent_m.
|
inline |
Get the centre of the sector
Definition at line 162 of file ScalingFFAMagnet.h.
References centre_m.
|
inline |
Return the calculated df coefficients
Definition at line 238 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 172 of file ScalingFFAMagnet.h.
References endField_m.
Referenced by OpalScalingFFAMagnet::update().
|
inline |
Return the end field name.
Definition at line 258 of file ScalingFFAMagnet.h.
References endFieldName_m.
|
overridevirtual |
Return a dummy (0.) field value (what is this for?)
Implements Component.
Definition at line 58 of file ScalingFFAMagnet.cpp.
References dummy.
|
overridevirtual |
Return a dummy (0.) field value (what is this for?)
Implements Component.
Definition at line 62 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 95 of file ScalingFFAMagnet.cpp.
References atan2(), cos(), getFieldValueCylindrical(), r0_m, r0Sign_m, 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, z, phi) |
B | calculated magnetic field defined like (Br, By, Bphi) |
Definition at line 111 of file ScalingFFAMagnet.cpp.
References abs(), azimuthalExtent_m, Bz_m, dfCoefficients_m, endField_m, endfieldmodel::EndFieldModel::function(), k_m, log(), maxOrder_m, Hypervolume::n, phiStart_m, pow(), r0_m, r0Sign_m, rMax_m, tanDelta_m, and verticalExtent_m.
Referenced by getFieldValue().
|
overridevirtual |
Return the cell geometry
Implements ElementBase.
Definition at line 83 of file ScalingFFAMagnet.cpp.
References planarArcGeometry_m.
|
overridevirtual |
Return the cell geometry
Implements ElementBase.
Definition at line 87 of file ScalingFFAMagnet.cpp.
References planarArcGeometry_m.
|
inline |
Get the maximum power of y modelled in the off-midplane expansion;
Definition at line 183 of file ScalingFFAMagnet.h.
References maxOrder_m.
|
inline |
Get the offset of the magnet end from the start
Definition at line 199 of file ScalingFFAMagnet.h.
References phiEnd_m.
|
inline |
Get the offset of the magnet centre from the start
Definition at line 191 of file ScalingFFAMagnet.h.
References phiStart_m.
Referenced by setupEndField().
|
inline |
|
inline |
|
inline |
|
inline |
Get tan delta - delta is the spiral angle
Definition at line 138 of file ScalingFFAMagnet.h.
References tanDelta_m.
|
inline |
Get the maximum vertical displacement from the midplane
Definition at line 231 of file ScalingFFAMagnet.h.
References verticalExtent_m.
|
overridevirtual |
Initialise the ScalingFFAMagnet
bunch | the global bunch object |
startField | not used |
endField | not used |
Implements Component.
Definition at line 70 of file ScalingFFAMagnet.cpp.
References initialise(), and Component::RefPartBunch_m.
Referenced by clone(), and OpalScalingFFAMagnet::update().
void ScalingFFAMagnet::initialise | ( | ) |
Initialise the ScalingFFAMagnet
Sets up the field expansion and the geometry; call after changing any field parameters
Definition at line 66 of file ScalingFFAMagnet.cpp.
References calculateDfCoefficients().
Referenced by initialise().
|
private |
|
inline |
Set the maximum azimuthal displacement from =0
Definition at line 227 of file ScalingFFAMagnet.h.
References azimuthalExtent_m.
Referenced by setupEndField(), and OpalScalingFFAMagnet::update().
Set the centre of the sector
Definition at line 165 of file ScalingFFAMagnet.h.
References centre_m.
Referenced by OpalScalingFFAMagnet::update().
|
inline |
Set the dipole constant B_0
Definition at line 153 of file ScalingFFAMagnet.h.
References Bz_m.
Referenced by OpalScalingFFAMagnet::update().
void ScalingFFAMagnet::setEndField | ( | endfieldmodel::EndFieldModel * | endField | ) |
Set the fringe field
Definition at line 183 of file ScalingFFAMagnet.cpp.
References endField_m.
Referenced by OpalScalingFFAMagnet::OpalScalingFFAMagnet(), and setupEndField().
|
inline |
Set the end field name.
Called during parsing of the input file; OPAL looks for the endFieldName when setupEndField() is called.
Definition at line 255 of file ScalingFFAMagnet.h.
References endFieldName_m, and name.
Referenced by OpalScalingFFAMagnet::setupDefaultEndField(), and OpalScalingFFAMagnet::setupNamedEndField().
|
inline |
Set the field index k
Definition at line 147 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 187 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 203 of file ScalingFFAMagnet.h.
References phiEnd_m.
Referenced by setupEndField(), and OpalScalingFFAMagnet::update().
|
inline |
Set the offset of the magnet centre from the start
Definition at line 195 of file ScalingFFAMagnet.h.
References phiStart_m.
Referenced by setupEndField(), and OpalScalingFFAMagnet::update().
|
inline |
Set the radius constant R_0
Definition at line 159 of file ScalingFFAMagnet.h.
References abs(), r0_m, and r0Sign_m.
Referenced by OpalScalingFFAMagnet::update().
|
inline |
Set the maximum radius
Definition at line 219 of file ScalingFFAMagnet.h.
References rMax_m.
Referenced by OpalScalingFFAMagnet::update().
|
inline |
Set the maximum radius
Definition at line 211 of file ScalingFFAMagnet.h.
References rMin_m.
Referenced by OpalScalingFFAMagnet::update().
|
inline |
Set tan delta - delta is the spiral angle
Definition at line 141 of file ScalingFFAMagnet.h.
References tanDelta_m.
Referenced by OpalScalingFFAMagnet::update().
void ScalingFFAMagnet::setupEndField | ( | ) |
setupEndField does some end field and geometry set-up
This is normally called just before the magnet is placed; can only set up the end field after everything has been parsed from input (otherwise OPAL may not know about an end field model).
sets PhiStart, PhiEnd, AzimuthalExtent and the end field model itself.
Definition at line 191 of file ScalingFFAMagnet.cpp.
References abs(), azimuthalExtent_m, endfieldmodel::EndFieldModel::clone(), endFieldName_m, endfieldmodel::EndFieldModel::getCentreLength(), endfieldmodel::EndFieldModel::getEndFieldModel(), endfieldmodel::EndFieldModel::getEndLength(), getPhiStart(), maxOrder_m, phiEnd_m, phiStart_m, planarArcGeometry_m, r0_m, endfieldmodel::EndFieldModel::rescale(), setAzimuthalExtent(), PlanarArcGeometry::setCurvature(), PlanarArcGeometry::setElementLength(), setEndField(), endfieldmodel::EndFieldModel::setMaximumDerivative(), setPhiEnd(), and setPhiStart().
Referenced by PyOpal::PyOpalObjectNS::PyOpalObject< C >::doSetup(), and ParallelCyclotronTracker::visitScalingFFAMagnet().
|
inline |
Set the maximum vertical displacement from the midplane
Definition at line 235 of file ScalingFFAMagnet.h.
References verticalExtent_m.
Referenced by OpalScalingFFAMagnet::update().
|
private |
Definition at line 285 of file ScalingFFAMagnet.h.
Referenced by getAzimuthalExtent(), getFieldValueCylindrical(), setAzimuthalExtent(), and setupEndField().
|
private |
Definition at line 279 of file ScalingFFAMagnet.h.
Referenced by getDipoleConstant(), getFieldValueCylindrical(), ScalingFFAMagnet(), and setDipoleConstant().
|
private |
Definition at line 288 of file ScalingFFAMagnet.h.
Referenced by getCentre(), and setCentre().
|
private |
Definition at line 292 of file ScalingFFAMagnet.h.
Referenced by calculateDfCoefficients(), getDfCoefficients(), and getFieldValueCylindrical().
|
private |
Definition at line 274 of file ScalingFFAMagnet.h.
Referenced by getField().
|
private |
Definition at line 289 of file ScalingFFAMagnet.h.
Referenced by getEndField(), getFieldValueCylindrical(), ScalingFFAMagnet(), setEndField(), and ~ScalingFFAMagnet().
|
private |
Definition at line 290 of file ScalingFFAMagnet.h.
Referenced by getEndFieldName(), setEndFieldName(), and setupEndField().
|
private |
Definition at line 291 of file ScalingFFAMagnet.h.
|
private |
Definition at line 278 of file ScalingFFAMagnet.h.
Referenced by calculateDfCoefficients(), getFieldIndex(), getFieldValueCylindrical(), and setFieldIndex().
|
private |
Definition at line 276 of file ScalingFFAMagnet.h.
Referenced by calculateDfCoefficients(), getFieldValueCylindrical(), getMaxOrder(), setMaxOrder(), and setupEndField().
|
private |
Definition at line 284 of file ScalingFFAMagnet.h.
Referenced by getPhiEnd(), setPhiEnd(), and setupEndField().
|
private |
Definition at line 283 of file ScalingFFAMagnet.h.
Referenced by getFieldValueCylindrical(), getPhiStart(), setPhiStart(), and setupEndField().
|
private |
Definition at line 273 of file ScalingFFAMagnet.h.
Referenced by getGeometry(), and setupEndField().
|
private |
Definition at line 280 of file ScalingFFAMagnet.h.
Referenced by getFieldValue(), getFieldValueCylindrical(), getR0(), ScalingFFAMagnet(), setR0(), and setupEndField().
|
private |
Definition at line 287 of file ScalingFFAMagnet.h.
Referenced by getFieldValue(), getFieldValueCylindrical(), ScalingFFAMagnet(), and setR0().
|
private |
Definition at line 282 of file ScalingFFAMagnet.h.
Referenced by getFieldValueCylindrical(), getRMax(), and setRMax().
|
private |
Definition at line 281 of file ScalingFFAMagnet.h.
|
private |
Definition at line 277 of file ScalingFFAMagnet.h.
Referenced by calculateDfCoefficients(), getFieldValueCylindrical(), getTanDelta(), and setTanDelta().
|
private |
Definition at line 286 of file ScalingFFAMagnet.h.
Referenced by getFieldValueCylindrical(), getVerticalExtent(), and setVerticalExtent().