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

Fixed ltt_track1_preprocess from being executed before LTT setup. #1121

Merged
merged 2 commits into from
Aug 3, 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
Binary file modified bmad-doc/other_manuals/long_term_tracking.pdf
Binary file not shown.
2 changes: 1 addition & 1 deletion bmad-doc/tutorial_ring_design/doc/tutorial_ring_design.tex
Original file line number Diff line number Diff line change
Expand Up @@ -3005,7 +3005,7 @@ \subsection{Exercises}
\item {\bf Alias command:} To save on typing, alias commands may be defined. Define an alias command called \vn{setit} so that typing ``\vn{setit 1e-6}'' is equivalent to ``\vn{set ele q vkick = 1e-6}''. Hint: Look in the manual or type ``\vn{help alias}'' to get more information on setting and using alias commands.
Note: Do not confuse \tao alias commands with the alias string component of a lattice element.
%
\item {\bf Adjust the tune using \vn{set tune}:} The tune of the lattice can also be set by using the \vn{set tune} command in \tao, which scales together all focusing quadrupoles and all defocusing quadrupoles to set the horizontal and vertical tunes. Using a lattice with the ring you have constrcted, use \vn{set tune -mask *,~QF,~QD 0.08 0.14} to set the tune of the ring. Plot the difference between the model and design lattices to see how much ``beta-beating'' there is around the ring.
\item {\bf Adjust the tune using \vn{set tune}:} The tune of the lattice can also be set by using the \vn{set tune} command in \tao, which scales together all focusing quadrupoles and all defocusing quadrupoles to set the horizontal and vertical tunes. Using a lattice with the ring you have constrcted, use \vn{set tune -mask *,$\sim$QF,$\sim$QD 0.08 0.14} to set the tune of the ring. Plot the difference between the model and design lattices to see how much ``beta-beating'' there is around the ring.
%
\end{enumerate}

Expand Down
30 changes: 15 additions & 15 deletions bsim/long_term_tracking/doc/long_term_tracking.tex
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@

\title{Long Term Tracking Program}
\author{}
\date{David Sagan \\ August 1, 2024}
\date{David Sagan \\ August 2, 2024}

\begin{document}
\pdfbookmark[1]{Contents}{contents}
Expand Down Expand Up @@ -215,7 +215,7 @@
then printed to the terminal. This mode can be used to get a sense of how the three different
methods compare to each other.

The starting coordinates are set by \vn{beam_init%center} and \vn{beam_init%spin} unless
The starting coordinates are set by \vn{beam_init%center} and \vn{beam_init%spin} unless the parameter
\vn{beam_init%use_particle_start} is set to True (the default is False). In this case, the
\vn{particle_start} commands in the lattice file are used to set the starting position. In both
cases, if \vn{ltt%add_closed_orbit_to_init_position} is set to True, the closed orbit will be added
Expand All @@ -228,11 +228,10 @@
\vn{bmad_com%d_orb}. This vector has 6 components, one for each phase space component. That is,
\vn{bmad_com%d_orb(1)} sets the variation of the $x$ phase space component, etc.

No data files are produced in this mode.

Radiation fluctuations are turned off in this mode but radiation damping will still be applied if
turned on.

No data files are produced in this mode.
%
\item["SINGLE"] \Newline
In this mode a single particle is tracked for \vn{ltt%n_turns} turns. The starting coordinates are
Expand Down Expand Up @@ -465,16 +464,17 @@
unnormalized strength \vn{B1_gradient} will remain fixed and normalized \vn{k1} will vary
inversely with the reference momentum.

There are two modes that can be selected to determine how ramper elements are applied. If
\vn{ltt%ramp_update_each_particle} is set to True, rampers are applied to a given lattice element as
each particle of the beam passes through the element using the time the particle would pass through
the center of the element. This is appropriate if ramping is fast on the time scale of a bunch
passage or if in \vn{"INDIVIDUAL"} or \vn{"SINGLE"} mode. If set to False, rampers are applied to a
given element only once per beam passage using the time of the center of the bunch passing the
center of the element. This is appropriate for parameters that vary slowly on the time scale of a
bunch passage. For example if ramping magnet strengths with energy ramping which occurs over many
turns, calculating once per beam passage should be a good approximation. The default setting of
\vn{ltt%ramp_update_each_particle} is False for \vn{"BEAM"} mode and True for all other modes.
There are two modes that can be selected to determine how ramper elements are applied. If using
\vn{"BEAM"} mode, and if\vn{ltt%ramp_update_each_particle} is set to True, rampers are applied to a
given lattice element as each particle of the beam passes through the element using the time the
particle would pass through the center of the element. This is appropriate if ramping is fast on the
time scale of a bunch passage or if in \vn{"INDIVIDUAL"} or \vn{"SINGLE"} mode. If set to False,
rampers are applied to a given element only once per beam passage using the time of the center of
the bunch passing the center of the element. This is appropriate for parameters that vary slowly on
the time scale of a bunch passage. For example if ramping magnet strengths with energy ramping which
occurs over many turns, calculating once per beam passage should be a good approximation. The
default setting of \vn{ltt%ramp_update_each_particle} is False for \vn{"BEAM"} mode and True for all
other modes.

Before a simulation, individual ramper elements may be toggled on or off by setting the element's
\vn{is_on} attribute in the lattice file:
Expand Down Expand Up @@ -877,7 +877,7 @@ \subsection{Simulation Parameters}
%
\item[ltt\%ramp_update_each_particle] \Newline
Default is False which means only apply rampers to a given lattice element once per beam passage
(\sref{s:ramp}).
(\sref{s:ramp}). This parameter is only used for \vn{"BEAM"} mode.
%
\item[ltt\%ramping_on] \Newline
If set to True, \vn{ramper} control elements will be use to modify the lattice during tracking
Expand Down
7 changes: 6 additions & 1 deletion bsim/modules/lt_tracking_mod.f90
Original file line number Diff line number Diff line change
Expand Up @@ -3492,6 +3492,11 @@ subroutine ltt_track1_preprocess (start_orb, ele, param, err_flag, finished, rad

character(*), parameter :: r_name = 'ltt_track1_preprocess'

! This routine may be called by bmad_parser (via ele_compute_ref_energy_and_time) which is
! before LTT ramping has been setup. To avoid problems, return if setup has not been done.

if (.not. associated(ltt_com_global%tracking_lat%ele)) return

! Recording a particle track?

err_flag = .false.
Expand All @@ -3508,7 +3513,7 @@ subroutine ltt_track1_preprocess (start_orb, ele, param, err_flag, finished, rad
endif

if (.not. ltt_params_global%ramping_on) return
if (.not. ltt_params_global%ramp_update_each_particle) return
if (.not. ltt_params_global%ramp_update_each_particle .and. ltt_params_global%simulation_mode == 'BEAM') return

! If bunch tracking, ramper bookkeeping is handled by track1_bunch_hook.

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/08/02 00:46:53"
character(*), parameter :: tao_version_date = "2024/08/02 09:48:49"
end module
Loading