1 #ifndef OPENMC_SETTINGS_H
2 #define OPENMC_SETTINGS_H
3 
4 //! \file settings.h
5 //! \brief Settings for OpenMC
6 
7 #include <cstdint>
8 #include <string>
9 #include <unordered_set>
10 
11 #include "pugixml.hpp"
12 
13 #include "openmc/array.h"
14 #include "openmc/constants.h"
15 #include "openmc/vector.h"
16 
17 namespace openmc {
18 
19 //==============================================================================
20 // Global variable declarations
21 //==============================================================================
22 
23 namespace settings {
24 
25 
26 // Boolean flags
27 extern bool assume_separate;          //!< assume tallies are spatially separate?
28 extern bool check_overlaps;           //!< check overlaps in geometry?
29 extern bool confidence_intervals;     //!< use confidence intervals for results?
30 extern bool create_fission_neutrons;  //!< create fission neutrons (fixed source)?
31 extern "C" bool cmfd_run;             //!< is a CMFD run?
32 extern "C" bool dagmc;                //!< indicator of DAGMC geometry
33 extern bool delayed_photon_scaling;   //!< Scale fission photon yield to include delayed
34 extern "C" bool entropy_on;           //!< calculate Shannon entropy?
35 extern bool event_based;              //!< use event-based mode (instead of history-based)
36 extern bool legendre_to_tabular;      //!< convert Legendre distributions to tabular?
37 extern bool material_cell_offsets;    //!< create material cells offsets?
38 extern "C" bool output_summary;       //!< write summary.h5?
39 extern bool output_tallies;           //!< write tallies.out?
40 extern bool particle_restart_run;     //!< particle restart run?
41 extern "C" bool photon_transport;     //!< photon transport turned on?
42 extern "C" bool reduce_tallies;       //!< reduce tallies at end of batch?
43 extern bool res_scat_on;              //!< use resonance upscattering method?
44 extern "C" bool restart_run;          //!< restart run?
45 extern "C" bool run_CE;               //!< run with continuous-energy data?
46 extern bool source_latest;            //!< write latest source at each batch?
47 extern bool source_separate;          //!< write source to separate file?
48 extern bool source_write;             //!< write source in HDF5 files?
49 extern bool surf_source_write;        //!< write surface source file?
50 extern bool surf_source_read;         //!< read surface source file?
51 extern bool survival_biasing;         //!< use survival biasing?
52 extern bool temperature_multipole;    //!< use multipole data?
53 extern "C" bool trigger_on;           //!< tally triggers enabled?
54 extern bool trigger_predict;          //!< predict batches for triggers?
55 extern bool ufs_on;                   //!< uniform fission site method on?
56 extern bool urr_ptables_on;           //!< use unresolved resonance prob. tables?
57 extern bool write_all_tracks;         //!< write track files for every particle?
58 extern bool write_initial_source;     //!< write out initial source file?
59 
60 // Paths to various files
61 extern std::string path_cross_sections;   //!< path to cross_sections.xml
62 extern std::string path_input;            //!< directory where main .xml files resides
63 extern std::string path_output;           //!< directory where output files are written
64 extern std::string path_particle_restart; //!< path to a particle restart file
65 extern std::string path_sourcepoint;      //!< path to a source file
66 extern "C" std::string path_statepoint;   //!< path to a statepoint file
67 
68 extern "C" int32_t n_inactive;               //!< number of inactive batches
69 extern "C" int32_t max_lost_particles;     //!< maximum number of lost particles
70 extern double rel_max_lost_particles;   //!< maximum number of lost particles, relative to the total number of particles
71 extern "C" int32_t gen_per_batch;            //!< number of generations per batch
72 extern "C" int64_t n_particles;              //!< number of particles per generation
73 
74 
75 extern int64_t max_particles_in_flight; //!< Max num. event-based particles in flight
76 
77 extern ElectronTreatment electron_treatment;       //!< how to treat secondary electrons
78 extern array<double, 4>
79   energy_cutoff; //!< Energy cutoff in [eV] for each particle type
80 extern int legendre_to_tabular_points; //!< number of points to convert Legendres
81 extern int max_order;                //!< Maximum Legendre order for multigroup data
82 extern int n_log_bins;               //!< number of bins for logarithmic energy grid
83 extern int n_batches;                //!< number of (inactive+active) batches
84 extern int n_max_batches;            //!< Maximum number of batches
85 extern ResScatMethod res_scat_method; //!< resonance upscattering method
86 extern double res_scat_energy_min;   //!< Min energy in [eV] for res. upscattering
87 extern double res_scat_energy_max;   //!< Max energy in [eV] for res. upscattering
88 extern vector<std::string>
89   res_scat_nuclides; //!< Nuclides using res. upscattering treatment
90 extern RunMode run_mode;                 //!< Run mode (eigenvalue, fixed src, etc.)
91 extern std::unordered_set<int> sourcepoint_batch; //!< Batches when source should be written
92 extern std::unordered_set<int> statepoint_batch; //!< Batches when state should be written
93 extern std::unordered_set<int> source_write_surf_id; //!< Surface ids where sources will be written
94 extern int64_t max_surface_particles;    //!< maximum number of particles to be banked on surfaces per process
95 extern TemperatureMethod temperature_method;           //!< method for choosing temperatures
96 extern double temperature_tolerance;     //!< Tolerance in [K] on choosing temperatures
97 extern double temperature_default;       //!< Default T in [K]
98 extern array<double, 2>
99   temperature_range; //!< Min/max T in [K] over which to load xs
100 extern int trace_batch;                  //!< Batch to trace particle on
101 extern int trace_gen;                    //!< Generation to trace particle on
102 extern int64_t trace_particle;           //!< Particle ID to enable trace on
103 extern vector<array<int, 3>>
104   track_identifiers;                 //!< Particle numbers for writing tracks
105 extern int trigger_batch_interval;   //!< Batch interval for triggers
106 extern "C" int verbosity;                //!< How verbose to make output
107 extern double weight_cutoff;         //!< Weight cutoff for Russian roulette
108 extern double weight_survive;        //!< Survival weight after Russian roulette
109 } // namespace settings
110 
111 //==============================================================================
112 // Functions
113 //==============================================================================
114 
115 //! Read settings from XML file
116 //! \param[in] root XML node for <settings>
117 void read_settings_xml();
118 
119 void free_memory_settings();
120 
121 } // namespace openmc
122 
123 #endif // OPENMC_SETTINGS_H
124