Skip to content

Commit cf6a2db

Browse files
authored
Merge pull request #2360 from mccode-dev/patch-issue-2359
Patch issue 2359 - Al_window absorption/scattering
2 parents 0b57bc4 + 24a97be commit cf6a2db

4 files changed

Lines changed: 178 additions & 7 deletions

File tree

mcstas-comps/contrib/Al_window.comp

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,12 @@ SHARE
6464
#endif
6565
%}
6666

67+
INITIALIZE
68+
%{
69+
MPI_MASTER (fprintf (stderr, "Al_window %s WARNING: Using simple lo-fi transmission model.\n - Replace with PowderN or NCrystal for bragg edges etc.\n",
70+
NAME_CURRENT_COMP););
71+
%}
72+
6773
TRACE
6874
%{
6975
double v; /* Neutron velocity */
@@ -72,22 +78,26 @@ TRACE
7278
double Al_s_tot_lambda, Al_my_tot, Al_my_a; /* total XS (barn), total scattering length (m-1), absorption scat. length */
7379
double lambda; /* neutrons wavelength */
7480

81+
/* Propagate to entry plane */
7582
PROP_Z0;
76-
83+
/* Calculate (linear) time to travel in material */
7784
dt0 = thickness / vz;
7885
v = sqrt (vx * vx + vy * vy + vz * vz);
86+
/* Propagate path through material and calculate distance travelled */
7987
PROP_DT (dt0);
8088
dist = v * dt0;
8189

90+
/* Velocity-corrected attentuation */
91+
Al_my_a = Al_my_a_v / v;
92+
93+
/* Crude 4th-order polynomial approximation for scattering cross-section */
8294
lambda = sqrt (81.81 / (VS2E * v * v));
8395
Al_s_tot_lambda = Al_pf_A + Al_pf_B1 * lambda + Al_pf_B2 * lambda * lambda + Al_pf_B3 * lambda * lambda * lambda;
8496
Al_s_tot_lambda += Al_pf_B4 * lambda * lambda * lambda * lambda;
85-
Al_my_tot = Al_rho / Al_mmol * Al_s_tot_lambda * avogadro * 10;
86-
Al_my_a = Al_my_a_v / v;
87-
88-
p *= exp (-Al_my_a * dist); /* neutron passes window without any interaction */
97+
Al_my_tot = Al_rho / Al_mmol * Al_s_tot_lambda * avogadro;
8998

90-
/* TODO: scatter in Debye-Scherrer cone */
99+
/* Weight with cross-section */
100+
p *= exp (-(Al_my_tot + Al_my_a) * dist); /* neutron passes window without any interaction */
91101
%}
92102

93103
MCDISPLAY

mcstas-comps/examples/ILL/ILL_H143_LADI/ILL_H143_LADI.instr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
* Detector: image plate 1250 x 450 mm2
4646
* Sample: at 2.710 mm from the end of the guide H143.
4747
*
48-
* %Example: -y Detector: ImagePlate_I=855288
48+
* %Example: -y Detector: ImagePlate_I=959000
4949
*
5050
* %Parameters
5151
* lambda: [Angs] wavelength
Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
/*******************************************************************************
2+
* Instrument: Test_Al_windows
3+
*
4+
* %I
5+
* Written by: Peter Willendrup
6+
* Date: 20260316
7+
* Origin: ESS
8+
* %INSTRUMENT_SITE: Tests_optics
9+
*
10+
* Small test instrument for studying Al-window performance
11+
*
12+
* %D
13+
* Test instrument for studying transmission through Al-windows.
14+
*
15+
* Includes 3 models of increasing complexity / sophistication:
16+
* 1) Al_window(),:
17+
* - simple linear absorption + 4th order scattering model
18+
* - infinite-plane geometry
19+
* 2) PowderN()
20+
* - Material specified from Al.laz input-file
21+
* - Parametrized for 80% statistics -> transmission
22+
* 3) NCrystal()
23+
* - Material specified from local Al as .ncmat format input
24+
* (generated from CIF file COD / 1502689)
25+
*
26+
* %Example: Window=1 thickness=0.001 Detector: OutputWL_I=0.099
27+
* %Example: Window=2 thickness=0.001 Detector: OutputWL_I=0.099
28+
* %Example: Window=3 thickness=0.001 Detector: OutputWL_I=0.099
29+
* %Example: Window=1 thickness=0.005 Detector: OutputWL_I=0.098
30+
* %Example: Window=2 thickness=0.005 Detector: OutputWL_I=0.098
31+
* %Example: Window=3 thickness=0.005 Detector: OutputWL_I=0.098
32+
*
33+
* %P
34+
* Window: [1] Choice of Al_Window (1), PowderN (2) or NCrystal (3) model
35+
* thickness: [m] Thickness of Al window
36+
* %L
37+
* <reference/HTML link>
38+
*
39+
* %E
40+
*******************************************************************************/
41+
DEFINE INSTRUMENT Test_Al_windows(int Window=1, double thickness=0.005)
42+
43+
DECLARE
44+
%{
45+
double u=1e-6; // Small distance, 1um
46+
%}
47+
48+
USERVARS
49+
%{
50+
%}
51+
52+
INITIALIZE
53+
%{
54+
%}
55+
56+
TRACE
57+
58+
COMPONENT origin = Progress_bar()
59+
AT (0, 0, 0) RELATIVE ABSOLUTE
60+
61+
COMPONENT Source = Source_simple(
62+
yheight=0.1,
63+
xwidth=0.1,
64+
dist=10,
65+
focus_xw=0.1,
66+
focus_yh=0.1,
67+
lambda0=5,
68+
dlambda=4.99)
69+
AT (0, 0, 0) RELATIVE PREVIOUS
70+
71+
COMPONENT InputPSD = PSD_monitor(
72+
xwidth=0.11,
73+
yheight=0.11)
74+
AT (0, 0, u) RELATIVE Source
75+
76+
COMPONENT InputWL = L_monitor(
77+
xwidth=0.11,
78+
yheight=0.11,
79+
nL=1000, Lmin=0, Lmax=10)
80+
AT (0, 0, u) RELATIVE Source
81+
82+
83+
COMPONENT Slit_in = Slit(
84+
xwidth=0.1,
85+
yheight=0.1)
86+
AT (0, 0, 10) RELATIVE Source
87+
88+
COMPONENT Al_window = Al_window(
89+
thickness=thickness)
90+
WHEN Window==1 AT (0, 0, 10+u) RELATIVE Source
91+
92+
COMPONENT PowderN = PowderN(xwidth=0.11, yheight=0.11, zdepth=thickness, reflections="Al.laz", p_transmit=0.8, p_inc=0.1, p_interact=0.1)
93+
WHEN Window==2 AT (0, 0, 10+u) RELATIVE Source
94+
95+
COMPONENT NCrystal_sample = NCrystal_sample(xwidth=0.11, yheight=0.11, zdepth=thickness, cfg="autogen_Al_sg225_cod1502689.ncmat")
96+
WHEN Window==3 AT (0, 0, 10+u) RELATIVE Source
97+
98+
COMPONENT Slit_out = Slit(
99+
xwidth=0.1,
100+
yheight=0.1)
101+
AT (0, 0, 10+thickness+2*u) RELATIVE Source
102+
103+
COMPONENT OutputSD = PSD_monitor(
104+
xwidth=0.11,
105+
yheight=0.11)
106+
AT (0, 0, u) RELATIVE Slit_out
107+
108+
COMPONENT OutputWL = L_monitor(
109+
xwidth=0.11,
110+
yheight=0.11,
111+
nL=1000, Lmin=0, Lmax=10)
112+
AT (0, 0, u) RELATIVE Slit_out
113+
114+
FINALLY
115+
%{
116+
%}
117+
118+
END
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
NCMAT v7
2+
#
3+
# Al (cubic, SG-225)
4+
#
5+
# Atoms per unit cell: 4xAl
6+
#
7+
# Structure converted (with NCrystal.cifutils module) from:
8+
#
9+
# "Hydrogen in the Metal&#x2212;Organic Framework Cr MIL-53"
10+
# Mulder, Fokko M., et al. [The Journal of Physical Chemistry C, 2010]
11+
# DOI: https://dx.doi.org/10.1021/jp102463p
12+
# Crystallography Open Database entry 1502689
13+
# https://www.crystallography.net/cod/1502689.html
14+
#
15+
# IMPORTANT NOTICE: This is a mostly automatic conversion which has not been
16+
# verified! In particular the @DYNINFO sections might need
17+
# post-editing. Before distributing this file to other people,
18+
# please review this, amend the comments here to document,
19+
# anything done, and remove this notice.
20+
#
21+
# Notice: The following WARNINGS were emitted when loading the CIF data:
22+
#
23+
# NCrystalUserWarning : ignoring uiso info present in CIF input for "Al" since uiso_temperature parameter value is not provided
24+
#
25+
# WARNING: Fallback (dummy) Debye temperature value was used for 1 atom!
26+
#
27+
# NOTICE: crystal structure was verified with spglib to be self-consistent.
28+
#
29+
@CELL
30+
cubic 4.0339
31+
@SPACEGROUP
32+
225
33+
@ATOMPOSITIONS
34+
Al 0 0 0
35+
Al 0 1/2 1/2
36+
Al 1/2 0 1/2
37+
Al 1/2 1/2 0
38+
@DYNINFO
39+
# WARNING: Using fallback Debye temperature value!
40+
element Al
41+
fraction 1
42+
type vdosdebye
43+
debye_temp 300

0 commit comments

Comments
 (0)