module sim_decay_mod use bmad use sim_bpm_mod implicit none type meas_beam_struct real(rp) :: current = 7500 real(rp) :: I0 = 7500 real(rp) :: tau = -1 ! lifetime of beam; -1 = infinite end type meas_beam_struct contains !++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ! Subroutine sim_decay(beam, time) ! ! Simulate a simple exponential beam decay; for coarse beam current ! dependence studies. ! ! Input: ! beam -- meas_beam_struct ! %tau -- Lifetime, in seconds ! % I0 -- Initial current ! time -- Total time elapsed ! ! Output: ! beam ! %current -- Present current of the beam !-------------------------------------------------------------------------- subroutine sim_decay(beam, time) use bmad !use sim_meas_mod implicit none type(meas_beam_struct) :: beam real(rp), intent(in) :: time if (beam%tau .ne. -1) then beam%current = beam%I0 * exp(-time/beam%tau) endif end subroutine sim_decay end module sim_decay_mod