Skip to content

Commit

Permalink
Add tests for neutron leakage postprocessor
Browse files Browse the repository at this point in the history
  • Loading branch information
smpark7 committed Nov 14, 2023
1 parent ceb63e5 commit 17819e3
Show file tree
Hide file tree
Showing 6 changed files with 136 additions and 13 deletions.
2 changes: 1 addition & 1 deletion include/postprocessors/TotalNeutronLeakage.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class TotalNeutronLeakage : public SideIntegralPostprocessor, public ScalarTrans

std::vector<MooseVariableFEBase *> _vars;
const MaterialProperty<std::vector<Real>> & _diffcoef;
int _num_groups;
unsigned int _num_groups;
std::vector<const VariableValue *> _group_fluxes;
std::vector<const VariableGradient *> _grad_group_fluxes;
};
8 changes: 4 additions & 4 deletions src/postprocessors/TotalNeutronLeakage.C
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ TotalNeutronLeakage::validParams()
params += ScalarTransportBase::validParams();
params.addClassDescription("Postprocessor for computing total neutron leakage along provided "
"boundaries for all neutron group fluxes");
params.addRequiredParam<int>("num_groups", "The total number of energy groups");
params.addRequiredParam<unsigned int>("num_groups", "The total number of energy groups");
params.addRequiredCoupledVar("group_fluxes", "All the variables that hold the group fluxes. "
"These MUST be listed by decreasing "
"energy/increasing group number.");
Expand All @@ -21,17 +21,17 @@ TotalNeutronLeakage::TotalNeutronLeakage(const InputParameters & parameters)
ScalarTransportBase(parameters),
_vars(getCoupledMooseVars()),
_diffcoef(getMaterialProperty<std::vector<Real>>("diffcoef")),
_num_groups(getParam<int>("num_groups"))
_num_groups(getParam<unsigned int>("num_groups"))
{
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.");
}
_group_fluxes.resize(n);
_grad_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);
_grad_group_fluxes[i] = &coupledGradient("group_fluxes", i);
Expand Down
3 changes: 3 additions & 0 deletions tests/postprocessors/gold/neutron_leakage_out.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
time,group1_leakage,group2_leakage,total_leakage
0,0,0,0
1,1,10,11
13 changes: 13 additions & 0 deletions tests/postprocessors/mat.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"mat1": {
"900": {
"DIFFCOEF": [
1.0,
1.0
]
},
"temp": [
900
]
}
}
103 changes: 103 additions & 0 deletions tests/postprocessors/neutron_leakage.i
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
[GlobalParams]
group_fluxes = 'group1 group2'
num_groups = 2
num_precursor_groups = 0
use_exp_form = false
temperature = 900
sss2_input = true
[]

[Mesh]
[gmg]
type = GeneratedMeshGenerator
dim = 2
nx = 2
ny = 2
xmax = 1
ymax = 1
[]
[]

[Variables]
[group1]
[]
[group2]
[]
[]

[Kernels]
[group1_diffusion]
type = GroupDiffusion
variable = group1
group_number = 1
[]
[group2_diffusion]
type = GroupDiffusion
variable = group2
group_number = 2
[]
[]

[BCs]
[group1_left]
type = DirichletBC
variable = group1
boundary = left
value = 3
[]
[group1_right]
type = DirichletBC
variable = group1
boundary = right
value = 2
[]
[group2_left]
type = DirichletBC
variable = group2
boundary = left
value = 30
[]
[group2_right]
type = DirichletBC
variable = group2
boundary = right
value = 20
[]
[]

[Materials]
[mat]
type = MoltresJsonMaterial
base_file = mat.json
material_key = 'mat1'
interp_type = 'none'
group_constants = 'DIFFCOEF'
[]
[]

[Executioner]
type = Steady
[]

[Postprocessors]
[group1_leakage]
type = NeutronLeakage
variable = group1
boundary = 'right'
group_number = 1
[]
[group2_leakage]
type = NeutronLeakage
variable = group2
boundary = 'right'
group_number = 2
[]
[total_leakage]
type = TotalNeutronLeakage
boundary = 'right'
[]
[]

[Outputs]
csv = true
[]
20 changes: 12 additions & 8 deletions tests/postprocessors/tests
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
[Tests]
[./side_weighted_integral]
type = 'Exodiff'
[side_weighted_integral]
type = Exodiff
input = 'side_weighted_integral.i'
exodiff = 'side_weighted_integral_out.e'

requirement = 'The system shall compute the weighted integral sum of a variable over a side.'
[../]
[./side_weighted_integral_RZ]
type = 'Exodiff'
[]
[side_weighted_integral_RZ]
type = Exodiff
input = 'side_weighted_integral_RZ.i'
exodiff = 'side_weighted_integral_RZ_out.e'

requirement = 'The system shall compute the weighted integral sum of a variable over a side in RZ coordinates.'
[../]
[]
[neutron_leakage]
type = CSVDiff
input = 'neutron_leakage.i'
csvdiff = 'neutron_leakage_out.csv'
requirement = 'The system shall compute group-wise and total neutron leakage'
[]
[]

0 comments on commit 17819e3

Please sign in to comment.