Skip to content

Commit

Permalink
Commit bmad-doc.
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidSagan committed Sep 16, 2023
2 parents 073f469 + 2279d2e commit 30e1538
Show file tree
Hide file tree
Showing 324 changed files with 260,716 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,20 @@
./packages
production
debug
bmad-doc/tutorial_bmad_tao/doc/2www.pl
bmad-doc/tutorial_bmad_tao/doc/tutorial_bmad_tao.aux
bmad-doc/tutorial_bmad_tao/doc/tutorial_bmad_tao.bbl
bmad-doc/tutorial_bmad_tao/doc/tutorial_bmad_tao.blg
bmad-doc/tutorial_bmad_tao/doc/tutorial_bmad_tao.log
bmad-doc/tutorial_bmad_tao/doc/tutorial_bmad_tao.out
bmad-doc/tutorial_bmad_tao/doc/tutorial_bmad_tao.pdf
bmad-doc/tutorial_bmad_tao/doc/tutorial_bmad_tao.toc
bmad-doc/cookbook_bmad_tao/doc/cookbook_bmad_tao.aux
bmad-doc/cookbook_bmad_tao/doc/cookbook_bmad_tao.bbl
bmad-doc/cookbook_bmad_tao/doc/cookbook_bmad_tao.blg
bmad-doc/cookbook_bmad_tao/doc/cookbook_bmad_tao.log
bmad-doc/cookbook_bmad_tao/doc/cookbook_bmad_tao.out
bmad-doc/cookbook_bmad_tao/doc/cookbook_bmad_tao.pdf
bmad-doc/cookbook_bmad_tao/doc/cookbook_bmad_tao.toc
bmad-doc/tao_examples/csr_beam_tracking/csr_wake.dat
*.digested*
13 changes: 13 additions & 0 deletions bmad-doc/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Documentation for Bmad and Tao and other Bmad based programs.

*Includes:*
- Tutorial for Bmad and Tao
- Tao examples
- Lattice examples
- Manuals for other Bmad based program


*Not Included:*
- [Bmad manual](https://www.classe.cornell.edu/bmad/manual.html)
- [Tao manual](https://www.classe.cornell.edu/bmad/tao.html)

30 changes: 30 additions & 0 deletions bmad-doc/lattices/Dragt_PSR_small_ring/Dragt_PSR_small_ring.bmad
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
!+
! This is a lattice for the Proton Storage Ring (PSR) at Los Alamos.
! It is based on the paper:
! Alex Dragt,
! "Exact Numerical Calculation of Chromaticity in Small Rings"
! Particle Accelerators, 12, pp 205-18, (1982)
!-


parameter[E_tot] = 797e6 + m_proton
parameter[particle] = proton
parameter[geometry] = closed

b36: sbend, l = 2.54948, angle = 36*raddeg
qd: quadrupole, l = 0.5, b1_gradient = -2.68
qf: quadrupole, l = 0.5, b1_gradient = 1.95
sh: sextupole, l = 0.5
sv: sextupole, l = 0.5

d228: drift, l = 2.28646
d148: drift, l = 1.48646
d45: drift, l = 0.45
d30: drift, l = 0.30

p_no: line = (d228, qd, d45, b36, d45, qf, d228)
p_ts: line = (d228, qd, d45, b36, d45, qf, d30, sh, d148)
p_ls: line = (d148, sv, d30, qd, d45, b36, d45, qf, d228)
psr: line = (p_no, p_ts, p_ls, 3*p_no, p_ts, p_ls, 2*p_no)

use, psr
11 changes: 11 additions & 0 deletions bmad-doc/lattices/cbeta/beginning/beginning_in_merge.bmad
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
! Beginning at in.a3.mar.beg
beginning[z_position] = 9.361464940552
beginning[x_position] = 13.548311830583
beginning[theta_position] = -15*pi/180
beginning[s] = 6.305575
! at la.mar.end_vessel, beta 11.5 m, alpha -0.9
BEGINNING[BETA_A] = 1.73422780020131384E+001
BEGINNING[ALPHA_A] = 3.02300262875727033E-001
BEGINNING[BETA_B] = 1.95524001260198843E+000
BEGINNING[ALPHA_B] = -1.53381642238284516E-001
parameter[e_tot] = e006
7 changes: 7 additions & 0 deletions bmad-doc/lattices/cbeta/du/du.X.bmad
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
MD2QUA02[B1_GRADIENT] = -1.44474001616028747E-001
MD2QUA03[B1_GRADIENT] = -4.46533459811314093E-001
MD2QUA04[B1_GRADIENT] = +7.10743752819115060E-001
MD2QUA05[B1_GRADIENT] = -9.33516081944438136E-001
MD2QUA06[B1_GRADIENT] = -3.91419230012521380E-001
MD2QUA07[B1_GRADIENT] = +3.31581481243683529E-001
MD2QUA08[B1_GRADIENT] = -5.64373216633781427E-002
108 changes: 108 additions & 0 deletions bmad-doc/lattices/cbeta/du/du.bmad
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
! __
! | \ | |
! |__/ \__/
!
!
! __ __
! |__) /__`
! |__) .__/
!


! ASSUMPTION: this file is loaded after la.demer.bmad!!!


!---------------------------
! Beam Dump Elements
!---------------------------

!---Markers
DU.Mar.BEG: MARKER
DU.Mar.END: MARKER
DU.Mar.MID: Marker

DU.Mar.Face: MARKER

!---Pipes
D2.Pip01: PIPE, L=2.072469, APERTURE = 0.5*1.38*0.0254
D2.Pip02: PIPE, L=2.660637, APERTURE = 0.5*1.38*0.0254
D2.Pip03: PIPE, L=4.724*0.0254, APERTURE = 0.5*1.38*0.0254 ! BPM 7108-302
D2.PIP04: PIPE, L=1.275*0.0254, APERTURE = 0.5*1.38*0.0254 ! Nipple, 7106-219, not present
D2.PIP05: PIPE, L=6.49*0.0254, APERTURE=0.5*1.38*0.0254 ! Sliding joint and transition 7106-213
ID2GAT01: PIPE, L=0.075, APERTURE=0.5*2.38*0.0254 ! Gate Valve
D2.PIP06: PIPE, L=28.08*.0254, aperture=0.5*2.38*0.0254 ! Pipe w/ 2 BPMs 7108-305
D2.PIP07: PIPE, L=33.63*0.0254, aperture=0.5*2.38*0.0254 ! Dump pumping chamber, 2.5 to 6.25 7106-304
D2.PIP08: PIPE, L=23.36*0.0254, aperture=0.5*5.15*0.0254 ! Dump taper, 7106-303
D2.PIP09: PIPE, L=1.12*0.0254, aperture=0.5*9.84*0.0254 ! Quad detector, 7106-302
D2.PIP10: PIPE, L=2.83908, aperture=0.5*11.438*0.0254 ! Beam dump, 7106-300; to tip of outside, not inside

! Centers are average of short and finger end
ID2BPM04: instrument, superimpose, ref=d2.pip03, ref_origin=end, offset = -2.1345*0.0254 ! 7108-302
ID2BPM05: instrument, superimpose, ref=d2.pip06, ref_origin=beginning, offset = +3.4605*0.0254 ! 7108-304 7108-305
ID2BPM06: instrument, superimpose, ref=d2.pip06, ref_origin=end, offset = -2.9145*0.0254 ! 7108-304 7108-305

!---Quadrupoles
!DU.SEX01: AB_MULTIPOLE, B2 = 7.096800, APERTURE = DU.aperture, superimpose, ref = D2.Pip01, ele_origin=end, ref_origin=end
!DU.Qua02: QUADRUPOLE, L = 0.150000, K1 = 33.709700, APERTURE = DU.aperture, superimpose, ref = D2.Pip01, ele_origin=end, ref_origin=end
!DU.SEX02: AB_MULTIPOLE, B2 = 7.096800, APERTURE = DU.aperture, superimpose, ref = D2.Pip01, ele_origin=end, ref_origin=end

! Placeholder; helper quad to reduce dispersion; does not and may never exist
! md2qua01: quadrupole, l=0.05, field_master=t, superimpose, ref=d2.pip01, ref_origin = beginning, offset = +0.45
! BNL ERL 6Q12 quadrupoles
bnl.erl.6q12: quad, field_master = T,
l = 1.6276438149813174e-01, fq1 = -1.7137226038331033e-04, fq2 = +1.4168477088720201e-05
md2qua02: bnl.erl.6q12, superimpose, ref = d2.pip01, ref_origin = beginning, offset = +0.84
md2qua03: bnl.erl.6q12, superimpose, ref = d2.pip01, ref_origin = beginning, offset = +1.158
md2qua04: bnl.erl.6q12, superimpose, ref = d2.pip01, ref_origin = beginning, offset = +1.430
md2qua05: bnl.erl.6q12, superimpose, ref = d2.pip01, ref_origin = end, offset = -0.37
md2qua06: bnl.erl.6q12, superimpose, ref = d2.pip02, ref_origin = beginning, offset = +0.32
md2qua07: bnl.erl.6q12, superimpose, ref = d2.pip02, ref_origin = beginning, offset = +0.65
md2qua08: bnl.erl.6q12, superimpose, ref = d2.pip02, ref_origin = beginning, offset = +0.98

ID2BPM01: instrument, superimpose, ref=d2.pip01, ref_origin = beginning, offset = +0.696043
ID2BPM02: instrument, superimpose, ref=d2.pip01, ref_origin = end, offset = -0.238
ID2BPM03: instrument, superimpose, ref=d2.pip02, ref_origin = beginning, offset = +0.485

ID2SCR01: instrument, superimpose, ref=d2.pip01, ref_origin = end, offset = -0.116303
ID2SCR02: instrument, superimpose, ref=d2.pip02, ref_origin = end, offset = -1.37
ID2SCR03: instrument, superimpose, ref=d2.pip02, ref_origin = end, offset = -0.77
ID2SCR04: instrument, superimpose, ref=d2.pip02, ref_origin = end, offset = -0.17

!---Bends
md2dip01: indpa.sym, e1 = -indpa.angle/2, e2 = -indpa.angle/2, g = -indpa.angle/indpa.sym[l]

!---Beam Stop
D2.Dum01: INSTRUMENT, TYPE = "BEAMSTOP", L = 2.83412, APERTURE = 0.46
D2.Dum01[descrip] = "3DMODEL=7106-300-L0-dump_STL/7106-300-L0-dump.blend"


!---Superpositions

!DU.SEX01[offset] = -0.40
!DU.Qua02[offset] = -0.25
!DU.SEX02[offset] = -0.25

!- - - Patch
du.demerge_patch: patch
DU.DEMERGE_PATCH[X_OFFSET] = +9.29523538798093796E-003
DU.DEMERGE_PATCH[X_PITCH] = +2.61799386281228785E-001

du: line = (
du.demerge_patch,
du.mar.beg,
d2.pip01,
md2dip01,
d2.pip02,
d2.pip03,
d2.pip05,
id2gat01,
d2.pip06,
d2.pip07,
d2.pip08,
d2.pip09,
d2.pip10)

du.short: line = (
du.demerge_patch,
du.mar.beg,
d2.pip01)
194 changes: 194 additions & 0 deletions bmad-doc/lattices/cbeta/erl.bmad
Original file line number Diff line number Diff line change
@@ -0,0 +1,194 @@
!
! ___ __
! |__ |__) |
! |___ | \ |___
!



! Markers

Mar.BEG: marker
Mar.END: marker


! Time patches
return1.time_patch: patch
return2.time_patch: patch
return3.time_patch: patch
return4.time_patch: patch
return5.time_patch: patch
return6.time_patch: patch
return7.time_patch: patch

tmatch : match, beta_a0=1, beta_a1=1, beta_b0=1, beta_b1=1
return1.time_match: tmatch
return2.time_match: tmatch
return3.time_match: tmatch
return4.time_match: tmatch
return5.time_match: tmatch
return6.time_match: tmatch
return7.time_match: tmatch

RETURN1.TIME_PATCH[T_OFFSET] = +1.22459198215588780E-10
RETURN2.TIME_PATCH[T_OFFSET] = -1.13000153078586955E-10
RETURN3.TIME_PATCH[T_OFFSET] = +8.26740428593621948E-11
RETURN4.TIME_PATCH[T_OFFSET] = +4.78800005308298447E-10
RETURN5.TIME_PATCH[T_OFFSET] = RETURN3.TIME_PATCH[T_OFFSET]
RETURN6.TIME_PATCH[T_OFFSET] = RETURN2.TIME_PATCH[T_OFFSET]
RETURN7.TIME_PATCH[T_OFFSET] = RETURN1.TIME_PATCH[T_OFFSET]

RETURN1.TIME_MATCH[DELTA_TIME] = -8.273e-12
RETURN2.TIME_MATCH[DELTA_TIME] = -2.879e-12
RETURN3.TIME_MATCH[DELTA_TIME] = -0.878e-12
RETURN4.TIME_MATCH[DELTA_TIME] = -8.017e-12
RETURN5.TIME_MATCH[DELTA_TIME] = return3.time_match[delta_time]
RETURN6.TIME_MATCH[DELTA_TIME] = return2.time_match[delta_time]
RETURN7.TIME_MATCH[DELTA_TIME] = return1.time_match[delta_time]

setenergy006: patch, e_tot_set=e006
setenergy042: patch, e_tot_set=e042
setenergy078: patch, e_tot_set=e078
setenergy114: patch, e_tot_set=e114
setenergy150: patch, e_tot_set=e150
setenergy042_m: line[multipass] = (setenergy042)
setenergy078_m: line[multipass] = (setenergy078)
setenergy114_m: line[multipass] = (setenergy114)

! For simulating dispersion correction
LA.ORBIT_SHIFT: MATCH,
beta_a0 = 1, alpha_a0 = 0, beta_a1 = 1, alpha_a1 = 0,
beta_b0 = 1, alpha_b0 = 0, beta_b1 = 1, alpha_b1 = 0


! Linac
LA.fakecavity: lcavity, L=1, rf_frequency=global_rf_frequency, voltage = 70e6
!LA: line[multipass] = (LA.fakecavity)
call, file = in/a3/a3.bmad
call, file = in/a3/a3.X.bmad
call, file = in/merge/in.merge.bmad
call, file = la/la.bmad

! FFAG
call, file = fx/cell/cell.bmad
call, file = fx/fx.bmad
call, file = tx/tx.bmad
call, file = zx/zx.bmad

! Splitters
call, file =sx/sx.bmad
call, file =rx/rx.bmad

! DU
call, file = du/du.bmad
call, file = du/du.X.bmad

ZA.extend: drift

mirror_merge_fork: fork, to_line = in.mirror_merge

ffa: line = (fa, ta, za, zb, tb, fb)

!- - - - - - ERL 1 pass - - - - - -
erl_1pass_half: line = (in.merge.part1, IN.MERGE.part2, Mar.BEG,
LA, setenergy042, la.tail, DU.part1, la.demer.match042, du.part2,
S1,
FA,
ZA)


erl_1pass: line = (
in.merge.part1, IN.MERGE.part2, Mar.BEG,
LA, setenergy042, la.tail, DU.part1, la.demer.match042, du.part2,
S1,
FA_single, TA_single, ZA_single, ZB_single, TB_single, FB_single,
R1, R1_connect, in.merge.match042, IN.MERGE.part2, return1.time_patch, return1.time_match,
LA,
setenergy006, la.tail, DU.part1, la.demer.match006, du.part2,
DU,
!DU.short,
Mar.END)

fat.end: drift, l=71.65e-3

cbeta_fat: line = (in.a3, mirror_merge_fork, in.merge.part1, in.merge.part2, mar.beg, la,
setenergy042, la.tail, du.part1, la.demer.match042, du.part2,
s1_fat, fa.gir01, fat.end)

cbeta_fat_gun: line = (IN_before_MERGE, in.a3, mirror_merge_fork, in.merge.part1, in.merge.part2, mar.beg, la,
setenergy042, la.tail, du.part1, la.demer.match042, du.part2,
s1_fat, fa.gir01, fat.end)

!- - - - - - ERL 4 pass - - - - - -


erl_4pass1: line = (
LA, setenergy042_m, la.tail, DU.part1, la.demer.match042.line, du.part2,
S1_multi,
FA, TA, ZA, ZB, TB, FB,
R1_multi, R1_connect, in.merge.match042.multi, IN.MERGE.part2, return1.time_patch, return1.time_match,
LA, setenergy078_m, la.tail, DU.part1, la.demer.match078.line, du.part2)

erl_4pass2: line = (
S2_multi,
FA, TA, ZA, ZB, TB, FB,
R2_multi, R1_connect, in.merge.match078.multi, IN.MERGE.part2, return2.time_patch, return2.time_match,
LA, setenergy114_m, la.tail, DU.part1, la.demer.match114.line, du.part2)

erl_4pass3: line = (
S3_multi,
FA, TA, ZA, ZB, TB, FB,
R3_multi, R1_connect, in.merge.match114.multi, IN.MERGE.part2, return3.time_patch, return3.time_match,
LA, setenergy150, la.tail, DU.part1, la.demer.match150, du.part2)

erl_4pass4: line = (
S4_multi,
FA, TA, ZA, ZB, TB, FB,
R4_multi, R1_connect, in.merge.match150, IN.MERGE.part2, return4.time_patch, return4.time_match,
LA, setenergy114_m, la.tail, DU.part1, la.demer.match114.line, du.part2)

erl_4pass5: line = (
S3_multi,
FA, TA, ZA, ZB, TB, FB,
R3_multi, R1_connect, in.merge.match114.multi, IN.MERGE.part2, return5.time_patch, return5.time_match,
LA, setenergy078_m, la.tail, DU.part1, la.demer.match078.line, du.part2)

erl_4pass6: line = (
S2_multi,
FA, TA, ZA, ZB, TB, FB,
R2_multi, R1_connect, in.merge.match078.multi, IN.MERGE.part2, return6.time_patch, return6.time_match,
LA, setenergy042_m, la.tail, DU.part1, la.demer.match042.line, du.part2)

erl_4pass7: line = (
S1_multi,
FA, TA, ZA, ZB, TB, FB,
R1_multi, R1_connect, in.merge.match042.multi, IN.MERGE.part2, return7.time_patch, return7.time_match,
LA, setenergy006, la.tail, DU.part1, la.demer.match006, du.part2)

erl_4pass: line = (in.a3, mirror_merge_fork, in.merge.part1, IN.MERGE.part2, Mar.BEG,
erl_4pass1,
erl_4pass2,
erl_4pass3,
erl_4pass4,
erl_4pass5,
erl_4pass6,
erl_4pass7,
DU,
!!DU.short,
Mar.END)

cbeta_4pass: line = (IN_before_MERGE, in.a3, mirror_merge_fork, in.merge.part1, IN.MERGE.part2, Mar.BEG,
erl_4pass1,
erl_4pass2,
erl_4pass3,
erl_4pass4,
erl_4pass5,
erl_4pass6,
erl_4pass7,
DU,
Mar.END)

!- - - - - - MLC Test - - - - - -
mlc_test: line = (IN_before_MERGE, in.a3, mirror_merge_fork, in.merge.part1, IN.MERGE.part2, Mar.BEG,
LA,
Mar.END)
Loading

0 comments on commit 30e1538

Please sign in to comment.