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

Accounting for symmetry in volume-integrated parameters #2017

Merged
merged 33 commits into from
Dec 11, 2024
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
8074ee1
account for symmetry in initialB10ComponentVol calc
bsculac Nov 21, 2024
2d3d3fe
add test
bsculac Nov 21, 2024
40b76d1
remove unnecessary changes
bsculac Nov 21, 2024
7c0b696
add parameter scaling on assembly move
bsculac Nov 22, 2024
3d72657
flip getAge check to be what was intended
bsculac Nov 22, 2024
1d9e807
remove superfluous symmetry adjustment
bsculac Nov 22, 2024
85bdd01
fix error when accessing parameters
bsculac Nov 22, 2024
b34542e
change test to add assembly after it has blocks
bsculac Nov 22, 2024
be19b2a
add test for scaling params when moving assembly
bsculac Nov 23, 2024
7f7206d
ruff
bsculac Nov 23, 2024
8777b4d
ruff2
bsculac Nov 23, 2024
792a5e9
add volume integrated tags to params that should have it, fix test
bsculac Dec 3, 2024
a1d1699
lint
bsculac Dec 3, 2024
88a0f6d
Merge branch 'main' of https://github.com/terrapower/armi into symmet…
bsculac Dec 3, 2024
9f4becb
fix unit test and example notebook
bsculac Dec 4, 2024
1e08e84
remove breadcrumbs
bsculac Dec 4, 2024
1a562f7
remove execution counts from example notebook
bsculac Dec 4, 2024
72ffaee
fix test that uses assembly comparison
bsculac Dec 5, 2024
e410d08
update test to account for symmetry factor
bsculac Dec 5, 2024
8e7185c
Merge branch 'main' of https://github.com/terrapower/armi into symmet…
bsculac Dec 5, 2024
7ca1e13
resolve errors in tests that specially accounted for symmetry
bsculac Dec 5, 2024
19bb4fb
apply multiplier more universally in _getParamMax
bsculac Dec 6, 2024
29e75a8
remove bad variable default, minor efficiency improvement
bsculac Dec 6, 2024
c03c5bb
account for iterable parameters
bsculac Dec 6, 2024
7ccc70d
remove breadcrumbs (again)
bsculac Dec 6, 2024
89997f2
correct getPuMoles to be in line with other parameters
bsculac Dec 9, 2024
e6e3af1
relocate param defenintions for clarity
bsculac Dec 9, 2024
22ec250
Apply suggestions from code review
bsculac Dec 10, 2024
6dcebcb
rephrase volume integrated check
bsculac Dec 10, 2024
67eafd1
Apply suggestions from code review
bsculac Dec 10, 2024
969f409
short circuit checking when not needed
bsculac Dec 10, 2024
eae2ffb
Merge branch 'symmetry_parameter_fix' of https://github.com/terrapowe…
bsculac Dec 10, 2024
cab4eb6
Update armi/physics/fuelCycle/fuelHandlers.py
john-science Dec 11, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion armi/bookkeeping/db/tests/test_comparedb3.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ def test_compareDatabaseSim(self):
dbs[1]._fullPath,
timestepCompare=[(0, 0), (0, 1)],
)
self.assertEqual(len(diffs.diffs), 504)
self.assertEqual(len(diffs.diffs), 576)
john-science marked this conversation as resolved.
Show resolved Hide resolved
# Cycle length is only diff (x3)
self.assertEqual(diffs.nDiffs(), 3)

Expand Down
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():
keckler marked this conversation as resolved.
Show resolved Hide resolved
for param in volIntegratedParamsToScale:
john-science marked this conversation as resolved.
Show resolved Hide resolved
name = param.name
if b.p[name] is None:
continue
else:
b.p[name] = b.p[name] * scalingFactor
john-science marked this conversation as resolved.
Show resolved Hide resolved

def getNum(self):
"""Return unique integer for this assembly."""
Expand Down
11 changes: 9 additions & 2 deletions armi/reactor/blockParameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,19 +84,25 @@ def getBlockParameterDefinitions():
pb.defParam(
"molesHmBOL",
units=f"{units.MOLES}",
description="Total number of atoms of heavy metal at BOL assuming a full assembly",
description="Total number of atoms of heavy metal at BOL.",
location=ParamLocation.VOLUME_INTEGRATED,
mgjarrett marked this conversation as resolved.
Show resolved Hide resolved
)

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)",
description=(
"cc's of un-irradiated, cold B10 containing component "
"(includes full volume of any components with B10)"
),
location=ParamLocation.VOLUME_INTEGRATED,
)

pb.defParam(
Expand All @@ -112,6 +118,7 @@ def getBlockParameterDefinitions():
"molesHmNow",
units=f"{units.MOLES}",
description="Total number of atoms of heavy metal",
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