1/******************************************************************************* 2* McStas instrument definitio URL=http://www.mcstas.org 3* 4* Instrument: SEMSANS 5* 6* %Identification 7* Written by: Morten Sales 8* Date: 2014 9* Origin: Copenhagen, Berlin, Delft 10* %INSTRUMENT_SITE: TU Delft. 11* 12* SEMSANS-instrument 13* 14* %Description 15* SEMSANS instrument with 2 isosceles triangular field coils 16* 17* %Parameters 18* triacoil_depth: [m] Half of the triangular coil depth in z-direction (one right triangle) 19* triacoil_width: [m] xwidth of triangular coil 20* triacoil_height: [m] yheight of triangular coil 21* pol_zdepth: [m] Depth of the polariser along z 22* vcoil_zdepth: [m] Depth along z of the v-coil flipper 23* Guide1_depth: [m] Depth of first guide/precession field section 24* Guide2_depth: [m] Depth of second guide/precession field section 25* Guide3_depth: [m] Depth of third guide/precession field section 26* Guide4_depth: [m] Depth of fourth guide/precession field section 27* Bguide: [T] Field strength of guide/precession field 28* Bextra: [T] Field strength of extra field in guide field 1 to acheive echo 29* Bt2: [T] Field in first triangular coil 30* Bt1: [T] Field in second triangular coil 31* DLambda: [AA] Wavelength spread from source (half of it) 32* Lambda: [AA] Mean wavelength 33* flippos: [m] Position (away from position set by vcoil_34_pos) of pi-flipper 34* FLIP: [1] Choose polarisation direction using v-coil pi/2-flipper (1 is down, -1 is up) 35* chop1_pos: [m] Position of first chopper 36* chop2_pos: [m] Position of second chopper 37* pol_pos: [m] Position of polariser 38* analyser_pos: [m] Position of analyser 39* grating_w: [m] Width of transmitting part of grating 40* grating_a: [m] Width of absorbing part of grating 41* slit_1_pos: [m] Position of first slit 42* slit_2_pos: [m] Position of second slit 43* Guide1_pos: [m] Position of first guide/precession field 44* Guide2_pos: [m] Position of second guide/precession field 45* Guide3_pos: [m] Position of third guide/precession field 46* Guide4_pos: [m] Position of fourth guide/precession field 47* vcoil_12_pos: [m] Position of first v-coil pair 48* vcoil_34_pos: [m] Position of second v-coil pair 49* vcoil_56_pos: [m] Position of third v-coil pair 50* triacoil_1_pos: [m] Position of first triangular coil (centre) 51* triacoil_2_pos: [m] Position of second triangular coil (centre) 52* grating_pos: [m] Position of grating 53* grating_pos: [m] Position of grating 54* detector_pos: [m] Position of detector 55* tlow: [mu-s] tmin of detector 56* thigh: [mu-s] tmax of detector 57* 58* %End 59*******************************************************************************/ 60DEFINE INSTRUMENT SEMSANS_instrument( triacoil_depth = 1.935000e-01, triacoil_width = 7.042824e-02, triacoil_height = 3.000000e-01, pol_zdepth = 9.300000e-01, vcoil_zdepth = 1.500000e-01, Guide1_depth = 1.650000e-02, Guide2_depth = 3.315000e-01, Guide3_depth = 3.315000e-01, Guide4_depth = 5.650000e-02, Bguide = -5.000000e-04, Bextra = -2.120000e-02, Bt2 = -4.440000e-03, Bt1 = -2.560000e-03, DLambda = 4.166366e+00, Lambda = 4.559500e+00, flippos = 3.100000e-02, FLIP = 1.000000e+00, chop1_pos = 5.000000e-01, chop2_pos = 9.740000e-01, pol_pos = 1.907000e+00, analyser_pos = 6.072000e+00, grating_w = 1.570000e-03, grating_a = 2.930000e-03, slit_1_pos = 2.957000e+00, slit_2_pos = 5.437000e+00, Guide1_pos = 3.307000e+00, Guide2_pos = 3.710500e+00, Guide3_pos = 4.342000e+00, Guide4_pos = 5.060500e+00, vcoil_12_pos = 3.157000e+00, vcoil_34_pos = 4.192000e+00, vcoil_56_pos = 5.267000e+00, triacoil_1_pos = 3.517000e+00, triacoil_2_pos = 4.867000e+00, grating_pos = 6.757000e+00, detector_pos = 6.957000e+00, tlow = 2.190523040779461e+03, thigh = 1.214744595341338e+04) 61 62/* The DECLARE section allows us to declare variables or small */ 63/* functions in C syntax. These may be used in the whole instrument. */ 64DECLARE 65%{ 66 67%} 68 69/* The INITIALIZE section is executed when the simulation starts */ 70/* (C code). You may use them as component parameter values. */ 71INITIALIZE 72%{ 73 74%} 75/* Here comes the TRACE section, where the actual */ 76/* instrument is defined as a sequence of components. */ 77TRACE 78 79COMPONENT Origin = Progress_bar() 80AT(0,0,0) ABSOLUTE 81 82// Source 83COMPONENT source = Source_simple( 84 radius=0, dist = slit_1_pos, focus_xw=20e-3, focus_yh=20e-3, 85 xwidth = 2e-3, yheight = 2e-3, 86 lambda0 = Lambda,dlambda = DLambda) 87AT (0, 0, 0) RELATIVE Origin 88 89// First chopper 90COMPONENT chop1 = DiskChopper(radius=0.21, theta_0=20, nu=25, nslit=2, phase=-10, isfirst=1, yheight=0.21) 91AT (0, 0, chop1_pos) RELATIVE Origin 92 93// Second chopper 94COMPONENT chop2 = DiskChopper(radius=0.21, theta_0=20, nu=25, nslit=2, phase=20-10, isfirst=0, yheight=0.21) 95AT (0, 0, chop2_pos) RELATIVE Origin 96 97// Polariser 98COMPONENT polarizer = Set_pol(py=1) 99AT (0, 0, pol_pos+0.5*pol_zdepth) RELATIVE Origin 100 101//First Slit 102COMPONENT slit_1 = Slit( 103 xwidth=15e-3,yheight=15e-3) 104AT (0,0,slit_1_pos) RELATIVE Origin 105 106//First v-coil of first v-coil pair 107COMPONENT vcoil1=Pol_pi_2_rotator( 108 xwidth=0.15,yheight=0.15,zdepth=vcoil_zdepth,rx=0,ry=0,rz=FLIP*1) 109AT (0,0,vcoil_12_pos-vcoil_zdepth) RELATIVE Origin 110 111//Second v-coil of first v-coil pair 112COMPONENT vcoil2=Pol_pi_2_rotator( 113 xwidth=0.15,yheight=0.15,zdepth=vcoil_zdepth,rx=0,ry=1,rz=0) 114AT (0,0,vcoil_12_pos) RELATIVE Origin 115 116 117// START GUIDEFIELD 1 118COMPONENT Guide_field1 = Pol_Bfield(xwidth=0.4, yheight=0.4, Bx=0, By=Bguide+Bextra, Bz=0,fieldFunction=const_magnetic_field) 119 AT (0,0,Guide1_pos) RELATIVE Origin 120 121 122// STOP GUIDE FIELD 1 123COMPONENT Guide_field1_cp = Pol_Bfield_stop() 124 AT (0,0,Guide1_pos+Guide1_depth) RELATIVE Origin 125 126 127// TRIA COIL 1 128COMPONENT triacoil_1=Pol_triafield( 129 xwidth=triacoil_width,yheight=triacoil_height,zdepth=2*triacoil_depth, 130 B=Bt1, Bguide=Bguide) 131 AT (0,0,triacoil_1_pos-triacoil_depth) RELATIVE Origin 132 133 134// START GUIDEFIELD 2 135COMPONENT Guide_field2 = Pol_Bfield(xwidth=0.4, yheight=0.4, Bx=0, By=Bguide, Bz=0,fieldFunction=const_magnetic_field) 136 AT (0,0,Guide2_pos) RELATIVE Origin 137 138 139// STOP GUIDE FIELD 2 140COMPONENT Guide_field2_cp = Pol_Bfield_stop() 141 AT (0,0,Guide2_pos+Guide2_depth+flippos) RELATIVE Origin 142 143 144//First v-coil of second v-coil pair 145COMPONENT vcoil3=Pol_pi_2_rotator( 146 xwidth=0.15,yheight=0.15,zdepth=vcoil_zdepth,rx=0,ry=0,rz=1) 147AT (0,0,vcoil_34_pos-vcoil_zdepth+flippos) RELATIVE Origin 148 149//Second v-coil of second v-coil pair 150COMPONENT vcoil4=Pol_pi_2_rotator( 151 xwidth=0.15,yheight=0.15,zdepth=vcoil_zdepth,rx=0,ry=0,rz=1) 152AT (0,0,vcoil_34_pos+flippos) RELATIVE Origin 153 154 155// START GUIDEFIELD 3 156COMPONENT Guide_field3 = Pol_Bfield(xwidth=0.4, yheight=0.4, Bx=0, By=Bguide, Bz=0,fieldFunction=const_magnetic_field) 157 AT (0,0,Guide3_pos+flippos) RELATIVE Origin 158 159 160// STOP GUIDE FIELD 3 161COMPONENT Guide_field3_cp = Pol_Bfield_stop() 162 AT (0,0,Guide3_pos+Guide3_depth) RELATIVE Origin 163 164 165// START TRIA COIL 2 166COMPONENT triacoil_2=Pol_triafield( 167 xwidth=triacoil_width,yheight=triacoil_height,zdepth=2*triacoil_depth, 168 B=Bt2, Bguide=Bguide) 169 AT (0,0,triacoil_2_pos-triacoil_depth) RELATIVE Origin 170 171 172// START GUIDEFIELD 4 173COMPONENT Guide_field4 = Pol_Bfield(xwidth=0.4, yheight=0.4, Bx=0, By=Bguide, Bz=0,fieldFunction=const_magnetic_field) 174 AT (0,0,Guide4_pos) RELATIVE Origin 175 176 177// STOP GUIDE FIELD 4 178COMPONENT Guide_field4_cp = Pol_Bfield_stop() 179 AT (0,0,Guide4_pos+Guide4_depth) RELATIVE Origin 180 181//First v-coil of third v-coil pair 182COMPONENT vcoil5=Pol_pi_2_rotator( 183 xwidth=0.15,yheight=0.15,zdepth=vcoil_zdepth,rx=0,ry=1,rz=0) 184AT (0,0,vcoil_56_pos-vcoil_zdepth) RELATIVE Origin 185 186//Second v-coil of third v-coil pair 187COMPONENT vcoil6=Pol_pi_2_rotator( 188 xwidth=0.15,yheight=0.15,zdepth=vcoil_zdepth,rx=0,ry=0,rz=1) 189AT (0,0,vcoil_56_pos) RELATIVE Origin 190 191//Second slit 192COMPONENT slit_2=Slit( 193 xwidth=15e-3,yheight=15e-3) 194AT(0,0,slit_2_pos) RELATIVE Origin 195 196//Analyser 197COMPONENT analyser=Analyser_ideal(mx=0,my=1,mz=0) 198 AT(0,0,analyser_pos) RELATIVE Origin 199 200 201//THIS IS GRATING 202 COMPONENT GratingSlit1_1 = Slit(xwidth=grating_w,yheight=5e-3) 203 AT (-2.0*grating_w - 2.0*grating_a, 0, grating_pos) RELATIVE Origin 204 GROUP Grating 205 206 COMPONENT GratingSlit1_2 = Slit(xwidth=grating_w,yheight=5e-3) 207 AT (-1.0*grating_w - 1.0*grating_a, 0, grating_pos) RELATIVE Origin 208 GROUP Grating 209 210 COMPONENT GratingSlit1_3 = Slit(xwidth=grating_w,yheight=5e-3) 211 AT (0, 0, grating_pos) RELATIVE Origin 212 GROUP Grating 213 214 COMPONENT GratingSlit1_4 = Slit(xwidth=grating_w,yheight=5e-3) 215 AT (1.0*grating_w + 1.0*grating_a, 0, grating_pos) RELATIVE Origin 216 GROUP Grating 217 218 COMPONENT GratingSlit1_5 = Slit(xwidth=grating_w,yheight=5e-3) 219 AT (2.0*grating_w + 2.0*grating_a, 0, grating_pos) RELATIVE Origin 220 GROUP Grating 221/* 222//THIS IS DOUBLE SLIT 223 COMPONENT GratingSlit2_1 = Slit(xwidth=grating_w,yheight=5e-3) 224 AT (-0.5*grating_w - 0.5*grating_a, 0, grating_pos) RELATIVE Origin 225 GROUP Grating 226 227 COMPONENT GratingSlit2_2 = Slit(xwidth=grating_w,yheight=5e-3) 228 AT (0.5*grating_w + 0.5*grating_a, 0, grating_pos) RELATIVE Origin 229 GROUP Grating 230*/ 231/* 232//THIS IS SINGLE SLIT 233 COMPONENT GratingSlit3_1 = Slit(xwidth=grating_w,yheight=5e-3) 234 AT (0, 0, grating_pos) RELATIVE Origin 235*/ 236 237 238COMPONENT TOF_det = TOF_monitor(xwidth = 0.05, yheight = 0.05, 239 nt=251, tmin=tlow, tmax=thigh, filename="TOF_det") 240AT (0, 0, detector_pos) RELATIVE Origin 241 242 243/* This section is executed when the simulation ends (C code). Other */ 244/* optional sections are : SAVE */ 245FINALLY 246%{ 247%} 248 249/* The END token marks the instrument definition end */ 250END 251