Skip to content

bmad-sim/AcceleratorSimUtils.jl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

78 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AcceleratorSimUtils

Stable Dev Build Status

A package of utility routines for the simulation of high energy accelerators and storage rings. AcceleratorSimUtils is part of the SciBmad project.

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).
  • one_cos(x) - Calculate 1 - cos(x) to machine precision for x near zero.
  • sqrt_one(x) - Calculate sqrt(1+x) - 1 to machine precision.
  • un_sinc(x, n) - Calculate nth derivative of sin(x)/x to machine precision.
  • un_cosc(x, n) - Calculate nth derivative of (1 - cos(x)) / x^2 to machine precision.

Pink noise

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