Skip to content

Commit

Permalink
add test for scaling params when moving assembly
Browse files Browse the repository at this point in the history
  • Loading branch information
bsculac committed Nov 23, 2024
1 parent b34542e commit be19b2a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
2 changes: 1 addition & 1 deletion armi/reactor/assemblies.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ def scaleParamsToNewSymmetryFactor(self, oldSymmetryFactor=1.0):
if b.p[name] is None:
continue
else:
b.p[name] = b.p[name] / scalingFactor
b.p[name] = b.p[name] * scalingFactor

def getNum(self):
"""Return unique integer for this assembly."""
Expand Down
16 changes: 14 additions & 2 deletions armi/reactor/tests/test_assemblies.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
runLog,
)
from armi.reactor.tests import test_reactors
from armi.reactor.parameters import ParamLocation
from armi.tests import TEST_ROOT, mockRunLogs
from armi.utils import directoryChangers
from armi.utils import textProcessors
Expand Down Expand Up @@ -223,6 +224,7 @@ def setUp(self):
"xsTypeNum": 40,
"zbottom": 97.3521,
"ztop": 111.80279999999999,
"massHmBOL": 9.0,
}

self.blockSettings = {
Expand All @@ -248,6 +250,7 @@ def setUp(self):
for i in range(NUM_BLOCKS):
b = blocks.HexBlock("TestHexBlock")
b.setHeight(self.height)
b.p["massHmBOL"] = self.blockParams["massHmBOL"]

self.hexDims = {
"Tinput": 273.0,
Expand Down Expand Up @@ -347,9 +350,18 @@ def test_moveTo(self):

def test_scaleParamsWhenMoved(self):
"""Volume integrated parameters must be scaled when an assembly is placed on a core boundary."""
ref = self.r.core.spatialGrid.getLocatorFromRingAndPos(3, 10)
i, j = grids.HexGrid.getIndicesFromRingAndPos(3, 10)
i, j = grids.HexGrid.getIndicesFromRingAndPos(1, 1)
locator = self.r.core.spatialGrid[i, j, 0]
originalParamValues = np.array(
[b.p["massHmBOL"] for b in self.assembly.getBlocks(Flags.FUEL)]
)
self.assertEqual(self.assembly.getSymmetryFactor(), 1)
self.assembly.moveTo(locator)
self.assertEqual(self.assembly.getSymmetryFactor(), 3)
thirdParamValues = np.array(
[b.p["massHmBOL"] for b in self.assembly.getBlocks(Flags.FUEL)]
)
assert_allclose(thirdParamValues / originalParamValues, 1 / 3)

def test_getName(self):
cur = self.assembly.getName()
Expand Down

0 comments on commit be19b2a

Please sign in to comment.