OPAL (Object Oriented Parallel Accelerator Library)
2021.1.99
OPAL
|
#include <VariableRFCavityFringeField.h>
Public Member Functions | |
VariableRFCavityFringeField (const std::string &name) | |
Constructor with given name. More... | |
VariableRFCavityFringeField (const VariableRFCavityFringeField &) | |
VariableRFCavityFringeField () | |
VariableRFCavityFringeField & | operator= (const VariableRFCavityFringeField &) |
virtual | ~VariableRFCavityFringeField () |
virtual void | accept (BeamlineVisitor &) const override |
virtual ElementBase * | clone () const override |
virtual bool | apply (const size_t &i, const double &t, Vector_t &E, Vector_t &B) override |
virtual bool | apply (const Vector_t &R, const Vector_t &P, const double &t, Vector_t &E, Vector_t &B) override |
virtual bool | applyToReferenceParticle (const Vector_t &R, const Vector_t &P, const double &t, Vector_t &E, Vector_t &B) override |
virtual void | setEndField (std::shared_ptr< endfieldmodel::EndFieldModel > endField) |
virtual std::shared_ptr< endfieldmodel::EndFieldModel > | getEndField () const |
virtual void | initialise (PartBunchBase< double, 3 > *bunch, double &startField, double &endField) override |
virtual void | setCavityCentre (double zCentre) |
virtual double | getCavityCentre () const |
virtual void | setMaxOrder (size_t maxOrder) |
virtual size_t | getMaxOrder () const |
void | initialiseCoefficients () |
void | printCoefficients (std::ostream &out) const |
std::vector< std::vector< double > > | getEzCoefficients () const |
std::vector< std::vector< double > > | getEyCoefficients () const |
std::vector< std::vector< double > > | getBxCoefficients () const |
Public Member Functions inherited from VariableRFCavity | |
VariableRFCavity (const std::string &name) | |
Constructor with given name. More... | |
VariableRFCavity (const VariableRFCavity &) | |
VariableRFCavity () | |
VariableRFCavity & | operator= (const VariableRFCavity &) |
virtual | ~VariableRFCavity () |
virtual void | finalise () override |
virtual bool | bends () const override |
virtual void | getDimensions (double &, double &) const override |
virtual double | getAmplitude (double time) const |
virtual double | getFrequency (double time) const |
virtual double | getPhase (double time) const |
virtual double | getHeight () const |
virtual double | getWidth () const |
virtual double | getLength () const |
virtual void | setHeight (double fullHeight) |
virtual void | setWidth (double fullWidth) |
virtual void | setLength (double length) |
virtual std::shared_ptr< AbstractTimeDependence > | getAmplitudeModel () const |
virtual std::shared_ptr< AbstractTimeDependence > | getPhaseModel () const |
virtual std::shared_ptr< AbstractTimeDependence > | getFrequencyModel () const |
virtual void | setAmplitudeModel (std::shared_ptr< AbstractTimeDependence > time_dep) |
virtual void | setPhaseModel (std::shared_ptr< AbstractTimeDependence > time_dep) |
virtual void | setFrequencyModel (std::shared_ptr< AbstractTimeDependence > time_dep) |
virtual void | setAmplitudeName (std::string amplitude) |
virtual void | setPhaseName (std::string phase) |
virtual void | setFrequencyName (std::string frequency) |
virtual StraightGeometry & | getGeometry () override |
virtual const StraightGeometry & | getGeometry () const override |
virtual EMField & | getField () override |
Not implemented. More... | |
virtual const EMField & | getField () const override |
Not implemented. More... | |
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 | 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... | |
Protected Attributes | |
double | zCentre_m |
size_t | maxOrder_m |
std::shared_ptr< endfieldmodel::EndFieldModel > | endField_m |
std::vector< std::vector< double > > | f_m |
std::vector< std::vector< double > > | g_m |
std::vector< std::vector< double > > | h_m |
Protected Attributes inherited from VariableRFCavity | |
std::shared_ptr< AbstractTimeDependence > | phaseTD_m |
std::shared_ptr< AbstractTimeDependence > | amplitudeTD_m |
std::shared_ptr< AbstractTimeDependence > | frequencyTD_m |
std::string | phaseName_m |
std::string | amplitudeName_m |
std::string | frequencyName_m |
double | halfWidth_m |
double | halfHeight_m |
double | _length |
StraightGeometry | geometry |
The cavity's geometry. More... | |
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 |
Private Member Functions | |
void | initNull () |
Additional Inherited Members | |
Public Types inherited from ElementBase | |
enum | ApertureType { RECTANGULAR , ELLIPTICAL , CONIC_RECTANGULAR , CONIC_ELLIPTICAL } |
enum | ElementType { BEAMLINE , CCOLLIMATOR , CORRECTOR , CYCLOTRON , DEGRADER , DRIFT , FLEXIBLECOLLIMATOR , MARKER , MONITOR , MPSPLITINTEGRATOR , MULTIPOLE , MULTIPOLET , OFFSET , PROBE , RBEND , RBEND3D , RFCAVITY , RING , SBEND3D , SBEND , SEPTUM , SOLENOID , SOURCE , STRIPPER , TRAVELINGWAVE , UNDULATOR , VACUUM , VARIABLERFCAVITY , ANY } |
Static Public Member Functions inherited from ElementBase | |
static std::string | getTypeString (ElementType type) |
Protected Member Functions inherited from VariableRFCavity | |
void | initNull () |
void | initialise () const |
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) |
Static Protected Attributes inherited from VariableRFCavity | |
static const double | lengthUnit_m = 1e3 |
Static Protected Attributes inherited from Component | |
static const std::vector< double > | defaultAperture_m |
Generates a field like Ey = E0*a(t)*y^{2n+1} g_n(z) sin{f(t)*t-q(t)} Ez = E0*a(t)*y^{2n} f_n(z) sin{f(t)*t-q(t)} Bx = B0*a(t)*y^{2n+1} h_n(z) cos{f(t)*t-q(t)} where E0, is a user-defined field and B0 is the corresponding magnetic field magnitude; f_n is a user-defined axial field dependence and g_n, h_n are the corresponding off-axis field dependencies. a(t), f(t), q(t) are time dependent amplitude, frequency, phase respectively; it is assumed that these quantities vary sufficiently slowly that Maxwell is satisfied.
Inherits from VariableRFCavity; inheritance is used here to share code from VariableRFCavity.
Set/get methods use metres; but internally we store as mm (for tracking)
Field units are kG and GV/mm
Definition at line 58 of file VariableRFCavityFringeField.h.
|
explicit |
Constructor with given name.
Definition at line 35 of file VariableRFCavityFringeField.cpp.
References initNull().
VariableRFCavityFringeField::VariableRFCavityFringeField | ( | const VariableRFCavityFringeField & | var | ) |
Copy Constructor; performs deepcopy on time-dependence models
Definition at line 43 of file VariableRFCavityFringeField.cpp.
References initNull().
VariableRFCavityFringeField::VariableRFCavityFringeField | ( | ) |
Default constructor
Definition at line 39 of file VariableRFCavityFringeField.cpp.
References initNull().
Referenced by clone().
|
virtual |
Destructor does nothing
The shared_ptrs will self-destruct when reference count goes to 0
Definition at line 62 of file VariableRFCavityFringeField.cpp.
|
overridevirtual |
Apply visitor to RFCavity.
The RF cavity finds the "time dependence" models by doing a string lookup against a list held by AbstractTimeDependence at accept time.
Reimplemented from VariableRFCavity.
Definition at line 76 of file VariableRFCavityFringeField.cpp.
References VariableRFCavity::initialise(), initialiseCoefficients(), and BeamlineVisitor::visitVariableRFCavity().
|
overridevirtual |
Calculate the field at the position of the i^th particle
i | indexes the particle whose field we need |
t | the time at which the field is calculated |
E | return value with electric field strength |
B | return value with magnetic field strength |
Reimplemented from VariableRFCavity.
Definition at line 156 of file VariableRFCavityFringeField.cpp.
References PartBunchBase< T, Dim >::P, PartBunchBase< T, Dim >::R, and Component::RefPartBunch_m.
Referenced by applyToReferenceParticle().
|
overridevirtual |
Calculate the field at a given position
R | the position at which the field is calculated |
P | the momentum (not used) |
t | the time at which the field is calculated |
E | return value; filled with electric field strength |
B | return value; filled with magnetic field strength |
Reimplemented from VariableRFCavity.
Definition at line 84 of file VariableRFCavityFringeField.cpp.
References VariableRFCavity::_length, abs(), VariableRFCavity::amplitudeTD_m, cos(), endField_m, f_m, VariableRFCavity::frequencyTD_m, g_m, h_m, VariableRFCavity::halfHeight_m, VariableRFCavity::halfWidth_m, maxOrder_m, Hypervolume::n, VariableRFCavity::phaseTD_m, Attrib::Distribution::R, sin(), Physics::two_pi, and zCentre_m.
|
overridevirtual |
Calculate the field at a given position. This is identical to "apply".
R | the position at which the field is calculated |
P | the momentum (not used) |
t | the time at which the field is calculated |
E | return value; filled with electric field strength |
B | return value; filled with magnetic field strength |
Reimplemented from VariableRFCavity.
Definition at line 161 of file VariableRFCavityFringeField.cpp.
References apply(), and Attrib::Distribution::R.
|
overridevirtual |
Inheritable deepcopy method
Reimplemented from VariableRFCavity.
Definition at line 65 of file VariableRFCavityFringeField.cpp.
References VariableRFCavityFringeField().
|
inline |
Get the coefficients for Bx
Definition at line 206 of file VariableRFCavityFringeField.h.
References h_m.
|
inlinevirtual |
Set the offset of centre of the cavity field from the element start in metres
Definition at line 177 of file VariableRFCavityFringeField.h.
References zCentre_m.
|
inlinevirtual |
Get the endFieldModel
Definition at line 191 of file VariableRFCavityFringeField.h.
References endField_m.
|
inline |
Get the coefficients for Ey
Definition at line 201 of file VariableRFCavityFringeField.h.
References g_m.
|
inline |
Get the coefficients for Ez
Definition at line 196 of file VariableRFCavityFringeField.h.
References f_m.
|
inlinevirtual |
Get the maximum y power that will be used in field calculations
Definition at line 186 of file VariableRFCavityFringeField.h.
References maxOrder_m.
|
overridevirtual |
Initialise ready for tracking
Does any setup on VirtualRFCavity and sets field expansion coefficients
Reimplemented from VariableRFCavity.
Definition at line 169 of file VariableRFCavityFringeField.cpp.
References VariableRFCavity::initialise(), and initialiseCoefficients().
void VariableRFCavityFringeField::initialiseCoefficients | ( | ) |
Set the coefficients for calculating the field expansion
Definition at line 186 of file VariableRFCavityFringeField.cpp.
References Physics::c, Physics::e, f_m, g_m, h_m, maxOrder_m, and Hypervolume::n.
Referenced by accept(), initialise(), and setMaxOrder().
|
private |
Definition at line 69 of file VariableRFCavityFringeField.cpp.
References endField_m, VariableRFCavity::initNull(), maxOrder_m, and zCentre_m.
Referenced by VariableRFCavityFringeField().
VariableRFCavityFringeField & VariableRFCavityFringeField::operator= | ( | const VariableRFCavityFringeField & | rhs | ) |
Assignment operator; performs deepcopy on time-dependence models
Definition at line 48 of file VariableRFCavityFringeField.cpp.
References endField_m, f_m, g_m, h_m, VariableRFCavity::operator=(), setEndField(), and zCentre_m.
void VariableRFCavityFringeField::printCoefficients | ( | std::ostream & | out | ) | const |
Print the coefficients to ostream out
Definition at line 226 of file VariableRFCavityFringeField.cpp.
References endl(), f_m, g_m, h_m, and printVector().
|
inlinevirtual |
Get the offset of centre of the cavity field from the element start in metres
Definition at line 173 of file VariableRFCavityFringeField.h.
References zCentre_m.
Referenced by OpalVariableRFCavityFringeField::update().
|
virtual |
Set the endFieldModel
endField | the new endFieldModel. VariableRFCavityFringe takes ownership of the memory allocated to endField. |
Definition at line 236 of file VariableRFCavityFringeField.cpp.
References end(), and endField_m.
Referenced by operator=(), and OpalVariableRFCavityFringeField::update().
|
inlinevirtual |
Set the maximum y power
Definition at line 181 of file VariableRFCavityFringeField.h.
References initialiseCoefficients(), and maxOrder_m.
Referenced by OpalVariableRFCavityFringeField::update().
|
protected |
Definition at line 165 of file VariableRFCavityFringeField.h.
Referenced by apply(), getEndField(), initNull(), operator=(), and setEndField().
|
protected |
Definition at line 166 of file VariableRFCavityFringeField.h.
Referenced by apply(), getEzCoefficients(), initialiseCoefficients(), operator=(), and printCoefficients().
|
protected |
Definition at line 167 of file VariableRFCavityFringeField.h.
Referenced by apply(), getEyCoefficients(), initialiseCoefficients(), operator=(), and printCoefficients().
|
protected |
Definition at line 168 of file VariableRFCavityFringeField.h.
Referenced by apply(), getBxCoefficients(), initialiseCoefficients(), operator=(), and printCoefficients().
|
protected |
Definition at line 164 of file VariableRFCavityFringeField.h.
Referenced by apply(), getMaxOrder(), initialiseCoefficients(), initNull(), and setMaxOrder().
|
protected |
Definition at line 163 of file VariableRFCavityFringeField.h.
Referenced by apply(), getCavityCentre(), initNull(), operator=(), and setCavityCentre().