mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-26 21:25:36 -04:00
Merge branch 'event_based_update' of github.com:jtramm/openmc into event_based_update
This commit is contained in:
commit
97da05095f
92 changed files with 876 additions and 905 deletions
|
|
@ -25,10 +25,11 @@ namespace openmc {
|
|||
// Constants
|
||||
//==============================================================================
|
||||
|
||||
// TODO: Convert to enum
|
||||
constexpr int FILL_MATERIAL {1};
|
||||
constexpr int FILL_UNIVERSE {2};
|
||||
constexpr int FILL_LATTICE {3};
|
||||
enum class Fill {
|
||||
MATERIAL,
|
||||
UNIVERSE,
|
||||
LATTICE
|
||||
};
|
||||
|
||||
// TODO: Convert to enum
|
||||
constexpr int32_t OP_LEFT_PAREN {std::numeric_limits<int32_t>::max()};
|
||||
|
|
@ -149,7 +150,7 @@ public:
|
|||
|
||||
int32_t id_; //!< Unique ID
|
||||
std::string name_; //!< User-defined name
|
||||
int type_; //!< Material, universe, or lattice
|
||||
Fill type_; //!< Material, universe, or lattice
|
||||
int32_t universe_; //!< Universe # this cell is in
|
||||
int32_t fill_; //!< Universe # filling this cell
|
||||
int32_t n_instances_{0}; //!< Number of instances of this cell
|
||||
|
|
|
|||
|
|
@ -113,192 +113,170 @@ constexpr int NUCLIDE_NONE {-1};
|
|||
// ============================================================================
|
||||
// CROSS SECTION RELATED CONSTANTS
|
||||
|
||||
// Angular distribution type
|
||||
// TODO: Convert to enum
|
||||
constexpr int ANGLE_ISOTROPIC {1};
|
||||
constexpr int ANGLE_32_EQUI {2};
|
||||
constexpr int ANGLE_TABULAR {3};
|
||||
constexpr int ANGLE_LEGENDRE {4};
|
||||
constexpr int ANGLE_HISTOGRAM {5};
|
||||
|
||||
// Temperature treatment method
|
||||
// TODO: Convert to enum?
|
||||
constexpr int TEMPERATURE_NEAREST {1};
|
||||
constexpr int TEMPERATURE_INTERPOLATION {2};
|
||||
enum class TemperatureMethod {
|
||||
NEAREST,
|
||||
INTERPOLATION
|
||||
};
|
||||
|
||||
// Reaction types
|
||||
// TODO: Convert to enum
|
||||
constexpr int REACTION_NONE {0};
|
||||
constexpr int TOTAL_XS {1};
|
||||
constexpr int ELASTIC {2};
|
||||
constexpr int N_NONELASTIC {3};
|
||||
constexpr int N_LEVEL {4};
|
||||
constexpr int MISC {5};
|
||||
constexpr int N_2ND {11};
|
||||
constexpr int N_2N {16};
|
||||
constexpr int N_3N {17};
|
||||
constexpr int N_FISSION {18};
|
||||
constexpr int N_F {19};
|
||||
constexpr int N_NF {20};
|
||||
constexpr int N_2NF {21};
|
||||
constexpr int N_NA {22};
|
||||
constexpr int N_N3A {23};
|
||||
constexpr int N_2NA {24};
|
||||
constexpr int N_3NA {25};
|
||||
constexpr int N_NP {28};
|
||||
constexpr int N_N2A {29};
|
||||
constexpr int N_2N2A {30};
|
||||
constexpr int N_ND {32};
|
||||
constexpr int N_NT {33};
|
||||
constexpr int N_N3HE {34};
|
||||
constexpr int N_ND2A {35};
|
||||
constexpr int N_NT2A {36};
|
||||
constexpr int N_4N {37};
|
||||
constexpr int N_3NF {38};
|
||||
constexpr int N_2NP {41};
|
||||
constexpr int N_3NP {42};
|
||||
constexpr int N_N2P {44};
|
||||
constexpr int N_NPA {45};
|
||||
constexpr int N_N1 {51};
|
||||
constexpr int N_N40 {90};
|
||||
constexpr int N_NC {91};
|
||||
constexpr int N_DISAPPEAR {101};
|
||||
constexpr int N_GAMMA {102};
|
||||
constexpr int N_P {103};
|
||||
constexpr int N_D {104};
|
||||
constexpr int N_T {105};
|
||||
constexpr int N_3HE {106};
|
||||
constexpr int N_A {107};
|
||||
constexpr int N_2A {108};
|
||||
constexpr int N_3A {109};
|
||||
constexpr int N_2P {111};
|
||||
constexpr int N_PA {112};
|
||||
constexpr int N_T2A {113};
|
||||
constexpr int N_D2A {114};
|
||||
constexpr int N_PD {115};
|
||||
constexpr int N_PT {116};
|
||||
constexpr int N_DA {117};
|
||||
constexpr int N_5N {152};
|
||||
constexpr int N_6N {153};
|
||||
constexpr int N_2NT {154};
|
||||
constexpr int N_TA {155};
|
||||
constexpr int N_4NP {156};
|
||||
constexpr int N_3ND {157};
|
||||
constexpr int N_NDA {158};
|
||||
constexpr int N_2NPA {159};
|
||||
constexpr int N_7N {160};
|
||||
constexpr int N_8N {161};
|
||||
constexpr int N_5NP {162};
|
||||
constexpr int N_6NP {163};
|
||||
constexpr int N_7NP {164};
|
||||
constexpr int N_4NA {165};
|
||||
constexpr int N_5NA {166};
|
||||
constexpr int N_6NA {167};
|
||||
constexpr int N_7NA {168};
|
||||
constexpr int N_4ND {169};
|
||||
constexpr int N_5ND {170};
|
||||
constexpr int N_6ND {171};
|
||||
constexpr int N_3NT {172};
|
||||
constexpr int N_4NT {173};
|
||||
constexpr int N_5NT {174};
|
||||
constexpr int N_6NT {175};
|
||||
constexpr int N_2N3HE {176};
|
||||
constexpr int N_3N3HE {177};
|
||||
constexpr int N_4N3HE {178};
|
||||
constexpr int N_3N2P {179};
|
||||
constexpr int N_3N3A {180};
|
||||
constexpr int N_3NPA {181};
|
||||
constexpr int N_DT {182};
|
||||
constexpr int N_NPD {183};
|
||||
constexpr int N_NPT {184};
|
||||
constexpr int N_NDT {185};
|
||||
constexpr int N_NP3HE {186};
|
||||
constexpr int N_ND3HE {187};
|
||||
constexpr int N_NT3HE {188};
|
||||
constexpr int N_NTA {189};
|
||||
constexpr int N_2N2P {190};
|
||||
constexpr int N_P3HE {191};
|
||||
constexpr int N_D3HE {192};
|
||||
constexpr int N_3HEA {193};
|
||||
constexpr int N_4N2P {194};
|
||||
constexpr int N_4N2A {195};
|
||||
constexpr int N_4NPA {196};
|
||||
constexpr int N_3P {197};
|
||||
constexpr int N_N3P {198};
|
||||
constexpr int N_3N2PA {199};
|
||||
constexpr int N_5N2P {200};
|
||||
constexpr int N_XP {203};
|
||||
constexpr int N_XD {204};
|
||||
constexpr int N_XT {205};
|
||||
constexpr int N_X3HE {206};
|
||||
constexpr int N_XA {207};
|
||||
constexpr int HEATING {301};
|
||||
constexpr int DAMAGE_ENERGY {444};
|
||||
constexpr int COHERENT {502};
|
||||
constexpr int INCOHERENT {504};
|
||||
constexpr int PAIR_PROD_ELEC {515};
|
||||
constexpr int PAIR_PROD {516};
|
||||
constexpr int PAIR_PROD_NUC {517};
|
||||
constexpr int PHOTOELECTRIC {522};
|
||||
constexpr int N_P0 {600};
|
||||
constexpr int N_PC {649};
|
||||
constexpr int N_D0 {650};
|
||||
constexpr int N_DC {699};
|
||||
constexpr int N_T0 {700};
|
||||
constexpr int N_TC {749};
|
||||
constexpr int N_3HE0 {750};
|
||||
constexpr int N_3HEC {799};
|
||||
constexpr int N_A0 {800};
|
||||
constexpr int N_AC {849};
|
||||
constexpr int N_2N0 {875};
|
||||
constexpr int N_2NC {891};
|
||||
constexpr int HEATING_LOCAL {901};
|
||||
enum ReactionType {
|
||||
REACTION_NONE = 0,
|
||||
TOTAL_XS = 1,
|
||||
ELASTIC = 2,
|
||||
N_NONELASTIC = 3,
|
||||
N_LEVEL = 4,
|
||||
MISC = 5,
|
||||
N_2ND = 11,
|
||||
N_2N = 16,
|
||||
N_3N = 17,
|
||||
N_FISSION = 18,
|
||||
N_F = 19,
|
||||
N_NF = 20,
|
||||
N_2NF = 21,
|
||||
N_NA = 22,
|
||||
N_N3A = 23,
|
||||
N_2NA = 24,
|
||||
N_3NA = 25,
|
||||
N_NP = 28,
|
||||
N_N2A = 29,
|
||||
N_2N2A = 30,
|
||||
N_ND = 32,
|
||||
N_NT = 33,
|
||||
N_N3HE = 34,
|
||||
N_ND2A = 35,
|
||||
N_NT2A = 36,
|
||||
N_4N = 37,
|
||||
N_3NF = 38,
|
||||
N_2NP = 41,
|
||||
N_3NP = 42,
|
||||
N_N2P = 44,
|
||||
N_NPA = 45,
|
||||
N_N1 = 51,
|
||||
N_N40 = 90,
|
||||
N_NC = 91,
|
||||
N_DISAPPEAR = 101,
|
||||
N_GAMMA = 102,
|
||||
N_P = 103,
|
||||
N_D = 104,
|
||||
N_T = 105,
|
||||
N_3HE = 106,
|
||||
N_A = 107,
|
||||
N_2A = 108,
|
||||
N_3A = 109,
|
||||
N_2P = 111,
|
||||
N_PA = 112,
|
||||
N_T2A = 113,
|
||||
N_D2A = 114,
|
||||
N_PD = 115,
|
||||
N_PT = 116,
|
||||
N_DA = 117,
|
||||
N_5N = 152,
|
||||
N_6N = 153,
|
||||
N_2NT = 154,
|
||||
N_TA = 155,
|
||||
N_4NP = 156,
|
||||
N_3ND = 157,
|
||||
N_NDA = 158,
|
||||
N_2NPA = 159,
|
||||
N_7N = 160,
|
||||
N_8N = 161,
|
||||
N_5NP = 162,
|
||||
N_6NP = 163,
|
||||
N_7NP = 164,
|
||||
N_4NA = 165,
|
||||
N_5NA = 166,
|
||||
N_6NA = 167,
|
||||
N_7NA = 168,
|
||||
N_4ND = 169,
|
||||
N_5ND = 170,
|
||||
N_6ND = 171,
|
||||
N_3NT = 172,
|
||||
N_4NT = 173,
|
||||
N_5NT = 174,
|
||||
N_6NT = 175,
|
||||
N_2N3HE = 176,
|
||||
N_3N3HE = 177,
|
||||
N_4N3HE = 178,
|
||||
N_3N2P = 179,
|
||||
N_3N3A = 180,
|
||||
N_3NPA = 181,
|
||||
N_DT = 182,
|
||||
N_NPD = 183,
|
||||
N_NPT = 184,
|
||||
N_NDT = 185,
|
||||
N_NP3HE = 186,
|
||||
N_ND3HE = 187,
|
||||
N_NT3HE = 188,
|
||||
N_NTA = 189,
|
||||
N_2N2P = 190,
|
||||
N_P3HE = 191,
|
||||
N_D3HE = 192,
|
||||
N_3HEA = 193,
|
||||
N_4N2P = 194,
|
||||
N_4N2A = 195,
|
||||
N_4NPA = 196,
|
||||
N_3P = 197,
|
||||
N_N3P = 198,
|
||||
N_3N2PA = 199,
|
||||
N_5N2P = 200,
|
||||
N_XP = 203,
|
||||
N_XD = 204,
|
||||
N_XT = 205,
|
||||
N_X3HE = 206,
|
||||
N_XA = 207,
|
||||
HEATING = 301,
|
||||
DAMAGE_ENERGY = 444,
|
||||
COHERENT = 502,
|
||||
INCOHERENT = 504,
|
||||
PAIR_PROD_ELEC = 515,
|
||||
PAIR_PROD = 516,
|
||||
PAIR_PROD_NUC = 517,
|
||||
PHOTOELECTRIC = 522,
|
||||
N_P0 = 600,
|
||||
N_PC = 649,
|
||||
N_D0 = 650,
|
||||
N_DC = 699,
|
||||
N_T0 = 700,
|
||||
N_TC = 749,
|
||||
N_3HE0 = 750,
|
||||
N_3HEC = 799,
|
||||
N_A0 = 800,
|
||||
N_AC = 849,
|
||||
N_2N0 = 875,
|
||||
N_2NC = 891,
|
||||
HEATING_LOCAL = 901
|
||||
};
|
||||
|
||||
constexpr std::array<int, 6> DEPLETION_RX {N_GAMMA, N_P, N_A, N_2N, N_3N, N_4N};
|
||||
|
||||
// Fission neutron emission (nu) type
|
||||
constexpr int NU_NONE {0}; // No nu values (non-fissionable)
|
||||
constexpr int NU_POLYNOMIAL {1}; // Nu values given by polynomial
|
||||
constexpr int NU_TABULAR {2}; // Nu values given by tabular distribution
|
||||
|
||||
// Library types
|
||||
constexpr int LIBRARY_NEUTRON {1};
|
||||
constexpr int LIBRARY_THERMAL {2};
|
||||
constexpr int LIBRARY_PHOTON {3};
|
||||
constexpr int LIBRARY_MULTIGROUP {4};
|
||||
|
||||
// Probability table parameters
|
||||
constexpr int URR_CUM_PROB {0};
|
||||
constexpr int URR_TOTAL {1};
|
||||
constexpr int URR_ELASTIC {2};
|
||||
constexpr int URR_FISSION {3};
|
||||
constexpr int URR_N_GAMMA {4};
|
||||
constexpr int URR_HEATING {5};
|
||||
enum class URRTableParam {
|
||||
CUM_PROB,
|
||||
TOTAL,
|
||||
ELASTIC,
|
||||
FISSION,
|
||||
N_GAMMA,
|
||||
HEATING
|
||||
};
|
||||
|
||||
// Maximum number of partial fission reactions
|
||||
constexpr int PARTIAL_FISSION_MAX {4};
|
||||
|
||||
// Resonance elastic scattering methods
|
||||
// TODO: Convert to enum
|
||||
enum class ResScatMethod {
|
||||
rvs, // Relative velocity sampling
|
||||
dbrc, // Doppler broadening rejection correction
|
||||
cxs // Constant cross section
|
||||
};
|
||||
|
||||
// Electron treatments
|
||||
// TODO: Convert to enum
|
||||
constexpr int ELECTRON_LED {1}; // Local Energy Deposition
|
||||
constexpr int ELECTRON_TTB {2}; // Thick Target Bremsstrahlung
|
||||
enum class ElectronTreatment {
|
||||
LED, // Local Energy Deposition
|
||||
TTB // Thick Target Bremsstrahlung
|
||||
};
|
||||
|
||||
// ============================================================================
|
||||
// MULTIGROUP RELATED
|
||||
|
||||
// MGXS Table Types
|
||||
// TODO: Convert to enum
|
||||
constexpr int MGXS_ISOTROPIC {1}; // Isotroically weighted data
|
||||
constexpr int MGXS_ANGLE {2}; // Data by angular bins
|
||||
|
||||
// Flag to denote this was a macroscopic data object
|
||||
constexpr double MACROSCOPIC_AWR {-2.};
|
||||
|
||||
|
|
@ -306,103 +284,86 @@ constexpr double MACROSCOPIC_AWR {-2.};
|
|||
constexpr int DEFAULT_NMU {33};
|
||||
|
||||
// Mgxs::get_xs enumerated types
|
||||
// TODO: Convert to enum
|
||||
constexpr int MG_GET_XS_TOTAL {0};
|
||||
constexpr int MG_GET_XS_ABSORPTION {1};
|
||||
constexpr int MG_GET_XS_INVERSE_VELOCITY {2};
|
||||
constexpr int MG_GET_XS_DECAY_RATE {3};
|
||||
constexpr int MG_GET_XS_SCATTER {4};
|
||||
constexpr int MG_GET_XS_SCATTER_MULT {5};
|
||||
constexpr int MG_GET_XS_SCATTER_FMU_MULT {6};
|
||||
constexpr int MG_GET_XS_SCATTER_FMU {7};
|
||||
constexpr int MG_GET_XS_FISSION {8};
|
||||
constexpr int MG_GET_XS_KAPPA_FISSION {9};
|
||||
constexpr int MG_GET_XS_PROMPT_NU_FISSION {10};
|
||||
constexpr int MG_GET_XS_DELAYED_NU_FISSION {11};
|
||||
constexpr int MG_GET_XS_NU_FISSION {12};
|
||||
constexpr int MG_GET_XS_CHI_PROMPT {13};
|
||||
constexpr int MG_GET_XS_CHI_DELAYED {14};
|
||||
enum class MgxsType {
|
||||
TOTAL,
|
||||
ABSORPTION,
|
||||
INVERSE_VELOCITY,
|
||||
DECAY_RATE,
|
||||
SCATTER,
|
||||
SCATTER_MULT,
|
||||
SCATTER_FMU_MULT,
|
||||
SCATTER_FMU,
|
||||
FISSION,
|
||||
KAPPA_FISSION,
|
||||
PROMPT_NU_FISSION,
|
||||
DELAYED_NU_FISSION,
|
||||
NU_FISSION,
|
||||
CHI_PROMPT,
|
||||
CHI_DELAYED
|
||||
};
|
||||
|
||||
// ============================================================================
|
||||
// TALLY-RELATED CONSTANTS
|
||||
|
||||
// Tally result entries
|
||||
constexpr int RESULT_VALUE {0};
|
||||
constexpr int RESULT_SUM {1};
|
||||
constexpr int RESULT_SUM_SQ {2};
|
||||
enum class TallyResult {
|
||||
VALUE,
|
||||
SUM,
|
||||
SUM_SQ
|
||||
};
|
||||
|
||||
// Tally type
|
||||
// TODO: Convert to enum
|
||||
constexpr int TALLY_VOLUME {1};
|
||||
constexpr int TALLY_MESH_SURFACE {2};
|
||||
constexpr int TALLY_SURFACE {3};
|
||||
enum class TallyType {
|
||||
VOLUME,
|
||||
MESH_SURFACE,
|
||||
SURFACE
|
||||
};
|
||||
|
||||
// Tally estimator types
|
||||
// TODO: Convert to enum
|
||||
constexpr int ESTIMATOR_ANALOG {1};
|
||||
constexpr int ESTIMATOR_TRACKLENGTH {2};
|
||||
constexpr int ESTIMATOR_COLLISION {3};
|
||||
enum class TallyEstimator {
|
||||
ANALOG,
|
||||
TRACKLENGTH,
|
||||
COLLISION
|
||||
};
|
||||
|
||||
// Event types for tallies
|
||||
// TODO: Convert to enum
|
||||
constexpr int EVENT_SURFACE {-2};
|
||||
constexpr int EVENT_LATTICE {-1};
|
||||
constexpr int EVENT_KILL {0};
|
||||
constexpr int EVENT_SCATTER {1};
|
||||
constexpr int EVENT_ABSORB {2};
|
||||
enum class TallyEvent {
|
||||
SURFACE,
|
||||
LATTICE,
|
||||
KILL,
|
||||
SCATTER,
|
||||
ABSORB
|
||||
};
|
||||
|
||||
// Tally score type -- if you change these, make sure you also update the
|
||||
// _SCORES dictionary in openmc/capi/tally.py
|
||||
// TODO: Convert to enum
|
||||
constexpr int SCORE_FLUX {-1}; // flux
|
||||
constexpr int SCORE_TOTAL {-2}; // total reaction rate
|
||||
constexpr int SCORE_SCATTER {-3}; // scattering rate
|
||||
constexpr int SCORE_NU_SCATTER {-4}; // scattering production rate
|
||||
constexpr int SCORE_ABSORPTION {-5}; // absorption rate
|
||||
constexpr int SCORE_FISSION {-6}; // fission rate
|
||||
constexpr int SCORE_NU_FISSION {-7}; // neutron production rate
|
||||
constexpr int SCORE_KAPPA_FISSION {-8}; // fission energy production rate
|
||||
constexpr int SCORE_CURRENT {-9}; // current
|
||||
constexpr int SCORE_EVENTS {-10}; // number of events
|
||||
constexpr int SCORE_DELAYED_NU_FISSION {-11}; // delayed neutron production rate
|
||||
constexpr int SCORE_PROMPT_NU_FISSION {-12}; // prompt neutron production rate
|
||||
constexpr int SCORE_INVERSE_VELOCITY {-13}; // flux-weighted inverse velocity
|
||||
constexpr int SCORE_FISS_Q_PROMPT {-14}; // prompt fission Q-value
|
||||
constexpr int SCORE_FISS_Q_RECOV {-15}; // recoverable fission Q-value
|
||||
constexpr int SCORE_DECAY_RATE {-16}; // delayed neutron precursor decay rate
|
||||
|
||||
// Tally map bin finding
|
||||
constexpr int NO_BIN_FOUND {-1};
|
||||
|
||||
// Tally filter and map types
|
||||
// TODO: Refactor to remove or convert to enum
|
||||
constexpr int FILTER_UNIVERSE {1};
|
||||
constexpr int FILTER_MATERIAL {2};
|
||||
constexpr int FILTER_CELL {3};
|
||||
|
||||
// Mesh types
|
||||
constexpr int MESH_REGULAR {1};
|
||||
|
||||
// Tally surface current directions
|
||||
constexpr int OUT_LEFT {1}; // x min
|
||||
constexpr int IN_LEFT {2}; // x min
|
||||
constexpr int OUT_RIGHT {3}; // x max
|
||||
constexpr int IN_RIGHT {4}; // x max
|
||||
constexpr int OUT_BACK {5}; // y min
|
||||
constexpr int IN_BACK {6}; // y min
|
||||
constexpr int OUT_FRONT {7}; // y max
|
||||
constexpr int IN_FRONT {8}; // y max
|
||||
constexpr int OUT_BOTTOM {9}; // z min
|
||||
constexpr int IN_BOTTOM {10}; // z min
|
||||
constexpr int OUT_TOP {11}; // z max
|
||||
constexpr int IN_TOP {12}; // z max
|
||||
//
|
||||
// These are kept as a normal enum and made negative, since variables which
|
||||
// store one of these enum values usually also may be responsible for storing
|
||||
// MT numbers from the long enum above.
|
||||
enum TallyScore {
|
||||
SCORE_FLUX = -1, // flux
|
||||
SCORE_TOTAL = -2, // total reaction rate
|
||||
SCORE_SCATTER = -3, // scattering rate
|
||||
SCORE_NU_SCATTER = -4, // scattering production rate
|
||||
SCORE_ABSORPTION = -5, // absorption rate
|
||||
SCORE_FISSION = -6, // fission rate
|
||||
SCORE_NU_FISSION = -7, // neutron production rate
|
||||
SCORE_KAPPA_FISSION = -8, // fission energy production rate
|
||||
SCORE_CURRENT = -9, // current
|
||||
SCORE_EVENTS = -10, // number of events
|
||||
SCORE_DELAYED_NU_FISSION = -11, // delayed neutron production rate
|
||||
SCORE_PROMPT_NU_FISSION = -12, // prompt neutron production rate
|
||||
SCORE_INVERSE_VELOCITY = -13, // flux-weighted inverse velocity
|
||||
SCORE_FISS_Q_PROMPT = -14, // prompt fission Q-value
|
||||
SCORE_FISS_Q_RECOV = -15, // recoverable fission Q-value
|
||||
SCORE_DECAY_RATE = -16 // delayed neutron precursor decay rate
|
||||
};
|
||||
|
||||
// Global tally parameters
|
||||
constexpr int N_GLOBAL_TALLIES {4};
|
||||
constexpr int K_COLLISION {0};
|
||||
constexpr int K_ABSORPTION {1};
|
||||
constexpr int K_TRACKLENGTH {2};
|
||||
constexpr int LEAKAGE {3};
|
||||
enum class GlobalTally {
|
||||
K_COLLISION,
|
||||
K_ABSORPTION,
|
||||
K_TRACKLENGTH,
|
||||
LEAKAGE
|
||||
};
|
||||
|
||||
// Miscellaneous
|
||||
constexpr int C_NONE {-1};
|
||||
|
|
@ -413,12 +374,14 @@ enum class Interpolation {
|
|||
histogram = 1, lin_lin = 2, lin_log = 3, log_lin = 4, log_log = 5
|
||||
};
|
||||
|
||||
// Run modes
|
||||
constexpr int RUN_MODE_FIXEDSOURCE {1};
|
||||
constexpr int RUN_MODE_EIGENVALUE {2};
|
||||
constexpr int RUN_MODE_PLOTTING {3};
|
||||
constexpr int RUN_MODE_PARTICLE {4};
|
||||
constexpr int RUN_MODE_VOLUME {5};
|
||||
enum class RunMode {
|
||||
UNSET, // default value, OpenMC throws error if left to this
|
||||
FIXED_SOURCE,
|
||||
EIGENVALUE,
|
||||
PLOTTING,
|
||||
PARTICLE,
|
||||
VOLUME
|
||||
};
|
||||
|
||||
// ============================================================================
|
||||
// CMFD CONSTANTS
|
||||
|
|
|
|||
|
|
@ -25,8 +25,8 @@ class Material;
|
|||
|
||||
namespace model {
|
||||
|
||||
extern std::vector<std::unique_ptr<Material>> materials;
|
||||
extern std::unordered_map<int32_t, int32_t> material_map;
|
||||
extern std::vector<std::unique_ptr<Material>> materials;
|
||||
|
||||
} // namespace model
|
||||
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ class Mgxs {
|
|||
private:
|
||||
|
||||
xt::xtensor<double, 1> kTs; // temperature in eV (k * T)
|
||||
int scatter_format; // flag for if this is legendre, histogram, or tabular
|
||||
AngleDistributionType scatter_format; // flag for if this is legendre, histogram, or tabular
|
||||
int num_delayed_groups; // number of delayed neutron groups
|
||||
int num_groups; // number of energy groups
|
||||
std::vector<XsData> xs; // Cross section data
|
||||
|
|
@ -64,7 +64,7 @@ class Mgxs {
|
|||
//! @param in_azimuthal Azimuthal angle grid.
|
||||
void
|
||||
init(const std::string& in_name, double in_awr, const std::vector<double>& in_kTs,
|
||||
bool in_fissionable, int in_scatter_format, bool in_is_isotropic,
|
||||
bool in_fissionable, AngleDistributionType in_scatter_format, bool in_is_isotropic,
|
||||
const std::vector<double>& in_polar, const std::vector<double>& in_azimuthal);
|
||||
|
||||
//! \brief Initializes the Mgxs object metadata from the HDF5 file
|
||||
|
|
@ -141,11 +141,11 @@ class Mgxs {
|
|||
//! @param dg delayed group index; use nullptr if irrelevant.
|
||||
//! @return Requested cross section value.
|
||||
double
|
||||
get_xs(int xstype, int gin, const int* gout, const double* mu,
|
||||
get_xs(MgxsType xstype, int gin, const int* gout, const double* mu,
|
||||
const int* dg);
|
||||
|
||||
inline double
|
||||
get_xs(int xstype, int gin)
|
||||
get_xs(MgxsType xstype, int gin)
|
||||
{return get_xs(xstype, gin, nullptr, nullptr, nullptr);}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -300,7 +300,7 @@ public:
|
|||
|
||||
// What event took place
|
||||
bool fission_ {false}; //!< did particle cause implicit fission
|
||||
int event_; //!< scatter, absorption
|
||||
TallyEvent event_; //!< scatter, absorption
|
||||
int event_nuclide_; //!< index in nuclides array
|
||||
int event_mt_; //!< reaction MT
|
||||
int delayed_group_ {0}; //!< delayed group
|
||||
|
|
|
|||
|
|
@ -27,15 +27,15 @@ void sample_neutron_reaction(Particle* p);
|
|||
void sample_photon_reaction(Particle* p);
|
||||
|
||||
//! Terminates the particle and either deposits all energy locally
|
||||
//! (electron_treatment = ELECTRON_LED) or creates secondary bremsstrahlung
|
||||
//! (electron_treatment = ElectronTreatment::LED) or creates secondary bremsstrahlung
|
||||
//! photons from electron deflections with charged particles (electron_treatment
|
||||
//! = ELECTRON_TTB).
|
||||
//! = ElectronTreatment::TTB).
|
||||
void sample_electron_reaction(Particle* p);
|
||||
|
||||
//! Terminates the particle and either deposits all energy locally
|
||||
//! (electron_treatment = ELECTRON_LED) or creates secondary bremsstrahlung
|
||||
//! (electron_treatment = ElectronTreatment::LED) or creates secondary bremsstrahlung
|
||||
//! photons from electron deflections with charged particles (electron_treatment
|
||||
//! = ELECTRON_TTB). Two annihilation photons of energy MASS_ELECTRON_EV (0.511
|
||||
//! = ElectronTreatment::TTB). Two annihilation photons of energy MASS_ELECTRON_EV (0.511
|
||||
//! MeV) are created and travel in opposite directions.
|
||||
void sample_positron_reaction(Particle* p);
|
||||
|
||||
|
|
|
|||
|
|
@ -125,7 +125,7 @@ class ScattData {
|
|||
//! use nullptr if irrelevant.
|
||||
//! @return Requested cross section value.
|
||||
double
|
||||
get_xs(int xstype, int gin, const int* gout, const double* mu);
|
||||
get_xs(MgxsType xstype, int gin, const int* gout, const double* mu);
|
||||
};
|
||||
|
||||
//==============================================================================
|
||||
|
|
|
|||
|
|
@ -67,9 +67,10 @@ extern "C" int32_t n_inactive; //!< number of inactive batches
|
|||
extern "C" int32_t gen_per_batch; //!< number of generations per batch
|
||||
extern "C" int64_t n_particles; //!< number of particles per generation
|
||||
|
||||
|
||||
extern "C" int64_t max_in_flight_particles; //!< Max num. event-based particles in flight
|
||||
|
||||
extern int electron_treatment; //!< how to treat secondary electrons
|
||||
extern ElectronTreatment electron_treatment; //!< how to treat secondary electrons
|
||||
extern std::array<double, 4> energy_cutoff; //!< Energy cutoff in [eV] for each particle type
|
||||
extern int legendre_to_tabular_points; //!< number of points to convert Legendres
|
||||
extern int max_order; //!< Maximum Legendre order for multigroup data
|
||||
|
|
@ -79,10 +80,10 @@ extern ResScatMethod res_scat_method; //!< resonance upscattering method
|
|||
extern double res_scat_energy_min; //!< Min energy in [eV] for res. upscattering
|
||||
extern double res_scat_energy_max; //!< Max energy in [eV] for res. upscattering
|
||||
extern std::vector<std::string> res_scat_nuclides; //!< Nuclides using res. upscattering treatment
|
||||
extern "C" int run_mode; //!< Run mode (eigenvalue, fixed src, etc.)
|
||||
extern RunMode run_mode; //!< Run mode (eigenvalue, fixed src, etc.)
|
||||
extern std::unordered_set<int> sourcepoint_batch; //!< Batches when source should be written
|
||||
extern std::unordered_set<int> statepoint_batch; //!< Batches when state should be written
|
||||
extern int temperature_method; //!< method for choosing temperatures
|
||||
extern TemperatureMethod temperature_method; //!< method for choosing temperatures
|
||||
extern double temperature_tolerance; //!< Tolerance in [K] on choosing temperatures
|
||||
extern double temperature_default; //!< Default T in [K]
|
||||
extern std::array<double, 2> temperature_range; //!< Min/max T in [K] over which to load xs
|
||||
|
|
|
|||
|
|
@ -17,17 +17,6 @@
|
|||
|
||||
namespace openmc {
|
||||
|
||||
//==============================================================================
|
||||
// Module constant declarations (defined in .cpp)
|
||||
//==============================================================================
|
||||
|
||||
// TODO: Convert to enum
|
||||
extern "C" const int BC_TRANSMIT;
|
||||
extern "C" const int BC_VACUUM;
|
||||
extern "C" const int BC_REFLECT;
|
||||
extern "C" const int BC_PERIODIC;
|
||||
extern "C" const int BC_WHITE;
|
||||
|
||||
//==============================================================================
|
||||
// Global variables
|
||||
//==============================================================================
|
||||
|
|
@ -94,8 +83,18 @@ struct BoundingBox
|
|||
class Surface
|
||||
{
|
||||
public:
|
||||
|
||||
// Types of available boundary conditions on a surface
|
||||
enum class BoundaryType {
|
||||
TRANSMIT,
|
||||
VACUUM,
|
||||
REFLECT,
|
||||
PERIODIC,
|
||||
WHITE
|
||||
};
|
||||
|
||||
int id_; //!< Unique ID
|
||||
int bc_; //!< Boundary condition
|
||||
BoundaryType bc_; //!< Boundary condition
|
||||
std::string name_; //!< User-defined name
|
||||
|
||||
explicit Surface(pugi::xml_node surf_node);
|
||||
|
|
|
|||
|
|
@ -14,9 +14,17 @@
|
|||
|
||||
namespace openmc {
|
||||
|
||||
// Different independent variables
|
||||
enum class DerivativeVariable {
|
||||
DENSITY,
|
||||
NUCLIDE_DENSITY,
|
||||
TEMPERATURE
|
||||
};
|
||||
|
||||
struct TallyDerivative {
|
||||
|
||||
DerivativeVariable variable; //!< Independent variable (like temperature)
|
||||
int id; //!< User-defined identifier
|
||||
int variable; //!< Independent variable (like temperature)
|
||||
int diff_material; //!< Material this derivative is applied to
|
||||
int diff_nuclide; //!< Nuclide this material is applied to
|
||||
|
||||
|
|
@ -66,12 +74,6 @@ extern std::vector<TallyDerivative> tally_derivs;
|
|||
extern std::unordered_map<int, int> tally_deriv_map;
|
||||
} // namespace model
|
||||
|
||||
// Independent variables
|
||||
//TODO: convert to enum
|
||||
constexpr int DIFF_DENSITY {1};
|
||||
constexpr int DIFF_NUCLIDE_DENSITY {2};
|
||||
constexpr int DIFF_TEMPERATURE {3};
|
||||
|
||||
} // namespace openmc
|
||||
|
||||
#endif // OPENMC_TALLIES_DERIVATIVE_H
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ public:
|
|||
//! \param[out] match will contain the matching bins and corresponding
|
||||
//! weights; note that there may be zero matching bins
|
||||
virtual void
|
||||
get_all_bins(const Particle* p, int estimator, FilterMatch& match) const = 0;
|
||||
get_all_bins(const Particle* p, TallyEstimator estimator, FilterMatch& match) const = 0;
|
||||
|
||||
//! Writes data describing this filter to an HDF5 statepoint group.
|
||||
virtual void
|
||||
|
|
@ -108,8 +108,8 @@ private:
|
|||
|
||||
namespace model {
|
||||
extern "C" int32_t n_filters;
|
||||
extern std::vector<std::unique_ptr<Filter>> tally_filters;
|
||||
extern std::unordered_map<int, int> filter_map;
|
||||
extern std::vector<std::unique_ptr<Filter>> tally_filters;
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ public:
|
|||
|
||||
void from_xml(pugi::xml_node node) override;
|
||||
|
||||
void get_all_bins(const Particle* p, int estimator, FilterMatch& match)
|
||||
void get_all_bins(const Particle* p, TallyEstimator estimator, FilterMatch& match)
|
||||
const override;
|
||||
|
||||
void to_statepoint(hid_t filter_group) const override;
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ public:
|
|||
|
||||
void from_xml(pugi::xml_node node) override;
|
||||
|
||||
void get_all_bins(const Particle* p, int estimator, FilterMatch& match)
|
||||
void get_all_bins(const Particle* p, TallyEstimator estimator, FilterMatch& match)
|
||||
const override;
|
||||
|
||||
void to_statepoint(hid_t filter_group) const override;
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ public:
|
|||
|
||||
void from_xml(pugi::xml_node node) override;
|
||||
|
||||
void get_all_bins(const Particle* p, int estimator, FilterMatch& match)
|
||||
void get_all_bins(const Particle* p, TallyEstimator estimator, FilterMatch& match)
|
||||
const override;
|
||||
|
||||
void to_statepoint(hid_t filter_group) const override;
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ public:
|
|||
|
||||
std::string type() const override {return "cellborn";}
|
||||
|
||||
void get_all_bins(const Particle* p, int estimator, FilterMatch& match)
|
||||
void get_all_bins(const Particle* p, TallyEstimator estimator, FilterMatch& match)
|
||||
const override;
|
||||
|
||||
std::string text_label(int bin) const override;
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ public:
|
|||
|
||||
std::string type() const override {return "cellfrom";}
|
||||
|
||||
void get_all_bins(const Particle* p, int estimator, FilterMatch& match)
|
||||
void get_all_bins(const Particle* p, TallyEstimator estimator, FilterMatch& match)
|
||||
const override;
|
||||
|
||||
std::string text_label(int bin) const override;
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ public:
|
|||
|
||||
void from_xml(pugi::xml_node node) override;
|
||||
|
||||
void get_all_bins(const Particle* p, int estimator, FilterMatch& match)
|
||||
void get_all_bins(const Particle* p, TallyEstimator estimator, FilterMatch& match)
|
||||
const override;
|
||||
|
||||
void to_statepoint(hid_t filter_group) const override;
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ public:
|
|||
|
||||
void from_xml(pugi::xml_node node) override;
|
||||
|
||||
void get_all_bins(const Particle* p, int estimator, FilterMatch& match)
|
||||
void get_all_bins(const Particle* p, TallyEstimator estimator, FilterMatch& match)
|
||||
const override;
|
||||
|
||||
void to_statepoint(hid_t filter_group) const override;
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ public:
|
|||
|
||||
void from_xml(pugi::xml_node node) override;
|
||||
|
||||
void get_all_bins(const Particle* p, int estimator, FilterMatch& match)
|
||||
void get_all_bins(const Particle* p, TallyEstimator estimator, FilterMatch& match)
|
||||
const override;
|
||||
|
||||
void to_statepoint(hid_t filter_group) const override;
|
||||
|
|
@ -68,7 +68,7 @@ public:
|
|||
|
||||
std::string type() const override {return "energyout";}
|
||||
|
||||
void get_all_bins(const Particle* p, int estimator, FilterMatch& match)
|
||||
void get_all_bins(const Particle* p, TallyEstimator estimator, FilterMatch& match)
|
||||
const override;
|
||||
|
||||
std::string text_label(int bin) const override;
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ public:
|
|||
|
||||
void from_xml(pugi::xml_node node) override;
|
||||
|
||||
void get_all_bins(const Particle* p, int estimator, FilterMatch& match)
|
||||
void get_all_bins(const Particle* p, TallyEstimator estimator, FilterMatch& match)
|
||||
const override;
|
||||
|
||||
void to_statepoint(hid_t filter_group) const override;
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ public:
|
|||
|
||||
void from_xml(pugi::xml_node node) override;
|
||||
|
||||
void get_all_bins(const Particle* p, int estimator, FilterMatch& match)
|
||||
void get_all_bins(const Particle* p, TallyEstimator estimator, FilterMatch& match)
|
||||
const override;
|
||||
|
||||
void to_statepoint(hid_t filter_group) const override;
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ public:
|
|||
|
||||
void from_xml(pugi::xml_node node) override;
|
||||
|
||||
void get_all_bins(const Particle* p, int estimator, FilterMatch& match)
|
||||
void get_all_bins(const Particle* p, TallyEstimator estimator, FilterMatch& match)
|
||||
const override;
|
||||
|
||||
void to_statepoint(hid_t filter_group) const override;
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ public:
|
|||
|
||||
void from_xml(pugi::xml_node node) override;
|
||||
|
||||
void get_all_bins(const Particle* p, int estimator, FilterMatch& match)
|
||||
void get_all_bins(const Particle* p, TallyEstimator estimator, FilterMatch& match)
|
||||
const override;
|
||||
|
||||
void to_statepoint(hid_t filter_group) const override;
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ public:
|
|||
|
||||
std::string type() const override {return "meshsurface";}
|
||||
|
||||
void get_all_bins(const Particle* p, int estimator, FilterMatch& match)
|
||||
void get_all_bins(const Particle* p, TallyEstimator estimator, FilterMatch& match)
|
||||
const override;
|
||||
|
||||
std::string text_label(int bin) const override;
|
||||
|
|
@ -22,6 +22,21 @@ public:
|
|||
// Accessors
|
||||
|
||||
void set_mesh(int32_t mesh) override;
|
||||
|
||||
enum class MeshDir {
|
||||
OUT_LEFT, // x min
|
||||
IN_LEFT, // x min
|
||||
OUT_RIGHT, // x max
|
||||
IN_RIGHT, // x max
|
||||
OUT_BACK, // y min
|
||||
IN_BACK, // y min
|
||||
OUT_FRONT, // y max
|
||||
IN_FRONT, // y max
|
||||
OUT_BOTTOM, // z min
|
||||
IN_BOTTOM, // z min
|
||||
OUT_TOP, // z max
|
||||
IN_TOP // z max
|
||||
};
|
||||
};
|
||||
|
||||
} // namespace openmc
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ public:
|
|||
|
||||
void from_xml(pugi::xml_node node) override;
|
||||
|
||||
void get_all_bins(const Particle* p, int estimator, FilterMatch& match)
|
||||
void get_all_bins(const Particle* p, TallyEstimator estimator, FilterMatch& match)
|
||||
const override;
|
||||
|
||||
void to_statepoint(hid_t filter_group) const override;
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ public:
|
|||
|
||||
void from_xml(pugi::xml_node node) override;
|
||||
|
||||
void get_all_bins(const Particle* p, int estimator, FilterMatch& match)
|
||||
void get_all_bins(const Particle* p, TallyEstimator estimator, FilterMatch& match)
|
||||
const override;
|
||||
|
||||
void to_statepoint(hid_t filter_group) const override;
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ public:
|
|||
|
||||
void from_xml(pugi::xml_node node) override;
|
||||
|
||||
void get_all_bins(const Particle* p, int estimator, FilterMatch& match)
|
||||
void get_all_bins(const Particle* p, TallyEstimator estimator, FilterMatch& match)
|
||||
const override;
|
||||
|
||||
void to_statepoint(hid_t filter_group) const override;
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ public:
|
|||
|
||||
void from_xml(pugi::xml_node node) override;
|
||||
|
||||
void get_all_bins(const Particle* p, int estimator, FilterMatch& match)
|
||||
void get_all_bins(const Particle* p, TallyEstimator estimator, FilterMatch& match)
|
||||
const override;
|
||||
|
||||
void to_statepoint(hid_t filter_group) const override;
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ public:
|
|||
|
||||
void from_xml(pugi::xml_node node) override;
|
||||
|
||||
void get_all_bins(const Particle* p, int estimator, FilterMatch& match)
|
||||
void get_all_bins(const Particle* p, TallyEstimator estimator, FilterMatch& match)
|
||||
const override;
|
||||
|
||||
void to_statepoint(hid_t filter_group) const override;
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ public:
|
|||
|
||||
void from_xml(pugi::xml_node node) override;
|
||||
|
||||
void get_all_bins(const Particle* p, int estimator, FilterMatch& match)
|
||||
void get_all_bins(const Particle* p, TallyEstimator estimator, FilterMatch& match)
|
||||
const override;
|
||||
|
||||
void to_statepoint(hid_t filter_group) const override;
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ public:
|
|||
|
||||
void from_xml(pugi::xml_node node) override;
|
||||
|
||||
void get_all_bins(const Particle* p, int estimator, FilterMatch& match)
|
||||
void get_all_bins(const Particle* p, TallyEstimator estimator, FilterMatch& match)
|
||||
const override;
|
||||
|
||||
void to_statepoint(hid_t filter_group) const override;
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ public:
|
|||
|
||||
void from_xml(pugi::xml_node node) override;
|
||||
|
||||
void get_all_bins(const Particle* p, int estimator, FilterMatch& match)
|
||||
void get_all_bins(const Particle* p, TallyEstimator estimator, FilterMatch& match)
|
||||
const override;
|
||||
|
||||
void to_statepoint(hid_t filter_group) const override;
|
||||
|
|
@ -76,7 +76,7 @@ public:
|
|||
|
||||
std::string type() const override {return "zernikeradial";}
|
||||
|
||||
void get_all_bins(const Particle* p, int estimator, FilterMatch& match)
|
||||
void get_all_bins(const Particle* p, TallyEstimator estimator, FilterMatch& match)
|
||||
const override;
|
||||
|
||||
std::string text_label(int bin) const override;
|
||||
|
|
|
|||
|
|
@ -79,10 +79,10 @@ public:
|
|||
|
||||
std::string name_; //!< User-defined name
|
||||
|
||||
int type_ {TALLY_VOLUME}; //!< e.g. volume, surface current
|
||||
TallyType type_ {TallyType::VOLUME}; //!< e.g. volume, surface current
|
||||
|
||||
//! Event type that contributes to this tally
|
||||
int estimator_ {ESTIMATOR_TRACKLENGTH};
|
||||
TallyEstimator estimator_ {TallyEstimator::TRACKLENGTH};
|
||||
|
||||
//! Whether this tally is currently being updated
|
||||
bool active_ {false};
|
||||
|
|
@ -98,10 +98,10 @@ public:
|
|||
//! True if this tally has a bin for every nuclide in the problem
|
||||
bool all_nuclides_ {false};
|
||||
|
||||
//! Results for each bin -- the first dimension of the array is for scores
|
||||
//! (e.g. flux, total reaction rate, fission reaction rate, etc.) and the
|
||||
//! second dimension of the array is for the combination of filters
|
||||
//! (e.g. specific cell, specific energy group, etc.)
|
||||
//! Results for each bin -- the first dimension of the array is for the
|
||||
//! combination of filters (e.g. specific cell, specific energy group, etc.)
|
||||
//! and the second dimension of the array is for scores (e.g. flux, total
|
||||
//! reaction rate, fission reaction rate, etc.)
|
||||
xt::xtensor<double, 3> results_;
|
||||
|
||||
//! True if this tally should be written to statepoint files
|
||||
|
|
@ -141,6 +141,7 @@ private:
|
|||
//==============================================================================
|
||||
|
||||
namespace model {
|
||||
extern std::unordered_map<int, int> tally_map;
|
||||
extern std::vector<std::unique_ptr<Tally>> tallies;
|
||||
extern std::vector<int> active_tallies;
|
||||
extern std::vector<int> active_analog_tallies;
|
||||
|
|
@ -148,8 +149,6 @@ namespace model {
|
|||
extern std::vector<int> active_collision_tallies;
|
||||
extern std::vector<int> active_meshsurf_tallies;
|
||||
extern std::vector<int> active_surface_tallies;
|
||||
|
||||
extern std::unordered_map<int, int> tally_map;
|
||||
}
|
||||
|
||||
namespace simulation {
|
||||
|
|
|
|||
|
|
@ -16,21 +16,6 @@
|
|||
|
||||
namespace openmc {
|
||||
|
||||
//==============================================================================
|
||||
// Constants
|
||||
//==============================================================================
|
||||
|
||||
// Secondary energy mode for S(a,b) inelastic scattering
|
||||
// TODO: Convert to enum
|
||||
constexpr int SAB_SECONDARY_EQUAL {0}; // Equally-likely outgoing energy bins
|
||||
constexpr int SAB_SECONDARY_SKEWED {1}; // Skewed outgoing energy bins
|
||||
constexpr int SAB_SECONDARY_CONT {2}; // Continuous, linear-linear interpolation
|
||||
|
||||
// Elastic mode for S(a,b) elastic scattering
|
||||
// TODO: Convert to enum
|
||||
constexpr int SAB_ELASTIC_INCOHERENT {3}; // Incoherent elastic scattering
|
||||
constexpr int SAB_ELASTIC_COHERENT {4}; // Coherent elastic scattering (Bragg edges)
|
||||
|
||||
//==============================================================================
|
||||
// Global variables
|
||||
//==============================================================================
|
||||
|
|
|
|||
|
|
@ -46,8 +46,15 @@ public:
|
|||
//! \param[in] results Vector of results for each domain
|
||||
void to_hdf5(const std::string& filename, const std::vector<Result>& results) const;
|
||||
|
||||
// Tally filter and map types
|
||||
enum class TallyDomain {
|
||||
UNIVERSE,
|
||||
MATERIAL,
|
||||
CELL
|
||||
};
|
||||
|
||||
// Data members
|
||||
int domain_type_; //!< Type of domain (cell, material, etc.)
|
||||
TallyDomain domain_type_; //!< Type of domain (cell, material, etc.)
|
||||
size_t n_samples_; //!< Number of samples to use
|
||||
double threshold_ {-1.0}; //!< Error threshold for domain volumes
|
||||
TriggerMetric trigger_type_ {TriggerMetric::not_active}; //!< Trigger metric for the volume calculation
|
||||
|
|
|
|||
|
|
@ -15,6 +15,15 @@
|
|||
|
||||
namespace openmc {
|
||||
|
||||
// Angular distribution type
|
||||
enum class AngleDistributionType {
|
||||
ISOTROPIC,
|
||||
EQUI_32,
|
||||
TABULAR,
|
||||
LEGENDRE,
|
||||
HISTOGRAM
|
||||
};
|
||||
|
||||
//==============================================================================
|
||||
// XSDATA contains the temperature-independent cross section data for an MGXS
|
||||
//==============================================================================
|
||||
|
|
@ -25,8 +34,8 @@ class XsData {
|
|||
|
||||
//! \brief Reads scattering data from the HDF5 file
|
||||
void
|
||||
scatter_from_hdf5(hid_t xsdata_grp, size_t n_ang,
|
||||
int scatter_format, int final_scatter_format, int order_data);
|
||||
scatter_from_hdf5(hid_t xsdata_grp, size_t n_ang, AngleDistributionType scatter_format,
|
||||
AngleDistributionType final_scatter_format, int order_data);
|
||||
|
||||
//! \brief Reads fission data from the HDF5 file
|
||||
void
|
||||
|
|
@ -104,8 +113,8 @@ class XsData {
|
|||
//! @param n_azi Number of azimuthal angles.
|
||||
//! @param n_groups Number of energy groups.
|
||||
//! @param n_d_groups Number of delayed neutron groups.
|
||||
XsData(bool fissionable, int scatter_format, int n_pol, int n_azi,
|
||||
size_t n_groups, size_t n_d_groups);
|
||||
XsData(bool fissionable, AngleDistributionType scatter_format, int n_pol,
|
||||
int n_azi, size_t n_groups, size_t n_d_groups);
|
||||
|
||||
//! \brief Loads the XsData object from the HDF5 file
|
||||
//!
|
||||
|
|
@ -121,8 +130,8 @@ class XsData {
|
|||
//! @param n_pol Number of polar angles.
|
||||
//! @param n_azi Number of azimuthal angles.
|
||||
void
|
||||
from_hdf5(hid_t xsdata_grp, bool fissionable, int scatter_format,
|
||||
int final_scatter_format, int order_data, bool is_isotropic, int n_pol,
|
||||
from_hdf5(hid_t xsdata_grp, bool fissionable, AngleDistributionType scatter_format,
|
||||
AngleDistributionType final_scatter_format, int order_data, bool is_isotropic, int n_pol,
|
||||
int n_azi);
|
||||
|
||||
//! \brief Combines the microscopic data to a macroscopic object.
|
||||
|
|
|
|||
|
|
@ -132,8 +132,7 @@ class Cell(_FortranObjectWithID):
|
|||
indices = POINTER(c_int32)()
|
||||
n = c_int32()
|
||||
_dll.openmc_cell_get_fill(self._index, fill_type, indices, n)
|
||||
|
||||
if fill_type.value == 1:
|
||||
if fill_type.value == 0:
|
||||
if n.value > 1:
|
||||
return [Material(index=i) for i in indices[:n.value]]
|
||||
else:
|
||||
|
|
@ -148,13 +147,13 @@ class Cell(_FortranObjectWithID):
|
|||
n = len(fill)
|
||||
indices = (c_int32*n)(*(m._index if m is not None else -1
|
||||
for m in fill))
|
||||
_dll.openmc_cell_set_fill(self._index, 1, n, indices)
|
||||
_dll.openmc_cell_set_fill(self._index, 0, n, indices)
|
||||
elif isinstance(fill, Material):
|
||||
indices = (c_int32*1)(fill._index)
|
||||
_dll.openmc_cell_set_fill(self._index, 1, 1, indices)
|
||||
_dll.openmc_cell_set_fill(self._index, 0, 1, indices)
|
||||
elif fill is None:
|
||||
indices = (c_int32*1)(-1)
|
||||
_dll.openmc_cell_set_fill(self._index, 1, 1, indices)
|
||||
_dll.openmc_cell_set_fill(self._index, 0, 1, indices)
|
||||
|
||||
def get_temperature(self, instance=None):
|
||||
"""Get the temperature of a cell
|
||||
|
|
|
|||
|
|
@ -98,10 +98,10 @@ _SCORES = {
|
|||
-15: 'fission-q-recoverable', -16: 'decay-rate'
|
||||
}
|
||||
_ESTIMATORS = {
|
||||
1: 'analog', 2: 'tracklength', 3: 'collision'
|
||||
0: 'analog', 1: 'tracklength', 2: 'collision'
|
||||
}
|
||||
_TALLY_TYPES = {
|
||||
1: 'volume', 2: 'mesh-surface', 3: 'surface'
|
||||
0: 'volume', 1: 'mesh-surface', 2: 'surface'
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
23
src/cell.cpp
23
src/cell.cpp
|
|
@ -247,7 +247,7 @@ Cell::temperature(int32_t instance) const
|
|||
void
|
||||
Cell::set_temperature(double T, int32_t instance)
|
||||
{
|
||||
if (settings::temperature_method == TEMPERATURE_INTERPOLATION) {
|
||||
if (settings::temperature_method == TemperatureMethod::INTERPOLATION) {
|
||||
if (T < data::temperature_min) {
|
||||
throw std::runtime_error{"Temperature is below minimum temperature at "
|
||||
"which data is available."};
|
||||
|
|
@ -565,7 +565,7 @@ CSGCell::to_hdf5(hid_t cell_group) const
|
|||
}
|
||||
|
||||
// Write fill information.
|
||||
if (type_ == FILL_MATERIAL) {
|
||||
if (type_ == Fill::MATERIAL) {
|
||||
write_dataset(group, "fill_type", "material");
|
||||
std::vector<int32_t> mat_ids;
|
||||
for (auto i_mat : material_) {
|
||||
|
|
@ -586,7 +586,7 @@ CSGCell::to_hdf5(hid_t cell_group) const
|
|||
temps.push_back(sqrtkT_val * sqrtkT_val / K_BOLTZMANN);
|
||||
write_dataset(group, "temperature", temps);
|
||||
|
||||
} else if (type_ == FILL_UNIVERSE) {
|
||||
} else if (type_ == Fill::UNIVERSE) {
|
||||
write_dataset(group, "fill_type", "universe");
|
||||
write_dataset(group, "fill", model::universes[fill_]->id_);
|
||||
if (translation_ != Position(0, 0, 0)) {
|
||||
|
|
@ -601,7 +601,7 @@ CSGCell::to_hdf5(hid_t cell_group) const
|
|||
}
|
||||
}
|
||||
|
||||
} else if (type_ == FILL_LATTICE) {
|
||||
} else if (type_ == Fill::LATTICE) {
|
||||
write_dataset(group, "fill_type", "lattice");
|
||||
write_dataset(group, "lattice", model::lattices[fill_]->id_);
|
||||
}
|
||||
|
|
@ -1047,8 +1047,8 @@ openmc_cell_get_fill(int32_t index, int* type, int32_t** indices, int32_t* n)
|
|||
{
|
||||
if (index >= 0 && index < model::cells.size()) {
|
||||
Cell& c {*model::cells[index]};
|
||||
*type = c.type_;
|
||||
if (c.type_ == FILL_MATERIAL) {
|
||||
*type = static_cast<int>(c.type_);
|
||||
if (c.type_ == Fill::MATERIAL) {
|
||||
*indices = c.material_.data();
|
||||
*n = c.material_.size();
|
||||
} else {
|
||||
|
|
@ -1066,10 +1066,11 @@ extern "C" int
|
|||
openmc_cell_set_fill(int32_t index, int type, int32_t n,
|
||||
const int32_t* indices)
|
||||
{
|
||||
Fill filltype = static_cast<Fill>(type);
|
||||
if (index >= 0 && index < model::cells.size()) {
|
||||
Cell& c {*model::cells[index]};
|
||||
if (type == FILL_MATERIAL) {
|
||||
c.type_ = FILL_MATERIAL;
|
||||
if (filltype == Fill::MATERIAL) {
|
||||
c.type_ = Fill::MATERIAL;
|
||||
c.material_.clear();
|
||||
for (int i = 0; i < n; i++) {
|
||||
int i_mat = indices[i];
|
||||
|
|
@ -1083,10 +1084,10 @@ openmc_cell_set_fill(int32_t index, int type, int32_t n,
|
|||
}
|
||||
}
|
||||
c.material_.shrink_to_fit();
|
||||
} else if (type == FILL_UNIVERSE) {
|
||||
c.type_ = FILL_UNIVERSE;
|
||||
} else if (filltype == Fill::UNIVERSE) {
|
||||
c.type_ = Fill::UNIVERSE;
|
||||
} else {
|
||||
c.type_ = FILL_LATTICE;
|
||||
c.type_ = Fill::LATTICE;
|
||||
}
|
||||
} else {
|
||||
set_errmsg("Index in cells array is out of bounds.");
|
||||
|
|
|
|||
|
|
@ -324,7 +324,7 @@ read_ce_cross_sections(const std::vector<std::vector<double>>& nuc_temps,
|
|||
simulation::log_spacing = std::log(data::energy_max[neutron] /
|
||||
data::energy_min[neutron]) / settings::n_log_bins;
|
||||
|
||||
if (settings::photon_transport && settings::electron_treatment == ELECTRON_TTB) {
|
||||
if (settings::photon_transport && settings::electron_treatment == ElectronTreatment::TTB) {
|
||||
// Determine if minimum/maximum energy for bremsstrahlung is greater/less
|
||||
// than the current minimum/maximum
|
||||
if (data::ttb_e_grid.size() >= 1) {
|
||||
|
|
|
|||
|
|
@ -340,22 +340,22 @@ void load_dagmc_geometry()
|
|||
to_lower(bc_value);
|
||||
|
||||
if (bc_value == "transmit" || bc_value == "transmission") {
|
||||
s->bc_ = BC_TRANSMIT;
|
||||
s->bc_ = Surface::BoundaryType::TRANSMIT;
|
||||
} else if (bc_value == "vacuum") {
|
||||
s->bc_ = BC_VACUUM;
|
||||
s->bc_ = Surface::BoundaryType::VACUUM;
|
||||
} else if (bc_value == "reflective" || bc_value == "reflect" || bc_value == "reflecting") {
|
||||
s->bc_ = BC_REFLECT;
|
||||
s->bc_ = Surface::BoundaryType::REFLECT;
|
||||
} else if (bc_value == "periodic") {
|
||||
fatal_error("Periodic boundary condition not supported in DAGMC.");
|
||||
} else {
|
||||
std::stringstream err_msg;
|
||||
err_msg << "Unknown boundary condition \"" << s->bc_
|
||||
err_msg << "Unknown boundary condition \"" << bc_value
|
||||
<< "\" specified on surface " << s->id_;
|
||||
fatal_error(err_msg);
|
||||
}
|
||||
} else {
|
||||
// if no condition is found, set to transmit
|
||||
s->bc_ = BC_TRANSMIT;
|
||||
s->bc_ = Surface::BoundaryType::TRANSMIT;
|
||||
}
|
||||
|
||||
// graveyard check
|
||||
|
|
@ -366,7 +366,7 @@ void load_dagmc_geometry()
|
|||
// if this surface belongs to the graveyard
|
||||
if (graveyard && parent_vols.find(graveyard) != parent_vols.end()) {
|
||||
// set BC to vacuum
|
||||
s->bc_ = BC_VACUUM;
|
||||
s->bc_ = Surface::BoundaryType::VACUUM;
|
||||
}
|
||||
|
||||
// add to global array and map
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ void calculate_generation_keff()
|
|||
const auto& gt = simulation::global_tallies;
|
||||
|
||||
// Get keff for this generation by subtracting off the starting value
|
||||
simulation::keff_generation = gt(K_TRACKLENGTH, RESULT_VALUE) - simulation::keff_generation;
|
||||
simulation::keff_generation = gt(GlobalTally::K_TRACKLENGTH, TallyResult::VALUE) - simulation::keff_generation;
|
||||
|
||||
double keff_reduced;
|
||||
#ifdef OPENMC_MPI
|
||||
|
|
@ -373,12 +373,12 @@ int openmc_get_keff(double* k_combined)
|
|||
|
||||
std::array<double, 3> kv {};
|
||||
xt::xtensor<double, 2> cov = xt::zeros<double>({3, 3});
|
||||
kv[0] = gt(K_COLLISION, RESULT_SUM) / n;
|
||||
kv[1] = gt(K_ABSORPTION, RESULT_SUM) / n;
|
||||
kv[2] = gt(K_TRACKLENGTH, RESULT_SUM) / n;
|
||||
cov(0, 0) = (gt(K_COLLISION, RESULT_SUM_SQ) - n*kv[0]*kv[0]) / (n - 1);
|
||||
cov(1, 1) = (gt(K_ABSORPTION, RESULT_SUM_SQ) - n*kv[1]*kv[1]) / (n - 1);
|
||||
cov(2, 2) = (gt(K_TRACKLENGTH, RESULT_SUM_SQ) - n*kv[2]*kv[2]) / (n - 1);
|
||||
kv[0] = gt(GlobalTally::K_COLLISION, TallyResult::SUM) / n;
|
||||
kv[1] = gt(GlobalTally::K_ABSORPTION, TallyResult::SUM) / n;
|
||||
kv[2] = gt(GlobalTally::K_TRACKLENGTH, TallyResult::SUM) / n;
|
||||
cov(0, 0) = (gt(GlobalTally::K_COLLISION, TallyResult::SUM_SQ) - n*kv[0]*kv[0]) / (n - 1);
|
||||
cov(1, 1) = (gt(GlobalTally::K_ABSORPTION, TallyResult::SUM_SQ) - n*kv[1]*kv[1]) / (n - 1);
|
||||
cov(2, 2) = (gt(GlobalTally::K_TRACKLENGTH, TallyResult::SUM_SQ) - n*kv[2]*kv[2]) / (n - 1);
|
||||
|
||||
// Calculate covariances based on sums with Bessel's correction
|
||||
cov(0, 1) = (simulation::k_col_abs - n * kv[0] * kv[1]) / (n - 1);
|
||||
|
|
|
|||
|
|
@ -73,8 +73,8 @@ int openmc_finalize()
|
|||
settings::check_overlaps = false;
|
||||
settings::confidence_intervals = false;
|
||||
settings::create_fission_neutrons = true;
|
||||
settings::electron_treatment = ElectronTreatment::LED;
|
||||
settings::delayed_photon_scaling = true;
|
||||
settings::electron_treatment = ELECTRON_LED;
|
||||
settings::energy_cutoff = {0.0, 1000.0, 0.0, 0.0};
|
||||
settings::entropy_on = false;
|
||||
settings::gen_per_batch = 1;
|
||||
|
|
@ -93,14 +93,14 @@ int openmc_finalize()
|
|||
settings::res_scat_energy_max = 1000.0;
|
||||
settings::restart_run = false;
|
||||
settings::run_CE = true;
|
||||
settings::run_mode = -1;
|
||||
settings::run_mode = RunMode::UNSET;
|
||||
settings::dagmc = false;
|
||||
settings::source_latest = false;
|
||||
settings::source_separate = false;
|
||||
settings::source_write = true;
|
||||
settings::survival_biasing = false;
|
||||
settings::temperature_default = 293.6;
|
||||
settings::temperature_method = TEMPERATURE_NEAREST;
|
||||
settings::temperature_method = TemperatureMethod::NEAREST;
|
||||
settings::temperature_multipole = false;
|
||||
settings::temperature_range = {0.0, 0.0};
|
||||
settings::temperature_tolerance = 10.0;
|
||||
|
|
|
|||
|
|
@ -127,7 +127,7 @@ find_cell_inner(Particle* p, const NeighborList* neighbor_list)
|
|||
|
||||
if (found) {
|
||||
Cell& c {*model::cells[i_cell]};
|
||||
if (c.type_ == FILL_MATERIAL) {
|
||||
if (c.type_ == Fill::MATERIAL) {
|
||||
//=======================================================================
|
||||
//! Found a material cell which means this is the lowest coord level.
|
||||
|
||||
|
|
@ -136,9 +136,9 @@ find_cell_inner(Particle* p, const NeighborList* neighbor_list)
|
|||
if (c.distribcell_index_ >= 0) {
|
||||
for (int i = 0; i < p->n_coord_; i++) {
|
||||
const auto& c_i {*model::cells[p->coord_[i].cell]};
|
||||
if (c_i.type_ == FILL_UNIVERSE) {
|
||||
if (c_i.type_ == Fill::UNIVERSE) {
|
||||
offset += c_i.offset_[c.distribcell_index_];
|
||||
} else if (c_i.type_ == FILL_LATTICE) {
|
||||
} else if (c_i.type_ == Fill::LATTICE) {
|
||||
auto& lat {*model::lattices[p->coord_[i+1].lattice]};
|
||||
int i_xyz[3] {p->coord_[i+1].lattice_x,
|
||||
p->coord_[i+1].lattice_y,
|
||||
|
|
@ -167,7 +167,7 @@ find_cell_inner(Particle* p, const NeighborList* neighbor_list)
|
|||
|
||||
return true;
|
||||
|
||||
} else if (c.type_ == FILL_UNIVERSE) {
|
||||
} else if (c.type_ == Fill::UNIVERSE) {
|
||||
//========================================================================
|
||||
//! Found a lower universe, update this coord level then search the next.
|
||||
|
||||
|
|
@ -191,7 +191,7 @@ find_cell_inner(Particle* p, const NeighborList* neighbor_list)
|
|||
++p->n_coord_;
|
||||
return find_cell_inner(p, nullptr);
|
||||
|
||||
} else if (c.type_ == FILL_LATTICE) {
|
||||
} else if (c.type_ == Fill::LATTICE) {
|
||||
//========================================================================
|
||||
//! Found a lower lattice, update this coord level then search the next.
|
||||
|
||||
|
|
|
|||
|
|
@ -88,10 +88,10 @@ adjust_indices()
|
|||
auto search_univ = model::universe_map.find(id);
|
||||
auto search_lat = model::lattice_map.find(id);
|
||||
if (search_univ != model::universe_map.end()) {
|
||||
c->type_ = FILL_UNIVERSE;
|
||||
c->type_ = Fill::UNIVERSE;
|
||||
c->fill_ = search_univ->second;
|
||||
} else if (search_lat != model::lattice_map.end()) {
|
||||
c->type_ = FILL_LATTICE;
|
||||
c->type_ = Fill::LATTICE;
|
||||
c->fill_ = search_lat->second;
|
||||
} else {
|
||||
std::stringstream err_msg;
|
||||
|
|
@ -100,7 +100,7 @@ adjust_indices()
|
|||
fatal_error(err_msg);
|
||||
}
|
||||
} else {
|
||||
c->type_ = FILL_MATERIAL;
|
||||
c->type_ = Fill::MATERIAL;
|
||||
for (auto& mat_id : c->material_) {
|
||||
if (mat_id != MATERIAL_VOID) {
|
||||
auto search = model::material_map.find(mat_id);
|
||||
|
|
@ -334,7 +334,7 @@ prepare_distribcell()
|
|||
// By default, add material cells to the list of distributed cells
|
||||
if (settings::material_cell_offsets) {
|
||||
for (gsl::index i = 0; i < model::cells.size(); ++i) {
|
||||
if (model::cells[i]->type_ == FILL_MATERIAL) distribcells.insert(i);
|
||||
if (model::cells[i]->type_ == Fill::MATERIAL) distribcells.insert(i);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -382,7 +382,7 @@ prepare_distribcell()
|
|||
// Allocate the cell and lattice offset tables.
|
||||
int n_maps = target_univ_ids.size();
|
||||
for (auto& c : model::cells) {
|
||||
if (c->type_ != FILL_MATERIAL) {
|
||||
if (c->type_ != Fill::MATERIAL) {
|
||||
c->offset_.resize(n_maps, C_NONE);
|
||||
}
|
||||
}
|
||||
|
|
@ -398,12 +398,12 @@ prepare_distribcell()
|
|||
for (int32_t cell_indx : univ->cells_) {
|
||||
Cell& c = *model::cells[cell_indx];
|
||||
|
||||
if (c.type_ == FILL_UNIVERSE) {
|
||||
if (c.type_ == Fill::UNIVERSE) {
|
||||
c.offset_[map] = offset;
|
||||
int32_t search_univ = c.fill_;
|
||||
offset += count_universe_instances(search_univ, target_univ_id);
|
||||
|
||||
} else if (c.type_ == FILL_LATTICE) {
|
||||
} else if (c.type_ == Fill::LATTICE) {
|
||||
Lattice& lat = *model::lattices[c.fill_];
|
||||
offset = lat.fill_offset_table(offset, target_univ_id, map);
|
||||
}
|
||||
|
|
@ -429,11 +429,11 @@ count_cell_instances(int32_t univ_indx)
|
|||
++c.n_instances_;
|
||||
model::universe_cell_counts[univ_indx][cell_indx] += 1;
|
||||
|
||||
if (c.type_ == FILL_UNIVERSE) {
|
||||
if (c.type_ == Fill::UNIVERSE) {
|
||||
// This cell contains another universe. Recurse into that universe.
|
||||
count_cell_instances(c.fill_);
|
||||
update_universe_cell_count(univ_indx, c.fill_);
|
||||
} else if (c.type_ == FILL_LATTICE) {
|
||||
} else if (c.type_ == Fill::LATTICE) {
|
||||
// This cell contains a lattice. Recurse into the lattice universes.
|
||||
Lattice& lat = *model::lattices[c.fill_];
|
||||
for (auto it = lat.begin(); it != lat.end(); ++it) {
|
||||
|
|
@ -459,11 +459,11 @@ count_universe_instances(int32_t search_univ, int32_t target_univ_id)
|
|||
for (int32_t cell_indx : model::universes[search_univ]->cells_) {
|
||||
Cell& c = *model::cells[cell_indx];
|
||||
|
||||
if (c.type_ == FILL_UNIVERSE) {
|
||||
if (c.type_ == Fill::UNIVERSE) {
|
||||
int32_t next_univ = c.fill_;
|
||||
count += count_universe_instances(next_univ, target_univ_id);
|
||||
|
||||
} else if (c.type_ == FILL_LATTICE) {
|
||||
} else if (c.type_ == Fill::LATTICE) {
|
||||
Lattice& lat = *model::lattices[c.fill_];
|
||||
for (auto it = lat.begin(); it != lat.end(); ++it) {
|
||||
int32_t next_univ = *it;
|
||||
|
|
@ -504,9 +504,9 @@ distribcell_path_inner(int32_t target_cell, int32_t map, int32_t target_offset,
|
|||
Cell& c = *model::cells[*cell_it];
|
||||
|
||||
// Material cells don't contain other cells so ignore them.
|
||||
if (c.type_ != FILL_MATERIAL) {
|
||||
if (c.type_ != Fill::MATERIAL) {
|
||||
int32_t temp_offset;
|
||||
if (c.type_ == FILL_UNIVERSE) {
|
||||
if (c.type_ == Fill::UNIVERSE) {
|
||||
temp_offset = offset + c.offset_[map];
|
||||
} else {
|
||||
Lattice& lat = *model::lattices[c.fill_];
|
||||
|
|
@ -524,7 +524,7 @@ distribcell_path_inner(int32_t target_cell, int32_t map, int32_t target_offset,
|
|||
Cell& c = *model::cells[*cell_it];
|
||||
path << "c" << c.id_ << "->";
|
||||
|
||||
if (c.type_ == FILL_UNIVERSE) {
|
||||
if (c.type_ == Fill::UNIVERSE) {
|
||||
// Recurse into the fill cell.
|
||||
offset += c.offset_[map];
|
||||
path << distribcell_path_inner(target_cell, map, target_offset,
|
||||
|
|
@ -571,10 +571,10 @@ maximum_levels(int32_t univ)
|
|||
|
||||
for (int32_t cell_indx : model::universes[univ]->cells_) {
|
||||
Cell& c = *model::cells[cell_indx];
|
||||
if (c.type_ == FILL_UNIVERSE) {
|
||||
if (c.type_ == Fill::UNIVERSE) {
|
||||
int32_t next_univ = c.fill_;
|
||||
levels_below = std::max(levels_below, maximum_levels(next_univ));
|
||||
} else if (c.type_ == FILL_LATTICE) {
|
||||
} else if (c.type_ == Fill::LATTICE) {
|
||||
Lattice& lat = *model::lattices[c.fill_];
|
||||
for (auto it = lat.begin(); it != lat.end(); ++it) {
|
||||
int32_t next_univ = *it;
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ int openmc_init(int argc, char* argv[], const void* intracomm)
|
|||
read_input_xml();
|
||||
|
||||
// Check for particle restart run
|
||||
if (settings::particle_restart_run) settings::run_mode = RUN_MODE_PARTICLE;
|
||||
if (settings::particle_restart_run) settings::run_mode = RunMode::PARTICLE;
|
||||
|
||||
// Stop initialization timer
|
||||
simulation::time_initialize.stop();
|
||||
|
|
@ -128,7 +128,7 @@ parse_command_line(int argc, char* argv[])
|
|||
std::string arg {argv[i]};
|
||||
if (arg[0] == '-') {
|
||||
if (arg == "-p" || arg == "--plot") {
|
||||
settings::run_mode = RUN_MODE_PLOTTING;
|
||||
settings::run_mode = RunMode::PLOTTING;
|
||||
settings::check_overlaps = true;
|
||||
|
||||
} else if (arg == "-n" || arg == "--particles") {
|
||||
|
|
@ -190,7 +190,7 @@ parse_command_line(int argc, char* argv[])
|
|||
} else if (arg == "-g" || arg == "--geometry-debug") {
|
||||
settings::check_overlaps = true;
|
||||
} else if (arg == "-c" || arg == "--volume") {
|
||||
settings::run_mode = RUN_MODE_VOLUME;
|
||||
settings::run_mode = RunMode::VOLUME;
|
||||
} else if (arg == "-s" || arg == "--threads") {
|
||||
// Read number of threads
|
||||
i += 1;
|
||||
|
|
@ -255,7 +255,7 @@ void read_input_xml()
|
|||
double_2dvec thermal_temps(data::thermal_scatt_map.size());
|
||||
finalize_geometry(nuc_temps, thermal_temps);
|
||||
|
||||
if (settings::run_mode != RUN_MODE_PLOTTING) {
|
||||
if (settings::run_mode != RunMode::PLOTTING) {
|
||||
simulation::time_read_xs.start();
|
||||
if (settings::run_CE) {
|
||||
// Read continuous-energy cross sections
|
||||
|
|
@ -274,7 +274,7 @@ void read_input_xml()
|
|||
// Initialize distribcell_filters
|
||||
prepare_distribcell();
|
||||
|
||||
if (settings::run_mode == RUN_MODE_PLOTTING) {
|
||||
if (settings::run_mode == RunMode::PLOTTING) {
|
||||
// Read plots.xml if it exists
|
||||
read_plots_xml();
|
||||
if (mpi::master && settings::verbosity >= 5) print_plot();
|
||||
|
|
|
|||
10
src/main.cpp
10
src/main.cpp
|
|
@ -29,18 +29,18 @@ int main(int argc, char* argv[]) {
|
|||
|
||||
// start problem based on mode
|
||||
switch (settings::run_mode) {
|
||||
case RUN_MODE_FIXEDSOURCE:
|
||||
case RUN_MODE_EIGENVALUE:
|
||||
case RunMode::FIXED_SOURCE:
|
||||
case RunMode::EIGENVALUE:
|
||||
err = openmc_run();
|
||||
break;
|
||||
case RUN_MODE_PLOTTING:
|
||||
case RunMode::PLOTTING:
|
||||
err = openmc_plot_geometry();
|
||||
break;
|
||||
case RUN_MODE_PARTICLE:
|
||||
case RunMode::PARTICLE:
|
||||
if (mpi::master) run_particle_restart();
|
||||
err = 0;
|
||||
break;
|
||||
case RUN_MODE_VOLUME:
|
||||
case RunMode::VOLUME:
|
||||
err = openmc_calculate_volumes();
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,8 +37,8 @@ namespace openmc {
|
|||
|
||||
namespace model {
|
||||
|
||||
std::vector<std::unique_ptr<Material>> materials;
|
||||
std::unordered_map<int32_t, int32_t> material_map;
|
||||
std::vector<std::unique_ptr<Material>> materials;
|
||||
|
||||
} // namespace model
|
||||
|
||||
|
|
@ -348,7 +348,7 @@ void Material::finalize()
|
|||
}
|
||||
|
||||
// Generate material bremsstrahlung data for electrons and positrons
|
||||
if (settings::photon_transport && settings::electron_treatment == ELECTRON_TTB) {
|
||||
if (settings::photon_transport && settings::electron_treatment == ElectronTreatment::TTB) {
|
||||
this->init_bremsstrahlung();
|
||||
}
|
||||
|
||||
|
|
|
|||
68
src/mgxs.cpp
68
src/mgxs.cpp
|
|
@ -30,8 +30,8 @@ namespace openmc {
|
|||
|
||||
void
|
||||
Mgxs::init(const std::string& in_name, double in_awr,
|
||||
const std::vector<double>& in_kTs, bool in_fissionable, int in_scatter_format,
|
||||
bool in_is_isotropic,
|
||||
const std::vector<double>& in_kTs, bool in_fissionable,
|
||||
AngleDistributionType in_scatter_format, bool in_is_isotropic,
|
||||
const std::vector<double>& in_polar, const std::vector<double>& in_azimuthal)
|
||||
{
|
||||
// Set the metadata
|
||||
|
|
@ -102,15 +102,15 @@ Mgxs::metadata_from_hdf5(hid_t xs_id, const std::vector<double>& temperature,
|
|||
|
||||
// If only one temperature is available, lets just use nearest temperature
|
||||
// interpolation
|
||||
if ((num_temps == 1) && (settings::temperature_method == TEMPERATURE_INTERPOLATION)) {
|
||||
if ((num_temps == 1) && (settings::temperature_method == TemperatureMethod::INTERPOLATION)) {
|
||||
warning("Cross sections for " + strtrim(name) + " are only available " +
|
||||
"at one temperature. Reverting to the nearest temperature " +
|
||||
"method.");
|
||||
settings::temperature_method = TEMPERATURE_NEAREST;
|
||||
settings::temperature_method = TemperatureMethod::NEAREST;
|
||||
}
|
||||
|
||||
switch(settings::temperature_method) {
|
||||
case TEMPERATURE_NEAREST:
|
||||
case TemperatureMethod::NEAREST:
|
||||
// Determine actual temperatures to read
|
||||
for (const auto& T : temperature) {
|
||||
auto i_closest = xt::argmin(xt::abs(available_temps - T))[0];
|
||||
|
|
@ -129,7 +129,7 @@ Mgxs::metadata_from_hdf5(hid_t xs_id, const std::vector<double>& temperature,
|
|||
}
|
||||
break;
|
||||
|
||||
case TEMPERATURE_INTERPOLATION:
|
||||
case TemperatureMethod::INTERPOLATION:
|
||||
for (int i = 0; i < temperature.size(); i++) {
|
||||
for (int j = 0; j < num_temps - 1; j++) {
|
||||
if ((available_temps[j] <= temperature[i]) &&
|
||||
|
|
@ -167,22 +167,22 @@ Mgxs::metadata_from_hdf5(hid_t xs_id, const std::vector<double>& temperature,
|
|||
close_group(kT_group);
|
||||
|
||||
// Load the remaining metadata
|
||||
int in_scatter_format;
|
||||
AngleDistributionType in_scatter_format;
|
||||
if (attribute_exists(xs_id, "scatter_format")) {
|
||||
std::string temp_str(MAX_WORD_LEN, ' ');
|
||||
read_attr_string(xs_id, "scatter_format", MAX_WORD_LEN, &temp_str[0]);
|
||||
to_lower(strtrim(temp_str));
|
||||
if (temp_str.compare(0, 8, "legendre") == 0) {
|
||||
in_scatter_format = ANGLE_LEGENDRE;
|
||||
in_scatter_format = AngleDistributionType::LEGENDRE;
|
||||
} else if (temp_str.compare(0, 9, "histogram") == 0) {
|
||||
in_scatter_format = ANGLE_HISTOGRAM;
|
||||
in_scatter_format = AngleDistributionType::HISTOGRAM;
|
||||
} else if (temp_str.compare(0, 7, "tabular") == 0) {
|
||||
in_scatter_format = ANGLE_TABULAR;
|
||||
in_scatter_format = AngleDistributionType::TABULAR;
|
||||
} else {
|
||||
fatal_error("Invalid scatter_format option!");
|
||||
}
|
||||
} else {
|
||||
in_scatter_format = ANGLE_LEGENDRE;
|
||||
in_scatter_format = AngleDistributionType::LEGENDRE;
|
||||
}
|
||||
|
||||
if (attribute_exists(xs_id, "scatter_shape")) {
|
||||
|
|
@ -215,7 +215,7 @@ Mgxs::metadata_from_hdf5(hid_t xs_id, const std::vector<double>& temperature,
|
|||
// However Pn has n+1 sets of points (since you need to count the P0
|
||||
// moment). Adjust for that. Histogram and Tabular formats dont need this
|
||||
// adjustment.
|
||||
if (in_scatter_format == ANGLE_LEGENDRE) {
|
||||
if (in_scatter_format == AngleDistributionType::LEGENDRE) {
|
||||
++order_dim;
|
||||
}
|
||||
|
||||
|
|
@ -281,9 +281,9 @@ Mgxs::Mgxs(hid_t xs_id, const std::vector<double>& temperature,
|
|||
metadata_from_hdf5(xs_id, temperature, temps_to_read, order_data);
|
||||
|
||||
// Set number of energy and delayed groups
|
||||
int final_scatter_format = scatter_format;
|
||||
AngleDistributionType final_scatter_format = scatter_format;
|
||||
if (settings::legendre_to_tabular) {
|
||||
if (scatter_format == ANGLE_LEGENDRE) final_scatter_format = ANGLE_TABULAR;
|
||||
if (scatter_format == AngleDistributionType::LEGENDRE) final_scatter_format = AngleDistributionType::TABULAR;
|
||||
}
|
||||
|
||||
// Load the more specific XsData information
|
||||
|
|
@ -322,7 +322,7 @@ Mgxs::Mgxs(const std::string& in_name, const std::vector<double>& mat_kTs,
|
|||
}
|
||||
// Force all of the following data to be the same; these will be verified
|
||||
// to be true later
|
||||
int in_scatter_format = micros[0]->scatter_format;
|
||||
AngleDistributionType in_scatter_format = micros[0]->scatter_format;
|
||||
bool in_is_isotropic = micros[0]->is_isotropic;
|
||||
std::vector<double> in_polar = micros[0]->polar;
|
||||
std::vector<double> in_azimuthal = micros[0]->azimuthal;
|
||||
|
|
@ -344,7 +344,7 @@ Mgxs::Mgxs(const std::string& in_name, const std::vector<double>& mat_kTs,
|
|||
std::vector<double> micro_t_interp(micros.size(), 0.);
|
||||
for (int m = 0; m < micros.size(); m++) {
|
||||
switch(settings::temperature_method) {
|
||||
case TEMPERATURE_NEAREST:
|
||||
case TemperatureMethod::NEAREST:
|
||||
{
|
||||
micro_t[m] = xt::argmin(xt::abs(micros[m]->kTs - temp_desired))[0];
|
||||
auto temp_actual = micros[m]->kTs[micro_t[m]];
|
||||
|
|
@ -357,7 +357,7 @@ Mgxs::Mgxs(const std::string& in_name, const std::vector<double>& mat_kTs,
|
|||
}
|
||||
}
|
||||
break;
|
||||
case TEMPERATURE_INTERPOLATION:
|
||||
case TemperatureMethod::INTERPOLATION:
|
||||
// Get a list of bounding temperatures for each actual temperature
|
||||
// present in the model
|
||||
for (int k = 0; k < micros[m]->kTs.shape()[0] - 1; k++) {
|
||||
|
|
@ -381,7 +381,7 @@ Mgxs::Mgxs(const std::string& in_name, const std::vector<double>& mat_kTs,
|
|||
// If we are doing nearest temperature interpolation, then we don't need
|
||||
// to do the 2nd temperature
|
||||
int num_interp_points = 2;
|
||||
if (settings::temperature_method == TEMPERATURE_NEAREST) num_interp_points = 1;
|
||||
if (settings::temperature_method == TemperatureMethod::NEAREST) num_interp_points = 1;
|
||||
for (int interp_point = 0; interp_point < num_interp_points; interp_point++) {
|
||||
std::vector<double> interp(micros.size());
|
||||
std::vector<double> temp_indices(micros.size());
|
||||
|
|
@ -416,7 +416,7 @@ Mgxs::combine(const std::vector<Mgxs*>& micros, const std::vector<double>& scala
|
|||
//==============================================================================
|
||||
|
||||
double
|
||||
Mgxs::get_xs(int xstype, int gin, const int* gout, const double* mu,
|
||||
Mgxs::get_xs(MgxsType xstype, int gin, const int* gout, const double* mu,
|
||||
const int* dg)
|
||||
{
|
||||
// This method assumes that the temperature and angle indices are set
|
||||
|
|
@ -430,31 +430,31 @@ Mgxs::get_xs(int xstype, int gin, const int* gout, const double* mu,
|
|||
#endif
|
||||
double val;
|
||||
switch(xstype) {
|
||||
case MG_GET_XS_TOTAL:
|
||||
case MgxsType::TOTAL:
|
||||
val = xs_t->total(a, gin);
|
||||
break;
|
||||
case MG_GET_XS_NU_FISSION:
|
||||
case MgxsType::NU_FISSION:
|
||||
val = fissionable ? xs_t->nu_fission(a, gin) : 0.;
|
||||
break;
|
||||
case MG_GET_XS_ABSORPTION:
|
||||
case MgxsType::ABSORPTION:
|
||||
val = xs_t->absorption(a, gin);;
|
||||
break;
|
||||
case MG_GET_XS_FISSION:
|
||||
case MgxsType::FISSION:
|
||||
val = fissionable ? xs_t->fission(a, gin) : 0.;
|
||||
break;
|
||||
case MG_GET_XS_KAPPA_FISSION:
|
||||
case MgxsType::KAPPA_FISSION:
|
||||
val = fissionable ? xs_t->kappa_fission(a, gin) : 0.;
|
||||
break;
|
||||
case MG_GET_XS_SCATTER:
|
||||
case MG_GET_XS_SCATTER_MULT:
|
||||
case MG_GET_XS_SCATTER_FMU_MULT:
|
||||
case MG_GET_XS_SCATTER_FMU:
|
||||
case MgxsType::SCATTER:
|
||||
case MgxsType::SCATTER_MULT:
|
||||
case MgxsType::SCATTER_FMU_MULT:
|
||||
case MgxsType::SCATTER_FMU:
|
||||
val = xs_t->scatter[a]->get_xs(xstype, gin, gout, mu);
|
||||
break;
|
||||
case MG_GET_XS_PROMPT_NU_FISSION:
|
||||
case MgxsType::PROMPT_NU_FISSION:
|
||||
val = fissionable ? xs_t->prompt_nu_fission(a, gin) : 0.;
|
||||
break;
|
||||
case MG_GET_XS_DELAYED_NU_FISSION:
|
||||
case MgxsType::DELAYED_NU_FISSION:
|
||||
if (fissionable) {
|
||||
if (dg != nullptr) {
|
||||
val = xs_t->delayed_nu_fission(a, *dg, gin);
|
||||
|
|
@ -468,7 +468,7 @@ Mgxs::get_xs(int xstype, int gin, const int* gout, const double* mu,
|
|||
val = 0.;
|
||||
}
|
||||
break;
|
||||
case MG_GET_XS_CHI_PROMPT:
|
||||
case MgxsType::CHI_PROMPT:
|
||||
if (fissionable) {
|
||||
if (gout != nullptr) {
|
||||
val = xs_t->chi_prompt(a, gin, *gout);
|
||||
|
|
@ -483,7 +483,7 @@ Mgxs::get_xs(int xstype, int gin, const int* gout, const double* mu,
|
|||
val = 0.;
|
||||
}
|
||||
break;
|
||||
case MG_GET_XS_CHI_DELAYED:
|
||||
case MgxsType::CHI_DELAYED:
|
||||
if (fissionable) {
|
||||
if (gout != nullptr) {
|
||||
if (dg != nullptr) {
|
||||
|
|
@ -510,10 +510,10 @@ Mgxs::get_xs(int xstype, int gin, const int* gout, const double* mu,
|
|||
val = 0.;
|
||||
}
|
||||
break;
|
||||
case MG_GET_XS_INVERSE_VELOCITY:
|
||||
case MgxsType::INVERSE_VELOCITY:
|
||||
val = xs_t->inverse_velocity(a, gin);
|
||||
break;
|
||||
case MG_GET_XS_DECAY_RATE:
|
||||
case MgxsType::DECAY_RATE:
|
||||
if (dg != nullptr) {
|
||||
val = xs_t->decay_rate(a, *dg);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -69,12 +69,12 @@ Nuclide::Nuclide(hid_t group, const std::vector<double>& temperature, int i_nucl
|
|||
std::sort(temps_available.begin(), temps_available.end());
|
||||
|
||||
// If only one temperature is available, revert to nearest temperature
|
||||
if (temps_available.size() == 1 && settings::temperature_method == TEMPERATURE_INTERPOLATION) {
|
||||
if (temps_available.size() == 1 && settings::temperature_method == TemperatureMethod::INTERPOLATION) {
|
||||
if (mpi::master) {
|
||||
warning("Cross sections for " + name_ + " are only available at one "
|
||||
"temperature. Reverting to nearest temperature method.");
|
||||
}
|
||||
settings::temperature_method = TEMPERATURE_NEAREST;
|
||||
settings::temperature_method = TemperatureMethod::NEAREST;
|
||||
}
|
||||
|
||||
// Determine actual temperatures to read -- start by checking whether a
|
||||
|
|
@ -93,7 +93,7 @@ Nuclide::Nuclide(hid_t group, const std::vector<double>& temperature, int i_nucl
|
|||
}
|
||||
|
||||
switch (settings::temperature_method) {
|
||||
case TEMPERATURE_NEAREST:
|
||||
case TemperatureMethod::NEAREST:
|
||||
// Find nearest temperatures
|
||||
for (double T_desired : temperature) {
|
||||
|
||||
|
|
@ -126,7 +126,7 @@ Nuclide::Nuclide(hid_t group, const std::vector<double>& temperature, int i_nucl
|
|||
}
|
||||
break;
|
||||
|
||||
case TEMPERATURE_INTERPOLATION:
|
||||
case TemperatureMethod::INTERPOLATION:
|
||||
// If temperature interpolation or multipole is selected, get a list of
|
||||
// bounding temperatures for each actual temperature present in the model
|
||||
for (double T_desired : temperature) {
|
||||
|
|
@ -581,7 +581,7 @@ void Nuclide::calculate_xs(int i_sab, int i_log_union, double sab_frac, Particle
|
|||
double f;
|
||||
int i_temp = -1;
|
||||
switch (settings::temperature_method) {
|
||||
case TEMPERATURE_NEAREST:
|
||||
case TemperatureMethod::NEAREST:
|
||||
{
|
||||
double max_diff = INFTY;
|
||||
for (int t = 0; t < kTs_.size(); ++t) {
|
||||
|
|
@ -594,7 +594,7 @@ void Nuclide::calculate_xs(int i_sab, int i_log_union, double sab_frac, Particle
|
|||
}
|
||||
break;
|
||||
|
||||
case TEMPERATURE_INTERPOLATION:
|
||||
case TemperatureMethod::INTERPOLATION:
|
||||
// Find temperatures that bound the actual temperature
|
||||
for (i_temp = 0; i_temp < kTs_.size() - 1; ++i_temp) {
|
||||
if (kTs_[i_temp] <= kT && kT < kTs_[i_temp + 1]) break;
|
||||
|
|
@ -784,10 +784,10 @@ void Nuclide::calculate_urr_xs(int i_temp, Particle& p) const
|
|||
p.stream_ = STREAM_TRACKING;
|
||||
|
||||
int i_low = 0;
|
||||
while (urr.prob_(i_energy, URR_CUM_PROB, i_low) <= r) {++i_low;};
|
||||
while (urr.prob_(i_energy, URRTableParam::CUM_PROB, i_low) <= r) {++i_low;};
|
||||
|
||||
int i_up = 0;
|
||||
while (urr.prob_(i_energy + 1, URR_CUM_PROB, i_up) <= r) {++i_up;};
|
||||
while (urr.prob_(i_energy + 1, URRTableParam::CUM_PROB, i_up) <= r) {++i_up;};
|
||||
|
||||
// Determine elastic, fission, and capture cross sections from the
|
||||
// probability table
|
||||
|
|
@ -800,46 +800,46 @@ void Nuclide::calculate_urr_xs(int i_temp, Particle& p) const
|
|||
f = (p.E_ - urr.energy_(i_energy)) /
|
||||
(urr.energy_(i_energy + 1) - urr.energy_(i_energy));
|
||||
|
||||
elastic = (1. - f) * urr.prob_(i_energy, URR_ELASTIC, i_low) +
|
||||
f * urr.prob_(i_energy + 1, URR_ELASTIC, i_up);
|
||||
fission = (1. - f) * urr.prob_(i_energy, URR_FISSION, i_low) +
|
||||
f * urr.prob_(i_energy + 1, URR_FISSION, i_up);
|
||||
capture = (1. - f) * urr.prob_(i_energy, URR_N_GAMMA, i_low) +
|
||||
f * urr.prob_(i_energy + 1, URR_N_GAMMA, i_up);
|
||||
elastic = (1. - f) * urr.prob_(i_energy, URRTableParam::ELASTIC, i_low) +
|
||||
f * urr.prob_(i_energy + 1, URRTableParam::ELASTIC, i_up);
|
||||
fission = (1. - f) * urr.prob_(i_energy, URRTableParam::FISSION, i_low) +
|
||||
f * urr.prob_(i_energy + 1, URRTableParam::FISSION, i_up);
|
||||
capture = (1. - f) * urr.prob_(i_energy, URRTableParam::N_GAMMA, i_low) +
|
||||
f * urr.prob_(i_energy + 1, URRTableParam::N_GAMMA, i_up);
|
||||
} else if (urr.interp_ == Interpolation::log_log) {
|
||||
// Determine interpolation factor on the table
|
||||
f = std::log(p.E_ / urr.energy_(i_energy)) /
|
||||
std::log(urr.energy_(i_energy + 1) / urr.energy_(i_energy));
|
||||
|
||||
// Calculate the elastic cross section/factor
|
||||
if ((urr.prob_(i_energy, URR_ELASTIC, i_low) > 0.) &&
|
||||
(urr.prob_(i_energy + 1, URR_ELASTIC, i_up) > 0.)) {
|
||||
if ((urr.prob_(i_energy, URRTableParam::ELASTIC, i_low) > 0.) &&
|
||||
(urr.prob_(i_energy + 1, URRTableParam::ELASTIC, i_up) > 0.)) {
|
||||
elastic =
|
||||
std::exp((1. - f) *
|
||||
std::log(urr.prob_(i_energy, URR_ELASTIC, i_low)) +
|
||||
f * std::log(urr.prob_(i_energy + 1, URR_ELASTIC, i_up)));
|
||||
std::log(urr.prob_(i_energy, URRTableParam::ELASTIC, i_low)) +
|
||||
f * std::log(urr.prob_(i_energy + 1, URRTableParam::ELASTIC, i_up)));
|
||||
} else {
|
||||
elastic = 0.;
|
||||
}
|
||||
|
||||
// Calculate the fission cross section/factor
|
||||
if ((urr.prob_(i_energy, URR_FISSION, i_low) > 0.) &&
|
||||
(urr.prob_(i_energy + 1, URR_FISSION, i_up) > 0.)) {
|
||||
if ((urr.prob_(i_energy, URRTableParam::FISSION, i_low) > 0.) &&
|
||||
(urr.prob_(i_energy + 1, URRTableParam::FISSION, i_up) > 0.)) {
|
||||
fission =
|
||||
std::exp((1. - f) *
|
||||
std::log(urr.prob_(i_energy, URR_FISSION, i_low)) +
|
||||
f * std::log(urr.prob_(i_energy + 1, URR_FISSION, i_up)));
|
||||
std::log(urr.prob_(i_energy, URRTableParam::FISSION, i_low)) +
|
||||
f * std::log(urr.prob_(i_energy + 1, URRTableParam::FISSION, i_up)));
|
||||
} else {
|
||||
fission = 0.;
|
||||
}
|
||||
|
||||
// Calculate the capture cross section/factor
|
||||
if ((urr.prob_(i_energy, URR_N_GAMMA, i_low) > 0.) &&
|
||||
(urr.prob_(i_energy + 1, URR_N_GAMMA, i_up) > 0.)) {
|
||||
if ((urr.prob_(i_energy, URRTableParam::N_GAMMA, i_low) > 0.) &&
|
||||
(urr.prob_(i_energy + 1, URRTableParam::N_GAMMA, i_up) > 0.)) {
|
||||
capture =
|
||||
std::exp((1. - f) *
|
||||
std::log(urr.prob_(i_energy, URR_N_GAMMA, i_low)) +
|
||||
f * std::log(urr.prob_(i_energy + 1, URR_N_GAMMA, i_up)));
|
||||
std::log(urr.prob_(i_energy, URRTableParam::N_GAMMA, i_low)) +
|
||||
f * std::log(urr.prob_(i_energy + 1, URRTableParam::N_GAMMA, i_up)));
|
||||
} else {
|
||||
capture = 0.;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -474,11 +474,11 @@ void print_runtime()
|
|||
show_time("Collisions", time_event_collision.elapsed(), 2);
|
||||
show_time("Particle death", time_event_death.elapsed(), 2);
|
||||
#endif
|
||||
if (settings::run_mode == RUN_MODE_EIGENVALUE) {
|
||||
if (settings::run_mode == RunMode::EIGENVALUE) {
|
||||
show_time("Time in inactive batches", time_inactive.elapsed(), 1);
|
||||
}
|
||||
show_time("Time in active batches", time_active.elapsed(), 1);
|
||||
if (settings::run_mode == RUN_MODE_EIGENVALUE) {
|
||||
if (settings::run_mode == RunMode::EIGENVALUE) {
|
||||
show_time("Time synchronizing fission bank", time_bank.elapsed(), 1);
|
||||
show_time("Sampling source sites", time_bank_sample.elapsed(), 2);
|
||||
show_time("SEND/RECV source sites", time_bank_sendrecv.elapsed(), 2);
|
||||
|
|
@ -534,8 +534,8 @@ void print_runtime()
|
|||
std::pair<double, double>
|
||||
mean_stdev(const double* x, int n)
|
||||
{
|
||||
double mean = x[RESULT_SUM] / n;
|
||||
double stdev = n > 1 ? std::sqrt((x[RESULT_SUM_SQ]/n
|
||||
double mean = x[static_cast<int>(TallyResult::SUM)] / n;
|
||||
double stdev = n > 1 ? std::sqrt((x[static_cast<int>(TallyResult::SUM_SQ)]/n
|
||||
- mean*mean)/(n - 1)) : 0.0;
|
||||
return {mean, stdev};
|
||||
}
|
||||
|
|
@ -570,14 +570,14 @@ void print_results()
|
|||
const auto& gt = simulation::global_tallies;
|
||||
double mean, stdev;
|
||||
if (n > 1) {
|
||||
if (settings::run_mode == RUN_MODE_EIGENVALUE) {
|
||||
std::tie(mean, stdev) = mean_stdev(>(K_COLLISION, 0), n);
|
||||
if (settings::run_mode == RunMode::EIGENVALUE) {
|
||||
std::tie(mean, stdev) = mean_stdev(>(GlobalTally::K_COLLISION, 0), n);
|
||||
std::cout << " k-effective (Collision) = "
|
||||
<< mean << " +/- " << t_n1 * stdev << '\n';
|
||||
std::tie(mean, stdev) = mean_stdev(>(K_TRACKLENGTH, 0), n);
|
||||
std::tie(mean, stdev) = mean_stdev(>(GlobalTally::K_TRACKLENGTH, 0), n);
|
||||
std::cout << " k-effective (Track-length) = "
|
||||
<< mean << " +/- " << t_n1 * stdev << '\n';
|
||||
std::tie(mean, stdev) = mean_stdev(>(K_ABSORPTION, 0), n);
|
||||
std::tie(mean, stdev) = mean_stdev(>(GlobalTally::K_ABSORPTION, 0), n);
|
||||
std::cout << " k-effective (Absorption) = "
|
||||
<< mean << " +/- " << t_n1 * stdev << '\n';
|
||||
if (n > 3) {
|
||||
|
|
@ -587,23 +587,23 @@ void print_results()
|
|||
<< k_combined[0] << " +/- " << t_n3 * k_combined[1] << '\n';
|
||||
}
|
||||
}
|
||||
std::tie(mean, stdev) = mean_stdev(>(LEAKAGE, 0), n);
|
||||
std::tie(mean, stdev) = mean_stdev(>(GlobalTally::LEAKAGE, 0), n);
|
||||
std::cout << " Leakage Fraction = "
|
||||
<< mean << " +/- " << t_n1 * stdev << '\n';
|
||||
} else {
|
||||
if (mpi::master) warning("Could not compute uncertainties -- only one "
|
||||
"active batch simulated!");
|
||||
|
||||
if (settings::run_mode == RUN_MODE_EIGENVALUE) {
|
||||
if (settings::run_mode == RunMode::EIGENVALUE) {
|
||||
std::cout << " k-effective (Collision) = "
|
||||
<< gt(K_COLLISION, RESULT_SUM) / n << '\n';
|
||||
<< gt(GlobalTally::K_COLLISION, TallyResult::SUM) / n << '\n';
|
||||
std::cout << " k-effective (Track-length) = "
|
||||
<< gt(K_TRACKLENGTH, RESULT_SUM) / n << '\n';
|
||||
<< gt(GlobalTally::K_TRACKLENGTH, TallyResult::SUM) / n << '\n';
|
||||
std::cout << " k-effective (Absorption) = "
|
||||
<< gt(K_ABSORPTION, RESULT_SUM) / n << '\n';
|
||||
<< gt(GlobalTally::K_ABSORPTION, TallyResult::SUM) / n << '\n';
|
||||
}
|
||||
std::cout << " Leakage Fraction = "
|
||||
<< gt(LEAKAGE, RESULT_SUM) / n << '\n';
|
||||
<< gt(GlobalTally::LEAKAGE, TallyResult::SUM) / n << '\n';
|
||||
}
|
||||
std::cout << '\n';
|
||||
|
||||
|
|
@ -669,16 +669,16 @@ write_tallies()
|
|||
if (tally.deriv_ != C_NONE) {
|
||||
const auto& deriv {model::tally_derivs[tally.deriv_]};
|
||||
switch (deriv.variable) {
|
||||
case DIFF_DENSITY:
|
||||
case DerivativeVariable::DENSITY:
|
||||
tallies_out << " Density derivative Material "
|
||||
<< std::to_string(deriv.diff_material) << "\n";
|
||||
break;
|
||||
case DIFF_NUCLIDE_DENSITY:
|
||||
case DerivativeVariable::NUCLIDE_DENSITY:
|
||||
tallies_out << " Nuclide density derivative Material "
|
||||
<< std::to_string(deriv.diff_material) << " Nuclide "
|
||||
<< data::nuclides[deriv.diff_nuclide]->name_ << "\n";
|
||||
break;
|
||||
case DIFF_TEMPERATURE:
|
||||
case DerivativeVariable::TEMPERATURE:
|
||||
tallies_out << " Temperature derivative Material "
|
||||
<< std::to_string(deriv.diff_material) << "\n";
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -146,7 +146,7 @@ Particle::event_calculate_xs()
|
|||
r_last_ = this->r();
|
||||
|
||||
// Reset event variables
|
||||
event_ = EVENT_KILL;
|
||||
event_ = TallyEvent::KILL;
|
||||
event_nuclide_ = NUCLIDE_NONE;
|
||||
event_mt_ = REACTION_NONE;
|
||||
|
||||
|
|
@ -225,7 +225,7 @@ Particle::event_advance()
|
|||
}
|
||||
|
||||
// Score track-length estimate of k-eff
|
||||
if (settings::run_mode == RUN_MODE_EIGENVALUE &&
|
||||
if (settings::run_mode == RunMode::EIGENVALUE &&
|
||||
type_ == Particle::Type::neutron) {
|
||||
keff_tally_tracklength_ += wgt_ * distance * macro_xs_.nu_fission;
|
||||
}
|
||||
|
|
@ -235,7 +235,7 @@ Particle::event_advance()
|
|||
score_track_derivative(this, distance);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Particle::event_cross_surface()
|
||||
{
|
||||
|
|
@ -254,11 +254,11 @@ Particle::event_cross_surface()
|
|||
boundary_.lattice_translation[2] != 0) {
|
||||
// Particle crosses lattice boundary
|
||||
cross_lattice(this, boundary_);
|
||||
event_ = EVENT_LATTICE;
|
||||
event_ = TallyEvent::LATTICE;
|
||||
} else {
|
||||
// Particle crosses surface
|
||||
this->cross_surface();
|
||||
event_ = EVENT_SURFACE;
|
||||
event_ = TallyEvent::SURFACE;
|
||||
}
|
||||
// Score cell to cell partial currents
|
||||
if (!model::active_surface_tallies.empty()) {
|
||||
|
|
@ -270,7 +270,7 @@ void
|
|||
Particle::event_collide()
|
||||
{
|
||||
// Score collision estimate of keff
|
||||
if (settings::run_mode == RUN_MODE_EIGENVALUE &&
|
||||
if (settings::run_mode == RunMode::EIGENVALUE &&
|
||||
type_ == Particle::Type::neutron) {
|
||||
keff_tally_collision_ += wgt_ * macro_xs_.nu_fission
|
||||
/ macro_xs_.total;
|
||||
|
|
@ -394,7 +394,7 @@ Particle::event_death()
|
|||
|
||||
// Record the number of progeny created by this particle.
|
||||
// This data will be used to efficiently sort the fission bank.
|
||||
if (settings::run_mode == RUN_MODE_EIGENVALUE) {
|
||||
if (settings::run_mode == RunMode::EIGENVALUE) {
|
||||
int64_t offset = id_ - 1 - simulation::work_index[mpi::rank];
|
||||
simulation::progeny_per_particle[offset] = n_progeny_;
|
||||
}
|
||||
|
|
@ -411,7 +411,7 @@ Particle::cross_surface()
|
|||
write_message(" Crossing surface " + std::to_string(surf->id_));
|
||||
}
|
||||
|
||||
if (surf->bc_ == BC_VACUUM && (settings::run_mode != RUN_MODE_PLOTTING)) {
|
||||
if (surf->bc_ == Surface::BoundaryType::VACUUM && (settings::run_mode != RunMode::PLOTTING)) {
|
||||
// =======================================================================
|
||||
// PARTICLE LEAKS OUT OF PROBLEM
|
||||
|
||||
|
|
@ -439,8 +439,9 @@ Particle::cross_surface()
|
|||
}
|
||||
return;
|
||||
|
||||
} else if ((surf->bc_ == BC_REFLECT || surf->bc_ == BC_WHITE)
|
||||
&& (settings::run_mode != RUN_MODE_PLOTTING)) {
|
||||
} else if ((surf->bc_ == Surface::BoundaryType::REFLECT ||
|
||||
surf->bc_ == Surface::BoundaryType::WHITE)
|
||||
&& (settings::run_mode != RunMode::PLOTTING)) {
|
||||
// =======================================================================
|
||||
// PARTICLE REFLECTS FROM SURFACE
|
||||
|
||||
|
|
@ -470,7 +471,7 @@ Particle::cross_surface()
|
|||
this->r() = r;
|
||||
}
|
||||
|
||||
Direction u = (surf->bc_ == BC_REFLECT) ?
|
||||
Direction u = (surf->bc_ == Surface::BoundaryType::REFLECT) ?
|
||||
surf->reflect(this->r(), this->u(), this) :
|
||||
surf->diffuse_reflect(this->r(), this->u(), this->current_seed());
|
||||
|
||||
|
|
@ -503,7 +504,7 @@ Particle::cross_surface()
|
|||
}
|
||||
return;
|
||||
|
||||
} else if (surf->bc_ == BC_PERIODIC && settings::run_mode != RUN_MODE_PLOTTING) {
|
||||
} else if (surf->bc_ == Surface::BoundaryType::PERIODIC && settings::run_mode != RunMode::PLOTTING) {
|
||||
// =======================================================================
|
||||
// PERIODIC BOUNDARY
|
||||
|
||||
|
|
@ -590,7 +591,7 @@ Particle::cross_surface()
|
|||
n_coord_ = 1;
|
||||
bool found = find_cell(this, false);
|
||||
|
||||
if (settings::run_mode != RUN_MODE_PLOTTING && (!found)) {
|
||||
if (settings::run_mode != RunMode::PLOTTING && (!found)) {
|
||||
// If a cell is still not found, there are two possible causes: 1) there is
|
||||
// a void in the model, and 2) the particle hit a surface at a tangent. If
|
||||
// the particle is really traveling tangent to a surface, if we move it
|
||||
|
|
@ -639,7 +640,7 @@ void
|
|||
Particle::write_restart() const
|
||||
{
|
||||
// Dont write another restart file if in particle restart mode
|
||||
if (settings::run_mode == RUN_MODE_PARTICLE) return;
|
||||
if (settings::run_mode == RunMode::PARTICLE) return;
|
||||
|
||||
// Set up file name
|
||||
std::stringstream filename;
|
||||
|
|
@ -665,13 +666,13 @@ Particle::write_restart() const
|
|||
write_dataset(file_id, "current_generation", simulation::current_gen);
|
||||
write_dataset(file_id, "n_particles", settings::n_particles);
|
||||
switch (settings::run_mode) {
|
||||
case RUN_MODE_FIXEDSOURCE:
|
||||
case RunMode::FIXED_SOURCE:
|
||||
write_dataset(file_id, "run_mode", "fixed source");
|
||||
break;
|
||||
case RUN_MODE_EIGENVALUE:
|
||||
case RunMode::EIGENVALUE:
|
||||
write_dataset(file_id, "run_mode", "eigenvalue");
|
||||
break;
|
||||
case RUN_MODE_PARTICLE:
|
||||
case RunMode::PARTICLE:
|
||||
write_dataset(file_id, "run_mode", "particle restart");
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
namespace openmc {
|
||||
|
||||
void read_particle_restart(Particle& p, int& previous_run_mode)
|
||||
void read_particle_restart(Particle& p, RunMode& previous_run_mode)
|
||||
{
|
||||
// Write meessage
|
||||
write_message("Loading particle restart file " +
|
||||
|
|
@ -38,9 +38,9 @@ void read_particle_restart(Particle& p, int& previous_run_mode)
|
|||
std::string mode;
|
||||
read_dataset(file_id, "run_mode", mode);
|
||||
if (mode == "eigenvalue") {
|
||||
previous_run_mode = RUN_MODE_EIGENVALUE;
|
||||
previous_run_mode = RunMode::EIGENVALUE;
|
||||
} else if (mode == "fixed source") {
|
||||
previous_run_mode = RUN_MODE_FIXEDSOURCE;
|
||||
previous_run_mode = RunMode::FIXED_SOURCE;
|
||||
}
|
||||
read_dataset(file_id, "id", p.id_);
|
||||
int type;
|
||||
|
|
@ -78,7 +78,7 @@ void run_particle_restart()
|
|||
Particle p;
|
||||
|
||||
// Read in the restart information
|
||||
int previous_run_mode;
|
||||
RunMode previous_run_mode;
|
||||
read_particle_restart(p, previous_run_mode);
|
||||
|
||||
// write track if that was requested on command line
|
||||
|
|
@ -90,15 +90,15 @@ void run_particle_restart()
|
|||
// Compute random number seed
|
||||
int64_t particle_seed;
|
||||
switch (previous_run_mode) {
|
||||
case RUN_MODE_EIGENVALUE:
|
||||
case RunMode::EIGENVALUE:
|
||||
particle_seed = (simulation::total_gen + overall_generation() - 1)*settings::n_particles + p.id_;
|
||||
break;
|
||||
case RUN_MODE_FIXEDSOURCE:
|
||||
case RunMode::FIXED_SOURCE:
|
||||
particle_seed = p.id_;
|
||||
break;
|
||||
default:
|
||||
throw std::runtime_error{"Unexpected run mode: " +
|
||||
std::to_string(previous_run_mode)};
|
||||
std::to_string(static_cast<int>(previous_run_mode))};
|
||||
}
|
||||
init_particle_seeds(particle_seed, p.seeds_);
|
||||
|
||||
|
|
|
|||
|
|
@ -207,7 +207,7 @@ PhotonInteraction::PhotonInteraction(hid_t group, int i_element)
|
|||
// Calculate total pair production
|
||||
pair_production_total_ = pair_production_nuclear_ + pair_production_electron_;
|
||||
|
||||
if (settings::electron_treatment == ELECTRON_TTB) {
|
||||
if (settings::electron_treatment == ElectronTreatment::TTB) {
|
||||
// Read bremsstrahlung scaled DCS
|
||||
rgroup = open_group(group, "bremsstrahlung");
|
||||
read_dataset(rgroup, "dcs", dcs_);
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ void collision(Particle* p)
|
|||
// Display information about collision
|
||||
if (settings::verbosity >= 10 || p->trace_) {
|
||||
std::stringstream msg;
|
||||
if (p->event_ == EVENT_KILL) {
|
||||
if (p->event_ == TallyEvent::KILL) {
|
||||
msg << " Killed. Energy = " << p->E_ << " eV.";
|
||||
} else if (p->type_ == Particle::Type::neutron) {
|
||||
msg << " " << reaction_name(p->event_mt_) << " with " <<
|
||||
|
|
@ -94,9 +94,9 @@ void sample_neutron_reaction(Particle* p)
|
|||
|
||||
if (nuc->fissionable_) {
|
||||
Reaction* rx = sample_fission(i_nuclide, p);
|
||||
if (settings::run_mode == RUN_MODE_EIGENVALUE) {
|
||||
if (settings::run_mode == RunMode::EIGENVALUE) {
|
||||
create_fission_sites(p, i_nuclide, rx);
|
||||
} else if (settings::run_mode == RUN_MODE_FIXEDSOURCE &&
|
||||
} else if (settings::run_mode == RunMode::FIXED_SOURCE &&
|
||||
settings::create_fission_neutrons) {
|
||||
create_fission_sites(p, i_nuclide, rx);
|
||||
|
||||
|
|
@ -176,7 +176,7 @@ create_fission_sites(Particle* p, int i_nuclide, const Reaction* rx)
|
|||
|
||||
// Determine whether to place fission sites into the shared fission bank
|
||||
// or the secondary particle bank.
|
||||
bool use_fission_bank = (settings::run_mode == RUN_MODE_EIGENVALUE);
|
||||
bool use_fission_bank = (settings::run_mode == RunMode::EIGENVALUE);
|
||||
|
||||
for (int i = 0; i < nu; ++i) {
|
||||
Particle::Bank* site;
|
||||
|
|
@ -275,7 +275,7 @@ void sample_photon_reaction(Particle* p)
|
|||
if (prob > cutoff) {
|
||||
double mu = element.rayleigh_scatter(alpha, p->current_seed());
|
||||
p->u() = rotate_angle(p->u(), mu, nullptr, p->current_seed());
|
||||
p->event_ = EVENT_SCATTER;
|
||||
p->event_ = TallyEvent::SCATTER;
|
||||
p->event_mt_ = COHERENT;
|
||||
return;
|
||||
}
|
||||
|
|
@ -318,7 +318,7 @@ void sample_photon_reaction(Particle* p)
|
|||
phi += PI;
|
||||
p->E_ = alpha_out*MASS_ELECTRON_EV;
|
||||
p->u() = rotate_angle(p->u(), mu, &phi, p->current_seed());
|
||||
p->event_ = EVENT_SCATTER;
|
||||
p->event_ = TallyEvent::SCATTER;
|
||||
p->event_mt_ = INCOHERENT;
|
||||
return;
|
||||
}
|
||||
|
|
@ -370,7 +370,7 @@ void sample_photon_reaction(Particle* p)
|
|||
// Allow electrons to fill orbital and produce auger electrons
|
||||
// and fluorescent photons
|
||||
element.atomic_relaxation(shell, *p);
|
||||
p->event_ = EVENT_ABSORB;
|
||||
p->event_ = TallyEvent::ABSORB;
|
||||
p->event_mt_ = 533 + shell.index_subshell;
|
||||
p->alive_ = false;
|
||||
p->E_ = 0.0;
|
||||
|
|
@ -396,7 +396,7 @@ void sample_photon_reaction(Particle* p)
|
|||
u = rotate_angle(p->u(), mu_positron, nullptr, p->current_seed());
|
||||
p->create_secondary(u, E_positron, Particle::Type::positron);
|
||||
|
||||
p->event_ = EVENT_ABSORB;
|
||||
p->event_ = TallyEvent::ABSORB;
|
||||
p->event_mt_ = PAIR_PROD;
|
||||
p->alive_ = false;
|
||||
p->E_ = 0.0;
|
||||
|
|
@ -407,21 +407,21 @@ void sample_electron_reaction(Particle* p)
|
|||
{
|
||||
// TODO: create reaction types
|
||||
|
||||
if (settings::electron_treatment == ELECTRON_TTB) {
|
||||
if (settings::electron_treatment == ElectronTreatment::TTB) {
|
||||
double E_lost;
|
||||
thick_target_bremsstrahlung(*p, &E_lost);
|
||||
}
|
||||
|
||||
p->E_ = 0.0;
|
||||
p->alive_ = false;
|
||||
p->event_ = EVENT_ABSORB;
|
||||
p->event_ = TallyEvent::ABSORB;
|
||||
}
|
||||
|
||||
void sample_positron_reaction(Particle* p)
|
||||
{
|
||||
// TODO: create reaction types
|
||||
|
||||
if (settings::electron_treatment == ELECTRON_TTB) {
|
||||
if (settings::electron_treatment == ElectronTreatment::TTB) {
|
||||
double E_lost;
|
||||
thick_target_bremsstrahlung(*p, &E_lost);
|
||||
}
|
||||
|
|
@ -440,7 +440,7 @@ void sample_positron_reaction(Particle* p)
|
|||
|
||||
p->E_ = 0.0;
|
||||
p->alive_ = false;
|
||||
p->event_ = EVENT_ABSORB;
|
||||
p->event_ = TallyEvent::ABSORB;
|
||||
}
|
||||
|
||||
int sample_nuclide(Particle* p)
|
||||
|
|
@ -592,7 +592,7 @@ void absorption(Particle* p, int i_nuclide)
|
|||
p->wgt_last_ = p->wgt_;
|
||||
|
||||
// Score implicit absorption estimate of keff
|
||||
if (settings::run_mode == RUN_MODE_EIGENVALUE) {
|
||||
if (settings::run_mode == RunMode::EIGENVALUE) {
|
||||
p->keff_tally_absorption_ += p->wgt_absorb_ * p->neutron_xs_[
|
||||
i_nuclide].nu_fission / p->neutron_xs_[i_nuclide].absorption;
|
||||
}
|
||||
|
|
@ -601,13 +601,13 @@ void absorption(Particle* p, int i_nuclide)
|
|||
if (p->neutron_xs_[i_nuclide].absorption >
|
||||
prn(p->current_seed()) * p->neutron_xs_[i_nuclide].total) {
|
||||
// Score absorption estimate of keff
|
||||
if (settings::run_mode == RUN_MODE_EIGENVALUE) {
|
||||
if (settings::run_mode == RunMode::EIGENVALUE) {
|
||||
p->keff_tally_absorption_ += p->wgt_ * p->neutron_xs_[
|
||||
i_nuclide].nu_fission / p->neutron_xs_[i_nuclide].absorption;
|
||||
}
|
||||
|
||||
p->alive_ = false;
|
||||
p->event_ = EVENT_ABSORB;
|
||||
p->event_ = TallyEvent::ABSORB;
|
||||
p->event_mt_ = N_DISAPPEAR;
|
||||
}
|
||||
}
|
||||
|
|
@ -693,7 +693,7 @@ void scatter(Particle* p, int i_nuclide)
|
|||
}
|
||||
|
||||
// Set event component
|
||||
p->event_ = EVENT_SCATTER;
|
||||
p->event_ = TallyEvent::SCATTER;
|
||||
|
||||
// Sample new outgoing angle for isotropic-in-lab scattering
|
||||
const auto& mat {model::materials[p->material_]};
|
||||
|
|
|
|||
|
|
@ -47,8 +47,8 @@ sample_reaction(Particle* p)
|
|||
// absorption (including fission)
|
||||
|
||||
if (model::materials[p->material_]->fissionable_) {
|
||||
if (settings::run_mode == RUN_MODE_EIGENVALUE ||
|
||||
(settings::run_mode == RUN_MODE_FIXEDSOURCE &&
|
||||
if (settings::run_mode == RunMode::EIGENVALUE ||
|
||||
(settings::run_mode == RunMode::FIXED_SOURCE &&
|
||||
settings::create_fission_neutrons)) {
|
||||
create_fission_sites(p);
|
||||
}
|
||||
|
|
@ -86,7 +86,7 @@ scatter(Particle* p)
|
|||
p->E_ = data::mg.energy_bin_avg_[p->g_];
|
||||
|
||||
// Set event component
|
||||
p->event_ = EVENT_SCATTER;
|
||||
p->event_ = TallyEvent::SCATTER;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -122,7 +122,7 @@ create_fission_sites(Particle* p)
|
|||
|
||||
// Determine whether to place fission sites into the shared fission bank
|
||||
// or the secondary particle bank.
|
||||
bool use_fission_bank = (settings::run_mode == RUN_MODE_EIGENVALUE);
|
||||
bool use_fission_bank = (settings::run_mode == RunMode::EIGENVALUE);
|
||||
|
||||
for (int i = 0; i < nu; ++i) {
|
||||
Particle::Bank* site;
|
||||
|
|
@ -230,7 +230,7 @@ absorption(Particle* p)
|
|||
p->keff_tally_absorption_ += p->wgt_ * p->macro_xs_.nu_fission /
|
||||
p->macro_xs_.absorption;
|
||||
p->alive_ = false;
|
||||
p->event_ = EVENT_ABSORB;
|
||||
p->event_ = TallyEvent::ABSORB;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ IdData::set_value(size_t y, size_t x, const Particle& p, int level) {
|
|||
if (p.material_ == MATERIAL_VOID) {
|
||||
data_(y,x,1) = MATERIAL_VOID;
|
||||
return;
|
||||
} else if (c->type_ != FILL_UNIVERSE) {
|
||||
} else if (c->type_ != Fill::UNIVERSE) {
|
||||
Material* m = model::materials[p.material_].get();
|
||||
data_(y,x,1) = m->id_;
|
||||
}
|
||||
|
|
@ -62,7 +62,7 @@ void
|
|||
PropertyData::set_value(size_t y, size_t x, const Particle& p, int level) {
|
||||
Cell* c = model::cells[p.coord_[level].cell].get();
|
||||
data_(y,x,0) = (p.sqrtkT_ * p.sqrtkT_) / K_BOLTZMANN;
|
||||
if (c->type_ != FILL_UNIVERSE && p.material_ != MATERIAL_VOID) {
|
||||
if (c->type_ != Fill::UNIVERSE && p.material_ != MATERIAL_VOID) {
|
||||
Material* m = model::materials[p.material_].get();
|
||||
data_(y,x,1) = m->density_gpcc_;
|
||||
}
|
||||
|
|
@ -678,7 +678,7 @@ void Plot::set_overlap_color(pugi::xml_node plot_node) {
|
|||
|
||||
// make sure we allocate the vector for counting overlap checks if
|
||||
// they're going to be plotted
|
||||
if (color_overlaps_ && settings::run_mode == RUN_MODE_PLOTTING) {
|
||||
if (color_overlaps_ && settings::run_mode == RunMode::PLOTTING) {
|
||||
settings::check_overlaps = true;
|
||||
model::overlap_check_count.resize(model::cells.size(), 0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -183,7 +183,7 @@ ScattData::sample_energy(int gin, int& gout, int& i_gout, uint64_t* seed)
|
|||
//==============================================================================
|
||||
|
||||
double
|
||||
ScattData::get_xs(int xstype, int gin, const int* gout, const double* mu)
|
||||
ScattData::get_xs(MgxsType xstype, int gin, const int* gout, const double* mu)
|
||||
{
|
||||
// Set the outgoing group offset index as needed
|
||||
int i_gout = 0;
|
||||
|
|
@ -198,10 +198,10 @@ ScattData::get_xs(int xstype, int gin, const int* gout, const double* mu)
|
|||
|
||||
double val = scattxs[gin];
|
||||
switch(xstype) {
|
||||
case MG_GET_XS_SCATTER:
|
||||
case MgxsType::SCATTER:
|
||||
if (gout != nullptr) val *= energy[gin][i_gout];
|
||||
break;
|
||||
case MG_GET_XS_SCATTER_MULT:
|
||||
case MgxsType::SCATTER_MULT:
|
||||
if (gout != nullptr) {
|
||||
val *= energy[gin][i_gout] / mult[gin][i_gout];
|
||||
} else {
|
||||
|
|
@ -209,7 +209,7 @@ ScattData::get_xs(int xstype, int gin, const int* gout, const double* mu)
|
|||
energy[gin].begin(), 0.0);
|
||||
}
|
||||
break;
|
||||
case MG_GET_XS_SCATTER_FMU_MULT:
|
||||
case MgxsType::SCATTER_FMU_MULT:
|
||||
if ((gout != nullptr) && (mu != nullptr)) {
|
||||
val *= energy[gin][i_gout] * calc_f(gin, *gout, *mu);
|
||||
} else {
|
||||
|
|
@ -218,7 +218,7 @@ ScattData::get_xs(int xstype, int gin, const int* gout, const double* mu)
|
|||
fatal_error("Invalid call to get_xs");
|
||||
}
|
||||
break;
|
||||
case MG_GET_XS_SCATTER_FMU:
|
||||
case MgxsType::SCATTER_FMU:
|
||||
if ((gout != nullptr) && (mu != nullptr)) {
|
||||
val *= energy[gin][i_gout] * calc_f(gin, *gout, *mu) / mult[gin][i_gout];
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ int64_t n_particles {-1};
|
|||
|
||||
int64_t max_in_flight_particles {100000};
|
||||
|
||||
int electron_treatment {ELECTRON_TTB};
|
||||
ElectronTreatment electron_treatment {ElectronTreatment::TTB};
|
||||
std::array<double, 4> energy_cutoff {0.0, 1000.0, 0.0, 0.0};
|
||||
int legendre_to_tabular_points {C_NONE};
|
||||
int max_order {0};
|
||||
|
|
@ -93,10 +93,10 @@ ResScatMethod res_scat_method {ResScatMethod::rvs};
|
|||
double res_scat_energy_min {0.01};
|
||||
double res_scat_energy_max {1000.0};
|
||||
std::vector<std::string> res_scat_nuclides;
|
||||
int run_mode {-1};
|
||||
RunMode run_mode {RunMode::UNSET};
|
||||
std::unordered_set<int> sourcepoint_batch;
|
||||
std::unordered_set<int> statepoint_batch;
|
||||
int temperature_method {TEMPERATURE_NEAREST};
|
||||
TemperatureMethod temperature_method {TemperatureMethod::NEAREST};
|
||||
double temperature_tolerance {10.0};
|
||||
double temperature_default {293.6};
|
||||
std::array<double, 2> temperature_range {0.0, 0.0};
|
||||
|
|
@ -143,7 +143,7 @@ void get_run_parameters(pugi::xml_node node_base)
|
|||
if (!trigger_on) n_max_batches = n_batches;
|
||||
|
||||
// Get number of inactive batches
|
||||
if (run_mode == RUN_MODE_EIGENVALUE) {
|
||||
if (run_mode == RunMode::EIGENVALUE) {
|
||||
if (check_for_node(node_base, "inactive")) {
|
||||
n_inactive = std::stoi(get_node_value(node_base, "inactive"));
|
||||
}
|
||||
|
|
@ -193,7 +193,7 @@ void read_settings_xml()
|
|||
// Check if settings.xml exists
|
||||
std::string filename = path_input + "settings.xml";
|
||||
if (!file_exists(filename)) {
|
||||
if (run_mode != RUN_MODE_PLOTTING) {
|
||||
if (run_mode != RunMode::PLOTTING) {
|
||||
std::stringstream msg;
|
||||
msg << "Settings XML file '" << filename << "' does not exist! In order "
|
||||
"to run OpenMC, you first need a set of input files; at a minimum, this "
|
||||
|
|
@ -301,19 +301,19 @@ void read_settings_xml()
|
|||
|
||||
// Check run mode if it hasn't been set from the command line
|
||||
xml_node node_mode;
|
||||
if (run_mode == C_NONE) {
|
||||
if (run_mode == RunMode::UNSET) {
|
||||
if (check_for_node(root, "run_mode")) {
|
||||
std::string temp_str = get_node_value(root, "run_mode", true, true);
|
||||
if (temp_str == "eigenvalue") {
|
||||
run_mode = RUN_MODE_EIGENVALUE;
|
||||
run_mode = RunMode::EIGENVALUE;
|
||||
} else if (temp_str == "fixed source") {
|
||||
run_mode = RUN_MODE_FIXEDSOURCE;
|
||||
run_mode = RunMode::FIXED_SOURCE;
|
||||
} else if (temp_str == "plot") {
|
||||
run_mode = RUN_MODE_PLOTTING;
|
||||
run_mode = RunMode::PLOTTING;
|
||||
} else if (temp_str == "particle restart") {
|
||||
run_mode = RUN_MODE_PARTICLE;
|
||||
run_mode = RunMode::PARTICLE;
|
||||
} else if (temp_str == "volume") {
|
||||
run_mode = RUN_MODE_VOLUME;
|
||||
run_mode = RunMode::VOLUME;
|
||||
} else {
|
||||
fatal_error("Unrecognized run mode: " + temp_str);
|
||||
}
|
||||
|
|
@ -326,11 +326,11 @@ void read_settings_xml()
|
|||
// Make sure that either eigenvalue or fixed source was specified
|
||||
node_mode = root.child("eigenvalue");
|
||||
if (node_mode) {
|
||||
run_mode = RUN_MODE_EIGENVALUE;
|
||||
run_mode = RunMode::EIGENVALUE;
|
||||
} else {
|
||||
node_mode = root.child("fixed_source");
|
||||
if (node_mode) {
|
||||
run_mode = RUN_MODE_FIXEDSOURCE;
|
||||
run_mode = RunMode::FIXED_SOURCE;
|
||||
} else {
|
||||
fatal_error("<eigenvalue> or <fixed_source> not specified.");
|
||||
}
|
||||
|
|
@ -338,7 +338,7 @@ void read_settings_xml()
|
|||
}
|
||||
}
|
||||
|
||||
if (run_mode == RUN_MODE_EIGENVALUE || run_mode == RUN_MODE_FIXEDSOURCE) {
|
||||
if (run_mode == RunMode::EIGENVALUE || run_mode == RunMode::FIXED_SOURCE) {
|
||||
// Read run parameters
|
||||
get_run_parameters(node_mode);
|
||||
|
||||
|
|
@ -362,9 +362,9 @@ void read_settings_xml()
|
|||
if (check_for_node(root, "electron_treatment")) {
|
||||
auto temp_str = get_node_value(root, "electron_treatment", true, true);
|
||||
if (temp_str == "led") {
|
||||
electron_treatment = ELECTRON_LED;
|
||||
electron_treatment = ElectronTreatment::LED;
|
||||
} else if (temp_str == "ttb") {
|
||||
electron_treatment = ELECTRON_TTB;
|
||||
electron_treatment = ElectronTreatment::TTB;
|
||||
} else {
|
||||
fatal_error("Unrecognized electron treatment: " + temp_str + ".");
|
||||
}
|
||||
|
|
@ -740,9 +740,9 @@ void read_settings_xml()
|
|||
if (check_for_node(root, "temperature_method")) {
|
||||
auto temp = get_node_value(root, "temperature_method", true, true);
|
||||
if (temp == "nearest") {
|
||||
temperature_method = TEMPERATURE_NEAREST;
|
||||
temperature_method = TemperatureMethod::NEAREST;
|
||||
} else if (temp == "interpolation") {
|
||||
temperature_method = TEMPERATURE_INTERPOLATION;
|
||||
temperature_method = TemperatureMethod::INTERPOLATION;
|
||||
} else {
|
||||
fatal_error("Unknown temperature method: " + temp);
|
||||
}
|
||||
|
|
@ -781,7 +781,7 @@ void read_settings_xml()
|
|||
}
|
||||
|
||||
// Check whether create fission sites
|
||||
if (run_mode == RUN_MODE_FIXEDSOURCE) {
|
||||
if (run_mode == RunMode::FIXED_SOURCE) {
|
||||
if (check_for_node(root, "create_fission_neutrons")) {
|
||||
create_fission_neutrons = get_node_value_bool(root, "create_fission_neutrons");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -110,9 +110,9 @@ int openmc_simulation_init()
|
|||
|
||||
// Display header
|
||||
if (mpi::master) {
|
||||
if (settings::run_mode == RUN_MODE_FIXEDSOURCE) {
|
||||
if (settings::run_mode == RunMode::FIXED_SOURCE) {
|
||||
header("FIXED SOURCE TRANSPORT SIMULATION", 3);
|
||||
} else if (settings::run_mode == RUN_MODE_EIGENVALUE) {
|
||||
} else if (settings::run_mode == RunMode::EIGENVALUE) {
|
||||
header("K EIGENVALUE SIMULATION", 3);
|
||||
if (settings::verbosity >= 7) print_columns();
|
||||
}
|
||||
|
|
@ -272,7 +272,7 @@ void allocate_banks()
|
|||
// Allocate source bank
|
||||
simulation::source_bank.resize(simulation::work_per_rank);
|
||||
|
||||
if (settings::run_mode == RUN_MODE_EIGENVALUE) {
|
||||
if (settings::run_mode == RunMode::EIGENVALUE) {
|
||||
init_fission_bank(3*simulation::work_per_rank);
|
||||
}
|
||||
}
|
||||
|
|
@ -282,7 +282,7 @@ void initialize_batch()
|
|||
// Increment current batch
|
||||
++simulation::current_batch;
|
||||
|
||||
if (settings::run_mode == RUN_MODE_FIXEDSOURCE) {
|
||||
if (settings::run_mode == RunMode::FIXED_SOURCE) {
|
||||
int b = simulation::current_batch;
|
||||
write_message("Simulating batch " + std::to_string(b), 6);
|
||||
}
|
||||
|
|
@ -329,7 +329,7 @@ void finalize_batch()
|
|||
simulation::n_realizations = 0;
|
||||
}
|
||||
|
||||
if (settings::run_mode == RUN_MODE_EIGENVALUE) {
|
||||
if (settings::run_mode == RunMode::EIGENVALUE) {
|
||||
// Write batch output
|
||||
if (mpi::master && settings::verbosity >= 7) print_batch_keff();
|
||||
}
|
||||
|
|
@ -373,7 +373,7 @@ void finalize_batch()
|
|||
|
||||
void initialize_generation()
|
||||
{
|
||||
if (settings::run_mode == RUN_MODE_EIGENVALUE) {
|
||||
if (settings::run_mode == RunMode::EIGENVALUE) {
|
||||
// Clear out the fission bank
|
||||
simulation::fission_bank_length = 0;
|
||||
|
||||
|
|
@ -382,7 +382,7 @@ void initialize_generation()
|
|||
|
||||
// Store current value of tracklength k
|
||||
simulation::keff_generation = simulation::global_tallies(
|
||||
K_TRACKLENGTH, RESULT_VALUE);
|
||||
GlobalTally::K_TRACKLENGTH, TallyResult::VALUE);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -391,22 +391,22 @@ void finalize_generation()
|
|||
auto& gt = simulation::global_tallies;
|
||||
|
||||
// Update global tallies with the accumulation variables
|
||||
if (settings::run_mode == RUN_MODE_EIGENVALUE) {
|
||||
gt(K_COLLISION, RESULT_VALUE) += global_tally_collision;
|
||||
gt(K_ABSORPTION, RESULT_VALUE) += global_tally_absorption;
|
||||
gt(K_TRACKLENGTH, RESULT_VALUE) += global_tally_tracklength;
|
||||
if (settings::run_mode == RunMode::EIGENVALUE) {
|
||||
gt(GlobalTally::K_COLLISION, TallyResult::VALUE) += global_tally_collision;
|
||||
gt(GlobalTally::K_ABSORPTION, TallyResult::VALUE) += global_tally_absorption;
|
||||
gt(GlobalTally::K_TRACKLENGTH, TallyResult::VALUE) += global_tally_tracklength;
|
||||
}
|
||||
gt(LEAKAGE, RESULT_VALUE) += global_tally_leakage;
|
||||
gt(GlobalTally::LEAKAGE, TallyResult::VALUE) += global_tally_leakage;
|
||||
|
||||
// reset tallies
|
||||
if (settings::run_mode == RUN_MODE_EIGENVALUE) {
|
||||
if (settings::run_mode == RunMode::EIGENVALUE) {
|
||||
global_tally_collision = 0.0;
|
||||
global_tally_absorption = 0.0;
|
||||
global_tally_tracklength = 0.0;
|
||||
}
|
||||
global_tally_leakage = 0.0;
|
||||
|
||||
if (settings::run_mode == RUN_MODE_EIGENVALUE) {
|
||||
if (settings::run_mode == RunMode::EIGENVALUE) {
|
||||
// If using shared memory, stable sort the fission bank (by parent IDs)
|
||||
// so as to allow for reproducibility regardless of which order particles
|
||||
// are run in.
|
||||
|
|
@ -429,7 +429,7 @@ void finalize_generation()
|
|||
}
|
||||
}
|
||||
|
||||
} else if (settings::run_mode == RUN_MODE_FIXEDSOURCE) {
|
||||
} else if (settings::run_mode == RunMode::FIXED_SOURCE) {
|
||||
// For fixed-source mode, we need to sample the external source
|
||||
simulation::time_sample_source.start();
|
||||
fill_source_bank_fixedsource();
|
||||
|
|
|
|||
|
|
@ -83,10 +83,10 @@ openmc_statepoint_write(const char* filename, bool* write_source)
|
|||
write_dataset(file_id, "energy_mode", settings::run_CE ?
|
||||
"continuous-energy" : "multi-group");
|
||||
switch (settings::run_mode) {
|
||||
case RUN_MODE_FIXEDSOURCE:
|
||||
case RunMode::FIXED_SOURCE:
|
||||
write_dataset(file_id, "run_mode", "fixed source");
|
||||
break;
|
||||
case RUN_MODE_EIGENVALUE:
|
||||
case RunMode::EIGENVALUE:
|
||||
write_dataset(file_id, "run_mode", "eigenvalue");
|
||||
break;
|
||||
}
|
||||
|
|
@ -101,7 +101,7 @@ openmc_statepoint_write(const char* filename, bool* write_source)
|
|||
write_attribute(file_id, "source_present", write_source_);
|
||||
|
||||
// Write out information for eigenvalue run
|
||||
if (settings::run_mode == RUN_MODE_EIGENVALUE)
|
||||
if (settings::run_mode == RunMode::EIGENVALUE)
|
||||
write_eigenvalue_hdf5(file_id);
|
||||
|
||||
hid_t tallies_group = create_group(file_id, "tallies");
|
||||
|
|
@ -116,13 +116,13 @@ openmc_statepoint_write(const char* filename, bool* write_source)
|
|||
hid_t deriv_group = create_group(derivs_group,
|
||||
"derivative " + std::to_string(deriv.id));
|
||||
write_dataset(deriv_group, "material", deriv.diff_material);
|
||||
if (deriv.variable == DIFF_DENSITY) {
|
||||
if (deriv.variable == DerivativeVariable::DENSITY) {
|
||||
write_dataset(deriv_group, "independent variable", "density");
|
||||
} else if (deriv.variable == DIFF_NUCLIDE_DENSITY) {
|
||||
} else if (deriv.variable == DerivativeVariable::NUCLIDE_DENSITY) {
|
||||
write_dataset(deriv_group, "independent variable", "nuclide_density");
|
||||
write_dataset(deriv_group, "nuclide",
|
||||
data::nuclides[deriv.diff_nuclide]->name_);
|
||||
} else if (deriv.variable == DIFF_TEMPERATURE) {
|
||||
} else if (deriv.variable == DerivativeVariable::TEMPERATURE) {
|
||||
write_dataset(deriv_group, "independent variable", "temperature");
|
||||
} else {
|
||||
fatal_error("Independent variable for derivative "
|
||||
|
|
@ -179,11 +179,11 @@ openmc_statepoint_write(const char* filename, bool* write_source)
|
|||
continue;
|
||||
}
|
||||
|
||||
if (tally->estimator_ == ESTIMATOR_ANALOG) {
|
||||
if (tally->estimator_ == TallyEstimator::ANALOG) {
|
||||
write_dataset(tally_group, "estimator", "analog");
|
||||
} else if (tally->estimator_ == ESTIMATOR_TRACKLENGTH) {
|
||||
} else if (tally->estimator_ == TallyEstimator::TRACKLENGTH) {
|
||||
write_dataset(tally_group, "estimator", "tracklength");
|
||||
} else if (tally->estimator_ == ESTIMATOR_COLLISION) {
|
||||
} else if (tally->estimator_ == TallyEstimator::COLLISION) {
|
||||
write_dataset(tally_group, "estimator", "collision");
|
||||
}
|
||||
|
||||
|
|
@ -275,11 +275,11 @@ openmc_statepoint_write(const char* filename, bool* write_source)
|
|||
write_dataset(runtime_group, "simulation", time_inactive.elapsed()
|
||||
+ time_active.elapsed());
|
||||
write_dataset(runtime_group, "transport", time_transport.elapsed());
|
||||
if (settings::run_mode == RUN_MODE_EIGENVALUE) {
|
||||
if (settings::run_mode == RunMode::EIGENVALUE) {
|
||||
write_dataset(runtime_group, "inactive batches", time_inactive.elapsed());
|
||||
}
|
||||
write_dataset(runtime_group, "active batches", time_active.elapsed());
|
||||
if (settings::run_mode == RUN_MODE_EIGENVALUE) {
|
||||
if (settings::run_mode == RunMode::EIGENVALUE) {
|
||||
write_dataset(runtime_group, "synchronizing fission bank", time_bank.elapsed());
|
||||
write_dataset(runtime_group, "sampling source sites", time_bank_sample.elapsed());
|
||||
write_dataset(runtime_group, "SEND-RECV source sites", time_bank_sendrecv.elapsed());
|
||||
|
|
@ -365,9 +365,9 @@ void load_state_point()
|
|||
// Read and overwrite run information except number of batches
|
||||
read_dataset(file_id, "run_mode", word);
|
||||
if (word == "fixed source") {
|
||||
settings::run_mode = RUN_MODE_FIXEDSOURCE;
|
||||
settings::run_mode = RunMode::FIXED_SOURCE;
|
||||
} else if (word == "eigenvalue") {
|
||||
settings::run_mode = RUN_MODE_EIGENVALUE;
|
||||
settings::run_mode = RunMode::EIGENVALUE;
|
||||
}
|
||||
read_attribute(file_id, "photon_transport", settings::photon_transport);
|
||||
read_dataset(file_id, "n_particles", settings::n_particles);
|
||||
|
|
@ -390,7 +390,7 @@ void load_state_point()
|
|||
}
|
||||
|
||||
// Read information specific to eigenvalue run
|
||||
if (settings::run_mode == RUN_MODE_EIGENVALUE) {
|
||||
if (settings::run_mode == RunMode::EIGENVALUE) {
|
||||
read_dataset(file_id, "n_inactive", temp);
|
||||
read_eigenvalue_hdf5(file_id);
|
||||
|
||||
|
|
@ -457,7 +457,7 @@ void load_state_point()
|
|||
}
|
||||
|
||||
// Read source if in eigenvalue mode
|
||||
if (settings::run_mode == RUN_MODE_EIGENVALUE) {
|
||||
if (settings::run_mode == RunMode::EIGENVALUE) {
|
||||
|
||||
// Check if source was written out separately
|
||||
if (!source_present) {
|
||||
|
|
@ -725,7 +725,7 @@ void write_tally_results_nr(hid_t file_id)
|
|||
|
||||
// Get view of accumulated tally values
|
||||
auto values_view = xt::view(t->results_, xt::all(), xt::all(),
|
||||
xt::range(RESULT_SUM, RESULT_SUM_SQ + 1));
|
||||
xt::range(static_cast<int>(TallyResult::SUM), static_cast<int>(TallyResult::SUM_SQ) + 1));
|
||||
|
||||
// Make copy of tally values in contiguous array
|
||||
xt::xtensor<double, 2> values = values_view;
|
||||
|
|
@ -752,7 +752,7 @@ void write_tally_results_nr(hid_t file_id)
|
|||
// Put in temporary tally result
|
||||
xt::xtensor<double, 3> results_copy = xt::zeros_like(t->results_);
|
||||
auto copy_view = xt::view(results_copy, xt::all(), xt::all(),
|
||||
xt::range(RESULT_SUM, RESULT_SUM_SQ + 1));
|
||||
xt::range(static_cast<int>(TallyResult::SUM), static_cast<int>(TallyResult::SUM_SQ) + 1));
|
||||
copy_view = values;
|
||||
|
||||
// Write reduced tally results to file
|
||||
|
|
|
|||
|
|
@ -16,15 +16,6 @@
|
|||
|
||||
namespace openmc {
|
||||
|
||||
//==============================================================================
|
||||
// Module constant definitions
|
||||
//==============================================================================
|
||||
|
||||
extern "C" const int BC_TRANSMIT {0};
|
||||
extern "C" const int BC_VACUUM {1};
|
||||
extern "C" const int BC_REFLECT {2};
|
||||
extern "C" const int BC_PERIODIC {3};
|
||||
extern "C" const int BC_WHITE {4};
|
||||
//==============================================================================
|
||||
// Global variables
|
||||
//==============================================================================
|
||||
|
|
@ -141,18 +132,18 @@ Surface::Surface(pugi::xml_node surf_node)
|
|||
std::string surf_bc = get_node_value(surf_node, "boundary", true, true);
|
||||
|
||||
if (surf_bc == "transmission" || surf_bc == "transmit" ||surf_bc.empty()) {
|
||||
bc_ = BC_TRANSMIT;
|
||||
bc_ = BoundaryType::TRANSMIT;
|
||||
|
||||
} else if (surf_bc == "vacuum") {
|
||||
bc_ = BC_VACUUM;
|
||||
bc_ = BoundaryType::VACUUM;
|
||||
|
||||
} else if (surf_bc == "reflective" || surf_bc == "reflect"
|
||||
|| surf_bc == "reflecting") {
|
||||
bc_ = BC_REFLECT;
|
||||
bc_ = BoundaryType::REFLECT;
|
||||
} else if (surf_bc == "white") {
|
||||
bc_ = BC_WHITE;
|
||||
bc_ = BoundaryType::WHITE;
|
||||
} else if (surf_bc == "periodic") {
|
||||
bc_ = BC_PERIODIC;
|
||||
bc_ = BoundaryType::PERIODIC;
|
||||
} else {
|
||||
std::stringstream err_msg;
|
||||
err_msg << "Unknown boundary condition \"" << surf_bc
|
||||
|
|
@ -161,7 +152,7 @@ Surface::Surface(pugi::xml_node surf_node)
|
|||
}
|
||||
|
||||
} else {
|
||||
bc_ = BC_TRANSMIT;
|
||||
bc_ = BoundaryType::TRANSMIT;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -229,19 +220,19 @@ CSGSurface::to_hdf5(hid_t group_id) const
|
|||
hid_t surf_group = create_group(group_id, group_name);
|
||||
|
||||
switch(bc_) {
|
||||
case BC_TRANSMIT :
|
||||
case BoundaryType::TRANSMIT :
|
||||
write_string(surf_group, "boundary_type", "transmission", false);
|
||||
break;
|
||||
case BC_VACUUM :
|
||||
case BoundaryType::VACUUM :
|
||||
write_string(surf_group, "boundary_type", "vacuum", false);
|
||||
break;
|
||||
case BC_REFLECT :
|
||||
case BoundaryType::REFLECT :
|
||||
write_string(surf_group, "boundary_type", "reflective", false);
|
||||
break;
|
||||
case BC_WHITE :
|
||||
case BoundaryType::WHITE :
|
||||
write_string(surf_group, "boundary_type", "white", false);
|
||||
break;
|
||||
case BC_PERIODIC :
|
||||
case BoundaryType::PERIODIC :
|
||||
write_string(surf_group, "boundary_type", "periodic", false);
|
||||
break;
|
||||
}
|
||||
|
|
@ -1204,7 +1195,7 @@ void read_surfaces(pugi::xml_node node)
|
|||
zmin {INFTY}, zmax {-INFTY};
|
||||
int i_xmin, i_xmax, i_ymin, i_ymax, i_zmin, i_zmax;
|
||||
for (int i_surf = 0; i_surf < model::surfaces.size(); i_surf++) {
|
||||
if (model::surfaces[i_surf]->bc_ == BC_PERIODIC) {
|
||||
if (model::surfaces[i_surf]->bc_ == Surface::BoundaryType::PERIODIC) {
|
||||
// Downcast to the PeriodicSurface type.
|
||||
Surface* surf_base = model::surfaces[i_surf].get();
|
||||
auto surf = dynamic_cast<PeriodicSurface*>(surf_base);
|
||||
|
|
@ -1249,7 +1240,7 @@ void read_surfaces(pugi::xml_node node)
|
|||
|
||||
// Set i_periodic for periodic BC surfaces.
|
||||
for (int i_surf = 0; i_surf < model::surfaces.size(); i_surf++) {
|
||||
if (model::surfaces[i_surf]->bc_ == BC_PERIODIC) {
|
||||
if (model::surfaces[i_surf]->bc_ == Surface::BoundaryType::PERIODIC) {
|
||||
// Downcast to the PeriodicSurface type.
|
||||
Surface* surf_base = model::surfaces[i_surf].get();
|
||||
auto surf = dynamic_cast<PeriodicSurface*>(surf_base);
|
||||
|
|
@ -1298,7 +1289,7 @@ void read_surfaces(pugi::xml_node node)
|
|||
}
|
||||
|
||||
// Make sure the opposite surface is also periodic.
|
||||
if (model::surfaces[surf->i_periodic_]->bc_ != BC_PERIODIC) {
|
||||
if (model::surfaces[surf->i_periodic_]->bc_ != Surface::BoundaryType::PERIODIC) {
|
||||
std::stringstream err_msg;
|
||||
err_msg << "Could not find matching surface for periodic boundary "
|
||||
"condition on surface " << surf->id_;
|
||||
|
|
@ -1311,12 +1302,12 @@ void read_surfaces(pugi::xml_node node)
|
|||
// surface
|
||||
bool boundary_exists = false;
|
||||
for (const auto& surf : model::surfaces) {
|
||||
if (surf->bc_ != BC_TRANSMIT) {
|
||||
if (surf->bc_ != Surface::BoundaryType::TRANSMIT) {
|
||||
boundary_exists = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (settings::run_mode != RUN_MODE_PLOTTING && !boundary_exists) {
|
||||
if (settings::run_mode != RunMode::PLOTTING && !boundary_exists) {
|
||||
fatal_error("No boundary conditions were applied to any surfaces!");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,10 +41,10 @@ TallyDerivative::TallyDerivative(pugi::xml_node node)
|
|||
std::string variable_str = get_node_value(node, "variable");
|
||||
|
||||
if (variable_str == "density") {
|
||||
variable = DIFF_DENSITY;
|
||||
variable = DerivativeVariable::DENSITY;
|
||||
|
||||
} else if (variable_str == "nuclide_density") {
|
||||
variable = DIFF_NUCLIDE_DENSITY;
|
||||
variable = DerivativeVariable::NUCLIDE_DENSITY;
|
||||
|
||||
std::string nuclide_name = get_node_value(node, "nuclide");
|
||||
bool found = false;
|
||||
|
|
@ -62,7 +62,7 @@ TallyDerivative::TallyDerivative(pugi::xml_node node)
|
|||
}
|
||||
|
||||
} else if (variable_str == "temperature") {
|
||||
variable = DIFF_TEMPERATURE;
|
||||
variable = DerivativeVariable::TEMPERATURE;
|
||||
|
||||
} else {
|
||||
std::stringstream out;
|
||||
|
|
@ -142,11 +142,11 @@ apply_derivative_to_score(const Particle* p, int i_tally, int i_nuclide,
|
|||
// d_c / d_rho = sigma_MT * const
|
||||
// (1 / c) * (d_c / d_rho) = 1 / rho
|
||||
|
||||
case DIFF_DENSITY:
|
||||
case DerivativeVariable::DENSITY:
|
||||
switch (tally.estimator_) {
|
||||
|
||||
case ESTIMATOR_ANALOG:
|
||||
case ESTIMATOR_COLLISION:
|
||||
case TallyEstimator::ANALOG:
|
||||
case TallyEstimator::COLLISION:
|
||||
switch (score_bin) {
|
||||
|
||||
case SCORE_TOTAL:
|
||||
|
|
@ -182,10 +182,10 @@ apply_derivative_to_score(const Particle* p, int i_tally, int i_nuclide,
|
|||
// (1 / c) * (d_c / d_N) = sigma_MT_i / Sigma_MT
|
||||
// where i is the perturbed nuclide.
|
||||
|
||||
case DIFF_NUCLIDE_DENSITY:
|
||||
case DerivativeVariable::NUCLIDE_DENSITY:
|
||||
switch (tally.estimator_) {
|
||||
|
||||
case ESTIMATOR_ANALOG:
|
||||
case TallyEstimator::ANALOG:
|
||||
if (p->event_nuclide_ != deriv.diff_nuclide) {
|
||||
score *= flux_deriv;
|
||||
return;
|
||||
|
|
@ -213,7 +213,7 @@ apply_derivative_to_score(const Particle* p, int i_tally, int i_nuclide,
|
|||
}
|
||||
break;
|
||||
|
||||
case ESTIMATOR_COLLISION:
|
||||
case TallyEstimator::COLLISION:
|
||||
switch (score_bin) {
|
||||
|
||||
case SCORE_TOTAL:
|
||||
|
|
@ -308,10 +308,10 @@ apply_derivative_to_score(const Particle* p, int i_tally, int i_nuclide,
|
|||
// computed by multipole_deriv_eval. It only works for the resolved
|
||||
// resonance range and requires multipole data.
|
||||
|
||||
case DIFF_TEMPERATURE:
|
||||
case DerivativeVariable::TEMPERATURE:
|
||||
switch (tally.estimator_) {
|
||||
|
||||
case ESTIMATOR_ANALOG:
|
||||
case TallyEstimator::ANALOG:
|
||||
{
|
||||
// Find the index of the event nuclide.
|
||||
int i;
|
||||
|
|
@ -397,7 +397,7 @@ apply_derivative_to_score(const Particle* p, int i_tally, int i_nuclide,
|
|||
}
|
||||
break;
|
||||
|
||||
case ESTIMATOR_COLLISION:
|
||||
case TallyEstimator::COLLISION:
|
||||
if (i_nuclide != -1) {
|
||||
const auto& nuc {data::nuclides[i_nuclide]};
|
||||
if (!multipole_in_range(nuc.get(), p->E_last_)) {
|
||||
|
|
@ -576,7 +576,7 @@ score_track_derivative(Particle* p, double distance)
|
|||
|
||||
switch (deriv.variable) {
|
||||
|
||||
case DIFF_DENSITY:
|
||||
case DerivativeVariable::DENSITY:
|
||||
// phi is proportional to e^(-Sigma_tot * dist)
|
||||
// (1 / phi) * (d_phi / d_rho) = - (d_Sigma_tot / d_rho) * dist
|
||||
// (1 / phi) * (d_phi / d_rho) = - Sigma_tot / rho * dist
|
||||
|
|
@ -584,7 +584,7 @@ score_track_derivative(Particle* p, double distance)
|
|||
/ material.density_gpcc_;
|
||||
break;
|
||||
|
||||
case DIFF_NUCLIDE_DENSITY:
|
||||
case DerivativeVariable::NUCLIDE_DENSITY:
|
||||
// phi is proportional to e^(-Sigma_tot * dist)
|
||||
// (1 / phi) * (d_phi / d_N) = - (d_Sigma_tot / d_N) * dist
|
||||
// (1 / phi) * (d_phi / d_N) = - sigma_tot * dist
|
||||
|
|
@ -592,7 +592,7 @@ score_track_derivative(Particle* p, double distance)
|
|||
* p->neutron_xs_[deriv.diff_nuclide].total;
|
||||
break;
|
||||
|
||||
case DIFF_TEMPERATURE:
|
||||
case DerivativeVariable::TEMPERATURE:
|
||||
for (auto i = 0; i < material.nuclide_.size(); ++i) {
|
||||
const auto& nuc {*data::nuclides[material.nuclide_[i]]};
|
||||
if (multipole_in_range(&nuc, p->E_last_)) {
|
||||
|
|
@ -626,14 +626,14 @@ void score_collision_derivative(Particle* p)
|
|||
|
||||
switch (deriv.variable) {
|
||||
|
||||
case DIFF_DENSITY:
|
||||
case DerivativeVariable::DENSITY:
|
||||
// phi is proportional to Sigma_s
|
||||
// (1 / phi) * (d_phi / d_rho) = (d_Sigma_s / d_rho) / Sigma_s
|
||||
// (1 / phi) * (d_phi / d_rho) = 1 / rho
|
||||
flux_deriv += 1. / material.density_gpcc_;
|
||||
break;
|
||||
|
||||
case DIFF_NUCLIDE_DENSITY:
|
||||
case DerivativeVariable::NUCLIDE_DENSITY:
|
||||
if (p->event_nuclide_ != deriv.diff_nuclide) continue;
|
||||
// Find the index in this material for the diff_nuclide.
|
||||
int i;
|
||||
|
|
@ -654,7 +654,7 @@ void score_collision_derivative(Particle* p)
|
|||
flux_deriv += 1. / material.atom_density_(i);
|
||||
break;
|
||||
|
||||
case DIFF_TEMPERATURE:
|
||||
case DerivativeVariable::TEMPERATURE:
|
||||
// Loop over the material's nuclides until we find the event nuclide.
|
||||
for (auto i_nuc : material.nuclide_) {
|
||||
const auto& nuc {*data::nuclides[i_nuc]};
|
||||
|
|
|
|||
|
|
@ -40,8 +40,8 @@ namespace openmc {
|
|||
//==============================================================================
|
||||
|
||||
namespace model {
|
||||
std::vector<std::unique_ptr<Filter>> tally_filters;
|
||||
std::unordered_map<int, int> filter_map;
|
||||
std::vector<std::unique_ptr<Filter>> tally_filters;
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
|
|
|
|||
|
|
@ -50,11 +50,11 @@ void AzimuthalFilter::set_bins(gsl::span<double> bins)
|
|||
}
|
||||
|
||||
void
|
||||
AzimuthalFilter::get_all_bins(const Particle* p, int estimator,
|
||||
AzimuthalFilter::get_all_bins(const Particle* p, TallyEstimator estimator,
|
||||
FilterMatch& match) const
|
||||
{
|
||||
double phi;
|
||||
if (estimator == ESTIMATOR_TRACKLENGTH) {
|
||||
if (estimator == TallyEstimator::TRACKLENGTH) {
|
||||
phi = std::atan2(p->u().y, p->u().x);
|
||||
} else {
|
||||
phi = std::atan2(p->u_last_.y, p->u_last_.x);
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ CellFilter::set_cells(gsl::span<int32_t> cells)
|
|||
}
|
||||
|
||||
void
|
||||
CellFilter::get_all_bins(const Particle* p, int estimator,
|
||||
CellFilter::get_all_bins(const Particle* p, TallyEstimator estimator,
|
||||
FilterMatch& match) const
|
||||
{
|
||||
for (int i = 0; i < p->n_coord_; i++) {
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ CellInstanceFilter::set_cell_instances(gsl::span<CellInstance> instances)
|
|||
Expects(x.index_cell >= 0);
|
||||
Expects(x.index_cell < model::cells.size());
|
||||
const auto& c {model::cells[x.index_cell]};
|
||||
if (c->type_ != FILL_MATERIAL) {
|
||||
if (c->type_ != Fill::MATERIAL) {
|
||||
throw std::invalid_argument{"Cell " + std::to_string(c->id_) + " is not "
|
||||
"filled with a material. Only material cells can be used in a cell "
|
||||
"instance filter."};
|
||||
|
|
@ -67,7 +67,7 @@ CellInstanceFilter::set_cell_instances(gsl::span<CellInstance> instances)
|
|||
}
|
||||
|
||||
void
|
||||
CellInstanceFilter::get_all_bins(const Particle* p, int estimator,
|
||||
CellInstanceFilter::get_all_bins(const Particle* p, TallyEstimator estimator,
|
||||
FilterMatch& match) const
|
||||
{
|
||||
gsl::index index_cell = p->coord_[p->n_coord_ - 1].cell;
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
namespace openmc {
|
||||
|
||||
void
|
||||
CellbornFilter::get_all_bins(const Particle* p, int estimator,
|
||||
CellbornFilter::get_all_bins(const Particle* p, TallyEstimator estimator,
|
||||
FilterMatch& match) const
|
||||
{
|
||||
auto search = map_.find(p->cell_born_);
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
namespace openmc {
|
||||
|
||||
void
|
||||
CellFromFilter::get_all_bins(const Particle* p, int estimator,
|
||||
CellFromFilter::get_all_bins(const Particle* p, TallyEstimator estimator,
|
||||
FilterMatch& match) const
|
||||
{
|
||||
for (int i = 0; i < p->n_coord_last_; i++) {
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ DelayedGroupFilter::set_groups(gsl::span<int> groups)
|
|||
}
|
||||
|
||||
void
|
||||
DelayedGroupFilter::get_all_bins(const Particle* p, int estimator,
|
||||
DelayedGroupFilter::get_all_bins(const Particle* p, TallyEstimator estimator,
|
||||
FilterMatch& match) const
|
||||
{
|
||||
match.bins_.push_back(0);
|
||||
|
|
|
|||
|
|
@ -38,16 +38,16 @@ DistribcellFilter::set_cell(int32_t cell)
|
|||
}
|
||||
|
||||
void
|
||||
DistribcellFilter::get_all_bins(const Particle* p, int estimator,
|
||||
DistribcellFilter::get_all_bins(const Particle* p, TallyEstimator estimator,
|
||||
FilterMatch& match) const
|
||||
{
|
||||
int offset = 0;
|
||||
auto distribcell_index = model::cells[cell_]->distribcell_index_;
|
||||
for (int i = 0; i < p->n_coord_; i++) {
|
||||
auto& c {*model::cells[p->coord_[i].cell]};
|
||||
if (c.type_ == FILL_UNIVERSE) {
|
||||
if (c.type_ == Fill::UNIVERSE) {
|
||||
offset += c.offset_[distribcell_index];
|
||||
} else if (c.type_ == FILL_LATTICE) {
|
||||
} else if (c.type_ == Fill::LATTICE) {
|
||||
auto& lat {*model::lattices[p->coord_[i+1].lattice]};
|
||||
int i_xyz[3] {p->coord_[i+1].lattice_x,
|
||||
p->coord_[i+1].lattice_y,
|
||||
|
|
|
|||
|
|
@ -56,11 +56,11 @@ EnergyFilter::set_bins(gsl::span<const double> bins)
|
|||
}
|
||||
|
||||
void
|
||||
EnergyFilter::get_all_bins(const Particle* p, int estimator, FilterMatch& match)
|
||||
EnergyFilter::get_all_bins(const Particle* p, TallyEstimator estimator, FilterMatch& match)
|
||||
const
|
||||
{
|
||||
if (p->g_ != F90_NONE && matches_transport_groups_) {
|
||||
if (estimator == ESTIMATOR_TRACKLENGTH) {
|
||||
if (estimator == TallyEstimator::TRACKLENGTH) {
|
||||
match.bins_.push_back(data::mg.num_energy_groups_ - p->g_ - 1);
|
||||
} else {
|
||||
match.bins_.push_back(data::mg.num_energy_groups_ - p->g_last_ - 1);
|
||||
|
|
@ -100,7 +100,7 @@ EnergyFilter::text_label(int bin) const
|
|||
//==============================================================================
|
||||
|
||||
void
|
||||
EnergyoutFilter::get_all_bins(const Particle* p, int estimator,
|
||||
EnergyoutFilter::get_all_bins(const Particle* p, TallyEstimator estimator,
|
||||
FilterMatch& match) const
|
||||
{
|
||||
if (p->g_ != F90_NONE && matches_transport_groups_) {
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ EnergyFunctionFilter::set_data(gsl::span<const double> energy,
|
|||
}
|
||||
|
||||
void
|
||||
EnergyFunctionFilter::get_all_bins(const Particle* p, int estimator,
|
||||
EnergyFunctionFilter::get_all_bins(const Particle* p, TallyEstimator estimator,
|
||||
FilterMatch& match) const
|
||||
{
|
||||
if (p->E_last_ >= energy_.front() && p->E_last_ <= energy_.back()) {
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ LegendreFilter::set_order(int order)
|
|||
}
|
||||
|
||||
void
|
||||
LegendreFilter::get_all_bins(const Particle* p, int estimator,
|
||||
LegendreFilter::get_all_bins(const Particle* p, TallyEstimator estimator,
|
||||
FilterMatch& match) const
|
||||
{
|
||||
std::vector<double> wgt(n_bins_);
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ MaterialFilter::set_materials(gsl::span<const int32_t> materials)
|
|||
}
|
||||
|
||||
void
|
||||
MaterialFilter::get_all_bins(const Particle* p, int estimator,
|
||||
MaterialFilter::get_all_bins(const Particle* p, TallyEstimator estimator,
|
||||
FilterMatch& match) const
|
||||
{
|
||||
auto search = map_.find(p->material_);
|
||||
|
|
|
|||
|
|
@ -31,10 +31,10 @@ MeshFilter::from_xml(pugi::xml_node node)
|
|||
}
|
||||
|
||||
void
|
||||
MeshFilter::get_all_bins(const Particle* p, int estimator, FilterMatch& match)
|
||||
MeshFilter::get_all_bins(const Particle* p, TallyEstimator estimator, FilterMatch& match)
|
||||
const
|
||||
{
|
||||
if (estimator != ESTIMATOR_TRACKLENGTH) {
|
||||
if (estimator != TallyEstimator::TRACKLENGTH) {
|
||||
auto bin = model::meshes[mesh_]->get_bin(p->r());
|
||||
if (bin >= 0) {
|
||||
match.bins_.push_back(bin);
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
namespace openmc {
|
||||
|
||||
void
|
||||
MeshSurfaceFilter::get_all_bins(const Particle* p, int estimator,
|
||||
MeshSurfaceFilter::get_all_bins(const Particle* p, TallyEstimator estimator,
|
||||
FilterMatch& match) const
|
||||
{
|
||||
model::meshes[mesh_]->surface_bins_crossed(p, match.bins_);
|
||||
|
|
@ -23,47 +23,47 @@ MeshSurfaceFilter::text_label(int bin) const
|
|||
|
||||
// Get flattend mesh index and surface index.
|
||||
int i_mesh = bin / (4 * n_dim);
|
||||
int i_surf = (bin % (4 * n_dim)) + 1;
|
||||
MeshDir surf_dir = static_cast<MeshDir>(bin % (4 * n_dim));
|
||||
|
||||
// Get mesh index part of label.
|
||||
std::string out = MeshFilter::text_label(i_mesh);
|
||||
|
||||
// Get surface part of label.
|
||||
switch (i_surf) {
|
||||
case OUT_LEFT:
|
||||
switch (surf_dir) {
|
||||
case MeshDir::OUT_LEFT:
|
||||
out += " Outgoing, x-min";
|
||||
break;
|
||||
case IN_LEFT:
|
||||
case MeshDir::IN_LEFT:
|
||||
out += " Incoming, x-min";
|
||||
break;
|
||||
case OUT_RIGHT:
|
||||
case MeshDir::OUT_RIGHT:
|
||||
out += " Outgoing, x-max";
|
||||
break;
|
||||
case IN_RIGHT:
|
||||
case MeshDir::IN_RIGHT:
|
||||
out += " Incoming, x-max";
|
||||
break;
|
||||
case OUT_BACK:
|
||||
case MeshDir::OUT_BACK:
|
||||
out += " Outgoing, y-min";
|
||||
break;
|
||||
case IN_BACK:
|
||||
case MeshDir::IN_BACK:
|
||||
out += " Incoming, y-min";
|
||||
break;
|
||||
case OUT_FRONT:
|
||||
case MeshDir::OUT_FRONT:
|
||||
out += " Outgoing, y-max";
|
||||
break;
|
||||
case IN_FRONT:
|
||||
case MeshDir::IN_FRONT:
|
||||
out += " Incoming, y-max";
|
||||
break;
|
||||
case OUT_BOTTOM:
|
||||
case MeshDir::OUT_BOTTOM:
|
||||
out += " Outgoing, z-min";
|
||||
break;
|
||||
case IN_BOTTOM:
|
||||
case MeshDir::IN_BOTTOM:
|
||||
out += " Incoming, z-min";
|
||||
break;
|
||||
case OUT_TOP:
|
||||
case MeshDir::OUT_TOP:
|
||||
out += " Outgoing, z-max";
|
||||
break;
|
||||
case IN_TOP:
|
||||
case MeshDir::IN_TOP:
|
||||
out += " Incoming, z-max";
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ MuFilter::set_bins(gsl::span<double> bins)
|
|||
}
|
||||
|
||||
void
|
||||
MuFilter::get_all_bins(const Particle* p, int estimator, FilterMatch& match)
|
||||
MuFilter::get_all_bins(const Particle* p, TallyEstimator estimator, FilterMatch& match)
|
||||
const
|
||||
{
|
||||
if (p->mu_ >= bins_.front() && p->mu_ <= bins_.back()) {
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ ParticleFilter::set_particles(gsl::span<Particle::Type> particles)
|
|||
}
|
||||
|
||||
void
|
||||
ParticleFilter::get_all_bins(const Particle* p, int estimator,
|
||||
ParticleFilter::get_all_bins(const Particle* p, TallyEstimator estimator,
|
||||
FilterMatch& match) const
|
||||
{
|
||||
for (auto i = 0; i < particles_.size(); i++) {
|
||||
|
|
|
|||
|
|
@ -50,11 +50,11 @@ PolarFilter::set_bins(gsl::span<double> bins)
|
|||
}
|
||||
|
||||
void
|
||||
PolarFilter::get_all_bins(const Particle* p, int estimator, FilterMatch& match)
|
||||
PolarFilter::get_all_bins(const Particle* p, TallyEstimator estimator, FilterMatch& match)
|
||||
const
|
||||
{
|
||||
double theta;
|
||||
if (estimator == ESTIMATOR_TRACKLENGTH) {
|
||||
if (estimator == TallyEstimator::TRACKLENGTH) {
|
||||
theta = std::acos(p->u().z);
|
||||
} else {
|
||||
theta = std::acos(p->u_last_.z);
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ SphericalHarmonicsFilter::set_cosine(gsl::cstring_span cosine)
|
|||
}
|
||||
|
||||
void
|
||||
SphericalHarmonicsFilter::get_all_bins(const Particle* p, int estimator,
|
||||
SphericalHarmonicsFilter::get_all_bins(const Particle* p, TallyEstimator estimator,
|
||||
FilterMatch& match) const
|
||||
{
|
||||
// Determine cosine term for scatter expansion if necessary
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ SpatialLegendreFilter::set_minmax(double min, double max)
|
|||
}
|
||||
|
||||
void
|
||||
SpatialLegendreFilter::get_all_bins(const Particle* p, int estimator,
|
||||
SpatialLegendreFilter::get_all_bins(const Particle* p, TallyEstimator estimator,
|
||||
FilterMatch& match) const
|
||||
{
|
||||
// Get the coordinate along the axis of interest.
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ SurfaceFilter::set_surfaces(gsl::span<int32_t> surfaces)
|
|||
}
|
||||
|
||||
void
|
||||
SurfaceFilter::get_all_bins(const Particle* p, int estimator,
|
||||
SurfaceFilter::get_all_bins(const Particle* p, TallyEstimator estimator,
|
||||
FilterMatch& match) const
|
||||
{
|
||||
auto search = map_.find(std::abs(p->surface_)-1);
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ UniverseFilter::set_universes(gsl::span<int32_t> universes)
|
|||
}
|
||||
|
||||
void
|
||||
UniverseFilter::get_all_bins(const Particle* p, int estimator,
|
||||
UniverseFilter::get_all_bins(const Particle* p, TallyEstimator estimator,
|
||||
FilterMatch& match) const
|
||||
{
|
||||
for (int i = 0; i < p->n_coord_; i++) {
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ ZernikeFilter::from_xml(pugi::xml_node node)
|
|||
}
|
||||
|
||||
void
|
||||
ZernikeFilter::get_all_bins(const Particle* p, int estimator,
|
||||
ZernikeFilter::get_all_bins(const Particle* p, TallyEstimator estimator,
|
||||
FilterMatch& match) const
|
||||
{
|
||||
// Determine the normalized (r,theta) coordinates.
|
||||
|
|
@ -86,7 +86,7 @@ ZernikeFilter::set_order(int order)
|
|||
//==============================================================================
|
||||
|
||||
void
|
||||
ZernikeRadialFilter::get_all_bins(const Particle* p, int estimator,
|
||||
ZernikeRadialFilter::get_all_bins(const Particle* p, TallyEstimator estimator,
|
||||
FilterMatch& match) const
|
||||
{
|
||||
// Determine the normalized radius coordinate.
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@ namespace openmc {
|
|||
//==============================================================================
|
||||
|
||||
namespace model {
|
||||
std::unordered_map<int, int> tally_map;
|
||||
std::vector<std::unique_ptr<Tally>> tallies;
|
||||
std::vector<int> active_tallies;
|
||||
std::vector<int> active_analog_tallies;
|
||||
|
|
@ -52,7 +53,6 @@ namespace model {
|
|||
std::vector<int> active_collision_tallies;
|
||||
std::vector<int> active_meshsurf_tallies;
|
||||
std::vector<int> active_surface_tallies;
|
||||
std::unordered_map<int, int> tally_map;
|
||||
}
|
||||
|
||||
namespace simulation {
|
||||
|
|
@ -310,15 +310,15 @@ Tally::Tally(pugi::xml_node node)
|
|||
// Change the tally estimator if a filter demands it
|
||||
std::string filt_type = f->type();
|
||||
if (filt_type == "energyout" || filt_type == "legendre") {
|
||||
estimator_ = ESTIMATOR_ANALOG;
|
||||
estimator_ = TallyEstimator::ANALOG;
|
||||
} else if (filt_type == "sphericalharmonics") {
|
||||
auto sf = dynamic_cast<SphericalHarmonicsFilter*>(f);
|
||||
if (sf->cosine() == SphericalHarmonicsCosine::scatter) {
|
||||
estimator_ = ESTIMATOR_ANALOG;
|
||||
estimator_ = TallyEstimator::ANALOG;
|
||||
}
|
||||
} else if (filt_type == "spatiallegendre" || filt_type == "zernike"
|
||||
|| filt_type == "zernikeradial") {
|
||||
estimator_ = ESTIMATOR_COLLISION;
|
||||
estimator_ = TallyEstimator::COLLISION;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -369,7 +369,7 @@ Tally::Tally(pugi::xml_node node)
|
|||
for (auto p : pf->particles()) {
|
||||
if (p == Particle::Type::electron ||
|
||||
p == Particle::Type::positron) {
|
||||
estimator_ = ESTIMATOR_ANALOG;
|
||||
estimator_ = TallyEstimator::ANALOG;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -402,13 +402,13 @@ Tally::Tally(pugi::xml_node node)
|
|||
|
||||
// Only analog or collision estimators are supported for differential
|
||||
// tallies.
|
||||
if (estimator_ == ESTIMATOR_TRACKLENGTH) {
|
||||
estimator_ = ESTIMATOR_COLLISION;
|
||||
if (estimator_ == TallyEstimator::TRACKLENGTH) {
|
||||
estimator_ = TallyEstimator::COLLISION;
|
||||
}
|
||||
|
||||
const auto& deriv = model::tally_derivs[deriv_];
|
||||
if (deriv.variable == DIFF_NUCLIDE_DENSITY
|
||||
|| deriv.variable == DIFF_TEMPERATURE) {
|
||||
if (deriv.variable == DerivativeVariable::NUCLIDE_DENSITY
|
||||
|| deriv.variable == DerivativeVariable::TEMPERATURE) {
|
||||
for (int i_nuc : nuclides_) {
|
||||
if (has_energyout && i_nuc == -1) {
|
||||
fatal_error("Error on tally " + std::to_string(id_)
|
||||
|
|
@ -437,29 +437,29 @@ Tally::Tally(pugi::xml_node node)
|
|||
if (check_for_node(node, "estimator")) {
|
||||
std::string est = get_node_value(node, "estimator");
|
||||
if (est == "analog") {
|
||||
estimator_ = ESTIMATOR_ANALOG;
|
||||
estimator_ = TallyEstimator::ANALOG;
|
||||
} else if (est == "tracklength" || est == "track-length"
|
||||
|| est == "pathlength" || est == "path-length") {
|
||||
// If the estimator was set to an analog estimator, this means the
|
||||
// tally needs post-collision information
|
||||
if (estimator_ == ESTIMATOR_ANALOG) {
|
||||
if (estimator_ == TallyEstimator::ANALOG) {
|
||||
throw std::runtime_error{"Cannot use track-length estimator for tally "
|
||||
+ std::to_string(id_)};
|
||||
}
|
||||
|
||||
// Set estimator to track-length estimator
|
||||
estimator_ = ESTIMATOR_TRACKLENGTH;
|
||||
estimator_ = TallyEstimator::TRACKLENGTH;
|
||||
|
||||
} else if (est == "collision") {
|
||||
// If the estimator was set to an analog estimator, this means the
|
||||
// tally needs post-collision information
|
||||
if (estimator_ == ESTIMATOR_ANALOG) {
|
||||
if (estimator_ == TallyEstimator::ANALOG) {
|
||||
throw std::runtime_error{"Cannot use collision estimator for tally " +
|
||||
std::to_string(id_)};
|
||||
}
|
||||
|
||||
// Set estimator to collision estimator
|
||||
estimator_ = ESTIMATOR_COLLISION;
|
||||
estimator_ = TallyEstimator::COLLISION;
|
||||
|
||||
} else {
|
||||
throw std::runtime_error{"Invalid estimator '" + est + "' on tally " +
|
||||
|
|
@ -615,20 +615,20 @@ Tally::set_scores(const std::vector<std::string>& scores)
|
|||
|
||||
case SCORE_SCATTER:
|
||||
if (legendre_present)
|
||||
estimator_ = ESTIMATOR_ANALOG;
|
||||
estimator_ = TallyEstimator::ANALOG;
|
||||
case SCORE_NU_FISSION:
|
||||
case SCORE_DELAYED_NU_FISSION:
|
||||
case SCORE_PROMPT_NU_FISSION:
|
||||
if (energyout_present)
|
||||
estimator_ = ESTIMATOR_ANALOG;
|
||||
estimator_ = TallyEstimator::ANALOG;
|
||||
break;
|
||||
|
||||
case SCORE_NU_SCATTER:
|
||||
if (settings::run_CE) {
|
||||
estimator_ = ESTIMATOR_ANALOG;
|
||||
estimator_ = TallyEstimator::ANALOG;
|
||||
} else {
|
||||
if (energyout_present || legendre_present)
|
||||
estimator_ = ESTIMATOR_ANALOG;
|
||||
estimator_ = TallyEstimator::ANALOG;
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
@ -647,9 +647,9 @@ Tally::set_scores(const std::vector<std::string>& scores)
|
|||
if (meshsurface_present)
|
||||
fatal_error("Cannot tally mesh surface currents in the same tally as "
|
||||
"normal surface currents");
|
||||
type_ = TALLY_SURFACE;
|
||||
type_ = TallyType::SURFACE;
|
||||
} else if (meshsurface_present) {
|
||||
type_ = TALLY_MESH_SURFACE;
|
||||
type_ = TallyType::MESH_SURFACE;
|
||||
} else {
|
||||
fatal_error("Cannot tally currents without surface type filters");
|
||||
}
|
||||
|
|
@ -677,7 +677,7 @@ Tally::set_scores(const std::vector<std::string>& scores)
|
|||
}
|
||||
|
||||
// Make sure current scores are not mixed in with volumetric scores.
|
||||
if (type_ == TALLY_SURFACE || type_ == TALLY_MESH_SURFACE) {
|
||||
if (type_ == TallyType::SURFACE || type_ == TallyType::MESH_SURFACE) {
|
||||
if (scores_.size() != 1)
|
||||
fatal_error("Cannot tally other scores in the same tally as surface "
|
||||
"currents");
|
||||
|
|
@ -823,7 +823,7 @@ void Tally::accumulate()
|
|||
if (mpi::master || !settings::reduce_tallies) {
|
||||
// Calculate total source strength for normalization
|
||||
double total_source = 0.0;
|
||||
if (settings::run_mode == RUN_MODE_FIXEDSOURCE) {
|
||||
if (settings::run_mode == RunMode::FIXED_SOURCE) {
|
||||
for (const auto& s : model::external_sources) {
|
||||
total_source += s.strength();
|
||||
}
|
||||
|
|
@ -837,10 +837,10 @@ void Tally::accumulate()
|
|||
// Accumulate each result
|
||||
for (int i = 0; i < results_.shape()[0]; ++i) {
|
||||
for (int j = 0; j < results_.shape()[1]; ++j) {
|
||||
double val = results_(i, j, RESULT_VALUE) * norm;
|
||||
results_(i, j, RESULT_VALUE) = 0.0;
|
||||
results_(i, j, RESULT_SUM) += val;
|
||||
results_(i, j, RESULT_SUM_SQ) += val*val;
|
||||
double val = results_(i, j, TallyResult::VALUE) * norm;
|
||||
results_(i, j, TallyResult::VALUE) = 0.0;
|
||||
results_(i, j, TallyResult::SUM) += val;
|
||||
results_(i, j, TallyResult::SUM_SQ) += val*val;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -872,7 +872,7 @@ void read_tallies_xml()
|
|||
read_meshes(root);
|
||||
|
||||
// We only need the mesh info for plotting
|
||||
if (settings::run_mode == RUN_MODE_PLOTTING) return;
|
||||
if (settings::run_mode == RunMode::PLOTTING) return;
|
||||
|
||||
// Read data for tally derivatives
|
||||
read_tally_derivatives(root);
|
||||
|
|
@ -908,7 +908,7 @@ void reduce_tally_results()
|
|||
auto& tally {model::tallies[i_tally]};
|
||||
|
||||
// Get view of accumulated tally values
|
||||
auto values_view = xt::view(tally->results_, xt::all(), xt::all(), RESULT_VALUE);
|
||||
auto values_view = xt::view(tally->results_, xt::all(), xt::all(), static_cast<int>(TallyResult::VALUE));
|
||||
|
||||
// Make copy of tally values in contiguous array
|
||||
xt::xtensor<double, 2> values = values_view;
|
||||
|
|
@ -928,7 +928,7 @@ void reduce_tally_results()
|
|||
|
||||
// Get view of global tally values
|
||||
auto& gt = simulation::global_tallies;
|
||||
auto gt_values_view = xt::view(gt, xt::all(), RESULT_VALUE);
|
||||
auto gt_values_view = xt::view(gt, xt::all(), static_cast<int>(TallyResult::VALUE));
|
||||
|
||||
// Make copy of values in contiguous array
|
||||
xt::xtensor<double, 1> gt_values = gt_values_view;
|
||||
|
|
@ -969,12 +969,12 @@ accumulate_tallies()
|
|||
if (mpi::master || !settings::reduce_tallies) {
|
||||
auto& gt = simulation::global_tallies;
|
||||
|
||||
if (settings::run_mode == RUN_MODE_EIGENVALUE) {
|
||||
if (settings::run_mode == RunMode::EIGENVALUE) {
|
||||
if (simulation::current_batch > settings::n_inactive) {
|
||||
// Accumulate products of different estimators of k
|
||||
double k_col = gt(K_COLLISION, RESULT_VALUE) / simulation::total_weight;
|
||||
double k_abs = gt(K_ABSORPTION, RESULT_VALUE) / simulation::total_weight;
|
||||
double k_tra = gt(K_TRACKLENGTH, RESULT_VALUE) / simulation::total_weight;
|
||||
double k_col = gt(GlobalTally::K_COLLISION, TallyResult::VALUE) / simulation::total_weight;
|
||||
double k_abs = gt(GlobalTally::K_ABSORPTION, TallyResult::VALUE) / simulation::total_weight;
|
||||
double k_tra = gt(GlobalTally::K_TRACKLENGTH, TallyResult::VALUE) / simulation::total_weight;
|
||||
simulation::k_col_abs += k_col * k_abs;
|
||||
simulation::k_col_tra += k_col * k_tra;
|
||||
simulation::k_abs_tra += k_abs * k_tra;
|
||||
|
|
@ -983,10 +983,10 @@ accumulate_tallies()
|
|||
|
||||
// Accumulate results for global tallies
|
||||
for (int i = 0; i < N_GLOBAL_TALLIES; ++i) {
|
||||
double val = gt(i, RESULT_VALUE)/simulation::total_weight;
|
||||
gt(i, RESULT_VALUE) = 0.0;
|
||||
gt(i, RESULT_SUM) += val;
|
||||
gt(i, RESULT_SUM_SQ) += val*val;
|
||||
double val = gt(i, TallyResult::VALUE)/simulation::total_weight;
|
||||
gt(i, TallyResult::VALUE) = 0.0;
|
||||
gt(i, TallyResult::SUM) += val;
|
||||
gt(i, TallyResult::SUM_SQ) += val*val;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1014,24 +1014,24 @@ setup_active_tallies()
|
|||
model::active_tallies.push_back(i);
|
||||
switch (tally.type_) {
|
||||
|
||||
case TALLY_VOLUME:
|
||||
case TallyType::VOLUME:
|
||||
switch (tally.estimator_) {
|
||||
case ESTIMATOR_ANALOG:
|
||||
case TallyEstimator::ANALOG:
|
||||
model::active_analog_tallies.push_back(i);
|
||||
break;
|
||||
case ESTIMATOR_TRACKLENGTH:
|
||||
case TallyEstimator::TRACKLENGTH:
|
||||
model::active_tracklength_tallies.push_back(i);
|
||||
break;
|
||||
case ESTIMATOR_COLLISION:
|
||||
case TallyEstimator::COLLISION:
|
||||
model::active_collision_tallies.push_back(i);
|
||||
}
|
||||
break;
|
||||
|
||||
case TALLY_MESH_SURFACE:
|
||||
case TallyType::MESH_SURFACE:
|
||||
model::active_meshsurf_tallies.push_back(i);
|
||||
break;
|
||||
|
||||
case TALLY_SURFACE:
|
||||
case TallyType::SURFACE:
|
||||
model::active_surface_tallies.push_back(i);
|
||||
}
|
||||
|
||||
|
|
@ -1108,7 +1108,7 @@ openmc_tally_get_estimator(int32_t index, int* estimator)
|
|||
return OPENMC_E_OUT_OF_BOUNDS;
|
||||
}
|
||||
|
||||
*estimator = model::tallies[index]->estimator_;
|
||||
*estimator = static_cast<int>(model::tallies[index]->estimator_);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -1124,11 +1124,11 @@ openmc_tally_set_estimator(int32_t index, const char* estimator)
|
|||
|
||||
std::string est = estimator;
|
||||
if (est == "analog") {
|
||||
t->estimator_ = ESTIMATOR_ANALOG;
|
||||
t->estimator_ = TallyEstimator::ANALOG;
|
||||
} else if (est == "collision") {
|
||||
t->estimator_ = ESTIMATOR_COLLISION;
|
||||
t->estimator_ = TallyEstimator::COLLISION;
|
||||
} else if (est == "tracklength") {
|
||||
t->estimator_ = ESTIMATOR_TRACKLENGTH;
|
||||
t->estimator_ = TallyEstimator::TRACKLENGTH;
|
||||
} else {
|
||||
set_errmsg("Unknown tally estimator: " + est);
|
||||
return OPENMC_E_INVALID_ARGUMENT;
|
||||
|
|
@ -1167,7 +1167,7 @@ openmc_tally_get_type(int32_t index, int32_t* type)
|
|||
set_errmsg("Index in tallies array is out of bounds.");
|
||||
return OPENMC_E_OUT_OF_BOUNDS;
|
||||
}
|
||||
*type = model::tallies[index]->type_;
|
||||
*type = static_cast<int>(model::tallies[index]->type_);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -1180,11 +1180,11 @@ openmc_tally_set_type(int32_t index, const char* type)
|
|||
return OPENMC_E_OUT_OF_BOUNDS;
|
||||
}
|
||||
if (strcmp(type, "volume") == 0) {
|
||||
model::tallies[index]->type_ = TALLY_VOLUME;
|
||||
model::tallies[index]->type_ = TallyType::VOLUME;
|
||||
} else if (strcmp(type, "mesh-surface") == 0) {
|
||||
model::tallies[index]->type_ = TALLY_MESH_SURFACE;
|
||||
model::tallies[index]->type_ = TallyType::MESH_SURFACE;
|
||||
} else if (strcmp(type, "surface") == 0) {
|
||||
model::tallies[index]->type_ = TALLY_SURFACE;
|
||||
model::tallies[index]->type_ = TallyType::SURFACE;
|
||||
} else {
|
||||
std::stringstream errmsg;
|
||||
errmsg << "Unknown tally type: " << type;
|
||||
|
|
|
|||
|
|
@ -167,7 +167,7 @@ score_fission_delayed_dg(int i_tally, int d_bin, double score, int score_index,
|
|||
|
||||
// Update the tally result
|
||||
#pragma omp atomic
|
||||
tally.results_(filter_index, score_index, RESULT_VALUE) += score;
|
||||
tally.results_(filter_index, score_index, TallyResult::VALUE) += score;
|
||||
|
||||
// Reset the original delayed group bin
|
||||
dg_match.bins_[i_bin] = original_bin;
|
||||
|
|
@ -197,7 +197,7 @@ double get_nuc_fission_q(const Nuclide& nuc, const Particle* p, int score_bin)
|
|||
double score_fission_q(const Particle* p, int score_bin, const Tally& tally,
|
||||
double flux, int i_nuclide, double atom_density)
|
||||
{
|
||||
if (tally.estimator_ == ESTIMATOR_ANALOG) {
|
||||
if (tally.estimator_ == TallyEstimator::ANALOG) {
|
||||
const Nuclide& nuc {*data::nuclides[p->event_nuclide_]};
|
||||
if (settings::survival_biasing) {
|
||||
// No fission events occur if survival biasing is on -- need to
|
||||
|
|
@ -210,7 +210,7 @@ double score_fission_q(const Particle* p, int score_bin, const Tally& tally,
|
|||
}
|
||||
} else {
|
||||
// Skip any non-absorption events
|
||||
if (p->event_ == EVENT_SCATTER) return 0.0;
|
||||
if (p->event_ == TallyEvent::SCATTER) return 0.0;
|
||||
// All fission events will contribute, so again we can use particle's
|
||||
// weight entering the collision as the estimate for the fission
|
||||
// reaction rate
|
||||
|
|
@ -275,7 +275,7 @@ double score_neutron_heating(const Particle* p, const Tally& tally, double flux,
|
|||
if (i_nuclide >= 0) {
|
||||
const Nuclide& nuc {*data::nuclides[i_nuclide]};
|
||||
heating_xs = get_nuclide_neutron_heating(p, nuc, rxn_bin, i_nuclide);
|
||||
if (tally.estimator_ == ESTIMATOR_ANALOG) {
|
||||
if (tally.estimator_ == TallyEstimator::ANALOG) {
|
||||
heating_xs /= p->neutron_xs_[i_nuclide].total;
|
||||
} else {
|
||||
heating_xs *= atom_density;
|
||||
|
|
@ -290,13 +290,13 @@ double score_neutron_heating(const Particle* p, const Tally& tally, double flux,
|
|||
const Nuclide& nuc {*data::nuclides[j_nuclide]};
|
||||
heating_xs += atom_density * get_nuclide_neutron_heating(p, nuc, rxn_bin, j_nuclide);
|
||||
}
|
||||
if (tally.estimator_ == ESTIMATOR_ANALOG) {
|
||||
if (tally.estimator_ == TallyEstimator::ANALOG) {
|
||||
heating_xs /= p->macro_xs_.total;
|
||||
}
|
||||
}
|
||||
}
|
||||
score = heating_xs * flux;
|
||||
if (tally.estimator_ == ESTIMATOR_ANALOG) {
|
||||
if (tally.estimator_ == TallyEstimator::ANALOG) {
|
||||
// All events score to a heating tally bin. We actually use a
|
||||
// collision estimator in place of an analog one since there is no
|
||||
// reaction-wise heating cross section
|
||||
|
|
@ -395,7 +395,7 @@ score_fission_eout(Particle* p, int i_tally, int i_score, int score_bin)
|
|||
|
||||
// Update tally results
|
||||
#pragma omp atomic
|
||||
tally.results_(filter_index, i_score, RESULT_VALUE) += score;
|
||||
tally.results_(filter_index, i_score, TallyResult::VALUE) += score;
|
||||
|
||||
} else if (score_bin == SCORE_DELAYED_NU_FISSION && g != 0) {
|
||||
|
||||
|
|
@ -442,7 +442,7 @@ score_fission_eout(Particle* p, int i_tally, int i_score, int score_bin)
|
|||
|
||||
// Update tally results
|
||||
#pragma omp atomic
|
||||
tally.results_(filter_index, i_score, RESULT_VALUE) += score*filter_weight;
|
||||
tally.results_(filter_index, i_score, TallyResult::VALUE) += score*filter_weight;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -476,7 +476,7 @@ score_general_ce(Particle* p, int i_tally, int start_index,
|
|||
|
||||
|
||||
case SCORE_FLUX:
|
||||
if (tally.estimator_ == ESTIMATOR_ANALOG) {
|
||||
if (tally.estimator_ == TallyEstimator::ANALOG) {
|
||||
// All events score to a flux bin. We actually use a collision estimator
|
||||
// in place of an analog one since there is no way to count 'events'
|
||||
// exactly for the flux
|
||||
|
|
@ -501,7 +501,7 @@ score_general_ce(Particle* p, int i_tally, int start_index,
|
|||
|
||||
|
||||
case SCORE_TOTAL:
|
||||
if (tally.estimator_ == ESTIMATOR_ANALOG) {
|
||||
if (tally.estimator_ == TallyEstimator::ANALOG) {
|
||||
// All events will score to the total reaction rate. We can just use
|
||||
// use the weight of the particle entering the collision as the score
|
||||
if (settings::survival_biasing) {
|
||||
|
|
@ -523,7 +523,7 @@ score_general_ce(Particle* p, int i_tally, int start_index,
|
|||
|
||||
|
||||
case SCORE_INVERSE_VELOCITY:
|
||||
if (tally.estimator_ == ESTIMATOR_ANALOG) {
|
||||
if (tally.estimator_ == TallyEstimator::ANALOG) {
|
||||
// All events score to an inverse velocity bin. We actually use a
|
||||
// collision estimator in place of an analog one since there is no way
|
||||
// to count 'events' exactly for the inverse velocity
|
||||
|
|
@ -544,9 +544,9 @@ score_general_ce(Particle* p, int i_tally, int start_index,
|
|||
|
||||
|
||||
case SCORE_SCATTER:
|
||||
if (tally.estimator_ == ESTIMATOR_ANALOG) {
|
||||
if (tally.estimator_ == TallyEstimator::ANALOG) {
|
||||
// Skip any event where the particle didn't scatter
|
||||
if (p->event_ != EVENT_SCATTER) continue;
|
||||
if (p->event_ != TallyEvent::SCATTER) continue;
|
||||
// Since only scattering events make it here, again we can use the
|
||||
// weight entering the collision as the estimator for the reaction rate
|
||||
score = p->wgt_last_ * flux;
|
||||
|
|
@ -565,7 +565,7 @@ score_general_ce(Particle* p, int i_tally, int start_index,
|
|||
case SCORE_NU_SCATTER:
|
||||
// Only analog estimators are available.
|
||||
// Skip any event where the particle didn't scatter
|
||||
if (p->event_ != EVENT_SCATTER) continue;
|
||||
if (p->event_ != TallyEvent::SCATTER) continue;
|
||||
// For scattering production, we need to use the pre-collision weight
|
||||
// times the yield as the estimate for the number of neutrons exiting a
|
||||
// reaction with neutrons in the exit channel
|
||||
|
|
@ -585,14 +585,14 @@ score_general_ce(Particle* p, int i_tally, int start_index,
|
|||
|
||||
|
||||
case SCORE_ABSORPTION:
|
||||
if (tally.estimator_ == ESTIMATOR_ANALOG) {
|
||||
if (tally.estimator_ == TallyEstimator::ANALOG) {
|
||||
if (settings::survival_biasing) {
|
||||
// No absorption events actually occur if survival biasing is on --
|
||||
// just use weight absorbed in survival biasing
|
||||
score = p->wgt_absorb_ * flux;
|
||||
} else {
|
||||
// Skip any event where the particle wasn't absorbed
|
||||
if (p->event_ == EVENT_SCATTER) continue;
|
||||
if (p->event_ == TallyEvent::SCATTER) continue;
|
||||
// All fission and absorption events will contribute here, so we
|
||||
// can just use the particle's weight entering the collision
|
||||
score = p->wgt_last_ * flux;
|
||||
|
|
@ -610,7 +610,7 @@ score_general_ce(Particle* p, int i_tally, int start_index,
|
|||
|
||||
case SCORE_FISSION:
|
||||
if (p->macro_xs_.absorption == 0) continue;
|
||||
if (tally.estimator_ == ESTIMATOR_ANALOG) {
|
||||
if (tally.estimator_ == TallyEstimator::ANALOG) {
|
||||
if (settings::survival_biasing) {
|
||||
// No fission events occur if survival biasing is on -- need to
|
||||
// calculate fraction of absorptions that would have resulted in
|
||||
|
|
@ -624,7 +624,7 @@ score_general_ce(Particle* p, int i_tally, int start_index,
|
|||
}
|
||||
} else {
|
||||
// Skip any non-absorption events
|
||||
if (p->event_ == EVENT_SCATTER) continue;
|
||||
if (p->event_ == TallyEvent::SCATTER) continue;
|
||||
// All fission events will contribute, so again we can use particle's
|
||||
// weight entering the collision as the estimate for the fission
|
||||
// reaction rate
|
||||
|
|
@ -644,7 +644,7 @@ score_general_ce(Particle* p, int i_tally, int start_index,
|
|||
|
||||
case SCORE_NU_FISSION:
|
||||
if (p->macro_xs_.absorption == 0) continue;
|
||||
if (tally.estimator_ == ESTIMATOR_ANALOG) {
|
||||
if (tally.estimator_ == TallyEstimator::ANALOG) {
|
||||
if (settings::survival_biasing || p->fission_) {
|
||||
if (tally.energyout_filter_ != C_NONE) {
|
||||
// Fission has multiple outgoing neutrons so this helper function
|
||||
|
|
@ -687,7 +687,7 @@ score_general_ce(Particle* p, int i_tally, int start_index,
|
|||
|
||||
case SCORE_PROMPT_NU_FISSION:
|
||||
if (p->macro_xs_.absorption == 0) continue;
|
||||
if (tally.estimator_ == ESTIMATOR_ANALOG) {
|
||||
if (tally.estimator_ == TallyEstimator::ANALOG) {
|
||||
if (settings::survival_biasing || p->fission_) {
|
||||
if (tally.energyout_filter_ != C_NONE) {
|
||||
// Fission has multiple outgoing neutrons so this helper function
|
||||
|
|
@ -749,7 +749,7 @@ score_general_ce(Particle* p, int i_tally, int start_index,
|
|||
|
||||
case SCORE_DELAYED_NU_FISSION:
|
||||
if (p->macro_xs_.absorption == 0) continue;
|
||||
if (tally.estimator_ == ESTIMATOR_ANALOG) {
|
||||
if (tally.estimator_ == TallyEstimator::ANALOG) {
|
||||
if (settings::survival_biasing || p->fission_) {
|
||||
if (tally.energyout_filter_ != C_NONE) {
|
||||
// Fission has multiple outgoing neutrons so this helper function
|
||||
|
|
@ -893,7 +893,7 @@ score_general_ce(Particle* p, int i_tally, int start_index,
|
|||
|
||||
case SCORE_DECAY_RATE:
|
||||
if (p->macro_xs_.absorption == 0) continue;
|
||||
if (tally.estimator_ == ESTIMATOR_ANALOG) {
|
||||
if (tally.estimator_ == TallyEstimator::ANALOG) {
|
||||
if (settings::survival_biasing) {
|
||||
// No fission events occur if survival biasing is on -- need to
|
||||
// calculate fraction of absorptions that would have resulted in
|
||||
|
|
@ -1079,7 +1079,7 @@ score_general_ce(Particle* p, int i_tally, int start_index,
|
|||
score = 0.;
|
||||
// Kappa-fission values are determined from the Q-value listed for the
|
||||
// fission cross section.
|
||||
if (tally.estimator_ == ESTIMATOR_ANALOG) {
|
||||
if (tally.estimator_ == TallyEstimator::ANALOG) {
|
||||
if (settings::survival_biasing) {
|
||||
// No fission events occur if survival biasing is on -- need to
|
||||
// calculate fraction of absorptions that would have resulted in
|
||||
|
|
@ -1094,7 +1094,7 @@ score_general_ce(Particle* p, int i_tally, int start_index,
|
|||
}
|
||||
} else {
|
||||
// Skip any non-absorption events
|
||||
if (p->event_ == EVENT_SCATTER) continue;
|
||||
if (p->event_ == TallyEvent::SCATTER) continue;
|
||||
// All fission events will contribute, so again we can use particle's
|
||||
// weight entering the collision as the estimate for the fission
|
||||
// reaction rate
|
||||
|
|
@ -1141,7 +1141,7 @@ score_general_ce(Particle* p, int i_tally, int start_index,
|
|||
|
||||
|
||||
case ELASTIC:
|
||||
if (tally.estimator_ == ESTIMATOR_ANALOG) {
|
||||
if (tally.estimator_ == TallyEstimator::ANALOG) {
|
||||
// Check if event MT matches
|
||||
if (p->event_mt_ != ELASTIC) continue;
|
||||
score = p->wgt_last_ * flux;
|
||||
|
|
@ -1180,7 +1180,7 @@ score_general_ce(Particle* p, int i_tally, int start_index,
|
|||
case N_GAMMA:
|
||||
case N_P:
|
||||
case N_A:
|
||||
if (tally.estimator_ == ESTIMATOR_ANALOG) {
|
||||
if (tally.estimator_ == TallyEstimator::ANALOG) {
|
||||
// Check if the event MT matches
|
||||
if (p->event_mt_ != score_bin) continue;
|
||||
score = p->wgt_last_ * flux;
|
||||
|
|
@ -1219,7 +1219,7 @@ score_general_ce(Particle* p, int i_tally, int start_index,
|
|||
score = score_neutron_heating(p, tally, flux, HEATING,
|
||||
i_nuclide, atom_density);
|
||||
} else if (p->type_ == Particle::Type::photon) {
|
||||
if (tally.estimator_ == ESTIMATOR_ANALOG) {
|
||||
if (tally.estimator_ == TallyEstimator::ANALOG) {
|
||||
// Score direct energy deposition in the collision
|
||||
score = E - p->E_;
|
||||
// We need to substract the energy of the secondary particles since
|
||||
|
|
@ -1267,11 +1267,13 @@ score_general_ce(Particle* p, int i_tally, int start_index,
|
|||
break;
|
||||
|
||||
default:
|
||||
|
||||
// The default block is really only meant for redundant neutron reactions
|
||||
// (e.g. 444, 901)
|
||||
if (p->type_ != Particle::Type::neutron) continue;
|
||||
|
||||
if (tally.estimator_ == ESTIMATOR_ANALOG) {
|
||||
if (tally.estimator_ == TallyEstimator::ANALOG) {
|
||||
|
||||
// Any other score is assumed to be a MT number. Thus, we just need
|
||||
// to check if it matches the MT number of the event
|
||||
if (p->event_mt_ != score_bin) continue;
|
||||
|
|
@ -1330,7 +1332,7 @@ score_general_ce(Particle* p, int i_tally, int start_index,
|
|||
|
||||
// Update tally results
|
||||
#pragma omp atomic
|
||||
tally.results_(filter_index, score_index, RESULT_VALUE) += score;
|
||||
tally.results_(filter_index, score_index, TallyResult::VALUE) += score;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1348,8 +1350,8 @@ score_general_mg(Particle* p, int i_tally, int start_index,
|
|||
// Set the direction and group to use with get_xs
|
||||
Direction p_u;
|
||||
int p_g;
|
||||
if (tally.estimator_ == ESTIMATOR_ANALOG
|
||||
|| tally.estimator_ == ESTIMATOR_COLLISION) {
|
||||
if (tally.estimator_ == TallyEstimator::ANALOG
|
||||
|| tally.estimator_ == TallyEstimator::COLLISION) {
|
||||
|
||||
if (settings::survival_biasing) {
|
||||
|
||||
|
|
@ -1362,7 +1364,7 @@ score_general_mg(Particle* p, int i_tally, int start_index,
|
|||
p_u = p->u_local();
|
||||
p_g = p->g_;
|
||||
}
|
||||
} else if (p->event_ == EVENT_SCATTER) {
|
||||
} else if (p->event_ == TallyEvent::SCATTER) {
|
||||
|
||||
// Then the energy group has been changed by the scattering routine
|
||||
// meaning gin is now in p % last_g
|
||||
|
|
@ -1402,7 +1404,7 @@ score_general_mg(Particle* p, int i_tally, int start_index,
|
|||
|
||||
|
||||
case SCORE_FLUX:
|
||||
if (tally.estimator_ == ESTIMATOR_ANALOG) {
|
||||
if (tally.estimator_ == TallyEstimator::ANALOG) {
|
||||
// All events score to a flux bin. We actually use a collision estimator
|
||||
// in place of an analog one since there is no way to count 'events'
|
||||
// exactly for the flux
|
||||
|
|
@ -1421,7 +1423,7 @@ score_general_mg(Particle* p, int i_tally, int start_index,
|
|||
|
||||
|
||||
case SCORE_TOTAL:
|
||||
if (tally.estimator_ == ESTIMATOR_ANALOG) {
|
||||
if (tally.estimator_ == TallyEstimator::ANALOG) {
|
||||
// All events will score to the total reaction rate. We can just use
|
||||
// use the weight of the particle entering the collision as the score
|
||||
if (settings::survival_biasing) {
|
||||
|
|
@ -1433,12 +1435,12 @@ score_general_mg(Particle* p, int i_tally, int start_index,
|
|||
}
|
||||
//TODO: should flux be multiplied in above instead of below?
|
||||
if (i_nuclide >= 0) {
|
||||
score *= flux * atom_density * nuc_xs.get_xs(MG_GET_XS_TOTAL, p_g)
|
||||
/ macro_xs.get_xs(MG_GET_XS_TOTAL, p_g);
|
||||
score *= flux * atom_density * nuc_xs.get_xs(MgxsType::TOTAL, p_g)
|
||||
/ macro_xs.get_xs(MgxsType::TOTAL, p_g);
|
||||
}
|
||||
} else {
|
||||
if (i_nuclide >= 0) {
|
||||
score = atom_density * flux * nuc_xs.get_xs(MG_GET_XS_TOTAL, p_g);
|
||||
score = atom_density * flux * nuc_xs.get_xs(MgxsType::TOTAL, p_g);
|
||||
} else {
|
||||
score = p->macro_xs_.total * flux;
|
||||
}
|
||||
|
|
@ -1447,8 +1449,8 @@ score_general_mg(Particle* p, int i_tally, int start_index,
|
|||
|
||||
|
||||
case SCORE_INVERSE_VELOCITY:
|
||||
if (tally.estimator_ == ESTIMATOR_ANALOG
|
||||
|| tally.estimator_ == ESTIMATOR_COLLISION) {
|
||||
if (tally.estimator_ == TallyEstimator::ANALOG
|
||||
|| tally.estimator_ == TallyEstimator::COLLISION) {
|
||||
// All events score to an inverse velocity bin. We actually use a
|
||||
// collision estimator in place of an analog one since there is no way
|
||||
// to count 'events' exactly for the inverse velocity
|
||||
|
|
@ -1460,51 +1462,51 @@ score_general_mg(Particle* p, int i_tally, int start_index,
|
|||
score = p->wgt_last_;
|
||||
}
|
||||
if (i_nuclide >= 0) {
|
||||
score *= flux * nuc_xs.get_xs(MG_GET_XS_INVERSE_VELOCITY, p_g)
|
||||
/ macro_xs.get_xs(MG_GET_XS_TOTAL, p_g);
|
||||
score *= flux * nuc_xs.get_xs(MgxsType::INVERSE_VELOCITY, p_g)
|
||||
/ macro_xs.get_xs(MgxsType::TOTAL, p_g);
|
||||
} else {
|
||||
score *= flux * macro_xs.get_xs(MG_GET_XS_INVERSE_VELOCITY, p_g)
|
||||
/ macro_xs.get_xs(MG_GET_XS_TOTAL, p_g);
|
||||
score *= flux * macro_xs.get_xs(MgxsType::INVERSE_VELOCITY, p_g)
|
||||
/ macro_xs.get_xs(MgxsType::TOTAL, p_g);
|
||||
}
|
||||
} else {
|
||||
if (i_nuclide >= 0) {
|
||||
score = flux * nuc_xs.get_xs(MG_GET_XS_INVERSE_VELOCITY, p_g);
|
||||
score = flux * nuc_xs.get_xs(MgxsType::INVERSE_VELOCITY, p_g);
|
||||
} else {
|
||||
score = flux * macro_xs.get_xs(MG_GET_XS_INVERSE_VELOCITY, p_g);
|
||||
score = flux * macro_xs.get_xs(MgxsType::INVERSE_VELOCITY, p_g);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case SCORE_SCATTER:
|
||||
if (tally.estimator_ == ESTIMATOR_ANALOG) {
|
||||
if (tally.estimator_ == TallyEstimator::ANALOG) {
|
||||
// Skip any event where the particle didn't scatter
|
||||
if (p->event_ != EVENT_SCATTER) continue;
|
||||
if (p->event_ != TallyEvent::SCATTER) continue;
|
||||
// Since only scattering events make it here, again we can use the
|
||||
// weight entering the collision as the estimator for the reaction rate
|
||||
score = p->wgt_last_ * flux;
|
||||
if (i_nuclide >= 0) {
|
||||
score *= atom_density * nuc_xs.get_xs(
|
||||
MG_GET_XS_SCATTER_FMU_MULT, p->g_last_, &p->g_, &p->mu_, nullptr)
|
||||
MgxsType::SCATTER_FMU_MULT, p->g_last_, &p->g_, &p->mu_, nullptr)
|
||||
/ macro_xs.get_xs(
|
||||
MG_GET_XS_SCATTER_FMU_MULT, p->g_last_, &p->g_, &p->mu_, nullptr);
|
||||
MgxsType::SCATTER_FMU_MULT, p->g_last_, &p->g_, &p->mu_, nullptr);
|
||||
}
|
||||
} else {
|
||||
if (i_nuclide >= 0) {
|
||||
score = atom_density * flux * nuc_xs.get_xs(
|
||||
MG_GET_XS_SCATTER_MULT, p_g, nullptr, &p->mu_, nullptr);
|
||||
MgxsType::SCATTER_MULT, p_g, nullptr, &p->mu_, nullptr);
|
||||
} else {
|
||||
score = flux * macro_xs.get_xs(
|
||||
MG_GET_XS_SCATTER_MULT, p_g, nullptr, &p->mu_, nullptr);
|
||||
MgxsType::SCATTER_MULT, p_g, nullptr, &p->mu_, nullptr);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case SCORE_NU_SCATTER:
|
||||
if (tally.estimator_ == ESTIMATOR_ANALOG) {
|
||||
if (tally.estimator_ == TallyEstimator::ANALOG) {
|
||||
// Skip any event where the particle didn't scatter
|
||||
if (p->event_ != EVENT_SCATTER) continue;
|
||||
if (p->event_ != TallyEvent::SCATTER) continue;
|
||||
// For scattering production, we need to use the pre-collision weight
|
||||
// times the multiplicity as the estimate for the number of neutrons
|
||||
// exiting a reaction with neutrons in the exit channel
|
||||
|
|
@ -1514,42 +1516,42 @@ score_general_mg(Particle* p, int i_tally, int start_index,
|
|||
// adjust the score by the actual probability for that nuclide.
|
||||
if (i_nuclide >= 0) {
|
||||
score *= atom_density
|
||||
* nuc_xs.get_xs(MG_GET_XS_SCATTER_FMU, p->g_last_, &p->g_,
|
||||
* nuc_xs.get_xs(MgxsType::SCATTER_FMU, p->g_last_, &p->g_,
|
||||
&p->mu_, nullptr)
|
||||
/ macro_xs.get_xs(MG_GET_XS_SCATTER_FMU, p->g_last_, &p->g_,
|
||||
/ macro_xs.get_xs(MgxsType::SCATTER_FMU, p->g_last_, &p->g_,
|
||||
&p->mu_, nullptr);
|
||||
}
|
||||
} else {
|
||||
if (i_nuclide >= 0) {
|
||||
score = atom_density * flux * nuc_xs.get_xs(MG_GET_XS_SCATTER, p_g);
|
||||
score = atom_density * flux * nuc_xs.get_xs(MgxsType::SCATTER, p_g);
|
||||
} else {
|
||||
score = flux * macro_xs.get_xs(MG_GET_XS_SCATTER, p_g);
|
||||
score = flux * macro_xs.get_xs(MgxsType::SCATTER, p_g);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case SCORE_ABSORPTION:
|
||||
if (tally.estimator_ == ESTIMATOR_ANALOG) {
|
||||
if (tally.estimator_ == TallyEstimator::ANALOG) {
|
||||
if (settings::survival_biasing) {
|
||||
// No absorption events actually occur if survival biasing is on --
|
||||
// just use weight absorbed in survival biasing
|
||||
score = p->wgt_absorb_ * flux;
|
||||
} else {
|
||||
// Skip any event where the particle wasn't absorbed
|
||||
if (p->event_ == EVENT_SCATTER) continue;
|
||||
if (p->event_ == TallyEvent::SCATTER) continue;
|
||||
// All fission and absorption events will contribute here, so we
|
||||
// can just use the particle's weight entering the collision
|
||||
score = p->wgt_last_ * flux;
|
||||
}
|
||||
if (i_nuclide >= 0) {
|
||||
score *= atom_density * nuc_xs.get_xs(MG_GET_XS_ABSORPTION, p_g)
|
||||
/ macro_xs.get_xs(MG_GET_XS_ABSORPTION, p_g);
|
||||
score *= atom_density * nuc_xs.get_xs(MgxsType::ABSORPTION, p_g)
|
||||
/ macro_xs.get_xs(MgxsType::ABSORPTION, p_g);
|
||||
}
|
||||
} else {
|
||||
if (i_nuclide >= 0) {
|
||||
score = atom_density * flux
|
||||
* nuc_xs.get_xs(MG_GET_XS_ABSORPTION, p_g);
|
||||
* nuc_xs.get_xs(MgxsType::ABSORPTION, p_g);
|
||||
} else {
|
||||
score = p->macro_xs_.absorption * flux;
|
||||
}
|
||||
|
|
@ -1558,7 +1560,7 @@ score_general_mg(Particle* p, int i_tally, int start_index,
|
|||
|
||||
|
||||
case SCORE_FISSION:
|
||||
if (tally.estimator_ == ESTIMATOR_ANALOG) {
|
||||
if (tally.estimator_ == TallyEstimator::ANALOG) {
|
||||
if (settings::survival_biasing) {
|
||||
// No fission events occur if survival biasing is on -- need to
|
||||
// calculate fraction of absorptions that would have resulted in
|
||||
|
|
@ -1566,31 +1568,31 @@ score_general_mg(Particle* p, int i_tally, int start_index,
|
|||
score = p->wgt_absorb_ * flux;
|
||||
} else {
|
||||
// Skip any non-absorption events
|
||||
if (p->event_ == EVENT_SCATTER) continue;
|
||||
if (p->event_ == TallyEvent::SCATTER) continue;
|
||||
// All fission events will contribute, so again we can use particle's
|
||||
// weight entering the collision as the estimate for the fission
|
||||
// reaction rate
|
||||
score = p->wgt_last_ * flux;
|
||||
}
|
||||
if (i_nuclide >= 0) {
|
||||
score *= atom_density * nuc_xs.get_xs(MG_GET_XS_FISSION, p_g)
|
||||
/ macro_xs.get_xs(MG_GET_XS_ABSORPTION, p_g);
|
||||
score *= atom_density * nuc_xs.get_xs(MgxsType::FISSION, p_g)
|
||||
/ macro_xs.get_xs(MgxsType::ABSORPTION, p_g);
|
||||
} else {
|
||||
score *= macro_xs.get_xs(MG_GET_XS_FISSION, p_g)
|
||||
/ macro_xs.get_xs(MG_GET_XS_ABSORPTION, p_g);
|
||||
score *= macro_xs.get_xs(MgxsType::FISSION, p_g)
|
||||
/ macro_xs.get_xs(MgxsType::ABSORPTION, p_g);
|
||||
}
|
||||
} else {
|
||||
if (i_nuclide >= 0) {
|
||||
score = atom_density * flux * nuc_xs.get_xs(MG_GET_XS_FISSION, p_g);
|
||||
score = atom_density * flux * nuc_xs.get_xs(MgxsType::FISSION, p_g);
|
||||
} else {
|
||||
score = flux * macro_xs.get_xs(MG_GET_XS_FISSION, p_g);
|
||||
score = flux * macro_xs.get_xs(MgxsType::FISSION, p_g);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case SCORE_NU_FISSION:
|
||||
if (tally.estimator_ == ESTIMATOR_ANALOG) {
|
||||
if (tally.estimator_ == TallyEstimator::ANALOG) {
|
||||
if (settings::survival_biasing || p->fission_) {
|
||||
if (tally.energyout_filter_ != C_NONE) {
|
||||
// Fission has multiple outgoing neutrons so this helper function
|
||||
|
|
@ -1605,11 +1607,11 @@ score_general_mg(Particle* p, int i_tally, int start_index,
|
|||
// nu-fission
|
||||
score = p->wgt_absorb_ * flux;
|
||||
if (i_nuclide >= 0) {
|
||||
score *= atom_density * nuc_xs.get_xs(MG_GET_XS_NU_FISSION, p_g)
|
||||
/ macro_xs.get_xs(MG_GET_XS_ABSORPTION, p_g);
|
||||
score *= atom_density * nuc_xs.get_xs(MgxsType::NU_FISSION, p_g)
|
||||
/ macro_xs.get_xs(MgxsType::ABSORPTION, p_g);
|
||||
} else {
|
||||
score *= macro_xs.get_xs(MG_GET_XS_NU_FISSION, p_g)
|
||||
/ macro_xs.get_xs(MG_GET_XS_ABSORPTION, p_g);
|
||||
score *= macro_xs.get_xs(MgxsType::NU_FISSION, p_g)
|
||||
/ macro_xs.get_xs(MgxsType::ABSORPTION, p_g);
|
||||
}
|
||||
} else {
|
||||
// Skip any non-fission events
|
||||
|
|
@ -1621,23 +1623,23 @@ score_general_mg(Particle* p, int i_tally, int start_index,
|
|||
// score.
|
||||
score = simulation::keff * p->wgt_bank_ * flux;
|
||||
if (i_nuclide >= 0) {
|
||||
score *= atom_density * nuc_xs.get_xs(MG_GET_XS_FISSION, p_g)
|
||||
/ macro_xs.get_xs(MG_GET_XS_FISSION, p_g);
|
||||
score *= atom_density * nuc_xs.get_xs(MgxsType::FISSION, p_g)
|
||||
/ macro_xs.get_xs(MgxsType::FISSION, p_g);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (i_nuclide >= 0) {
|
||||
score = atom_density * flux
|
||||
* nuc_xs.get_xs(MG_GET_XS_NU_FISSION, p_g);
|
||||
* nuc_xs.get_xs(MgxsType::NU_FISSION, p_g);
|
||||
} else {
|
||||
score = flux * macro_xs.get_xs(MG_GET_XS_NU_FISSION, p_g);
|
||||
score = flux * macro_xs.get_xs(MgxsType::NU_FISSION, p_g);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case SCORE_PROMPT_NU_FISSION:
|
||||
if (tally.estimator_ == ESTIMATOR_ANALOG) {
|
||||
if (tally.estimator_ == TallyEstimator::ANALOG) {
|
||||
if (settings::survival_biasing || p->fission_) {
|
||||
if (tally.energyout_filter_ != C_NONE) {
|
||||
// Fission has multiple outgoing neutrons so this helper function
|
||||
|
|
@ -1653,11 +1655,11 @@ score_general_mg(Particle* p, int i_tally, int start_index,
|
|||
score = p->wgt_absorb_ * flux;
|
||||
if (i_nuclide >= 0) {
|
||||
score *= atom_density *
|
||||
nuc_xs.get_xs(MG_GET_XS_PROMPT_NU_FISSION, p_g)
|
||||
/ macro_xs.get_xs(MG_GET_XS_ABSORPTION, p_g);
|
||||
nuc_xs.get_xs(MgxsType::PROMPT_NU_FISSION, p_g)
|
||||
/ macro_xs.get_xs(MgxsType::ABSORPTION, p_g);
|
||||
} else {
|
||||
score *= macro_xs.get_xs(MG_GET_XS_PROMPT_NU_FISSION, p_g)
|
||||
/ macro_xs.get_xs(MG_GET_XS_ABSORPTION, p_g);
|
||||
score *= macro_xs.get_xs(MgxsType::PROMPT_NU_FISSION, p_g)
|
||||
/ macro_xs.get_xs(MgxsType::ABSORPTION, p_g);
|
||||
}
|
||||
} else {
|
||||
// Skip any non-fission events
|
||||
|
|
@ -1672,23 +1674,23 @@ score_general_mg(Particle* p, int i_tally, int start_index,
|
|||
auto prompt_frac = 1. - n_delayed / static_cast<double>(p->n_bank_);
|
||||
score = simulation::keff * p->wgt_bank_ * prompt_frac * flux;
|
||||
if (i_nuclide >= 0) {
|
||||
score *= atom_density * nuc_xs.get_xs(MG_GET_XS_FISSION, p_g)
|
||||
/ macro_xs.get_xs(MG_GET_XS_FISSION, p_g);
|
||||
score *= atom_density * nuc_xs.get_xs(MgxsType::FISSION, p_g)
|
||||
/ macro_xs.get_xs(MgxsType::FISSION, p_g);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (i_nuclide >= 0) {
|
||||
score = atom_density * flux *
|
||||
nuc_xs.get_xs(MG_GET_XS_PROMPT_NU_FISSION, p_g);
|
||||
nuc_xs.get_xs(MgxsType::PROMPT_NU_FISSION, p_g);
|
||||
} else {
|
||||
score = flux * macro_xs.get_xs(MG_GET_XS_PROMPT_NU_FISSION, p_g);
|
||||
score = flux * macro_xs.get_xs(MgxsType::PROMPT_NU_FISSION, p_g);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case SCORE_DELAYED_NU_FISSION:
|
||||
if (tally.estimator_ == ESTIMATOR_ANALOG) {
|
||||
if (tally.estimator_ == TallyEstimator::ANALOG) {
|
||||
if (settings::survival_biasing || p->fission_) {
|
||||
if (tally.energyout_filter_ != C_NONE) {
|
||||
// Fission has multiple outgoing neutrons so this helper function
|
||||
|
|
@ -1701,7 +1703,7 @@ score_general_mg(Particle* p, int i_tally, int start_index,
|
|||
// No fission events occur if survival biasing is on -- need to
|
||||
// calculate fraction of absorptions that would have resulted in
|
||||
// delayed-nu-fission
|
||||
double abs_xs = macro_xs.get_xs(MG_GET_XS_ABSORPTION, p_g);
|
||||
double abs_xs = macro_xs.get_xs(MgxsType::ABSORPTION, p_g);
|
||||
if (abs_xs > 0.) {
|
||||
if (tally.delayedgroup_filter_ != C_NONE) {
|
||||
auto i_dg_filt = tally.filters()[tally.delayedgroup_filter_];
|
||||
|
|
@ -1713,11 +1715,11 @@ score_general_mg(Particle* p, int i_tally, int start_index,
|
|||
auto d = filt.groups()[d_bin] - 1;
|
||||
score = p->wgt_absorb_ * flux;
|
||||
if (i_nuclide >= 0) {
|
||||
score *= nuc_xs.get_xs(MG_GET_XS_DELAYED_NU_FISSION, p_g,
|
||||
score *= nuc_xs.get_xs(MgxsType::DELAYED_NU_FISSION, p_g,
|
||||
nullptr, nullptr, &d)
|
||||
/ abs_xs;
|
||||
} else {
|
||||
score *= macro_xs.get_xs(MG_GET_XS_DELAYED_NU_FISSION, p_g,
|
||||
score *= macro_xs.get_xs(MgxsType::DELAYED_NU_FISSION, p_g,
|
||||
nullptr, nullptr, &d)
|
||||
/ abs_xs;
|
||||
}
|
||||
|
|
@ -1730,10 +1732,10 @@ score_general_mg(Particle* p, int i_tally, int start_index,
|
|||
// delayed-nu-fission xs to the absorption xs
|
||||
score = p->wgt_absorb_ * flux;
|
||||
if (i_nuclide >= 0) {
|
||||
score *= nuc_xs.get_xs(MG_GET_XS_DELAYED_NU_FISSION, p_g)
|
||||
score *= nuc_xs.get_xs(MgxsType::DELAYED_NU_FISSION, p_g)
|
||||
/ abs_xs;
|
||||
} else {
|
||||
score *= macro_xs.get_xs(MG_GET_XS_DELAYED_NU_FISSION, p_g)
|
||||
score *= macro_xs.get_xs(MgxsType::DELAYED_NU_FISSION, p_g)
|
||||
/ abs_xs;
|
||||
}
|
||||
}
|
||||
|
|
@ -1759,8 +1761,8 @@ score_general_mg(Particle* p, int i_tally, int start_index,
|
|||
score = simulation::keff * p->wgt_bank_ / p->n_bank_
|
||||
* p->n_delayed_bank_[d-1] * flux;
|
||||
if (i_nuclide >= 0) {
|
||||
score *= atom_density * nuc_xs.get_xs(MG_GET_XS_FISSION, p_g)
|
||||
/ macro_xs.get_xs(MG_GET_XS_FISSION, p_g);
|
||||
score *= atom_density * nuc_xs.get_xs(MgxsType::FISSION, p_g)
|
||||
/ macro_xs.get_xs(MgxsType::FISSION, p_g);
|
||||
}
|
||||
score_fission_delayed_dg(i_tally, d_bin, score, score_index, p->filter_matches_);
|
||||
}
|
||||
|
|
@ -1772,8 +1774,8 @@ score_general_mg(Particle* p, int i_tally, int start_index,
|
|||
score = simulation::keff * p->wgt_bank_ / p->n_bank_ * n_delayed
|
||||
* flux;
|
||||
if (i_nuclide >= 0) {
|
||||
score *= atom_density * nuc_xs.get_xs(MG_GET_XS_FISSION, p_g)
|
||||
/ macro_xs.get_xs(MG_GET_XS_FISSION, p_g);
|
||||
score *= atom_density * nuc_xs.get_xs(MgxsType::FISSION, p_g)
|
||||
/ macro_xs.get_xs(MgxsType::FISSION, p_g);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1788,10 +1790,10 @@ score_general_mg(Particle* p, int i_tally, int start_index,
|
|||
auto d = filt.groups()[d_bin] - 1;
|
||||
if (i_nuclide >= 0) {
|
||||
score = flux * atom_density * nuc_xs.get_xs(
|
||||
MG_GET_XS_DELAYED_NU_FISSION, p_g, nullptr, nullptr, &d);
|
||||
MgxsType::DELAYED_NU_FISSION, p_g, nullptr, nullptr, &d);
|
||||
} else {
|
||||
score = flux * macro_xs.get_xs(
|
||||
MG_GET_XS_DELAYED_NU_FISSION, p_g, nullptr, nullptr, &d);
|
||||
MgxsType::DELAYED_NU_FISSION, p_g, nullptr, nullptr, &d);
|
||||
}
|
||||
score_fission_delayed_dg(i_tally, d_bin, score, score_index, p->filter_matches_);
|
||||
}
|
||||
|
|
@ -1799,9 +1801,9 @@ score_general_mg(Particle* p, int i_tally, int start_index,
|
|||
} else {
|
||||
if (i_nuclide >= 0) {
|
||||
score = flux * atom_density *
|
||||
nuc_xs.get_xs(MG_GET_XS_DELAYED_NU_FISSION, p_g);
|
||||
nuc_xs.get_xs(MgxsType::DELAYED_NU_FISSION, p_g);
|
||||
} else {
|
||||
score = flux * macro_xs.get_xs(MG_GET_XS_DELAYED_NU_FISSION, p_g);
|
||||
score = flux * macro_xs.get_xs(MgxsType::DELAYED_NU_FISSION, p_g);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1809,12 +1811,12 @@ score_general_mg(Particle* p, int i_tally, int start_index,
|
|||
|
||||
|
||||
case SCORE_DECAY_RATE:
|
||||
if (tally.estimator_ == ESTIMATOR_ANALOG) {
|
||||
if (tally.estimator_ == TallyEstimator::ANALOG) {
|
||||
if (settings::survival_biasing) {
|
||||
// No fission events occur if survival biasing is on -- need to
|
||||
// calculate fraction of absorptions that would have resulted in
|
||||
// delayed-nu-fission
|
||||
double abs_xs = macro_xs.get_xs(MG_GET_XS_ABSORPTION, p_g);
|
||||
double abs_xs = macro_xs.get_xs(MgxsType::ABSORPTION, p_g);
|
||||
if (abs_xs > 0) {
|
||||
if (tally.delayedgroup_filter_ != C_NONE) {
|
||||
auto i_dg_filt = tally.filters()[tally.delayedgroup_filter_];
|
||||
|
|
@ -1826,14 +1828,14 @@ score_general_mg(Particle* p, int i_tally, int start_index,
|
|||
auto d = filt.groups()[d_bin] - 1;
|
||||
score = p->wgt_absorb_ * flux;
|
||||
if (i_nuclide >= 0) {
|
||||
score *= nuc_xs.get_xs(MG_GET_XS_DECAY_RATE, p_g,
|
||||
score *= nuc_xs.get_xs(MgxsType::DECAY_RATE, p_g,
|
||||
nullptr, nullptr, &d)
|
||||
* nuc_xs.get_xs(MG_GET_XS_DELAYED_NU_FISSION, p_g,
|
||||
* nuc_xs.get_xs(MgxsType::DELAYED_NU_FISSION, p_g,
|
||||
nullptr, nullptr, &d) / abs_xs;
|
||||
} else {
|
||||
score *= macro_xs.get_xs(MG_GET_XS_DECAY_RATE, p_g, nullptr,
|
||||
score *= macro_xs.get_xs(MgxsType::DECAY_RATE, p_g, nullptr,
|
||||
nullptr, &d)
|
||||
* macro_xs.get_xs(MG_GET_XS_DELAYED_NU_FISSION, p_g,
|
||||
* macro_xs.get_xs(MgxsType::DELAYED_NU_FISSION, p_g,
|
||||
nullptr, nullptr, &d) / abs_xs;
|
||||
}
|
||||
score_fission_delayed_dg(i_tally, d_bin, score, score_index, p->filter_matches_);
|
||||
|
|
@ -1848,15 +1850,15 @@ score_general_mg(Particle* p, int i_tally, int start_index,
|
|||
for (auto d = 0; d < data::mg.num_delayed_groups_; ++d) {
|
||||
if (i_nuclide >= 0) {
|
||||
score += p->wgt_absorb_ * flux
|
||||
* nuc_xs.get_xs(MG_GET_XS_DECAY_RATE, p_g, nullptr,
|
||||
* nuc_xs.get_xs(MgxsType::DECAY_RATE, p_g, nullptr,
|
||||
nullptr, &d)
|
||||
* nuc_xs.get_xs(MG_GET_XS_DELAYED_NU_FISSION, p_g,
|
||||
* nuc_xs.get_xs(MgxsType::DELAYED_NU_FISSION, p_g,
|
||||
nullptr, nullptr, &d) / abs_xs;
|
||||
} else {
|
||||
score += p->wgt_absorb_ * flux
|
||||
* macro_xs.get_xs(MG_GET_XS_DECAY_RATE, p_g, nullptr,
|
||||
* macro_xs.get_xs(MgxsType::DECAY_RATE, p_g, nullptr,
|
||||
nullptr, &d)
|
||||
* macro_xs.get_xs(MG_GET_XS_DELAYED_NU_FISSION, p_g,
|
||||
* macro_xs.get_xs(MgxsType::DELAYED_NU_FISSION, p_g,
|
||||
nullptr, nullptr, &d) / abs_xs;
|
||||
}
|
||||
}
|
||||
|
|
@ -1879,12 +1881,12 @@ score_general_mg(Particle* p, int i_tally, int start_index,
|
|||
if (d != -1) {
|
||||
if (i_nuclide >= 0) {
|
||||
score += simulation::keff * atom_density * bank.wgt * flux
|
||||
* nuc_xs.get_xs(MG_GET_XS_DECAY_RATE, p_g, nullptr, nullptr, &d)
|
||||
* nuc_xs.get_xs(MG_GET_XS_FISSION, p_g)
|
||||
/ macro_xs.get_xs(MG_GET_XS_FISSION, p_g);
|
||||
* nuc_xs.get_xs(MgxsType::DECAY_RATE, p_g, nullptr, nullptr, &d)
|
||||
* nuc_xs.get_xs(MgxsType::FISSION, p_g)
|
||||
/ macro_xs.get_xs(MgxsType::FISSION, p_g);
|
||||
} else {
|
||||
score += simulation::keff * bank.wgt * flux
|
||||
* macro_xs.get_xs(MG_GET_XS_DECAY_RATE, p_g, nullptr, nullptr, &d);
|
||||
* macro_xs.get_xs(MgxsType::DECAY_RATE, p_g, nullptr, nullptr, &d);
|
||||
}
|
||||
if (tally.delayedgroup_filter_ != C_NONE) {
|
||||
auto i_dg_filt = tally.filters()[tally.delayedgroup_filter_];
|
||||
|
|
@ -1915,15 +1917,15 @@ score_general_mg(Particle* p, int i_tally, int start_index,
|
|||
auto d = filt.groups()[d_bin] - 1;
|
||||
if (i_nuclide >= 0) {
|
||||
score += atom_density * flux
|
||||
* nuc_xs.get_xs(MG_GET_XS_DECAY_RATE, p_g, nullptr,
|
||||
* nuc_xs.get_xs(MgxsType::DECAY_RATE, p_g, nullptr,
|
||||
nullptr, &d)
|
||||
* nuc_xs.get_xs(MG_GET_XS_DELAYED_NU_FISSION, p_g, nullptr,
|
||||
* nuc_xs.get_xs(MgxsType::DELAYED_NU_FISSION, p_g, nullptr,
|
||||
nullptr, &d);
|
||||
} else {
|
||||
score += flux
|
||||
* macro_xs.get_xs(MG_GET_XS_DECAY_RATE, p_g, nullptr,
|
||||
* macro_xs.get_xs(MgxsType::DECAY_RATE, p_g, nullptr,
|
||||
nullptr, &d)
|
||||
* macro_xs.get_xs(MG_GET_XS_DELAYED_NU_FISSION, p_g, nullptr,
|
||||
* macro_xs.get_xs(MgxsType::DELAYED_NU_FISSION, p_g, nullptr,
|
||||
nullptr, &d);
|
||||
}
|
||||
score_fission_delayed_dg(i_tally, d_bin, score, score_index, p->filter_matches_);
|
||||
|
|
@ -1934,12 +1936,12 @@ score_general_mg(Particle* p, int i_tally, int start_index,
|
|||
for (auto d = 0; d < data::mg.num_delayed_groups_; ++d) {
|
||||
if (i_nuclide >= 0) {
|
||||
score += atom_density * flux
|
||||
* nuc_xs.get_xs(MG_GET_XS_DECAY_RATE, p_g, nullptr, nullptr, &d)
|
||||
* nuc_xs.get_xs(MG_GET_XS_DELAYED_NU_FISSION, p_g, nullptr, nullptr, &d);
|
||||
* nuc_xs.get_xs(MgxsType::DECAY_RATE, p_g, nullptr, nullptr, &d)
|
||||
* nuc_xs.get_xs(MgxsType::DELAYED_NU_FISSION, p_g, nullptr, nullptr, &d);
|
||||
} else {
|
||||
score += flux
|
||||
* macro_xs.get_xs(MG_GET_XS_DECAY_RATE, p_g, nullptr, nullptr, &d)
|
||||
* macro_xs.get_xs(MG_GET_XS_DELAYED_NU_FISSION, p_g, nullptr, nullptr, &d);
|
||||
* macro_xs.get_xs(MgxsType::DECAY_RATE, p_g, nullptr, nullptr, &d)
|
||||
* macro_xs.get_xs(MgxsType::DELAYED_NU_FISSION, p_g, nullptr, nullptr, &d);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1948,7 +1950,7 @@ score_general_mg(Particle* p, int i_tally, int start_index,
|
|||
|
||||
|
||||
case SCORE_KAPPA_FISSION:
|
||||
if (tally.estimator_ == ESTIMATOR_ANALOG) {
|
||||
if (tally.estimator_ == TallyEstimator::ANALOG) {
|
||||
if (settings::survival_biasing) {
|
||||
// No fission events occur if survival biasing is on -- need to
|
||||
// calculate fraction of absorptions that would have resulted in
|
||||
|
|
@ -1956,7 +1958,7 @@ score_general_mg(Particle* p, int i_tally, int start_index,
|
|||
score = p->wgt_absorb_ * flux;
|
||||
} else {
|
||||
// Skip any non-absorption events
|
||||
if (p->event_ == EVENT_SCATTER) continue;
|
||||
if (p->event_ == TallyEvent::SCATTER) continue;
|
||||
// All fission events will contribute, so again we can use particle's
|
||||
// weight entering the collision as the estimate for the fission
|
||||
// reaction rate
|
||||
|
|
@ -1964,18 +1966,18 @@ score_general_mg(Particle* p, int i_tally, int start_index,
|
|||
}
|
||||
if (i_nuclide >= 0) {
|
||||
score *= atom_density
|
||||
* nuc_xs.get_xs(MG_GET_XS_KAPPA_FISSION, p_g)
|
||||
/ macro_xs.get_xs(MG_GET_XS_ABSORPTION, p_g);
|
||||
* nuc_xs.get_xs(MgxsType::KAPPA_FISSION, p_g)
|
||||
/ macro_xs.get_xs(MgxsType::ABSORPTION, p_g);
|
||||
} else {
|
||||
score *=
|
||||
macro_xs.get_xs(MG_GET_XS_KAPPA_FISSION, p_g)
|
||||
/ macro_xs.get_xs(MG_GET_XS_ABSORPTION, p_g);
|
||||
macro_xs.get_xs(MgxsType::KAPPA_FISSION, p_g)
|
||||
/ macro_xs.get_xs(MgxsType::ABSORPTION, p_g);
|
||||
}
|
||||
} else {
|
||||
if (i_nuclide >= 0) {
|
||||
score = atom_density * flux * nuc_xs.get_xs(MG_GET_XS_KAPPA_FISSION, p_g);
|
||||
score = atom_density * flux * nuc_xs.get_xs(MgxsType::KAPPA_FISSION, p_g);
|
||||
} else {
|
||||
score = flux * macro_xs.get_xs(MG_GET_XS_KAPPA_FISSION, p_g);
|
||||
score = flux * macro_xs.get_xs(MgxsType::KAPPA_FISSION, p_g);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
@ -1992,7 +1994,7 @@ score_general_mg(Particle* p, int i_tally, int start_index,
|
|||
|
||||
// Update tally results
|
||||
#pragma omp atomic
|
||||
tally.results_(filter_index, score_index, RESULT_VALUE) += score;
|
||||
tally.results_(filter_index, score_index, TallyResult::VALUE) += score;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2292,7 +2294,7 @@ score_surface_tally(Particle* p, const std::vector<int>& tallies)
|
|||
for (auto score_index = 0; score_index < tally.scores_.size();
|
||||
++score_index) {
|
||||
#pragma omp atomic
|
||||
tally.results_(filter_index, score_index, RESULT_VALUE) += score;
|
||||
tally.results_(filter_index, score_index, TallyResult::VALUE) += score;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -31,8 +31,8 @@ get_tally_uncertainty(int i_tally, int score_index, int filter_index)
|
|||
{
|
||||
const auto& tally {model::tallies[i_tally]};
|
||||
|
||||
auto sum = tally->results_(filter_index, score_index, RESULT_SUM);
|
||||
auto sum_sq = tally->results_(filter_index, score_index, RESULT_SUM_SQ);
|
||||
auto sum = tally->results_(filter_index, score_index, TallyResult::SUM);
|
||||
auto sum_sq = tally->results_(filter_index, score_index, TallyResult::SUM_SQ);
|
||||
|
||||
int n = tally->n_realizations_;
|
||||
auto mean = sum / n;
|
||||
|
|
@ -111,7 +111,7 @@ check_tally_triggers(double& ratio, int& tally_id, int& score)
|
|||
double
|
||||
check_keff_trigger()
|
||||
{
|
||||
if (settings::run_mode != RUN_MODE_EIGENVALUE) return 0.0;
|
||||
if (settings::run_mode != RunMode::EIGENVALUE) return 0.0;
|
||||
|
||||
double k_combined[2];
|
||||
openmc_get_keff(k_combined);
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ ThermalScattering::ThermalScattering(hid_t group, const std::vector<double>& tem
|
|||
}
|
||||
|
||||
switch (settings::temperature_method) {
|
||||
case TEMPERATURE_NEAREST:
|
||||
case TemperatureMethod::NEAREST:
|
||||
// Determine actual temperatures to read
|
||||
for (const auto& T : temperature) {
|
||||
|
||||
|
|
@ -96,7 +96,7 @@ ThermalScattering::ThermalScattering(hid_t group, const std::vector<double>& tem
|
|||
}
|
||||
break;
|
||||
|
||||
case TEMPERATURE_INTERPOLATION:
|
||||
case TemperatureMethod::INTERPOLATION:
|
||||
// If temperature interpolation or multipole is selected, get a list of
|
||||
// bounding temperatures for each actual temperature present in the model
|
||||
for (const auto& T : temperature) {
|
||||
|
|
@ -156,7 +156,7 @@ ThermalScattering::calculate_xs(double E, double sqrtkT, int* i_temp,
|
|||
// Determine temperature for S(a,b) table
|
||||
double kT = sqrtkT*sqrtkT;
|
||||
int i;
|
||||
if (settings::temperature_method == TEMPERATURE_NEAREST) {
|
||||
if (settings::temperature_method == TemperatureMethod::NEAREST) {
|
||||
// If using nearest temperature, do linear search on temperature
|
||||
for (i = 0; i < kTs_.size(); ++i) {
|
||||
if (std::abs(kTs_[i] - kT) < K_BOLTZMANN*settings::temperature_tolerance) {
|
||||
|
|
|
|||
|
|
@ -45,11 +45,11 @@ VolumeCalculation::VolumeCalculation(pugi::xml_node node)
|
|||
// Read domain type (cell, material or universe)
|
||||
std::string domain_type = get_node_value(node, "domain_type");
|
||||
if (domain_type == "cell") {
|
||||
domain_type_ = FILTER_CELL;
|
||||
domain_type_ = TallyDomain::CELL;
|
||||
} else if (domain_type == "material") {
|
||||
domain_type_ = FILTER_MATERIAL;
|
||||
domain_type_ = TallyDomain::MATERIAL;
|
||||
} else if (domain_type == "universe") {
|
||||
domain_type_ = FILTER_UNIVERSE;
|
||||
domain_type_ = TallyDomain::UNIVERSE;
|
||||
} else {
|
||||
fatal_error(std::string("Unrecognized domain type for stochastic "
|
||||
"volume calculation: " + domain_type));
|
||||
|
|
@ -139,7 +139,7 @@ std::vector<VolumeCalculation::Result> VolumeCalculation::execute() const
|
|||
// If this location is not in the geometry at all, move on to next block
|
||||
if (!find_cell(&p, false)) continue;
|
||||
|
||||
if (domain_type_ == FILTER_MATERIAL) {
|
||||
if (domain_type_ == TallyDomain::MATERIAL) {
|
||||
if (p.material_ != MATERIAL_VOID) {
|
||||
for (int i_domain = 0; i_domain < n; i_domain++) {
|
||||
if (model::materials[p.material_]->id_ == domain_ids_[i_domain]) {
|
||||
|
|
@ -148,7 +148,7 @@ std::vector<VolumeCalculation::Result> VolumeCalculation::execute() const
|
|||
}
|
||||
}
|
||||
}
|
||||
} else if (domain_type_ == FILTER_CELL) {
|
||||
} else if (domain_type_ == TallyDomain::CELL) {
|
||||
for (int level = 0; level < p.n_coord_; ++level) {
|
||||
for (int i_domain=0; i_domain < n; i_domain++) {
|
||||
if (model::cells[p.coord_[level].cell]->id_ == domain_ids_[i_domain]) {
|
||||
|
|
@ -157,7 +157,7 @@ std::vector<VolumeCalculation::Result> VolumeCalculation::execute() const
|
|||
}
|
||||
}
|
||||
}
|
||||
} else if (domain_type_ == FILTER_UNIVERSE) {
|
||||
} else if (domain_type_ == TallyDomain::UNIVERSE) {
|
||||
for (int level = 0; level < p.n_coord_; ++level) {
|
||||
for (int i_domain = 0; i_domain < n; ++i_domain) {
|
||||
if (model::universes[p.coord_[level].universe]->id_ == domain_ids_[i_domain]) {
|
||||
|
|
@ -382,13 +382,13 @@ void VolumeCalculation::to_hdf5(const std::string& filename,
|
|||
write_attribute(file_id, "iterations", 1);
|
||||
}
|
||||
|
||||
if (domain_type_ == FILTER_CELL) {
|
||||
if (domain_type_ == TallyDomain::CELL) {
|
||||
write_attribute(file_id, "domain_type", "cell");
|
||||
}
|
||||
else if (domain_type_ == FILTER_MATERIAL) {
|
||||
else if (domain_type_ == TallyDomain::MATERIAL) {
|
||||
write_attribute(file_id, "domain_type", "material");
|
||||
}
|
||||
else if (domain_type_ == FILTER_UNIVERSE) {
|
||||
else if (domain_type_ == TallyDomain::UNIVERSE) {
|
||||
write_attribute(file_id, "domain_type", "universe");
|
||||
}
|
||||
|
||||
|
|
@ -477,9 +477,9 @@ int openmc_calculate_volumes() {
|
|||
|
||||
if (mpi::master) {
|
||||
std::string domain_type;
|
||||
if (vol_calc.domain_type_ == FILTER_CELL) {
|
||||
if (vol_calc.domain_type_ == VolumeCalculation::TallyDomain::CELL) {
|
||||
domain_type = " Cell ";
|
||||
} else if (vol_calc.domain_type_ == FILTER_MATERIAL) {
|
||||
} else if (vol_calc.domain_type_ == VolumeCalculation::TallyDomain::MATERIAL) {
|
||||
domain_type = " Material ";
|
||||
} else {
|
||||
domain_type = " Universe ";
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ namespace openmc {
|
|||
// XsData class methods
|
||||
//==============================================================================
|
||||
|
||||
XsData::XsData(bool fissionable, int scatter_format, int n_pol, int n_azi,
|
||||
XsData::XsData(bool fissionable, AngleDistributionType scatter_format, int n_pol, int n_azi,
|
||||
size_t n_groups, size_t n_d_groups) :
|
||||
n_g_(n_groups),
|
||||
n_dg_(n_d_groups)
|
||||
|
|
@ -32,8 +32,8 @@ XsData::XsData(bool fissionable, int scatter_format, int n_pol, int n_azi,
|
|||
size_t n_ang = n_pol * n_azi;
|
||||
|
||||
// check to make sure scatter format is OK before we allocate
|
||||
if (scatter_format != ANGLE_HISTOGRAM && scatter_format != ANGLE_TABULAR &&
|
||||
scatter_format != ANGLE_LEGENDRE) {
|
||||
if (scatter_format != AngleDistributionType::HISTOGRAM && scatter_format != AngleDistributionType::TABULAR &&
|
||||
scatter_format != AngleDistributionType::LEGENDRE) {
|
||||
fatal_error("Invalid scatter_format!");
|
||||
}
|
||||
// allocate all [temperature][angle][in group] quantities
|
||||
|
|
@ -68,11 +68,11 @@ XsData::XsData(bool fissionable, int scatter_format, int n_pol, int n_azi,
|
|||
|
||||
|
||||
for (int a = 0; a < n_ang; a++) {
|
||||
if (scatter_format == ANGLE_HISTOGRAM) {
|
||||
if (scatter_format == AngleDistributionType::HISTOGRAM) {
|
||||
scatter.emplace_back(new ScattDataHistogram);
|
||||
} else if (scatter_format == ANGLE_TABULAR) {
|
||||
} else if (scatter_format == AngleDistributionType::TABULAR) {
|
||||
scatter.emplace_back(new ScattDataTabular);
|
||||
} else if (scatter_format == ANGLE_LEGENDRE) {
|
||||
} else if (scatter_format == AngleDistributionType::LEGENDRE) {
|
||||
scatter.emplace_back(new ScattDataLegendre);
|
||||
}
|
||||
}
|
||||
|
|
@ -81,8 +81,8 @@ XsData::XsData(bool fissionable, int scatter_format, int n_pol, int n_azi,
|
|||
//==============================================================================
|
||||
|
||||
void
|
||||
XsData::from_hdf5(hid_t xsdata_grp, bool fissionable, int scatter_format,
|
||||
int final_scatter_format, int order_data, bool is_isotropic, int n_pol, int n_azi)
|
||||
XsData::from_hdf5(hid_t xsdata_grp, bool fissionable, AngleDistributionType scatter_format,
|
||||
AngleDistributionType final_scatter_format, int order_data, bool is_isotropic, int n_pol, int n_azi)
|
||||
{
|
||||
// Reconstruct the dimension information so it doesn't need to be passed
|
||||
size_t n_ang = n_pol * n_azi;
|
||||
|
|
@ -398,8 +398,8 @@ XsData::fission_from_hdf5(hid_t xsdata_grp, size_t n_ang, bool is_isotropic)
|
|||
//==============================================================================
|
||||
|
||||
void
|
||||
XsData::scatter_from_hdf5(hid_t xsdata_grp, size_t n_ang,
|
||||
int scatter_format, int final_scatter_format, int order_data)
|
||||
XsData::scatter_from_hdf5(hid_t xsdata_grp, size_t n_ang, AngleDistributionType scatter_format,
|
||||
AngleDistributionType final_scatter_format, int order_data)
|
||||
{
|
||||
if (!object_exists(xsdata_grp, "scatter_data")) {
|
||||
fatal_error("Must provide scatter_data group!");
|
||||
|
|
@ -427,7 +427,7 @@ XsData::scatter_from_hdf5(hid_t xsdata_grp, size_t n_ang,
|
|||
// Compare the number of orders given with the max order of the problem;
|
||||
// strip off the superfluous orders if needed
|
||||
int order_dim;
|
||||
if (scatter_format == ANGLE_LEGENDRE) {
|
||||
if (scatter_format == AngleDistributionType::LEGENDRE) {
|
||||
order_dim = std::min(order_data - 1, settings::max_order) + 1;
|
||||
} else {
|
||||
order_dim = order_data;
|
||||
|
|
@ -480,8 +480,8 @@ XsData::scatter_from_hdf5(hid_t xsdata_grp, size_t n_ang,
|
|||
close_group(scatt_grp);
|
||||
|
||||
// Finally, convert the Legendre data to tabular, if needed
|
||||
if (scatter_format == ANGLE_LEGENDRE &&
|
||||
final_scatter_format == ANGLE_TABULAR) {
|
||||
if (scatter_format == AngleDistributionType::LEGENDRE &&
|
||||
final_scatter_format == AngleDistributionType::TABULAR) {
|
||||
for (size_t a = 0; a < n_ang; a++) {
|
||||
ScattDataLegendre legendre_scatt;
|
||||
xt::xtensor<int, 1> in_gmin = xt::view(gmin, a, xt::all());
|
||||
|
|
|
|||
|
|
@ -170,10 +170,6 @@ def test_settings(lib_init):
|
|||
assert settings.seed == 1
|
||||
settings.seed = 11
|
||||
|
||||
assert settings.run_mode == 'eigenvalue'
|
||||
settings.run_mode = 'volume'
|
||||
settings.run_mode = 'eigenvalue'
|
||||
|
||||
|
||||
def test_tally_mapping(lib_init):
|
||||
tallies = openmc.lib.tallies
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue