OPAL (Object Oriented Parallel Accelerator Library) 2022.1
OPAL
|
#include <VerticalFFAMagnet.h>
Public Member Functions | |
VerticalFFAMagnet (const std::string &name) | |
~VerticalFFAMagnet () | |
ElementBase * | clone () const |
bool | apply (const size_t &i, const double &t, Vector_t &E, Vector_t &B) |
bool | apply (const Vector_t &R, const Vector_t &P, const double &t, Vector_t &E, Vector_t &B) |
bool | getFieldValue (const Vector_t &R, Vector_t &B) const |
void | initialise (PartBunchBase< double, 3 > *bunch, double &startField, double &endField) |
void | initialise () |
void | finalise () |
bool | bends () const |
void | getDimensions (double &, double &) const |
BGeometryBase & | getGeometry () |
const BGeometryBase & | getGeometry () const |
EMField & | getField () |
const EMField & | getField () const |
void | accept (BeamlineVisitor &visitor) const |
endfieldmodel::EndFieldModel * | getEndField () const |
void | setEndField (endfieldmodel::EndFieldModel *endField) |
size_t | getMaxOrder () const |
void | setMaxOrder (size_t maxOrder) |
double | getB0 () const |
void | setB0 (double Bz) |
double | getFieldIndex () const |
void | setFieldIndex (double index) |
double | getNegativeVerticalExtent () const |
void | setNegativeVerticalExtent (double negativeExtent) |
double | getPositiveVerticalExtent () const |
void | setPositiveVerticalExtent (double positiveExtent) |
double | getBBLength () const |
void | setBBLength (double bbLength) |
double | getWidth () const |
void | setWidth (double width) |
std::vector< std::vector< double > > | getDfCoefficients () 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 | |
void | calculateDfCoefficients () |
VerticalFFAMagnet (const VerticalFFAMagnet &right) | |
VerticalFFAMagnet & | operator= (const VerticalFFAMagnet &rhs) |
Private Attributes | |
StraightGeometry | straightGeometry_m |
BMultipoleField | dummy |
size_t | maxOrder_m = 0 |
double | k_m = 0. |
double | Bz_m = 0. |
double | zNegExtent_m = 0. |
double | zPosExtent_m = 0. |
double | halfWidth_m = 0. |
double | bbLength_m = 0. |
std::unique_ptr< endfieldmodel::EndFieldModel > | endField_m |
std::vector< std::vector< double > > | dfCoefficients_m |
const double | mm =1000. |
const double | Tesla =10. |
Additional Inherited Members | |
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) 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 |
Bending magnet with an exponential dependence on field in the vertical plane
VerticalFFAMagnet makes a rectangular bending magnet with a dipole field that has a dependence like B0 exp(mz)
Definition at line 28 of file VerticalFFAMagnet.h.
|
explicit |
Construct a new VerticalFFAMagnet
name | User-defined name of the VerticalFFAMagnet |
Definition at line 17 of file VerticalFFAMagnet.cpp.
Referenced by clone().
VerticalFFAMagnet::~VerticalFFAMagnet | ( | ) |
Destructor - deletes the field
Definition at line 38 of file VerticalFFAMagnet.cpp.
|
private |
Copy constructor
Definition at line 21 of file VerticalFFAMagnet.cpp.
References Component::RefPartBunch_m.
|
virtual |
Accept a beamline visitor
Implements ElementBase.
Definition at line 77 of file VerticalFFAMagnet.cpp.
References BeamlineVisitor::visitVerticalFFAMagnet().
|
inlinevirtual |
Calculate the field at the position of the ith particle
i | index of the particle event; 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 218 of file VerticalFFAMagnet.h.
References apply(), PartBunchBase< T, Dim >::P, PartBunchBase< T, Dim >::R, and Component::RefPartBunch_m.
Referenced by apply().
|
inlinevirtual |
Calculate the field at some arbitrary position
R | position in the local coordinate system of the magnet |
P | not used |
t | not used |
E | not used |
B | calculated magnetic field |
Reimplemented from Component.
Definition at line 223 of file VerticalFFAMagnet.h.
References getFieldValue(), and Attrib::Distribution::R.
|
inlinevirtual |
Return false - VerticalFFAMagnet is a straight magnet
Nb: the VerticalFFAMagnet geometry is straight even though trajectories are not
Implements Component.
Definition at line 97 of file VerticalFFAMagnet.h.
|
private |
Definition at line 123 of file VerticalFFAMagnet.cpp.
References dfCoefficients_m, k_m, maxOrder_m, and Hypervolume::n.
Referenced by initialise().
|
virtual |
Inheritable copy constructor
Implements ElementBase.
Definition at line 41 of file VerticalFFAMagnet.cpp.
References initialise(), and VerticalFFAMagnet().
|
virtual |
Finalise the VerticalFFAMagnet - sets bunch to nullptr
Implements Component.
Definition at line 65 of file VerticalFFAMagnet.cpp.
References Component::RefPartBunch_m.
|
inline |
Get the centre field at z=0
Definition at line 140 of file VerticalFFAMagnet.h.
|
inline |
Get the length of the bounding box (centred on magnet centre)
Definition at line 164 of file VerticalFFAMagnet.h.
References bbLength_m, and mm.
|
inline |
Get the coefficients used for the field expansion
B_y is given by sum_n B_0 exp(ky) f_n x^n where f_n = sum_k c_{nk} partial_k f_0
Returns a vector of vectors, like c[n][k]. The expansion for the other field elements can be related back to c[n][k] (see elsewhere for details).
Definition at line 228 of file VerticalFFAMagnet.h.
References dfCoefficients_m.
|
inlinevirtual |
|
inline |
Get the fringe field
Returns the fringe field model; VerticalFFAMagnet retains ownership of the returned memory.
Definition at line 122 of file VerticalFFAMagnet.h.
References endField_m.
Referenced by OpalVerticalFFAMagnet::update().
|
virtual |
Return a dummy (0.) field value (what is this for?)
Implements Component.
Definition at line 47 of file VerticalFFAMagnet.cpp.
References dummy.
|
virtual |
Return a dummy (0.) field value (what is this for?)
Implements Component.
Definition at line 51 of file VerticalFFAMagnet.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 82 of file VerticalFFAMagnet.cpp.
References abs(), bbLength_m, Bz_m, dfCoefficients_m, endField_m, exp(), halfWidth_m, k_m, maxOrder_m, Hypervolume::n, Attrib::Distribution::R, zNegExtent_m, and zPosExtent_m.
Referenced by apply().
|
virtual |
Return the cell geometry
Implements ElementBase.
Definition at line 69 of file VerticalFFAMagnet.cpp.
References straightGeometry_m.
|
virtual |
Return the cell geometry
Implements ElementBase.
Definition at line 73 of file VerticalFFAMagnet.cpp.
References straightGeometry_m.
|
inline |
Get the maximum power of x used in the off-midplane expansion;
Definition at line 133 of file VerticalFFAMagnet.h.
References maxOrder_m.
|
inline |
Get the maximum extent below z = 0
Definition at line 152 of file VerticalFFAMagnet.h.
References mm, and zNegExtent_m.
|
inline |
Get the maximum extent above z = 0
Definition at line 158 of file VerticalFFAMagnet.h.
References mm, and zPosExtent_m.
|
inline |
Get the full width of the bounding box (centred on magnet centre)
Definition at line 170 of file VerticalFFAMagnet.h.
References halfWidth_m, and mm.
void VerticalFFAMagnet::initialise | ( | ) |
Initialise the VerticalFFAMagnet
Sets up the field expansion and the geometry; call after changing any field parameters
Definition at line 55 of file VerticalFFAMagnet.cpp.
References bbLength_m, calculateDfCoefficients(), StraightGeometry::setElementLength(), and straightGeometry_m.
Referenced by initialise().
|
virtual |
Initialise the VerticalFFAMagnet
bunch | the global bunch object (but not used) |
startField | not used |
endField | not used |
Implements Component.
Definition at line 60 of file VerticalFFAMagnet.cpp.
References initialise(), and Component::RefPartBunch_m.
Referenced by clone(), and OpalVerticalFFAMagnet::update().
|
private |
|
inline |
Set the centre field at z=0
Definition at line 143 of file VerticalFFAMagnet.h.
Referenced by OpalVerticalFFAMagnet::update().
|
inline |
Set the length of the bounding box (centred on magnet centre)
Definition at line 167 of file VerticalFFAMagnet.h.
References bbLength_m, and mm.
Referenced by OpalVerticalFFAMagnet::update().
void VerticalFFAMagnet::setEndField | ( | endfieldmodel::EndFieldModel * | endField | ) |
Set the fringe field
Definition at line 144 of file VerticalFFAMagnet.cpp.
References endField_m, and maxOrder_m.
Referenced by OpalVerticalFFAMagnet::OpalVerticalFFAMagnet().
|
inline |
Set the field index
Definition at line 149 of file VerticalFFAMagnet.h.
Referenced by OpalVerticalFFAMagnet::update().
void VerticalFFAMagnet::setMaxOrder | ( | size_t | maxOrder | ) |
Set the maximum power of x used in the off-midplane expansion;
Definition at line 149 of file VerticalFFAMagnet.cpp.
References endField_m, and maxOrder_m.
Referenced by OpalVerticalFFAMagnet::update().
|
inline |
Set the maximum extent below z = 0
Definition at line 210 of file VerticalFFAMagnet.h.
References mm, and zNegExtent_m.
Referenced by OpalVerticalFFAMagnet::update().
|
inline |
set the maximum extent above z = 0
Definition at line 214 of file VerticalFFAMagnet.h.
References mm, and zPosExtent_m.
Referenced by OpalVerticalFFAMagnet::update().
|
inline |
Set the full width of the bounding box (centred on magnet centre)
Definition at line 173 of file VerticalFFAMagnet.h.
References halfWidth_m, and mm.
Referenced by OpalVerticalFFAMagnet::update().
|
private |
Definition at line 202 of file VerticalFFAMagnet.h.
Referenced by getBBLength(), getFieldValue(), initialise(), and setBBLength().
|
private |
Definition at line 198 of file VerticalFFAMagnet.h.
Referenced by getB0(), getFieldValue(), and setB0().
|
private |
Definition at line 204 of file VerticalFFAMagnet.h.
Referenced by calculateDfCoefficients(), getDfCoefficients(), and getFieldValue().
|
private |
Definition at line 194 of file VerticalFFAMagnet.h.
Referenced by getField().
|
private |
Definition at line 203 of file VerticalFFAMagnet.h.
Referenced by getEndField(), getFieldValue(), setEndField(), and setMaxOrder().
|
private |
Definition at line 201 of file VerticalFFAMagnet.h.
Referenced by getFieldValue(), getWidth(), and setWidth().
|
private |
Definition at line 197 of file VerticalFFAMagnet.h.
Referenced by calculateDfCoefficients(), getFieldIndex(), getFieldValue(), and setFieldIndex().
|
private |
Definition at line 196 of file VerticalFFAMagnet.h.
Referenced by calculateDfCoefficients(), getFieldValue(), getMaxOrder(), setEndField(), and setMaxOrder().
|
private |
Definition at line 206 of file VerticalFFAMagnet.h.
Referenced by getBBLength(), getFieldIndex(), getNegativeVerticalExtent(), getPositiveVerticalExtent(), getWidth(), setBBLength(), setFieldIndex(), setNegativeVerticalExtent(), setPositiveVerticalExtent(), and setWidth().
|
private |
Definition at line 193 of file VerticalFFAMagnet.h.
Referenced by getGeometry(), and initialise().
|
private |
Definition at line 207 of file VerticalFFAMagnet.h.
|
private |
Definition at line 199 of file VerticalFFAMagnet.h.
Referenced by getFieldValue(), getNegativeVerticalExtent(), and setNegativeVerticalExtent().
|
private |
Definition at line 200 of file VerticalFFAMagnet.h.
Referenced by getFieldValue(), getPositiveVerticalExtent(), and setPositiveVerticalExtent().