Skip to content

Commit

Permalink
Adding util function to test for depletion (#1015)
Browse files Browse the repository at this point in the history
  • Loading branch information
john-science committed Dec 13, 2022
1 parent 68d5c3b commit 186d0c2
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
15 changes: 15 additions & 0 deletions armi/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,21 @@ def getBurnSteps(cs):
return [len(steps) for steps in stepLengths]


def hasBurnup(cs):
"""Is depletion being modeled?
Parameters
----------
cs : case settings object
Returns
-------
bool
Are there any burnup steps?
"""
return sum(getBurnSteps(cs)) > 0


def getMaxBurnSteps(cs):
burnSteps = getBurnSteps(cs)
return max(burnSteps)
Expand Down
4 changes: 4 additions & 0 deletions armi/utils/tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
getCycleNodeFromCumulativeNode,
getPreviousTimeNode,
getCumulativeNodeNum,
hasBurnup,
)


Expand Down Expand Up @@ -300,6 +301,9 @@ def test_getBurnSteps(self):
getBurnSteps(self.standaloneSimpleCS), self.burnStepsSimpleSolution
)

def test_hasBurnup(self):
self.assertTrue(hasBurnup(self.standaloneDetailedCS))

def test_getMaxBurnSteps(self):
self.assertEqual(
getMaxBurnSteps(self.standaloneDetailedCS),
Expand Down

0 comments on commit 186d0c2

Please sign in to comment.