From b6f10538c44e873bccdb6749bbd8b37dd6e6342e Mon Sep 17 00:00:00 2001 From: Tony Alberti Date: Fri, 15 Dec 2023 09:44:07 -0800 Subject: [PATCH] Updating testing for converters (#1555) --- .../tests/test_axialExpansionChanger.py | 3 ++ .../converters/tests/test_blockConverter.py | 9 +++--- .../converters/tests/test_uniformMesh.py | 29 ++++++++++--------- 3 files changed, 24 insertions(+), 17 deletions(-) diff --git a/armi/reactor/converters/tests/test_axialExpansionChanger.py b/armi/reactor/converters/tests/test_axialExpansionChanger.py index 8f81b2eea..49a2d7cfd 100644 --- a/armi/reactor/converters/tests/test_axialExpansionChanger.py +++ b/armi/reactor/converters/tests/test_axialExpansionChanger.py @@ -863,6 +863,9 @@ def test_coldAssemblyExpansion(self): Notes ----- + For R_ARMI_INP_COLD_HEIGHT, the action of axial expansion occurs in setUp() during core + construction, specifically in :py:meth:`constructAssem ` + Two assertions here: 1. total assembly height should be preserved (through use of top dummy block) 2. in armi.tests.detailedAxialExpansion.refSmallReactorBase.yaml, diff --git a/armi/reactor/converters/tests/test_blockConverter.py b/armi/reactor/converters/tests/test_blockConverter.py index e3f612c23..9218a73f0 100644 --- a/armi/reactor/converters/tests/test_blockConverter.py +++ b/armi/reactor/converters/tests/test_blockConverter.py @@ -116,14 +116,10 @@ def test_convert(self): .core.getAssemblies(Flags.FUEL)[2] .getFirstBlock(Flags.FUEL) ) - block.spatialGrid = grids.HexGrid.fromPitch(1.0) - area = block.getArea() converter = blockConverters.HexComponentsToCylConverter(block) converter.convert() - self.assertAlmostEqual(area, converter.convertedBlock.getArea()) - self.assertAlmostEqual(area, block.getArea()) for compType in [Flags.FUEL, Flags.CLAD, Flags.DUCT]: self.assertAlmostEqual( @@ -136,7 +132,12 @@ def test_convert(self): ] ), ) + for c in converter.convertedBlock.getComponents(compType): + self.assertEqual( + block.getComponent(compType).temperatureInC, c.temperatureInC + ) + self.assertEqual(block.getHeight(), converter.convertedBlock.getHeight()) self._checkAreaAndComposition(block, converter.convertedBlock) self._checkCiclesAreInContact(converter.convertedBlock) diff --git a/armi/reactor/converters/tests/test_uniformMesh.py b/armi/reactor/converters/tests/test_uniformMesh.py index febdc182e..11f781536 100644 --- a/armi/reactor/converters/tests/test_uniformMesh.py +++ b/armi/reactor/converters/tests/test_uniformMesh.py @@ -254,9 +254,9 @@ def test_filterMesh(self): """ Test that the mesh can be correctly filtered. - .. test:: Preserve the boundaries of fuel and control material. - :id: T_ARMI_UMC_NON_UNIFORM1 - :tests: R_ARMI_UMC_NON_UNIFORM + .. test:: Produce a uniform mesh with a size no smaller than a user-specified value. + :id: T_ARMI_UMC_MIN_MESH1 + :tests: R_ARMI_UMC_MIN_MESH """ meshList = [1.0, 3.0, 4.0, 7.0, 9.0, 12.0, 16.0, 19.0, 20.0] anchorPoints = [4.0, 16.0] @@ -305,7 +305,7 @@ def test_generateCommonMesh(self): Covers generateCommonmesh() and _decuspAxialMesh(). .. test:: Produce a uniform mesh with a size no smaller than a user-specified value. - :id: T_ARMI_UMC_MIN_MESH + :id: T_ARMI_UMC_MIN_MESH0 :tests: R_ARMI_UMC_MIN_MESH .. test:: Preserve the boundaries of fuel and control material. @@ -418,9 +418,8 @@ def test_convertNumberDensities(self): :tests: R_ARMI_UMC """ refMass = self.r.core.getMass("U235") - applyNonUniformHeightDistribution( - self.r - ) # this changes the mass of everything in the core + # perturb the heights of the assemblies -> changes the mass of everything in the core + applyNonUniformHeightDistribution(self.r) perturbedCoreMass = self.r.core.getMass("U235") self.assertNotEqual(refMass, perturbedCoreMass) self.converter.convert(self.r) @@ -428,12 +427,16 @@ def test_convertNumberDensities(self): uniformReactor = self.converter.convReactor uniformMass = uniformReactor.core.getMass("U235") - self.assertAlmostEqual( - perturbedCoreMass, uniformMass - ) # conversion conserved mass - self.assertAlmostEqual( - self.r.core.getMass("U235"), perturbedCoreMass - ) # conversion didn't change source reactor mass + # conversion conserved mass + self.assertAlmostEqual(perturbedCoreMass, uniformMass) + # conversion didn't change source reactor mass + self.assertAlmostEqual(self.r.core.getMass("U235"), perturbedCoreMass) + # conversion results in uniform axial mesh + refAssemMesh = self.converter.convReactor.core.refAssem.getAxialMesh() + for a in self.converter.convReactor.core: + mesh = a.getAxialMesh() + for ref, check in zip(refAssemMesh, mesh): + self.assertEqual(ref, check) def test_applyStateToOriginal(self): """