Skip to content

Fix backtracking, edir and chg in thin solenoid. #318

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 1 commit into from
Jun 2, 2023
Merged
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
12 changes: 6 additions & 6 deletions src/madl_dynmap.mad
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ function M.strex_kickhs (elm, m, lw) -- [KICKT] --

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

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

Expand Down Expand Up @@ -547,10 +547,10 @@ function M.strex_kickhs (elm, m, lw) -- [KICKT] --
-- solenoid
if ksi ~= 0 and lrad ~= 0 then
local px, py in m[i]
local hss = (ksi^2/lrad) -- 4 H(s_0)^2/ds
local hss = sdir*(ksi^2/lrad) -- 4 H(s_0)^2/ds
local _dpp = 1/pz
local _dp = _dpp^2
local ang = (0.5*ksi*lw)*_dpp
local ang = (wchg*0.5*ksi)*_dpp
local ca, sa = cos(ang), sin(ang)

local nx = ca* x + sa* y
Expand All @@ -560,10 +560,10 @@ function M.strex_kickhs (elm, m, lw) -- [KICKT] --
local nt = m[i].t - ang*(_beta+pt)*(y*px - x*py)*_dp

m[i].x = nx
m[i].px = npx - 0.25*(wchg*hss)*nx*_dpp
m[i].px = npx - (0.25 *hss)*nx*_dpp
m[i].y = ny
m[i].py = npy - 0.25*(wchg*hss)*ny*_dpp
m[i].t = nt - 0.125*(_beta+pt)*(wchg*hss)*(nx^2+ny^2)*_dpp^3
m[i].py = npy - (0.25 *hss)*ny*_dpp
m[i].t = nt - (0.125*hss)*(_beta+pt)*(nx^2+ny^2)*_dpp^3
end
end

Expand Down