Skip to content

Commit 645515f

Browse files
committed
The modified SNS linac lattice with SCL cavities installed during Power Upgrade Project (PUP) added to XML files. From now on we will use this lattice for all SNS linac simulations. Users can set some cavities amplitude to zero if they want to simulate the old SCL linac.
1 parent 88ac765 commit 645515f

File tree

4 files changed

+22921
-4711
lines changed

4 files changed

+22921
-4711
lines changed

examples/SNS_Linac/pyorbit3_linac_model/pyorbit3_sns_linac_mebt_hebt2.py

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,23 @@
1010
The usual BaseRF_Gap nodes have a zero length.
1111
1212
The apertures are added to the lattice.
13+
14+
There are two possible configurations:
15+
16+
1. SCL Linac last cavity is 23d - final energy 1 GeV
17+
xml_file_name = "../sns_linac_xml/sns_linac.xml"
18+
19+
2. SCL Linac last cavity is 32d - final energy 1.3 GeV
20+
xml_file_name = "../sns_linac_xml/sns_pup_linac.xml"
21+
22+
The output files will be:
23+
24+
file_out = open("pyorbit_twiss_sizes_ekin.dat", "w")
25+
or
26+
file_out = open("pyorbit_twiss_sizes_ekin_pup.dat", "w")
27+
28+
You have to edit script manually.
29+
1330
"""
1431

1532
import sys
@@ -57,7 +74,8 @@
5774
sns_linac_factory.setMaxDriftLength(0.01)
5875

5976
# ---- the XML file name with the structure
60-
xml_file_name = "../sns_linac_xml/sns_linac.xml"
77+
#xml_file_name = "../sns_linac_xml/sns_linac.xml"
78+
xml_file_name = "../sns_linac_xml/sns_pup_linac.xml"
6179

6280
# ---- make lattice from XML file
6381
accLattice = sns_linac_factory.getLinacAccLattice(names, xml_file_name)
@@ -103,8 +121,9 @@
103121
# Replace_BaseRF_Gap_to_AxisField_Nodes(accLattice,z_step,dir_location,["MEBT","CCL1","CCL2","CCL3","CCL4","SCLMed"])
104122

105123
# ------------------------------------------------------------------------------
106-
# accSeq_names = ["MEBT","DTL1","DTL2","DTL3","DTL4","DTL5","DTL6","CCL1","CCL2","CCL3","CCL4","SCLMed"]
107-
accSeq_names = ["MEBT", "DTL1", "DTL2", "DTL3", "DTL4", "DTL5", "DTL6"]
124+
accSeq_names = ["MEBT", "DTL1", "DTL2", "DTL3", "DTL4", "DTL5", "DTL6"]
125+
accSeq_names += ["CCL1","CCL2","CCL3","CCL4"]
126+
accSeq_names += ["SCLMed","SCLHigh"]
108127

109128
# ---- hard-edge quad models will be replaced with soft-edge models
110129
# ---- It is possible for DTL also - if the RF gap models are zero-length ones
@@ -273,7 +292,8 @@
273292

274293
twiss_analysis = BunchTwissAnalysis()
275294

276-
file_out = open("pyorbit_twiss_sizes_ekin.dat", "w")
295+
#file_out = open("pyorbit_twiss_sizes_ekin.dat", "w")
296+
file_out = open("pyorbit_twiss_sizes_ekin_pup.dat", "w")
277297

278298
s = " Node position "
279299
s += " alphaX betaX emittX normEmittX"
@@ -312,7 +332,7 @@ def action_entrance(paramsDict):
312332
# ---- phi_de_emittZ will be in [pi*deg*MeV]
313333
phi_de_emittZ = z_to_phase_coeff * emittZ
314334
eKin = bunch.getSyncParticle().kinEnergy() * 1.0e3
315-
s = " %35s %4.5f " % (node.getName(), pos + pos_start)
335+
s = " %45s %4.5f " % (node.getName(), pos + pos_start)
316336
s += " %6.4f %6.4f %6.4f %6.4f " % (alphaX, betaX, emittX, norm_emittX)
317337
s += " %6.4f %6.4f %6.4f %6.4f " % (alphaY, betaY, emittY, norm_emittY)
318338
s += " %6.4f %6.4f %6.4f %6.4f " % (alphaZ, betaZ, emittZ, phi_de_emittZ)
@@ -322,7 +342,7 @@ def action_entrance(paramsDict):
322342
file_out.flush()
323343
s_prt = " %5d %35s %4.5f " % (paramsDict["count"], node.getName(), pos + pos_start)
324344
s_prt += " %5.3f %5.3f %5.3f " % (x_rms, y_rms, z_rms_deg)
325-
s_prt += " %10.6f %8d " % (eKin, nParts)
345+
s_prt += " %10.4f %8d " % (eKin, nParts)
326346
print(s_prt)
327347

328348

0 commit comments

Comments
 (0)