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

account for symmetry in initialB10ComponentVol calc #2017

Draft
wants to merge 11 commits into
base: main
Choose a base branch
from
15 changes: 15 additions & 0 deletions armi/reactor/assemblies.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,13 +206,28 @@ def insert(self, index, obj):

def moveTo(self, locator):
"""Move an assembly somewhere else."""
oldSymmetryFactor = self.getSymmetryFactor()
composites.Composite.moveTo(self, locator)
if self.lastLocationLabel != self.DATABASE:
self.p.numMoves += 1
self.p.daysSinceLastMove = 0.0
self.parent.childrenByLocator[locator] = self
# symmetry may have changed (either moving on or off of symmetry line)
self.clearCache()
self.scaleParamsToNewSymmetryFactor(oldSymmetryFactor)

def scaleParamsToNewSymmetryFactor(self, oldSymmetryFactor=1.0):
volIntegratedParamsToScale = self.getBlocks()[0].p.paramDefs.atLocation(
ParamLocation.VOLUME_INTEGRATED
)
scalingFactor = oldSymmetryFactor / self.getSymmetryFactor()
for b in self.getBlocks():
for param in volIntegratedParamsToScale:
name = param.name
if b.p[name] is None:
continue
else:
b.p[name] = b.p[name] * scalingFactor

def getNum(self):
"""Return unique integer for this assembly."""
Expand Down
3 changes: 3 additions & 0 deletions armi/reactor/blockParameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,18 +85,21 @@ def getBlockParameterDefinitions():
"molesHmBOL",
units=f"{units.MOLES}",
description="Total number of atoms of heavy metal at BOL assuming a full assembly",
location=ParamLocation.VOLUME_INTEGRATED,
)

pb.defParam(
"massHmBOL",
units=units.GRAMS,
description="Mass of heavy metal at BOL",
location=ParamLocation.VOLUME_INTEGRATED,
)

pb.defParam(
"initialB10ComponentVol",
units=f"{units.CM}^3",
description="cc's of un-irradiated, cold B10 containing component (includes full volume if any B10)",
location=ParamLocation.VOLUME_INTEGRATED,
)

pb.defParam(
Expand Down
19 changes: 18 additions & 1 deletion armi/reactor/tests/test_assemblies.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,6 @@ def setUp(self):
)

self.assembly = makeTestAssembly(NUM_BLOCKS, self.assemNum, r=self.r)
self.r.core.add(self.assembly)

# Use these if they are needed
self.blockParams = {
Expand All @@ -224,6 +223,7 @@ def setUp(self):
"xsTypeNum": 40,
"zbottom": 97.3521,
"ztop": 111.80279999999999,
"massHmBOL": 9.0,
}

self.blockSettings = {
Expand All @@ -249,6 +249,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 All @@ -267,6 +268,7 @@ def setUp(self):
self.assembly.add(b)
self.blockList.append(b)

self.r.core.add(self.assembly)
self.assembly.calculateZCoords()

def test_isOnWhichSymmetryLine(self):
Expand Down Expand Up @@ -345,6 +347,21 @@ def test_moveTo(self):
cur = self.assembly.spatialLocator
self.assertEqual(cur, ref)

def test_scaleParamsWhenMoved(self):
"""Volume integrated parameters must be scaled when an assembly is placed on a core boundary."""
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()
ref = self.name
Expand Down
Loading