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

Number density bug fix #804

Merged
merged 8 commits into from
Aug 3, 2022
Merged
Show file tree
Hide file tree
Changes from 5 commits
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
4 changes: 2 additions & 2 deletions armi/reactor/blueprints/blockBlueprint.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,12 +119,12 @@ def construct(
if cs["inputHeightsConsideredHot"]:
if "group" in c.name:
jakehader marked this conversation as resolved.
Show resolved Hide resolved
for component in c:
component.applyHotHeightDensityReduction()
component.adjustNDensForHotHeight()
componentBlueprint.insertDepletableNuclideKeys(
component, blueprint
)
else:
c.applyHotHeightDensityReduction()
c.adjustNDensForHotHeight()
componentBlueprint.insertDepletableNuclideKeys(c, blueprint)
components[c.name] = c
if spatialGrid:
Expand Down
46 changes: 24 additions & 22 deletions armi/reactor/components/component.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ def __init__(
self.temperatureInC = Thot
self.material = None
self.setProperties(material)
self.applyMaterialMassFracsToNumberDensities() # not necessary when duplicating...
self.setNDensFromMassFracsAtTempInC() # not necessary when duplicating...
self.setType(name)
self.p.mergeWith = mergeWith
self.p.customIsotopicsName = isotopics
Expand Down Expand Up @@ -327,42 +327,44 @@ def setProperties(self, properties):
self.material.parent = self
self.clearLinkedCache()

def applyMaterialMassFracsToNumberDensities(self):
def setNDensFromMassFracsAtTempInC(self):
"""
Set initial (cold) number densities of this component based Material composition.
Set number densities for the component based on material mass fractions using hot temperatures.

Notes
-----
- the density returned accounts for the radial expansion of the component
due to the difference in self.inputTemperatureInC and self.temperatureInC
- axial expansion effects are not included here.

See Also
--------
self.adjustNDensForHotHeight
"""
density = self.material.getProperty("density", Tc=self.inputTemperatureInC)
density = self.material.getProperty("density", Tc=self.temperatureInC)

self.p.numberDensities = densityTools.getNDensFromMasses(
density, self.material.p.massFrac
)

def applyHotHeightDensityReduction(self):
def adjustNDensForHotHeight(self):
"""
Set initial (hot) number densities of this component based Material composition.
Adjust number densities to account for prescribed hot block heights (axial expansion).

Notes
-----
We apply the hot-height density reduction here to account for pre-expanded
block heights in blueprints.
Future temperature changes can be handled by multiplications of 1/(1+dLL)**2
instead of 1/(1+dLL)**3 since we have pre-expanded in the axial direction.
"""
denistyIfNotPreExpandedAxially = self.material.getProperty(
"density", self.temperatureInK
)
- We apply this hot height density reduction to account for pre-expanded
block heights in blueprints.
- This is called when inputHeightsConsideredHot: True.

# axial expansion factor must be applied because ARMI expects hot heights
# to be entered on assemblies in the blueprints so that it doesn't have to
# handle the problem of fuel axially expanding at a different rate than clad.
See Also
--------
self.setNDensFromMassFracsAtTempInC
"""
axialExpansionFactor = 1.0 + self.material.linearExpansionFactor(
self.temperatureInC, self.inputTemperatureInC
)

self.p.numberDensities = densityTools.getNDensFromMasses(
denistyIfNotPreExpandedAxially / axialExpansionFactor,
self.material.p.massFrac,
)
self.changeNDensByFactor(1.0 / axialExpansionFactor)

def getProperties(self):
"""Return the active Material object defining thermo-mechanical properties."""
Expand Down
2 changes: 1 addition & 1 deletion armi/reactor/converters/tests/test_blockConverter.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def _perturbTemps(self, block, cName, tCold, tHot):
"Give the component different ref and hot temperatures than in test_Blocks."
c = block.getComponent(Flags.fromString(cName))
c.refTemp, c.refHot = tCold, tHot
c.applyHotHeightDensityReduction()
c.adjustNDensForHotHeight()
c.setTemperature(tHot)
return block

Expand Down
2 changes: 1 addition & 1 deletion armi/reactor/tests/test_blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -2259,7 +2259,7 @@ def test_coldMass(self):
and hot height.
"""
fuel = self.b.getComponent(Flags.FUEL)
fuel.applyHotHeightDensityReduction()
fuel.adjustNDensForHotHeight()
# set ref (input/cold) temperature.
Thot = fuel.temperatureInC
Tcold = fuel.inputTemperatureInC
Expand Down
13 changes: 11 additions & 2 deletions armi/reactor/tests/test_components.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ def test_getComponentArea(self):
)

# show that area expansion is consistent with the density change in the material
self.component.applyHotHeightDensityReduction()
self.component.adjustNDensForHotHeight()
hotDensity = self.component.density()
hotArea = self.component.getArea()
thermalExpansionFactor = self.component.getThermalExpansionFactor(
Expand All @@ -231,7 +231,7 @@ def test_getComponentArea(self):
area=math.pi,
)
)
coldComponent.applyHotHeightDensityReduction()
coldComponent.adjustNDensForHotHeight()
coldDensity = coldComponent.density()
coldArea = coldComponent.getArea()

Expand Down Expand Up @@ -493,6 +493,15 @@ def test_changeNumberDensities(self):
self.component.changeNDensByFactor(3.0)
self.assertEqual(self.component.getNumberDensity("NA23"), 3.0)

def test_MassConserved(self):
jakehader marked this conversation as resolved.
Show resolved Hide resolved
"""Demonstrate that mass is conserved at different temperatures."""
circle1 = Circle("circle", "HT9", 20, 300, 1.0)
circle2 = Circle("circle", "HT9", 20, 600, 1.0)
self.assertAlmostEqual(
circle1.p.numberDensities["FE"] * circle1.getArea(),
circle2.p.numberDensities["FE"] * circle2.getArea(),
)


class TestTriangle(TestShapedComponent):
componentCls = Triangle
Expand Down
1 change: 1 addition & 0 deletions doc/release/0.2.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ Bug fixes
#. Remove ``copy.deepcopy`` from ``armi/reactor/converters/uniformMesh.py``
#. Clarify docstring for ``armi/reactor/components/complexShapes.py::Helix``
#. Bug fix in ``armi/reactor/components/complexShapes.py::Helix::getCircleInnerDiameter``
#. Bug fix and clarity improvements for how number densities are initialized for components.
#. TBD


Expand Down