File: ISIS_CRISP.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 (169 lines) | stat: -rw-r--r-- 5,388 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
/*******************************************************************************
*
* McStas, neutron ray-tracing package
*         Copyright (C) 1997-2010, All rights reserved
*         Risoe National Laboratory, Roskilde, Denmark
*         Institut Laue Langevin, Grenoble, France
*
* Instrument: Crisp3 test instrument for the Multilayer_NR_Sample component.
*
* %Identification
* Written by: <a href="robert.dalgliesh@stfc.ac.uk">Robert Dalgliesh</a>
* Date: 2010
* Origin: <a href="http://www.isis.stfc.ac.uk/">ISIS (UK)</a>
* %INSTRUMENT_SITE: ISIS
*
* Model of the ISIS CRISP reflectometer, including the Multilayer_Sample reflectivity sample.
*
* %Description
* This model of the ISIS CRISP reflectometer demonstrates the use of the Multilayer_Sample component.
*
* The algorithm of the component requires complex numbers, facilitated by the
* <a href="http://www.gnu.org/software/gsl/">GNU Scientific Library (GSL)</a>. To link
* your the instrument with an installed GSL, you should use MCSTAS_CFLAGS like
*
* MCSTAS_CFLAGS = -g -O2 -lm -lgsl -lgslcblas
*
* %Example: FRAC=0.1 Detector: PSDdet1_I=120
*
* %Parameters
* glen: [m]  Length of the elliptical guides
* flen: [m]  Focal-length of elliptical guides
* w1: [m]    Entry-width of elliptical guides
* vm: [m]    m-value of material for left and right vertical guide mirrors
* FRAC: [1]  Fraction of statistics used to model incoherent scattering from sample
*
* %Link
* <a href="http://www.isis.stfc.ac.uk/instruments/crisp/">Website of the CRISP instrument</a>
*
* %End
*******************************************************************************/
DEFINE INSTRUMENT ISIS_CRISP(glen=1.4,flen=0.4,w1=0.05,vm=3.0, FRAC=0)

DECLARE
%{
  double glen,flen,spos,tend,t15,fp1;
  double linw,loutw,l,u1,u2,div1,b_ell_q,w1,w12,a_ell_q,lbw,w2;
%}

INITIALIZE
%{
  spos=10.2055;
  l=glen;
  loutw=flen;
  linw=10.0;
  w12=w1/2.0;

// calculate the width of the guide exit
  lbw = l + linw + loutw;
  u1 = sqrt((linw*linw)+(w12*w12));
  u2 = sqrt((w12*w12) + ((l+loutw)*(l+loutw)));
  a_ell_q = ((u1 + u2)/2)*((u1 + u2)/2);
  b_ell_q = a_ell_q - ((lbw/2)*(lbw/2));

/* calculate width of guide exit (w2) */
  div1 = ((lbw/2-loutw)*(lbw/2-loutw))/a_ell_q;
  w2 = sqrt(b_ell_q*(1-div1));
  w2 = w2*2;

  tend=w2;
  t15=tan(-1.5*DEG2RAD);
%}

TRACE

COMPONENT a1 = Arm()
  AT (0,0,0) ABSOLUTE

COMPONENT isis_source = ISIS_moderator(
    Face = "crisp", Emin = -6.5, Emax = -0.55, dist = 7.2695,
    focus_xw = 0.045, focus_yh = 0.0045, xwidth = -1, yheight = -1,
    CAngle = 0.0, SAC = 1)
  AT (0.0, 0.0, 0.00001) RELATIVE a1
  ROTATED (1.5, 0.0, 0.0) ABSOLUTE

COMPONENT defslit1 = Slit(
    xmin = -0.0345, xmax = 0.0345, ymin = -0.01731,
    ymax = 0.01731)
  AT (0.0, -0.09829, 3.7537) ABSOLUTE

COMPONENT defslit2 = Slit(
    xmin = -0.0289, xmax = 0.0289, ymin = -0.0123,
    ymax = 0.0123)
  AT (0.0, -0.15976, 6.101) ABSOLUTE

COMPONENT coarseslit1 = Slit(
    xmin = -0.03, xmax = 0.03, ymin = -0.1,
    ymax = 0.1)
  AT (0.0, -0.1757, 6.7096) ABSOLUTE

COMPONENT coarseslit2 = Slit(
    xmin = -0.1, xmax = 0.1, ymin = -0.01,
    ymax = 0.01)
  AT (0.0, -0.17832, 6.8096) ABSOLUTE

COMPONENT lmon1 = L_monitor(
    nL = 500, filename = "lmon1.dat", xmin = -0.06,
    xmax = 0.06, ymin = -0.04, ymax = 0.04, Lmin = 0.0,
    Lmax = 10.0)
  AT (0.0, -0.1833, 7.0) ABSOLUTE

COMPONENT PSDmon1 = PSD_monitor(
    nx = 100, ny = 100, filename = "PSD1.dat",
    xmin = -0.05, xmax = 0.05, ymin = -0.01, ymax = 0.01)
  AT (0.0, -0.1833, 7.01) ABSOLUTE

COMPONENT slit1 = Slit(
    xwidth=0.04, yheight=0.004)
  AT (0.0, -0.1904, 7.2695) ABSOLUTE

COMPONENT PSDmons1 = PSD_monitor(
    nx = 100, ny = 100, filename = "PSDs1.dat",
    xmin = -0.05, xmax = 0.05, ymin = -0.01, ymax = 0.01)
  AT (0.0, 7.27*t15, 7.27) ABSOLUTE

COMPONENT eguide1 = Guide_tapering(
    segno = 10, w1 = w1, h1 = 0.1, l = glen, option="elliptical",
    linw=10.0, loutw = flen, mx = vm, my = 0)
  AT (0.0, (spos-flen-glen)*t15, spos-flen-glen) ABSOLUTE
  ROTATED (1.5, 0.0, 0.0) ABSOLUTE

COMPONENT slit2 = Slit(
    xwidth=tend, yheight=0.0025)
  AT (0.0, -0.2581, 9.8555) ABSOLUTE

COMPONENT lmon2 = L_monitor(
    nL = 500, filename = "lmon2.dat", xmin = -0.06,
    xmax = 0.06, ymin = -0.04, ymax = 0.04, Lmin = 0.0,
    Lmax = 10.0)
  AT (0.0, -0.2608, 9.96) ABSOLUTE

COMPONENT samp1 = Multilayer_Sample(
    xwidth = 0.05, zlength = 0.15, mu_inc=0.138, ythick=0.01,
    nlayer = 0, sldPar = {0.0,6.35e-6}, dPar = {0.0},
    sigmaPar = {5.0}, target_index=1, focus_xw=2*tend, focus_yh=0.01,
    frac_inc=FRAC)
  AT (0.0, spos*t15, spos) ABSOLUTE

COMPONENT slit3 = Slit(
    xwidth= tend, yheight=0.003)
  AT (0.0, (spos+flen-0.01)*t15-2.0*(flen-0.01)*t15, spos+flen-0.01) ABSOLUTE

COMPONENT eguide2 = Guide_tapering(
    segno = 10, w1 = tend, h1 = 0.1, l = glen, option="elliptical",
    linw=flen, loutw = 10.0, mx = vm, my = 0)
  AT (0.0, (spos+flen)*t15-2.0*flen*t15, spos+flen ) ABSOLUTE
  ROTATED(-1.5,0.0,0.0) ABSOLUTE

COMPONENT lmon3 = L_monitor(
    nL = 500, filename = "lmon3.dat", xmin = -0.05,
    xmax = 0.05, ymin = -0.05, ymax = 0.05, Lmin = 0.0,
    Lmax = 10.0)
  AT (0.0, 12.11*t15-2.0*(12.11-spos)*t15, 12.11) ABSOLUTE

COMPONENT PSDdet1 = PSD_monitor(
    nx = 100, ny = 100, filename = "PSD3.dat",
    xmin = -0.05, xmax = 0.05, ymin = -0.05, ymax = 0.05)
  AT (0.0, 12.111*t15-2.0*(12.111-spos)*t15, 12.111) ABSOLUTE

END