Skip to content

Commit

Permalink
Cleaning up a minor XSGM bug (#1751)
Browse files Browse the repository at this point in the history
  • Loading branch information
mgjarrett authored Jun 27, 2024
1 parent f535add commit 9d6e2b0
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 18 deletions.
12 changes: 6 additions & 6 deletions armi/physics/neutronics/crossSectionGroupManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -1235,12 +1235,12 @@ def createRepresentativeBlocksUsingExistingBlocks(

# create a new block collection that inherits all of the properties
# and settings from oldBlockCollection.
if len(oldBlockCollection._validRepresentativeBlockTypes) > 0:
validBlockTypes = []
for flag in oldBlockCollection._validRepresentativeBlockTypes:
validBlockTypes.append(flags._toString(Flags, flag))
else:
validBlockTypes = None
validBlockTypes = oldBlockCollection._validRepresentativeBlockTypes
if validBlockTypes is not None and len(validBlockTypes) > 0:
validBlockTypes = [
flags._toString(Flags, flag)
for flag in oldBlockCollection._validRepresentativeBlockTypes
]
newBlockCollection = oldBlockCollection.__class__(
oldBlockCollection.allNuclidesInProblem,
validBlockTypes=validBlockTypes,
Expand Down
38 changes: 27 additions & 11 deletions armi/physics/neutronics/tests/test_crossSectionManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -816,16 +816,8 @@ def test_getRepresentativeBlocks(self):
self.assertIsNone(blocks[0].p.detailedNDens)
self.assertIsNone(blocks[1].p.detailedNDens)

def test_createRepresentativeBlocksUsingExistingBlocks(self):
"""
Demonstrates that a new representative block can be generated from an existing
representative block.
Notes
-----
This tests that the XS ID of the new representative block is correct and that the
compositions are identical between the original and the new representative blocks.
"""
def _createRepresentativeBlocksUsingExistingBlocks(self, validBlockTypes):
"""Reusable code used in multiple unit tests."""
o, r = test_reactors.loadTestReactor(
TEST_ROOT, inputFileName="smallestTestReactor/armiRunSmallest.yaml"
)
Expand All @@ -843,7 +835,7 @@ def test_createRepresentativeBlocksUsingExistingBlocks(self):
}
)
o.cs[CONF_CROSS_SECTION].setDefaults(
crossSectionGroupManager.AVERAGE_BLOCK_COLLECTION, ["fuel"]
crossSectionGroupManager.AVERAGE_BLOCK_COLLECTION, validBlockTypes
)
aaSettings = o.cs[CONF_CROSS_SECTION]["AA"]
self.csm.cs = copy.deepcopy(o.cs)
Expand Down Expand Up @@ -877,6 +869,30 @@ def test_createRepresentativeBlocksUsingExistingBlocks(self):
continue
self.assertEqual(baSettingValue, aaSettings.__dict__[setting])

def test_createRepresentativeBlocksUsingExistingBlocks(self):
"""
Demonstrates that a new representative block can be generated from an existing
representative block.
Notes
-----
This tests that the XS ID of the new representative block is correct and that the
compositions are identical between the original and the new representative blocks.
"""
self._createRepresentativeBlocksUsingExistingBlocks(["fuel"])

def test_createRepresentativeBlocksUsingExistingBlocksDisableValidBlockTypes(self):
"""
Demonstrates that a new representative block can be generated from an existing
representative block with the setting `disableBlockTypeExclusionInXsGeneration: true`.
Notes
-----
This tests that the XS ID of the new representative block is correct and that the
compositions are identical between the original and the new representative blocks.
"""
self._createRepresentativeBlocksUsingExistingBlocks(True)

def test_interactBOL(self):
"""Test `BOL` lattice physics update frequency.
Expand Down
2 changes: 1 addition & 1 deletion doc/release/0.3.rst
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ Bug Fixes
---------
#. Fixed four bugs with "corners up" hex grids. (`PR#1649 <https://github.com/terrapower/armi/pull/1649>`_)
#. Fixed ``safeCopy`` to work on both Windows and Linux with strict permissions (`PR#1691 <https://github.com/terrapower/armi/pull/1691>`_)
#. When creating a new XS group, inherit settings from initial group. (`PR#1653 <https://github.com/terrapower/armi/pull/1653>`_)
#. When creating a new XS group, inherit settings from initial group. (`PR#1653 <https://github.com/terrapower/armi/pull/1653>`_, `PR#1751 <https://github.com/terrapower/armi/pull/1751>`_)

#. TBD

Expand Down

0 comments on commit 9d6e2b0

Please sign in to comment.