Skip to content

Commit

Permalink
Call completeInitialLoading after applying thermal expansion to the…
Browse files Browse the repository at this point in the history
… reactor core. (#885)

Add fix in applyThermalExpansion to the reactor to call the block's completeInitialLoading method. This method is required to be called as it sets initial BOL values on each block, like heavy metal mass/moles on itself and its components. Additionally, this sets the smear density and initial enrichment
  • Loading branch information
jakehader committed Sep 19, 2022
1 parent df33e8d commit e1e4816
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 17 deletions.
5 changes: 3 additions & 2 deletions armi/reactor/reactors.py
Expand Up @@ -27,15 +27,15 @@
The Reactor contains a Core, which contains a heirachical collection of Assemblies, which in turn
each contain a collection of Blocks.
"""
from typing import Optional
import collections
import copy
import itertools
import os
import tabulate
import time
from typing import Optional

import numpy
import tabulate

from armi import runLog
from armi import getPluginManagerOrFail, materials, nuclearDataIO, settings
Expand Down Expand Up @@ -2355,3 +2355,4 @@ def _applyThermalExpansion(
if not a.hasFlags(Flags.CONTROL):
for b in a:
b.p.heightBOL = b.getHeight()
b.completeInitialLoading()
60 changes: 45 additions & 15 deletions armi/reactor/tests/test_reactors.py
Expand Up @@ -845,19 +845,37 @@ def test_applyThermalExpansion_CoreConstruct(self):
# stash original axial mesh info
oldRefBlockAxialMesh = self.r.core.p.referenceBlockAxialMesh
oldAxialMesh = self.r.core.p.axialMesh
oldBlockBOLHeights = {}
for a in assemsToChange:
for b in a[1:]:
oldBlockBOLHeights[b] = b.p.heightBOL

nonEqualParameters = ["heightBOL", "molesHmBOL", "massHmBOL"]
equalParameters = ["smearDensity", "nHMAtBOL", "enrichmentBOL"]

oldBlockParameters = {}
for param in nonEqualParameters + equalParameters:
oldBlockParameters[param] = {}
for a in assemsToChange:
for b in a[1:]:
oldBlockParameters[param][b] = b.p[param]

self.r.core.processLoading(self.o.cs, dbLoad=False)
for i, val in enumerate(oldRefBlockAxialMesh[1:]):
self.assertNotEqual(val, self.r.core.p.referenceBlockAxialMesh[i])
for i, val in enumerate(oldAxialMesh[1:]):
self.assertNotEqual(val, self.r.core.p.axialMesh[i])

for a in assemsToChange:
if not a.hasFlags(Flags.CONTROL):
for b in a[1:]:
self.assertNotEqual(oldBlockBOLHeights[b], b.p.heightBOL)
for param in nonEqualParameters:
if oldBlockParameters[param][b] and b.p[param]:
self.assertNotEqual(
oldBlockParameters[param][b], b.p[param]
)
else:
self.assertAlmostEqual(
oldBlockParameters[param][b], b.p[param]
)
for param in equalParameters:
self.assertAlmostEqual(oldBlockParameters[param][b], b.p[param])

def test_updateBlockBOLHeights_DBLoad(self):
"""test Core::_applyThermalExpansion for db load
Expand All @@ -868,21 +886,33 @@ def test_updateBlockBOLHeights_DBLoad(self):
- to maintain code coverage, _applyThermalExpansion is called via processLoading
"""
self.o.cs["inputHeightsConsideredHot"] = False
# stash original blueprint assemblies axial mesh info
oldBlockBOLHeights = {}
assemsToChange = [a for a in self.r.blueprints.assemblies.values()]
for a in assemsToChange:
for b in a[1:]:
oldBlockBOLHeights[b] = b.p.heightBOL
# stash original blueprint assemblies axial mesh info
nonEqualParameters = ["heightBOL", "molesHmBOL", "massHmBOL"]
equalParameters = ["smearDensity", "nHMAtBOL", "enrichmentBOL"]
oldBlockParameters = {}
for param in nonEqualParameters + equalParameters:
oldBlockParameters[param] = {}
for a in assemsToChange:
for b in a[1:]:
oldBlockParameters[param][b] = b.p[param]

self.r.core.processLoading(self.o.cs, dbLoad=True)

for a in assemsToChange:
if not a.hasFlags(Flags.CONTROL):
for b in a[1:]:
self.assertNotEqual(
oldBlockBOLHeights[b],
b.p.heightBOL,
msg="{0}, {1}".format(a, b),
)
for param in nonEqualParameters:
if oldBlockParameters[param][b] and b.p[param]:
self.assertNotEqual(
oldBlockParameters[param][b], b.p[param]
)
else:
self.assertAlmostEqual(
oldBlockParameters[param][b], b.p[param]
)
for param in equalParameters:
self.assertAlmostEqual(oldBlockParameters[param][b], b.p[param])


class CartesianReactorTests(ReactorTests):
Expand Down
1 change: 1 addition & 0 deletions doc/release/0.2.rst
Expand Up @@ -58,6 +58,7 @@ Bug fixes
#. Fixed bug where components were different if initialized through blueprints vs init (bug active for ~ 2 months).
#. Fixed bug where component mass was being conserved in axial expansion instead of correct density (`PR#846 <https://github.com/terrapower/armi/pull/846>`_)
#. Fixed bug in ``armi/reactor/blocks.py::HexBlock::rotatePins`` that failed to modify pinLocation parameter (`#855 <https://github.com/terrapower/armi/pull/855>`_).
#. Fixed bug in ``armi/reactor.py::Core::_applyThermalExpansion`` that failed to call the ``block.completeInitiaLoading`` (`#885 <https://github.com/terrapower/armi/pull/885>`_).
#. TBD

ARMI v0.2.3
Expand Down

0 comments on commit e1e4816

Please sign in to comment.