Skip to content

Commit

Permalink
Fixing getCircleInnerDiameter() on holed components (#757)
Browse files Browse the repository at this point in the history
  • Loading branch information
keckler authored Jul 12, 2022
1 parent 66f587d commit ecc1dbb
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 3 deletions.
25 changes: 25 additions & 0 deletions armi/reactor/components/complexShapes.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,19 @@ def getComponentArea(self, cold=False):
area = mult * (hexArea - circularArea)
return area

def getCircleInnerDiameter(self, Tc=None, cold=False):
"""
For the special case of only one single hole, returns the
diameter of that hole.
For any other case, returns 0.0 because an "circle inner diameter" becomes
undefined.
"""
if self.getDimension("nHoles") == 1:
return self.getDimension("holeOD", Tc, cold)
else:
return 0.0


class HoledRectangle(basicShapes.Rectangle):
"""Rectangle with one circular hole in it."""
Expand Down Expand Up @@ -130,6 +143,12 @@ def getComponentArea(self, cold=False):
area = mult * (rectangleArea - circularArea)
return area

def getCircleInnerDiameter(self, Tc=None, cold=False):
"""
Returns the ``holeOD``.
"""
return self.getDimension("holeOD", Tc, cold)


class HoledSquare(basicShapes.Square):
"""Square with one circular hole in it."""
Expand Down Expand Up @@ -176,6 +195,12 @@ def getComponentArea(self, cold=False):
area = mult * (rectangleArea - circularArea)
return area

def getCircleInnerDiameter(self, Tc=None, cold=False):
"""
Returns the ``holeOD``.
"""
return self.getDimension("holeOD", Tc, cold)


class Helix(ShapedComponent):
"""A spiral wire component used to model a pin wire-wrap.
Expand Down
8 changes: 5 additions & 3 deletions armi/reactor/components/componentParameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,11 @@ def getHoledHexagonParameterDefinitions():

pDefs = parameters.ParameterDefinitionCollection()
with pDefs.createBuilder(location=ParamLocation.AVERAGE, saveToDB=True) as pb:
pb.defParam("holeOD", units="?", description="?")
pb.defParam("holeOD", units="cm", description="Diameter of interior hole(s)")

pb.defParam("nHoles", units="?", description="?")
pb.defParam(
"nHoles", units=units.UNITLESS, description="Number of interior holes"
)

return pDefs

Expand All @@ -168,7 +170,7 @@ def getHoledRectangleParameterDefinitions():

pDefs = parameters.ParameterDefinitionCollection()
with pDefs.createBuilder(location=ParamLocation.AVERAGE, saveToDB=True) as pb:
pb.defParam("holeOD", units="?", description="?")
pb.defParam("holeOD", units="cm", description="Diameter of interior hole")

return pDefs

Expand Down
30 changes: 30 additions & 0 deletions armi/reactor/tests/test_components.py
Original file line number Diff line number Diff line change
Expand Up @@ -826,6 +826,26 @@ def test_getBoundingCircleOuterDiameter(self):
cur = self.component.getBoundingCircleOuterDiameter(cold=True)
self.assertAlmostEqual(ref, cur)

def test_getCircleInnerDiameter(self):
ref = 0 # there are multiple holes, so the function should return 0
cur = self.component.getCircleInnerDiameter(cold=True)
self.assertEqual(ref, cur)

# make and test another one with just 1 hole
simpleHoledHexagon = HoledHexagon(
"hex",
"Void",
self.componentDims["Tinput"],
self.componentDims["Thot"],
self.componentDims["op"],
self.componentDims["holeOD"],
nHoles=1,
)
self.assertEqual(
self.componentDims["holeOD"],
simpleHoledHexagon.getCircleInnerDiameter(cold=True),
)

def test_getArea(self):
op = self.component.getDimension("op")
odHole = self.component.getDimension("holeOD")
Expand Down Expand Up @@ -884,6 +904,11 @@ def test_getBoundingCircleOuterDiameter(self):
cur = self.component.getBoundingCircleOuterDiameter()
self.assertAlmostEqual(ref, cur)

def test_getCircleInnerDiameter(self):
ref = self.componentDims["holeOD"]
cur = self.component.getCircleInnerDiameter(cold=True)
self.assertEqual(ref, cur)

def test_getArea(self):
rectArea = self.length * self.width
odHole = self.component.getDimension("holeOD")
Expand Down Expand Up @@ -925,6 +950,11 @@ def setClassDims(self):
def test_thermallyExpands(self):
self.assertTrue(self.component.THERMAL_EXPANSION_DIMS)

def test_getCircleInnerDiameter(self):
ref = self.componentDims["holeOD"]
cur = self.component.getCircleInnerDiameter(cold=True)
self.assertEqual(ref, cur)


class TestHelix(TestShapedComponent):
componentCls = Helix
Expand Down

0 comments on commit ecc1dbb

Please sign in to comment.