program test_ramp_function use bmad use ramp_parameters implicit none real(rp) t, frac_ref, f_AC/60./, extract_qv, extract_qh, extract_s, extract_octk3 real(rp) dt integer lun integer nturns integer n_fft/256/ integer nparticles integer ios real(rp) e_init, omega, rf_phase_twopi real(rp) initial_offset(6) real(rp) qvert,qhorz,ss, ext_time real(rp) emit_x, emit_y,sig_z, sig_e real(rp) circumference/755.8698/ real(rp) bump real(rp) bump_amp/1./ logical ramp_synch, phase_space logical aperture_limit_on/.false./ logical scale_emit/.false./ namelist/input/e_init, & !starting energy ramp_synch, & ! ramp t0, & ! start time nturns, & ! number of turns rf_phase_twopi, & ! RF phase initial_offset, & ! coord vec n_fft, & ! number of turns in each fft nparticles, & ! number of particles qvert,qhorz, & ! strength of detuning vertical and horizontal quads sextk2, & ! strength of sextupole octk3, & ! strength of octupole ext_time, & ! extraction start time turn_on_time, & ! time for detuning quads to get to full strength as fractin of ext_time emit_x, emit_y, sig_z, sig_e, & ! initial beam parameters ext_param, & ! multiplier of extraction sextupole or octupole x_septum, x_wall, t_septum, & ! extraction septum - center line to septum, center line to wall of vacuum chamber, thickness t1, & oct_ramp, quad_ramp, bump_ramp, sext_ramp, & ! oct_ramp(0:7000), octupole function, quad_ramp(0:7000) quad function, bump_ramp(0:7000) bump ramp * 60 hz phase_space, & ! if true write phase space for each particle each turn hbump, & ! hbump(1:3) in radians aperture_limit_on, & ! set true to turn on aperture limits scale_emit, & !scale emittance computed in init_beam_distribution to injection energy bump_amp ! amplitude of pulse bump oct_ramp=-1. quad_ramp=-1. bump_ramp = -1. sext_ramp = -1. lun = lunget() open(unit=lun, file='input.in', STATUS ='old') read(lun, nml=input, IOSTAT=ios) rewind(lun) read(lun, nml=input, IOSTAT=ios) close(unit=lun) write(6,nml=input) qv = qvert qh=qhorz t_ext = ext_time hbump(1:3) = bump_amp*hbump(1:3) lun=lunget() open(lun,file='ramp_functions.dat') write(lun,'(6a12)')'time','bends','vertical quad','horizontal quad','sextupole','octupole' t=0 dt = 2.e-6 do while(t< 1./60) call ramp_function(t, frac_ref, extract_qv, extract_qh, extract_s, extract_octk3, bump) write(lun,'(7es12.4)')t/circumference*c_light,frac_ref, extract_qv, extract_qh, extract_s, extract_octk3, bump t=t+dt end do end