Skip to content

Adding impl/test crumbs for requirements #1507

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Nov 29, 2023
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion armi/physics/neutronics/energyGroups.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,12 @@


def getFastFluxGroupCutoff(eGrpStruc):
"""Given a constant "fast" energy threshold, return which ARMI energy group index contains this threshold."""
"""Given a constant "fast" energy threshold, return which ARMI energy group index contains this threshold.

.. impl:: Return the energy group index which contains a given energy threshold.
:id: I_ARMI_EG_FE
:implements: R_ARMI_EG_FE
"""
gThres = -1
for g, eV in enumerate(eGrpStruc):
if eV < FAST_FLUX_THRESHOLD_EV:
Expand Down Expand Up @@ -67,6 +72,10 @@ def getGroupStructure(name):
"""
Return descending neutron energy group upper bounds in eV for a given structure name.

.. impl:: Provide the neutron energy group bounds for a given group structure.
:id: I_ARMI_EG_NE
:implements: R_ARMI_EG_NE

Notes
-----
Copy of the group structure is return so that modifications of the energy bounds does
Expand Down
9 changes: 7 additions & 2 deletions armi/physics/neutronics/globalFlux/globalFluxInterface.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,13 @@ def interactEOC(self, cycle=None):
* units.ABS_REACTIVITY_TO_PCM
)

def _checkEnergyBalance(self):
"""Check that there is energy balance between the power generated and the specified power is the system."""
def checkEnergyBalance(self):
"""Check that there is energy balance between the power generated and the specified power.

.. impl:: Validate the energy generate matches user specifications.
:id: I_ARMI_FLUX_CHECK_POWER
:implements: R_ARMI_FLUX_CHECK_POWER
"""
powerGenerated = (
self.r.core.calcTotalParam(
"power", calcBasedOnFullObj=False, generationNum=2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,7 @@ def test_getHistoryParams(self):
self.assertIn("detailedDpa", params)

def test_checkEnergyBalance(self):
"""
Test energy balance check.
"""Test energy balance check.

.. test:: Block-wise power is consistent with reactor data model power.
:id: T_ARMI_FLUX_CHECK_POWER
Expand All @@ -190,7 +189,7 @@ def test_checkEnergyBalance(self):
cs = settings.Settings()
_o, r = test_reactors.loadTestReactor()
gfi = MockGlobalFluxInterface(r, cs)
gfi._checkEnergyBalance()
gfi.checkEnergyBalance()


class TestGlobalFluxInterfaceWithExecuters(unittest.TestCase):
Expand Down
11 changes: 10 additions & 1 deletion armi/physics/neutronics/tests/test_energyGroups.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,12 @@

class TestEnergyGroups(unittest.TestCase):
def test_invalidGroupStructureType(self):
"""Test that the reverse lookup fails on non-existent energy group bounds."""
"""Test that the reverse lookup fails on non-existent energy group bounds.

.. test:: Check the neutron energy group bounds logic fails correctly for the wrong structure.
:id: T_ARMI_EG_NE0
:tests: R_ARMI_EG_NE
"""
modifier = 1e-5
for groupStructureType in energyGroups.GROUP_STRUCTURE:
energyBounds = energyGroups.getGroupStructure(groupStructureType)
Expand All @@ -32,6 +37,10 @@ def test_consistenciesBetweenGroupStructureAndGroupStructureType(self):
"""
Test that the reverse lookup of the energy group structures work.

.. test:: Check the neutron energy group bounds for a given group structure.
:id: T_ARMI_EG_NE1
:tests: R_ARMI_EG_NE

Notes
-----
Several group structures point to the same energy group structure so the reverse lookup will fail to
Expand Down
9 changes: 7 additions & 2 deletions armi/reactor/assemblies.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,6 @@ def add(self, obj: blocks.Block):
.. impl:: Assemblies are made up of type Block.
:id: I_ARMI_ASSEM_BLOCKS
:implements: R_ARMI_ASSEM_BLOCKS

"""
composites.Composite.add(self, obj)
obj.spatialLocator = self.spatialGrid[0, 0, len(self) - 1]
Expand Down Expand Up @@ -227,7 +226,6 @@ def getLocation(self):
.. impl:: Assembly location is retrievable.
:id: I_ARMI_ASSEM_POSI0
:implements: R_ARMI_ASSEM_POSI

"""
# just use ring and position, not axial (which is 0)
if not self.parent:
Expand Down Expand Up @@ -1229,6 +1227,13 @@ def rotate(self, rad):


class HexAssembly(Assembly):
"""Placeholder, so users can explicitly define a hex-based assembly.

.. impl:: Assembly of hex blocks.
:id: I_ARMI_ASSEM_HEX
:implements: R_ARMI_ASSEM_HEX
"""

pass


Expand Down
4 changes: 4 additions & 0 deletions armi/reactor/blueprints/componentBlueprint.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,10 @@ def insertDepletableNuclideKeys(c, blueprint):
"""
Auto update number density keys on all DEPLETABLE components.

.. impl:: Any depletable component will be adjusted.
:id: I_ARMI_BP_NUC_FLAGS
:implements: R_ARMI_BP_NUC_FLAGS

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is in the most appropriate place? I would assume this would be better put into somewhere in isotopicOptions, but let me know if I'm misunderstanding your intent.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, or maybe this is just one part of it. I guess the user needs to define composite objects with the DEPLETABLE flag, which would happen in other parts of the blueprints.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just a "blueprint requirement", so I put it in the most general place in the blueprints.

That's really as far as my thought process went.

Hmmm

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, well it is good where it is, by the logic of my second comment above. But during the upcoming "real" review, I anticipate we'll probably ask for another impl in the isotopicOptions.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated. Take a look.

Notes
-----
This should be moved to a neutronics/depletion plugin hook but requires some
Expand Down
2 changes: 1 addition & 1 deletion armi/reactor/blueprints/tests/test_blockBlueprints.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ def test_explicitFlags(self):
Test flags are created from blueprint file.

.. test:: Nuc flags can define depletable objects.
:id: T_ARMI_BP_NUC_FLAGS
:id: T_ARMI_BP_NUC_FLAGS0
:tests: R_ARMI_BP_NUC_FLAGS
"""
a1 = self.blueprints.assemDesigns.bySpecifier["IC"].construct(
Expand Down
7 changes: 6 additions & 1 deletion armi/reactor/blueprints/tests/test_blueprints.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,12 @@ def test_componentDimensions(self):
self.assertAlmostEqual(fuel.getDimension("mult"), 169)

def test_traceNuclides(self):
"""Ensure that armi.reactor.blueprints.componentBlueprint.insertDepletableNuclideKeys runs."""
"""Ensure that armi.reactor.blueprints.componentBlueprint.insertDepletableNuclideKeys runs.

.. test:: Users marking components as depletable will affect number densities.
:id: T_ARMI_BP_NUC_FLAGS1
:tests: R_ARMI_BP_NUC_FLAGS
"""
fuel = (
self.blueprints.constructAssem(self.cs, "igniter fuel")
.getFirstBlock(Flags.FUEL)
Expand Down
4 changes: 4 additions & 0 deletions armi/reactor/converters/axialExpansionChanger.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,10 @@ class AxialExpansionChanger:
:id: I_ARMI_AXIAL_EXP
:implements: R_ARMI_AXIAL_EXP

.. impl:: Preserve the total height of an ARMI assembly, during expansion.
:id: I_ARMI_ASSEM_HEIGHT_PRES
:implements: R_ARMI_ASSEM_HEIGHT_PRES

Attributes
----------
linked : :py:class:`AssemblyAxialLinkage`
Expand Down
10 changes: 7 additions & 3 deletions armi/reactor/converters/geometryConverters.py
Original file line number Diff line number Diff line change
Expand Up @@ -1194,11 +1194,15 @@ def reset(self):


class HexToRZConverter(HexToRZThetaConverter):
r"""
"""
Create a new reactor with R-Z coordinates from the Hexagonal-Z reactor.

This is a subclass of the HexToRZThetaConverter. See the HexToRZThetaConverter for explanation and setup of
the converterSettings.
This is a subclass of the HexToRZThetaConverter. See the HexToRZThetaConverter for
explanation and setup of the converterSettings.

.. impl:: Tool to convert a hex core to an RZTheta core.
:id: I_ARMI_CONV_3DHEX_TO_2DRZ
:implements: R_ARMI_CONV_3DHEX_TO_2DRZ
"""

_GEOMETRY_TYPE = geometry.GeomType.RZ
Expand Down
10 changes: 8 additions & 2 deletions armi/reactor/converters/tests/test_geometryConverters.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def setUp(self):
self.cs = self.o.cs

def test_addRing(self):
r"""Tests that the addRing method adds the correct number of fuel assemblies to the test reactor."""
"""Tests that the addRing method adds the correct number of fuel assemblies to the test reactor."""
converter = geometryConverters.FuelAssemNumModifier(self.cs)
converter.numFuelAssems = 7
converter.ringsToAdd = 1 * ["radial shield"]
Expand All @@ -65,7 +65,7 @@ def test_addRing(self):
) # should wind up with 11 reflector assemblies per 1/3rd core

def test_setNumberOfFuelAssems(self):
r"""Tests that the setNumberOfFuelAssems method properly changes the number of fuel assemblies."""
"""Tests that the setNumberOfFuelAssems method properly changes the number of fuel assemblies."""
# tests ability to add fuel assemblies
converter = geometryConverters.FuelAssemNumModifier(self.cs)
converter.numFuelAssems = 60
Expand Down Expand Up @@ -142,6 +142,12 @@ def tearDown(self):
del self.r

def test_convert(self):
"""Test the HexToRZConverter.

.. test:: Convert a 3D hex reactor core to an RZ-Theta core.
:id: T_ARMI_CONV_3DHEX_TO_2DRZ
:tests: R_ARMI_CONV_3DHEX_TO_2DRZ
"""
# make the reactor smaller, because of a test parallelization edge case
for ring in [9, 8, 7, 6, 5, 4, 3]:
self.r.core.removeAssembliesInRing(ring, self.o.cs)
Expand Down
4 changes: 2 additions & 2 deletions armi/reactor/grids/structuredgrid.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,9 +292,9 @@ def restoreBackup(self):
def getCoordinates(self, indices, nativeCoords=False) -> numpy.ndarray:
"""Return the coordinates of the center of the mesh cell at the given indices in cm.

.. test:: Get the coordinates from a location in a grid.
.. impl:: Get the coordinates from a location in a grid.
:id: I_ARMI_GRID_GLOBAL_POS
:tests: R_ARMI_GRID_GLOBAL_POS
:implements: R_ARMI_GRID_GLOBAL_POS
"""
indices = numpy.array(indices)
return self._evaluateMesh(
Expand Down