Skip to content

Commit

Permalink
Merge 2e2aaf6 into 4fcea82
Browse files Browse the repository at this point in the history
  • Loading branch information
albeanth authored Mar 25, 2022
2 parents 4fcea82 + 2e2aaf6 commit d8888ec
Show file tree
Hide file tree
Showing 8 changed files with 1,103 additions and 473 deletions.
37 changes: 37 additions & 0 deletions armi/materials/fakeMaterial.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
"""fake test materials for unit tests in armi.reactor.converters.tests.test_axialExpansionChanger"""
from armi.materials.ht9 import HT9
from armi.utils import units


class Fake(HT9):
"""
Fake material based on HT9, used to verify
assembly axial expansion
"""

name = "Fake"

def __init__(self):
HT9.__init__(self)

def linearExpansionPercent(self, Tk=None, Tc=None):
""" A fake linear expansion percent"""
Tc = units.getTc(Tc, Tk)
return 0.02 * Tc


class FakeException(HT9):
"""
Fake material based on HT9, used to verify exceptions
in assembly axial expansion
"""

name = "FakeException"

def __init__(self):
HT9.__init__(self)

def linearExpansionPercent(self, Tk=None, Tc=None):
""" A fake linear expansion percent"""
Tc = units.getTc(Tc, Tk)
return 0.08 * Tc
94 changes: 0 additions & 94 deletions armi/reactor/assemblies.py
Original file line number Diff line number Diff line change
Expand Up @@ -1197,100 +1197,6 @@ def countBlocksWithFlags(self, blockTypeSpec=None):
"""
return len(self.getBlocks(blockTypeSpec))

def axiallyExpandBlockHeights(self, heightList, nucNamesToConserveMass):
"""
Takes a list of new fuel block heights and then scales the fuel blocks to the
new heights, adjusting densities to preserve mass
Adjusts the height of the lowest plenum block to keep total assembly height
constant.
Parameters
----------
heightList : list of floats
Entry 0 represents the height (in cm) of the bottom fuel block closest to
the grid plate Entry n represents the height (in cm) of the top fuel block
closest to the plenum
nucNamesToConserveMass : list
The nuclides to conserve mass of
See Also
--------
axiallyExpand : expands blocks uniformly. could be combined.
"""
if self.countBlocksWithFlags(Flags.FUEL) != len(heightList):
raise RuntimeError(
"number of blocks {} and len of height list {} not equal in "
"assembly {}. Cannot axially expand".format(
self.countBlocksWithFlags(Flags.FUEL), len(heightList), self
)
)

initialHeight = self.getHeight()

cumulativeHeightAdded = 0.0
for b, newHeight in zip(self.getBlocks(Flags.FUEL), heightList):
originalHeight = b.getHeight()
b.setHeight(newHeight, conserveMass=True, adjustList=nucNamesToConserveMass)
cumulativeHeightAdded += newHeight - originalHeight

# shrink/grow plenum accordingly to keep T/H parameters, etc. consistent.
plenumBlocks = self.getBlocks(Flags.PLENUM)
if not plenumBlocks:
runLog.warning(
"No plenum blocks found in {0}. Axial expansion is modifying the "
"total assembly height and volume.".format(self)
)
# Alter assembly number density to account conserve attoms during volume
# change.
# This is analogous to what happens to component/block number density
# during `armi.reactor.blocks.Block.adjustDensity`, which gets called when
# block heights change.
if self.p.detailedNDens is not None:
self.p.detailedNDens *= initialHeight / (
initialHeight + cumulativeHeightAdded
)
else:
plenumBlock = plenumBlocks[-1] # adjust the top plenum block
plenumHeight = plenumBlock.getHeight()
if cumulativeHeightAdded < plenumHeight:
plenumBlock.setHeight(plenumHeight - cumulativeHeightAdded)
else:
raise RuntimeError(
"Cannot subtract {0} cm from plenum block "
"that is only {1} tall.".format(cumulativeHeightAdded, plenumHeight)
)

def axiallyExpand(self, percent, adjustList):
"""
Axially expands an entire assembly.
Parameters
----------
percent : float
Number from 0 to 100 to make this assembly grow by that much.
If you pass a negative number, the code will actually shrink the assembly by
that percent.
adjustList : list
Nuclides to modify. Omit things like sodium to let it flow.
See Also
--------
axiallyExpandBlockHeights : allows non-uniform expansions. Does the work.
"""
growFrac = percent / 100.0
fuelBlockHeights = []
for b in self.getBlocks(Flags.FUEL):
heightOriginal = b.getHeight()
if growFrac > 0:
fuelBlockHeights.append(heightOriginal * (1.0 + growFrac))
else:
# NOTICE THE SIGN SWITCH! SINCE WE GAVE NEGATIVE NUMBER AS AN INDICATOR!
fuelBlockHeights.append(heightOriginal * (1.0 / (1.0 - growFrac)))

self.axiallyExpandBlockHeights(fuelBlockHeights, adjustList)

def getDim(self, typeSpec, dimName):
"""
Search through blocks in this assembly and find the first component of compName.
Expand Down
Loading

0 comments on commit d8888ec

Please sign in to comment.