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

Call completeInitialLoading after applying thermal expansion to the reactor core. #885

Merged
merged 4 commits into from Sep 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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