Skip to content

Commit

Permalink
Provide Component.getFuelMass
Browse files Browse the repository at this point in the history
Directly calls getMass if the component is flagged with fuel
  • Loading branch information
drewj-usnctech committed May 3, 2023
1 parent 69300af commit 61df8df
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
5 changes: 5 additions & 0 deletions armi/reactor/components/component.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
from armi.bookkeeping import report
from armi.reactor import composites
from armi.reactor import parameters
from armi.reactor import flags
from armi.reactor.components import componentParameters
from armi.utils import densityTools
from armi.utils.units import C_TO_K
Expand Down Expand Up @@ -1205,6 +1206,10 @@ def getPitchData(self):
"Please implement if this component type can be a pitch defining component."
)

def getFuelMass(self) -> float:
"""Return the mass in grams if this is a fueled component"""
return self.getMass() if self.hasFlags(flags.Flags.FUEL) else 0.0


class ShapedComponent(Component):
"""A component with well-defined dimensions."""
Expand Down
8 changes: 8 additions & 0 deletions armi/reactor/tests/test_components.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

from armi.materials.material import Material
from armi.reactor import components
from armi.reactor import flags
from armi.reactor.components import (
Component,
UnshapedComponent,
Expand Down Expand Up @@ -516,6 +517,13 @@ def test_changeNumberDensities(self):
self.component.changeNDensByFactor(3.0)
self.assertEqual(self.component.getNumberDensity("NA23"), 3.0)

def test_fuelMass(self):
nominalMass = self.component.getMass()
self.component.p.flags = flags.Flags.FUEL
self.assertEqual(self.component.getFuelMass(), nominalMass)
self.component.p.flags = flags.Flags.MODERATOR
self.assertEqual(self.component.getFuelMass(), 0.0)


class TestComponentExpansion(unittest.TestCase):
tCold = 20
Expand Down

0 comments on commit 61df8df

Please sign in to comment.