Skip to content

Commit f653fb5

Browse files
committed
Add rudimentary Union Geometry_test adapted from McStas
1 parent e111ec5 commit f653fb5

1 file changed

Lines changed: 172 additions & 0 deletions

File tree

Lines changed: 172 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,172 @@
1+
/*******************************************************************************
2+
* McXtrace instrument definition URL=http://www.mcxtrace.org
3+
*
4+
* Instrument: Geometry_test
5+
*
6+
* %Identification
7+
* Written by: Peter Willendrup
8+
* Date: January 2026
9+
* Origin: DTU
10+
* %INSTRUMENT_SITE: Tests_union
11+
*
12+
* Test of all Union geometry components in one file
13+
*
14+
* %Description
15+
* Use of all basic geometries, mesh(as a torus), sphere, cylinder, cone and box
16+
*
17+
* Adapted from McSas Geometry_test, work in progress
18+
*
19+
* Example: meshfile="torus.off" Detector: detector_scat_I=47.5
20+
* Example: meshfile="torus.STL" Detector: detector_scat_I=47.5
21+
*
22+
* %Parameters
23+
*
24+
* %End
25+
*******************************************************************************/
26+
27+
DEFINE INSTRUMENT Geometry_test(string meshfile="torus.STL")
28+
29+
DECLARE
30+
%{
31+
%}
32+
33+
TRACE
34+
35+
COMPONENT init = Union_init()
36+
AT (0,0,0) ABSOLUTE
37+
38+
COMPONENT Vanadium_incoherent = Incoherent_process(sigma=2*5.08,packing_factor=1,unit_cell_volume=27.66)
39+
AT (0,0,0) ABSOLUTE
40+
41+
COMPONENT Vanadium = Union_make_material(my_absorption=2*5.08*100/27.66,process_string="Vanadium_incoherent")
42+
AT (0,0,0) ABSOLUTE
43+
44+
/* // P0 */
45+
/* COMPONENT Al_incoherent = Incoherent_process(sigma=4*0.0082,packing_factor=1,unit_cell_volume=66.4) */
46+
/* AT (0,0,0) ABSOLUTE */
47+
48+
/* // P1 */
49+
/* COMPONENT Al_Powder = Powder_process(reflections="Al.laz") */
50+
/* AT (0,0,0) ABSOLUTE */
51+
52+
/* COMPONENT Al = Union_make_material(my_absorption=100*4*0.231/66.4) */
53+
/* AT (0,0,0) ABSOLUTE */
54+
55+
/* // P0 */
56+
/* COMPONENT Cu_incoherent = Incoherent_process(sigma=4*0.55,packing_factor=1,unit_cell_volume=47.22) */
57+
/* AT (0,0,0) ABSOLUTE */
58+
59+
/* // P1 */
60+
/* COMPONENT Cu_Powder = Powder_process(reflections="Cu.laz") */
61+
/* AT (0,0,0) ABSOLUTE */
62+
63+
/* COMPONENT Cu = Union_make_material(my_absorption=5*100*4*3.78/47.22) */
64+
/* AT (0,0,0) ABSOLUTE */
65+
66+
COMPONENT a1 = Progress_bar()
67+
AT (0,0,0) ABSOLUTE
68+
69+
COMPONENT source = Arm()/* Source_div( */
70+
/* xwidth=0.09, yheight=0.15,focus_aw=0.01, focus_ah=0.01, */
71+
/* E0 = 5, */
72+
/* dE = 0, flux = 1E12) */
73+
AT (0,0,0) RELATIVE a1 ROTATED (0,0,0) RELATIVE a1
74+
75+
COMPONENT sample_pos = Arm()
76+
AT (0,0,0.3) RELATIVE source
77+
78+
/* COMPONENT cryostat_wall = Union_cylinder( */
79+
/* radius=0.07,yheight=0.32,priority=10,material_string="Al",p_interact=0.2) */
80+
/* AT (0,0,0) RELATIVE sample_pos */
81+
/* ROTATED (0,0,0) RELATIVE sample_pos */
82+
83+
/* COMPONENT cryostat_wall_vacuum = Union_cylinder( */
84+
/* radius=0.068,yheight=0.318,priority=11,material_string="Vacuum") */
85+
/* AT (0,0,0) RELATIVE sample_pos */
86+
/* ROTATED (0,0,0) RELATIVE sample_pos */
87+
88+
/* COMPONENT sample_sphere = Union_sphere( */
89+
/* radius=0.031,priority=20,material_string="Cu") */
90+
/* AT (0.01,0,0) RELATIVE sample_pos */
91+
/* ROTATED (0,0,0) RELATIVE sample_pos */
92+
93+
COMPONENT sample_box = Union_box(
94+
xwidth=0.021, yheight=0.018, zdepth=0.1, priority=21, material_string="Vanadium")
95+
AT (-0.01,0,0) RELATIVE sample_pos
96+
ROTATED (34,17,0) RELATIVE sample_pos
97+
98+
/* COMPONENT sample_cone = Union_cone( */
99+
/* radius_top=0.031, radius_bottom=0.005, yheight=0.04, priority=22, material_string="Cu") */
100+
/* AT (0.02,-0.03,0) RELATIVE sample_pos */
101+
/* ROTATED (0,0,20) RELATIVE sample_pos */
102+
103+
/* COMPONENT sample_torus = Union_mesh( */
104+
/* filename = meshfile, */
105+
/* material_string="Al", */
106+
/* coordinate_scale =0.025, */
107+
/* priority=346, */
108+
/* skip_convex_check=1 */
109+
/* ) AT (0,0,0.02) RELATIVE sample_pos */
110+
/* ROTATED (0,45,0) RELATIVE sample_pos */
111+
112+
113+
/* COMPONENT test_logger_1D = Union_logger_1D( */
114+
/* variable="time", min_value=1E-4, max_value=8E-4, n1=200, filename="logger_1D.dat" */
115+
/* ) */
116+
/* AT (0,0,0) RELATIVE sample_pos */
117+
/* ROTATED (0,0,0) RELATIVE sample_pos */
118+
119+
/* COMPONENT test_logger_2DQ = Union_logger_2DQ( */
120+
/* Q_direction_1 = "z", Q1_min=-5, Q1_max=5, n1=100, */
121+
/* Q_direction_2 = "x", Q2_min=-5, Q2_max=5, n2=100, */
122+
/* filename="logger_2DQ.dat" */
123+
/* ) */
124+
/* AT (0,0,0) RELATIVE sample_pos */
125+
/* ROTATED (0,0,0) RELATIVE sample_pos */
126+
127+
/* COMPONENT test_logger_2D_space_zx = Union_logger_2D_space( */
128+
/* D_direction_1 = "z", D1_min=-0.1, D1_max=0.1, n1=200, */
129+
/* D_direction_2 = "x", D2_min=-0.1, D2_max=0.1, n2=200, */
130+
/* filename="logger_2D_space_zx.dat" */
131+
/* ) */
132+
/* AT (0,0,0) RELATIVE sample_pos */
133+
/* ROTATED (0,0,0) RELATIVE sample_pos */
134+
135+
/* COMPONENT test_logger_2D_space_zy = Union_logger_2D_space( */
136+
/* D_direction_1 = "z", D1_min=-0.1, D1_max=0.1, n1=200, */
137+
/* D_direction_2 = "y", D2_min=-0.1, D2_max=0.1, n2=200, */
138+
/* filename="logger_2D_space_zy.dat" */
139+
/* ) */
140+
/* AT (0,0,0) RELATIVE sample_pos */
141+
/* ROTATED (0,0,0) RELATIVE sample_pos */
142+
143+
/* COMPONENT test_logger_3D_space = Union_logger_3D_space( */
144+
/* D_direction_1 = "z", D1_min=-0.1, D1_max=0.1, n1=200, */
145+
/* D_direction_2 = "x", D2_min=-0.1, D2_max=0.1, n2=200, */
146+
/* D_direction_3 = "y", D3_min=-0.03, D3_max=0.03, n3=3, */
147+
/* filename="logger_3D_space.dat" */
148+
/* ) */
149+
/* AT (0,0,0) RELATIVE sample_pos */
150+
/* ROTATED (0,0,0) RELATIVE sample_pos */
151+
152+
/* COMPONENT scat_direction = Arm() */
153+
/* AT (0,0,0) RELATIVE sample_pos */
154+
/* ROTATED (0,34,0) RELATIVE sample_pos */
155+
156+
COMPONENT sample = Union_master()
157+
AT(0,0,0) RELATIVE sample_pos
158+
ROTATED(0,0,0) RELATIVE sample_pos
159+
160+
/* COMPONENT detector = PSD_monitor(xwidth=0.085, yheight=0.15, nx=200, ny=200, filename="PSD.dat", restore_neutron=1) */
161+
/* AT (0,0,0.3) RELATIVE sample_pos */
162+
/* ROTATED (0,0,0) RELATIVE sample_pos */
163+
164+
/* COMPONENT detector_scat = PSD_monitor(xwidth=0.085, yheight=0.15, nx=200, ny=200, filename="PSD_scat.dat", restore_neutron=1) */
165+
/* AT (0,0,0.5) RELATIVE scat_direction */
166+
/* ROTATED (0,0,0) RELATIVE scat_direction */
167+
168+
COMPONENT stop = Union_stop()
169+
AT (0,0,0) ABSOLUTE
170+
171+
172+
END

0 commit comments

Comments
 (0)