File: ILL_H512_D22.instr

package info (click to toggle)
mccode 3.5.19%2Bds5-2
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 1,113,256 kB
  • sloc: ansic: 40,697; python: 25,137; yacc: 8,438; sh: 5,405; javascript: 4,596; lex: 1,632; cpp: 742; perl: 296; lisp: 273; makefile: 226; fortran: 132
file content (357 lines) | stat: -rw-r--r-- 11,837 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
/*******************************************************************************
*         McStas instrument definition URL=http://mcstas.risoe.dk
*
* Instrument: ILL_H512_D22
*
* %Identification
* Written by: FARHI Emmanuel (farhi@ill.fr)
* Date: May, 2011
* Origin:ILL
* %INSTRUMENT_SITE: ILL
*
* The H512 cold guide at the ILL, with D22
*
* %Description
*
* This model describes the H512 cold guide at the ILL, with D22.
*
* The D22 Large dynamic range small-angle diffractometer
* is fully simulated. A sample can be specified (liquid),
* with monitoring of the scattering in angular (diffraction) and energy modes
* (for spectroscopy).
*
* %Example: lambda=4.5 Detector: D22_Detector_I=1.76653e+07
*
* Flux given at sample positions from <www.ill.fr>
* ILL_H5: D22:  nu=23589.5 [rpm] lambda=4.5 [Angs] sample=H2O_liq.qSq
* Flux 1.2e8 -- 7.1e7
*
* %Parameters
* lambda: [Angs]        central wavelength band for guide illumination and D22 velocity selector setting wavelength
* dlambda: [Angs]       half width of guide wavelength band
* D22_sample: [string]  D22 liquid/powder/amorphous sample
* D_collimation: []
*
* %End
*******************************************************************************/
DEFINE INSTRUMENT ILL_H512_D22( lambda=4.5, dlambda=.45, D22_collimation=2, string D22_sample="H2O_liq.qSq")

DECLARE %{

  /* HCS (H5) source 'Measured' parameters */
  double sT3=413.5,sI3=10.22e12;
  double sT2=145.8,sI2=3.44e13;
  double sT1=40.1 ,sI1=2.78e13;

  /* guide coating parameters */
  double gR0          = 1;
  double gQc          = 0.0216;
  double gAlpha       = 4.07;
  double gW           = 1.0/300.0;

  double Al_Thickness = 0.001;
  double gGap         = 0.001;

  double  D22_nu      = 0;

  double flag         = 0;
  //#ifdef OPENACC
  // This single bracket is put here to kill compilation on GPU - as it seemingly never finishes...
  //{
  //#endif
%}

USERVARS %{
  int splitflag;
%}

INITIALIZE %{

  /* compute H512 parameters: D22 Velocity Selector */
  D22_nu   = 3956*48.3*DEG2RAD/2/PI/lambda/0.25;
  printf("ILL_H512_D22: D22:  nu=%g [rpm] lambda=%g [Angs] sample=%s\n",
    D22_nu*60, lambda, D22_sample);

%}

TRACE

/* ================================ H5 common =============================== */

COMPONENT Origin = Progress_bar()
AT(0,0,0) ABSOLUTE

COMPONENT HCS = Source_gen(
  radius   = 0.21/2,
  zdepth   = 0.15,
  dist     = 2.155,
  focus_xw = 0.123,
  focus_yh = 0.120,
  lambda0     = lambda,
  dlambda     = dlambda,
  T1       = sT1,
  I1       = sI1,
  T2       = sT2,
  I2       = sI2,
  T3       = sT3,
  I3       = sI3,
  verbose  = 1)
  AT (0, 0, 0) RELATIVE Origin

COMPONENT HCS_Al  = PowderN(
    reflections="Al.laz", xwidth=0.17, yheight=0.12, zdepth=Al_Thickness, p_inc=0.005, p_transmit=0.9450, p_interact=0.05, d_phi=10)
AT (0,0,0.21) RELATIVE HCS

COMPONENT COPY(HCS_Al) = COPY(HCS_Al)
AT (0,0,0.61) RELATIVE HCS

COMPONENT COPY(HCS_Al) = COPY(HCS_Al)
AT (0,0,0.78) RELATIVE HCS

COMPONENT COPY(HCS_Al) = COPY(HCS_Al)
AT (0,0,0.92) RELATIVE HCS

COMPONENT COPY(HCS_Al) = COPY(HCS_Al)
AT (0,0,2.15) RELATIVE HCS

/* Ni common guide: wide entry window for all guides */
COMPONENT H5 = Monitor_nD(xwidth=0.04+0.004+0.015+0.004+0.06, yheight=0.12,
  options="x y, slit", bins=50)
AT(0,0,2.155) RELATIVE HCS

COMPONENT H51_origin = COPY(H5)(options="dx limits=[-6 6] dy limits=[-6 6]", xwidth=0.04, restore_neutron=1)
AT (-(0.04+0.004+0.015+0.004+0.06)/2+0.04/2,0,0) RELATIVE H5 ROTATED (0,-1.3269,0) RELATIVE H5


                       /* start of guide sections */

/* ================================ H51 ===================================== */
/* feeds: IN15, D22 */

COMPONENT H51_Start = Arm()
AT (0,0,0) RELATIVE H51_origin

COMPONENT H51_inpile = Guide_gravity(h1=0.12,w1=0.04, m=1.2, l=2.775,
  R0=gR0, Qc=gQc, alpha=gAlpha, W=gW)
AT (0,0,0) RELATIVE PREVIOUS

/* Gap 25 mm before BOG (barillet obturateur general). Carter BOG             */

COMPONENT H51_Obt_1 = COPY(PREVIOUS)(l=0.863)
AT (0,0,2.775+0.025) RELATIVE PREVIOUS

COMPONENT H51_Obt_2 = COPY(PREVIOUS)(l=1.433)
AT (0,0,0.863+0.012) RELATIVE PREVIOUS

COMPONENT H51_Obt_3 = COPY(PREVIOUS)(l=0.745)
AT (0,0,1.433+0.012) RELATIVE PREVIOUS

COMPONENT COPY(HCS_Al) = COPY(HCS_Al)(xwidth=0.04)
AT (0,0,0.745+0.01) RELATIVE PREVIOUS

/* Gap 75 mm after BOG (barillet obturateur general): VS */

COMPONENT H51_Obt_Out = COPY(H5)(xwidth=0.04, restore_neutron=1)
AT (0,0,0.06) RELATIVE PREVIOUS

COMPONENT COPY(HCS_Al) = COPY(HCS_Al)(xwidth=0.04)
AT (0,0,0) RELATIVE PREVIOUS

/* Sections 2,3 in NoteDPT11/H51 - curved R=3000 m. Length=2.5 m down to splitter */
/* Carter VS+Movable+Common                                                   */

COMPONENT H51_S2 = COPY(H51_inpile)(l=2.5/3)
AT (0,0,0.05)                      RELATIVE PREVIOUS

COMPONENT COPY(H51_S2) = COPY(H51_S2)
AT (0,0,2.5/3)                    RELATIVE PREVIOUS
ROTATED (0,-2.5/3/3000*RAD2DEG,0) RELATIVE PREVIOUS

COMPONENT COPY(H51_S2) = COPY(H51_S2)
AT (0,0,2.5/3)                    RELATIVE PREVIOUS
ROTATED (0,-2.5/3/3000*RAD2DEG,0) RELATIVE PREVIOUS

COMPONENT HCS_Al_H51 = COPY(HCS_Al)(xwidth=0.04)
AT (0,0,2.5/3+0.01) RELATIVE PREVIOUS

/* Splitter (polarising "Deviateur") H511/H512 L=1.5                          */
/* D22 in transmission, IN15 in reflection: 79.70-76.45 = 3.25 deg angle      */
/* bottom   part direct to d22 height=55mm                                    */
/* top part part in reflection to in15 height=55mm: transmitted part lost     */

/* split the beam to either D22 or IN15  (monitors)                           */
COMPONENT H51_S2_Out = COPY(H5)(xwidth=0.04, yheight=0.12)
AT (0,0,0.05) RELATIVE PREVIOUS

COMPONENT H51_split_2 = COPY(H5)(xwidth=0.04, restore_neutron=1, yheight=0.055)
AT (0,0.12/2-0.055/2,0)  RELATIVE H51_S2_Out
EXTEND %{
  if(SCATTERED) splitflag=2;
%}
//JUMP H512_Start WHEN SCATTERED

COMPONENT H51_split_1 = COPY(H5)(xwidth=0.04, restore_neutron=1, yheight=0.055)
AT (0,-0.12/2+0.055/2,0)  RELATIVE H51_S2_Out
EXTEND %{
  if(SCATTERED) splitflag=1;
%}
//JUMP H511_Start WHEN SCATTERED

/* H511 bottom to IN15 ====================================================== */
COMPONENT H511_Start = Arm()
AT (0,0,0) RELATIVE H51_split_1
EXTEND %{
  if (splitflag==1) ABSORB; /* H511/IN15 not simulated here */
%}

/* H512 top to D22 ========================================================== */
COMPONENT H512_Start = Arm()
AT (0,0,0) RELATIVE H51_split_2

/* Sections 3,4,5,6 in NoteDPT11/H51 - curved R=3000 m. Length=2.5 m down to VTE */
/* Carter C1-C4                                                               */

COMPONENT H512_S36 = COPY(H51_inpile)(l=20.85/16, h1=0.055)
AT (0,0,0.0)                      RELATIVE PREVIOUS

COMPONENT COPY(H512_S36) = COPY(H512_S36)
AT (0,0,20.85/16)                    RELATIVE PREVIOUS
ROTATED (0,-20.85/16/3000*RAD2DEG,0) RELATIVE PREVIOUS

COMPONENT COPY(H512_S36) = COPY(H512_S36)
AT (0,0,20.85/16)                    RELATIVE PREVIOUS
ROTATED (0,-20.85/16/3000*RAD2DEG,0) RELATIVE PREVIOUS

COMPONENT COPY(H512_S36) = COPY(H512_S36)
AT (0,0,20.85/16)                    RELATIVE PREVIOUS
ROTATED (0,-20.85/16/3000*RAD2DEG,0) RELATIVE PREVIOUS

COMPONENT COPY(H512_S36) = COPY(H512_S36)
AT (0,0,20.85/16)                    RELATIVE PREVIOUS
ROTATED (0,-20.85/16/3000*RAD2DEG,0) RELATIVE PREVIOUS

COMPONENT COPY(H512_S36) = COPY(H512_S36)
AT (0,0,20.85/16)                    RELATIVE PREVIOUS
ROTATED (0,-20.85/16/3000*RAD2DEG,0) RELATIVE PREVIOUS

COMPONENT COPY(H512_S36) = COPY(H512_S36)
AT (0,0,20.85/16)                    RELATIVE PREVIOUS
ROTATED (0,-20.85/16/3000*RAD2DEG,0) RELATIVE PREVIOUS

COMPONENT COPY(H512_S36) = COPY(H512_S36)
AT (0,0,20.85/16)                    RELATIVE PREVIOUS
ROTATED (0,-20.85/16/3000*RAD2DEG,0) RELATIVE PREVIOUS

COMPONENT COPY(H512_S36) = COPY(H512_S36)
AT (0,0,20.85/16)                    RELATIVE PREVIOUS
ROTATED (0,-20.85/16/3000*RAD2DEG,0) RELATIVE PREVIOUS

COMPONENT COPY(H512_S36) = COPY(H512_S36)
AT (0,0,20.85/16)                    RELATIVE PREVIOUS
ROTATED (0,-20.85/16/3000*RAD2DEG,0) RELATIVE PREVIOUS

COMPONENT COPY(H512_S36) = COPY(H512_S36)
AT (0,0,20.85/16)                    RELATIVE PREVIOUS
ROTATED (0,-20.85/16/3000*RAD2DEG,0) RELATIVE PREVIOUS

COMPONENT COPY(H512_S36) = COPY(H512_S36)
AT (0,0,20.85/16)                    RELATIVE PREVIOUS
ROTATED (0,-20.85/16/3000*RAD2DEG,0) RELATIVE PREVIOUS

COMPONENT COPY(H512_S36) = COPY(H512_S36)
AT (0,0,20.85/16)                    RELATIVE PREVIOUS
ROTATED (0,-20.85/16/3000*RAD2DEG,0) RELATIVE PREVIOUS

COMPONENT COPY(H512_S36) = COPY(H512_S36)
AT (0,0,20.85/16)                    RELATIVE PREVIOUS
ROTATED (0,-20.85/16/3000*RAD2DEG,0) RELATIVE PREVIOUS

COMPONENT COPY(H512_S36) = COPY(H512_S36)
AT (0,0,20.85/16)                    RELATIVE PREVIOUS
ROTATED (0,-20.85/16/3000*RAD2DEG,0) RELATIVE PREVIOUS

COMPONENT COPY(H512_S36) = COPY(H512_S36)
AT (0,0,20.85/16)                    RELATIVE PREVIOUS
ROTATED (0,-20.85/16/3000*RAD2DEG,0) RELATIVE PREVIOUS

COMPONENT HCS_Al_H512 = COPY(HCS_Al)(xwidth=0.04)
AT (0,0,20.85/16+0.01) RELATIVE PREVIOUS

/* VTE space+OT H512: 108 mm + 2 mm Al window */

COMPONENT H512_VTE = COPY(H5)(xwidth=0.06, restore_neutron=1)
AT (0,0,0.108/2-0.001) RELATIVE PREVIOUS

COMPONENT COPY(HCS_Al) = COPY(HCS_Al)(zdepth=0.002,xwidth=0.04)
AT (0,0,0.108/2-0.05) RELATIVE PREVIOUS

COMPONENT H51_S78 = COPY(H51_inpile)(l=6.0/4, h1=0.055)
AT (0,0,0.05)                      RELATIVE PREVIOUS

COMPONENT COPY(H51_S78) = COPY(H51_S78)
AT (0,0,6.0/4)                    RELATIVE PREVIOUS
ROTATED (0,-6.0/4/3000*RAD2DEG,0) RELATIVE PREVIOUS

COMPONENT COPY(H51_S78) = COPY(H51_S78)
AT (0,0,6.0/4)                    RELATIVE PREVIOUS
ROTATED (0,-6.0/4/3000*RAD2DEG,0) RELATIVE PREVIOUS

COMPONENT COPY(H51_S78) = COPY(H51_S78)
AT (0,0,6.0/4)                    RELATIVE PREVIOUS
ROTATED (0,-6.0/4/3000*RAD2DEG,0) RELATIVE PREVIOUS

COMPONENT COPY(HCS_Al) = COPY(HCS_Al)(zdepth=0.002,xwidth=0.04)
AT (0,0,6.0/4+0.01) RELATIVE PREVIOUS

/* 3 m to V selector, straight */

COMPONENT H512_S11 = COPY(H51_inpile)(l=3.0, nelements=2, h1=0.055)
AT (0,0,0.01)                      RELATIVE PREVIOUS

COMPONENT COPY(HCS_Al) = COPY(HCS_Al)(xwidth=0.04)
AT (0,0,3+0.01) RELATIVE PREVIOUS

COMPONENT D22_PreV = Monitor_nD(xwidth=0.04, yheight=0.05,
  options="x y", bins=50, restore_neutron=1)
AT (0,0,0.01) RELATIVE PREVIOUS

/* D22 Velocity Selector: just like D11 EADS/Astrium NVS 023 in 60 cm gap */
COMPONENT D22_Vselector = V_selector(xwidth=0.04, yheight=0.05, zdepth=0.30, radius=0.12,
  alpha=48.3, length=0.25, d=0.0004, nu=D22_nu, nslit=72)
AT (0,0,3+0.01+0.3+0.01) RELATIVE H512_S11

COMPONENT D22_Collimation = COPY(H51_inpile)(
  l=20-D22_collimation, nelements=ceil(D22_collimation/1.5))
AT (0,0,0.3) RELATIVE D22_Vselector

COMPONENT D22_Sample_Pos = Arm()
AT (0,0,20+0.3) RELATIVE D22_Vselector

COMPONENT H51_D22_Sample_Div = Monitor_nD(xwidth=0.02, yheight=0.05,
  options="dx limits=[-2 2], dy limits=[-2 2]", bins=100, restore_neutron=1)
AT (0,0,0) RELATIVE D22_Sample_Pos

COMPONENT H51_D22_Sample_XY = Monitor_nD(xwidth=0.02, yheight=0.05,
  options="x y", bins=50, restore_neutron=1)
AT (0,0,0) RELATIVE D22_Sample_Pos

COMPONENT H51_D22_Sample_L = Monitor_nD(xwidth=0.02, yheight=0.05,
  options="lambda limits=[1 10]", bins=50, restore_neutron=1)
AT (0,0,0) RELATIVE D22_Sample_Pos

SPLIT COMPONENT H51_D22_Sample = Isotropic_Sqw(radius=0.005,yheight=0.05,
  Sqw_coh=D22_sample, Sqw_inc=NULL, d_phi=RAD2DEG*atan2(1, D22_collimation))
AT (0,0,0) RELATIVE D22_Sample_Pos
EXTEND %{
  if (!SCATTERED) ABSORB;
%}

COMPONENT D22_Detector = Monitor_nD(xwidth=1, yheight=1, options="x y", bins=128)
AT (0,0,D22_collimation) RELATIVE D22_Sample_Pos
EXTEND %{
  ABSORB; /* H512 end here */
%}

/* ========================= end of simulation ============================== */

END