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

Fixing Component density to agree with 3D density #860

Merged
merged 7 commits into from
Aug 26, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
18 changes: 14 additions & 4 deletions armi/reactor/components/component.py
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
Expand Up @@ -586,19 +586,15 @@ def test_ExpansionConservationHotHeightDefined(self):
circle1.temperatureInC, circle1.inputTemperatureInC
)
factorToUndoHotHeight = circle1.getThermalExpansionFactor()
onufer marked this conversation as resolved.
Show resolved Hide resolved
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