Skip to content

Element Map Fixes: Multipole #278

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Mar 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/madl_dynmap.mad
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,7 @@ function M.strex_kickh (elm, m, lw) -- [KICKT] --

m.atdebug(elm, m, lw, 'strex_kickh:0')

local el, eh, tdir, nmul, knl, ksl, beam in m
local el, tdir, nmul, knl, ksl, beam in m
local wchg = lw*tdir*beam.charge
local _beta = 1/beam.beta

Expand All @@ -519,10 +519,10 @@ function M.strex_kickh (elm, m, lw) -- [KICKT] --
m[i].py = py + wchg*(bx - ksl[1]*pz)
m[i].t = t - wchg*(knl[1]*x - ksl[1]*y)*(_beta+pt)/pz

-- curvature
if eh ~= 0 then
m[i].px = m[i].px - (knl[1]^2/eh)*x -- eh was el
m[i].py = m[i].py - (ksl[1]^2/eh)*y -- eh was el
-- field curvature
if el ~= 0 then
m[i].px = m[i].px - wchg*(knl[1]^2/el)*x
m[i].py = m[i].py - wchg*(ksl[1]^2/el)*y
end
end

Expand Down
6 changes: 3 additions & 3 deletions src/madl_etrck.mad
Original file line number Diff line number Diff line change
Expand Up @@ -246,13 +246,13 @@ local function track_multipole (elm, m)

if m.nmul == 0 then return track_marker(elm, m) end

local angle, ksi, lrad in elm
local angle, ksi, lrad, knl, ksl in elm
local edir in m

m.el, m.eh = 0, lrad ~= 0 and angle/lrad*edir or 0
m.el = lrad

local kick = strex_kick
if abs(angle) >= minang then
if abs(knl[1]) + abs(ksl[1]) >= minang then
kick = strex_kickh
elseif abs(ksi) >= minstr then
m.ksi = ksi
Expand Down