OPAL (Object Oriented Parallel Accelerator Library)  2021.1.99
OPAL
Public Member Functions | Protected Attributes | Private Member Functions | List of all members
VariableRFCavityFringeField Class Reference

#include <VariableRFCavityFringeField.h>

Inheritance diagram for VariableRFCavityFringeField:
Inheritance graph
[legend]
Collaboration diagram for VariableRFCavityFringeField:
Collaboration graph
[legend]

Public Member Functions

 VariableRFCavityFringeField (const std::string &name)
 Constructor with given name. More...
 
 VariableRFCavityFringeField (const VariableRFCavityFringeField &)
 
 VariableRFCavityFringeField ()
 
VariableRFCavityFringeFieldoperator= (const VariableRFCavityFringeField &)
 
virtual ~VariableRFCavityFringeField ()
 
virtual void accept (BeamlineVisitor &) const override
 
virtual ElementBaseclone () 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::EndFieldModelgetEndField () 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 ()
 
VariableRFCavityoperator= (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< AbstractTimeDependencegetAmplitudeModel () const
 
virtual std::shared_ptr< AbstractTimeDependencegetPhaseModel () const
 
virtual std::shared_ptr< AbstractTimeDependencegetFrequencyModel () 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 StraightGeometrygetGeometry () override
 
virtual const StraightGeometrygetGeometry () const override
 
virtual EMFieldgetField () override
 Not implemented. More...
 
virtual const EMFieldgetField () 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 ElementBasegetDesign () 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 ChannelgetChannel (const std::string &aKey, bool create=false)
 Construct a read/write channel. More...
 
virtual const ConstChannelgetConstChannel (const std::string &aKey) const
 Construct a read-only channel. More...
 
virtual ElementBasecopyStructure ()
 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 BoundaryGeometrygetBoundaryGeometry () 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 WakeFunctiongetWake () const
 return the attached wake object if there is any More...
 
virtual bool hasWake () const
 
virtual void setParticleMatterInteraction (ParticleMatterInteractionHandler *spys)
 
virtual ParticleMatterInteractionHandlergetParticleMatterInteraction () 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::EndFieldModelendField_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< AbstractTimeDependencephaseTD_m
 
std::shared_ptr< AbstractTimeDependenceamplitudeTD_m
 
std::shared_ptr< AbstractTimeDependencefrequencyTD_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
 
RCObjectoperator= (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
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ VariableRFCavityFringeField() [1/3]

VariableRFCavityFringeField::VariableRFCavityFringeField ( const std::string &  name)
explicit

Constructor with given name.

Definition at line 35 of file VariableRFCavityFringeField.cpp.

References initNull().

Here is the call graph for this function:

◆ VariableRFCavityFringeField() [2/3]

VariableRFCavityFringeField::VariableRFCavityFringeField ( const VariableRFCavityFringeField var)

Copy Constructor; performs deepcopy on time-dependence models

Definition at line 43 of file VariableRFCavityFringeField.cpp.

References initNull().

Here is the call graph for this function:

◆ VariableRFCavityFringeField() [3/3]

VariableRFCavityFringeField::VariableRFCavityFringeField ( )

Default constructor

Definition at line 39 of file VariableRFCavityFringeField.cpp.

References initNull().

Referenced by clone().

Here is the call graph for this function:

◆ ~VariableRFCavityFringeField()

VariableRFCavityFringeField::~VariableRFCavityFringeField ( )
virtual

Destructor does nothing

The shared_ptrs will self-destruct when reference count goes to 0

Definition at line 62 of file VariableRFCavityFringeField.cpp.

Member Function Documentation

◆ accept()

void VariableRFCavityFringeField::accept ( BeamlineVisitor visitor) const
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().

Here is the call graph for this function:

◆ apply() [1/2]

bool VariableRFCavityFringeField::apply ( const size_t &  i,
const double &  t,
Vector_t E,
Vector_t B 
)
overridevirtual

Calculate the field at the position of the i^th particle

Parameters
iindexes the particle whose field we need
tthe time at which the field is calculated
Ereturn value with electric field strength
Breturn value with magnetic field strength
Returns
True if particle is outside the boundaries; else False

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().

◆ apply() [2/2]

bool VariableRFCavityFringeField::apply ( const Vector_t R,
const Vector_t P,
const double &  t,
Vector_t E,
Vector_t B 
)
overridevirtual

Calculate the field at a given position

Parameters
Rthe position at which the field is calculated
Pthe momentum (not used)
tthe time at which the field is calculated
Ereturn value; filled with electric field strength
Breturn value; filled with magnetic field strength
Returns
True if particle is outside the boundaries; else False

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.

Here is the call graph for this function:

◆ applyToReferenceParticle()

bool VariableRFCavityFringeField::applyToReferenceParticle ( const Vector_t R,
const Vector_t P,
const double &  t,
Vector_t E,
Vector_t B 
)
overridevirtual

Calculate the field at a given position. This is identical to "apply".

Parameters
Rthe position at which the field is calculated
Pthe momentum (not used)
tthe time at which the field is calculated
Ereturn value; filled with electric field strength
Breturn value; filled with magnetic field strength
Returns
True if particle is outside the boundaries; else False

Reimplemented from VariableRFCavity.

Definition at line 161 of file VariableRFCavityFringeField.cpp.

References apply(), and Attrib::Distribution::R.

Here is the call graph for this function:

◆ clone()

ElementBase * VariableRFCavityFringeField::clone ( ) const
overridevirtual

Inheritable deepcopy method

Reimplemented from VariableRFCavity.

Definition at line 65 of file VariableRFCavityFringeField.cpp.

References VariableRFCavityFringeField().

Here is the call graph for this function:

◆ getBxCoefficients()

std::vector< std::vector< double > > VariableRFCavityFringeField::getBxCoefficients ( ) const
inline

Get the coefficients for Bx

Definition at line 206 of file VariableRFCavityFringeField.h.

References h_m.

◆ getCavityCentre()

double VariableRFCavityFringeField::getCavityCentre ( ) const
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.

◆ getEndField()

std::shared_ptr< endfieldmodel::EndFieldModel > VariableRFCavityFringeField::getEndField ( ) const
inlinevirtual

Get the endFieldModel

Returns
the endFieldModel; VariableRFCavityFringe retains ownership of the memory allocated to the endFieldModel.

Definition at line 191 of file VariableRFCavityFringeField.h.

References endField_m.

◆ getEyCoefficients()

std::vector< std::vector< double > > VariableRFCavityFringeField::getEyCoefficients ( ) const
inline

Get the coefficients for Ey

Definition at line 201 of file VariableRFCavityFringeField.h.

References g_m.

◆ getEzCoefficients()

std::vector< std::vector< double > > VariableRFCavityFringeField::getEzCoefficients ( ) const
inline

Get the coefficients for Ez

Definition at line 196 of file VariableRFCavityFringeField.h.

References f_m.

◆ getMaxOrder()

size_t VariableRFCavityFringeField::getMaxOrder ( ) const
inlinevirtual

Get the maximum y power that will be used in field calculations

Definition at line 186 of file VariableRFCavityFringeField.h.

References maxOrder_m.

◆ initialise()

void VariableRFCavityFringeField::initialise ( PartBunchBase< double, 3 > *  bunch,
double &  startField,
double &  endField 
)
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().

Here is the call graph for this function:

◆ 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().

◆ initNull()

void VariableRFCavityFringeField::initNull ( )
private

Definition at line 69 of file VariableRFCavityFringeField.cpp.

References endField_m, VariableRFCavity::initNull(), maxOrder_m, and zCentre_m.

Referenced by VariableRFCavityFringeField().

Here is the call graph for this function:

◆ operator=()

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.

Here is the call graph for this function:

◆ printCoefficients()

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().

Here is the call graph for this function:

◆ setCavityCentre()

void VariableRFCavityFringeField::setCavityCentre ( double  zCentre)
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().

◆ setEndField()

void VariableRFCavityFringeField::setEndField ( std::shared_ptr< endfieldmodel::EndFieldModel endField)
virtual

Set the endFieldModel

Parameters
endFieldthe 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().

Here is the call graph for this function:

◆ setMaxOrder()

void VariableRFCavityFringeField::setMaxOrder ( size_t  maxOrder)
inlinevirtual

Set the maximum y power

Definition at line 181 of file VariableRFCavityFringeField.h.

References initialiseCoefficients(), and maxOrder_m.

Referenced by OpalVariableRFCavityFringeField::update().

Here is the call graph for this function:

Member Data Documentation

◆ endField_m

std::shared_ptr<endfieldmodel::EndFieldModel> VariableRFCavityFringeField::endField_m
protected

Definition at line 165 of file VariableRFCavityFringeField.h.

Referenced by apply(), getEndField(), initNull(), operator=(), and setEndField().

◆ f_m

std::vector<std::vector<double> > VariableRFCavityFringeField::f_m
protected

◆ g_m

std::vector<std::vector<double> > VariableRFCavityFringeField::g_m
protected

◆ h_m

std::vector<std::vector<double> > VariableRFCavityFringeField::h_m
protected

◆ maxOrder_m

size_t VariableRFCavityFringeField::maxOrder_m
protected

◆ zCentre_m

double VariableRFCavityFringeField::zCentre_m
protected

The documentation for this class was generated from the following files: