Skip to content

Commit

Permalink
Fix ele_to_fibre to better preserve Taylor map.
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidSagan committed Jul 18, 2024
1 parent 3eb8874 commit f9a5f13
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ The external packages repository is simply a set of libraries needed by Bmad.
```bash
cd bmad-ecosystem
rm ../bmad-external-packages/README.md # Do not copy this file
cp -r ../bmad-external-packages .
cp -r ../bmad-external-packages/\* .
```

To build everything:
Expand Down
4 changes: 2 additions & 2 deletions bmad-doc/tutorial_bmad_tao/doc/tutorial_bmad_tao.tex
Original file line number Diff line number Diff line change
Expand Up @@ -5285,8 +5285,8 @@ \subsection{Exercises}
set curve r23.g.y legend_text = "X"
set curve r23.g.y component = design
\end{code}
Note: By default, orbit plots have a non-blank legend_text which is why the legend_text needs to be changed.
What happens if, instead of setting to ``X'', the legend_text is set to a blank string?
Note: By default, orbit plots have a non-blank \vn{legend_text} which is why the \vn{legend_text} needs to be changed.
What happens if, instead of setting to ``X'', the \vn{legend_text} is set to a blank string?
%
\item
\begin{code}
Expand Down
8 changes: 5 additions & 3 deletions bmad/ptc/ele_to_fibre.f90
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ subroutine ele_to_fibre (ele, ptc_fibre, param, use_offsets, err_flag, integ_ord
endif

use_taylor = (n_map == 0 .and. (key == wiggler$ .or. key == undulator$) .and. ele%field_calc == helical_model$)
use_taylor = use_taylor .or. (ele%tracking_method == taylor$ .and. associated(ele%spin_taylor(1)%term))
if (use_taylor) key = match$

!
Expand Down Expand Up @@ -209,7 +210,8 @@ subroutine ele_to_fibre (ele, ptc_fibre, param, use_offsets, err_flag, integ_ord
!

if (key == sbend$ .and. val(l$) == 0) key = kicker$
if (ele2%field_calc == fieldmap$ .and. ele2%tracking_method /= bmad_standard$) key = wiggler$
if (ele2%field_calc == fieldmap$ .and. ele2%tracking_method /= bmad_standard$ .and. &
.not. use_taylor) key = wiggler$

select case (key)

Expand Down Expand Up @@ -898,8 +900,8 @@ subroutine ele_to_fibre (ele, ptc_fibre, param, use_offsets, err_flag, integ_ord
! FieldMap cartesian_map element.
! Include all wiggler elements even planar_model with field_calc = bmad_standard$

if (.not. associated(ele2%gen_grad_map) .and. .not. associated(ele2%cylindrical_map) .and. (key == wiggler$ .or. &
key == undulator$ .or. (associated(ele2%cartesian_map) .and. ele2%field_calc == fieldmap$))) then
if (.not. use_taylor .and. .not. associated(ele2%gen_grad_map) .and. .not. associated(ele2%cylindrical_map) .and. &
(key == wiggler$ .or. key == undulator$ .or. (associated(ele2%cartesian_map) .and. ele2%field_calc == fieldmap$))) then


is_planar_wiggler = ((key == wiggler$ .or. key == undulator$) .and. ele2%field_calc == planar_model$)
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/15 21:04:15"
character(*), parameter :: tao_version_date = "2024/07/16 21:03:51"
end module

0 comments on commit f9a5f13

Please sign in to comment.