Neutron transport code for background analysis.
This code calculates the neutron flux in an infinite slab of material using the multigroup diffusion approximation with zeroth-order evaluated group constants (see below for description of this approximation).
This repository is divided into several directories by functionality. The overall repository structure is:
|- ntransporter/
|---- boundary_conditions/
|---- cross_sections/
|---- include/
|---- process_reader/
|---- sources/
|---- src/
More details on each top-level subdirectory can be found in individual README
's.
The following packages must be installed/configured before building ntransporter
:
Geant4
: required bySuperSim
, also used for differential cross section calculations. Versions ofSuperSim
used byntransporter
(at time of writing,<= V11.00.01
) usegeant4-v10.6.3
. Installation instructions can be found here for the newest version, but should still work for 10.6.3.
Note
Geant4
must be built in multithreaded mode in order to interface correctly with ntransporter
. One should set the cmake flag GEANT4_BUILD_MULTITHREADED=ON
during compilation of Geant4
-
SuperSim
: SuperCDMS's main simulations software, used for configuring CDMS-specific physics lists and calculating total cross sections. Data under thesupersim
directory is used for source calculations. The entire source code must be available to this program, and the environment should be configured as when building/compiling the software yourself (see this Confluence page). The code is available on the Gitlab.Linking to
SuperSim
is managed by theSuperSim_include
andSuperSim_exclude
files. An example of each is included in the top level of this repository (see Top-level files section below). TheSuperSim_include
file gives a list of directories (under the$CDMS_SUPERSIM
environment variable) to link and compile files in. TheSuperSim_exclude
file gives a list of file names (not including directory paths) to exclude from explicit linking. By default, the build system will parse all files matching*.cc
by Linuxfind
command unless the full filename matches "/X
" forX
any line given in theSuperSim_exclude
file.At the time of compilation, the environment must be configured just as one would in trying to build
SuperSim
. For example, if one wishes to runntransporter
on Cedar, follow the instructions on this Confluence page, and run thesetup_supersim.sh
script before compilingntransporter
.
Depending on the system, SuperSim
may require some additional packages to be correctly installed/configured. See also the external package guide. These include:
-
ROOT
: CERN's data processing language. Find installation instructions here. Current versions ofntransporter
have been tested onROOT
version6.24/04
, but should work for any version>= 6.02
. One should also note the C++ standard used to compileROOT
for setting theCXX_STD
cmake
variable -
G4CMP
: Mike Kelsey's solid-state physics extension toGeant4
. Available on Github. Required by certain components ofSuperSim
, though not used directly by anyntransporter
functionality. If one wishes to avoid this dependency, they may investigate modifying theSuperSim_include
andSuperSim_exclude
-
CVODE
: LLNL's differential equation solver package. Can be downloaded as a component of theSUNDIALS
package (findv5.1.0
here), and find installation instructions here. Note thatcmake
assumes theCVODE
object files are built with the suffix.so
unless the compiler matches "AppleClang
", in which case it looks for.dylib
files. The baseCMakeLists.txt
file must be modified directly if this is not the case. -
uuid-dev
: utility package for generating 128-bit University Unique IDs (UUIDs) for random number generation. Can be downloaded withsudo apt-get install uuid-dev
A few environment variables (denoted by $
before the variable name) must be set before compiling ntransporter
(in addition to the ones either set or required by the SuperSim
configuration process, e.g., $CDMS_INSTALL
, $ROOTSYS
, or $G4WORKDIR
). These are:
-
$G4CMPINSTALL
: path to the system'sG4CMP
installation (note: it does not appear to be necessary to source the$G4CMPINSTALL/g4cmp_env.sh
script), e.g.,/home/ajbiffl3/G4CMP
. This one should also be set before sourcing theSuperSim
g4setup
script. -
$CVODE_HOME
: path to installation directory ofCVODE
, e.g., (if following the installation guide)/home/ajbiffl3/SUNDIALS/sundials-5.1.0/instdir
-
$LIBUUID_OBJ
: (only used ifcmake
optionFORCE_LIBUUID_LINK
is set) path touuid-dev
object file, e.g.,/usr/lib/libuuid.so
cmake
requires some variables giving paths to important files or other programs be set correctly in order to compile:
-
SUPERSIM_INCLUDE
: the full path of theSuperSim_include
file. If one wishes to useSuperSim_include.txt
included at the top level of this repository, the default value ("SuperSim_include.txt
") will be fine. -
SUPERSIM_EXCLUDE
: the full path of theSuperSim_exclude
file. Once again, the default value ("SuperSim_exclude.txt
") will use theSuperSim_exclude
file included in this repository. -
CXX_STD
: integer (default14
) specifying the C++ standard to compile the program with. It is recommended to compile against the same version used byROOT
. The default value of14
is typically used to compileSuperSim
. Conda installations ofROOT
use17
. -
FORCE_LIBUUID_LINK
boolean option (defaultOFF
) to force linking of thelibuuid
object file specified by the$LIBUUID_OBJ
environment variable (if set,$LIBUUID_OBJ
must be specified in the current environment to point to thelibuuid.so
object file on the current system, e.g.,/usr/lib/libuuid.so
). -
CVODE_LIB_FOLDER
: name of folder under environment variable$CVODE_HOME
containing object files forCVODE
(probably eitherlib
, the default value, orlib64
).
Some other optional cmake options can be used to personalize the build:
-
REGEN_CDMSVERSION
: boolean option (defaultOFF
) to force re-generation of theCDMSVersion.hh
header file. This option will always reset toOFF
after running, so must be explicitly set every time one wants to regenerate the version header file. This should be done any time theSuperSim
version is changed. -
IGNORE_WARNINGS
: boolean option (defaultOFF
) to ignore compiler warnings (passes-w
flag to compiler if set) -
SUBDIRS_VERBOSE
: boolean option (defaultOFF
) to print additional information about linking executables in first-level subdirectories -
EXCLUDE_VERBOSE
: boolean option (defaultON
) to print files excluded from compilation/linking by theSuperSim_exclude
file -
BUILD_PROCINFO
: boolean option (defaultOFF
) to build thePROCINFO
executable from theprocess_reader
subdirectory (see thatREADME
for more info)
These options can be set when calling cmake
or by modifying the CMakeCache.txt
file in the build directory directly. All but REGEN_CDMSVERSION
will be saved in CMakeCache.txt
for subsequent calls of cmake
.
The ntransporter
program uses cmake
utility to compile and build the executables in the program. Note that several steps in the cmake script require using the linux shell.
To build the program, make a build directory. For these examples, it's assumed the build directory is located inside the top-level ntransporter
directory:
$ cd ntransporter
$ mkdir build
$ cd build
Once the environment variables are correctly set up, the dependencies configured, and the necessary cmake
variables set, cmake
can be run, e.g.,
cmake -DFORCE_LIBUUID_LINK=ON -DCVODE_LIB_FOLDER="lib64" -DCXX_STD=17 ../
If this is successful, make
all targets:
make all
This will build all executables in ntransporter
into the build directory.
Alternatively, one can build each executable individually, e.g.,
make NT_Src
An overview of the executables built by ntransporter
is given here. In general, the executables built by ntransporter
begin with "NT_
".
-
NT_XS
: calculate group cross sections for one material/group number pairUsage:
./NT_XS output_file_base_path material [ngroups=100] [points_per_group=10]
-
NT_XX
: calculate group cross sections for multiple material/group number pairs (note the results change depending on the order of pairs - use is not recommended)Usage:
./NT_XX output_file_base_path material1 material2 ... [-n ngroups1=100 ngroups2 ...]
-
NT_DX
: calculate differential cross sections for multiple material/group number pairsUsage:
./NT_DX output_file_base_path path_to_ntransporter_base material1 material2 ... [-n ngroups1=100 ngroups2 ...]
-
NT_Src
: calculate group sourcesUsage:
./NT_Src output_file_base_path material path_to_supersim [ngroups=100]
-
NT_BC
: calculate boundary conditions (infinite slab flux)Usage:
./NT_BC output_file_base_path path_to_ntransporter_base material [ngroups=100]
-
PROCINFO
: print hadronic process info for the neutron in the "Shielding" physics list inSuperSim
Usage:
./PROCINFO
The repository currently includes many output files from the executables in data/V1
and data/V2
directories under the subdirectory of the corresponding executable, e.g., ntransporter/sources/data/V1
contains files generated with the NT_Src
executable.
The top-level ntransporter/
directory contains the following files:
-
.gitignore
: standard.gitignore
file -
CMakeLists.txt
: top-level CMakeLists file for the project. Responsible for compiling all executables in the repository -
LICENSE
: Standard MIT license -
SuperSim_include.txt
:SuperSim_include
file, list of directories within SuperSim needed for project -
SuperSim_exclude.txt
:SuperSim_exclude
file, list of filenames to exclude from linking if found in any of theSuperSim_include
directories -
SuperSim_Main.hh
: overloadedSuperSim_Main
header file fromSuperSim
- needed to redefine members of theSuperSim_Main
class as public so they can be accessed byntransporter
Version 2 Physics - Zero-Temperature Multigroup Diffusion Approximation with Zeroth-Order Evaluated Group Constants
The full neutron transport equation is:
where
To move to the neutron diffusion equation, we first define the scalar flux
and the neutron current density
(both with units neutrons per unit time per unit area per unit energy) and make two physical assumptions.
First, assume the angular flux
Second, assume the neutron current density
Additional physical assumptions: isotropic scattering and isotropic sources:
where
Now if we integrate over solid angle
We now define a series of
Integrating the diffusion equation over group
where we've defined the group flux
and the group source
and where we've defined the following "group constants:"
- The total cross section:
- The diffusion coefficient on the
$j$ component of the flux gradient:
- The inverse neutron speed:
- The scattering cross section from group
$g'$ to group$g$ :
Also note the spatial derivative term should be expanded as the following:
We consider a group structure with fast groups between 0.1 eV and 20 MeV and a single thermal group below 0.1 eV. The actual numerical value of the lower bound of the thermal group is set to 1e-7 eV
Given these specifications, a grouping (set of group boundaries) is specified by the number of fast groups. In the code this is what G
refers to, while G+1
.
With these in place, the bounds of the fast groups are
From the neutron diffusion equation, we consider the steady-state, infinite medium case, and so can drop the time and spatial derivatives, resulting in the "slowing down equation:"
where now everything is only a function of energy.
Once again integrating over group
In the zero-temperature approximation, it is impossible for a neutron to increase in energy (decrease in group number) after a collision, so the multigroup slowing down equation becomes:
The evaluation of most group constants requires knowledge of the flux
-
Assume s-wave scattering:
$\Sigma_s(E'\rightarrow E)=\frac{\Sigma_s(E')}{(1-\alpha)E'}$ when$E\lt E'\lt E/\alpha$ -
Ignore absorption and inelastic scattering
-
Consider energies well below source energies
These above assumptions result in an asymptotic solution
For the thermal group, we assume a Maxwell-Boltzmann distribution at room temperature (0.0257 eV).
More details on evaluating the differential cross sections cross_sections
documentation.