From 780039c51215ab29feb6a9ddb5e13a570c517e65 Mon Sep 17 00:00:00 2001 From: Patrick Shriwise Date: Thu, 20 Jan 2022 15:10:24 -0600 Subject: [PATCH] moving some single-use constants closer to point of use --- include/openmc/cmfd_solver.h | 11 +++++++++++ include/openmc/constants.h | 24 +----------------------- include/openmc/particle_data.h | 3 +++ include/openmc/physics.h | 7 +++++++ include/openmc/source.h | 9 +++++++++ include/openmc/weight_windows.h | 6 ++++++ 6 files changed, 37 insertions(+), 23 deletions(-) diff --git a/include/openmc/cmfd_solver.h b/include/openmc/cmfd_solver.h index 731fe7ffbd..76c8bf6a89 100644 --- a/include/openmc/cmfd_solver.h +++ b/include/openmc/cmfd_solver.h @@ -3,6 +3,17 @@ namespace openmc { +//============================================================================== +// Constants +//============================================================================== + +// For non-accelerated regions on coarse mesh overlay +constexpr int CMFD_NOACCEL {-1}; + +//============================================================================== +// Non-member functions +//============================================================================== + void free_memory_cmfd(); } // namespace openmc diff --git a/include/openmc/constants.h b/include/openmc/constants.h index ddd38500ff..8427c2d558 100644 --- a/include/openmc/constants.h +++ b/include/openmc/constants.h @@ -39,9 +39,6 @@ constexpr array VERSION_PROPERTIES {1, 0}; // NOTE: This is the only section of the constants module that should ever be // adjusted. Modifying constants in other sections may cause the code to fail. -// Monoatomic ideal-gas scattering treatment threshold -constexpr double FREE_GAS_THRESHOLD {400.0}; - // Significance level for confidence intervals constexpr double CONFIDENCE_LEVEL {0.95}; @@ -53,15 +50,9 @@ constexpr double FP_PRECISION {1e-14}; constexpr double FP_REL_PRECISION {1e-5}; constexpr double FP_COINCIDENT {1e-12}; -// Maximum number of collisions/crossings -constexpr int MAX_EVENTS {1000000}; +// Maximum number of random samples per history constexpr int MAX_SAMPLE {100000}; -// Maximum number of external source spatial resamples to encounter before an -// error is thrown. -constexpr int EXTSRC_REJECT_THRESHOLD {10000}; -constexpr double EXTSRC_REJECT_FRACTION {0.05}; - // ============================================================================ // MATH AND PHYSICAL CONSTANTS @@ -237,9 +228,6 @@ enum ReactionType { constexpr array DEPLETION_RX {N_GAMMA, N_P, N_A, N_2N, N_3N, N_4N}; -// Maximum number of partial fission reactions -constexpr int PARTIAL_FISSION_MAX {4}; - // Resonance elastic scattering methods enum class ResScatMethod { rvs, // Relative velocity sampling @@ -342,21 +330,11 @@ enum class RunMode { VOLUME }; -// ============================================================================ -// CMFD CONSTANTS - -// For non-accelerated regions on coarse mesh overlay -constexpr int CMFD_NOACCEL {-1}; - //============================================================================== // Geometry Constants enum class GeometryType { CSG, DAG }; -//============================================================================== -// Variance Reduction constants -constexpr double DEFAULT_WEIGHT_CUTOFF {1.0e-38}; // default low weight cutoff - } // namespace openmc #endif // OPENMC_CONSTANTS_H diff --git a/include/openmc/particle_data.h b/include/openmc/particle_data.h index 7d03823856..d31c20022e 100644 --- a/include/openmc/particle_data.h +++ b/include/openmc/particle_data.h @@ -27,6 +27,9 @@ constexpr int MAX_DELAYED_GROUPS {8}; constexpr double CACHE_INVALID {-1.0}; +// Maximum number of collisions/crossings +constexpr int MAX_EVENTS {1000000}; + //========================================================================== // Aliases and type definitions diff --git a/include/openmc/physics.h b/include/openmc/physics.h index 32a43e26d4..262b3a8841 100644 --- a/include/openmc/physics.h +++ b/include/openmc/physics.h @@ -10,6 +10,13 @@ namespace openmc { +//============================================================================== +// Constants +//============================================================================== + +// Monoatomic ideal-gas scattering treatment threshold +constexpr double FREE_GAS_THRESHOLD {400.0}; + //============================================================================== // Non-member functions //============================================================================== diff --git a/include/openmc/source.h b/include/openmc/source.h index 6866655c18..18fddc6899 100644 --- a/include/openmc/source.h +++ b/include/openmc/source.h @@ -14,6 +14,15 @@ namespace openmc { +//============================================================================== +// Constants +//============================================================================== + +// Maximum number of external source spatial resamples to encounter before an +// error is thrown. +constexpr int EXTSRC_REJECT_THRESHOLD {10000}; +constexpr double EXTSRC_REJECT_FRACTION {0.05}; + //============================================================================== // Global variables //============================================================================== diff --git a/include/openmc/weight_windows.h b/include/openmc/weight_windows.h index 12113d528f..9c42138901 100644 --- a/include/openmc/weight_windows.h +++ b/include/openmc/weight_windows.h @@ -15,6 +15,12 @@ namespace openmc { +//============================================================================== +// Constants +//============================================================================== + +constexpr double DEFAULT_WEIGHT_CUTOFF {1.0e-38}; // default low weight cutoff + //============================================================================== // Non-member functions //==============================================================================