OPAL (Object Oriented Parallel Accelerator Library)
2024.1
OPAL
|
#include <GreenWakeFunction.h>
Classes | |
class | Wake |
Public Member Functions | |
~GreenWakeFunction () | |
GreenWakeFunction (const std::string &name, std::vector< Filter * > filters, int NBIN, double Z0, double radius, double sigma, int acMode, double tau, WakeDirection direction, bool constLength, std::string fname) | |
std::pair< int, int > | distrIndices (int vectLen) |
given a vector of length N, distribute the indexes among the available processors More... | |
void | apply (PartBunchBase< double, 3 > *bunch) override |
void | setWakeFromFile (int NBin, double spacing) |
reads in the wakefield from file More... | |
virtual WakeType | getType () const override |
![]() | |
WakeFunction (std::string name, unsigned int n) | |
virtual | ~WakeFunction () |
virtual void | initialize (const ElementBase *) |
const std::string & | getName () const |
Private Member Functions | |
template<class F > | |
double | simpson (F &f, double a, double b, unsigned int N) |
Simpson-Integration from the function f from a to b with N steps. More... | |
void | compEnergy (const double K, const double charge, const double *lambda, double *OutEnergy) |
just a Testfunction! Calculate the energy of the Wakefunction with the lambda More... | |
void | compEnergy (const double K, const double charge, std::vector< double > lambda, double *OutEnergy) |
Calculate the energy of the Wakefunction with the lambda. More... | |
void | CalcWakeFFT (double spacing) |
Calculate the FFT of the Wakefunction. More... | |
Static Private Member Functions | |
static std::string | getWakeDirectionString (const WakeDirection &direction) |
Private Attributes | |
std::vector< double > | lineDensity_m |
save the line Density of the particle bunch More... | |
std::vector< double > | FftWField_m |
FFT of the zero padded wakefield. More... | |
int | NBin_m |
divides the particle bunch in NBin slices More... | |
double | Z0_m |
impedance More... | |
double | radius_m |
radius More... | |
double | sigma_m |
material constant More... | |
int | acMode_m |
conductivity either 1="AC" or 2="DC" More... | |
double | tau_m |
material constant More... | |
WakeDirection | direction_m |
direction either "Longitudinal" - "Transversal" More... | |
bool | constLength_m |
true if the length of the particle bunch is considered as constant More... | |
std::string | filename_m |
filename of the wakefield More... | |
std::vector< Filter * > | filters_m |
Static Private Attributes | |
static const std::map < WakeDirection, std::string > | wakeDirectiontoString_s |
Additional Inherited Members | |
![]() | |
const unsigned int | nBins_m |
Definition at line 42 of file GreenWakeFunction.h.
GreenWakeFunction::~GreenWakeFunction | ( | ) |
Definition at line 87 of file GreenWakeFunction.cpp.
GreenWakeFunction::GreenWakeFunction | ( | const std::string & | name, |
std::vector< Filter * > | filters, | ||
int | NBIN, | ||
double | Z0, | ||
double | radius, | ||
double | sigma, | ||
int | acMode, | ||
double | tau, | ||
WakeDirection | direction, | ||
bool | constLength, | ||
std::string | fname | ||
) |
In this code one can only apply either the longitudinal wakefield or the transversal wakefield. One should implement that both wakefields can be applied to the particle beam
NBins must be set equal to MT of the fieldsolver. This should be changed. (the length of lineDensity_m must be NBins and not to MT)
[in] | NBIN | number of Bins |
[in] | Z0 | impedance of the tube |
[in] | radius | radius of the tube |
[in] | sigma | material constant |
[in] | acMode | 1 for AC and 2 for DC |
[in] | tau | material constant |
[in] | direction | 0 for transversal and 1 for Longitudinal |
[in] | constLength | true if the length of the particle bunch is considered as constant |
[in] | fname | read wake from file |
Definition at line 56 of file GreenWakeFunction.cpp.
|
overridevirtual |
Implements WakeFunction.
Definition at line 119 of file GreenWakeFunction.cpp.
References abs(), Physics::c, PartBunchBase< T, Dim >::calcBeamParameters(), PartBunchBase< T, Dim >::calcLineDensity(), CalcWakeFFT(), compEnergy(), constLength_m, direction_m, PartBunchBase< T, Dim >::Ef, endl(), FftWField_m, filename_m, filters_m, floor(), PartBunchBase< T, Dim >::get_bounds(), PartBunchBase< T, Dim >::getChargePerParticle(), PartBunchBase< T, Dim >::getLocalNum(), gmsg, lineDensity_m, LONGITUDINAL, NBin_m, WakeFunction::nBins_m, PAssert, PartBunchBase< T, Dim >::R, setWakeFromFile(), sqrt(), TRANSVERSAL, and Z0_m.
|
private |
Calculate the FFT of the Wakefunction.
[in] | spacing | distance between 2 slice in the line distribution |
Calculate the Wakefield on all processors
Reduce the results
Definition at line 376 of file GreenWakeFunction.cpp.
References acMode_m, direction_m, distrIndices(), FftWField_m, NBin_m, radius_m, real(), reduce(), sigma_m, simpson(), tau_m, work, and Z0_m.
Referenced by apply().
|
private |
just a Testfunction! Calculate the energy of the Wakefunction with the lambda
[in] | K | a constant |
[in] | charge | a constant |
[in] | lambda | the distribution of the Particles |
[out] | OutEnergy | this is the Output |
Definition at line 259 of file GreenWakeFunction.cpp.
References FftWField_m, NBin_m, real(), and work.
Referenced by apply().
|
private |
Calculate the energy of the Wakefunction with the lambda.
[in] | K | a constant |
[in] | charge | a constant |
[in] | lambda | the distribution of the Particles |
[out] | OutEnergy | this is the Output |
Definition at line 319 of file GreenWakeFunction.cpp.
References FftWField_m, NBin_m, real(), and work.
std::pair< int, int > GreenWakeFunction::distrIndices | ( | int | vectLen | ) |
given a vector of length N, distribute the indexes among the available processors
[in] | length | of vector |
[out] | first,: | lowIndex, second: hiIndex |
Definition at line 104 of file GreenWakeFunction.cpp.
References IpplInfo::getNodes(), and IpplInfo::myNode().
Referenced by CalcWakeFFT().
|
overridevirtual |
Implements WakeFunction.
Definition at line 532 of file GreenWakeFunction.cpp.
References GreenWakeFunction.
|
staticprivate |
Definition at line 536 of file GreenWakeFunction.cpp.
References wakeDirectiontoString_s.
void GreenWakeFunction::setWakeFromFile | ( | int | NBin, |
double | spacing | ||
) |
reads in the wakefield from file
Definition at line 456 of file GreenWakeFunction.cpp.
References endl(), FftWField_m, filename_m, Hypervolume::fs, name, NBin_m, real(), and work.
Referenced by apply().
|
inlineprivate |
Simpson-Integration from the function f from a to b with N steps.
[in] | f | the function to integrate |
[in] | a | integrate from a |
[in] | b | integrate to b |
[in] | N | Number of integration points |
Definition at line 141 of file GreenWakeFunction.h.
References PAssert, and test::result.
Referenced by CalcWakeFFT().
|
private |
conductivity either 1="AC" or 2="DC"
Definition at line 175 of file GreenWakeFunction.h.
Referenced by CalcWakeFFT().
|
private |
true if the length of the particle bunch is considered as constant
Definition at line 181 of file GreenWakeFunction.h.
Referenced by apply().
|
private |
direction either "Longitudinal" - "Transversal"
Definition at line 179 of file GreenWakeFunction.h.
Referenced by apply(), and CalcWakeFFT().
|
private |
FFT of the zero padded wakefield.
Definition at line 164 of file GreenWakeFunction.h.
Referenced by apply(), CalcWakeFFT(), compEnergy(), and setWakeFromFile().
|
private |
filename of the wakefield
Definition at line 183 of file GreenWakeFunction.h.
Referenced by apply(), and setWakeFromFile().
|
private |
Definition at line 185 of file GreenWakeFunction.h.
Referenced by apply().
|
private |
save the line Density of the particle bunch
Definition at line 162 of file GreenWakeFunction.h.
Referenced by apply().
|
private |
divides the particle bunch in NBin slices
Definition at line 167 of file GreenWakeFunction.h.
Referenced by apply(), CalcWakeFFT(), compEnergy(), and setWakeFromFile().
|
private |
|
private |
|
private |
|
staticprivate |
Definition at line 187 of file GreenWakeFunction.h.
Referenced by getWakeDirectionString().
|
private |
impedance
Definition at line 169 of file GreenWakeFunction.h.
Referenced by apply(), and CalcWakeFFT().