diff --git a/armi/reactor/assemblies.py b/armi/reactor/assemblies.py index 73503efcd..e19ed7a4e 100644 --- a/armi/reactor/assemblies.py +++ b/armi/reactor/assemblies.py @@ -206,6 +206,7 @@ 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 @@ -213,6 +214,20 @@ def moveTo(self, locator): 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.""" diff --git a/armi/reactor/blockParameters.py b/armi/reactor/blockParameters.py index 820ebac9f..277f7928b 100644 --- a/armi/reactor/blockParameters.py +++ b/armi/reactor/blockParameters.py @@ -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( diff --git a/armi/reactor/tests/test_assemblies.py b/armi/reactor/tests/test_assemblies.py index c18850ed0..83a0bc0e1 100644 --- a/armi/reactor/tests/test_assemblies.py +++ b/armi/reactor/tests/test_assemblies.py @@ -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 = { @@ -224,6 +223,7 @@ def setUp(self): "xsTypeNum": 40, "zbottom": 97.3521, "ztop": 111.80279999999999, + "massHmBOL": 9.0, } self.blockSettings = { @@ -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, @@ -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): @@ -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