Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidSagan committed Jun 2, 2024
2 parents cb929bd + 96c9a9b commit 25c1fa3
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 43 deletions.
2 changes: 1 addition & 1 deletion bmad/doc/elements.tex
Original file line number Diff line number Diff line change
Expand Up @@ -3389,7 +3389,7 @@ \section{Match}
alpha_a1, alpha_b1 = <Real> ! Exit alphas
eta_x0, eta_y0 = <Real> ! Entrance etas
eta_x1, eta_y1 = <Real> ! Exit etas
etap_x0, etap_y0 = <Real> ! Entrance eta'
etap_x0, etap_y0 = <Real> ! Entrance momentum dispersion
etap_x1, etap_y1 = <Real> ! Exit eta'
c11_mat0, c12_mat0, c21_mat0, c22_mat0 = <Real> ! Entrance coupling.
c11_mat1, c12_mat1, c21_mat1, c22_mat1 = <Real> ! Exit coupling.
Expand Down
13 changes: 6 additions & 7 deletions bmad/doc/linear-optics.tex
Original file line number Diff line number Diff line change
Expand Up @@ -389,22 +389,21 @@ \section{Dispersion Calculation}
\label{eedxdpz}
\end{equation}

There are two dispersion derivatives that Bmad uses. One dispersion derivative corresponds to
the definition used by the MAD and SAD programs
The associated momentum dispersion is:
\begin{equation}
\text{etap_x} = \equiv \left. \frac{dp_x}{dp_z} \right|_s \comma \qquad
\text{etap_y} = \equiv \left. \frac{dp_y}{dp_z} \right|_s \comma \qquad
\end{equation}
This dispersion derivative is useful when constructing particle bunch distributions and for
The momentum dispersion is useful when constructing particle bunch distributions and for
various calculations like for calculating radiation integrals.

To calulate the normal mode dispersions, \Eq{avx} is used to transform from laboratory to normal mode
coordinates.

The one drawback with the above dispersion derivative definition is that it is not always simply
related to the longitudinal derivative of the dispersion $d\eta/ds$. This becomes a factor when
designing lattices where, if some section of the lattice needs to be dispersion free, it is
convienient to be able to optimize $d\eta/ds$ to zero. $d\eta_{x,y}/ds$ is calculated from $dp_{x,y}/dp_z$ via
The one drawback with the momentum dispersion is that it is not always simply related to the
derivative of the dispersion $d\eta/ds$. This becomes a factor when designing lattices where, if
some section of the lattice needs to be dispersion free, it is convienient to be able to optimize
$d\eta/ds$ to zero. The dispersion derivative is related to the momentum dispersion by
\begin{align}
\text{deta_x_ds} &\equiv \frac{d\eta_x}{ds}
= \frac{d}{dp_z} \left( \frac{dx}{ds} \right)
Expand Down
6 changes: 4 additions & 2 deletions bmad/doc/normal-modes.tex
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ \section{Components in the Ele\_struct}
real(rp) gamma ! Twiss gamma function
real(rp) phi ! Normal mode Phase advance
real(rp) eta ! Normal mode dispersion
real(rp) etap ! Normal mode dispersion derivative
real(rp) etap ! Normal mode momentum dispersion.
real(rp) deta_ds ! Dispersion derivative
real(rp) sigma ! Normal mode beam size
real(rp) sigma_p ! Normal mode beam size derivative
real(rp) emit ! Geometric emittance
Expand All @@ -34,10 +35,11 @@ \section{Components in the Ele\_struct}
\begin{example}
type xy_disp_struct
real(rp) eta ! Projected dispersion
real(rp) etap ! Projected dispersion derivative \(dp_x/dp_z\) or \(dp_y/dp_z\).
real(rp) etap ! Projected momentum dispersion
real(rp) deta_ds ! Projected dispersion derivative \(d\eta_x/ds\) or \(d\eta_y/ds\).
end type
\end{example}
Section~\sref{s:dispersion} discussed the relationship between \vn{etap} and \vn{deta_ds}.

\index{ele_struct!\%emit}\index{ele_struct!\%norm_emit}
\index{ele_struct!\%sigma}\index{ele_struct!\%sigma_p}
Expand Down
17 changes: 13 additions & 4 deletions bmad/doc/param-statements.tex
Original file line number Diff line number Diff line change
Expand Up @@ -287,8 +287,10 @@ \section{Beginning and Line Parameter Statements}
beginning[e_tot] = <Real> ! Reference total energy in eV.
beginning[eta_x] = <Real> ! x-axis dispersion
beginning[eta_y] = <Real> ! y-axis dispersion
beginning[etap_x] = <Real> ! x-axis dispersion derivative.
beginning[etap_y] = <Real> ! y-axis dispersion derivative.
beginning[etap_x] = <Real> ! x-axis momentum dispersion.
beginning[etap_y] = <Real> ! y-axis momentum dispersion.
beginning[deta_x_ds] = <Real> ! x-axis dispersion derivative.
beginning[deta_y_ds] = <Real> ! y-axis dispersion derivative.
beginning[p0c] = <Real> ! Reference momentum in eV.
beginning[phi_a] = <Real> ! "a" mode phase.
beginning[phi_b] = <Real> ! "b" mode phase.
Expand All @@ -304,8 +306,15 @@ \section{Beginning and Line Parameter Statements}
\vn{parameter[e_tot]} are equivalent and one or the other may be set but not both. Similarly,
\vn{beginning[p0c]} and \vn{parameter[p0c]} are equivalent.

Setting \vn{etap_x} or \vn{etap_y} sets both types of dispersion derivatives (\sref{s:dispersion}). That
is, setting \vn{etap_x} sets both \vn{etap_x} and \vn{deta_x_ds} and similarly for \vn{etap_y}.
Setting either momentum dispersion \vn{etap_x} or \vn{etap_y} also sets the corresponding dispersion
derivative \vn{deta_x_ds} or \vn{deta_y_ds} (\sref{s:dispersion}). If a momentum dispersion is set
in the lattice file, or during program running the dispersion derivatives are ``slaved'' to the
momentum dispersion. That is, if the reference phase space momentum $p_z$ changes, the momentum
dispersions will be keept constant and the dispersion derivatives will be calculated from
\Eq{dexds}. Similarly, if a dispersion derivative is set in the lattice file or during program
running, the momentum dispersions are slaved to the dispersion derivative. Which is slaved to which is
determined by the last derivative set. If no derivatives are set, the dispersion derivatives are slaved
to the momentum dispersions.

\index{x_position}\index{y_position}\index{z_position}
\index{theta_position}\index{phi_position}\index{psi_position}
Expand Down
46 changes: 23 additions & 23 deletions regression_tests/slice_test/output.correct
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
"rfcav:dvec" ABS 1e-14 0.000000000E+00 0.000000000E+00 0.000000000E+00 0.000000000E+00 -1.734723476E-18 5.551115123E-17
"rfcav:dvec" ABS 1e-14 0.000000000E+00 0.000000000E+00 0.000000000E+00 0.000000000E+00 0.000000000E+00 1.110223025E-16
"rfcav:dt" ABS 1e-8 0.000000000E+00
"rfcav:dmat" ABS 1e-14 0.000000000E+00 0.000000000E+00 0.000000000E+00 0.000000000E+00 4.440892099E-16 2.220446049E-16
"rfcav-slice:beta" ABS 1e-8 1.000807273E+01 1.200672743E+01
"rfcav-slice:eta" ABS 1e-8 1.320608738E+00 -1.071519157E-03
"rfcav-rk:dvec" ABS 1e-14 -2.204729455E-13 -5.711106501E-13 -5.071785006E-13 -1.319730783E-12 -9.008072066E-14 -1.170247232E-11
"rfcav-rk:dt" ABS 1e-8 1.121376906E-12
"rfcav-rk:dmat" ABS 1e-10 7.513634159E-11 3.180973263E-10 5.425182525E-11 5.799237757E-10 2.671940447E-10 8.118381172E-09
"rfcav-slice:eta" ABS 1e-8 1.320561481E+00 -1.071480813E-03
"rfcav-rk:dvec" ABS 1e-14 -2.204742465E-13 -5.711156374E-13 -5.071837048E-13 -1.319744227E-12 -9.010327207E-14 -1.170258335E-11
"rfcav-rk:dt" ABS 1e-8 1.120880941E-12
"rfcav-rk:dmat" ABS 1e-10 7.502221067E-11 3.180806729E-10 5.358513633E-11 5.776182865E-10 2.650450970E-10 8.149309740E-09

"bend:dvec" ABS 1e-14 -1.009836961E-09 -1.766419991E-09 1.574831384E-09 2.249244938E-09 -6.361138873E-11 0.000000000E+00
"bend:dt" ABS 1e-8 6.378159729E-11
"bend:dmat" ABS 1e-14 1.527760873E-08 1.307392394E-08 1.428199103E-08 1.356393634E-08 5.429139971E-09 0.000000000E+00
"bend:dvec" ABS 1e-14 -1.009836981E-09 -1.766420081E-09 1.574831370E-09 2.249244862E-09 -6.361138179E-11 0.000000000E+00
"bend:dt" ABS 1e-8 6.378153530E-11
"bend:dmat" ABS 1e-14 1.527760879E-08 1.307392439E-08 1.428199103E-08 1.356393606E-08 5.429139971E-09 0.000000000E+00
"bend-slice:beta" ABS 1e-8 8.834758901E+00 5.094154149E+00
"bend-slice:eta" ABS 1e-8 5.414619401E-01 4.698985221E-01
"bend-slice:floor" ABS 1e-10 -3.699850353E-01 -3.116340961E-01 8.564321248E-01
Expand Down Expand Up @@ -45,10 +45,10 @@
"Dc:s" ABS 1e-14 0.000000000000E+00

"Dd:vec(1)" ABS 1e-14 6.886736867622E-13
"Dd:vec(2)" ABS 1e-14 -3.259835096628E-15
"Dd:vec(2)" ABS 1e-14 -3.148820840979E-15
"Dd:vec(3)" ABS 1e-14 2.091912509509E-13
"Dd:vec(4)" ABS 1e-14 -3.854638043454E-15
"Dd:vec(5)" ABS 1e-14 -1.030909705475E-13
"Dd:vec(5)" ABS 1e-14 -1.030909908763E-13
"Dd:vec(6)" ABS 1e-14 0.000000000000E+00

"a%beta " REL 1E-10 9.809753183868E+00
Expand Down Expand Up @@ -81,26 +81,26 @@
"Db:xmat_c(6,:)" ABS 1e-10 0.000000000000E+00 0.000000000000E+00 0.000000000000E+00 0.000000000000E+00 0.000000000000E+00 0.000000000000E+00
"Db:vec0_c(:)" ABS 1e-10 0.000000000000E+00 0.000000000000E+00 0.000000000000E+00 0.000000000000E+00 0.000000000000E+00 0.000000000000E+00

"Dd:xmat_c(1,:)" ABS 1e-10 -1.060957111054E-08 3.090635325442E-07 -2.433538759394E-09 7.077623348506E-08 0.000000000000E+00 1.484562472953E-12
"Dd:xmat_c(2,:)" ABS 1e-10 9.725905844582E-11 2.406340904315E-09 1.784855119605E-11 5.459191293467E-10 0.000000000000E+00 -3.472222509515E-14
"Dd:xmat_c(3,:)" ABS 1e-10 -2.385552255735E-09 6.947351427478E-08 1.041982211625E-08 -3.033581510437E-07 0.000000000000E+00 6.155356553847E-13
"Dd:xmat_c(1,:)" ABS 1e-10 -1.060957111054E-08 3.090635383174E-07 -2.433538759394E-09 7.077623362384E-08 0.000000000000E+00 1.484562472953E-12
"Dd:xmat_c(2,:)" ABS 1e-10 9.725907232361E-11 2.406340571248E-09 1.784855206341E-11 5.459190877133E-10 0.000000000000E+00 -3.477773624638E-14
"Dd:xmat_c(3,:)" ABS 1e-10 -2.385552255735E-09 6.947351427478E-08 1.041982211625E-08 -3.033581510437E-07 0.000000000000E+00 6.155356562318E-13
"Dd:xmat_c(4,:)" ABS 1e-10 5.203599313594E-11 -4.801946340560E-10 -2.313243416263E-10 2.085126515894E-09 0.000000000000E+00 1.788943621942E-14
"Dd:xmat_c(5,:)" ABS 1e-10 1.588906672900E-09 -4.609482129325E-08 3.643199318615E-10 -1.055576287143E-08 0.000000000000E+00 1.616114100184E-10
"Dd:xmat_c(5,:)" ABS 1e-10 1.588906756167E-09 -4.609483084117E-08 3.643199561476E-10 -1.055576447084E-08 0.000000000000E+00 1.616093890655E-10
"Dd:xmat_c(6,:)" ABS 1e-10 0.000000000000E+00 0.000000000000E+00 0.000000000000E+00 0.000000000000E+00 0.000000000000E+00 0.000000000000E+00
"Dd:vec0_c(:)" ABS 1e-10 6.885770626364E-13 -3.627084713020E-15 2.092933771091E-13 -3.761977918504E-15 -1.029589032114E-13 0.000000000000E+00
"LC-BS:vec(1)" ABS 1e-14 6.723158855965E-05 5.055363679757E-16
"LC-BS:vec(2)" ABS 1e-14 -5.769545859910E-06 -3.041305678434E-16
"Dd:vec0_c(:)" ABS 1e-10 6.885770761889E-13 -3.738101087907E-15 2.092933771091E-13 -3.761977918504E-15 -1.029588998232E-13 0.000000000000E+00
"LC-BS:vec(1)" ABS 1e-14 6.723158855965E-05 5.054821578671E-16
"LC-BS:vec(2)" ABS 1e-14 -5.769545859910E-06 -3.041085449868E-16
"LC-BS:vec(3)" ABS 1e-14 0.000000000000E+00 0.000000000000E+00
"LC-BS:vec(4)" ABS 1e-14 0.000000000000E+00 0.000000000000E+00
"LC-BS:vec(5)" ABS 2e-14 -2.879666598096E-10 -1.589314664865E-11
"LC-BS:vec(6)" ABS 4e-14 -4.877724411826E-10 4.124054163213E-11
"LC-BS:c*t" ABS 1e-14 2.005801927568E+00 1.591799725574E-11
"LC-BS:vec(5)" ABS 2e-14 -2.879666598096E-10 -1.589317089599E-11
"LC-BS:vec(6)" ABS 4e-14 -4.877724411826E-10 4.124095414893E-11
"LC-BS:c*t" ABS 1e-14 2.005801927568E+00 1.591923716829E-11

"LC-BS:D:a%beta" ABS 1e-12 16.60358993314493 0.00000000023711
"LC-BS:D:b%beta" ABS 1e-12 10.16475489612586 0.00000000013185
"LC-BS:D:a%beta" ABS 1e-12 16.60358993314493 0.00000000023707
"LC-BS:D:b%beta" ABS 1e-12 10.16475489612586 0.00000000013184
"LC-BS:D:a%alpha" ABS 1e-12 1.31728052001455 0.00000000008831
"LC-BS:D:b%alpha" ABS 1e-12 0.69301005416531 0.00000000005669
"LC-BS:D:a%eta" ABS 1e-12 1.85632256755489 0.06423141376393
"LC-BS:D:a%eta" ABS 1e-12 1.85632256755489 0.06423141376394
"LC-BS:D:b%eta" ABS 1e-12 0.00000000000000 0.00000000000000
"em_field_slave" ABS 1e-10 1.00000000E-04 0.00000000E+00 0.00000000E+00 0.00000000E+00 0.00000000E+00 0.00000000E+00

Expand Down
2 changes: 1 addition & 1 deletion tao/code/tao_beam_track_endpoint.f90
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ function tao_beam_track_endpoint (ele_id, lat, branch_str, where) result (ele)
return
end select

if (ele0%lord_status == super_lord$) ele0 => pointer_to_slave(ele0, ele%n_lord)
if (ele0%lord_status == super_lord$) ele0 => pointer_to_slave(ele0, ele0%n_lord)

if (ele0%n_slave /= 0) then
call out_io (s_error$, r_name, 'UNABLE TO ASSOCIATE BEAM ' // where // ' ELEMENT: ' // ele_id, &
Expand Down
10 changes: 5 additions & 5 deletions tao/doc/data.tex
Original file line number Diff line number Diff line change
Expand Up @@ -720,10 +720,10 @@ \section{Data Types Table}
\pref{element.attrib} & element_attrib.<attr_name> & lattice element attribute & lat & No \\ \hline
\pref{emit.a} & emit.a, .b, .c & Emittance & lat, beam & No \\ \hline
\pref{emit.x} & emit.x, .y, .z & Projected emittance & lat, beam & No \\ \hline
\pref{eta.x} & eta.x, .y, .z & Dispersion & lat, beam & Yes \\ \hline
\pref{eta.a} & eta.a, .b & Normal-mode dispersion & lat, beam & Yes \\ \hline
\pref{etap.x} & etap.x, .y & Momentum derivative & lat, beam & Yes \\ \hline
\pref{etap.a} & etap.a, .b & Momentum derivative & lat, beam & Yes \\ \hline
\pref{eta.x} & eta.x, .y, .z & Dispersions & lat, beam & Yes \\ \hline
\pref{eta.a} & eta.a, .b & Normal-mode dispersions & lat, beam & Yes \\ \hline
\pref{etap.x} & etap.x, .y & Momentum dispersions & lat, beam & Yes \\ \hline
\pref{etap.a} & etap.a, .b & Momentum dispersions & lat, beam & Yes \\ \hline
\pref{expression} & expression:<expression> & See text above & lat & No \\ \hline
\pref{floor} & \begin{tabular}{@{}l}
floor.x, .y, .z, \\
Expand Down Expand Up @@ -1018,7 +1018,7 @@ \section{Tao Data Types}\index{data!data Types}

%----------------------
\item[chrom.detap.x, .detap.y] \Newline \hlabel{chrom.detap}
The chromatic dispersion derivatives $\partial\eta'_{x,y}/\partial\delta$. Unlike the standard
The chromatic momentum dispersion derivatives $\partial\eta'_{x,y}/\partial\delta$. Unlike the standard
chromaticities,\vn{chrom.a} and \vn{chrom.b}, the these chromaticities are evaluated at
individual elements.

Expand Down

0 comments on commit 25c1fa3

Please sign in to comment.