@@ -322,7 +322,7 @@ recursive subroutine em_field_calc (ele, param, s_pos, orbit, local_ref_frame, f
322322 if (present (rf_time)) then
323323 time = rf_time
324324 else
325- time = particle_rf_time(orbit, ele, .false. , s_body)
325+ time = particle_rf_time(orbit, ele, .false. , s_body, rf_freq = ele % value(rf_frequency$) )
326326 endif
327327 phase = twopi * (ele% value(phi0$) + ele% value(phi0_multipass$) + ele% value(phi0_autoscale$) - &
328328 (time - rf_ref_time_offset(ele) - s_body/ c_light) * ele% value(rf_frequency$))
@@ -347,7 +347,7 @@ recursive subroutine em_field_calc (ele, param, s_pos, orbit, local_ref_frame, f
347347 if (present (rf_time)) then
348348 time = rf_time
349349 else
350- time = particle_rf_time(orbit, ele, .true. , s_body)
350+ time = particle_rf_time(orbit, ele, .true. , s_body, rf_freq = ele % value(rf_frequency$) )
351351 endif
352352 phase = (ele% value(phi0$) + ele% value(phi0_multipass$) + ele% value(phi0_err$) + ele% value(phi0_autoscale$))
353353 field% e(3 ) = e_accel_field (ele, gradient$) * cos (twopi * (time * ele% value(rf_frequency$) + phase)) / ref_charge
@@ -425,7 +425,7 @@ recursive subroutine em_field_calc (ele, param, s_pos, orbit, local_ref_frame, f
425425 if (present (rf_time)) then
426426 time = rf_time
427427 else
428- time = particle_rf_time(orbit, ele, .true. , s_body)
428+ time = particle_rf_time(orbit, ele, .true. , s_body, rf_freq = ele % value(rf_frequency$) )
429429 endif
430430
431431 if (nint (ele% value(cavity_type$)) == traveling_wave$) then
@@ -782,13 +782,6 @@ recursive subroutine em_field_calc (ele, param, s_pos, orbit, local_ref_frame, f
782782! FieldMap
783783
784784case (fieldmap$)
785-
786- if (present (rf_time)) then
787- time = rf_time
788- else
789- time = particle_rf_time(orbit, ele, .false. , s_body)
790- endif
791-
792785 if (.not. associated (ele% cylindrical_map) .and. .not. associated (ele% cartesian_map) .and. &
793786 .not. associated (ele% gen_grad_map) .and. .not. associated (ele% grid_field)) then
794787 call out_io (s_fatal$, r_name, ' No associated fieldmap (cartesican_map, grid_field, etc) FOR: ' // ele% name)
@@ -1108,6 +1101,12 @@ recursive subroutine em_field_calc (ele, param, s_pos, orbit, local_ref_frame, f
11081101 freq0 = ele% value(rf_frequency$)
11091102 freq = ele% value(rf_frequency$) * cl_map% harmonic
11101103
1104+ if (present (rf_time)) then
1105+ time = rf_time
1106+ else
1107+ time = particle_rf_time(orbit, ele, .false. , s_body, rf_freq = freq0)
1108+ endif
1109+
11111110 if (freq0 == 0 ) then
11121111 call out_io (s_fatal$, r_name, ' Element frequency is zero but cylindrical_map harmonic is not in: ' // ele% name)
11131112 if (global_com% exit_on_error) call err_exit
@@ -1314,6 +1313,12 @@ recursive subroutine em_field_calc (ele, param, s_pos, orbit, local_ref_frame, f
13141313 return
13151314 endif
13161315
1316+ if (present (rf_time)) then
1317+ time = rf_time
1318+ else
1319+ time = particle_rf_time(orbit, ele, .false. , s_body, rf_freq = freq0)
1320+ endif
1321+
13171322 t_ref = (ele% value(phi0$) + ele% value(phi0_multipass$) + ele% value(phi0_err$) + &
13181323 phi0_autoscale + g_field% phi0_fieldmap) / freq0
13191324 if (ele% key == rfcavity$) t_ref = 0.25 / freq0 - t_ref
0 commit comments