IMPACT T
Functions/Subroutines
distributionclass Module Reference

This class defines initial distributions for the charged particle beam bunch information in the accelerator. More...

Functions/Subroutines

subroutine sample_dist (this, distparam, nparam, flagdist, geom, grid,
 sample the particles with intial distribution. More...
 
subroutine uniform_dist (this, nparam, distparam, grid)
 6d uniform distribution More...
 
subroutine gauss3_dist (this, nparam, distparam, grid, flagalloc)
 6d Gaussian distribution More...
 
subroutine normdv (y)
 
subroutine normvec (y, num)
 
subroutine waterbag_dist (this, nparam, distparam, grid, flagalloc)
 6d Waterbag distribution. sample the particles with intial distribution using rejection method. More...
 
subroutine kv3d_dist (this, nparam, distparam, grid)
 transverse KV distribution and longitudinal uniform distribution More...
 
subroutine semigauss_dist (this, nparam, distparam, grid)
 3d Waterbag distribution in spatial and 3d Gaussian distribution in momentum space More...
 
subroutine normdv2 (y)
 
subroutine read_dist (this, nparam, distparam, ib)
 read in an initial distribution with format (x(m), px/mc, y(m), py/mc,...) More...
 
subroutine readparmela_dist (this, nparam, distparam, geom, grid, Flag
 
subroutine readelegant_dist (this, nparam, distparam, geom, grid, Flag
 
subroutine normdv1d (y)
 
subroutine cylcoldzsob_dist (this, nparam, distparam, grid)
 
subroutine psiroot (rk, xx, xmod, psi, eps, Nmax)
 
subroutine sobseq (n, x, iseed)
 
subroutine combine_dist (this, nparam, distparam, grid, ib, Nb, flagdis
 generating initial particle distribution based on the combination of transverse spatial distribution (2 types), longitudinal spatial distribution (3 types) and 3D momentum distribution (4 types). For example, flagdist = 111 denotes type 1 from transverse spatial distribution, type 1 from longitudinal spatial distribution, and type 1 from 3D momentum distribution. In this case, it denotes a transverse uniform elliptical, longitudinal flat-top with linear ramping in spatial, and 3d full Gaussian distribution in momentum space. flagdist = ijk, where i = 1 (transverse uniform ellipse) and 2 (Gaussian with cut-off); j = 1 (flat-top with linear ramping), 2 (flat-top with 2sigma Gaussain ramping), and 3 (Gaussian with cut-off); k = 1, (3D Gaussian momentum), 2 (transverse Gaussian momentum, longitudinal semi-Gaussian), 3 (streak camera model), and 4 (3 step model). More...
 
subroutine tranunifxy_dist (ptxy, avgpts, sigx, sigy, xmu1, xmu3)
 transverse spatial uniform elleptical distribution. (id=1) More...
 
subroutine trangaussxy_dist (ptxy, avgpts, sigx, sigy, xmu1, xmu3, cutx
 transverse spatial Gaussian distribution with cut-off. (id=2) More...
 
subroutine longflattoplinz_dist (ptz, avgpts, avgpts0, zscale, pzscal
 longitudinal spatial flat-top distribution with linear ramp (id=1). More...
 
subroutine longflattopgasz_dist (ptz, avgpts, avgpts0, zscale, pzscal
 longitudinal spatial flat-top distribution with 2sigma Gaussian ramp. (id=2) More...
 
subroutine longgaussz_dist (ptz, avgpts, sigz, xmu5, cutz)
 longitudinal spatial Gaussian distribution with cut-off. (id=3) More...
 
subroutine waterxyz_dist (ptxyz, avgpts, sigx, sigy, sigz, xmu1, xmu3, x
 3D spatial Waterbag distribution. (id=34) More...
 
subroutine pxpypzgauss3d_dist (pmxyz, avgpts, sigpx, sigpy, sigpz, xmu
 3D Momentum Gaussian distribution. (id=1) More...
 
subroutine pxpygausspzsg_dist (pmxyz, avgpts, sigpx, sigpy, sigpz, xmu
 Momentum Gaussian distribution in transverse while longitudinal xexp(-x^2/sigz^2). (id=2) The longitudinal distribution follows Bird's book, p.129. More...
 
subroutine pxpypzstreakcam_dist (pmxyz, avgpts, emax, wkf, emass, xmu2
 Momentum distribution following the streak camera model. (id=3) both emax and wkf are in the units of eV. emass is also in eV. More...
 
subroutine pxpypz3step_dist (pmxyz, avgpts, Ef, Eph, Tem, Ewk, emass, xm
 Momentum distribution following the streak camera model. (id=4) momentum: following the 3 step model in David Dowell's PRSTAB paper v.12, 074201, 2009. momentum input parameters are: laser photon energy (eV), cathode temperature (eV), cathode effective work function (eV) (work function - surface field), Fermi energy of cathode material, emass (eV). More...
 
subroutine normveccut (y, num, cutx, cuty)
 

Detailed Description

This class defines initial distributions for the charged particle beam bunch information in the accelerator.

Author
Ji Qiang

Function/Subroutine Documentation

◆ combine_dist()

subroutine distributionclass::combine_dist ( type (beambunch), intent(inout)  this,
integer, intent(in)  nparam,
double precision, dimension(nparam)  distparam,
type (pgrid2d), intent(in)  grid,
integer, intent(in)  ib,
integer, intent(in)  Nb,
  flagdis 
)

generating initial particle distribution based on the combination of transverse spatial distribution (2 types), longitudinal spatial distribution (3 types) and 3D momentum distribution (4 types). For example, flagdist = 111 denotes type 1 from transverse spatial distribution, type 1 from longitudinal spatial distribution, and type 1 from 3D momentum distribution. In this case, it denotes a transverse uniform elliptical, longitudinal flat-top with linear ramping in spatial, and 3d full Gaussian distribution in momentum space. flagdist = ijk, where i = 1 (transverse uniform ellipse) and 2 (Gaussian with cut-off); j = 1 (flat-top with linear ramping), 2 (flat-top with 2sigma Gaussain ramping), and 3 (Gaussian with cut-off); k = 1, (3D Gaussian momentum), 2 (transverse Gaussian momentum, longitudinal semi-Gaussian), 3 (streak camera model), and 4 (3 step model).

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cylcoldzsob_dist()

subroutine distributionclass::cylcoldzsob_dist ( type (beambunch), intent(inout)  this,
integer, intent(in)  nparam,
double precision, dimension(nparam)  distparam,
type (pgrid2d), intent(in)  grid 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ gauss3_dist()

subroutine distributionclass::gauss3_dist ( type (beambunch), intent(inout)  this,
integer, intent(in)  nparam,
double precision, dimension(nparam)  distparam,
type (pgrid2d), intent(in)  grid,
integer, intent(in)  flagalloc 
)

6d Gaussian distribution

Here is the call graph for this function:
Here is the caller graph for this function:

◆ kv3d_dist()

subroutine distributionclass::kv3d_dist ( type (beambunch), intent(inout)  this,
integer, intent(in)  nparam,
double precision, dimension(nparam)  distparam,
type (pgrid2d), intent(in)  grid 
)

transverse KV distribution and longitudinal uniform distribution

Here is the call graph for this function:
Here is the caller graph for this function:

◆ longflattopgasz_dist()

subroutine distributionclass::longflattopgasz_dist ( real*8, dimension(avgpts0), intent(out)  ptz,
integer, intent(inout)  avgpts,
integer, intent(in)  avgpts0,
real*8, intent(in)  zscale,
  pzscal 
)

longitudinal spatial flat-top distribution with 2sigma Gaussian ramp. (id=2)

Here is the caller graph for this function:

◆ longflattoplinz_dist()

subroutine distributionclass::longflattoplinz_dist ( real*8, dimension(avgpts0), intent(out)  ptz,
integer, intent(inout)  avgpts,
integer, intent(in)  avgpts0,
real*8, intent(in)  zscale,
  pzscal 
)

longitudinal spatial flat-top distribution with linear ramp (id=1).

Here is the caller graph for this function:

◆ longgaussz_dist()

subroutine distributionclass::longgaussz_dist ( real*8, dimension(avgpts), intent(out)  ptz,
integer, intent(in)  avgpts,
real*8, intent(in)  sigz,
real*8, intent(in)  xmu5,
real*8, intent(in)  cutz 
)

longitudinal spatial Gaussian distribution with cut-off. (id=3)

Here is the call graph for this function:
Here is the caller graph for this function:

◆ normdv()

subroutine distributionclass::normdv ( double precision, dimension(2), intent(out)  y)

◆ normdv1d()

subroutine distributionclass::normdv1d ( double precision, intent(out)  y)

◆ normdv2()

subroutine distributionclass::normdv2 ( double precision, dimension(3), intent(out)  y)
Here is the caller graph for this function:

◆ normvec()

subroutine distributionclass::normvec ( double precision, dimension(2,num), intent(out)  y,
integer, intent(in)  num 
)
Here is the caller graph for this function:

◆ normveccut()

subroutine distributionclass::normveccut ( double precision, dimension(2,num), intent(out)  y,
integer, intent(in)  num,
real*8, intent(in)  cutx,
real*8, intent(in)  cuty 
)
Here is the caller graph for this function:

◆ psiroot()

subroutine distributionclass::psiroot ( real*8  rk,
real*8  xx,
real*8  xmod,
real*8  psi,
real*8  eps,
integer  Nmax 
)
Here is the caller graph for this function:

◆ pxpygausspzsg_dist()

subroutine distributionclass::pxpygausspzsg_dist ( real*8, dimension(3,avgpts), intent(out)  pmxyz,
integer, intent(in)  avgpts,
real*8, intent(in)  sigpx,
real*8, intent(in)  sigpy,
real*8, intent(in)  sigpz,
  xmu 
)

Momentum Gaussian distribution in transverse while longitudinal xexp(-x^2/sigz^2). (id=2) The longitudinal distribution follows Bird's book, p.129.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ pxpypz3step_dist()

subroutine distributionclass::pxpypz3step_dist ( real*8, dimension(3,avgpts), intent(out)  pmxyz,
integer, intent(in)  avgpts,
real*8, intent(in)  Ef,
real*8, intent(in)  Eph,
real*8, intent(in)  Tem,
real*8, intent(in)  Ewk,
real*8, intent(in)  emass,
  xm 
)

Momentum distribution following the streak camera model. (id=4) momentum: following the 3 step model in David Dowell's PRSTAB paper v.12, 074201, 2009. momentum input parameters are: laser photon energy (eV), cathode temperature (eV), cathode effective work function (eV) (work function - surface field), Fermi energy of cathode material, emass (eV).

Here is the caller graph for this function:

◆ pxpypzgauss3d_dist()

subroutine distributionclass::pxpypzgauss3d_dist ( real*8, dimension(3,avgpts), intent(out)  pmxyz,
integer, intent(in)  avgpts,
real*8, intent(in)  sigpx,
real*8, intent(in)  sigpy,
real*8, intent(in)  sigpz,
  xmu 
)

3D Momentum Gaussian distribution. (id=1)

Here is the call graph for this function:
Here is the caller graph for this function:

◆ pxpypzstreakcam_dist()

subroutine distributionclass::pxpypzstreakcam_dist ( real*8, dimension(3,avgpts), intent(out)  pmxyz,
integer, intent(in)  avgpts,
real*8, intent(in)  emax,
real*8, intent(in)  wkf,
real*8, intent(in)  emass,
real*8, intent(in)  xmu2 
)

Momentum distribution following the streak camera model. (id=3) both emax and wkf are in the units of eV. emass is also in eV.

Here is the caller graph for this function:

◆ read_dist()

subroutine distributionclass::read_dist ( type (beambunch), intent(inout)  this,
integer, intent(in)  nparam,
double precision, dimension(nparam)  distparam,
integer, intent(in)  ib 
)

read in an initial distribution with format (x(m), px/mc, y(m), py/mc,...)

Here is the caller graph for this function:

◆ readelegant_dist()

subroutine distributionclass::readelegant_dist ( type (beambunch), intent(inout)  this,
integer, intent(in)  nparam,
double precision, dimension(nparam)  distparam,
type (compdom), intent(in)  geom,
type (pgrid2d), intent(in)  grid,
  Flag 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ readparmela_dist()

subroutine distributionclass::readparmela_dist ( type (beambunch), intent(inout)  this,
integer, intent(in)  nparam,
double precision, dimension(nparam)  distparam,
type (compdom), intent(in)  geom,
type (pgrid2d), intent(in)  grid,
  Flag 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sample_dist()

subroutine distributionclass::sample_dist ( type (beambunch), intent(inout)  this,
double precision, dimension(nparam)  distparam,
integer, intent(in)  nparam,
integer, intent(in)  flagdist,
type (compdom), intent(in)  geom,
type (pgrid2d), intent(in)  grid 
)

sample the particles with intial distribution.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ semigauss_dist()

subroutine distributionclass::semigauss_dist ( type (beambunch), intent(inout)  this,
integer, intent(in)  nparam,
double precision, dimension(nparam)  distparam,
type (pgrid2d), intent(in)  grid 
)

3d Waterbag distribution in spatial and 3d Gaussian distribution in momentum space

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sobseq()

subroutine distributionclass::sobseq ( integer  n,
real*8, dimension(*)  x,
integer  iseed 
)
Here is the caller graph for this function:

◆ trangaussxy_dist()

subroutine distributionclass::trangaussxy_dist ( real*8, dimension(2,avgpts), intent(out)  ptxy,
integer, intent(in)  avgpts,
real*8, intent(in)  sigx,
real*8, intent(in)  sigy,
real*8, intent(in)  xmu1,
real*8, intent(in)  xmu3,
real*8, intent(in)  cutx 
)

transverse spatial Gaussian distribution with cut-off. (id=2)

Here is the call graph for this function:
Here is the caller graph for this function:

◆ tranunifxy_dist()

subroutine distributionclass::tranunifxy_dist ( real*8, dimension(2,avgpts), intent(out)  ptxy,
integer, intent(in)  avgpts,
real*8, intent(in)  sigx,
real*8, intent(in)  sigy,
real*8, intent(in)  xmu1,
real*8, intent(in)  xmu3 
)

transverse spatial uniform elleptical distribution. (id=1)

Here is the caller graph for this function:

◆ uniform_dist()

subroutine distributionclass::uniform_dist ( type (beambunch), intent(inout)  this,
integer, intent(in)  nparam,
double precision, dimension(nparam)  distparam,
type (pgrid2d), intent(in)  grid 
)

6d uniform distribution

Here is the call graph for this function:
Here is the caller graph for this function:

◆ waterbag_dist()

subroutine distributionclass::waterbag_dist ( type (beambunch), intent(inout)  this,
integer, intent(in)  nparam,
double precision, dimension(nparam)  distparam,
type (pgrid2d), intent(in)  grid,
integer, intent(in)  flagalloc 
)

6d Waterbag distribution. sample the particles with intial distribution using rejection method.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ waterxyz_dist()

subroutine distributionclass::waterxyz_dist ( real*8, dimension(3,avgpts), intent(out)  ptxyz,
integer, intent(in)  avgpts,
real*8, intent(in)  sigx,
real*8, intent(in)  sigy,
real*8, intent(in)  sigz,
real*8, intent(in)  xmu1,
real*8, intent(in)  xmu3,
  x 
)

3D spatial Waterbag distribution. (id=34)