Skip to content

Commit

Permalink
New Match element syntax.
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidSagan committed Nov 9, 2023
1 parent 745606e commit 5fcb4d0
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 9 deletions.
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: November 4, 2023 \\
Revision: November 8, 2023 \\
\end{flushright}

\pdfbookmark[0]{Preamble}{Preamble}
Expand Down
2 changes: 1 addition & 1 deletion bmad/low_level/match_ele_to_mat6.f90
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ subroutine match_ele_to_mat6 (ele, start_orb, mat6, vec0, err_flag, include_delt
v(pz0$) = start_orb%vec(6)
endif

if (m_val == identity$ .or. t_ele%a%beta == 0 .or. t_ele%b%beta == 0) then
if (m_val == identity$ .or. ((t_ele%a%beta == 0 .or. t_ele%b%beta == 0) .and. (do_twiss .or. do_trombone))) then
v(mode_flip0$) = int_logic(t_ele%mode_flip)
v(mode_flip1$) = int_logic(t_ele%mode_flip)
call mat_make_unit(mat6)
Expand Down
1 change: 1 addition & 0 deletions regression_tests/TESTS.LIST
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ girder_test
hdf5_test
long_term_tracking_test
mat6_calc_method_test
match_test
mode_flip_test
mode3_test
multipass_test
Expand Down
30 changes: 27 additions & 3 deletions regression_tests/match_test/match_test.bmad
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,35 @@ particle_start[spin_z] = 0.5

m0: match, delta_time = 1e-9, beta_a0 = 1, beta_b0 = 2, beta_a1 = 2, beta_b1 = 3,
c11_mat0 = 0.1, c12_mat0 = 0.2, c21_mat0 = 0.3, c22_mat0 = 0.4,
c11_mat1 = 0.4, c12_mat1 = 0.3, c21_mat1 = 0.2, c22_mat1 = 0.1
c11_mat1 = 0.4, c12_mat1 = 0.3, c21_mat1 = 0.2, c22_mat1 = 0.1,
x0 = 0.01, px0 = 0.02, y0 = 0.03, py0 = 0.04, z0 = 0.05, pz0 = 0.06,
x1 = 0.07, px1 = 0.08, y1 = 0.09, py1 = 0.01, z1 = 0.02, pz1 = 0.03

m1: match, beta_a1 = 20, beta_b1 = 15, matrix = match_twiss, kick0 = match_orbit,
c11_mat1 = 0.4, c12_mat1 = 0.3, c21_mat1 = 0.2, c22_mat1 = 0.1,
x1 = 0.07, px1 = 0.08, y1 = 0.09, py1 = 0.01, z1 = 0.02, pz1 = 0.03

m2: match, matrix = phase_trombone, dphi_a = 1, dphi_b = 2, kick0 = zero,
x1 = 0.07, px1 = 0.08, y1 = 0.09, py1 = 0.01, z1 = 0.02, pz1 = 0.03

!m1: match, beta_a1 = 20, beta_b1 = 15, matrix = match_twiss

l0: line = (m0)
use, l0

l1: line = (m1)
l1[beta_a] = 10
l1[alpha_a] = -1
l1[beta_b] = 20
l1[alpha_b] = 1
l1[geometry] = open

l2: line = (m1)
l2[beta_a] = 10
l2[alpha_a] = -1
l2[beta_b] = 20
l2[alpha_b] = 1
l2[geometry] = open


use, l0, l1, l2


14 changes: 11 additions & 3 deletions regression_tests/match_test/match_test.f90
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ program match_test
type (lat_struct), target :: lat
type (branch_struct), pointer :: branch
type (ele_struct), pointer :: ele
type (coord_struct) orb0, orb1

integer ib, ie
integer i, ib, ie
character(100) lat_file

!
Expand All @@ -22,9 +23,16 @@ program match_test

do ib = 0, ubound(lat%branch, 1)
branch => lat%branch(ib)
ele => branch%ele(ie)

ele => branch%ele(1)
call init_coord(orb0, lat%particle_start, ele, upstream_end$)
call make_mat6(ele, branch%param, lat%particle_start, orb0)

write (1, '(a, i0, a, 6es16.8)') '"Vec0-', ib, '" ABS 1E-10', ele%vec0
do i = 1, 6
write (1, '(2(a, i0), a, 6es16.8)') '"Mat', i, '-', ib, '" ABS 1E-10', ele%mat6(i,:)
enddo
enddo

close(1)

end program
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 = "2023/11/08 13:48:34"
character(*), parameter :: tao_version_date = "2023/11/08 20:53:59"
end module

0 comments on commit 5fcb4d0

Please sign in to comment.