File: Test_capillary.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 (139 lines) | stat: -rw-r--r-- 3,577 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
/*****************************************************************************
*         McXtrace instrument definition URL=http://www.mcxtrace.org
*
* Instrument: Test_capillary
*
* %Identification
* Written by: E. B: Knudsen
* Date: July 2015.
* Origin: DTU Physics
* %INSTRUMENT_SITE: Tests_optics
*
* Unit test instrument for the capillary tube component.
*
* %Description
*
* Very simple setup to compare intensities diffracted by Monochromators. 
* It shows that implementations are equivalent.
*
* %Example: Test_capillary -n 1e6 TL=3 TR=0.001 L1=0.4 Detector: psd14_I=7.34669e-08
*
* %Parameters
* INPUT PARAMETERS:
* TR: [m] radius of capillary tube
* TL: [m] length of capillary tube
* L1: [m] disatnce from source to capillary tube entrance
*
* %End
****************************************************************************/

DEFINE INSTRUMENT Test_capillary(TL=0.1, TR=1e-4, L1=3)

DECLARE
%{
%}
/* end of DECLARE */
USERVARS
%{
  int reflecs;
%}

INITIALIZE
%{
%}
/* end of INITIALIZE */

TRACE
/* Source description */

COMPONENT Origin = Progress_bar()
     AT (0,0,0) ABSOLUTE
EXTEND
%{
    reflecs=0;
%}

/* a flat constant source */

COMPONENT generic_source=Source_flat(
    E0=30.05, dE=7.1,
    xwidth=1.0e-3, yheight=1.0e-3, 
    focus_xw=2*TR,focus_yh=2*TR, dist=L1
)
AT (0,0,0) RELATIVE PREVIOUS

COMPONENT psd_pre = 
PSD_monitor(xwidth = 3*TR, yheight = 3*TR,
    nx=100, ny=100, filename="psdpre.dat")
AT (0, 0, L1-1e-9) RELATIVE generic_source 

COMPONENT emon_pre = E_monitor(
    xwidth=0.1, yheight=0.1, nE=200, Emin=30.05-7.1,Emax=30.05+7.1, restore_xray=1,filename="emon_pre.dat")
AT (0, 0, L1-1e-10) RELATIVE generic_source  


COMPONENT tube = Capillary(
        radius=TR,length=TL, R0=0, coating="Rh.txt")
AT(0,0,L1) RELATIVE generic_source
EXTEND
%{
    if (SCATTERED) {
        reflecs=SCATTERED;
    }
%}

COMPONENT tube_out = Arm()
AT(0,0,TL+1e-9) RELATIVE tube


COMPONENT psd0 = 
PSD_monitor(xwidth = 3*TR, yheight = 3*TR,
	    nx=100, ny=100, filename="psd0.dat")
AT (0, 0, 0) RELATIVE tube_out

COMPONENT psd00 = COPY(psd0)(
        filename="psd00.dat")
WHEN reflecs==0 AT(0,0,0) RELATIVE tube_out
COMPONENT psd01 = COPY(psd0)(
        filename="psd01.dat")
WHEN reflecs==1 AT(0,0,0) RELATIVE tube_out
COMPONENT psd02 = COPY(psd0)(
        filename="psd02.dat")
WHEN reflecs==2 AT(0,0,0) RELATIVE tube_out
COMPONENT psd03 = COPY(psd0)(
        filename="psd03.dat")
WHEN reflecs==3 AT(0,0,0) RELATIVE tube_out
COMPONENT psd04 = COPY(psd0)(
        filename="psd04.dat")
WHEN reflecs==4 AT(0,0,0) RELATIVE tube_out

COMPONENT psd1 = 
PSD_monitor(xwidth = 3*TR, yheight = 3*TR,
	    nx=100, ny=100, filename="psd1.dat")
AT (0, 0, 1) RELATIVE tube_out
COMPONENT psd10 = COPY(psd1)(
        filename="psd10.dat")
WHEN reflecs==0 AT(0,0,1) RELATIVE tube_out
COMPONENT psd11 = COPY(psd0)(
        filename="psd11.dat")
WHEN reflecs==1 AT(0,0,1) RELATIVE tube_out
COMPONENT psd12 = COPY(psd1)(
        filename="psd12.dat")
WHEN reflecs==2 AT(0,0,1) RELATIVE tube_out
COMPONENT psd13 = COPY(psd1)(
        filename="psd13.dat")
WHEN reflecs==3 AT(0,0,1) RELATIVE tube_out
COMPONENT psd14 = COPY(psd1)(
        filename="psd14.dat")
WHEN reflecs==4 AT(0,0,1) RELATIVE tube_out

COMPONENT emon = E_monitor(nE=200,
			   xwidth=0.1, yheight=0.1, nE=200, Emin=30.05-7.1,Emax=30.05+7.1, restore_xray=1,filename="emon.dat")
AT (0, 0, 1.1) RELATIVE tube_out

COMPONENT emon_zm = E_monitor(nE=50,
			   xwidth=0.1, yheight=0.1, nE=200, Emin=30.05-1.1,Emax=30.05+1.1, restore_xray=1,filename="emonzm.dat")
AT (0, 0, 1.1) RELATIVE tube_out

END