The Union framework, contributed by Mads Bertelsen (University of Copenhagen), is a set of components that together allow the description of complex, possibly nested or overlapping, sample environments with multiple scattering, by separating the description of geometry (where matter is) from physical process (what happens to a neutron there). A worked example can be found in the Union_demos category of the example instrument library (see the User Manual, chapter on instrument examples).
A Union simulation is assembled in four steps, each using one or more of the component classes documented in this chapter:
One or more process components (e.g. Incoherent_process, Powder_process, Single_crystal_process) each describe one scattering process.
These are gathered into named materials using Union_make_material, which may combine several processes (e.g. coherent + incoherent scattering) into one material definition.
Geometry components (Union_box, Union_cylinder, Union_sphere, Union_cone, Union_mesh) place volumes of a given material in the instrument, and may be nested or intersected to build up arbitrarily complex sample environments.
A Union_master component, placed after all of the geometries it should simulate, performs the actual ray-tracing (including multiple scattering) through every geometry defined since the previous master (or since Union_init). More than one master may be used in the same instrument to simulate, e.g., a sample and its environment in separate passes.
Additionally, logger and absorption logger components record scattering/absorption event statistics (position, \(Q\), time, …) within a Union geometry for diagnostic or scientific output, and conditional components restrict logging to neutrons meeting a criterion (e.g. reaching a detector).