Skip to content

Commit 937776a

Browse files
authored
Merge pull request #332 from jgray-19/ng_vs_ng
Improve NG vs NG Tests
2 parents a745d41 + 1735e87 commit 937776a

File tree

1 file changed

+75
-24
lines changed

1 file changed

+75
-24
lines changed

tests/tests/test-ng-maps/test-ng-maps.mad

Lines changed: 75 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ local function testQUAD() -- Test the body (~2 min)
7171
local cfg = ref_cfg "quad" {
7272
elm = "quadrupole 'quad' {at=0.75, l=1.5, k1=${bdir}*${k1}, k1s=${bdir}*${k1s},tilt=${tilt}, fringe=0}",
7373
model = 1..2,
74-
method = 2..6..2,
74+
method = {"'teapot4'", 2, 4, 6, 8, "'teapot'"},
7575
nslice = 1..3,
7676
energy = {1, 6500}, -- {1, 450, 6500}
7777

@@ -180,7 +180,7 @@ end
180180

181181
local function testSBEND() -- Test the body (~2 min)
182182
local cfg = ref_cfg "sbend" {
183-
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}",
183+
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}",
184184
model = {1, 2},
185185
method = 2..8..2,
186186
nslice = 1..3,
@@ -189,7 +189,8 @@ local function testSBEND() -- Test the body (~2 min)
189189
tol = 600,
190190

191191
angle_div = {50, 100, 200, 500, 1000},
192-
alist = tblcat(ref_cfg.alist, {"angle_div"}),
192+
k0 = {0, 0.8, 1, 1.2},
193+
alist = tblcat(ref_cfg.alist, {"angle_div", "k0"}),
193194

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

216217
tol = 2000,
217218

218-
angle_div = {50, 100, 200, 500, 1000},
219+
angle_div = {50, 200, 1000},
220+
k0 = {0, 0.8, 1},
219221
true_rbend = {false, true},
220222
e1 = {-0.15, 0, 0.2},
221223
e2 = {-0.2, 0, 0.15},
222-
alist = tblcat(ref_cfg.alist, {"true_rbend", "angle_div", "e1", "e2"}),
224+
alist = tblcat(ref_cfg.alist, {"true_rbend", "k0", "angle_div", "e1", "e2"}),
223225

224226
plot_info = {
225227
title = "RBend NG v NG Maps",
@@ -262,7 +264,7 @@ end
262264

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

276278
knl = {
277279
{0, 0, 0, 0},
278-
{0.5, 0, 0, 0},
280+
-- {0.5, 0, 0, 0},
279281
{0, 5, 0, 0},
280282
{0, 0, 50, 0},
281283
{0, 0, 0, 500},
282-
{0.5, 5, 50, 500},
284+
-- {0.5, 5, 50, 500},
283285
},
284286
alist = tblcat(ref_cfg.alist, {"knl"}),
285287
}
286288

287-
local equiv = object "rfm" {
288-
multipole = object {
289-
"element", "l",
290-
element := {
291-
"multipole"
292-
},
293-
l = {0},
294-
295-
n = 1,
296-
},
297-
298-
alist = {"multipole"},
299-
}
300-
run_test(cfg, equiv)
289+
run_test(cfg, {alist={}})
301290
end
302291

303292
local function testSOL()
@@ -312,15 +301,77 @@ local function testSOL()
312301

313302
ks = -0.6..0.6..0.3,
314303
alist = tblcat(ref_cfg.alist, {"ks"}),
304+
plot_info = {
305+
title = "Solenoid NG v NG Maps",
306+
filename = "solenoid-ngvng.png",
307+
series = default_plot_cfg.series,
308+
legend = default_plot_cfg.legend,
309+
},
310+
}
311+
312+
run_test(cfg, {alist={}})
313+
end
314+
315+
local function testRFCAVITY()
316+
local cfg = ref_cfg "rfcav" {
317+
elm = "rfcavity 'rfcav' {l=1.5, volt=${bdir}*${volt}, freq=${freq}, lag=${lag}, fringe=0}",
318+
model = {1, 2},
319+
method = 2..8..2,
320+
nslice = 1..3,
321+
energy = {1, 6500},
322+
323+
tol = 100,
324+
325+
volt = {-8, 0, 8},
326+
freq = {75, 150, 225},
327+
lag = {0, 0.8},
328+
alist = tblcat(ref_cfg.alist, {"volt", "freq", "lag"}),
329+
330+
plot_info = {
331+
title = "RF Cavity NG v NG Maps",
332+
filename = "rfcav-ngvng.png",
333+
series = default_plot_cfg.series,
334+
legend = default_plot_cfg.legend,
335+
},
315336
}
337+
316338
run_test(cfg, {alist={}})
317339
end
318340

341+
local function testKICKER()
342+
local cfg = ref_cfg "kicker" {
343+
elm = "kicker 'kicker' {at=0.75, l=1.5, hkick=${bdir}*${hkick}, vkick=${bdir}*${vkick}}",
344+
345+
model = {1, 2},
346+
method = 2..8..2,
347+
nslice = 1..3,
348+
energy = {1, 6500},
349+
350+
tol = 5,
351+
352+
hkick = {-2e-3, 0, 1.5e-3},
353+
vkick = {-2e-3, 0, 1.5e-3},
354+
alist = tblcat(ref_cfg.alist, {"hkick", "vkick"}),
355+
356+
plot_info = {
357+
title = "Kicker NG v NG Maps",
358+
filename = "kicker-ngvng.png",
359+
series = default_plot_cfg.series,
360+
legend = default_plot_cfg.legend,
361+
},
362+
}
363+
364+
run_test(cfg, {alist={}})
365+
end
366+
367+
319368
testQUAD()
320369
testSEXT()
321370
testOCT()
322371
testSBEND()
323372
testRBEND()
324373
testRBENDPARALLEL()
325-
-- testRFMULTIPOLE()
374+
testRFMULTIPOLE()
326375
testSOL()
376+
testRFCAVITY()
377+
testKICKER()

0 commit comments

Comments
 (0)