Skip to content

Commit

Permalink
Merge pull request #966 from nuclearkevin/rxn_rate_scores
Browse files Browse the repository at this point in the history
Add common reaction rate scores
  • Loading branch information
aprilnovak authored Oct 7, 2024
2 parents f8d57f5 + be1805e commit 5d6970b
Show file tree
Hide file tree
Showing 11 changed files with 296 additions and 8 deletions.
4 changes: 4 additions & 0 deletions doc/content/source/tallies/scores_triggers.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ a tally. Options include:
- `damage_energy`: damage energy production
- `flux`: particle scalar flux
- `H3_production`: tritium production reaction rate
- `total`: the total reaction rate
- `absorption`: the absorption reaction rate
- `scatter`: the scatter reaction rate
- `fission`: the fission reaction rate

For more information on the specific meanings of these various scores,
please consult the [OpenMC tally documentation](https://docs.openmc.org/en/stable/usersguide/tallies.html). The names of
Expand Down
8 changes: 7 additions & 1 deletion include/base/OpenMCProblemBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,15 @@ class OpenMCProblemBase : public CardinalProblem, public PostprocessorInterface
*/
void catchOpenMCError(const int & err, const std::string descriptor) const;

/**
* Whether the score is a reaction rate score
* @return whether the tally from OpenMC has units of 1/src
*/
bool isReactionRateScore(const std::string & score) const;

/**
* Whether the score is a heating-type score
* @return whether tally from OpenMC has units of eV/src
* @return whether the tally from OpenMC has units of eV/src
*/
bool isHeatingScore(const std::string & score) const;

Expand Down
8 changes: 5 additions & 3 deletions src/base/CardinalEnums.C
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,16 @@ getInitialPropertiesEnum()
MultiMooseEnum
getTallyScoreEnum()
{
return MultiMooseEnum("heating heating_local kappa_fission fission_q_prompt fission_q_recoverable damage_energy flux H3_production");
return MultiMooseEnum(
"heating heating_local kappa_fission fission_q_prompt fission_q_recoverable damage_energy "
"flux H3_production total absorption scatter fission");
}

MooseEnum
getEnergyGroupsEnum()
{
return MooseEnum(
"CASMO_2 CASMO_4 CASMO_8 CASMO_16 CASMO_25 CASMO_40 VITAMIN_J_42 SCALE_44 MPACT_51 MPACT_60 "
"MPACT_69 CASMO_70 "
"XMAS_172 VITAMIN_J_175 SCALE_252 TRIPOLI_315 SHEM_361 CCFE_709 UKAEA_1102 ECCO_1968");
"MPACT_69 CASMO_70 XMAS_172 VITAMIN_J_175 SCALE_252 TRIPOLI_315 SHEM_361 CCFE_709 UKAEA_1102 "
"ECCO_1968");
}
6 changes: 4 additions & 2 deletions src/base/OpenMCCellAverageProblem.C
Original file line number Diff line number Diff line change
Expand Up @@ -2221,10 +2221,12 @@ OpenMCCellAverageProblem::tallyMultiplier(unsigned int global_score) const
else
source *= *_source_strength;

// Reaction rate scores have units of reactions/src (OpenMC) or reactions/s (Cardinal).
if (isReactionRateScore(_all_tally_scores[global_score]))
return source;

if (_all_tally_scores[global_score] == "flux")
return source / _scaling;
else if (_all_tally_scores[global_score] == "H3-production")
return source;
else
mooseError("Unhandled tally score enum!");
}
Expand Down
16 changes: 14 additions & 2 deletions src/base/OpenMCProblemBase.C
Original file line number Diff line number Diff line change
Expand Up @@ -692,11 +692,23 @@ OpenMCProblemBase::numCells() const
return n_openmc_cells;
}

bool
OpenMCProblemBase::isReactionRateScore(const std::string & score) const
{
const std::set<std::string> viable_scores = {
"H3-production", "total", "absorption", "scatter", "fission"};
return viable_scores.count(score);
}

bool
OpenMCProblemBase::isHeatingScore(const std::string & score) const
{
std::set<std::string> viable_scores = {"heating", "heating-local", "kappa-fission",
"fission-q-prompt", "fission-q-recoverable", "damage-energy"};
const std::set<std::string> viable_scores = {"heating",
"heating-local",
"kappa-fission",
"fission-q-prompt",
"fission-q-recoverable",
"damage-energy"};
return viable_scores.count(score);
}

Expand Down
16 changes: 16 additions & 0 deletions test/tests/neutronics/tallies/reaction_rates/geometry.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version='1.0' encoding='utf-8'?>
<geometry>
<cell id="1" material="1" region="-1" universe="1" />
<cell id="2" material="2" region="-2" universe="1" />
<cell id="3" material="3" region="-3" universe="1" />
<cell id="4" material="4" region="1 2 3 4 -5 6 -7 8 -9" universe="1" />
<surface coeffs="0.0 0.0 0.0 1.5" id="1" type="sphere" />
<surface coeffs="0.0 0.0 4.0 1.5" id="2" type="sphere" />
<surface coeffs="0.0 0.0 8.0 1.5" id="3" type="sphere" />
<surface boundary="reflective" coeffs="-2.5" id="4" name="minimum x" type="x-plane" />
<surface boundary="reflective" coeffs="2.5" id="5" name="maximum x" type="x-plane" />
<surface boundary="reflective" coeffs="-2.5" id="6" name="minimum y" type="y-plane" />
<surface boundary="reflective" coeffs="2.5" id="7" name="maximum y" type="y-plane" />
<surface boundary="reflective" coeffs="-2.0" id="8" type="z-plane" />
<surface boundary="reflective" coeffs="10.0" id="9" type="z-plane" />
</geometry>
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
time,fluid_abs,fluid_fis,fluid_sca,fluid_tot,max_err_abs,max_err_fis,max_err_sca,max_err_tot,pebble1_abs,pebble1_fis,pebble1_sca,pebble1_tot,pebble2_abs,pebble2_fis,pebble2_sca,pebble2_tot,pebble3_abs,pebble3_fis,pebble3_sca,pebble3_tot,total_abs,total_fis,total_sca,total_tot
2,4149.6966831807,680.47521645749,296062.06592204,300211.76260522,0.056733496208636,0.056604251482993,0.055791612323537,0.055791025495985,192976.8576854,39318.916021239,7071351.6419481,7264328.4996335,275273.85825425,103528.67789506,7056891.3237557,7332165.1820099,374173.7454997,179011.11385643,7060000.1112522,7434173.8567519,12226931.171582,4433961.3918573,357830861.2212,370057792.39278
40 changes: 40 additions & 0 deletions test/tests/neutronics/tallies/reaction_rates/materials.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?xml version='1.0' encoding='utf-8'?>
<materials>
<material depletable="true" id="1">
<density units="g/cc" value="5.0" />
<nuclide ao="9.051308944870946e-05" name="U234" />
<nuclide ao="0.010126612654073502" name="U235" />
<nuclide ao="0.9897364895065476" name="U238" />
<nuclide ao="4.63847499302226e-05" name="U236" />
<nuclide ao="1.999242" name="O16" />
<nuclide ao="0.000758" name="O17" />
</material>
<material depletable="true" id="2">
<density units="g/cc" value="5.0" />
<nuclide ao="0.0004523305496680539" name="U234" />
<nuclide ao="0.05060678290832386" name="U235" />
<nuclide ao="0.948709083169038" name="U238" />
<nuclide ao="0.00023180337297007338" name="U236" />
<nuclide ao="1.999242" name="O16" />
<nuclide ao="0.000758" name="O17" />
</material>
<material depletable="true" id="3">
<density units="g/cc" value="5.0" />
<nuclide ao="0.0009040745407538578" name="U234" />
<nuclide ao="0.10114794158928406" name="U235" />
<nuclide ao="0.8974846777145036" name="U238" />
<nuclide ao="0.00046330615545845175" name="U236" />
<nuclide ao="1.999242" name="O16" />
<nuclide ao="0.000758" name="O17" />
</material>
<material depletable="true" id="4">
<density units="g/cc" value="0.1" />
<nuclide ao="1.99968852" name="H1" />
<nuclide ao="0.00031148" name="H2" />
<nuclide ao="0.999621" name="O16" />
<nuclide ao="0.000379" name="O17" />
<nuclide ao="5.4e-05" name="U234" />
<nuclide ao="0.007204" name="U235" />
<nuclide ao="0.992742" name="U238" />
</material>
</materials>
179 changes: 179 additions & 0 deletions test/tests/neutronics/tallies/reaction_rates/openmc.i
Original file line number Diff line number Diff line change
@@ -0,0 +1,179 @@
[Mesh]
[sphere]
type = FileMeshGenerator
file = ../../meshes/sphere.e
[]
[solid]
type = CombinerGenerator
inputs = sphere
positions = '0 0 0
0 0 4
0 0 8'
[]
[solid_ids]
type = SubdomainIDGenerator
input = solid
subdomain_id = '100'
[]
[fluid]
type = FileMeshGenerator
file = ../../heat_source/stoplight.exo
[]
[fluid_ids]
type = SubdomainIDGenerator
input = fluid
subdomain_id = '200'
[]
[combine]
type = CombinerGenerator
inputs = 'solid_ids fluid_ids'
[]
[]

[Problem]
type = OpenMCCellAverageProblem
verbose = true

source_strength = 1e6

temperature_blocks = '100 200'
density_blocks = '200'
cell_level = 0

initial_properties = xml

[Tallies]
[Cell]
type = CellTally
score = 'absorption fission scatter total'
blocks = '100 200'
[]
[]
[]

[Executioner]
type = Steady
[]

[Postprocessors]
[total_abs]
type = ElementIntegralVariablePostprocessor
variable = absorption
[]
[fluid_abs]
type = PointValue
variable = absorption
point = '0.0 0.0 2.0'
[]
[pebble1_abs]
type = PointValue
variable = absorption
point = '0.0 0.0 0.0'
[]
[pebble2_abs]
type = PointValue
variable = absorption
point = '0.0 0.0 4.0'
[]
[pebble3_abs]
type = PointValue
variable = absorption
point = '0.0 0.0 8.0'
[]
[max_err_abs]
type = TallyRelativeError
tally_score = 'absorption'
[]

[total_fis]
type = ElementIntegralVariablePostprocessor
variable = fission
[]
[fluid_fis]
type = PointValue
variable = fission
point = '0.0 0.0 2.0'
[]
[pebble1_fis]
type = PointValue
variable = fission
point = '0.0 0.0 0.0'
[]
[pebble2_fis]
type = PointValue
variable = fission
point = '0.0 0.0 4.0'
[]
[pebble3_fis]
type = PointValue
variable = fission
point = '0.0 0.0 8.0'
[]
[max_err_fis]
type = TallyRelativeError
tally_score = 'fission'
[]

[total_sca]
type = ElementIntegralVariablePostprocessor
variable = scatter
[]
[fluid_sca]
type = PointValue
variable = scatter
point = '0.0 0.0 2.0'
[]
[pebble1_sca]
type = PointValue
variable = scatter
point = '0.0 0.0 0.0'
[]
[pebble2_sca]
type = PointValue
variable = scatter
point = '0.0 0.0 4.0'
[]
[pebble3_sca]
type = PointValue
variable = scatter
point = '0.0 0.0 8.0'
[]
[max_err_sca]
type = TallyRelativeError
tally_score = 'scatter'
[]

[total_tot]
type = ElementIntegralVariablePostprocessor
variable = total
[]
[fluid_tot]
type = PointValue
variable = total
point = '0.0 0.0 2.0'
[]
[pebble1_tot]
type = PointValue
variable = total
point = '0.0 0.0 0.0'
[]
[pebble2_tot]
type = PointValue
variable = total
point = '0.0 0.0 4.0'
[]
[pebble3_tot]
type = PointValue
variable = total
point = '0.0 0.0 8.0'
[]
[max_err_tot]
type = TallyRelativeError
tally_score = 'total'
[]
[]

[Outputs]
execute_on = final
csv = true
[]
16 changes: 16 additions & 0 deletions test/tests/neutronics/tallies/reaction_rates/settings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version='1.0' encoding='utf-8'?>
<settings>
<run_mode>fixed source</run_mode>
<particles>100</particles>
<batches>50</batches>
<inactive>10</inactive>
<source strength="1.0">
<space type="box">
<parameters>-5.0 -5.0 0 5.0 5.0 12.0</parameters>
</space>
</source>
<temperature_default>600.0</temperature_default>
<temperature_method>nearest</temperature_method>
<temperature_multipole>false</temperature_multipole>
<temperature_range>294.0 1600.0</temperature_range>
</settings>
9 changes: 9 additions & 0 deletions test/tests/neutronics/tallies/reaction_rates/tests
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[Tests]
[reaction_rates]
type = CSVDiff
input = openmc.i
csvdiff = openmc_out.csv
requirement = "The system shall allow tallying of absorption/fission/scattering/total reaction rates in fixed source mode."
required_objects = 'OpenMCCellAverageProblem'
[]
[]

0 comments on commit 5d6970b

Please sign in to comment.