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 3 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
11 changes: 7 additions & 4 deletions armi/physics/neutronics/crossSectionGroupManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -1235,10 +1235,13 @@ 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))
if oldBlockCollection._validRepresentativeBlockTypes is not None:
if len(oldBlockCollection._validRepresentativeBlockTypes) > 0:
validBlockTypes = []
for flag in oldBlockCollection._validRepresentativeBlockTypes:
validBlockTypes.append(flags._toString(Flags, flag))
else:
validBlockTypes = None
else:
validBlockTypes = None
mgjarrett marked this conversation as resolved.
Show resolved Hide resolved
newBlockCollection = oldBlockCollection.__class__(
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
Loading