Skip to content

bmad-sim/AcceleratorSimUtils.jl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

71 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AcceleratorSimUtils

Stable Dev Build Status

A package of utility routines used by the SciBmad project for the simulation of high energy accelerators and storage rings.

Conversions of particle energy, momentum, speed, and γ factor

  • calc_E_kinetic(...) - Calculate kinetic energy.
  • calc_γ(...) - Calculate relativistic gamma factor.
  • calc_E_tot(...) - Calculate total energy.
  • calc_pc(...) - Calculate momentum * c.
  • calc_β(...) - Calculate velocity/c.
  • calc_1β(...) - Calculate 1 - β.
  • calc_changed_energy(...) - Calculate the new energy and momentum given initial momentum and energy change.

Math routines

  • modulo2(x, amp) - Calculate x + 2 * n * amp where the output is in the range [-amp, amp).
  • un_sinc(x, n) - Calculate nth derivative of sin(x)/x.
  • un_cosc(x, n) - Calculate nth derivative of (1 - cos(x)) / x^2.
  • one_cos(x) - Calculate 1 - cos(x).

Pink noise

  • gen_pinknoise(beta, size, dt, f0) - Random number generator that has a "pink noise spectrum.