OPAL (Object Oriented Parallel Accelerator Library) 2024.2
OPAL
OpalUndulator.cpp
Go to the documentation of this file.
1//
2// Class OpalUndulator
3// Defines the Undulator/Wiggler element and its attributes.
4//
5// Copyright (c) 2020, Arnau AlbĂ , Paul Scherrer Institut, Villigen PSI, Switzerland
6// All rights reserved.
7//
8// Implemented as part of the MSc thesis
9// "Start-to-End Modelling of the AWA Micro-Bunched Electron Cooling POP-Experiment"
10//
11// This file is part of OPAL.
12//
13// OPAL is free software: you can redistribute it and/or modify
14// it under the terms of the GNU General Public License as published by
15// the Free Software Foundation, either version 3 of the License, or
16// (at your option) any later version.
17//
18// You should have received a copy of the GNU General Public License
19// along with OPAL. If not, see <https://www.gnu.org/licenses/>.
20//
22
25
27 : OpalElement(SIZE, "UNDULATOR", "The \"UNDULATOR\" element defines an undulator or wiggler.") {
28 itsAttr[K] = Attributes::makeReal("K", "Undulator strength parameter [unitless].", 1);
29
30 itsAttr[LAMBDA] = Attributes::makeReal("LAMBDA", "Undulator period [m].", 0.0);
31
32 itsAttr[NUMPERIODS] = Attributes::makeReal("NUMPERIODS", "Number of undulator periods.", 0.0);
33
35 "ANGLE", "Polarisation angle of the undulator magnetic field [rad].", 0.0);
36
38 "FNAME", "Jobfile specifying the output data from the undulator.", "");
39
41 Attributes::makeRealArray("MESHLENGTH", "Size of computational mesh [m].");
42
44 Attributes::makeRealArray("MESHRESOLUTION", "{dx, dy, dz} of the mesh [m].");
45
47 Attributes::makeReal("TRUNORDER", "Order of absorbing boundary conditions. 1st or 2nd.", 2);
48
50 Attributes::makeReal("TOTALTIME", "Total time of the full-wave simulation [s].", 0.0);
51
53 "DTBUNCH",
54 "Time step for the particle update can be smaller than the field update step [s].", 0.0);
55
57
58 setElement(new UndulatorRep("UNDULATOR"));
59}
60
62 : OpalElement(name, parent) {
64}
65
68
70 return new OpalUndulator(name, this);
71}
72
75
76 UndulatorRep* ur = static_cast<UndulatorRep*>(getElement());
77 /* The element length is given by the number and length of the undulator periods, plus the
78 * length of the two fringe fields, each measuring 2 * lambda. */
91
92 // Transmit "unknown" attributes.
94}
const std::string name
double getReal(const Attribute &attr)
Return real value.
Attribute makeReal(const std::string &name, const std::string &help)
Make real attribute.
Attribute makeRealArray(const std::string &name, const std::string &help)
Create real array attribute.
std::vector< double > getRealArray(const Attribute &attr)
Get array value.
std::string getString(const Attribute &attr)
Get string value.
Attribute makeString(const std::string &name, const std::string &help)
Make string attribute.
ElementBase * getElement() const
Return the embedded CLASSIC element.
Definition Element.h:120
void setElement(ElementBase *)
Assign new CLASSIC element.
Definition Element.h:125
std::vector< Attribute > itsAttr
The object attributes.
Definition Object.h:216
virtual void setElementLength(double length)
Set design length.
void setAngle(double theta)
void setMeshLength(const std::vector< double > &ml)
void setLambda(double lambda)
void setFilename(const std::string &fname)
void setTotalTime(double tt)
void setTruncationOrder(unsigned int trunOrder)
void setNumPeriods(unsigned int np)
void setDtBunch(double dtb)
void setMeshResolution(const std::vector< double > &mr)
void setK(double k)
virtual void updateUnknown(ElementBase *)
Transmit the ``unknown'' (not known to OPAL) attributes to CLASSIC.
virtual void update()
Update the embedded CLASSIC element.
OpalElement(int size, const char *name, const char *help)
Exemplar constructor.
void registerOwnership() const
virtual void update()
Update the embedded CLASSIC drift.
virtual ~OpalUndulator()
virtual OpalUndulator * clone(const std::string &name)
Make clone.
OpalUndulator()
Exemplar constructor.