Skip to content

Commit

Permalink
udpate adjustDensityForHeightExpansion
Browse files Browse the repository at this point in the history
  • Loading branch information
onufer committed Aug 25, 2022
1 parent a9b9f44 commit 84f5657
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 25 deletions.
18 changes: 14 additions & 4 deletions armi/reactor/components/component.py
Expand Up @@ -357,20 +357,30 @@ def applyMaterialMassFracsToNumberDensities(self):
)
self.changeNDensByFactor(1.0 / coldMatAxialExpansionFactor)

def adjustDensityForHeightExpansion(self):
def adjustDensityForHeightExpansion(self, newHot):
"""
Change the densities in cases where height of the block/component is increasing
Change the densities in cases where height of the block/component is changing with expansion.
Notes
-----
Call after setTemperature.
Call before setTemperature since we need old hot temp.
This works well if there is only 1 solid component.
If there are multiple components expanding at different rates during thermal
expansion this becomes more complicated and, and axial expansion should be used.
Multiple expansion rates cannot trivially be accommodated.
See AxialExpansionChanger.
"""
self.changeNDensByFactor(1.0 / self.getThermalExpansionFactor())
self.changeNDensByFactor(1.0 / self.getHeightFactor(newHot))

def getHeightFactor(self, newHot):
"""
Return the factor by which height would change by if we did 3D expansion.
Notes
-----
Call before setTemperature since we need old hot temp.
"""
return self.getThermalExpansionFactor(Tc=newHot, T0=self.temperatureInC)

def getProperties(self):
"""Return the active Material object defining thermo-mechanical properties."""
Expand Down
27 changes: 6 additions & 21 deletions armi/reactor/tests/test_components.py
Expand Up @@ -586,19 +586,15 @@ def test_ExpansionConservationHotHeightDefined(self):
circle1.temperatureInC, circle1.inputTemperatureInC
)
factorToUndoHotHeight = circle1.getThermalExpansionFactor()
self.assertAlmostEqual(
coldMatAxialExpansionFactor,
factorToUndoHotHeight,
)
# when block.setHeight is called (which effectively changes component height)
# component.setNumberDensity is called (for solid isotopes) to adjust the number
# density so that now the 2D expansion will be approximated/expanded around
# the hot temp which is akin to these adjustments

# undo the old coldMatAxialExpansionFactor
circle1.changeNDensByFactor(factorToUndoHotHeight)
# change to self.THot
heightFactor = circle1.getHeightFactor(self.tHot)
circle1.adjustDensityForHeightExpansion(self.tHot) # apply temp at new height
circle1.setTemperature(self.tHot)
circle1.adjustDensityForHeightExpansion() # apply at new temp

# now its density is same as hot component
self.assertAlmostEqual(
Expand All @@ -607,26 +603,18 @@ def test_ExpansionConservationHotHeightDefined(self):
)

# show that mass is conserved after expansion
circle1NewHotHeight = (
hotHeight * circle1.getThermalExpansionFactor() / factorToUndoHotHeight
)
circle1NewHotHeight = hotHeight * heightFactor
self.assertAlmostEqual(
mass1, circle1.getMassDensity() * circle1.getArea() * circle1NewHotHeight
)
# you can calculate the height exp factor directly this way
self.assertAlmostEqual(
circle1.getThermalExpansionFactor() / factorToUndoHotHeight,
circle1.getThermalExpansionFactor(Tc=circle1.temperatureInC, T0=self.tWarm),
)

self.assertAlmostEqual(
circle1.getMassDensity(),
circle1.material.density3(Tc=circle1.temperatureInC),
)
# change back to old temp
circle1.changeNDensByFactor(circle1.getThermalExpansionFactor())
circle1.adjustDensityForHeightExpansion(self.tWarm)
circle1.setTemperature(self.tWarm)
circle1.adjustDensityForHeightExpansion()

# check for consistency
self.assertAlmostEqual(initialDens, circle1.getMassDensity())
Expand All @@ -651,11 +639,8 @@ def test_ExpansionConservationColdHeightDefined(self):
circle1AdjustTo2 = Circle("circle", "HT9", 20, self.tWarm, 1.0)

# make it hot like 2
circle1AdjustTo2.changeNDensByFactor(
circle1AdjustTo2.getThermalExpansionFactor()
)
circle1AdjustTo2.adjustDensityForHeightExpansion(self.tHot)
circle1AdjustTo2.setTemperature(self.tHot)
circle1AdjustTo2.adjustDensityForHeightExpansion()
# check that its like 2
self.assertAlmostEqual(
circle2.getMassDensity(), circle1AdjustTo2.getMassDensity()
Expand Down

0 comments on commit 84f5657

Please sign in to comment.