Skip to content

Commit

Permalink
Merge pull request #29 from azukov/lattice
Browse files Browse the repository at this point in the history
Update SNS example lattice
  • Loading branch information
azukov authored Sep 30, 2024
2 parents 88ac765 + 6ab46ca commit 1e63c8a
Show file tree
Hide file tree
Showing 7 changed files with 22,926 additions and 4,713 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/compilation.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
name: build-pyorbit

on:
pull_request:
branches:
- main
push:
tags:
- '*'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/conda-tests.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
. /opt/conda/etc/profile.d/conda.sh
conda activate po3
cd examples/SNS_Linac/pyorbit3_linac_model/
python pyorbit3_sns_sts_linac_mebt_hebt2.py
python pyorbit3_sns_linac_mebt_hebt2.py
2 changes: 1 addition & 1 deletion .github/workflows/pip-tests.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
. .po3/bin/activate
cd examples/SNS_Linac/pyorbit3_linac_model/
python pyorbit3_sns_sts_linac_mebt_hebt2.py
python pyorbit3_sns_linac_mebt_hebt2.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,23 @@
The usual BaseRF_Gap nodes have a zero length.
The apertures are added to the lattice.
There are two possible configurations:
1. SCL Linac last cavity is 23d - final energy 1 GeV
xml_file_name = "../sns_linac_xml/sns_linac.xml"
2. SCL Linac last cavity is 32d - final energy 1.3 GeV
xml_file_name = "../sns_linac_xml/sns_pup_linac.xml"
The output files will be:
file_out = open("pyorbit_twiss_sizes_ekin.dat", "w")
or
file_out = open("pyorbit_twiss_sizes_ekin_pup.dat", "w")
You have to edit script manually.
"""

import sys
Expand Down Expand Up @@ -57,7 +74,8 @@
sns_linac_factory.setMaxDriftLength(0.01)

# ---- the XML file name with the structure
xml_file_name = "../sns_linac_xml/sns_linac.xml"
#xml_file_name = "../sns_linac_xml/sns_linac.xml"
xml_file_name = "../sns_linac_xml/sns_pup_linac.xml"

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

# ------------------------------------------------------------------------------
# accSeq_names = ["MEBT","DTL1","DTL2","DTL3","DTL4","DTL5","DTL6","CCL1","CCL2","CCL3","CCL4","SCLMed"]
accSeq_names = ["MEBT", "DTL1", "DTL2", "DTL3", "DTL4", "DTL5", "DTL6"]
accSeq_names = ["MEBT", "DTL1", "DTL2", "DTL3", "DTL4", "DTL5", "DTL6"]
accSeq_names += ["CCL1","CCL2","CCL3","CCL4"]
accSeq_names += ["SCLMed","SCLHigh"]

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

twiss_analysis = BunchTwissAnalysis()

file_out = open("pyorbit_twiss_sizes_ekin.dat", "w")
#file_out = open("pyorbit_twiss_sizes_ekin.dat", "w")
file_out = open("pyorbit_twiss_sizes_ekin_pup.dat", "w")

s = " Node position "
s += " alphaX betaX emittX normEmittX"
Expand Down Expand Up @@ -312,7 +332,7 @@ def action_entrance(paramsDict):
# ---- phi_de_emittZ will be in [pi*deg*MeV]
phi_de_emittZ = z_to_phase_coeff * emittZ
eKin = bunch.getSyncParticle().kinEnergy() * 1.0e3
s = " %35s %4.5f " % (node.getName(), pos + pos_start)
s = " %45s %4.5f " % (node.getName(), pos + pos_start)
s += " %6.4f %6.4f %6.4f %6.4f " % (alphaX, betaX, emittX, norm_emittX)
s += " %6.4f %6.4f %6.4f %6.4f " % (alphaY, betaY, emittY, norm_emittY)
s += " %6.4f %6.4f %6.4f %6.4f " % (alphaZ, betaZ, emittZ, phi_de_emittZ)
Expand All @@ -322,7 +342,7 @@ def action_entrance(paramsDict):
file_out.flush()
s_prt = " %5d %35s %4.5f " % (paramsDict["count"], node.getName(), pos + pos_start)
s_prt += " %5.3f %5.3f %5.3f " % (x_rms, y_rms, z_rms_deg)
s_prt += " %10.6f %8d " % (eKin, nParts)
s_prt += " %10.4f %8d " % (eKin, nParts)
print(s_prt)


Expand Down
Loading

0 comments on commit 1e63c8a

Please sign in to comment.