Skip to content
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

More ring design tutorial devel. #1110

Merged
merged 2 commits into from
Aug 1, 2024
Merged
Show file tree
Hide file tree
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
5 changes: 5 additions & 0 deletions bmad-doc/tao_examples/custom_tao_with_measured_data/README
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
Example of How to Create a Customized Version of Tao
---------------------------------------------------

This example uses real data from the Fermilab Recycler NOvA Ring curtesy of Meiqin Xiao.
Paper:
Linear Modelling and Lattice Correction from Betatron Phase Measurements at the Fermilab Recycler NOvA Ring
Meiqin Xiao(Fermilab), Kyle Hazelwood(Fermilab), Ming-Jen Yang(Fermilab), R. Ainsword(Fermilab)

Directory:
tao/examples/custom_tao_with_measured_data

Expand Down
Binary file modified bmad-doc/tutorial_ring_design/doc/figures/tunecell.pdf
Binary file not shown.
1 change: 1 addition & 0 deletions bmad-doc/tutorial_ring_design/doc/macros.tex
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@
\newcommand{\ltt}{{\sl Long Term Tracking}\xspace}
\newcommand{\da}{{\sl Dynamic Aperture}\xspace}
\newcommand{\sodom}{{\sl SODOM-2}\xspace}
\newcommand{\spinstrob}{{\sl spin_stroboscope}\xspace}
\newcommand{\bmad}{{\sl Bmad}\xspace}
\newcommand{\mad}{{\sl MAD}\xspace}
\newcommand{\quickplot}{{\sl Quick Plot}\xspace}
Expand Down
46 changes: 13 additions & 33 deletions bmad-doc/tutorial_ring_design/doc/tutorial_ring_design.tex
Original file line number Diff line number Diff line change
Expand Up @@ -1654,13 +1654,13 @@ \subsection{Example: tao.init for the Tune Cell}
\begin{code}
! Require periodic betas in center FoDo cells of 2 o'clock tune cell
datum(1) = 'expression: lat::beta.a[QFSS_2##4] - lat::beta.a[QFSS_2##5]'
'' '0' 'end' 'target' 0 10
'' '' '' 'target' 0 10
datum(2) = 'expression: lat::beta.b[QFSS_2##4] - lat::beta.b[QFSS_2##5]'
'' '0' 'end' 'target' 0 10
'' '' '' 'target' 0 10
datum(3) = 'expression: lat::alpha.a[QFSS_2##4] - lat::alpha.a[QFSS_2##5]'
'' '0' 'end' 'target' 0 10
'' '' '' 'target' 0 10
datum(4) = 'expression: lat::alpha.b[QFSS_2##4] - lat::alpha.b[QFSS_2##5]'
'' '0' 'end' 'target' 0 10
'' '' '' 'target' 0 10
\end{code}

The syntax \vn{lat::beta.a[QFSS_2\#\#4]} evaluates to the value of the \vn{a}-mode beta function at the fourth lattice element named \vn{QFSS_2}.
Expand Down Expand Up @@ -1835,10 +1835,10 @@ \subsection{Example}
Values at End of Element:
Index name key ... orbit ... spin
... x ... x
0 BEGINNING Beginning_Ele ... 0.000000E+00 ... 0.000000E+00
1 B Sbend ... 5.027722E-03 ... -1.414516E-01
2 Q Quadrupole ... -1.599068E-02 ... -7.350543E-02
3 END Marker ... -1.599068E-02 ... -7.350543E-02
0 BEGINNING Beginning_Ele ... 0.000000E+00 ... 1.000000E+00
1 B Sbend ... 2.888946E-02 ... 9.886413E-01
2 Q Quadrupole ... -1.847740E-02 ... 9.768026E-01
3 END Marker ... -1.847740E-02 ... 9.768026E-01
\end{code}

or the \vn{show element} command
Expand All @@ -1863,7 +1863,7 @@ \subsection{Exercises:}

\begin{enumerate}[leftmargin=*]
\item {\bf Phase Space:} Construct a lattice with a single drift of 2 meters length.
Set the particle species to be protons with a reference energy of $10^12$~eV (so the approximation
Set the particle species to be protons with a reference energy of $10^{12}$~eV (so the approximation
that the particle velocity is speed of light can be made), and
Set the initial particle position to have $p_x = 0.2$, $p_z = 1$ with all other coordinates
zero. Calculate from first principles what the phase space coordinates will be at the end of the
Expand Down Expand Up @@ -1988,7 +1988,7 @@ \subsection{Adding RF Cavities}

The example files for this section can be found at \vn{/lattices/9_RF/AddingRF/}

In a real machine, electrons emit synchrotron radiation as they bend around the ring, so we need to replenish the energy with an RF system. Let’s put RF cavities in the 10 o’clock straight section of our ring. We will design a special FODO cellwith RF cavities \vn{FODORF} and replace 4 FODO cells in the 10 o’clock straight section.
In a real machine, electrons emit synchrotron radiation as they bend around the ring, so we need to replenish the energy with an RF system. Let’s put RF cavities in the 10 o’clock straight section of our ring. We will design a special FODO cell with RF cavities \vn{FODORF} and replace 4 FODO cells in the 10 o’clock straight section.

In the ESR, there are two RF cavities of length $4.017 \textrm{m}$ between each quadrupole with equal drift spaces between each element. We will follow these dimensions as shown in Fig.~\ref{f:fodorf}.

Expand All @@ -2015,7 +2015,7 @@ \subsection{Example: Consturcting the FODO cell with RF cavities}
FODORF: line = (QFSS, DRF, RF0, DRF, RF0, DRF, QDSS, DRF, RF0, DRF, RF0, DRF)
\end{code}

\item Replace 4 FODO cells in the 10 o'clock section with \vn{FODORF} by modifying \vn{SEXTANT9} and \vn{SEXTANT9}:
\item Replace 4 FODO cells in the 10 o'clock section with \vn{FODORF} by modifying \vn{SEXTANT9} and \vn{SEXTANT11}:
\begin{code}
SEXTANT9: line = (4*FODOSSF, SS_TO_ARCF, 20*FODOAF,
ARC_TO_SSF, 2*FODOSSF, 2*FODORF)
Expand All @@ -2036,7 +2036,7 @@ \subsection{Exercises}
%
\item
Modify the \vn{lcavity} in the \vn{cavity.bmad} to have a small length (so the transit time is
small), and set the beginning momentum small enough so the relativistic beta is significantly than
small), and set the beginning momentum small enough so the relativistic beta is significantly less than
one. Starting the particle with a finite $z$, calculate the ending $z$ after the cavity and verity
that the change in $z$ is consistent with what Bmad calculates.
%
Expand Down Expand Up @@ -3214,32 +3214,12 @@ \subsection{Exercises}
\begin{enumerate}[leftmargin=*]
%
\item {\bf Zero orbit at IP:}
Use 4 horizontal/vertical kickers around the IP (CH/V_104 to CH/V_107, 8 total kickers) to make the orbit exactly 0 at the IP without affecting the rest of the ring.
Use 4 horizontal/vertical kickers around the IP (CH/V\_104 to CH/V\_107, 8 total kickers) to make the orbit exactly 0 at the IP without affecting the rest of the ring.
%
\end{enumerate}

\newpage

%------------------------------------------------------------------------------
%------------------------------------------------------------------------------
%\section{Tracking with Ramping and Spin Tracking}

%------------------------------------------------------------------------------
%\subsection{Tracking with Ramping}
%The ESR will not be used to accelerate, however to show what ramping in Bmad might look like we include this section.

%------------------------------------------------------------------------------
%\subsection{Adding Siberian Snakes}
%Taylor element overview



%------------------------------------------------------------------------------
%\subsection{Invariant Spin Field Calculations}
%\sodom $\rightarrow$ \ltt

%\newpage

%------------------------------------------------------------------------------
%------------------------------------------------------------------------------
\appendix
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
beginning[beta_a] = 10. ! m a-mode beta function
beginning[beta_b] = 10. ! m b-mode beta function
beginning[e_tot] = 10e6 ! eV
parameter[geometry] = open ! or closed
parameter[geometry] = open з! or closed
bmad_com[spin_tracking_on] = T

particle_start[y] = 0.01
Expand Down
2 changes: 1 addition & 1 deletion bmad/calculations/exact_bend_multipole/convert.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3

# Script for processing the Mathematica output for exact bend multipoles into Fortran form.
# The output is a temporary that must be cut and pasted as appropriate.
Expand Down
2 changes: 1 addition & 1 deletion bmad/doc/cover-page.tex
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

\begin{flushright}
\large
Revision: July 14, 2024 \\
Revision: July 30, 2024 \\
\end{flushright}

\pdfbookmark[0]{Preamble}{Preamble}
Expand Down
2 changes: 1 addition & 1 deletion bmad/doc/example-program.tex
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ \section{A First Program}
Consider the example program shown in \fig{f:program}. The source code for this program is provided
with \bmad in the directory:
\begin{example}
\$ACC_ROOT_DIR/examples/simple_bmad_program
\$ACC_ROOT_DIR/code_examples/simple_bmad_program
\end{example}
[Note: \vn{\$ACC_ROOT_DIR} is the root directory of the \bmad \vn{Distribution} when you are running
``off-site'' and is root directory of the \vn{Release} when you are running ``on-site''.]
Expand Down
37 changes: 19 additions & 18 deletions bmad/doc/list-element-attributes.tex
Original file line number Diff line number Diff line change
Expand Up @@ -84,24 +84,25 @@ \chapter{List of Element Attributes}
\label{s:list.beambeam}

\begin{tabular}{llll} \toprule
alias & crab_x3 [1/m$^2$] & p0c [eV] & wrap_superimpose \\
alpha_a_strong & crab_x4 [1/m$^3$] & ptc_integration_type & x1_limit [m] \\
alpha_b_strong & crab_x5 [1/m$^4$] & ref_origin & x2_limit [m] \\
aperture [m] & create_jumbo_slave & ref_time_start [sec] & x_limit [m] \\
aperture_at & delta_ref_time [sec] & reference & x_offset [m] \\
aperture_type & descrip & repetition_frequency [Hz] & x_offset_tot [m] \\
bbi_constant & e_tot [eV] & sig_x [m] & x_pitch [rad] \\
beta_a_strong [m] & e_tot_strong [eV] & sig_y [m] & x_pitch_tot [rad] \\
beta_b_strong [m] & ele_origin & sig_z [m] & y1_limit [m] \\
bs_field [T] & field_calc & species_strong & y2_limit [m] \\
charge & is_on & spin_tracking_method & y_limit [m] \\
cmat_11 & ks [1/m] & superimpose & y_offset [m] \\
cmat_12 & l [m] & symplectify & y_offset_tot [m] \\
cmat_21 & mat6_calc_method & tilt [rad] & y_pitch [rad] \\
cmat_22 & n_particle & tilt_tot [rad] & y_pitch_tot [rad] \\
crab_tilt [rad] & n_slice & tracking_method & z_crossing [m] \\
crab_x1 & offset [m] & type & z_offset [m] \\
crab_x2 [1/m] & offset_moves_aperture & wall & z_offset_tot [m] \\
alias & crab_x4 [1/m$^3$] & ref_origin & x2_limit [m] \\
alpha_a_strong & crab_x5 [1/m$^4$] & ref_time_start [sec] & x_limit [m] \\
alpha_b_strong & create_jumbo_slave & reference & x_offset [m] \\
aperture [m] & delta_ref_time [sec] & repetition_frequency [Hz] & x_offset_tot [m] \\
aperture_at & descrip & s_twiss_ref [m] & x_pitch [rad] \\
aperture_type & e_tot [eV] & sig_x [m] & x_pitch_tot [rad] \\
bbi_constant & e_tot_strong [eV] & sig_y [m] & y1_limit [m] \\
beta_a_strong [m] & ele_origin & sig_z [m] & y2_limit [m] \\
beta_b_strong [m] & field_calc & species_strong & y_limit [m] \\
bs_field [T] & is_on & spin_tracking_method & y_offset [m] \\
charge & ks [1/m] & superimpose & y_offset_tot [m] \\
cmat_11 & l [m] & symplectify & y_pitch [rad] \\
cmat_12 & mat6_calc_method & tilt [rad] & y_pitch_tot [rad] \\
cmat_21 & n_particle & tilt_tot [rad] & z_crossing [m] \\
cmat_22 & n_slice & tracking_method & z_offset [m] \\
crab_tilt [rad] & offset [m] & type & z_offset_tot [m] \\
crab_x1 & offset_moves_aperture & wall & \\
crab_x2 [1/m] & p0c [eV] & wrap_superimpose & \\
crab_x3 [1/m$^2$] & ptc_integration_type & x1_limit [m] & \\
\bottomrule
\end{tabular}
\vfill
Expand Down
2 changes: 1 addition & 1 deletion bsim/bbu/collect_thresholds.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3

import os, sys

Expand Down
2 changes: 1 addition & 1 deletion bsim/bbu/test_run.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
import os, sys, shutil, glob, tempfile, time
from bbu import bbu_main, find_threshold, drscan, phase_scan #imports bbu package in user python path

Expand Down
2 changes: 1 addition & 1 deletion bsim/spin_stroboscope/plotting/invariant_spin.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3

import sys
import numpy as np
Expand Down
2 changes: 1 addition & 1 deletion bsim/tune_scan/plotting/tune_scan_density_plot.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3

# To execute this file from within the Python interpreter:
# execfile('this_file_name')
Expand Down
2 changes: 1 addition & 1 deletion cpp_bmad_interface/scripts/bmad_enums_to_c.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3

# Note:
# Run this script in the cpp_bmad_interface directory.
Expand Down
2 changes: 1 addition & 1 deletion cpp_bmad_interface/scripts/create_interface.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3

# Note: Run this script in the cpp_bmad_interface directory.

Expand Down
2 changes: 1 addition & 1 deletion lux/doc/lux.tex
Original file line number Diff line number Diff line change
Expand Up @@ -879,7 +879,7 @@ \section{Python Scripting}
Example:
\begin{listing}{1}
#!/usr/bin/env python
#!/usr/bin/env python3
import subprocess
import glob
Expand Down
2 changes: 1 addition & 1 deletion lux/scripts/combine_det_pix_files.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3

# Script to combine det_pix output files from Lux into one det_pix file.
# This is useful when a simulation has to be broken up into multiple runs.
Expand Down
2 changes: 1 addition & 1 deletion lux/scripts/plot_det_pix.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3

# To execute this file from within the Python interpreter:
# execfile('this_file_name')
Expand Down
2 changes: 1 addition & 1 deletion regression_tests/scripts/run_tests.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3

#+
# Script to run regression tests for the Bmad libraries.
Expand Down
2 changes: 1 addition & 1 deletion tao/doc/generate_tex_for_python_commands.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
# coding: utf-8

# # Generate documentation for Tao python commands.
Expand Down
2 changes: 1 addition & 1 deletion tao/version/tao_version_mod.f90
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
!-

module tao_version_mod
character(*), parameter :: tao_version_date = "2024/07/26 21:59:14"
character(*), parameter :: tao_version_date = "2024/07/30 17:00:42"
end module
2 changes: 1 addition & 1 deletion util/create_searchf_namelist
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3

#+
# Script to create the searchf.namelist files so that getf and listf can do faster searches.
Expand Down
2 changes: 1 addition & 1 deletion util/getf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3

#+
# See searchf.py for all documentation
Expand Down
2 changes: 1 addition & 1 deletion util/listf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3

#+
# See searchf.py for all documentation
Expand Down
2 changes: 1 addition & 1 deletion util/raw_list
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3

#+
# Script for finding and printing structure definitions.
Expand Down
2 changes: 1 addition & 1 deletion util/searchf.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3

#+
# searchf.py is the file that holds the code for the scripts:
Expand Down
2 changes: 1 addition & 1 deletion util_programs/elegant_to_bmad/elegant_to_bmad.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3

#+
# Script to convert from Elegant lattice format to Bmad lattice format.
Expand Down
2 changes: 1 addition & 1 deletion util_programs/mad_to_bmad/mad8_to_bmad.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3

#+
# Script to convert from MAD8 lattice format to Bmad lattice format.
Expand Down
2 changes: 1 addition & 1 deletion util_programs/mad_to_bmad/madx_to_bmad.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3

#+
# Script to convert from MADX lattice format to Bmad lattice format.
Expand Down
2 changes: 1 addition & 1 deletion util_programs/slicktrack_to_bmad/slicktrack_to_bmad.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3

from itertools import tee
import sys
Expand Down