diff --git a/include/openmc/settings.h b/include/openmc/settings.h index ccaaa1508f..aa4b93656a 100644 --- a/include/openmc/settings.h +++ b/include/openmc/settings.h @@ -5,6 +5,7 @@ //! \brief Settings for OpenMC #include +#include #include #include "pugixml.hpp" @@ -18,13 +19,32 @@ namespace openmc { namespace settings { // Boolean flags -extern "C" bool check_overlaps; //!< check overlaps in geometry? -extern "C" bool particle_restart_run; //!< particle restart run? -extern "C" bool photon_transport; //!< photon transport turned on? -extern "C" bool restart_run; //!< restart run? -extern "C" bool run_CE; //!< run with continuous-energy data? -extern "C" bool write_all_tracks; //!< write track files for every particle? -extern "C" bool write_initial_source; //!< write out initial source file? +extern "C" bool assume_separate; //!< assume tallies are spatially separate? +extern "C" bool check_overlaps; //!< check overlaps in geometry? +extern "C" bool cmfd_run; //!< use CMFD? +extern "C" bool confidence_intervals; //!< use confidence intervals for results? +extern "C" bool create_fission_neutrons; //!< create fission neutrons (fixed source)? +extern "C" bool entropy_on; //!< calculate Shannon entropy? +extern "C" bool legendre_to_tabular; //!< convert Legendre distributions to tabular? +extern "C" bool output_summary; //!< write summary.h5? +extern "C" bool output_tallies; //!< write tallies.out? +extern "C" bool particle_restart_run; //!< particle restart run? +extern "C" bool photon_transport; //!< photon transport turned on? +extern "C" bool reduce_tallies; //!< reduce tallies at end of batch? +extern "C" bool res_scat_on; //!< use resonance upscattering method? +extern "C" bool restart_run; //!< restart run? +extern "C" bool run_CE; //!< run with continuous-energy data? +extern "C" bool source_latest; //!< write latest source at each batch? +extern "C" bool source_separate; //!< write source to separate file? +extern "C" bool source_write; //!< write source in HDF5 files? +extern "C" bool survival_biasing; //!< use survival biasing? +extern "C" bool temperature_multipole; //!< use multipole data? +extern "C" bool trigger_on; //!< tally triggers enabled? +extern "C" bool trigger_predict; //!< predict batches for triggers? +extern "C" bool ufs_on; //!< uniform fission site method on? +extern "C" bool urr_ptables_on; //!< use unresolved resonance prob. tables? +extern "C" bool write_all_tracks; //!< write track files for every particle? +extern "C" bool write_initial_source; //!< write out initial source file? // Paths to various files // TODO: Make strings instead of char* once Fortran is gone @@ -37,12 +57,21 @@ extern std::string path_multipole; extern std::string path_output; extern std::string path_source; -// Temperature settings -extern int temperature_method; -extern bool temperature_multipole; -extern double temperature_tolerance; -extern double temperature_default; -extern std::array temperature_range; +extern "C" int32_t index_entropy_mesh; //!< Index of entropy mesh in global mesh array +extern "C" int32_t index_ufs_mesh; //!< Index of UFS mesh in global mesh array + +extern "C" int electron_treatment; //!< how to treat secondary electrons +extern "C" double energy_cutoff[4]; //!< Energy cutoff in [eV] for each particle type +extern "C" int legendre_to_tabular_points; //!< number of points to convert Legendres +extern "C" int temperature_method; //!< method for choosing temperatures +extern "C" int res_scat_method; //!< resonance upscattering method +extern "C" double res_scat_energy_min; //!< Min energy in [eV] for res. upscattering +extern "C" double res_scat_energy_max; //!< Max energy in [eV] for res. upscattering +extern "C" double temperature_tolerance; //!< Tolerance in [K] on choosing temperatures +extern "C" double temperature_default; //!< Default T in [K] +extern "C" double temperature_range[2]; //!< Min/max T in [K] over which to load xs +extern "C" double weight_cutoff; //!< Weight cutoff for Russian roulette +extern "C" double weight_survive; //!< Survival weight after Russian roulette } // namespace settings diff --git a/src/settings.F90 b/src/settings.F90 index 2ebb4da57b..8c862d9b9f 100644 --- a/src/settings.F90 +++ b/src/settings.F90 @@ -15,19 +15,19 @@ module settings ! CONTINUOUS-ENERGY CROSS SECTION RELATED VARIABLES ! Unreoslved resonance probablity tables - logical(C_BOOL) :: urr_ptables_on = .true. + logical(C_BOOL), bind(C) :: urr_ptables_on ! Default temperature and method for choosing temperatures - integer(C_INT) :: temperature_method = TEMPERATURE_NEAREST - logical :: temperature_multipole = .false. - real(C_DOUBLE) :: temperature_tolerance = 10.0_8 - real(8) :: temperature_default = 293.6_8 - real(8) :: temperature_range(2) = [ZERO, ZERO] + integer(C_INT), bind(C) :: temperature_method + logical(C_BOOL), bind(C) :: temperature_multipole + real(C_DOUBLE), bind(C) :: temperature_tolerance + real(C_DOUBLE), bind(C) :: temperature_default + real(C_DOUBLE), bind(C) :: temperature_range(2) integer :: n_log_bins ! number of bins for logarithmic grid logical(C_BOOL), bind(C) :: photon_transport - integer :: electron_treatment = ELECTRON_TTB + integer(C_INT), bind(C) :: electron_treatment ! ============================================================================ ! MULTI-GROUP CROSS SECTION RELATED VARIABLES @@ -36,19 +36,19 @@ module settings integer(C_INT) :: max_order ! Whether or not to convert Legendres to tabulars - logical :: legendre_to_tabular = .true. + logical(C_BOOL), bind(C) :: legendre_to_tabular ! Number of points to use in the Legendre to tabular conversion - integer(C_INT) :: legendre_to_tabular_points = C_NONE + integer(C_INT), bind(C) :: legendre_to_tabular_points ! ============================================================================ ! SIMULATION VARIABLES ! Assume all tallies are spatially distinct - logical :: assume_separate = .false. + logical(C_BOOL), bind(C) :: assume_separate ! Use confidence intervals for results instead of standard deviations - logical :: confidence_intervals = .false. + logical(C_BOOL), bind(C) :: confidence_intervals integer(C_INT64_T), bind(C) :: n_particles = 0 ! # of particles per generation integer(C_INT32_T), bind(C) :: n_batches ! # of batches @@ -57,25 +57,25 @@ module settings integer :: n_max_batches ! max # of batches integer :: n_batch_interval = 1 ! batch interval for triggers - logical :: pred_batches = .false. ! predict batches for triggers - logical :: trigger_on = .false. ! flag for turning triggers on/off + logical(C_BOOL), bind(C, name='trigger_predict') :: pred_batches ! predict batches for triggers + logical(C_BOOL), bind(C) :: trigger_on ! flag for turning triggers on/off - logical :: entropy_on = .false. - integer :: index_entropy_mesh = -1 + logical(C_BOOL), bind(C) :: entropy_on + integer(C_INT32_T), bind(C) :: index_entropy_mesh - logical :: ufs = .false. - integer :: index_ufs_mesh = -1 + logical(C_BOOL), bind(C, name='ufs_on') :: ufs + integer(C_INT32_T), bind(C) :: index_ufs_mesh ! Write source at end of simulation - logical :: source_separate = .false. - logical :: source_write = .true. - logical :: source_latest = .false. + logical(C_BOOL), bind(C) :: source_separate + logical(C_BOOL), bind(C) :: source_write + logical(C_BOOL), bind(C) :: source_latest ! Variance reduction settins - logical :: survival_biasing = .false. - real(8) :: weight_cutoff = 0.25_8 - real(8) :: energy_cutoff(4) = [ZERO, 1000.0_8, ZERO, ZERO] - real(8) :: weight_survive = ONE + logical(C_BOOL), bind(C) :: survival_biasing + real(C_DOUBLE), bind(C) :: weight_cutoff + real(C_DOUBLE), bind(C) :: energy_cutoff(4) + real(C_DOUBLE) :: weight_survive ! Mode to run in (fixed source, eigenvalue, plotting, etc) integer(C_INT), bind(C, name='openmc_run_mode') :: run_mode = NONE @@ -105,7 +105,7 @@ module settings logical(C_BOOL), bind(C) :: write_initial_source ! Whether create fission neutrons or not. Only applied for MODE_FIXEDSOURCE - logical :: create_fission_neutrons = .true. + logical(C_BOOL), bind(C) :: create_fission_neutrons ! Information about state points to be written integer :: n_state_points = 0 @@ -124,21 +124,21 @@ module settings character(MAX_FILE_LEN) :: path_output = '' ! Path to output directory ! Various output options - logical :: output_summary = .true. - logical :: output_tallies = .true. + logical(C_BOOL), bind(C) :: output_summary + logical(C_BOOL), bind(C) :: output_tallies ! Resonance scattering settings - logical :: res_scat_on = .false. ! is resonance scattering treated? - integer :: res_scat_method = RES_SCAT_ARES ! resonance scattering method - real(8) :: res_scat_energy_min = 0.01_8 - real(8) :: res_scat_energy_max = 1000.0_8 + logical(C_BOOL), bind(C) :: res_scat_on ! is resonance scattering treated? + integer(C_INT), bind(C) :: res_scat_method ! resonance scattering method + real(C_DOUBLE), bind(C) :: res_scat_energy_min + real(C_DOUBLE), bind(C) :: res_scat_energy_max character(10), allocatable :: res_scat_nuclides(:) ! Is CMFD active - logical :: cmfd_run = .false. + logical(C_BOOL), bind(C) :: cmfd_run ! No reduction at end of batch - logical :: reduce_tallies = .true. + logical(C_BOOL), bind(C) :: reduce_tallies contains diff --git a/src/settings.cpp b/src/settings.cpp index fc517b0c53..8c0027aa0f 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -18,13 +18,33 @@ namespace openmc { namespace settings { -bool check_overlaps {false}; -bool particle_restart_run {false}; -bool photon_transport {false}; -bool restart_run {false}; -bool run_CE {true}; -bool write_all_tracks {false}; -bool write_initial_source {false}; +// Default values for boolean flags +bool assume_separate {false}; +bool check_overlaps {false}; +bool cmfd_run {false}; +bool confidence_intervals {false}; +bool create_fission_neutrons {true}; +bool entropy_on {false}; +bool legendre_to_tabular {true}; +bool output_summary {true}; +bool output_tallies {true}; +bool particle_restart_run {false}; +bool photon_transport {false}; +bool reduce_tallies {true}; +bool res_scat_on {false}; +bool restart_run {false}; +bool run_CE {true}; +bool source_latest {false}; +bool source_separate {false}; +bool source_write {true}; +bool survival_biasing {false}; +bool temperature_multipole {false}; +bool trigger_on {false}; +bool trigger_predict {false}; +bool ufs_on {false}; +bool urr_ptables_on {true}; +bool write_all_tracks {false}; +bool write_initial_source {false}; char* path_input; char* path_statepoint; @@ -35,11 +55,21 @@ std::string path_multipole; std::string path_output; std::string path_source; +int32_t index_entropy_mesh {-1}; +int32_t index_ufs_mesh {-1}; + +int electron_treatment {ELECTRON_TTB}; +double energy_cutoff[4] {0.0, 1000.0, 0.0, 0.0}; +int legendre_to_tabular_points {C_NONE}; +int res_scat_method {RES_SCAT_ARES}; +double res_scat_energy_min {0.01}; +double res_scat_energy_max {1000.0}; int temperature_method {TEMPERATURE_NEAREST}; -bool temperature_multipole {false}; double temperature_tolerance {10.0}; double temperature_default {293.6}; -std::array temperature_range {0.0, 0.0}; +double temperature_range[2] {0.0, 0.0}; +double weight_cutoff {0.25}; +double weight_survive {1.0}; } // namespace settings