diff --git a/armi/reactor/components/component.py b/armi/reactor/components/component.py index b69f507ce..0f25d0250 100644 --- a/armi/reactor/components/component.py +++ b/armi/reactor/components/component.py @@ -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.""" diff --git a/armi/reactor/tests/test_components.py b/armi/reactor/tests/test_components.py index 6cbc1e696..f8d415a44 100644 --- a/armi/reactor/tests/test_components.py +++ b/armi/reactor/tests/test_components.py @@ -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( @@ -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()) @@ -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()