From b437da8b8dcaafe5c8299e24ea63246faa955079 Mon Sep 17 00:00:00 2001 From: David Sagan Date: Thu, 12 Dec 2024 23:04:49 -0500 Subject: [PATCH] Fix update of p0c. --- bmad/ptc/update_fibre_from_ele.f90 | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/bmad/ptc/update_fibre_from_ele.f90 b/bmad/ptc/update_fibre_from_ele.f90 index 2ce2f2245..d6ef9228a 100644 --- a/bmad/ptc/update_fibre_from_ele.f90 +++ b/bmad/ptc/update_fibre_from_ele.f90 @@ -27,8 +27,9 @@ subroutine update_fibre_from_ele (ele, survey_needed) type (element), pointer :: mag type (elementp), pointer :: magp type (magnet_chart), pointer :: mp, mpp +type (work) ptc_work -real(rp) value, hk, vk, phi_tot, fh, volt +real(rp) value, hk, vk, phi_tot, fh, volt, delta_p real(rp) a_pole(0:n_pole_maxx), b_pole(0:n_pole_maxx) real(rp) a_ptc(0:n_pole_maxx), b_ptc(0:n_pole_maxx) real(rp), pointer :: val(:) @@ -44,6 +45,7 @@ subroutine update_fibre_from_ele (ele, survey_needed) branch => pointer_to_branch(ele) fib => ele%ptc_fibre val => ele%value +FEED_P0C = .true. mag => fib%mag magp => fib%magp @@ -51,6 +53,10 @@ subroutine update_fibre_from_ele (ele, survey_needed) mp => mag%p mpp => magp%p +ptc_work = fib +ptc_work = 1e-9_rp * val(p0c$) - mp%p0c +fib = ptc_work + cavity_type = not_set$ if (ele%key == rfcavity$ .or. ele%key == lcavity$) then cavity_type = nint(ele%value(cavity_type$)) @@ -67,8 +73,6 @@ subroutine update_fibre_from_ele (ele, survey_needed) call set_real_all (mp%lc, mpp%lc, val(l$)) endif -call set_real_all (mp%p0c, mpp%p0c, 1e-9_rp * val(p0c$)) - ! if (ele%key == marker$) return