File: PSI_source.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 (111 lines) | stat: -rw-r--r-- 3,364 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
/************************************************
*
* McStas model of the source from the DMC powder diffractometer at PSI, CH.
*
* %Identification
* Written by: Peter Willendrup (Risoe), Uwe Filges (PSI), Lukas Keller (PSI)
* 
* Date: May 7th, 2008
* Origin:PSI
* %INSTRUMENT_SITE: PSI
*
* McStas model of the DMC powder diffractometer at PSI, CH.
*
* %Description
* McStas model of the DMC powder diffractometer at PSI, CH.
*
* Please note that this instrument file does not include the radial collimator of DMC. 
* To generate the full 800-bin angle coverage at DMC, you should combine two simulations
* using this instrumentfile, with SHIFT=0 and 0.1. This will displace the detector by half
* a bin-width, which is a standard procedure at the DMC diffractometer
*
* %Example: lambda=2.5666 Detector: PSDbefore_guides_I=2.54332e+09
*
* %Parameters
* lambda: [AA]     Choice of wavelength, affects both monochromator and source component
* R: [1]           Reflectivity of non-curved guides
* R_curve: [1]     Reflectivity of curved guides
* filename: [str]  Choice of reflection list file, e.g. from McStas data dir
* D_PHI: [deg]     Focusing 'd_phi' for PowderN, see mcdoc page
* SHIFT: [deg]     Rotation of detector, set to 0.1 to displace by half a bin
* PACK: [1]        Powder packing factor
* Dw: [1]          Powder Debye-Waller factor
* BARNS: [1]       Flag to define if powder reflection file |F2| is in Barns or fm
*
* %Link
* The <a href="http://lns00.psi.ch/montecarlo/">PSI Monte-Carlo</a> website.
* %Link
* P Willendrup, U Filges, L Keller, E Farhi, K Lefmann: Validation of a realistic powder sample using data from DMC at PSI, ICNS 2005 (Physica B, 386, (2006), 1032.)
*
* %End
***************************************************/
DEFINE INSTRUMENT PSI_source(lambda=2.5666, R=0.87, R_curve=0.87, string filename="Na2Ca3Al2F14.laz",D_PHI=6, SHIFT=0, PACK=0.7, Dw=0.8, BARNS=1)

DECLARE
%{
  double mono_q = 1.8734;
  double OMA;  
  double RV;
  double y_mono = 0.025;
  double NV = 5;
  double d_phi_0;
  double TTM;
  double sample_radius = 0.008/2;
  double sample_height = 0.03;
  double can_radius = 0.0083/2;
  double can_height = 0.0303;
  double can_thick = 0.00015;
  
  /******Mirrorvalues*****/
  
  double alpha;
  double Qc=0.0217;
  double R0=0.995;
  double Mvalue=1.9;
  double W=1.0/250.0;
  
  double alpha_curve;
  double Qc_curve=0.0217;
  double R0_curve= 0.995;
  double Mvalue_curve=2.1;
  double W_curve=1.0/250.0;
  
  double ldiff=0.05;
  /* Curved guide element angle*/
  double angleGuideCurved;

%}

INITIALIZE
%{
  TTM = 2*asin(mono_q*lambda/(4*PI))*RAD2DEG;
  OMA = TTM/2;
  RV = fabs(2*2.82*sin(DEG2RAD*OMA));
  
  angleGuideCurved=-2.0*asin(0.4995 /2.0/3612)/PI*180;
  alpha=(R0-R)/Qc/(Mvalue-1);
  alpha_curve=(R0_curve-R_curve)/Qc_curve/(Mvalue_curve-1);
  
%}

TRACE

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

COMPONENT source = Source_Maxwell_3(
        yheight=0.156, xwidth=0.126,
	      Lmin=lambda-ldiff/2,Lmax=lambda+ldiff/2,
        dist=1.5, focus_xw = 0.02, focus_yh = 0.12,
        T1=296.16, I1=8.5E11,
        T2=40.68, I2=5.2E11)    
AT (0,0,0) RELATIVE source_arm  ROTATED (0,0,0) RELATIVE source_arm

COMPONENT PSDbefore_guides = PSD_monitor(
    nx = 128, ny = 128, filename = "PSDbefore_guides",
    xwidth = 0.025, yheight = 0.125)
AT (0, 0, 1.5) RELATIVE source_arm

END