From e395f5ae7e1b0524a69b3029d3293ac80f35ca0f Mon Sep 17 00:00:00 2001 From: Mark Onufer Date: Thu, 23 Apr 2020 06:05:34 -0700 Subject: [PATCH] Allow square componets to be used for cartesian lattice --- armi/reactor/blocks.py | 11 ++++++++--- armi/reactor/tests/test_blocks.py | 29 +++++++++++++++++++++++++---- 2 files changed, 33 insertions(+), 7 deletions(-) diff --git a/armi/reactor/blocks.py b/armi/reactor/blocks.py index af5833a35..aa8f2b85e 100644 --- a/armi/reactor/blocks.py +++ b/armi/reactor/blocks.py @@ -2343,7 +2343,8 @@ def breakFuelComponentsIntoIndividuals(self): # update moles at BOL for each pin self.p.molesHmBOLByPin = [] for pinNum, pin in enumerate(self.iterComponents(Flags.FUEL)): - pin.p.flags = fuelFlags # Update the fuel component flags to be the same as before the split (i.e., DEPLETABLE) + # Update the fuel component flags to be the same as before the split (i.e., DEPLETABLE) + pin.p.flags = fuelFlags self.p.molesHmBOLByPin.append(pin.getHMMoles()) pin.p.massHmBOL /= nPins @@ -2702,7 +2703,8 @@ def getPinToDuctGap(self, cold=False): face to face in cm. """ if self.LOCATION_CLASS is None: - return None # can't assume anything about dimensions if there is no location type + # can't assume anything about dimensions if there is no location type + return None wire = self.getComponent(Flags.WIRE) ducts = sorted(self.getChildrenWithFlags(Flags.DUCT)) @@ -2909,8 +2911,11 @@ def getPitch(self, returnComp=False): # block as opposed to initializing _pitchDefiningComponent to (None, None) if c is None: raise ValueError("{} has no valid pitch".format(self)) + + # ask component for dimensions, since they could have changed + elif isinstance(c, components.Square): + maxLength = maxWidth = c.getDimension("widthOuter") else: - # ask component for dimensions, since they could have changed maxLength = c.getDimension("lengthOuter") maxWidth = c.getDimension("widthOuter") diff --git a/armi/reactor/tests/test_blocks.py b/armi/reactor/tests/test_blocks.py index 2d864fa28..de552c5f6 100644 --- a/armi/reactor/tests/test_blocks.py +++ b/armi/reactor/tests/test_blocks.py @@ -20,6 +20,7 @@ import numpy from numpy.testing import assert_allclose +import tparmi from armi.reactor import blocks from armi.reactor import components import armi.runLog as runLog @@ -1524,11 +1525,32 @@ def test_getPinCoords(self): class CartesianBlock_TestCase(unittest.TestCase): + """Tests for blocks with rectangular/square outer shape.""" + + PITCH = 70 + def setUp(self): caseSetting = settings.Settings() - caseSetting["xw"] = 5.0 - caseSetting["yw"] = 3.0 - self.CartesianBlock = blocks.CartesianBlock("TestCartesianBlock", caseSetting) + self.cartesianBlock = blocks.CartesianBlock("TestCartesianBlock", caseSetting) + + self.cartesianComponent = components.HoledSquare( + "duct", + "UZr", + Tinput=273.0, + Thot=273.0, + holeOD=68.0, + widthOuter=self.PITCH, + mult=1.0, + ) + self.cartesianBlock.addComponent(self.cartesianComponent) + self.cartesianBlock.addComponent( + components.Circle( + "clad", "HT9", Tinput=273.0, Thot=273.0, od=68.0, mult=169.0 + ) + ) + + def test_getPitch(self): + self.assertEqual(self.cartesianBlock.getPitch(), (self.PITCH, self.PITCH)) class MassConservationTests(unittest.TestCase): @@ -1538,7 +1560,6 @@ class MassConservationTests(unittest.TestCase): def setUp(self): # build a block that has some basic components in it. - cs = settings.Settings() self.b = blocks.HexBlock("fuel", height=10.0) fuelDims = {"Tinput": 25.0, "Thot": 600, "od": 0.76, "id": 0.00, "mult": 127.0}