From cb3d4e03156a01ad5387ec2921fd818adb50bfa0 Mon Sep 17 00:00:00 2001 From: jstilley Date: Fri, 9 Jun 2023 09:35:28 -0700 Subject: [PATCH 1/6] Improving Block getWettedPerimeter calculation --- armi/reactor/blocks.py | 17 ++++++++++++++++- armi/reactor/tests/test_blocks.py | 16 ++++++++++++++-- doc/release/0.2.rst | 1 + 3 files changed, 31 insertions(+), 3 deletions(-) diff --git a/armi/reactor/blocks.py b/armi/reactor/blocks.py index 3ed609c52..898a89d56 100644 --- a/armi/reactor/blocks.py +++ b/armi/reactor/blocks.py @@ -2211,12 +2211,27 @@ def getWettedPerimeter(self): 6 * c.getDimension("ip") / math.sqrt(3) if c else 0.0 ) + # account for the wire warp in the wetted perimeter + try: + wire = self.getComponent(Flags.WIRE) + if wire is not None: + correctionFactor = numpy.hypot( + 1.0, + math.pi + * wire.getDimension("helixDiameter") + / wire.getDimension("axialPitch"), + ) + else: + correctionFactor = 1.0 + except ValueError: + correctionFactor = 1.0 + # solid circle = od * pi # NOTE: since these are pin components, multiply by the number of pins wettedPinPerimeter = 0.0 for c in wettedPinComponents: wettedPinPerimeter += c.getDimension("od") if c else 0.0 - wettedPinPerimeter *= self.getNumPins() * math.pi + wettedPinPerimeter *= self.getNumPins() * math.pi * correctionFactor # hollow circle = (id + od) * pi wettedHollowCirclePerimeter = 0.0 diff --git a/armi/reactor/tests/test_blocks.py b/armi/reactor/tests/test_blocks.py index 1b079f8a0..5c31d2393 100644 --- a/armi/reactor/tests/test_blocks.py +++ b/armi/reactor/tests/test_blocks.py @@ -747,7 +747,7 @@ def test_getTotalMass(self): self.assertAlmostEqual(cur, ref, places=places) def test_replaceBlockWithBlock(self): - r"""Tests conservation of mass flag in replaceBlockWithBlock.""" + """Tests conservation of mass flag in replaceBlockWithBlock.""" block = self.block ductBlock = block.__class__("duct") ductBlock.add(block.getComponent(Flags.COOLANT, exact=True)) @@ -771,13 +771,25 @@ def test_replaceBlockWithBlock(self): def test_getWettedPerimeter(self): cur = self.block.getWettedPerimeter() + + wire = self.block.getComponent(Flags.WIRE) + correctionFactor = numpy.hypot( + 1.0, + math.pi + * wire.getDimension("helixDiameter") + / wire.getDimension("axialPitch"), + ) + ref = math.pi * ( self.block.getDim(Flags.CLAD, "od") + self.block.getDim(Flags.WIRE, "od") - ) * self.block.getDim(Flags.CLAD, "mult") + 6 * self.block.getDim( + ) * correctionFactor * self.block.getDim( + Flags.CLAD, "mult" + ) + 6 * self.block.getDim( Flags.DUCT, "ip" ) / math.sqrt( 3 ) + self.assertAlmostEqual(cur, ref) def test_getFlowAreaPerPin(self): diff --git a/doc/release/0.2.rst b/doc/release/0.2.rst index ed0d928d9..1107ef9ed 100644 --- a/doc/release/0.2.rst +++ b/doc/release/0.2.rst @@ -15,6 +15,7 @@ What's new in ARMI Bug fixes --------- #. Changed units.FLOAT_DIMENSION_DECIMALS from 10 to 8 (`PR#1183 `_) +#. Improved ``Block.getWettedPerimeter()`` to include wire. (`PR#1298 `_) #. Fixed a bug in the ISOTXS file name used for snapshots. (`PR#1277 `_) #. Fix a bug in uniform mesh decusping when assemblies of same type have drastically different height. (`PR#1282 `_) #. Sort components on representativeBlock for consistency check. (`PR#1275 `_) From a17f5ce7fd8466f3f9eca73ebb27ee39f028dd3f Mon Sep 17 00:00:00 2001 From: jstilley Date: Fri, 9 Jun 2023 09:37:06 -0700 Subject: [PATCH 2/6] Fixing release notes --- doc/release/0.2.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/release/0.2.rst b/doc/release/0.2.rst index 1107ef9ed..8854e8e78 100644 --- a/doc/release/0.2.rst +++ b/doc/release/0.2.rst @@ -15,7 +15,7 @@ What's new in ARMI Bug fixes --------- #. Changed units.FLOAT_DIMENSION_DECIMALS from 10 to 8 (`PR#1183 `_) -#. Improved ``Block.getWettedPerimeter()`` to include wire. (`PR#1298 `_) +#. Improved ``HexBlock.getWettedPerimeter()`` to include wire. (`PR#1299 `_) #. Fixed a bug in the ISOTXS file name used for snapshots. (`PR#1277 `_) #. Fix a bug in uniform mesh decusping when assemblies of same type have drastically different height. (`PR#1282 `_) #. Sort components on representativeBlock for consistency check. (`PR#1275 `_) From ea649fcafbe992216c94f8218f2f0d2067ba8d64 Mon Sep 17 00:00:00 2001 From: jstilley Date: Fri, 9 Jun 2023 12:18:55 -0700 Subject: [PATCH 3/6] Adjusting the wetted perimeter calc --- armi/reactor/blocks.py | 13 ++++++++----- armi/reactor/tests/test_blocks.py | 21 +-------------------- 2 files changed, 9 insertions(+), 25 deletions(-) diff --git a/armi/reactor/blocks.py b/armi/reactor/blocks.py index 898a89d56..8880e7b1f 100644 --- a/armi/reactor/blocks.py +++ b/armi/reactor/blocks.py @@ -2221,17 +2221,20 @@ def getWettedPerimeter(self): * wire.getDimension("helixDiameter") / wire.getDimension("axialPitch"), ) + wireDiameter = wire.getDimension("od") * correctionFactor else: - correctionFactor = 1.0 + wireDiameter = 0.0 except ValueError: - correctionFactor = 1.0 + wireDiameter = 0.0 # solid circle = od * pi # NOTE: since these are pin components, multiply by the number of pins - wettedPinPerimeter = 0.0 + wettedPinDiameter = 0.0 for c in wettedPinComponents: - wettedPinPerimeter += c.getDimension("od") if c else 0.0 - wettedPinPerimeter *= self.getNumPins() * math.pi * correctionFactor + wettedPinDiameter += c.getDimension("od") if c else 0.0 + wettedPinPerimeter = ( + self.getNumPins() * math.pi * (wettedPinDiameter + wireDiameter) + ) # hollow circle = (id + od) * pi wettedHollowCirclePerimeter = 0.0 diff --git a/armi/reactor/tests/test_blocks.py b/armi/reactor/tests/test_blocks.py index 5c31d2393..10000e809 100644 --- a/armi/reactor/tests/test_blocks.py +++ b/armi/reactor/tests/test_blocks.py @@ -771,26 +771,7 @@ def test_replaceBlockWithBlock(self): def test_getWettedPerimeter(self): cur = self.block.getWettedPerimeter() - - wire = self.block.getComponent(Flags.WIRE) - correctionFactor = numpy.hypot( - 1.0, - math.pi - * wire.getDimension("helixDiameter") - / wire.getDimension("axialPitch"), - ) - - ref = math.pi * ( - self.block.getDim(Flags.CLAD, "od") + self.block.getDim(Flags.WIRE, "od") - ) * correctionFactor * self.block.getDim( - Flags.CLAD, "mult" - ) + 6 * self.block.getDim( - Flags.DUCT, "ip" - ) / math.sqrt( - 3 - ) - - self.assertAlmostEqual(cur, ref) + self.assertAlmostEqual(cur, 910.1118990260776) def test_getFlowAreaPerPin(self): area = self.block.getComponent(Flags.COOLANT).getArea() From a967f6576b873f6fb03505f8e580c0bf10d47401 Mon Sep 17 00:00:00 2001 From: jstilley Date: Fri, 9 Jun 2023 12:46:29 -0700 Subject: [PATCH 4/6] Adjusting the calc again --- armi/reactor/blocks.py | 55 ++++++++++++++++++------------- armi/reactor/tests/test_blocks.py | 20 ++++++++++- 2 files changed, 51 insertions(+), 24 deletions(-) diff --git a/armi/reactor/blocks.py b/armi/reactor/blocks.py index 8880e7b1f..3b4045c3b 100644 --- a/armi/reactor/blocks.py +++ b/armi/reactor/blocks.py @@ -27,19 +27,20 @@ import numpy +from armi import nuclideBases from armi import runLog from armi.bookkeeping import report -from armi import nuclideBases from armi.physics.neutronics import GAMMA from armi.physics.neutronics import NEUTRON -from armi.reactor.components import basicShapes from armi.reactor import blockParameters from armi.reactor import components -from armi.reactor.components.basicShapes import Hexagon, Circle from armi.reactor import composites from armi.reactor import geometry from armi.reactor import grids from armi.reactor import parameters +from armi.reactor.components import basicShapes +from armi.reactor.components.basicShapes import Hexagon, Circle +from armi.reactor.components.complexShapes import Helix from armi.reactor.flags import Flags from armi.reactor.parameters import ParamLocation from armi.utils import densityTools @@ -2211,30 +2212,22 @@ def getWettedPerimeter(self): 6 * c.getDimension("ip") / math.sqrt(3) if c else 0.0 ) - # account for the wire warp in the wetted perimeter - try: - wire = self.getComponent(Flags.WIRE) - if wire is not None: + # solid circle = NumPins * pi * (Comp Diam + Wire Diam) + wettedPinPerimeter = 0.0 + for c in wettedPinComponents: + if c is None: + continue + correctionFactor = 1.0 + if c.hasFlags(Flags.WIRE) and isinstance(c, Helix): + # account for the wire correctionFactor = numpy.hypot( 1.0, math.pi - * wire.getDimension("helixDiameter") - / wire.getDimension("axialPitch"), + * c.getDimension("helixDiameter") + / c.getDimension("axialPitch"), ) - wireDiameter = wire.getDimension("od") * correctionFactor - else: - wireDiameter = 0.0 - except ValueError: - wireDiameter = 0.0 - - # solid circle = od * pi - # NOTE: since these are pin components, multiply by the number of pins - wettedPinDiameter = 0.0 - for c in wettedPinComponents: - wettedPinDiameter += c.getDimension("od") if c else 0.0 - wettedPinPerimeter = ( - self.getNumPins() * math.pi * (wettedPinDiameter + wireDiameter) - ) + wettedPinPerimeter += c.getDimension("od") * correctionFactor + wettedPinPerimeter *= self.getNumPins() * math.pi # hollow circle = (id + od) * pi wettedHollowCirclePerimeter = 0.0 @@ -2250,6 +2243,22 @@ def getWettedPerimeter(self): + wettedHollowCirclePerimeter ) + def whatever(self): + wettedPinPerimeter = 0.0 + for c in wettedPinComponents: + if c is None: + continue + correctionFactor = 1.0 + if c.hasFlag(Flags.WIRE) and isinstance(Helix): + correctionFactor = numpy.hypot( + 1.0, + math.pi + * c.getDimension("helixDiameter") + / c.getDimension("axialPitch"), + ) + wettedPinPerimeter += c.getDimension("od") * correctionFactor + wettedPinPerimeter *= self.getNumPins() * math.pi + def getFlowArea(self): """ Return the total flowing coolant area of the block in cm^2. diff --git a/armi/reactor/tests/test_blocks.py b/armi/reactor/tests/test_blocks.py index 10000e809..667d7f8ce 100644 --- a/armi/reactor/tests/test_blocks.py +++ b/armi/reactor/tests/test_blocks.py @@ -771,7 +771,25 @@ def test_replaceBlockWithBlock(self): def test_getWettedPerimeter(self): cur = self.block.getWettedPerimeter() - self.assertAlmostEqual(cur, 910.1118990260776) + + wire = self.block.getComponent(Flags.WIRE) + correctionFactor = numpy.hypot( + 1.0, + math.pi + * wire.getDimension("helixDiameter") + / wire.getDimension("axialPitch"), + ) + wireDiameter = wire.getDimension("od") * correctionFactor + + ref = math.pi * ( + self.block.getDim(Flags.CLAD, "od") + wireDiameter + ) * self.block.getDim(Flags.CLAD, "mult") + 6 * self.block.getDim( + Flags.DUCT, "ip" + ) / math.sqrt( + 3 + ) + + self.assertAlmostEqual(cur, ref) def test_getFlowAreaPerPin(self): area = self.block.getComponent(Flags.COOLANT).getArea() From 68f4533a100d563fbaa1573e667081a49bb4453f Mon Sep 17 00:00:00 2001 From: jstilley Date: Fri, 9 Jun 2023 13:09:03 -0700 Subject: [PATCH 5/6] Whoops. Removing test method --- armi/reactor/blocks.py | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/armi/reactor/blocks.py b/armi/reactor/blocks.py index 3b4045c3b..0856b4d68 100644 --- a/armi/reactor/blocks.py +++ b/armi/reactor/blocks.py @@ -2243,22 +2243,6 @@ def getWettedPerimeter(self): + wettedHollowCirclePerimeter ) - def whatever(self): - wettedPinPerimeter = 0.0 - for c in wettedPinComponents: - if c is None: - continue - correctionFactor = 1.0 - if c.hasFlag(Flags.WIRE) and isinstance(Helix): - correctionFactor = numpy.hypot( - 1.0, - math.pi - * c.getDimension("helixDiameter") - / c.getDimension("axialPitch"), - ) - wettedPinPerimeter += c.getDimension("od") * correctionFactor - wettedPinPerimeter *= self.getNumPins() * math.pi - def getFlowArea(self): """ Return the total flowing coolant area of the block in cm^2. From 2d83b15598de13d1394c928bfa20c9d050318aff Mon Sep 17 00:00:00 2001 From: jstilley Date: Mon, 12 Jun 2023 07:02:36 -0700 Subject: [PATCH 6/6] Cleaning up code/comments --- armi/reactor/blocks.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/armi/reactor/blocks.py b/armi/reactor/blocks.py index 0856b4d68..8107504fa 100644 --- a/armi/reactor/blocks.py +++ b/armi/reactor/blocks.py @@ -2215,11 +2215,9 @@ def getWettedPerimeter(self): # solid circle = NumPins * pi * (Comp Diam + Wire Diam) wettedPinPerimeter = 0.0 for c in wettedPinComponents: - if c is None: - continue correctionFactor = 1.0 - if c.hasFlags(Flags.WIRE) and isinstance(c, Helix): - # account for the wire + if isinstance(c, Helix): + # account for the helical wire wrap correctionFactor = numpy.hypot( 1.0, math.pi