Skip to content

Commit

Permalink
Fixing _getParamMax for Volume-Integrated Assembly Params (#2033)
Browse files Browse the repository at this point in the history
  • Loading branch information
bsculac authored Dec 11, 2024
1 parent 9945e29 commit c078cde
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 7 deletions.
13 changes: 9 additions & 4 deletions armi/physics/fuelCycle/fuelHandlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,19 +212,24 @@ def _compareAssem(candidate, current):

@staticmethod
def _getParamMax(a, paramName, blockLevelMax=True):
"""Get parameter with Block-level maximum."""
"""Get assembly/block-level maximum parameter value in assembly."""
multiplier = a.getSymmetryFactor()
if multiplier != 1:
# handle special case: volume-integrated parameters where symmetry factor is not 1
if blockLevelMax:
paramCollection = a.getBlocks()[0].p
else:
paramCollection = a.p
isVolumeIntegrated = (
a.getBlocks()[0].p.paramDefs[paramName].location
paramCollection.paramDefs[paramName].location
== ParamLocation.VOLUME_INTEGRATED
)
multiplier = a.getSymmetryFactor() if isVolumeIntegrated else 1.0

if blockLevelMax:
return a.getChildParamValues(paramName).max() * multiplier

return a.p[paramName] * multiplier
else:
return a.p[paramName] * multiplier

def findAssembly(
self,
Expand Down
25 changes: 22 additions & 3 deletions armi/physics/fuelCycle/tests/test_fuelHandlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
from armi.settings import caseSettings
from armi.tests import TEST_ROOT, ArmiTestHelper, mockRunLogs
from armi.utils import directoryChangers
from armi.reactor.parameters import ParamLocation


class FuelHandlerTestHelper(ArmiTestHelper):
Expand Down Expand Up @@ -153,14 +154,32 @@ def interactBOC(self, cycle=None):


class TestFuelHandler(FuelHandlerTestHelper):
def test_getParamMax(self):
@patch("armi.reactor.assemblies.Assembly.getSymmetryFactor")
def test_getParamMax(self, mockGetSymmetry):

a = self.assembly
mockGetSymmetry.return_value = 1
expectedValue = 0.5
a.p["kInf"] = expectedValue
for b in a:
b.p["kInf"] = expectedValue

# symmetry factor == 1
res = fuelHandlers.FuelHandler._getParamMax(a, "kInf", True)
self.assertEqual(res, expectedValue)

res = fuelHandlers.FuelHandler._getParamMax(a, "kInf", False)
self.assertEqual(res, expectedValue)

# symmetry factor == 3
mockGetSymmetry.return_value = 3
a.p.paramDefs["kInf"].location = ParamLocation.VOLUME_INTEGRATED
a.getBlocks()[0].p.paramDefs["kInf"].location = ParamLocation.VOLUME_INTEGRATED
res = fuelHandlers.FuelHandler._getParamMax(a, "kInf", True)
self.assertEqual(res, 0.0)
self.assertAlmostEqual(res, expectedValue * 3)

res = fuelHandlers.FuelHandler._getParamMax(a, "kInf", False)
self.assertEqual(res, 0.0)
self.assertAlmostEqual(res, expectedValue * 3)

def test_interactBOC(self):
# set up mock interface
Expand Down

0 comments on commit c078cde

Please sign in to comment.