Skip to content

Commit

Permalink
Use runLog.error and exceptions in getOptimalAssemblyOrientation
Browse files Browse the repository at this point in the history
  • Loading branch information
drewj-tp committed Nov 27, 2024
1 parent e319100 commit 52ec5d8
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions armi/physics/fuelCycle/hexAssemblyFuelMgmtUtils.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,9 @@ def getOptimalAssemblyOrientation(a: "HexAssembly", aPrev: "HexAssembly") -> int
"""
maxBuBlock = maxBurnupBlock(a)
if maxBuBlock.spatialGrid is None:
raise ValueError(
f"Block {maxBuBlock} in {a} does not have a spatial grid. Cannot rotate."
)
msg = f"Block {maxBuBlock} in {a} does not have a spatial grid. Cannot rotate."
runLog.error(msg)
raise ValueError(msg)
maxBuPinLocation = maxBurnupLocator(maxBuBlock)
# No need to rotate if max burnup pin is the center
if maxBuPinLocation.i == 0 and maxBuPinLocation.j == 0:
Expand All @@ -105,10 +105,12 @@ def getOptimalAssemblyOrientation(a: "HexAssembly", aPrev: "HexAssembly") -> int
previousLocations = blockAtPreviousLocation.getPinLocations()
previousPowers = blockAtPreviousLocation.p.linPowByPin
if len(previousLocations) != len(previousPowers):
raise ValueError(
msg = (
f"Inconsistent pin powers and number of pins in {blockAtPreviousLocation}. "
f"Found {len(previousLocations)} locations but {len(previousPowers)} powers."
)
runLog.error(msg)
raise ValueError(msg)

ringPowers = {
(loc.i, loc.j): p for loc, p in zip(previousLocations, previousPowers)
Expand Down

0 comments on commit 52ec5d8

Please sign in to comment.