Skip to content

Commit

Permalink
Fix update of p0c.
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidSagan committed Dec 13, 2024
1 parent 028ad62 commit b437da8
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions bmad/ptc/update_fibre_from_ele.f90
Original file line number Diff line number Diff line change
Expand Up @@ -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(:)
Expand All @@ -44,13 +45,18 @@ 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

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$))
Expand All @@ -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
Expand Down

0 comments on commit b437da8

Please sign in to comment.