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

Clean up a minor bug in #1653 #1751

Merged
merged 6 commits into from
Jun 27, 2024
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -53,7 +53,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
Loading