OPAL (Object Oriented Parallel Accelerator Library) 2024.2
OPAL
GreenWakeFunction Class Reference

#include <GreenWakeFunction.h>

Inheritance diagram for GreenWakeFunction:
Collaboration diagram for GreenWakeFunction:

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
void apply (PartBunchBase< double, 3 > *bunch) override
void setWakeFromFile (int NBin, double spacing)
 reads in the wakefield from file
virtual WakeType getType () const override
virtual void initialize (const ElementBase *)
const std::string & getName () const

Protected Attributes

const unsigned int nBins_m

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.
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
void compEnergy (const double K, const double charge, std::vector< double > lambda, double *OutEnergy)
 Calculate the energy of the Wakefunction with the lambda.
void CalcWakeFFT (double spacing)
 Calculate the FFT of the Wakefunction.

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
std::vector< double > FftWField_m
 FFT of the zero padded wakefield.
int NBin_m
 divides the particle bunch in NBin slices
double Z0_m
 impedance
double radius_m
 radius
double sigma_m
 material constant
int acMode_m
 conductivity either 1="AC" or 2="DC"
double tau_m
 material constant
WakeDirection direction_m
 direction either "Longitudinal" - "Transversal"
bool constLength_m
 true if the length of the particle bunch is considered as constant
std::string filename_m
 filename of the wakefield
std::vector< Filter * > filters_m
const std::string name_m

Static Private Attributes

static const std::map< WakeDirection, std::string > wakeDirectiontoString_s

Detailed Description

Definition at line 42 of file GreenWakeFunction.h.

Constructor & Destructor Documentation

◆ ~GreenWakeFunction()

GreenWakeFunction::~GreenWakeFunction ( )

Definition at line 87 of file GreenWakeFunction.cpp.

◆ GreenWakeFunction()

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 )
Todo

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)

Parameters
[in]NBINnumber of Bins
[in]Z0impedance of the tube
[in]radiusradius of the tube
[in]sigmamaterial constant
[in]acMode1 for AC and 2 for DC
[in]taumaterial constant
[in]direction0 for transversal and 1 for Longitudinal
[in]constLengthtrue if the length of the particle bunch is considered as constant
[in]fnameread wake from file

Definition at line 56 of file GreenWakeFunction.cpp.

References acMode_m, begin(), constLength_m, direction_m, end(), endl(), filename_m, filters_m, gmsg, lineDensity_m, name, NBin_m, radius_m, sigma_m, tau_m, WakeFunction::WakeFunction(), and Z0_m.

Here is the call graph for this function:

Member Function Documentation

◆ apply()

◆ CalcWakeFFT()

void GreenWakeFunction::CalcWakeFFT ( double spacing)
private

Calculate the FFT of the Wakefunction.

Parameters
[in]spacingdistance 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 a, acMode_m, direction_m, distrIndices(), FftWField_m, NBin_m, radius_m, real(), reduce(), sigma_m, simpson(), tau_m, and Z0_m.

Referenced by apply().

Here is the call graph for this function:

◆ compEnergy() [1/2]

void GreenWakeFunction::compEnergy ( const double K,
const double charge,
const double * lambda,
double * OutEnergy )
private

just a Testfunction! Calculate the energy of the Wakefunction with the lambda

Parameters
[in]Ka constant
[in]chargea constant
[in]lambdathe distribution of the Particles
[out]OutEnergythis is the Output

Definition at line 259 of file GreenWakeFunction.cpp.

References FftWField_m, NBin_m, and real().

Referenced by apply().

Here is the call graph for this function:

◆ compEnergy() [2/2]

void GreenWakeFunction::compEnergy ( const double K,
const double charge,
std::vector< double > lambda,
double * OutEnergy )
private

Calculate the energy of the Wakefunction with the lambda.

Parameters
[in]Ka constant
[in]chargea constant
[in]lambdathe distribution of the Particles
[out]OutEnergythis is the Output

Definition at line 319 of file GreenWakeFunction.cpp.

References FftWField_m, NBin_m, and real().

Here is the call graph for this function:

◆ distrIndices()

std::pair< int, int > GreenWakeFunction::distrIndices ( int vectLen)

given a vector of length N, distribute the indexes among the available processors

Todo
make this function general available
Parameters
[in]lengthof vector
[out]firstlowIndex, second: hiIndex

Definition at line 104 of file GreenWakeFunction.cpp.

References IpplInfo::getNodes(), and IpplInfo::myNode().

Referenced by CalcWakeFFT().

Here is the call graph for this function:

◆ getName()

const std::string & WakeFunction::getName ( ) const
inlineinherited

Definition at line 49 of file WakeFunction.h.

References name_m.

◆ getType()

WakeType GreenWakeFunction::getType ( ) const
overridevirtual

Implements WakeFunction.

Definition at line 532 of file GreenWakeFunction.cpp.

References GreenWakeFunction.

◆ getWakeDirectionString()

std::string GreenWakeFunction::getWakeDirectionString ( const WakeDirection & direction)
staticprivate

Definition at line 536 of file GreenWakeFunction.cpp.

References wakeDirectiontoString_s.

◆ initialize()

virtual void WakeFunction::initialize ( const ElementBase * )
inlinevirtualinherited

Reimplemented in CSRIGFWakeFunction, and CSRWakeFunction.

Definition at line 43 of file WakeFunction.h.

Referenced by ParallelTTracker::computeWakefield().

◆ setWakeFromFile()

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, name, NBin_m, and real().

Referenced by apply().

Here is the call graph for this function:

◆ simpson()

template<class F>
double GreenWakeFunction::simpson ( F & f,
double a,
double b,
unsigned int N )
inlineprivate

Simpson-Integration from the function f from a to b with N steps.

Parameters
[in]fthe function to integrate
[in]aintegrate from a
[in]bintegrate to b
[in]NNumber of integration points
Returns
function value of the integration

Definition at line 141 of file GreenWakeFunction.h.

References a, and PAssert.

Referenced by CalcWakeFFT().

Member Data Documentation

◆ acMode_m

int GreenWakeFunction::acMode_m
private

conductivity either 1="AC" or 2="DC"

Definition at line 175 of file GreenWakeFunction.h.

Referenced by CalcWakeFFT(), and GreenWakeFunction().

◆ constLength_m

bool GreenWakeFunction::constLength_m
private

true if the length of the particle bunch is considered as constant

Definition at line 181 of file GreenWakeFunction.h.

Referenced by apply(), and GreenWakeFunction().

◆ direction_m

WakeDirection GreenWakeFunction::direction_m
private

direction either "Longitudinal" - "Transversal"

Definition at line 179 of file GreenWakeFunction.h.

Referenced by apply(), CalcWakeFFT(), and GreenWakeFunction().

◆ FftWField_m

std::vector<double> GreenWakeFunction::FftWField_m
private

FFT of the zero padded wakefield.

Definition at line 164 of file GreenWakeFunction.h.

Referenced by apply(), CalcWakeFFT(), compEnergy(), compEnergy(), and setWakeFromFile().

◆ filename_m

std::string GreenWakeFunction::filename_m
private

filename of the wakefield

Definition at line 183 of file GreenWakeFunction.h.

Referenced by apply(), GreenWakeFunction(), and setWakeFromFile().

◆ filters_m

std::vector<Filter*> GreenWakeFunction::filters_m
private

Definition at line 185 of file GreenWakeFunction.h.

Referenced by apply(), and GreenWakeFunction().

◆ lineDensity_m

std::vector<double> GreenWakeFunction::lineDensity_m
private

save the line Density of the particle bunch

Definition at line 162 of file GreenWakeFunction.h.

Referenced by apply(), and GreenWakeFunction().

◆ name_m

const std::string WakeFunction::name_m
privateinherited

Definition at line 55 of file WakeFunction.h.

Referenced by getName(), and WakeFunction().

◆ NBin_m

int GreenWakeFunction::NBin_m
private

divides the particle bunch in NBin slices

Definition at line 167 of file GreenWakeFunction.h.

Referenced by apply(), CalcWakeFFT(), compEnergy(), compEnergy(), GreenWakeFunction(), and setWakeFromFile().

◆ nBins_m

const unsigned int WakeFunction::nBins_m
protectedinherited

◆ radius_m

double GreenWakeFunction::radius_m
private

radius

Definition at line 171 of file GreenWakeFunction.h.

Referenced by CalcWakeFFT(), and GreenWakeFunction().

◆ sigma_m

double GreenWakeFunction::sigma_m
private

material constant

Definition at line 173 of file GreenWakeFunction.h.

Referenced by CalcWakeFFT(), and GreenWakeFunction().

◆ tau_m

double GreenWakeFunction::tau_m
private

material constant

Definition at line 177 of file GreenWakeFunction.h.

Referenced by CalcWakeFFT(), and GreenWakeFunction().

◆ wakeDirectiontoString_s

const std::map< WakeDirection, std::string > GreenWakeFunction::wakeDirectiontoString_s
staticprivate
Initial value:

Definition at line 36 of file GreenWakeFunction.h.

Referenced by getWakeDirectionString().

◆ Z0_m

double GreenWakeFunction::Z0_m
private

impedance

Definition at line 169 of file GreenWakeFunction.h.

Referenced by apply(), CalcWakeFFT(), and GreenWakeFunction().


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