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

core of the envelope tracker based on Rene Bakkers BET implementation More...

#include <EnvelopeBunch.h>

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

Public Member Functions

 EnvelopeBunch (const PartData *ref)
 Default constructor. More...
 
 EnvelopeBunch (const std::vector< OpalParticle > &, const PartData *ref)
 Conversion. More...
 
 EnvelopeBunch (const EnvelopeBunch &)=delete
 Copy constructor (implement if needed) More...
 
virtual ~EnvelopeBunch ()
 
void createBunch ()
 create and initialize local num slices More...
 
void distributeSlices (int nSlice=101)
 distributes nSlice amongst processors and initializes slices More...
 
void initialize (int sli, double charge, double energy, double width, double te, double frac, double current, double center, double bX, double bY, double mX, double mY, double Bz, int nbin)
 
bool isRadial ()
 check if solver includes radial More...
 
bool isOffaxis ()
 check if solver includes off-axis tracking More...
 
void calcBeamParameters ()
 calculates envelope statistics More...
 
void computeSpaceCharge ()
 
void timeStep (double tStep, double zCat=0.0)
 performs a time-step for all active slices (also handles emission) More...
 
void derivs (double tc, double Y[], double dYdt[])
 helper function to calculate derivatives need in RH equation More...
 
double Eavg ()
 calculate the average energy of the bunch More...
 
double zAvg ()
 calculate <z> [m] More...
 
double zTail ()
 calculate tail of bunch [m] More...
 
double zHead ()
 calculate the head of the bunch [m] More...
 
double time ()
 read time-stamp of bunch More...
 
void setEx (double emi)
 set emittance X More...
 
void setEy (double emi)
 set emittance Y More...
 
void setSolverParameter (int s)
 set the DE solver flag More...
 
void setEnergy (double, double=0.0)
 
void setExternalFields (int i, const Vector_t &EF, const Vector_t &BF, const Vector_t &KR, const Vector_t &KT)
 
void getExternalFields (int i, Vector_t &EF, Vector_t &BF, Vector_t &KR, Vector_t &KT) const
 
double get_sPos ()
 return reference position More...
 
double AvBField ()
 returns average magnetic field More...
 
double AvEField ()
 returns average electric field More...
 
int getLocalNum ()
 returns the number of local slices More...
 
int getTotalNum ()
 returns the total number of slices More...
 
double getT ()
 returns the current time of the bunch More...
 
double get_meanKineticEnergy ()
 returns the mean energy More...
 
double get_dEdt ()
 returns the energy spread More...
 
Vector_t sigmax ()
 returns vector with rms position More...
 
Vector_t sigmap ()
 returns vector with rms momenta More...
 
Vector_t emtn ()
 returns vector with emittance More...
 
Vector_t get_norm_emit ()
 returns vector with normalized emittance More...
 
Vector_t maxX ()
 returns vector with the max spatial extends of the bunch More...
 
Vector_t minX ()
 returns vector with the min spatial extends of the bunch More...
 
Vector_t maxP ()
 returns vector with the max momentum of the bunch More...
 
Vector_t minP ()
 returns vector with the min momentum of the bunch More...
 
double getChargePerParticle ()
 returns charge per slice More...
 
Vector_t get_rrms ()
 returns RMS x,y,z More...
 
Vector_t get_prms ()
 returns RMSP x,y,z More...
 
size_t mySliceStartOffset ()
 
size_t mySliceEndOffset ()
 
size_t numMySlices ()
 
Informslprint (Inform &os)
 
void setCharge (double _Q)
 set the charge of the bunch More...
 
double getGamma (int i)
 returns gamma of slice i More...
 
double getBeta (int i)
 returns beta of slice i More...
 
void setBeta (int i, double val)
 
void setR (int i, const Vector_t &R)
 
Vector_t getR (int i)
 
void setP (int i, const Vector_t &P)
 
Vector_t getP (int i)
 
void setZ (int i, double coo)
 set Z coordinate of slice i More...
 
double getZ (int i)
 returns Z coordinate of slice i More...
 
double getX (int i)
 returns X coordinate of slice i More...
 
void setX (int i, double val)
 
double getY (int i)
 returns Y coordinate of slice i More...
 
void setY (int i, double val)
 
double getX0 (int i)
 returns X coordinate of the centroid of slice i More...
 
void setX0 (int i, double val)
 
double getY0 (int i)
 returns Y coordinate of the centroid of slice i More...
 
void setY0 (int i, double val)
 
double getPx (int i)
 returns X momenta of slice i More...
 
void setPx (int i, double val)
 
double getPy (int i)
 returns Y momenta of slice i More...
 
void setPy (int i, double val)
 
double getPz (int i)
 returns Z momenta of slice i More...
 
double getPx0 (int i)
 returns angular deflection centroid in x of slice i More...
 
void setPx0 (int i, double val)
 
double getPy0 (int i)
 returns angular deflection centroid in y of slice i More...
 
void setPy0 (int i, double val)
 
void get_bounds (Vector_t &min, Vector_t &max)
 returns bounds of envelope bunch More...
 
- Public Member Functions inherited from PartBunch
 PartBunch (const PartData *ref)
 Default constructor. More...
 
 PartBunch ()=delete
 
 PartBunch (const PartBunch &)=delete
 
PartBunchoperator= (const PartBunch &)=delete
 
 ~PartBunch ()
 
void runTests ()
 
void initialize (FieldLayout_t *fLayout)
 
void do_binaryRepart ()
 
double getRho (int x, int y, int z)
 
const Mesh_tgetMesh () const
 
Mesh_tgetMesh ()
 
FieldLayout_tgetFieldLayout ()
 
void setBCAllPeriodic ()
 
void setBCAllOpen ()
 
void setBCForDCBeam ()
 
VectorPair_t getEExtrema ()
 
void computeSelfFields ()
 
void computeSelfFields (int b)
 
void computeSelfFields_cycl (double gamma)
 Calculates the self electric field from the charge density distribution for use in cyclotrons. More...
 
void computeSelfFields_cycl (int b)
 Calculates the self electric field from the charge density distribution for use in cyclotrons. More...
 
void resetInterpolationCache (bool clearCache=false)
 
void swap (unsigned int i, unsigned int j)
 
Informprint (Inform &os)
 
- Public Member Functions inherited from PartBunchBase< double, 3 >
 PartBunchBase (AbstractParticle< double, Dim > *pb)
 
 PartBunchBase (AbstractParticle< double, Dim > *pb, const PartData *ref)
 
 PartBunchBase (const PartBunchBase &rhs)=delete
 
virtual ~PartBunchBase ()
 
bool getIfBeamEmitting ()
 
int getLastEmittedEnergyBin ()
 
size_t getNumberOfEmissionSteps ()
 
int getNumberOfEnergyBins ()
 
void Rebin ()
 
void setEnergyBins (int numberOfEnergyBins)
 
bool weHaveEnergyBins ()
 
void switchToUnitlessPositions (bool use_dt_per_particle=false)
 
void switchOffUnitlessPositions (bool use_dt_per_particle=false)
 
void setDistribution (Distribution *d, std::vector< Distribution * > addedDistributions, size_t &np)
 
bool isGridFixed ()
 
bool hasBinning ()
 
void setTEmission (double t)
 
double getTEmission ()
 
bool doEmission ()
 
bool weHaveBins () const
 
void setPBins (PartBins *pbin)
 
void setPBins (PartBinsCyc *pbin)
 
size_t emitParticles (double eZ)
 Emit particles in the given bin i.e. copy the particles from the bin structure into the particle container. More...
 
void updateNumTotal ()
 
void rebin ()
 
int getNumBins ()
 
int getLastemittedBin ()
 
void setLocalBinCount (size_t num, int bin)
 
void calcGammas ()
 Compute the gammas of all bins. More...
 
void calcGammas_cycl ()
 
double getBinGamma (int bin)
 Get gamma of one bin. More...
 
virtual void setBinCharge (int bin, double q)
 Set the charge of one bin to the value of q and all other to zero. More...
 
virtual void setBinCharge (int bin)
 Set the charge of all other the ones in bin to zero. More...
 
size_t calcNumPartsOutside (Vector_t x)
 returns the number of particles outside of a box defined by x More...
 
void calcLineDensity (unsigned int nBins, std::vector< double > &lineDensity, std::pair< double, double > &meshInfo)
 
void setBeamFrequency (double v)
 
virtual void boundp ()
 
void boundp_destroy ()
 
size_t boundp_destroyT ()
 
size_t destroyT ()
 
void get_bounds (Vector_t &rmin, Vector_t &rmax)
 
void getLocalBounds (Vector_t &rmin, Vector_t &rmax)
 
std::pair< Vector_t, double > getBoundingSphere ()
 
std::pair< Vector_t, double > getLocalBoundingSphere ()
 
void push_back (OpalParticle p)
 
void set_part (FVector< double, 6 > z, int ii)
 
void set_part (OpalParticle p, int ii)
 
OpalParticle get_part (int ii)
 
void maximumAmplitudes (const FMatrix< double, 6, 6 > &D, double &axmax, double &aymax)
 Return maximum amplitudes. More...
 
void setdT (double dt)
 
double getdT () const
 
void setT (double t)
 
void incrementT ()
 
double getT () const
 
double get_sPos ()
 
void set_sPos (double s)
 
double get_gamma () const
 
double get_meanKineticEnergy () const
 
Vector_t get_origin () const
 
Vector_t get_maxExtent () const
 
Vector_t get_centroid () const
 
Vector_t get_rrms () const
 
Vector_t get_rprms () const
 
Vector_t get_rmean () const
 
Vector_t get_prms () const
 
Vector_t get_pmean () const
 
Vector_t get_pmean_Distribution () const
 
Vector_t get_emit () const
 
Vector_t get_norm_emit () const
 
Vector_t get_halo () const
 
virtual Vector_t get_hr () const
 
double get_Dx () const
 
double get_Dy () const
 
double get_DDx () const
 
double get_DDy () const
 
virtual void set_meshEnlargement (double dh)
 
void gatherLoadBalanceStatistics ()
 
size_t getLoadBalance (int p) const
 
void get_PBounds (Vector_t &min, Vector_t &max) const
 
void calcBeamParameters ()
 
void calcBeamParametersInitial ()
 
double getCouplingConstant () const
 
void setCouplingConstant (double c)
 
void setCharge (double q)
 
void setChargeZeroPart (double q)
 
void setMass (double mass)
 
double getEkin () const
 Need Ek for the Schottky effect calculation (eV) More...
 
double getWorkFunctionRf () const
 Need the work function for the Schottky effect calculation (eV) More...
 
double getLaserEnergy () const
 Need the laser energy for the Schottky effect calculation (eV) More...
 
double getCharge () const
 get the total charge per simulation particle More...
 
double getChargePerParticle () const
 get the macro particle charge More...
 
virtual void setSolver (FieldSolver *fs)
 
bool hasFieldSolver ()
 
std::string getFieldSolverType () const
 
void setStepsPerTurn (int n)
 
int getStepsPerTurn () const
 
void setGlobalTrackStep (long long n)
 step in multiple TRACK commands More...
 
long long getGlobalTrackStep () const
 
void setLocalTrackStep (long long n)
 step in a TRACK command More...
 
void incTrackSteps ()
 
long long getLocalTrackStep () const
 
void setNumBunch (short n)
 
short getNumBunch () const
 
void setTotalNumPerBunch (size_t numpart, short n)
 
size_t getTotalNumPerBunch (short n) const
 
void setLocalNumPerBunch (size_t numpart, short n)
 
size_t getLocalNumPerBunch (short n) const
 
void countTotalNumPerBunch ()
 
void setGlobalMeanR (Vector_t globalMeanR)
 
Vector_t getGlobalMeanR ()
 
void setGlobalToLocalQuaternion (Quaternion_t globalToLocalQuaternion)
 
Quaternion_t getGlobalToLocalQuaternion ()
 
void setSteptoLastInj (int n)
 
int getSteptoLastInj ()
 
double calcMeanPhi ()
 calculate average angle of longitudinal direction of bins More...
 
bool resetPartBinID2 (const double eta)
 reset Bin[] for each particle according to the method given in paper PAST-AB(064402) by G. Fubiani et al. More...
 
bool resetPartBinBunch ()
 
double getdE ()
 
virtual void actT ()
 
const PartDatagetReference () const
 
double getEmissionDeltaT ()
 
Quaternion_t getQKs3D ()
 
void setQKs3D (Quaternion_t q)
 
Vector_t getKs3DRefr ()
 
void setKs3DRefr (Vector_t r)
 
Vector_t getKs3DRefp ()
 
void setKs3DRefp (Vector_t p)
 
void iterateEmittedBin (int binNumber)
 
void calcEMean ()
 
void correctEnergy (double avrgp)
 
Informprint (Inform &os)
 
size_t getTotalNum () const
 
void setTotalNum (size_t n)
 
void setLocalNum (size_t n)
 
size_t getLocalNum () const
 
size_t getDestroyNum () const
 
size_t getGhostNum () const
 
unsigned int getMinimumNumberOfParticlesPerCore () const
 
void setMinimumNumberOfParticlesPerCore (unsigned int n)
 
ParticleLayout< double, Dim > & getLayout ()
 
const ParticleLayout< double,
Dim > & 
getLayout () const
 
bool getUpdateFlag (UpdateFlags_t f) const
 
void setUpdateFlag (UpdateFlags_t f, bool val)
 
ParticleBConds< Position_t,
Dimension > & 
getBConds ()
 
void setBConds (const ParticleBConds< Position_t, Dimension > &bc)
 
bool singleInitNode () const
 
void resetID ()
 
void update ()
 
void update (const ParticleAttrib< char > &canSwap)
 
void createWithID (unsigned id)
 
void create (size_t M)
 
void globalCreate (size_t np)
 
void destroy (size_t M, size_t I, bool doNow=false)
 
void performDestroy (bool updateLocalNum=false)
 
void ghostDestroy (size_t M, size_t I)
 
FMatrix< double, 2 *Dim, 2 *DimgetSigmaMatrix ()
 
double getQ () const
 Access to reference data. More...
 
double getM () const
 
double getP () const
 
double getE () const
 
ParticleType::type getPType () const
 
double getInitialBeta () const
 
double getInitialGamma () const
 
void resetQ (double q)
 
void resetM (double m)
 
void setPType (ParticleType::type)
 

Public Attributes

bool isValid_m
 
std::unique_ptr< ProfilecurrentProfile_m
 current profile of bunch (fit) More...
 
IpplTimings::TimerRef calcITimer_m
 
IpplTimings::TimerRef spaceChargeTimer_m
 
- Public Attributes inherited from PartBunch
Field_t rho_m
 scalar potential More...
 
VField_t eg_m
 vector field on the grid More...
 
- Public Attributes inherited from PartBunchBase< double, 3 >
ParticlePos_tR
 
ParticleIndex_tID
 
ParticleAttrib< Vector_tP
 
ParticleAttrib< double > Q
 
ParticleAttrib< double > M
 
ParticleAttrib< double > Phi
 
ParticleAttrib< Vector_tEf
 
ParticleAttrib< Vector_tEftmp
 
ParticleAttrib< Vector_tBf
 
ParticleAttrib< int > Bin
 
ParticleAttrib< double > dt
 
ParticleAttrib< short > PType
 
ParticleAttrib< int > TriID
 
ParticleAttrib< short > cavityGapCrossed
 particle just crossed cavity gap (for ParallelCyclotronTracker) More...
 
ParticleAttrib< short > bunchNum
 
Vector_t RefPartR_m
 
Vector_t RefPartP_m
 
ParticleType::type refPType_m
 
CoordinateSystemTrafo toLabTrafo_m
 
int myNode_m
 avoid calls to Ippl::myNode() More...
 
int nodes_m
 avoid calls to Ippl::getNodes() More...
 
bool fixed_grid
 if the grid does not have to adapt More...
 
PartBinspbin_m
 
std::unique_ptr< LossDataSinklossDs_m
 
std::unique_ptr< Informpmsg_m
 
std::unique_ptr< std::ofstream > f_stream
 
IpplTimings::TimerRef distrReload_m
 timer for IC, can not be in Distribution.h More...
 
IpplTimings::TimerRef distrCreate_m
 
double dtScInit_m
 
double deltaTau_m
 
bool lowParticleCount_m
 if a local node has less than 2 particles lowParticleCount_m == true More...
 
IpplTimings::TimerRef selfFieldTimer_m
 timer for selfField calculation More...
 

Private Member Functions

void synchronizeSlices ()
 synchronize z position and betas of all slices (needed in calcI and space charge calculation) More...
 
void runStats (EnvelopeBunchParameter sp, double *xAvg, double *xMax, double *xMin, double *rms, int *nValid)
 run statistics on slices More...
 
void calcEmittance (double *emtnx, double *emtny, double *emtx, double *emty, int *nValid)
 calculate bunch emittance More...
 
void calcEnergyChirp (double *g0, double *dgdt, double *gInc, int *nValid)
 calculate the energy chirp and uncorrelated energy spread More...
 
void setBinnedLShape (EnvelopeBunchShape shape, double z0, double w, double frac)
 set longitudinal shape of bunch (initial distribution) More...
 
void setTShape (double enx, double eny, double rx, double ry, double b0)
 set transverse shape of bunch (initial distribution) More...
 
void setTOffset (double x0, double px0, double y0, double py0)
 set transverse offset of bunch More...
 
double moveZ0 (double zC)
 move the complete bunch forward such that the head of the bunch matches the cahtode position More...
 
void backup ()
 backup slice values More...
 
double tReset (double dt=0.0)
 
void cSpaceCharge ()
 
void calcI ()
 calculates the current current distribution More...
 

Private Attributes

int numSlices_m
 number of total slices in bunch More...
 
int numMySlices_m
 number of my slices in bunch More...
 
size_t mySliceStartOffset_m
 first global slice on this processor More...
 
size_t mySliceEndOffset_m
 last global slice on this processor More...
 
std::vector< double > z_m
 synchronized z positions for parallel tracker More...
 
std::vector< double > b_m
 synchronized betas for parallel tracker More...
 
std::vector< std::vector< int > > bins_m
 bins for emission More...
 
double hbin_m
 emission bin width More...
 
int nebin_m
 number of bins for emission More...
 
int firstBinWithValue_m
 first bin on processor containing slices More...
 
int activeSlices_m
 number of active slices More...
 
int solver_m
 see enum SolverParameters More...
 
int dStat_m
 see enum DataStatus More...
 
double t_m
 local time in bunch [s] More...
 
double t_offset_m
 accumulated time offset by tReset function More...
 
double emtnx0_m
 intrinsic normalized emittance of slice [m rad] More...
 
double emtny0_m
 
double emtbx0_m
 intrinsic normalized emittance Bush effect [m rad] More...
 
double emtby0_m
 
double dx0_m
 offset of the coordinate system when tracking along the s-axis [m] More...
 
double dy0_m
 
double dfi_x_m
 rotation of coordinate system when tracking along the s-axis [rad] More...
 
double dfi_y_m
 
double Bz0_m
 magnetic field on cathode [T] More...
 
double Q_m
 total bunch charge [C] More...
 
double I0avg_m
 average current on creation of bunch (see setLshape) More...
 
Vector_t Esl_m
 electric field More...
 
Vector_t Bsl_m
 magnetic field More...
 
Vector_t KRsl_m
 radial focussing term beam More...
 
Vector_t KTsl_m
 transverse kick of beam More...
 
std::unique_ptr< Vector_t[]> KR
 define value of radial kick for each slice More...
 
std::unique_ptr< Vector_t[]> KT
 define value of transversal kick for each slice More...
 
std::unique_ptr< Vector_t[]> EF
 external E fields More...
 
std::unique_ptr< Vector_t[]> BF
 external B fields More...
 
std::vector< std::shared_ptr
< EnvelopeSlice > > 
slices_m
 array of slices More...
 
unsigned int activeSlice_m
 
int sign_m
 gives the sign of charge Q More...
 
int currentSlice_m
 current Slice set in run() & cSpaceCharge() and used in derivs() & zcsI() More...
 
double zCat_m
 cathode position More...
 
std::vector< double > Exw_m
 transverse wake field x More...
 
std::vector< double > Eyw_m
 transverse wake field y More...
 
std::vector< double > Ezw_m
 longitudinal wake field More...
 
std::vector< double > Esct_m
 Longitudinal Space-charge field. More...
 
std::vector< double > G_m
 Transverse Space-charge term: Eq.(9) More...
 
int nValid_m
 
double z0_m
 
double emission_time_step_m
 
size_t lastEmittedBin_m
 
double E_m
 
double dEdt_m
 
double Einc_m
 
double tau_m
 
double I_m
 
double Irms_m
 
double Rx_m
 
double Ry_m
 
double RxMax_m
 
double RyMax_m
 
double RxMin_m
 
double RyMin_m
 
double Px_m
 
double Py_m
 
double x0_m
 
double y0_m
 
double x0Max_m
 
double y0Max_m
 
double x0Min_m
 
double y0Min_m
 
double Ez_m
 
double Bz_m
 
Vector_t maxX_m
 
Vector_t minX_m
 
Vector_t maxP_m
 
Vector_t minP_m
 
Vector_t sigmax_m
 
Vector_t sigmap_m
 
Vector_t emtn_m
 
Vector_t norm_emtn_m
 
double curZHead_m
 
double curZTail_m
 

Additional Inherited Members

- Public Types inherited from PartBunch
enum  { Dim = Dimension }
 
typedef IpplParticleBase
< Layout_t
pbase_t
 
- Public Types inherited from PartBunchBase< double, 3 >
enum  UnitState_t
 
typedef AbstractParticle
< double, Dim >::ParticlePos_t 
ParticlePos_t
 
typedef AbstractParticle
< double, Dim >
::ParticleIndex_t 
ParticleIndex_t
 
typedef AbstractParticle
< double, Dim >::UpdateFlags 
UpdateFlags_t
 
typedef AbstractParticle
< double, Dim >::Position_t 
Position_t
 
typedef std::pair< Vector_t,
Vector_t
VectorPair_t
 
- Static Public Attributes inherited from PartBunchBase< double, 3 >
static const unsigned Dimension
 
- Protected Member Functions inherited from PartBunchBase< double, 3 >
size_t calcMoments ()
 
void calcMomentsInitial ()
 
double calculateAngle (double x, double y)
 angle range [0~2PI) degree More...
 
- Protected Attributes inherited from PartBunchBase< double, 3 >
IpplTimings::TimerRef boundpTimer_m
 
IpplTimings::TimerRef boundpBoundsTimer_m
 
IpplTimings::TimerRef boundpUpdateTimer_m
 
IpplTimings::TimerRef statParamTimer_m
 
IpplTimings::TimerRef histoTimer_m
 
const PartDatareference
 
UnitState_t unit_state_
 
UnitState_t stateOfLastBoundP_
 
double centroid_m [2 *Dim]
 holds the centroid of the beam More...
 
FMatrix< double, 2 *Dim, 2 *Dimmoments_m
 6x6 matrix of the moments of the beam More...
 
double dt_m
 holds the timestep in seconds More...
 
double t_m
 holds the actual time of the integration More...
 
double eKin_m
 mean energy of the bunch (MeV) More...
 
double dE_m
 energy spread of the beam in MeV More...
 
double spos_m
 the position along design trajectory More...
 
Vector_t globalMeanR_m
 
Quaternion_t globalToLocalQuaternion_m
 
Vector_t rmax_m
 maximal extend of particles More...
 
Vector_t rmin_m
 minimal extend of particles More...
 
Vector_t rrms_m
 rms beam size (m) More...
 
Vector_t prms_m
 rms momenta More...
 
Vector_t rmean_m
 mean position (m) More...
 
Vector_t pmean_m
 mean momenta More...
 
Vector_t eps_m
 rms emittance (not normalized) More...
 
Vector_t eps_norm_m
 rms normalized emittance More...
 
Vector_t halo_m
 
Vector_t rprms_m
 rms correlation More...
 
double Dx_m
 dispersion x & y More...
 
double Dy_m
 
double DDx_m
 derivative of the dispersion More...
 
double DDy_m
 
Vector_t hr_m
 meshspacing of cartesian mesh More...
 
Vektor< int, 3 > nr_m
 meshsize of cartesian mesh More...
 
FieldSolverfs_m
 stores the used field solver More...
 
double couplingConstant_m
 
double qi_m
 
int distDump_m
 counter to store the distribution dump More...
 
int fieldDBGStep_m
 
double dh_m
 Mesh enlargement. More...
 
double tEmission_m
 in % how much the mesh is enlarged More...
 
std::unique_ptr< double[]> bingamma_m
 holds the gamma of the bin More...
 
std::unique_ptr< size_t[]> binemitted_m
 
int stepsPerTurn_m
 steps per turn for OPAL-cycl More...
 
long long localTrackStep_m
 step in a TRACK command More...
 
long long globalTrackStep_m
 if multiple TRACK commands More...
 
short numBunch_m
 current bunch number More...
 
std::vector< size_t > bunchTotalNum_m
 number of particles per bunch More...
 
std::vector< size_t > bunchLocalNum_m
 
int SteptoLastInj_m
 
std::unique_ptr< size_t[]> globalPartPerNode_m
 
Distributiondist_m
 
bool dcBeam_m
 
double periodLength_m
 
std::shared_ptr
< AbstractParticle< double,
Dim > > 
pbase
 

Detailed Description

core of the envelope tracker based on Rene Bakkers BET implementation

Definition at line 60 of file EnvelopeBunch.h.

Constructor & Destructor Documentation

EnvelopeBunch::EnvelopeBunch ( const PartData ref)

Default constructor.

Definition at line 64 of file EnvelopeBunch.cpp.

References calcITimer_m, IpplTimings::getTimer(), isValid_m, and spaceChargeTimer_m.

Here is the call graph for this function:

EnvelopeBunch::EnvelopeBunch ( const std::vector< OpalParticle > &  rhs,
const PartData ref 
)

Conversion.

Definition at line 76 of file EnvelopeBunch.cpp.

EnvelopeBunch::EnvelopeBunch ( const EnvelopeBunch )
delete

Copy constructor (implement if needed)

EnvelopeBunch::~EnvelopeBunch ( )
virtual

Definition at line 84 of file EnvelopeBunch.cpp.

Member Function Documentation

double EnvelopeBunch::AvBField ( )

returns average magnetic field

Definition at line 1405 of file EnvelopeBunch.cpp.

References BF, IpplInfo::getComm(), numMySlices_m, and numSlices_m.

Referenced by calcBeamParameters().

Here is the call graph for this function:

double EnvelopeBunch::AvEField ( )

returns average electric field

Definition at line 1417 of file EnvelopeBunch.cpp.

References EF, IpplInfo::getComm(), numMySlices_m, and numSlices_m.

Referenced by calcBeamParameters().

Here is the call graph for this function:

void EnvelopeBunch::backup ( )
inlineprivate

backup slice values

Definition at line 568 of file EnvelopeBunch.h.

References slices_m.

Referenced by moveZ0(), setBinnedLShape(), setEnergy(), setTShape(), and timeStep().

void EnvelopeBunch::calcBeamParameters ( )
void EnvelopeBunch::calcEmittance ( double *  emtnx,
double *  emtny,
double *  emtx,
double *  emty,
int *  nValid 
)
private

calculate bunch emittance

Parameters
emtnxnormalized emittance x
emtnynormalized emittance y
emtxemittance x
emtyemittance y
nValidnumber of valid slices

Definition at line 294 of file EnvelopeBunch.cpp.

References Physics::c, emtbx0_m, emtby0_m, emtnx0_m, emtny0_m, numMySlices_m, reduce(), SLI_beta, SLI_px, SLI_py, SLI_x, SLI_y, SLI_z, slices_m, solver_m, sqrt(), sv_radial, and zCat_m.

Referenced by calcBeamParameters().

Here is the call graph for this function:

void EnvelopeBunch::calcEnergyChirp ( double *  g0,
double *  dgdt,
double *  gInc,
int *  nValid 
)
private

calculate the energy chirp and uncorrelated energy spread

Parameters
g0average gamma
dgdtchirp
gIncincoherent energy spread
nValidnumber of valid slices

Definition at line 373 of file EnvelopeBunch.cpp.

References Physics::c, IpplInfo::Comm, IpplInfo::getComm(), Communicate::getNodes(), gt(), linfit(), numMySlices_m, pow(), reduce(), SLI_beta, SLI_z, slices_m, sqrt(), zAvg(), and zCat_m.

Referenced by calcBeamParameters().

Here is the call graph for this function:

void EnvelopeBunch::calcI ( )
private

calculates the current current distribution

  1. Normalize profile to match bunch charge as a constant However, only normalize for sufficient beam energy

Definition at line 714 of file EnvelopeBunch.cpp.

References b_m, Physics::c, IpplInfo::Comm, currentProfile_m, ds_currentCalculated, dStat_m, endl(), fabs(), IpplInfo::getComm(), itype_lin, mySliceEndOffset_m, mySliceStartOffset_m, numSlices_m, Physics::q_e, Q_m, sgSmooth(), sqrt(), z_m, zHead(), and zTail().

Referenced by computeSpaceCharge().

Here is the call graph for this function:

void EnvelopeBunch::computeSpaceCharge ( )
void EnvelopeBunch::createBunch ( )

create and initialize local num slices

Definition at line 491 of file EnvelopeBunch.cpp.

References b_m, BF, Bz0_m, currentProfile_m, dfi_x_m, dfi_y_m, ds_fieldsSynchronized, ds_slicesSynchronized, dStat_m, dx0_m, dy0_m, EF, emtbx0_m, emtby0_m, emtnx0_m, emtny0_m, Esct_m, Exw_m, Eyw_m, Ezw_m, G_m, getLocalNum(), I0avg_m, KR, KT, numSlices_m, Q_m, slices_m, solver_m, sv_lwakes, sv_offaxis, sv_radial, sv_twakes, t_m, t_offset_m, and z_m.

Referenced by Distribution::doRestartOpalE(), and initialize().

Here is the call graph for this function:

void EnvelopeBunch::cSpaceCharge ( )
private

culates space-charge fields Calculate longitudinal-, and transverse space-charge fields for bunch Output is stored in the global class arrays Esct and G, respectively.

Definition at line 927 of file EnvelopeBunch.cpp.

References BETA_MIN1, Physics::c, currentProfile_m, endl(), Physics::epsilon_0, Esct_m, fabs(), G_m, getBeta(), IpplInfo::getComm(), getGamma(), itype_lin, mySliceStartOffset_m, numMySlices_m, numSlices_m, Physics::pi, Q_m, PartBunchBase< double, 3 >::R, SLI_beta, SLI_x, SLI_y, SLI_z, slices_m, sqrt(), Physics::two_pi, z_m, zHead(), and zTail().

Referenced by computeSpaceCharge().

Here is the call graph for this function:

void EnvelopeBunch::derivs ( double  tc,
double  Y[],
double  dYdt[] 
)

helper function to calculate derivatives need in RH equation

Parameters
tctime
Y[]in/out array of slice parameters
dYdt[]derivation wrt to time of slice parameters
derivs for RK routine

Definition of equation set:

Y[SLI_z] = z dz/dt = beta*c*cos(a) cos(a) = 1 - (px0^2 + py0^2)/c2 Y[SLI_beta] = beta db/dt = (e0/mc)*(E_acc + E_sc)/gamma^3 Y[SLI_x] = x dx/dt = px = Y[SLI_px] Y[SLI_px] = px dpx/dt = f(x,beta) - (beta*gamma^2(db/dt)*px + Kr*x) Y[SLI_y] = y dy/dt = py = Y[SLI_py] Y[SLI_py] = py dpy/dt = f(y,beta) - (beta*gamma^2(db/dt)*py + Kr*y) Y[SLI_x0] = x0 dx0/dt = px0 = Y[SLI_px0] Y[SLI_px0] = px0 dpx0/dt= -(beta*gamma^2(db/dt)*px0) + Kt*x0 Y[SLI_y0] = y0 dy0/dt = py0 = Y[SLI_py0] Y[SLI_py0] = py0 dpy0/dt= -(beta*gamma^2(db/dt)*py0) + Kt*y0

Transversal space charge blowup: f(x,beta) = c^2*I/(2Ia)/(x*beta*gamma^3)

ALT: SLI_z (commented by Rene) dYdt[SLI_z] = Y[SLI_beta]*c*sqrt(1.0 - (pow(Y[SLI_px0],2) + pow(Y[SLI_py0],2))/pow(c*Y[SLI_beta],2)); dYdt[SLI_z] = Y[SLI_beta]*c*cos(Y[SLI_px0]/Y[SLI_beta]/c)*cos(Y[SLI_py0]/Y[SLI_beta]/c);

\[ \dot{z} = \beta c cos(\alpha) \]

minimum spot-size due to emittance

\[ \left(\frac{\epsilon_n c}{\gamma}\right)^2 \]

\[ \dot{\sigma} = p \]

\[ \ddot{\sigma} = -\gamma^2\beta\dot{\beta}\dot{\sigma} - K\sigma + 2c^2\left(\frac{I}{2I_0}\right)\frac{G}{\beta R^2}(1-\beta)^2 \sigma + \left(\frac{\epsilon_n c}{\gamma}\right)^2 \frac{1}{\sigma^3} \]

\[ \dot{\sigma} = p \]

Definition at line 1092 of file EnvelopeBunch.cpp.

References activeSlices_m, Physics::alpha, Physics::c, cos(), currentProfile_m, currentSlice_m, curZHead_m, curZTail_m, Physics::e0m, Physics::e0mc, emtbx0_m, emtby0_m, emtnx0_m, emtny0_m, Esct_m, Esl_m, Exw_m, Eyw_m, Ezw_m, G_m, Physics::Ia, KRsl_m, KTsl_m, numSlices_m, pow(), Q_m, SLI_beta, SLI_px, SLI_px0, SLI_py, SLI_py0, SLI_x, SLI_x0, SLI_y, SLI_y0, SLI_z, solver_m, sqrt(), sv_offaxis, and sv_radial.

Here is the call graph for this function:

void EnvelopeBunch::distributeSlices ( int  nSlice = 101)

distributes nSlice amongst processors and initializes slices

Definition at line 464 of file EnvelopeBunch.cpp.

References IpplInfo::Comm, Communicate::getNodes(), Communicate::myNode(), mySliceEndOffset_m, mySliceStartOffset_m, numMySlices_m, and numSlices_m.

Referenced by Distribution::doRestartOpalE(), and initialize().

Here is the call graph for this function:

double EnvelopeBunch::Eavg ( )

calculate the average energy of the bunch

Definition at line 1429 of file EnvelopeBunch.cpp.

References Physics::c, Physics::EMASS, IpplInfo::getComm(), numMySlices_m, Physics::q_e, SLI_z, slices_m, sum(), and zCat_m.

Referenced by ParallelSliceTracker::execute(), get_meanKineticEnergy(), and ParallelSliceTracker::switchElements().

Here is the call graph for this function:

Vector_t EnvelopeBunch::emtn ( )
inline

returns vector with emittance

Definition at line 178 of file EnvelopeBunch.h.

References emtn_m.

Referenced by H5PartWrapperForPS::stashPhaseSpaceEnvelope().

void EnvelopeBunch::get_bounds ( Vector_t min,
Vector_t max 
)
inline

returns bounds of envelope bunch

Definition at line 357 of file EnvelopeBunch.h.

References zHead(), and zTail().

Referenced by ParallelSliceTracker::computeExternalFields(), ParallelSliceTracker::execute(), ParallelSliceTracker::writeLastStepPhaseSpace(), and ParallelSliceTracker::writePhaseSpace().

Here is the call graph for this function:

double EnvelopeBunch::get_dEdt ( )
inline

returns the energy spread

Definition at line 172 of file EnvelopeBunch.h.

References dEdt_m.

Referenced by StatWriter::write().

double EnvelopeBunch::get_meanKineticEnergy ( )
inline

returns the mean energy

Definition at line 170 of file EnvelopeBunch.h.

References Eavg().

Referenced by slprint(), H5PartWrapperForPS::stashPhaseSpaceEnvelope(), StatWriter::write(), and H5PartWrapperForPS::writeStepHeader().

Here is the call graph for this function:

Vector_t EnvelopeBunch::get_norm_emit ( )
inline

returns vector with normalized emittance

Definition at line 180 of file EnvelopeBunch.h.

References norm_emtn_m.

Referenced by H5PartWrapperForPS::stashPhaseSpaceEnvelope(), StatWriter::write(), and H5PartWrapperForPS::writeStepHeader().

Vector_t EnvelopeBunch::get_prms ( )
inline

returns RMSP x,y,z

Definition at line 194 of file EnvelopeBunch.h.

References sigmap_m.

Referenced by StatWriter::write(), and H5PartWrapperForPS::writeStepHeader().

Vector_t EnvelopeBunch::get_rrms ( )
inline

returns RMS x,y,z

Definition at line 192 of file EnvelopeBunch.h.

References sigmax_m.

Referenced by StatWriter::write(), and H5PartWrapperForPS::writeStepHeader().

double EnvelopeBunch::get_sPos ( )

return reference position

Definition at line 1444 of file EnvelopeBunch.cpp.

References IpplInfo::getComm(), numMySlices_m, SLI_z, and slices_m.

Referenced by ParallelSliceTracker::dumpStats(), ParallelSliceTracker::execute(), H5PartWrapperForPS::stashPhaseSpaceEnvelope(), and H5PartWrapperForPS::writeStepHeader().

Here is the call graph for this function:

double EnvelopeBunch::getBeta ( int  i)
inlinevirtual

returns beta of slice i

Reimplemented from PartBunchBase< double, 3 >.

Definition at line 215 of file EnvelopeBunch.h.

References numMySlices_m, SLI_beta, and slices_m.

Referenced by cSpaceCharge(), and H5PartWrapperForPS::writeStepData().

double EnvelopeBunch::getChargePerParticle ( )
inline

returns charge per slice

Definition at line 190 of file EnvelopeBunch.h.

References numSlices_m, and Q_m.

Referenced by Distribution::doRestartOpalE(), H5PartWrapperForPS::stashPhaseSpaceEnvelope(), and StatWriter::write().

void EnvelopeBunch::getExternalFields ( int  i,
Vector_t EF,
Vector_t BF,
Vector_t KR,
Vector_t KT 
) const
inline

Definition at line 150 of file EnvelopeBunch.h.

double EnvelopeBunch::getGamma ( int  i)
inlinevirtual

returns gamma of slice i

Reimplemented from PartBunchBase< double, 3 >.

Definition at line 209 of file EnvelopeBunch.h.

References numMySlices_m, and slices_m.

Referenced by cSpaceCharge().

int EnvelopeBunch::getLocalNum ( )
inline
Vector_t EnvelopeBunch::getP ( int  i)
inline
double EnvelopeBunch::getPx ( int  i)
inlinevirtual

returns X momenta of slice i

Reimplemented from PartBunchBase< double, 3 >.

Definition at line 311 of file EnvelopeBunch.h.

References numMySlices_m, SLI_px, and slices_m.

Referenced by H5PartWrapperForPS::writeStepData().

double EnvelopeBunch::getPx0 ( int  i)
inlinevirtual

returns angular deflection centroid in x of slice i

Reimplemented from PartBunchBase< double, 3 >.

Definition at line 337 of file EnvelopeBunch.h.

References numMySlices_m, SLI_px0, and slices_m.

Referenced by H5PartWrapperForPS::writeStepData().

double EnvelopeBunch::getPy ( int  i)
inlinevirtual

returns Y momenta of slice i

Reimplemented from PartBunchBase< double, 3 >.

Definition at line 321 of file EnvelopeBunch.h.

References numMySlices_m, SLI_py, and slices_m.

Referenced by H5PartWrapperForPS::writeStepData().

double EnvelopeBunch::getPy0 ( int  i)
inlinevirtual

returns angular deflection centroid in y of slice i

Reimplemented from PartBunchBase< double, 3 >.

Definition at line 347 of file EnvelopeBunch.h.

References numMySlices_m, SLI_py0, and slices_m.

Referenced by H5PartWrapperForPS::writeStepData().

double EnvelopeBunch::getPz ( int  i)
inlinevirtual

returns Z momenta of slice i

Reimplemented from PartBunchBase< double, 3 >.

Definition at line 331 of file EnvelopeBunch.h.

References Physics::m_e, numMySlices_m, SLI_beta, and slices_m.

Referenced by H5PartWrapperForPS::writeStepData().

Vector_t EnvelopeBunch::getR ( int  i)
inline
double EnvelopeBunch::getT ( )
inline
int EnvelopeBunch::getTotalNum ( )
inline

returns the total number of slices

Definition at line 166 of file EnvelopeBunch.h.

References numSlices_m.

Referenced by ParallelSliceTracker::execute(), slprint(), H5PartWrapperForPS::stashPhaseSpaceEnvelope(), and StatWriter::write().

double EnvelopeBunch::getX ( int  i)
inlinevirtual

returns X coordinate of slice i

Reimplemented from PartBunchBase< double, 3 >.

Definition at line 271 of file EnvelopeBunch.h.

References numMySlices_m, SLI_x, and slices_m.

Referenced by H5PartWrapperForPS::writeStepData().

double EnvelopeBunch::getX0 ( int  i)
inlinevirtual

returns X coordinate of the centroid of slice i

Reimplemented from PartBunchBase< double, 3 >.

Definition at line 291 of file EnvelopeBunch.h.

References numMySlices_m, SLI_x0, and slices_m.

Referenced by H5PartWrapperForPS::writeStepData().

double EnvelopeBunch::getY ( int  i)
inlinevirtual

returns Y coordinate of slice i

Reimplemented from PartBunchBase< double, 3 >.

Definition at line 281 of file EnvelopeBunch.h.

References numMySlices_m, SLI_y, and slices_m.

Referenced by H5PartWrapperForPS::writeStepData().

double EnvelopeBunch::getY0 ( int  i)
inlinevirtual

returns Y coordinate of the centroid of slice i

Reimplemented from PartBunchBase< double, 3 >.

Definition at line 301 of file EnvelopeBunch.h.

References numMySlices_m, SLI_y0, and slices_m.

Referenced by H5PartWrapperForPS::writeStepData().

double EnvelopeBunch::getZ ( int  i)
inlinevirtual

returns Z coordinate of slice i

Reimplemented from PartBunchBase< double, 3 >.

Definition at line 265 of file EnvelopeBunch.h.

References numMySlices_m, SLI_z, and slices_m.

Referenced by H5PartWrapperForPS::writeStepData().

void EnvelopeBunch::initialize ( int  sli,
double  charge,
double  energy,
double  width,
double  te,
double  frac,
double  current,
double  center,
double  bX,
double  bY,
double  mX,
double  mY,
double  Bz,
int  nbin 
)
bool EnvelopeBunch::isOffaxis ( )
inline

check if solver includes off-axis tracking

Definition at line 98 of file EnvelopeBunch.h.

References solver_m, and sv_offaxis.

bool EnvelopeBunch::isRadial ( )
inline

check if solver includes radial

Definition at line 95 of file EnvelopeBunch.h.

References solver_m, and sv_radial.

Vector_t EnvelopeBunch::maxP ( )
inline

returns vector with the max momentum of the bunch

Definition at line 186 of file EnvelopeBunch.h.

References maxP_m.

Referenced by H5PartWrapperForPS::stashPhaseSpaceEnvelope(), and H5PartWrapperForPS::writeStepHeader().

Vector_t EnvelopeBunch::maxX ( )
inline

returns vector with the max spatial extends of the bunch

Definition at line 182 of file EnvelopeBunch.h.

References maxX_m.

Referenced by H5PartWrapperForPS::stashPhaseSpaceEnvelope().

Vector_t EnvelopeBunch::minP ( )
inline

returns vector with the min momentum of the bunch

Definition at line 188 of file EnvelopeBunch.h.

References minP_m.

Referenced by H5PartWrapperForPS::stashPhaseSpaceEnvelope(), and H5PartWrapperForPS::writeStepHeader().

Vector_t EnvelopeBunch::minX ( )
inline

returns vector with the min spatial extends of the bunch

Definition at line 184 of file EnvelopeBunch.h.

References minX_m.

Referenced by H5PartWrapperForPS::stashPhaseSpaceEnvelope().

double EnvelopeBunch::moveZ0 ( double  zC)
private

move the complete bunch forward such that the head of the bunch matches the cahtode position

Definition at line 1041 of file EnvelopeBunch.cpp.

References backup(), endl(), numMySlices_m, SLI_z, slices_m, zCat_m, and zHead().

Here is the call graph for this function:

size_t EnvelopeBunch::mySliceEndOffset ( )
inline

Definition at line 197 of file EnvelopeBunch.h.

References mySliceEndOffset_m.

Referenced by Distribution::doRestartOpalE().

size_t EnvelopeBunch::mySliceStartOffset ( )
inline

Definition at line 196 of file EnvelopeBunch.h.

References mySliceStartOffset_m.

Referenced by Distribution::doRestartOpalE().

size_t EnvelopeBunch::numMySlices ( )
inline

Definition at line 198 of file EnvelopeBunch.h.

References numMySlices_m.

void EnvelopeBunch::runStats ( EnvelopeBunchParameter  sp,
double *  xAvg,
double *  xMax,
double *  xMin,
double *  rms,
int *  nValid 
)
private

run statistics on slices

Parameters
spparameter to run statistics on
xAvgaverage
xMaxmax
xMinmin
rmsrms
nValidnumber of valid slices

Definition at line 159 of file EnvelopeBunch.cpp.

References BETA_MIN1, IpplInfo::getComm(), max(), min(), numMySlices_m, SLI_beta, SLI_px, SLI_px0, SLI_py, SLI_py0, SLI_x, SLI_x0, SLI_y, SLI_y0, SLI_z, slices_m, sp_beta, sp_gamma, sp_I, sp_Px, sp_px0, sp_Py, sp_py0, sp_Pz, sp_Rx, sp_Ry, sp_x0, sp_y0, sp_z, sqrt(), and zCat_m.

Referenced by calcBeamParameters().

Here is the call graph for this function:

void EnvelopeBunch::setBeta ( int  i,
double  val 
)
inline

Definition at line 219 of file EnvelopeBunch.h.

References numMySlices_m, SLI_beta, and slices_m.

Referenced by H5PartWrapperForPS::readStepData().

void EnvelopeBunch::setBinnedLShape ( EnvelopeBunchShape  shape,
double  z0,
double  w,
double  frac 
)
private

set longitudinal shape of bunch (initial distribution)

Parameters
shapeof bunch (currently rectangular or Gauss)
z0center of the bunch [m]
wlength of the bunch [m]
fracfraction of Gauss (length) used

Definition at line 570 of file EnvelopeBunch.cpp.

References backup(), bins_m, bsGauss, bsRect, Physics::c, IpplInfo::Comm, Physics::e, fabs(), findRoot(), firstBinWithValue_m, Communicate::getNodes(), hbin_m, I0avg_m, mySliceEndOffset_m, mySliceStartOffset_m, nebin_m, numMySlices_m, numSlices_m, Q_m, reduce(), SLI_beta, SLI_z, slices_m, and sqrt().

Referenced by initialize().

Here is the call graph for this function:

void EnvelopeBunch::setCharge ( double  _Q)
inline

set the charge of the bunch

Definition at line 203 of file EnvelopeBunch.h.

References abs(), Q_m, and sign_m.

Referenced by Distribution::doRestartOpalE(), initialize(), and TrackRun::setupSliceTracker().

Here is the call graph for this function:

void EnvelopeBunch::setEnergy ( double  E0,
double  dE = 0.0 
)

Definition at line 686 of file EnvelopeBunch.cpp.

References backup(), Physics::c, Physics::EMASS, fabs(), numMySlices_m, Physics::q_e, SLI_beta, SLI_z, slices_m, sqrt(), and zAvg().

Referenced by initialize().

Here is the call graph for this function:

void EnvelopeBunch::setEx ( double  emi)
inline

set emittance X

Definition at line 135 of file EnvelopeBunch.h.

References emtnx0_m.

void EnvelopeBunch::setExternalFields ( int  i,
const Vector_t EF,
const Vector_t BF,
const Vector_t KR,
const Vector_t KT 
)
inline

Definition at line 143 of file EnvelopeBunch.h.

References BF, EF, KR, and KT.

Referenced by ParallelSliceTracker::computeExternalFields().

void EnvelopeBunch::setEy ( double  emi)
inline

set emittance Y

Definition at line 137 of file EnvelopeBunch.h.

References emtny0_m.

void EnvelopeBunch::setP ( int  i,
const Vector_t P 
)
inline

Definition at line 241 of file EnvelopeBunch.h.

References numMySlices_m, SLI_beta, SLI_px, SLI_py, slices_m, and sqrt().

Referenced by ParallelSliceTracker::computeExternalFields().

Here is the call graph for this function:

void EnvelopeBunch::setPx ( int  i,
double  val 
)
inline

Definition at line 315 of file EnvelopeBunch.h.

References numMySlices_m, SLI_px, and slices_m.

Referenced by H5PartWrapperForPS::readStepData().

void EnvelopeBunch::setPx0 ( int  i,
double  val 
)
inline

Definition at line 341 of file EnvelopeBunch.h.

References numMySlices_m, SLI_px0, and slices_m.

Referenced by H5PartWrapperForPS::readStepData().

void EnvelopeBunch::setPy ( int  i,
double  val 
)
inline

Definition at line 325 of file EnvelopeBunch.h.

References numMySlices_m, SLI_py, and slices_m.

Referenced by H5PartWrapperForPS::readStepData().

void EnvelopeBunch::setPy0 ( int  i,
double  val 
)
inline

Definition at line 351 of file EnvelopeBunch.h.

References numMySlices_m, SLI_py0, and slices_m.

Referenced by H5PartWrapperForPS::readStepData().

void EnvelopeBunch::setR ( int  i,
const Vector_t R 
)
inline

Definition at line 224 of file EnvelopeBunch.h.

References numMySlices_m, SLI_x, SLI_y, SLI_z, and slices_m.

Referenced by ParallelSliceTracker::computeExternalFields().

void EnvelopeBunch::setSolverParameter ( int  s)
inline

set the DE solver flag

Definition at line 139 of file EnvelopeBunch.h.

References solver_m.

Referenced by initialize().

void EnvelopeBunch::setTOffset ( double  x0,
double  px0,
double  y0,
double  py0 
)
private

set transverse offset of bunch

Parameters
x0coordinate [m]
px0divergence [rad]
y0coordinate [m]
py0divergence [rad]

Definition at line 677 of file EnvelopeBunch.cpp.

References numMySlices_m, SLI_px0, SLI_py0, SLI_x0, SLI_y0, and slices_m.

void EnvelopeBunch::setTShape ( double  enx,
double  eny,
double  rx,
double  ry,
double  b0 
)
private

set transverse shape of bunch (initial distribution)

Parameters
enxnormalized emittance x [m rad]
enynormalized emittance y [m rad]
rxradius x [m]
ryradius y [m]
b0Bz0 [T]

Definition at line 651 of file EnvelopeBunch.cpp.

References backup(), Bz0_m, Physics::c, Physics::EMASS, emtbx0_m, emtby0_m, emtnx0_m, emtny0_m, numMySlices_m, Physics::q_e, SLI_px, SLI_py, SLI_x, SLI_y, and slices_m.

Referenced by initialize().

Here is the call graph for this function:

void EnvelopeBunch::setX ( int  i,
double  val 
)
inline

Definition at line 275 of file EnvelopeBunch.h.

References numMySlices_m, SLI_x, and slices_m.

Referenced by H5PartWrapperForPS::readStepData().

void EnvelopeBunch::setX0 ( int  i,
double  val 
)
inline

Definition at line 295 of file EnvelopeBunch.h.

References numMySlices_m, SLI_x0, and slices_m.

Referenced by H5PartWrapperForPS::readStepData().

void EnvelopeBunch::setY ( int  i,
double  val 
)
inline

Definition at line 285 of file EnvelopeBunch.h.

References numMySlices_m, SLI_y, and slices_m.

Referenced by H5PartWrapperForPS::readStepData().

void EnvelopeBunch::setY0 ( int  i,
double  val 
)
inline

Definition at line 305 of file EnvelopeBunch.h.

References numMySlices_m, SLI_y0, and slices_m.

Referenced by H5PartWrapperForPS::readStepData().

void EnvelopeBunch::setZ ( int  i,
double  coo 
)
inlinevirtual

set Z coordinate of slice i

Reimplemented from PartBunchBase< double, 3 >.

Definition at line 259 of file EnvelopeBunch.h.

References numMySlices_m, SLI_z, and slices_m.

Referenced by H5PartWrapperForPS::readStepData().

Vector_t EnvelopeBunch::sigmap ( )
inline

returns vector with rms momenta

Definition at line 176 of file EnvelopeBunch.h.

References sigmap_m.

Referenced by H5PartWrapperForPS::stashPhaseSpaceEnvelope().

Vector_t EnvelopeBunch::sigmax ( )
inline

returns vector with rms position

Definition at line 174 of file EnvelopeBunch.h.

References sigmax_m.

Referenced by H5PartWrapperForPS::stashPhaseSpaceEnvelope().

Inform & EnvelopeBunch::slprint ( Inform os)

Definition at line 1523 of file EnvelopeBunch.cpp.

References Physics::e, endl(), get_meanKineticEnergy(), PartBunchBase< double, 3 >::getdT(), getTotalNum(), Q_m, and zAvg().

Referenced by operator<<().

Here is the call graph for this function:

void EnvelopeBunch::synchronizeSlices ( )
private

synchronize z position and betas of all slices (needed in calcI and space charge calculation)

Definition at line 699 of file EnvelopeBunch.cpp.

References b_m, IpplInfo::getComm(), mySliceStartOffset_m, numMySlices_m, numSlices_m, SLI_beta, SLI_z, slices_m, and z_m.

Referenced by computeSpaceCharge().

Here is the call graph for this function:

double EnvelopeBunch::time ( )
inline

read time-stamp of bunch

Definition at line 132 of file EnvelopeBunch.h.

References t_m.

void EnvelopeBunch::timeStep ( double  tStep,
double  zCat = 0.0 
)

performs a time-step for all active slices (also handles emission)

Parameters
tStepdt for timestep
zCatposition of cathode (default: 0.0)

mark calling of this function + update vars

subtract average orbit for when tracking along the s-axis

Definition at line 1198 of file EnvelopeBunch.cpp.

References activeSlice_m, activeSlices_m, backup(), BF, Bsl_m, Physics::c, currentSlice_m, curZHead_m, curZTail_m, dfi_x_m, dfi_y_m, ds_slicesSynchronized, ds_spaceCharge, dStat_m, dx0_m, dy0_m, EF, endl(), Esl_m, isValid_m, KR, KRsl_m, KT, KTsl_m, numMySlices_m, numSlices_m, odeint(), pow(), reduce(), rk4(), sin(), SLI_beta, SLI_px0, SLI_py0, SLI_x0, SLI_y0, SLI_z, slices_m, SLNPAR, solver_m, sqrt(), sv_fixedStep, sv_s_path, t_m, zCat_m, zHead(), and zTail().

Referenced by ParallelSliceTracker::timeIntegration().

Here is the call graph for this function:

double EnvelopeBunch::tReset ( double  dt = 0.0)
private

reset time of bunch (returns the offset applied) time difference (0.0 - auto-sync)

Definition at line 1055 of file EnvelopeBunch.cpp.

References PartBunchBase< double, 3 >::dt, t_m, t_offset_m, and zAvg().

Here is the call graph for this function:

double EnvelopeBunch::zAvg ( )

calculate <z> [m]

Definition at line 1460 of file EnvelopeBunch.cpp.

References IpplInfo::getComm(), isValid_m, numMySlices_m, SLI_z, slices_m, and sum().

Referenced by calcEnergyChirp(), ParallelSliceTracker::execute(), setEnergy(), slprint(), and tReset().

Here is the call graph for this function:

double EnvelopeBunch::zHead ( )

calculate the head of the bunch [m]

Definition at line 1502 of file EnvelopeBunch.cpp.

References IpplInfo::getComm(), isValid_m, max(), numMySlices_m, SLI_z, and slices_m.

Referenced by calcI(), cSpaceCharge(), get_bounds(), moveZ0(), ParallelSliceTracker::switchElements(), and timeStep().

Here is the call graph for this function:

double EnvelopeBunch::zTail ( )

calculate tail of bunch [m]

Definition at line 1481 of file EnvelopeBunch.cpp.

References IpplInfo::getComm(), isValid_m, min(), numMySlices_m, SLI_z, and slices_m.

Referenced by calcI(), cSpaceCharge(), get_bounds(), ParallelSliceTracker::switchElements(), and timeStep().

Here is the call graph for this function:

Member Data Documentation

unsigned int EnvelopeBunch::activeSlice_m
private

Definition at line 431 of file EnvelopeBunch.h.

Referenced by timeStep().

int EnvelopeBunch::activeSlices_m
private

number of active slices

Definition at line 389 of file EnvelopeBunch.h.

Referenced by derivs(), initialize(), and timeStep().

std::vector<double> EnvelopeBunch::b_m
private

synchronized betas for parallel tracker

Definition at line 379 of file EnvelopeBunch.h.

Referenced by calcI(), createBunch(), and synchronizeSlices().

std::unique_ptr<Vector_t[]> EnvelopeBunch::BF
private

external B fields

Definition at line 428 of file EnvelopeBunch.h.

Referenced by AvBField(), createBunch(), setExternalFields(), and timeStep().

std::vector< std::vector<int> > EnvelopeBunch::bins_m
private

bins for emission

Definition at line 381 of file EnvelopeBunch.h.

Referenced by setBinnedLShape().

Vector_t EnvelopeBunch::Bsl_m
private

magnetic field

Definition at line 416 of file EnvelopeBunch.h.

Referenced by timeStep().

double EnvelopeBunch::Bz0_m
private

magnetic field on cathode [T]

Definition at line 408 of file EnvelopeBunch.h.

Referenced by createBunch(), and setTShape().

double EnvelopeBunch::Bz_m
private

Definition at line 478 of file EnvelopeBunch.h.

Referenced by calcBeamParameters().

IpplTimings::TimerRef EnvelopeBunch::calcITimer_m

Definition at line 86 of file EnvelopeBunch.h.

Referenced by computeSpaceCharge(), and EnvelopeBunch().

std::unique_ptr<Profile> EnvelopeBunch::currentProfile_m

current profile of bunch (fit)

Definition at line 84 of file EnvelopeBunch.h.

Referenced by calcI(), computeSpaceCharge(), createBunch(), cSpaceCharge(), and derivs().

int EnvelopeBunch::currentSlice_m
private

current Slice set in run() & cSpaceCharge() and used in derivs() & zcsI()

Definition at line 435 of file EnvelopeBunch.h.

Referenced by derivs(), and timeStep().

double EnvelopeBunch::curZHead_m
private

Definition at line 491 of file EnvelopeBunch.h.

Referenced by derivs(), and timeStep().

double EnvelopeBunch::curZTail_m
private

Definition at line 492 of file EnvelopeBunch.h.

Referenced by derivs(), and timeStep().

double EnvelopeBunch::dEdt_m
private

Definition at line 454 of file EnvelopeBunch.h.

Referenced by calcBeamParameters(), and get_dEdt().

double EnvelopeBunch::dfi_x_m
private

rotation of coordinate system when tracking along the s-axis [rad]

Definition at line 406 of file EnvelopeBunch.h.

Referenced by createBunch(), and timeStep().

double EnvelopeBunch::dfi_y_m
private

Definition at line 406 of file EnvelopeBunch.h.

Referenced by createBunch(), and timeStep().

int EnvelopeBunch::dStat_m
private

see enum DataStatus

Definition at line 394 of file EnvelopeBunch.h.

Referenced by calcI(), createBunch(), and timeStep().

double EnvelopeBunch::dx0_m
private

offset of the coordinate system when tracking along the s-axis [m]

Definition at line 404 of file EnvelopeBunch.h.

Referenced by createBunch(), and timeStep().

double EnvelopeBunch::dy0_m
private

Definition at line 404 of file EnvelopeBunch.h.

Referenced by createBunch(), and timeStep().

double EnvelopeBunch::E_m
private

Definition at line 453 of file EnvelopeBunch.h.

Referenced by calcBeamParameters().

std::unique_ptr<Vector_t[]> EnvelopeBunch::EF
private

external E fields

Definition at line 426 of file EnvelopeBunch.h.

Referenced by AvEField(), createBunch(), setExternalFields(), and timeStep().

double EnvelopeBunch::Einc_m
private

Definition at line 455 of file EnvelopeBunch.h.

Referenced by calcBeamParameters().

double EnvelopeBunch::emission_time_step_m
private

Definition at line 451 of file EnvelopeBunch.h.

Referenced by initialize().

double EnvelopeBunch::emtbx0_m
private

intrinsic normalized emittance Bush effect [m rad]

Definition at line 402 of file EnvelopeBunch.h.

Referenced by calcEmittance(), createBunch(), derivs(), and setTShape().

double EnvelopeBunch::emtby0_m
private

Definition at line 402 of file EnvelopeBunch.h.

Referenced by calcEmittance(), createBunch(), derivs(), and setTShape().

Vector_t EnvelopeBunch::emtn_m
private

Definition at line 485 of file EnvelopeBunch.h.

Referenced by calcBeamParameters(), and emtn().

double EnvelopeBunch::emtnx0_m
private

intrinsic normalized emittance of slice [m rad]

Definition at line 400 of file EnvelopeBunch.h.

Referenced by calcEmittance(), createBunch(), derivs(), setEx(), and setTShape().

double EnvelopeBunch::emtny0_m
private

Definition at line 400 of file EnvelopeBunch.h.

Referenced by calcEmittance(), createBunch(), derivs(), setEy(), and setTShape().

std::vector<double> EnvelopeBunch::Esct_m
private

Longitudinal Space-charge field.

Definition at line 445 of file EnvelopeBunch.h.

Referenced by createBunch(), cSpaceCharge(), and derivs().

Vector_t EnvelopeBunch::Esl_m
private

electric field

Definition at line 414 of file EnvelopeBunch.h.

Referenced by derivs(), and timeStep().

std::vector<double> EnvelopeBunch::Exw_m
private

transverse wake field x

Definition at line 439 of file EnvelopeBunch.h.

Referenced by createBunch(), and derivs().

std::vector<double> EnvelopeBunch::Eyw_m
private

transverse wake field y

Definition at line 441 of file EnvelopeBunch.h.

Referenced by createBunch(), and derivs().

double EnvelopeBunch::Ez_m
private

Definition at line 477 of file EnvelopeBunch.h.

Referenced by calcBeamParameters().

std::vector<double> EnvelopeBunch::Ezw_m
private

longitudinal wake field

Definition at line 443 of file EnvelopeBunch.h.

Referenced by createBunch(), and derivs().

int EnvelopeBunch::firstBinWithValue_m
private

first bin on processor containing slices

Definition at line 387 of file EnvelopeBunch.h.

Referenced by setBinnedLShape().

std::vector<double> EnvelopeBunch::G_m
private

Transverse Space-charge term: Eq.(9)

Definition at line 447 of file EnvelopeBunch.h.

Referenced by createBunch(), cSpaceCharge(), and derivs().

double EnvelopeBunch::hbin_m
private

emission bin width

Definition at line 383 of file EnvelopeBunch.h.

Referenced by setBinnedLShape().

double EnvelopeBunch::I0avg_m
private

average current on creation of bunch (see setLshape)

Definition at line 412 of file EnvelopeBunch.h.

Referenced by createBunch(), and setBinnedLShape().

double EnvelopeBunch::I_m
private

Definition at line 457 of file EnvelopeBunch.h.

Referenced by calcBeamParameters().

double EnvelopeBunch::Irms_m
private

Definition at line 458 of file EnvelopeBunch.h.

Referenced by calcBeamParameters().

bool EnvelopeBunch::isValid_m
std::unique_ptr<Vector_t[]> EnvelopeBunch::KR
private

define value of radial kick for each slice

Definition at line 422 of file EnvelopeBunch.h.

Referenced by createBunch(), setExternalFields(), and timeStep().

Vector_t EnvelopeBunch::KRsl_m
private

radial focussing term beam

Definition at line 418 of file EnvelopeBunch.h.

Referenced by derivs(), and timeStep().

std::unique_ptr<Vector_t[]> EnvelopeBunch::KT
private

define value of transversal kick for each slice

Definition at line 424 of file EnvelopeBunch.h.

Referenced by createBunch(), setExternalFields(), and timeStep().

Vector_t EnvelopeBunch::KTsl_m
private

transverse kick of beam

Definition at line 420 of file EnvelopeBunch.h.

Referenced by derivs(), and timeStep().

size_t EnvelopeBunch::lastEmittedBin_m
private

Definition at line 452 of file EnvelopeBunch.h.

Referenced by initialize().

Vector_t EnvelopeBunch::maxP_m
private

Definition at line 481 of file EnvelopeBunch.h.

Referenced by calcBeamParameters(), and maxP().

Vector_t EnvelopeBunch::maxX_m
private

Definition at line 479 of file EnvelopeBunch.h.

Referenced by calcBeamParameters(), and maxX().

Vector_t EnvelopeBunch::minP_m
private

Definition at line 482 of file EnvelopeBunch.h.

Referenced by calcBeamParameters(), and minP().

Vector_t EnvelopeBunch::minX_m
private

Definition at line 480 of file EnvelopeBunch.h.

Referenced by calcBeamParameters(), and minX().

size_t EnvelopeBunch::mySliceEndOffset_m
private

last global slice on this processor

Definition at line 375 of file EnvelopeBunch.h.

Referenced by calcI(), distributeSlices(), mySliceEndOffset(), and setBinnedLShape().

size_t EnvelopeBunch::mySliceStartOffset_m
private

first global slice on this processor

Definition at line 373 of file EnvelopeBunch.h.

Referenced by calcI(), cSpaceCharge(), distributeSlices(), mySliceStartOffset(), setBinnedLShape(), and synchronizeSlices().

int EnvelopeBunch::nebin_m
private

number of bins for emission

Definition at line 385 of file EnvelopeBunch.h.

Referenced by initialize(), and setBinnedLShape().

Vector_t EnvelopeBunch::norm_emtn_m
private

Definition at line 486 of file EnvelopeBunch.h.

Referenced by calcBeamParameters(), and get_norm_emit().

int EnvelopeBunch::numMySlices_m
private
int EnvelopeBunch::numSlices_m
private
int EnvelopeBunch::nValid_m
private

Definition at line 449 of file EnvelopeBunch.h.

Referenced by calcBeamParameters().

double EnvelopeBunch::Px_m
private

Definition at line 465 of file EnvelopeBunch.h.

Referenced by calcBeamParameters().

double EnvelopeBunch::Py_m
private

Definition at line 466 of file EnvelopeBunch.h.

Referenced by calcBeamParameters().

double EnvelopeBunch::Q_m
private
double EnvelopeBunch::Rx_m
private

Definition at line 459 of file EnvelopeBunch.h.

Referenced by calcBeamParameters().

double EnvelopeBunch::RxMax_m
private

Definition at line 461 of file EnvelopeBunch.h.

Referenced by calcBeamParameters().

double EnvelopeBunch::RxMin_m
private

Definition at line 463 of file EnvelopeBunch.h.

Referenced by calcBeamParameters().

double EnvelopeBunch::Ry_m
private

Definition at line 460 of file EnvelopeBunch.h.

Referenced by calcBeamParameters().

double EnvelopeBunch::RyMax_m
private

Definition at line 462 of file EnvelopeBunch.h.

Referenced by calcBeamParameters().

double EnvelopeBunch::RyMin_m
private

Definition at line 464 of file EnvelopeBunch.h.

Referenced by calcBeamParameters().

Vector_t EnvelopeBunch::sigmap_m
private

Definition at line 484 of file EnvelopeBunch.h.

Referenced by calcBeamParameters(), get_prms(), and sigmap().

Vector_t EnvelopeBunch::sigmax_m
private

Definition at line 483 of file EnvelopeBunch.h.

Referenced by calcBeamParameters(), get_rrms(), and sigmax().

int EnvelopeBunch::sign_m
private

gives the sign of charge Q

Definition at line 433 of file EnvelopeBunch.h.

Referenced by setCharge().

std::vector< std::shared_ptr<EnvelopeSlice> > EnvelopeBunch::slices_m
private
int EnvelopeBunch::solver_m
private

see enum SolverParameters

Definition at line 392 of file EnvelopeBunch.h.

Referenced by calcBeamParameters(), calcEmittance(), createBunch(), derivs(), isOffaxis(), isRadial(), setSolverParameter(), and timeStep().

IpplTimings::TimerRef EnvelopeBunch::spaceChargeTimer_m

Definition at line 87 of file EnvelopeBunch.h.

Referenced by computeSpaceCharge(), and EnvelopeBunch().

double EnvelopeBunch::t_m
private

local time in bunch [s]

Definition at line 396 of file EnvelopeBunch.h.

Referenced by createBunch(), getT(), time(), timeStep(), and tReset().

double EnvelopeBunch::t_offset_m
private

accumulated time offset by tReset function

Definition at line 398 of file EnvelopeBunch.h.

Referenced by createBunch(), and tReset().

double EnvelopeBunch::tau_m
private

Definition at line 456 of file EnvelopeBunch.h.

Referenced by calcBeamParameters().

double EnvelopeBunch::x0_m
private

Definition at line 467 of file EnvelopeBunch.h.

Referenced by calcBeamParameters().

double EnvelopeBunch::x0Max_m
private

Definition at line 469 of file EnvelopeBunch.h.

Referenced by calcBeamParameters().

double EnvelopeBunch::x0Min_m
private

Definition at line 471 of file EnvelopeBunch.h.

Referenced by calcBeamParameters().

double EnvelopeBunch::y0_m
private

Definition at line 468 of file EnvelopeBunch.h.

Referenced by calcBeamParameters().

double EnvelopeBunch::y0Max_m
private

Definition at line 470 of file EnvelopeBunch.h.

Referenced by calcBeamParameters().

double EnvelopeBunch::y0Min_m
private

Definition at line 472 of file EnvelopeBunch.h.

Referenced by calcBeamParameters().

double EnvelopeBunch::z0_m
private

Definition at line 450 of file EnvelopeBunch.h.

Referenced by calcBeamParameters().

std::vector<double> EnvelopeBunch::z_m
private

synchronized z positions for parallel tracker

Definition at line 377 of file EnvelopeBunch.h.

Referenced by calcI(), createBunch(), cSpaceCharge(), and synchronizeSlices().

double EnvelopeBunch::zCat_m
private

cathode position

Definition at line 437 of file EnvelopeBunch.h.

Referenced by calcEmittance(), calcEnergyChirp(), Eavg(), moveZ0(), runStats(), and timeStep().


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