Skip to content

Commit

Permalink
Updating testing for converters (#1555)
Browse files Browse the repository at this point in the history
  • Loading branch information
albeanth authored Dec 15, 2023
1 parent ae1a330 commit b6f1053
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 17 deletions.
3 changes: 3 additions & 0 deletions armi/reactor/converters/tests/test_axialExpansionChanger.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 <armi.reactor.blueprints.Blueprints.constructAssem>`
Two assertions here:
1. total assembly height should be preserved (through use of top dummy block)
2. in armi.tests.detailedAxialExpansion.refSmallReactorBase.yaml,
Expand Down
9 changes: 5 additions & 4 deletions armi/reactor/converters/tests/test_blockConverter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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)

Expand Down
29 changes: 16 additions & 13 deletions armi/reactor/converters/tests/test_uniformMesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -418,22 +418,25 @@ 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)

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):
"""
Expand Down

0 comments on commit b6f1053

Please sign in to comment.