Skip to content

Commit

Permalink
Adding impl and test tags for requirements (#1462)
Browse files Browse the repository at this point in the history
  • Loading branch information
john-science authored Nov 7, 2023
1 parent 96a5ede commit 6a546dd
Show file tree
Hide file tree
Showing 8 changed files with 86 additions and 2 deletions.
14 changes: 13 additions & 1 deletion armi/interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ class STACK_ORDER: # noqa: invalid-class-name
Each module specifies an ``ORDER`` constant that specifies where in this order it
should be placed in the Interface Stack.
.. impl:: Define an ordered list of interfaces.
:id: I_ARMI_OPERATOR_INTERFACES0
:implements: R_ARMI_OPERATOR_INTERFACES
Notes
-----
Originally, the ordering was accomplished with a very large if/else construct in ``createInterfaces``.
Expand Down Expand Up @@ -84,7 +88,11 @@ class STACK_ORDER: # noqa: invalid-class-name
class TightCoupler:
"""
Data structure that defines tight coupling attributes that are implemented
within an Interface and called upon when ``interactCoupled`` is called.
within an Interface and called upon when ``interactAllCoupled`` is called.
.. impl:: The TightCoupler defines the convergence criteria for physics coupling.
:id: I_ARMI_OPERATOR_PHYSICS0
:implements: R_ARMI_OPERATOR_PHYSICS
Parameters
----------
Expand Down Expand Up @@ -240,6 +248,10 @@ class Interface:
Interface instances are gathered into an interface stack in
:py:meth:`armi.operators.operator.Operator.createInterfaces`.
.. impl:: The interface shall allow code execution at important operational points in time.
:id: I_ARMI_INTERFACE
:implements: R_ARMI_INTERFACE
"""

# list containing interfaceClass
Expand Down
11 changes: 11 additions & 0 deletions armi/materials/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,13 @@


def setMaterialNamespaceOrder(order):
"""
Set the material namespace order at the Python interpretter, global level.
.. impl:: Materials can be searched across packages in a defined namespace.
:id: I_ARMI_MAT_NAMESPACE
:implements: R_ARMI_MAT_NAMESPACE
"""
global _MATERIAL_NAMESPACE_ORDER
_MATERIAL_NAMESPACE_ORDER = order

Expand Down Expand Up @@ -121,6 +128,10 @@ def resolveMaterialClassByName(name: str, namespaceOrder: List[str] = None):
gets used (Framework's UO2 vs. a user plugins UO2 vs. the Kentucky Transportation
Cabinet's UO2) is up to the user at runtime.
.. impl:: Material collections are defined with an order of precedence in the case of duplicates.
:id: I_ARMI_MAT_ORDER
:implements: R_ARMI_MAT_ORDER
Parameters
----------
name : str
Expand Down
20 changes: 19 additions & 1 deletion armi/materials/material.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,14 @@ class Material:
"""
A material is made up of elements or isotopes. It has bulk properties like mass density.
.. impl:: The abstract material class.
:id: I_ARMI_MAT_PROPERTIES
:implements: R_ARMI_MAT_PROPERTIES
.. impl:: Materials generate nuclide mass fractions at instantiation.
:id: I_ARMI_MAT_FRACS
:implements: R_ARMI_MAT_FRACS
Attributes
----------
parent : Component
Expand Down Expand Up @@ -94,7 +102,13 @@ def __repr__(self):

@property
def name(self):
"""Getter for the private name attribute of this Material."""
"""
Getter for the private name attribute of this Material.
.. impl:: The name of a material is accessible.
:id: I_ARMI_MAT_NAME
:implements: R_ARMI_MAT_NAME
"""
return self._name

@name.setter
Expand Down Expand Up @@ -707,6 +721,10 @@ def getThermalExpansionDensityReduction(self, prevTempInC, newTempInC):
def linearExpansion(self, Tk=None, Tc=None):
"""For void, lets just not allow temperature changes to change dimensions
since it is a liquid it will fill its space.
.. impl:: Fluid materials are not thermally expandable.
:id: I_ARMI_MAT_FLUID
:implements: R_ARMI_MAT_FLUID
"""
return 0.0

Expand Down
7 changes: 7 additions & 0 deletions armi/materials/void.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@


class Void(material.Fluid):
"""A Void material is a bookkeeping material with zero density.
.. impl:: Define a void material with zero density.
:id: I_ARMI_MAT_VOID
:implements: R_ARMI_MAT_VOID
"""

def pseudoDensity(self, Tk: float = None, Tc: float = None) -> float:
return 0.0

Expand Down
8 changes: 8 additions & 0 deletions armi/operators/operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ class Operator:
.. note:: The :doc:`/developer/guide` has some additional narrative on this topic.
.. impl:: The operator package shall expose an ordered list of interfaces, and loop over them in order.
:id: I_ARMI_OPERATOR_INTERFACES1
:implements: R_ARMI_OPERATOR_INTERFACES
Attributes
----------
cs : CaseSettings object
Expand Down Expand Up @@ -650,6 +654,10 @@ def interactAllCoupled(self, coupledIteration):
This is distinct from loose coupling, which would simply uses the temperature values from the previous timestep
in the current flux solution. It's also distinct from full coupling where all fields are solved simultaneously.
ARMI supports tight and loose coupling.
.. impl:: Physics coupling is driven from Operator.
:id: I_ARMI_OPERATOR_PHYSICS1
:implements: R_ARMI_OPERATOR_PHYSICS
"""
activeInterfaces = [ii for ii in self.interfaces if ii.enabled()]

Expand Down
12 changes: 12 additions & 0 deletions armi/physics/neutronics/globalFlux/globalFluxInterface.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,10 @@ def getLabel(caseTitle, cycle, node, iteration=None):
class GlobalFluxOptions(executers.ExecutionOptions):
"""Data structure representing common options in Global Flux Solvers.
.. impl:: Options for neutronics solvers.
:id: I_ARMI_FLUX_OPTIONS
:implements: R_ARMI_FLUX_OPTIONS
Attributes
----------
adjoint : bool
Expand Down Expand Up @@ -528,6 +532,10 @@ def _performGeometryTransformations(self, makePlots=False):
In both cases, we need to undo the modifications between reading the output
and applying the result to the data model.
.. impl:: Ensure the mesh in the reactor model is appropriate for neutronics solver execution.
:id: I_ARMI_FLUX_RX_RATES
:implements: R_ARMI_FLUX_RX_RATES
See Also
--------
_undoGeometryTransformations
Expand Down Expand Up @@ -1244,6 +1252,10 @@ def calcReactionRates(obj, keff, lib):
r"""
Compute 1-group reaction rates for this object (usually a block).
.. impl:: Return the reaction rates for a given ArmiObject.
:id: I_ARMI_FLUX_RX_RATES
:implements: R_ARMI_FLUX_RX_RATES
Parameters
----------
obj : Block
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,14 @@ def getKeff(self):


class TestGlobalFluxOptions(unittest.TestCase):
"""
Tests for GlobalFluxOptions.
.. test:: Tests GlobalFluxOptions
:id: T_ARMI_FLUX_OPTIONS
:tests: R_ARMI_FLUX_OPTIONS
"""

def test_readFromSettings(self):
cs = settings.Settings()
opts = globalFluxInterface.GlobalFluxOptions("neutronics-run")
Expand Down
8 changes: 8 additions & 0 deletions armi/plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,10 @@ def defineParameters() -> Dict:
"""
Function for defining additional parameters.
.. impl:: Plugins can add parameters to the reactor data model.
:id: I_ARMI_PLUGIN_PARAMS
:implements: R_ARMI_PLUGIN_PARAMS
Returns
-------
dict
Expand Down Expand Up @@ -372,6 +376,10 @@ def defineSettings() -> List:
neutronics kernel (let's say MCNP), it should also define a new option to tell
the settings system that ``"MCNP"`` is a valid option.
.. impl:: Plugins can add settings to the run.
:id: I_ARMI_PLUGIN_SETTINGS
:implements: R_ARMI_PLUGIN_SETTINGS
Returns
-------
list
Expand Down

0 comments on commit 6a546dd

Please sign in to comment.