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
|
/*******************************************************************************
* McStas instrument definition URL=http://mcstas.risoe.dk
*
* Instrument: Test_Sources
*
* %Identification
* Written by: FARHI Emmanuel (farhi@ill.fr)
* Date: Aug 3, 2008
* Origin:ILL
* %INSTRUMENT_SITE: Tests_optics
*
* A test instrument to compare sources
*
* %Description
* A test instrument to compare sources and check they provide the valid
* sprectrum and intensity. It shows that the first 4 flat sources are equivalent,
* the 2 Maxwellian sources as well.
*
* WARNING: Result of test no. 1 for Source_adapt.comp is not correct if MPI is used, as
* that source component does not support MPI.
*
* Example: source=1 Detector: m1_I=9.97273e+11
* %Example: source=2 Detector: m1_I=9.48467e+11
* %Example: source=3 Detector: m1_I=9.96553e+11
* %Example: source=4 Detector: m1_I=9.966e+11
* %Example: source=5 Detector: m1_I=2.4279e+11
* %Example: source=6 Detector: m1_I=2.42284e+11
* %Example: source=7 Detector: m1_I=2.28139e+13
* %Example: source=8 Detector: m1_I=5.0787e+13
*
* %Parameters
* source: [1] selection of the source to use in 1=Source_adapt, 2=Source_div, 3=Source_simple, 4=Source_gen (simple), 5=Source_gen, 6=Source_Maxwell_3, 7=ESS_butterfly, 8=Moderator
* Lmin: [AA] Minimum wavelength produced at source
* Lmax: [AA] Maximum wavelength produced at source
*
* %End
*******************************************************************************/
DEFINE INSTRUMENT Test_Sources(int source=0, Lmin=1, Lmax=11)
DECLARE
%{
double Lambda0;
double dLambda;
char lamopts[128];
%}
INITIALIZE
%{
printf("%s: ", NAME_INSTRUMENT);
if (source==1) printf("Using Source_adapt\n");
else if (source==2) printf("Using Source_div\n");
else if (source==3) printf("Using Source_simple\n");
else if (source==4) printf("Using Source_gen (flat spectrum)\n");
else if (source==5) printf("Using Source_gen\n");
else if (source==6) printf("Using Source_Maxwell_3\n");
else if (source==7) printf("Using ESS_butterfly\n");
else if (source==8) printf("Using Moderator\n");
else {
printf("Selected moderator undefined, exiting!\n");
exit(-1);
}
printf("Studied wavelength range is [%g %g] AA\n", Lmin, Lmax);
dLambda=(Lmax-Lmin)/2;
Lambda0=(Lmax+Lmin)/2;
sprintf(lamopts,"lambda limits=[%g %g]",Lmin,Lmax);
%}
TRACE
COMPONENT Origin = Progress_bar()
AT (0, 0, 0) ABSOLUTE
/* the sources ============================================================== */
COMPONENT sa2 = Source_div( /* flux in n/s/cm2/st/AA */
xwidth=0.01, yheight=0.01, focus_aw=2*RAD2DEG*atan(0.1/1.0/2), focus_ah=2*RAD2DEG*atan(0.1/1.0/2), lambda0=Lambda0, dlambda=dLambda, gauss=0, flux=1e13
) WHEN (source == 2)
AT (0,0,0) ABSOLUTE
COMPONENT sa3 = Source_simple( /* flux in n/s/cm2/st/AA */
xwidth=0.01, yheight=0.01,
dist=1, focus_xw=0.1, focus_yh=0.1,
lambda0=Lambda0, dlambda=dLambda, flux=1e13
) WHEN (source == 3)
AT (0,0,0) ABSOLUTE
COMPONENT sa4 = Source_gen( /* flux in n/s/cm2/st/AA */
Lmin=Lmin, Lmax=Lmax, dist=1, focus_xw=0.1, focus_yh=0.1,
xwidth=0.01, yheight=0.01,
I1=1e+13
) WHEN (source == 4)
AT (0,0,0) ABSOLUTE
COMPONENT sa5 = Source_gen( /* flux in n/s/cm2/st/AA */
Lmin=Lmin, Lmax=Lmax, dist=1, focus_xw=0.1, focus_yh=0.1,
xwidth=0.01, yheight=0.01, verbose=1,
T1=216.8,I1=1.24e+13,T2=33.9,I2=1.02e+13, T3=16.7 ,I3=3.0423e+12
) WHEN (source == 5)
AT (0,0,0) ABSOLUTE
COMPONENT sa6 = Source_Maxwell_3( /* flux in n/s/cm2/st/AA */
Lmin=Lmin, Lmax=Lmax, dist=1, focus_xw=0.1, focus_yh=0.1,
xwidth=0.01, yheight=0.01,
T1=216.8,I1=1.24e+13,T2=33.9,I2=1.02e+13, T3=16.7 ,I3=3.0423e+12
) WHEN (source == 6)
AT (0,0,0) ABSOLUTE
COMPONENT sa7 = ESS_butterfly(sector="W",beamline=8,
Lmin=Lmin, Lmax=Lmax, dist=1, focus_xw=0.1, focus_yh=0.1
) WHEN (source == 7)
AT (0,0,0) ABSOLUTE
COMPONENT sa8 = Moderator( /* flux in n/s/cm2/st */
radius = 0.01*sqrt(2), dist=1, focus_xw=0.1, focus_yh=0.1,
Emin =81.81/(Lmax*Lmax), Emax = 81.81/(Lmin*Lmin), Ec = 9.0, t0 = 37.15, gamma = 39.1, flux=1e13
) WHEN (source == 8)
AT (0,0,0) ABSOLUTE
COMPONENT Events = Event_monitor_simple(nevents=1e3)
AT (0,0,0) ABSOLUTE
/* the monitor ============================================================== */
COMPONENT m1 = Monitor_nD(
xwidth=0.1, yheight=0.1,
options=lamopts, bins=40
) AT (0,0,1) ABSOLUTE
COMPONENT m2 = Monitor_nD(
xwidth=0.2, yheight=0.2,
options="x, y, parallel", bins=40
) AT (0,0,1) ABSOLUTE
COMPONENT m3 = Monitor_nD(
xwidth=0.2, yheight=0.2,
options="dx limits=[-3.5 3.5] dy limits=[-3.5 3.5], parallel", bins=40
) AT (0,0,1) ABSOLUTE
END
|