File: Test_Guides.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 (191 lines) | stat: -rw-r--r-- 5,286 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
/*******************************************************************************
*         McStas instrument definition URL=http://www.mcstas.org
*
* Instrument: Test_Guides
*
* %Identification
* Written by: E. Farhi [farhi@ill.fr]
* Date: Sept 1st, 2008
* Origin: ILL
* %INSTRUMENT_SITE: Tests_optics
*
* Cross comparison of Guide components
*
* %Description
* Cross comparison of Guide components, using McStas and
* contributed components. It shows that all implementations are equivalent,
* except the Guide_honeycomb which has a different geometry.
*
* %Example: Guide=1 Detector: Monitor2_xy_I=0.00726875
* %Example: Guide=2 Detector: Monitor2_xy_I=0.00725213
* %Example: Guide=3 Detector: Monitor2_xy_I=0.00727304
* %Example: Guide=4 Detector: Monitor2_xy_I=0.00721742
* %Example: Guide=5 Detector: Monitor2_xy_I=0.00721742
* %Example: Guide=6 Detector: Monitor2_xy_I=0.00721742
* %Example: Guide=7 Detector: Monitor2_xy_I=0.00724912
* %Example: Guide=8 Detector: Monitor2_xy_I=0.00683072
* %Example: Guide=9 Detector: Monitor2_xy_I=0.00724912
*
* %Parameters
* Guide: [1]  Choice of Guide component to test, with 1=Guide, 2=Guide_channeled, 3=Guide_gravity, 4=Guide_wavy, 5=Guide_curved 6=Elliptic_guide_gravity 7=Guide_honeycomb
*
* %End
*******************************************************************************/
DEFINE INSTRUMENT Test_Guides(int Guide=1)
DEPENDENCY " -DUSE_OFF "

DECLARE %{
  int _Guide;
  #pragma acc declare create(_Guide)
%}

USERVARS
%{
  int Flag_anyshape_scatter;
  int Flag_anyshape_r_scatter;
%}

INITIALIZE
%{
  if(Guide==1) printf("Using Guide\n");
  if(Guide==2) printf("Using Guide_channeled\n"); 
  if(Guide==3) printf("Using Guide_gravity\n"); 
  if(Guide==4) printf("Using Guide_wavy\n"); 
  if(Guide==5) printf("Using Guide_curved\n");
  if(Guide==6) printf("Using Elliptic_guide_gravity\n"); 
  if(Guide==7) printf("Using Guide_anyshape\n");
  if(Guide==8) printf("Using Guide_honeycomb\n");
  if(Guide==9) printf("Using Guide_r_anyshape\n");

  _Guide=Guide;
  #pragma acc update device(_Guide)
%}

TRACE

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

COMPONENT Source = Source_gen(
   focus_xw = 0.05, focus_yh = 0.05, lambda0 = 3.39, dlambda = 0.3,
   yheight = 0.05, xwidth = 0.05)
  AT (0, 0, 0) RELATIVE PREVIOUS
EXTEND %{
	t = randtriangle()*1e-3;	/* 1 ms triangle time window */
	Flag_anyshape_scatter=0;
%}

COMPONENT Monitor1_xt = Monitor_nD(
    options = "x y", xwidth = 0.05, yheight = 0.05)
  AT (0, 0, 1) RELATIVE PREVIOUS

COMPONENT Guide_Position = Arm( )
  AT (0, 0, 0.1) RELATIVE PREVIOUS

COMPONENT Guide1 = Guide(
    w1 = 0.05, h1 = 0.05, l = 1.0, R0 = 0.99, m=1)
  WHEN (Guide == 1)
  AT (0, 0, 0) RELATIVE Guide_Position
EXTEND %{
  if (!SCATTERED) ABSORB;
%}

COMPONENT GuideC = Guide_channeled(
    w1 = 0.05, h1 = 0.05, l = 1.0, R0 = 0.99, d=0, m=1)
  WHEN (Guide == 2)
  AT (0, 0, 0) RELATIVE Guide_Position
EXTEND %{
  if (!SCATTERED) ABSORB;
%}

COMPONENT GuideG = Guide_gravity(
    w1 = 0.05, h1 = 0.05, l = 1.0, R0 = 0.99, d=0, m=1)
  WHEN (Guide == 3)
  AT (0, 0, 0) RELATIVE Guide_Position
EXTEND %{
  if (!SCATTERED) ABSORB;
%}

COMPONENT GuideW = Guide_wavy(
    w1 = 0.05, h1 = 0.05, l = 1.0, R0 = 0.99, m=1)
  WHEN (Guide == 4)
  AT (0, 0, 0) RELATIVE Guide_Position
EXTEND %{
  if (!SCATTERED) ABSORB;
%}

COMPONENT GuideR = Guide_curved(
    w1 = 0.05, h1 = 0.05, l = 1.0, R0 = 0.99, m=1, curvature=10000)
  WHEN (Guide == 5)
  AT (0, 0, 0) RELATIVE Guide_Position
EXTEND %{
  if (!SCATTERED) ABSORB;
%}

COMPONENT GuideEl = Elliptic_guide_gravity(
  xwidth = 0.05, yheight=0.05, l = 1.0, R0 = 0.99, m=1,
  linxw=1e6, linyh=1e6, loutxw=1e6, loutyh=1e6, dimensionsAt="mid")
  WHEN (Guide == 6)
  AT (0, 0, 0) RELATIVE Guide_Position
EXTEND %{
  if (!SCATTERED) ABSORB;
%}

COMPONENT GuideA_prefix = Slit(xwidth=0.05, yheight=0.05)
  WHEN (Guide == 7)
AT (0,0,-0.0001) RELATIVE Guide_Position
EXTEND %{
  if (SCATTERED) Flag_anyshape_scatter++;
%}

COMPONENT GuideA = Guide_anyshape(geometry="Guide.off", R0=0.99, m=1)
  WHEN (Guide == 7)
  AT (0, 0, 0) RELATIVE Guide_Position
EXTEND %{
  if (SCATTERED) Flag_anyshape_scatter++;
%}

COMPONENT GuideA_sufffix = Slit(xwidth=0.05, yheight=0.05)
  WHEN (Guide == 7)
AT (0,0,1+0.0001) RELATIVE Guide_Position
EXTEND %{
  if (SCATTERED) Flag_anyshape_scatter++;
  if (_Guide == 7 && !Flag_anyshape_scatter) ABSORB;
%}
  
COMPONENT GuideH = Guide_honeycomb(
    w1 = 0.05, l = 1.0, R0 = 0.99, m=1, d=0)
  WHEN (Guide == 8)
  AT (0, 0, 0) RELATIVE Guide_Position
EXTEND %{
  if (!SCATTERED) ABSORB;
%}


COMPONENT GuideAr_prefix = Slit(xwidth=0.05, yheight=0.05)
  WHEN (Guide == 9)
AT (0,0,-0.0001) RELATIVE Guide_Position
EXTEND %{
  if (SCATTERED) Flag_anyshape_r_scatter++;
%}

COMPONENT GuideAr = Guide_anyshape_r(geometry="Guide_r.off", R0=0.99, m=0)
  WHEN (Guide == 9)
  AT (0, 0, 0) RELATIVE Guide_Position
EXTEND %{
  if (SCATTERED) Flag_anyshape_r_scatter++;
%}

COMPONENT GuideAr_sufffix = Slit(xwidth=0.05, yheight=0.05)
  WHEN (Guide == 9)
AT (0,0,1+0.0001) RELATIVE Guide_Position
EXTEND %{
  if (SCATTERED) Flag_anyshape_r_scatter++;
  if (_Guide== 9 && !Flag_anyshape_r_scatter) ABSORB;
%}  

COMPONENT Monitor2_xy = Monitor_nD(
    options = "x y", xwidth = 0.07, yheight = 0.07)
  AT (0, 0, 2) RELATIVE Guide_Position

END