Skip to content

Commit

Permalink
Fix wrong int signedness
Browse files Browse the repository at this point in the history
  • Loading branch information
smpark7 committed Mar 7, 2024
1 parent 40fd508 commit 110f228
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
4 changes: 2 additions & 2 deletions include/postprocessors/ElmIntegTotFissNtsPostprocessor.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ class ElmIntegTotFissNtsPostprocessor : public ElementIntegralPostprocessor
virtual Real computeQpIntegral() override;

// The number of neutron energy groups.
int _num_groups;
unsigned int _num_groups;

// The number of precursor groups.
int _num_precursor_groups;
unsigned int _num_precursor_groups;

// Whether to account for delayed neutrons
bool _account_delayed;
Expand Down
2 changes: 1 addition & 1 deletion include/postprocessors/ElmIntegTotFissPostprocessor.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class ElmIntegTotFissPostprocessor : public ElementIntegralPostprocessor, public
virtual Real computeQpIntegral() override;
virtual Real computeFluxMultiplier(int index);

int _num_groups;
unsigned int _num_groups;
const MaterialProperty<std::vector<Real>> & _fissxs;
std::vector<MooseVariableFEBase *> _vars;
Real _nt_scale;
Expand Down
18 changes: 9 additions & 9 deletions src/postprocessors/ElmIntegTotFissNtsPostprocessor.C
Original file line number Diff line number Diff line change
Expand Up @@ -12,36 +12,36 @@ ElmIntegTotFissNtsPostprocessor::validParams()
params.addCoupledVar("pre_concs", "All the variables that hold the precursor "
"concentrations. These MUST be listed by increasing "
"group number.");
params.addRequiredParam<int>("num_groups", "The number of energy groups.");
params.addParam<int>("num_precursor_groups", 0, "The number of precursor groups.");
params.addRequiredParam<unsigned int>("num_groups", "The number of energy groups.");
params.addParam<unsigned int>("num_precursor_groups", 0, "The number of precursor groups.");
params.addRequiredParam<bool>("account_delayed", "Whether to account for delayed neutrons.");
return params;
}

ElmIntegTotFissNtsPostprocessor::ElmIntegTotFissNtsPostprocessor(const InputParameters & parameters)
: ElementIntegralPostprocessor(parameters),
// MooseVariableInterface(this, false),
_num_groups(getParam<int>("num_groups")),
_num_precursor_groups(getParam<int>("num_precursor_groups")),
_num_groups(getParam<unsigned int>("num_groups")),
_num_precursor_groups(getParam<unsigned int>("num_precursor_groups")),
_account_delayed(getParam<bool>("account_delayed")),
_nsf(getMaterialProperty<std::vector<Real>>("nsf")),
_decay_constant(getMaterialProperty<std::vector<Real>>("decay_constant")),
_vars(getCoupledMooseVars())
{
addMooseVariableDependency(_vars);
int n = coupledComponents("group_fluxes");
unsigned int n = coupledComponents("group_fluxes");
if (!(n == _num_groups))
mooseError("The number of group flux variables doesn't match the number of energy groups.");

_group_fluxes.resize(n);
for (int i = 0; i < _group_fluxes.size(); ++i)
for (unsigned int i = 0; i < _group_fluxes.size(); ++i)
{
_group_fluxes[i] = &coupledValue("group_fluxes", i);
}

if (_account_delayed)
{
int m = coupledComponents("pre_concs");
unsigned int m = coupledComponents("pre_concs");
if (m == 0)
{
mooseError("account_delayed flag set to true but no precursor groups specified."
Expand All @@ -64,12 +64,12 @@ Real
ElmIntegTotFissNtsPostprocessor::computeQpIntegral()
{
Real sum = 0;
for (int i = 0; i < _num_groups; ++i)
for (unsigned int i = 0; i < _num_groups; ++i)
sum += _nsf[_qp][i] * (*_group_fluxes[i])[_qp];

if (_account_delayed)
{
for (int i = 0; i < _num_precursor_groups; ++i)
for (unsigned int i = 0; i < _num_precursor_groups; ++i)
sum += _decay_constant[_qp][i] * (*_pre_concs[i])[_qp];
}

Expand Down
8 changes: 4 additions & 4 deletions src/postprocessors/ElmIntegTotFissPostprocessor.C
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,21 @@ ElmIntegTotFissPostprocessor::validParams()
params.addRequiredCoupledVar(
"group_fluxes",
"The group fluxes. MUST be arranged by decreasing energy/increasing group number.");
params.addRequiredParam<int>("num_groups", "The number of energy groups.");
params.addRequiredParam<unsigned int>("num_groups", "The number of energy groups.");
params.addParam<Real>("nt_scale", 1, "Scaling of the neutron fluxes to aid convergence.");
return params;
}

ElmIntegTotFissPostprocessor::ElmIntegTotFissPostprocessor(const InputParameters & parameters)
: ElementIntegralPostprocessor(parameters),
ScalarTransportBase(parameters),
_num_groups(getParam<int>("num_groups")),
_num_groups(getParam<unsigned int>("num_groups")),
_fissxs(getMaterialProperty<std::vector<Real>>("fissxs")),
_vars(getCoupledMooseVars()),
_nt_scale(getParam<Real>("nt_scale"))
{
addMooseVariableDependency(_vars);
int n = coupledComponents("group_fluxes");
unsigned int n = coupledComponents("group_fluxes");
if (!(n == _num_groups))
mooseError("The number of coupled variables doesn't match the number of groups.");

Expand All @@ -39,7 +39,7 @@ Real
ElmIntegTotFissPostprocessor::computeQpIntegral()
{
Real sum = 0;
for (int i = 0; i < _num_groups; ++i)
for (unsigned int i = 0; i < _num_groups; ++i)
sum += computeFluxMultiplier(i) * computeConcentration((*_group_fluxes[i]), _qp) * _nt_scale;

return sum;
Expand Down

0 comments on commit 110f228

Please sign in to comment.