Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Control Power and Source Strength #1001

Open
wants to merge 4 commits into
base: devel
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions include/base/OpenMCProblemBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions src/base/OpenMCCellAverageProblem.C
Original file line number Diff line number Diff line change
Expand Up @@ -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]))
Expand All @@ -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];
}
}

Expand Down
11 changes: 9 additions & 2 deletions src/base/OpenMCProblemBase.C
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,22 @@ 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;
}

OpenMCProblemBase::OpenMCProblemBase(const InputParameters & params)
: CardinalProblem(params),
PostprocessorInterface(this),
_verbose(getParam<bool>("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<bool>("reuse_source")),
_specified_scaling(params.isParamSetByUser("scaling")),
_scaling(getParam<Real>("scaling")),
Expand Down Expand Up @@ -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");
Expand All @@ -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");
Expand Down