Difference between revisions of "MAD input file"

From New IAC Wiki
Jump to navigation Jump to search
Line 1: Line 1:
 +
[[GiulioStancariDesign]]
 +
----
 
<pre>
 
<pre>
! HRRL positron beamline, version 2
+
! HRRL positron beamline, version 3
TITLE,"HRRL POSITRON BEAMLINE (HPBv2 2009.05.21)";
+
TITLE,"HRRL POSITRON BEAMLINE (HPBv3 2009.05.27)";
  
 
! Positron beam
 
! Positron beam
Line 16: Line 18:
 
YQF: QUADRUPOLE, L=0.10;
 
YQF: QUADRUPOLE, L=0.10;
 
YQD: QUADRUPOLE, L=0.10;
 
YQD: QUADRUPOLE, L=0.10;
KQ1:=+0.214;
+
KQ1:=+0.181;
KQ2:=-0.059;
+
KQ2:=-0.170;
KQ3:=-0.102;
+
KQ3:=+0.011;
  
KQ4:=+0.181;
+
KQ4:=+0.173;
KQ5:=-0.204;
+
KQ5:=-0.246;
KQ6:=+0.195;
+
KQ6:=+0.249;
  
KQ7:=-0.030;
+
KQ7:=-0.078;
KQ8:=-0.073;
+
KQ8:=-0.044;
KQ9:=+0.078;
+
KQ9:=+0.118;
  
 
VALUE,KQ1,KQ2,KQ3,KQ4,KQ5,KQ6,KQ7,KQ8,KQ9;
 
VALUE,KQ1,KQ2,KQ3,KQ4,KQ5,KQ6,KQ7,KQ8,KQ9;
Line 60: Line 62:
 
Q3: YQF,K1:=KQ3/BRHO,AT=0.6;
 
Q3: YQF,K1:=KQ3/BRHO,AT=0.6;
 
! First bend
 
! First bend
D1: KD,AT=L1;
+
D1: KD,AT=L1+L/2;
 
! Second triplet
 
! Second triplet
 
Q4: YQF,K1:=KQ4/BRHO,AT=0.3+L+L1;
 
Q4: YQF,K1:=KQ4/BRHO,AT=0.3+L+L1;
Line 66: Line 68:
 
Q6: YQF,K1:=KQ6/BRHO,AT=0.7+L+L1;
 
Q6: YQF,K1:=KQ6/BRHO,AT=0.7+L+L1;
 
! Steerer 2
 
! Steerer 2
S2: MONITOR,L=0.05,AT=0.250+0.798+L+L1;
+
! S2: MONITOR,L=0.05,AT=0.250+0.798+L+L1;
 
! Second bend
 
! Second bend
D2: KD,AT=L1+L+L2;
+
D2: KD,AT=L1+L+L2+L/2;
 
! BPM 2
 
! BPM 2
BPM2: MONITOR,L=0.10,AT=0.362+L+L2+L+L1;
+
! BPM2: MONITOR,L=0.10,AT=0.362+L+L2+L+L1;
 
! Third triplet
 
! Third triplet
 
Q7: YQF,K1:=KQ7/BRHO,AT=0.623+L+L2+L+L1;
 
Q7: YQF,K1:=KQ7/BRHO,AT=0.623+L+L2+L+L1;
Line 76: Line 78:
 
Q9: YQF,K1:=KQ9/BRHO,AT=1.023+L+L2+L+L1;
 
Q9: YQF,K1:=KQ9/BRHO,AT=1.023+L+L2+L+L1;
 
! Steerer 3
 
! Steerer 3
S3: MONITOR,L=0.05,AT=0.227+1.023+L+L2+L+L1;
+
! S3: MONITOR,L=0.05,AT=0.227+1.023+L+L2+L+L1;
 
! Secondary target
 
! Secondary target
 
STRGT: MONITOR,L=0., AT=0.871+1.023+L+L2+L+L1;
 
STRGT: MONITOR,L=0., AT=0.871+1.023+L+L2+L+L1;
Line 107: Line 109:
 
IF (0<1) {
 
IF (0<1) {
 
MATCH,SEQUENCE=PBL,BETX=BX0,ALFX=AX0,BETY=BY0,ALFY=AX0,DX=0,DPX=0,DY=0,DPY=0;
 
MATCH,SEQUENCE=PBL,BETX=BX0,ALFX=AX0,BETY=BY0,ALFY=AX0,DX=0,DPX=0,DY=0,DPY=0;
CONSTRAINT,SEQUENCE=PBL,RANGE=#S/#E,MVAR3<12;
+
CONSTRAINT,SEQUENCE=PBL,RANGE=#S/#E,MVAR3<10;
CONSTRAINT,SEQUENCE=PBL,RANGE=#S/#E,MVAR4<12;
+
CONSTRAINT,SEQUENCE=PBL,RANGE=#S/#E,MVAR4<10;
 
CONSTRAINT,SEQUENCE=PBL,RANGE=STRGT,ALFX=0;
 
CONSTRAINT,SEQUENCE=PBL,RANGE=STRGT,ALFX=0;
 
CONSTRAINT,SEQUENCE=PBL,RANGE=STRGT,ALFY=0;
 
CONSTRAINT,SEQUENCE=PBL,RANGE=STRGT,ALFY=0;
 
CONSTRAINT,SEQUENCE=PBL,RANGE=STRGT,BETX=1.6;
 
CONSTRAINT,SEQUENCE=PBL,RANGE=STRGT,BETX=1.6;
 
CONSTRAINT,SEQUENCE=PBL,RANGE=STRGT,BETY=1.6;
 
CONSTRAINT,SEQUENCE=PBL,RANGE=STRGT,BETY=1.6;
CONSTRAINT,SEQUENCE=PBL,RANGE=S3,DX=0;
+
CONSTRAINT,SEQUENCE=PBL,RANGE=Q9,DX=0;
CONSTRAINT,SEQUENCE=PBL,RANGE=S3,DPX=0;
+
CONSTRAINT,SEQUENCE=PBL,RANGE=Q9,DPX=0;
 
VARY, NAME=KQ1, STEP=1E-6;
 
VARY, NAME=KQ1, STEP=1E-6;
 
VARY, NAME=KQ2, STEP=1E-6;
 
VARY, NAME=KQ2, STEP=1E-6;
Line 125: Line 127:
 
VARY, NAME=KQ9, STEP=1E-6;
 
VARY, NAME=KQ9, STEP=1E-6;
 
LMDIF,CALLS=1E4,TOLERANCE=1E-8;
 
LMDIF,CALLS=1E4,TOLERANCE=1E-8;
 +
!MIGRAD,CALLS=1E4;
 
ENDMATCH;
 
ENDMATCH;
 
}
 
}
Line 136: Line 139:
 
SETPLOT,XSIZE=55;
 
SETPLOT,XSIZE=55;
 
PLOT, HAXIS=S, VAXIS1=BETX,BETY, VAXIS4=DX,
 
PLOT, HAXIS=S, VAXIS1=BETX,BETY, VAXIS4=DX,
   STYLE=100, COLOUR=100, INTERPOLATE=TRUE, NOVERSION=TRUE;
+
   STYLE=100, COLOUR=1, INTERPOLATE=TRUE, NOVERSION=TRUE;
 
SETPLOT,XSIZE=40;
 
SETPLOT,XSIZE=40;
 
PLOT, HAXIS=S, VAXIS1=MUX,MUY,
 
PLOT, HAXIS=S, VAXIS1=MUX,MUY,
   STYLE=100, COLOUR=100, INTERPOLATE=TRUE, NOVERSION=TRUE;
+
   STYLE=100, COLOUR=1, INTERPOLATE=TRUE, NOVERSION=TRUE;
 
PLOT, HAXIS=S, VAXIS1=MVAR1,MVAR2,MVAR3,
 
PLOT, HAXIS=S, VAXIS1=MVAR1,MVAR2,MVAR3,
   STYLE=100, COLOUR=100, INTERPOLATE=TRUE, NOVERSION=TRUE;
+
   STYLE=100, COLOUR=1, INTERPOLATE=TRUE, NOVERSION=TRUE;
 
</pre>
 
</pre>
 
[[User:Stancari|Stancari]] 11:40, 26 May 2009 (MDT)
 
----
 
[[GiulioStancariDesign]]
 

Revision as of 15:54, 28 May 2009

GiulioStancariDesign


! HRRL positron beamline, version 3
TITLE,"HRRL POSITRON BEAMLINE (HPBv3 2009.05.27)";

! Positron beam
PC = 1.7e-3;
EMITX = 10E-6; EMITY = 10E-6; ! maximum, geometrical
DPP = 0.02; ! maximum
BRHO = (1E9/CLIGHT) * PC;
BEAM,PARTICLE=POSITRON,PC=PC,
  EX=EMITX,EY=EMITY,SIGE=DPP;

! Yellow quadrupoles
! Max gradient = 19 T/m
! Aperture = +- 1 in
YQF: QUADRUPOLE, L=0.10;
YQD: QUADRUPOLE, L=0.10;
KQ1:=+0.181;
KQ2:=-0.170;
KQ3:=+0.011;

KQ4:=+0.173;
KQ5:=-0.246;
KQ6:=+0.249;

KQ7:=-0.078;
KQ8:=-0.044;
KQ9:=+0.118;

VALUE,KQ1,KQ2,KQ3,KQ4,KQ5,KQ6,KQ7,KQ8,KQ9;

! Kiwi dipoles
RHO = 0.290185;
TH = 45.*PI/180;
L = RHO*TH;
VALUE,L;
KD: SBEND, L=L, ANGLE=TH;

! POSITRON BEAMLINE
!
! Positron target - first bend = L1 = 0.887 m
! First bend =                 = L  = 0.228
! Between bends =              = L2 = 1.295
! Second bend =                = L  = 0.228
! Second bend - wall =         = L3 = 2.034
! Wall thickness =             = L4 = 0.914
!                                    ---------
! Total beamline length =      = LT = 5.586 m
L1 = 0.887; L2 = 1.295; L3 = 2.034; L4 = 0.914;
LT = L1+L+L2+L+L3+L4;
VALUE, LT;
! Initial conditions
AX0=0; BX0=1.6; AY0=0; BY0=1.6;
PBL: SEQUENCE,REFER=ENTRY,L=LT;
! Positron production target
PTRGT: MONITOR,L=0., AT=0.;
! First triplet
Q1: YQF,K1:=KQ1/BRHO,AT=0.2;
Q2: YQD,K1:=KQ2/BRHO,AT=0.4;
Q3: YQF,K1:=KQ3/BRHO,AT=0.6;
! First bend
D1: KD,AT=L1+L/2;
! Second triplet
Q4: YQF,K1:=KQ4/BRHO,AT=0.3+L+L1;
Q5: YQD,K1:=KQ5/BRHO,AT=0.5+L+L1;
Q6: YQF,K1:=KQ6/BRHO,AT=0.7+L+L1;
! Steerer 2
! S2: MONITOR,L=0.05,AT=0.250+0.798+L+L1;
! Second bend
D2: KD,AT=L1+L+L2+L/2;
! BPM 2
! BPM2: MONITOR,L=0.10,AT=0.362+L+L2+L+L1;
! Third triplet
Q7: YQF,K1:=KQ7/BRHO,AT=0.623+L+L2+L+L1;
Q8: YQD,K1:=KQ8/BRHO,AT=0.823+L+L2+L+L1;
Q9: YQF,K1:=KQ9/BRHO,AT=1.023+L+L2+L+L1;
! Steerer 3
! S3: MONITOR,L=0.05,AT=0.227+1.023+L+L2+L+L1;
! Secondary target
STRGT: MONITOR,L=0., AT=0.871+1.023+L+L2+L+L1;
! Wall1
WALL1: MONITOR,L=0.,AT=L3+L+L2+L+L1;
! Wall2
WALL2: MONITOR,L=0.,AT=L4+L3+L+L2+L+L1;
ENDSEQUENCE;

! Activate beamline
USE,SEQUENCE=PBL;

! Calculate Twiss parameters
SELECT,FLAG=TWISS,COLUMN=NAME,S,BETX,BETY,DX;
TWISS,ALFX=AX0,BETX=BX0,ALFY=AY0,BETY=BY0,FILE="twiss.out";

! Define beam profiles (maximum) in mm
! design momentum
MVAR1 := 1E3*SQRT(TABLE(TWISS,BETX)*EMITX);
MVAR2 := 1E3*SQRT(TABLE(TWISS,BETY)*EMITY);
! off-momentum
MVAR3 := 1E3*SQRT(TABLE(TWISS,BETX)*EMITX + (TABLE(TWISS,DX)*DPP)^2);
MVAR4 := 1E3*SQRT(TABLE(TWISS,BETY)*EMITY + (TABLE(TWISS,DY)*DPP)^2);

! Calculate Twiss parameters
SELECT,FLAG=TWISS,COLUMN=NAME,S,BETX,BETY,DX,MVAR1,MVAR2,MVAR3,MVAR4,MUX,MUY;
TWISS,ALFX=AX0,BETX=BX0,ALFY=AY0,BETY=BY0,FILE="twiss.out";

! Optimize
IF (0<1) {
MATCH,SEQUENCE=PBL,BETX=BX0,ALFX=AX0,BETY=BY0,ALFY=AX0,DX=0,DPX=0,DY=0,DPY=0;
CONSTRAINT,SEQUENCE=PBL,RANGE=#S/#E,MVAR3<10;
CONSTRAINT,SEQUENCE=PBL,RANGE=#S/#E,MVAR4<10;
CONSTRAINT,SEQUENCE=PBL,RANGE=STRGT,ALFX=0;
CONSTRAINT,SEQUENCE=PBL,RANGE=STRGT,ALFY=0;
CONSTRAINT,SEQUENCE=PBL,RANGE=STRGT,BETX=1.6;
CONSTRAINT,SEQUENCE=PBL,RANGE=STRGT,BETY=1.6;
CONSTRAINT,SEQUENCE=PBL,RANGE=Q9,DX=0;
CONSTRAINT,SEQUENCE=PBL,RANGE=Q9,DPX=0;
VARY, NAME=KQ1, STEP=1E-6;
VARY, NAME=KQ2, STEP=1E-6;
VARY, NAME=KQ3, STEP=1E-6;
VARY, NAME=KQ4, STEP=1E-6;
VARY, NAME=KQ5, STEP=1E-6;
VARY, NAME=KQ6, STEP=1E-6;
VARY, NAME=KQ7, STEP=1E-6;
VARY, NAME=KQ8, STEP=1E-6;
VARY, NAME=KQ9, STEP=1E-6;
LMDIF,CALLS=1E4,TOLERANCE=1E-8;
!MIGRAD,CALLS=1E4;
ENDMATCH;
}

VALUE, KQ1,KQ2,KQ3,KQ4,KQ5,KQ6,KQ7,KQ8,KQ9;

! Plot
RESPLOT;
SETPLOT,POST=2,YSIZE=16;
!  ASCALE=0.8,LSCALE=0.8,SSCALE=0.8,RSCALE=0.8;
SETPLOT,XSIZE=55;
PLOT, HAXIS=S, VAXIS1=BETX,BETY, VAXIS4=DX,
  STYLE=100, COLOUR=1, INTERPOLATE=TRUE, NOVERSION=TRUE;
SETPLOT,XSIZE=40;
PLOT, HAXIS=S, VAXIS1=MUX,MUY,
  STYLE=100, COLOUR=1, INTERPOLATE=TRUE, NOVERSION=TRUE;
PLOT, HAXIS=S, VAXIS1=MVAR1,MVAR2,MVAR3,
  STYLE=100, COLOUR=1, INTERPOLATE=TRUE, NOVERSION=TRUE;