diff --git a/include/base/OpenMCProblemBase.h b/include/base/OpenMCProblemBase.h index 715159faf..da5d00a5c 100644 --- a/include/base/OpenMCProblemBase.h +++ b/include/base/OpenMCProblemBase.h @@ -376,10 +376,10 @@ class OpenMCProblemBase : public CardinalProblem, public PostprocessorInterface const bool & _verbose; /// Power by which to normalize the OpenMC results, for k-eigenvalue mode - const Real * _power; + const Real & _power; /// Source strength by which to normalize the OpenMC results, for fixed source mode - const Real * _source_strength; + const Real & _source_strength; /** * Whether to take the starting fission source from iteration \f$n\f$ as the diff --git a/src/base/OpenMCCellAverageProblem.C b/src/base/OpenMCCellAverageProblem.C index 73124a599..30fe9fc51 100644 --- a/src/base/OpenMCCellAverageProblem.C +++ b/src/base/OpenMCCellAverageProblem.C @@ -2330,9 +2330,9 @@ OpenMCCellAverageProblem::tallyMultiplier(unsigned int global_score) const // normalize the tally Real source = _local_mean_tally[global_score]; if (_run_mode == openmc::RunMode::EIGENVALUE) - source *= *_power / EV_TO_JOULE / _local_mean_tally[_source_rate_index]; + source *= _power / EV_TO_JOULE / _local_mean_tally[_source_rate_index]; else - source *= *_source_strength; + source *= _source_strength; // Reaction rate scores have units of reactions/src (OpenMC) or reactions/s (Cardinal). if (isReactionRateScore(_all_tally_scores[global_score])) @@ -2347,9 +2347,9 @@ OpenMCCellAverageProblem::tallyMultiplier(unsigned int global_score) const { // Heating tallies have units of eV / source particle if (_run_mode == openmc::RunMode::EIGENVALUE) - return *_power; + return _power; else - return *_source_strength * EV_TO_JOULE * _local_mean_tally[global_score]; + return _source_strength * EV_TO_JOULE * _local_mean_tally[global_score]; } } diff --git a/src/base/OpenMCProblemBase.C b/src/base/OpenMCProblemBase.C index e3eba5d11..a9294ad37 100644 --- a/src/base/OpenMCProblemBase.C +++ b/src/base/OpenMCProblemBase.C @@ -70,6 +70,9 @@ OpenMCProblemBase::validParams() false, "Whether to skip writing any statepoint files from OpenMC; this is a performance " "optimization for scenarios where you may not want the statepoint files anyways"); + + params.declareControllable("power"); + params.declareControllable("source_strength"); return params; } @@ -77,6 +80,12 @@ OpenMCProblemBase::OpenMCProblemBase(const InputParameters & params) : CardinalProblem(params), PostprocessorInterface(this), _verbose(getParam("verbose")), + _power(openmc::settings::run_mode == openmc::RunMode::EIGENVALUE + ? getPostprocessorValue("power") + : 0), + _source_strength(openmc::settings::run_mode == openmc::RunMode::FIXED_SOURCE + ? getPostprocessorValue("source_strength") + : 0), _reuse_source(getParam("reuse_source")), _specified_scaling(params.isParamSetByUser("scaling")), _scaling(getParam("scaling")), @@ -115,7 +124,6 @@ OpenMCProblemBase::OpenMCProblemBase(const InputParameters & params) if (tally_actions.size() > 0) { checkRequiredParam(params, "power", "running in k-eigenvalue mode"); - _power = &getPostprocessorValue("power"); } else checkUnusedParam(params, "power", "no tallies have been added"); @@ -128,7 +136,6 @@ OpenMCProblemBase::OpenMCProblemBase(const InputParameters & params) if (tally_actions.size() > 0) { checkRequiredParam(params, "source_strength", "running in fixed source mode"); - _source_strength = &getPostprocessorValue("source_strength"); } else checkUnusedParam(params, "source_strength", "no tallies have been added");