From 0918dea0db1e3bb80fd5b3d5c742457cb4406c93 Mon Sep 17 00:00:00 2001 From: Michael Jarrett Date: Mon, 10 Jul 2023 11:29:11 -0700 Subject: [PATCH 1/5] Add nucTempHelper to CylindricalComponentsAverageBlockCollection --- armi/physics/neutronics/crossSectionGroupManager.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/armi/physics/neutronics/crossSectionGroupManager.py b/armi/physics/neutronics/crossSectionGroupManager.py index cd475fcf0..6eedc7181 100644 --- a/armi/physics/neutronics/crossSectionGroupManager.py +++ b/armi/physics/neutronics/crossSectionGroupManager.py @@ -505,6 +505,19 @@ def _orderComponentsInGroup(self, repBlock): componentLists = [list(sorted(b)) for b in self.getCandidateBlocks()] return [list(comps) for comps in zip(*componentLists)] + def _getNucTempHelper(self): + """All candidate blocks are used in the average.""" + nvt = numpy.zeros(len(self.allNuclidesInProblem)) + nv = numpy.zeros(len(self.allNuclidesInProblem)) + for block in self.getCandidateBlocks(): + wt = self.getWeight(block) + nvtBlock, nvBlock = getBlockNuclideTemperatureAvgTerms( + block, self.allNuclidesInProblem + ) + nvt += nvtBlock * wt + nv += nvBlock * wt + return nvt, nv + class SlabComponentsAverageBlockCollection(BlockCollection): """ From fd1e8f58783dd4457d5b494478251260da9354e3 Mon Sep 17 00:00:00 2001 From: Michael Jarrett Date: Fri, 28 Jul 2023 10:26:50 -0700 Subject: [PATCH 2/5] Add test for nucTempHelper --- armi/physics/neutronics/tests/test_crossSectionManager.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/armi/physics/neutronics/tests/test_crossSectionManager.py b/armi/physics/neutronics/tests/test_crossSectionManager.py index 218972221..3e534c97d 100644 --- a/armi/physics/neutronics/tests/test_crossSectionManager.py +++ b/armi/physics/neutronics/tests/test_crossSectionManager.py @@ -285,6 +285,7 @@ def setUp(self): 1.9717608091694139, ] + def test_ComponentAverage1DCylinder(self): r""" tests that the XS group manager calculates the expected component atom density @@ -295,6 +296,8 @@ def test_ComponentAverage1DCylinder(self): xsgm.interactBOL() + xsgm.updateNuclideTemperatures() + # Check that the correct defaults are propagated after the interactBOL # from the cross section group manager is called. xsOpt = self.o.cs[CONF_CROSS_SECTION]["ZA"] @@ -317,6 +320,7 @@ def test_ComponentAverage1DCylinder(self): c.getNumberDensity(nuc), compDensity.get(nuc, 0.0) ) + def test_checkComponentConsistency(self): xsgm = self.o.getInterface("xsGroups") From a5a5954440bb96ff46fef35e0a051658b798e732 Mon Sep 17 00:00:00 2001 From: Michael Jarrett Date: Fri, 28 Jul 2023 10:29:54 -0700 Subject: [PATCH 3/5] Add release notes. --- doc/release/0.2.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/release/0.2.rst b/doc/release/0.2.rst index e35d40643..808e1b778 100644 --- a/doc/release/0.2.rst +++ b/doc/release/0.2.rst @@ -12,6 +12,7 @@ What's new in ARMI #. Broad cleanup of ``Parameters``: filled in all empty units and descriptions, removed unused params. (`PR#1345 `_) #. Removed redundant ``Material.name`` variable. (`PR#1335 `_) #. Added SHA1 hashes of XS control files to the welcome text. (`PR#1334 `_) +#. Add a _getNucTempHelper method for CylindricalComponentsAverageBlockCollection. (`PR#1363 `_) #. TBD Bug fixes From 3ded80d57577accd2e2e2cb770f3e890d5d24931 Mon Sep 17 00:00:00 2001 From: Michael Jarrett Date: Fri, 28 Jul 2023 10:32:05 -0700 Subject: [PATCH 4/5] Black formatting. --- armi/physics/neutronics/tests/test_crossSectionManager.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/armi/physics/neutronics/tests/test_crossSectionManager.py b/armi/physics/neutronics/tests/test_crossSectionManager.py index 3e534c97d..711025fe7 100644 --- a/armi/physics/neutronics/tests/test_crossSectionManager.py +++ b/armi/physics/neutronics/tests/test_crossSectionManager.py @@ -285,7 +285,6 @@ def setUp(self): 1.9717608091694139, ] - def test_ComponentAverage1DCylinder(self): r""" tests that the XS group manager calculates the expected component atom density @@ -320,7 +319,6 @@ def test_ComponentAverage1DCylinder(self): c.getNumberDensity(nuc), compDensity.get(nuc, 0.0) ) - def test_checkComponentConsistency(self): xsgm = self.o.getInterface("xsGroups") From e6e80115bf8001032756ef411eaa9aaec3e159a2 Mon Sep 17 00:00:00 2001 From: Michael Jarrett Date: Wed, 16 Aug 2023 18:11:35 -0700 Subject: [PATCH 5/5] Add nuc temps to unit test. --- .../tests/test_crossSectionManager.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/armi/physics/neutronics/tests/test_crossSectionManager.py b/armi/physics/neutronics/tests/test_crossSectionManager.py index 9e1967fc0..dc7f6df3a 100644 --- a/armi/physics/neutronics/tests/test_crossSectionManager.py +++ b/armi/physics/neutronics/tests/test_crossSectionManager.py @@ -295,20 +295,22 @@ def test_ComponentAverage1DCylinder(self): xsgm.interactBOL() - xsgm.updateNuclideTemperatures() - # Check that the correct defaults are propagated after the interactBOL # from the cross section group manager is called. xsOpt = self.o.cs[CONF_CROSS_SECTION]["ZA"] self.assertEqual(xsOpt.blockRepresentation, "ComponentAverage1DCylinder") xsgm.createRepresentativeBlocks() + xsgm.updateNuclideTemperatures() + representativeBlockList = list(xsgm.representativeBlocks.values()) representativeBlockList.sort(key=lambda repB: repB.getMass() / repB.getVolume()) reprBlock = xsgm.representativeBlocks["ZA"] self.assertEqual(reprBlock.name, "1D_CYL_AVG_ZA") self.assertEqual(reprBlock.p.percentBu, 0.0) + refTemps = {"fuel": 600.0, "coolant": 450.0, "structure": 462.4565} + for c, compDensity, compArea in zip( reprBlock, self.expectedComponentDensities, self.expectedComponentAreas ): @@ -318,6 +320,18 @@ def test_ComponentAverage1DCylinder(self): self.assertAlmostEqual( c.getNumberDensity(nuc), compDensity.get(nuc, 0.0) ) + if "fuel" in c.getType(): + compTemp = refTemps["fuel"] + elif any(sodium in c.getType() for sodium in ["bond", "coolant"]): + compTemp = refTemps["coolant"] + else: + compTemp = refTemps["structure"] + self.assertAlmostEqual( + compTemp, + xsgm.avgNucTemperatures["ZA"][nuc], + 2, + f"{nuc} temperature does not match expected value of {compTemp}", + ) def test_checkComponentConsistency(self):