Skip to content

Improve NG vs NG Tests #332

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 2 commits into from
Jun 27, 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
99 changes: 75 additions & 24 deletions tests/tests/test-ng-maps/test-ng-maps.mad
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ local function testQUAD() -- Test the body (~2 min)
local cfg = ref_cfg "quad" {
elm = "quadrupole 'quad' {at=0.75, l=1.5, k1=${bdir}*${k1}, k1s=${bdir}*${k1s},tilt=${tilt}, fringe=0}",
model = 1..2,
method = 2..6..2,
method = {"'teapot4'", 2, 4, 6, 8, "'teapot'"},
nslice = 1..3,
energy = {1, 6500}, -- {1, 450, 6500}

Expand Down Expand Up @@ -180,7 +180,7 @@ end

local function testSBEND() -- Test the body (~2 min)
local cfg = ref_cfg "sbend" {
elm = "sbend 'sbend' {at=0.75, l=1.5, k0=${bdir}*math.pi/${angle_div}, angle=${tdir}*math.pi/${angle_div}*1.5, fringe=0}",
elm = "sbend 'sbend' {at=0.75, l=1.5, k0=${k0}*${bdir}*math.pi/${angle_div}, angle=${tdir}*math.pi/${angle_div}*1.5, fringe=0}",
model = {1, 2},
method = 2..8..2,
nslice = 1..3,
Expand All @@ -189,7 +189,8 @@ local function testSBEND() -- Test the body (~2 min)
tol = 600,

angle_div = {50, 100, 200, 500, 1000},
alist = tblcat(ref_cfg.alist, {"angle_div"}),
k0 = {0, 0.8, 1, 1.2},
alist = tblcat(ref_cfg.alist, {"angle_div", "k0"}),

plot_info = {
title = "SBend NG v NG Maps",
Expand All @@ -204,7 +205,7 @@ end
local function testRBEND() -- Test the body (~2 min)
local cfg = ref_cfg "rbend" {
elm = [[rbend 'rbend' {
at=0.75, l=1.5, k0=${bdir}*math.pi/${angle_div}, angle=${tdir}*math.pi/${angle_div}*1.5, fringe=0,
at=0.75, l=1.5, k0=${k0}*${bdir}*math.pi/${angle_div}, angle=${tdir}*math.pi/${angle_div}*1.5, fringe=0,
e1 = ${tdir}*${e1}*math.pi/${angle_div}*1.5, e2 = ${tdir}*${e2}*math.pi/${angle_div}*1.5,
true_rbend = ${true_rbend},
}]],
Expand All @@ -215,11 +216,12 @@ local function testRBEND() -- Test the body (~2 min)

tol = 2000,

angle_div = {50, 100, 200, 500, 1000},
angle_div = {50, 200, 1000},
k0 = {0, 0.8, 1},
true_rbend = {false, true},
e1 = {-0.15, 0, 0.2},
e2 = {-0.2, 0, 0.15},
alist = tblcat(ref_cfg.alist, {"true_rbend", "angle_div", "e1", "e2"}),
alist = tblcat(ref_cfg.alist, {"true_rbend", "k0", "angle_div", "e1", "e2"}),

plot_info = {
title = "RBend NG v NG Maps",
Expand Down Expand Up @@ -262,7 +264,7 @@ end

local function testRFMULTIPOLE()
local cfg = ref_cfg "rfmultipole" {
elm = "${element} 'rfm' {at=0.75, l=${l}, volt=0, freq=75, knl=${knl}, fringe=0}",
elm = "${element} 'rfm' {at=1.5, l=0, volt=0, freq=1, knl=${knl}, fringe=0}",
model = {1, 2},
method = 2..8..2,
nslice = 1..3,
Expand All @@ -275,29 +277,16 @@ local function testRFMULTIPOLE()

knl = {
{0, 0, 0, 0},
{0.5, 0, 0, 0},
-- {0.5, 0, 0, 0},
{0, 5, 0, 0},
{0, 0, 50, 0},
{0, 0, 0, 500},
{0.5, 5, 50, 500},
-- {0.5, 5, 50, 500},
},
alist = tblcat(ref_cfg.alist, {"knl"}),
}

local equiv = object "rfm" {
multipole = object {
"element", "l",
element := {
"multipole"
},
l = {0},

n = 1,
},

alist = {"multipole"},
}
run_test(cfg, equiv)
run_test(cfg, {alist={}})
end

local function testSOL()
Expand All @@ -312,15 +301,77 @@ local function testSOL()

ks = -0.6..0.6..0.3,
alist = tblcat(ref_cfg.alist, {"ks"}),
plot_info = {
title = "Solenoid NG v NG Maps",
filename = "solenoid-ngvng.png",
series = default_plot_cfg.series,
legend = default_plot_cfg.legend,
},
}

run_test(cfg, {alist={}})
end

local function testRFCAVITY()
local cfg = ref_cfg "rfcav" {
elm = "rfcavity 'rfcav' {l=1.5, volt=${bdir}*${volt}, freq=${freq}, lag=${lag}, fringe=0}",
model = {1, 2},
method = 2..8..2,
nslice = 1..3,
energy = {1, 6500},

tol = 100,

volt = {-8, 0, 8},
freq = {75, 150, 225},
lag = {0, 0.8},
alist = tblcat(ref_cfg.alist, {"volt", "freq", "lag"}),

plot_info = {
title = "RF Cavity NG v NG Maps",
filename = "rfcav-ngvng.png",
series = default_plot_cfg.series,
legend = default_plot_cfg.legend,
},
}

run_test(cfg, {alist={}})
end

local function testKICKER()
local cfg = ref_cfg "kicker" {
elm = "kicker 'kicker' {at=0.75, l=1.5, hkick=${bdir}*${hkick}, vkick=${bdir}*${vkick}}",

model = {1, 2},
method = 2..8..2,
nslice = 1..3,
energy = {1, 6500},

tol = 5,

hkick = {-2e-3, 0, 1.5e-3},
vkick = {-2e-3, 0, 1.5e-3},
alist = tblcat(ref_cfg.alist, {"hkick", "vkick"}),

plot_info = {
title = "Kicker NG v NG Maps",
filename = "kicker-ngvng.png",
series = default_plot_cfg.series,
legend = default_plot_cfg.legend,
},
}

run_test(cfg, {alist={}})
end


testQUAD()
testSEXT()
testOCT()
testSBEND()
testRBEND()
testRBENDPARALLEL()
-- testRFMULTIPOLE()
testRFMULTIPOLE()
testSOL()
testRFCAVITY()
testKICKER()