Skip to content

Commit

Permalink
Merge f159ed7 into df33e8d
Browse files Browse the repository at this point in the history
  • Loading branch information
jakehader committed Sep 19, 2022
2 parents df33e8d + f159ed7 commit 20c1666
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 27 deletions.
24 changes: 12 additions & 12 deletions armi/reactor/reactors.py
Expand Up @@ -27,18 +27,8 @@
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

import numpy

from armi import runLog
from armi import getPluginManagerOrFail, materials, nuclearDataIO, settings
from armi import runLog
from armi.nuclearDataIO import xsLibraries
from armi.reactor import assemblies
from armi.reactor import assemblyLists
Expand All @@ -49,13 +39,22 @@
from armi.reactor import reactorParameters
from armi.reactor import systemLayoutInput
from armi.reactor import zones
from armi.reactor.converters.axialExpansionChanger import AxialExpansionChanger
from armi.reactor.flags import Flags
from armi.settings.fwSettings.globalSettings import CONF_MATERIAL_NAMESPACE_ORDER
from armi.utils import createFormattedStrWithDelimiter, units
from armi.utils import directoryChangers
from armi.utils.iterables import Sequence
from armi.utils.mathematics import average1DWithinTolerance
from armi.reactor.converters.axialExpansionChanger import AxialExpansionChanger
import collections
import copy
import itertools
import os
import time
from typing import Optional

import numpy
import tabulate


class Reactor(composites.Composite):
Expand Down Expand Up @@ -2355,3 +2354,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 20c1666

Please sign in to comment.