Skip to content

Commit 1e63c8a

Browse files
authored
Merge pull request #29 from azukov/lattice
Update SNS example lattice
2 parents 88ac765 + 6ab46ca commit 1e63c8a

File tree

7 files changed

+22926
-4713
lines changed

7 files changed

+22926
-4713
lines changed

.github/workflows/compilation.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
name: build-pyorbit
22

33
on:
4+
pull_request:
5+
branches:
6+
- main
47
push:
58
tags:
69
- '*'

.github/workflows/conda-tests.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
. /opt/conda/etc/profile.d/conda.sh
22
conda activate po3
33
cd examples/SNS_Linac/pyorbit3_linac_model/
4-
python pyorbit3_sns_sts_linac_mebt_hebt2.py
4+
python pyorbit3_sns_linac_mebt_hebt2.py

.github/workflows/pip-tests.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
. .po3/bin/activate
22
cd examples/SNS_Linac/pyorbit3_linac_model/
3-
python pyorbit3_sns_sts_linac_mebt_hebt2.py
3+
python pyorbit3_sns_linac_mebt_hebt2.py

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)