OPAL (Object Oriented Parallel Accelerator Library) 2024.2
OPAL
Undulator.h
Go to the documentation of this file.
1//
2// Class Undulator
3// Defines all the methods used by the Undulator element.
4// The Undulator element uses a full wave solver from the
5// MITHRA library, see <https://github.com/aryafallahi/mithra/>.
6//
7// Copyright (c) 2020, Arnau AlbĂ , Paul Scherrer Institut, Villigen PSI, Switzerland
8// All rights reserved.
9//
10// Implemented as part of the MSc thesis
11// "Start-to-End Modelling of the AWA Micro-Bunched Electron Cooling POP-Experiment"
12//
13// This file is part of OPAL.
14//
15// OPAL is free software: you can redistribute it and/or modify
16// it under the terms of the GNU General Public License as published by
17// the Free Software Foundation, either version 3 of the License, or
18// (at your option) any later version.
19//
20// You should have received a copy of the GNU General Public License
21// along with OPAL. If not, see <https://www.gnu.org/licenses/>.
22//
23#ifndef CLASSIC_Undulator_HH
24#define CLASSIC_Undulator_HH
25
26#include <string>
27#include <vector>
28
30
31class Undulator : public Component {
32public:
34 explicit Undulator(const std::string& name);
35
36 Undulator();
37 Undulator(const Undulator& right);
38 virtual ~Undulator();
39
41 virtual void accept(BeamlineVisitor&) const;
42
43 virtual void initialise(PartBunchBase<double, 3>* bunch, double& startField, double& endField);
44
45 using Component::apply;
46 void apply(PartBunchBase<double, 3>* itsBunch, CoordinateSystemTrafo const& refToLocalCSTrafo);
47
48 virtual void finalise();
49
50 virtual bool bends() const;
51
52 virtual ElementType getType() const;
53
54 virtual void getDimensions(double& zBegin, double& zEnd) const;
55
56 void setK(double k);
57 double getK() const;
58 void setLambda(double lambda);
59 double getLambda() const;
60 void setNumPeriods(unsigned int np);
61 unsigned int getNumPeriods() const;
62 void setAngle(double theta);
63 double getAngle() const;
64 void setFilename(const std::string& fname);
65 const std::string& getFilename() const;
66 void setMeshLength(const std::vector<double>& ml);
67 std::vector<double> getMeshLength() const;
68 void setMeshResolution(const std::vector<double>& mr);
69 std::vector<double> getMeshResolution() const;
70 void setTruncationOrder(unsigned int trunOrder);
71 unsigned int getTruncationOrder() const;
72 void setTotalTime(double tt);
73 double getTotalTime() const;
74 void setDtBunch(double dtb);
75 double getDtBunch() const;
76 void setHasBeenSimulated(bool hbs);
77 bool getHasBeenSimulated() const;
78
79private:
81 double k_m;
82
84 double lambda_m;
85
87 unsigned int numPeriods_m;
88
90 double angle_m;
91
93 std::string fname_m;
94
96 std::vector<double> meshLength_m;
97
99 std::vector<double> meshResolution_m;
100
102 unsigned int truncationOrder_m;
103
106
108 double dtBunch_m;
109
112
113 // Not implemented.
114 void operator=(const Undulator&);
115};
116
117#endif // CLASSIC_Undulator_HH
ElementType
Definition ElementBase.h:88
const std::string name
virtual bool apply(const size_t &i, const double &t, Vector_t &E, Vector_t &B)
Definition Component.cpp:99
Component(const std::string &name)
Constructor with given name.
Definition Component.cpp:53
virtual ElementType getType() const
Get element type std::string.
unsigned int numPeriods_m
Number of periods.
Definition Undulator.h:87
void setAngle(double theta)
double angle_m
Polarisation angle of the undulator field.
Definition Undulator.h:90
double getK() const
std::vector< double > getMeshLength() const
double lambda_m
Undulator period.
Definition Undulator.h:84
std::vector< double > meshResolution_m
Mesh dx, dy, dz.
Definition Undulator.h:99
std::string fname_m
Mithra file with output information.
Definition Undulator.h:93
double totalTime_m
Total time to run undulator.
Definition Undulator.h:105
virtual ~Undulator()
Definition Undulator.cpp:75
void setMeshLength(const std::vector< double > &ml)
void apply(PartBunchBase< double, 3 > *itsBunch, CoordinateSystemTrafo const &refToLocalCSTrafo)
Definition Undulator.cpp:87
void setLambda(double lambda)
void setFilename(const std::string &fname)
double getDtBunch() const
void setTotalTime(double tt)
virtual void finalise()
void setTruncationOrder(unsigned int trunOrder)
void setNumPeriods(unsigned int np)
virtual bool bends() const
unsigned int getTruncationOrder() const
virtual void initialise(PartBunchBase< double, 3 > *bunch, double &startField, double &endField)
Definition Undulator.cpp:82
double getTotalTime() const
double dtBunch_m
Time step for the bunch position update.
Definition Undulator.h:108
const std::string & getFilename() const
bool getHasBeenSimulated() const
unsigned int getNumPeriods() const
void setDtBunch(double dtb)
Undulator(const std::string &name)
Constructor with given name.
Definition Undulator.cpp:60
void operator=(const Undulator &)
double getAngle() const
std::vector< double > getMeshResolution() const
std::vector< double > meshLength_m
Size of computational domain.
Definition Undulator.h:96
void setMeshResolution(const std::vector< double > &mr)
bool hasBeenSimulated_m
Boolean to indicate whether this undulator has already been simulated.
Definition Undulator.h:111
double getLambda() const
void setK(double k)
virtual void getDimensions(double &zBegin, double &zEnd) const
virtual void accept(BeamlineVisitor &) const
Apply visitor to Undulator.
Definition Undulator.cpp:78
double k_m
The undulator parameter.
Definition Undulator.h:81
void setHasBeenSimulated(bool hbs)
unsigned int truncationOrder_m
First or second order absorbing boundary conditions.
Definition Undulator.h:102