MAD-X Primer (3): マッチング : ローカルバンプの作成¶
目的¶
MAD-X Primer Appendix 1.3(Example 3)
match ( 軌道補正マッチング機能 ) を使用し、「垂直方向の局所バンプ」を生成する方法を学ぶ.
目標軌道¶
3つのキッカー(垂直軌道補正器: KCV7, KCV9, KCV10)を使用し、ビームを変位させる軌道を設計する.
入口 (BPMV5)で y=0 mm
中央のモニタ (BPMV8)で y=5 mm にバンプ
出口 (BPMV11)で再び y=0 mm に戻す
ビーム軌道を作るキッカを MATCHコマンドを使って自動調整 .
コード¶
option,-echo;
// Read input file with machine description
// This machine is constructed with macro
// subroutine INST()
// Match a vertical orbit bump at monitor BPMV8
call, file="spsmac.seq";
// Define the beam for the machine
Beam, particle = proton, sequence=cassps, energy = 450.0;
// Use the sequence with the name: cassps
use, sequence=cassps;
// バンプ軌道 ( y=5mm )の追加、at BPMV8
// match :: コメントアウトすると、y方向の広がりは一切なし
//
// Match a vertical orbit bump of 5 mm at monitor BPMV8
match, orbit;
constraint,range=bpmv5 ,y=0.0 ,py=0.0; // BPMv5 において、y=0, py=0
constraint,range=bpmv8 ,y=0.005; // BPMv8 において、y=0.005 (バンプする制約)
constraint,range=bpmv11,y=0.0 ,py=0.0; // BMPv11において、y=0, py=0 ( 影響がないようにする制約 )
vary,name=kcv7,step=0.0001;
vary,name=kcv9,step=0.0001; // ノブは ヴァーチカルキックの 7,9,10 番
vary,name=kcv10,step=0.0001;
lmdif,calls=100,tolerance=1.0E-20;
endmatch;
// Define the type and amount of output
select,flag=twiss,class=monitor,column=name,s,x,px,y,py;
select,flag=twiss,class=hkicker,column=name,s,x,px,y,py;
select,flag=twiss,class=vkicker,column=name,s,x,px,y,py;
// Execute the Twiss command to calculate the Twiss parameters
// Compute at the centre of the element and write to: twiss.out
twiss,save,centre,file=out/twiss.tfs;
survey, file=out/survey.tfs;
// Plot the vertical orbit between the
// 1st and 20th beam position monitor
plot, haxis=s, vaxis=y,colour=100, vmin=-0.001,vmax=0.011, range=bpmv3/bpmv13;
stop;
命令¶
MATCH, ORBIT : 軌道補正専用のマッチング ブロック
CONSTRAINT : 位置・角度(Y, PY)の制約指定
VARY : 変数(キッカーの強度)の最適化
LMDIF : 数値最適化 (Levenberg-Marquardt algorithm )のトレランスと関数呼出し回数上限
補足ポイント¶
PY=0.0 の指定により、「まっすぐ進む」ことが保証される
Y=0.005 (5 mm) など単位はメートル(SI)系であることに注意
:= を使って変数(KCV7 など)が遅延評価されるようにしておくと、マッチング後も値が反映される