Skip to content

Commit c799586

Browse files
authored
Adding impl/test crumbs for blueprints (#1476)
1 parent 5b3555c commit c799586

10 files changed

+97
-7
lines changed

armi/reactor/blueprints/assemblyBlueprint.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,10 @@ class AssemblyBlueprint(yamlize.Object):
9292
9393
This class utilizes ``yamlize`` to enable serialization to and from the
9494
blueprints YAML file.
95+
96+
.. impl:: Create assembly from blueprint file
97+
:id: I_ARMI_BP_ASSEM
98+
:implements: R_ARMI_BP_ASSEM
9599
"""
96100

97101
name = yamlize.Attribute(type=str)

armi/reactor/blueprints/blockBlueprint.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,12 @@ def _configureGeomOptions():
4242

4343

4444
class BlockBlueprint(yamlize.KeyedList):
45-
"""Input definition for Block."""
45+
"""Input definition for Block.
46+
47+
.. impl:: Create a Block from blueprint file
48+
:id: I_ARMI_BP_BLOCK
49+
:implements: R_ARMI_BP_BLOCK
50+
"""
4651

4752
item_type = componentBlueprint.ComponentBlueprint
4853
key_attr = componentBlueprint.ComponentBlueprint.name

armi/reactor/blueprints/componentBlueprint.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,10 @@ class ComponentBlueprint(yamlize.Object):
119119
"""
120120
This class defines the inputs necessary to build ARMI component objects. It uses ``yamlize`` to enable serialization
121121
to and from YAML.
122+
123+
.. impl:: Construct component from blueprint file
124+
:id: I_ARMI_BP_COMP
125+
:implements: R_ARMI_BP_COMP
122126
"""
123127

124128
name = yamlize.Attribute(type=str)

armi/reactor/blueprints/gridBlueprint.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,12 @@ def readFromLatticeMap(self, value):
246246
self._readFromLatticeMap = value
247247

248248
def construct(self):
249-
"""Build a Grid from a grid definition."""
249+
"""Build a Grid from a grid definition.
250+
251+
.. impl:: Define a lattice map in reactor core
252+
:id: I_ARMI_BP_GRID
253+
:implements: R_ARMI_BP_GRID
254+
"""
250255
self._readGridContents()
251256
grid = self._constructSpatialGrid()
252257
return grid
@@ -534,6 +539,10 @@ def saveToStream(stream, bluep, full=False, tryMap=False):
534539
full: bool ~ Is this a full output file, or just a partial/grids?
535540
tryMap: regardless of input form, attempt to output as a lattice map. let's face it;
536541
they're prettier.
542+
543+
.. impl:: Write a blueprint file from a blueprint object
544+
:id: I_ARMI_BP_TO_DB
545+
:implements: R_ARMI_BP_TO_DB
537546
"""
538547
# To save, we want to try our best to output our grid blueprints in the lattice
539548
# map style. However, we do not want to wreck the state that the current

armi/reactor/blueprints/reactorBlueprint.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,14 @@ def _resolveSystemType(typ: str):
101101
def construct(self, cs, bp, reactor, geom=None, loadAssems=True):
102102
"""Build a core/IVS/EVST/whatever and fill it with children.
103103
104+
.. impl:: Build core and spent fuel pool from blueprint
105+
:id: I_ARMI_BP_SYSTEMS
106+
:implements: R_ARMI_BP_SYSTEMS
107+
108+
.. impl:: Create core object with blueprint
109+
:id: I_ARMI_BP_CORE
110+
:implements: R_ARMI_BP_CORE
111+
104112
Parameters
105113
----------
106114
cs : :py:class:`Settings <armi.settings.Settings>` object.

armi/reactor/blueprints/tests/test_assemblyBlueprints.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,13 @@ def loadCustomAssembly(self, assemblyInput):
183183
return design.assemblies["fuel a"]
184184

185185
def test_checkParamConsistency(self):
186+
"""
187+
Load assembly from a blueprint file.
188+
189+
.. test:: Create assembly from blueprint file
190+
:id: T_ARMI_BP_ASSEM
191+
:tests: R_ARMI_BP_ASSEM
192+
"""
186193
# make sure a good example doesn't error
187194
a = self.loadCustomAssembly(self.twoBlockInput_correct)
188195
blockAxialMesh = a.getAxialMesh()

armi/reactor/blueprints/tests/test_blockBlueprints.py

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
op: 16.75
6464
other fuel: &block_fuel_other
6565
grid name: fuelgrid
66-
flags: fuel test
66+
flags: fuel test depletable
6767
fuel:
6868
shape: Circle
6969
material: UZr
@@ -255,7 +255,12 @@
255255

256256

257257
class TestGriddedBlock(unittest.TestCase):
258-
"""Tests for a block that has components in a lattice."""
258+
"""Tests for a block that has components in a lattice.
259+
260+
.. test:: Create block with blueprint file
261+
:id: T_ARMI_BP_BLOCK
262+
:tests: R_ARMI_BP_BLOCK
263+
"""
259264

260265
def setUp(self):
261266
self.cs = settings.Settings()
@@ -301,6 +306,13 @@ def test_nonLatticeComponentHasRightMult(self):
301306
self.assertEqual(duct.getDimension("mult"), 1.0)
302307

303308
def test_explicitFlags(self):
309+
"""
310+
Test flags are created from blueprint file.
311+
312+
.. test:: Test depletable nuc flags
313+
:id: T_ARMI_BP_NUC_FLAGS
314+
:tests: R_ARMI_BP_NUC_FLAGS
315+
"""
304316
a1 = self.blueprints.assemDesigns.bySpecifier["IC"].construct(
305317
self.cs, self.blueprints
306318
)
@@ -312,7 +324,9 @@ def test_explicitFlags(self):
312324
)
313325

314326
self.assertTrue(b1.hasFlags(Flags.FUEL, exact=True))
315-
self.assertTrue(b2.hasFlags(Flags.FUEL | Flags.TEST, exact=True))
327+
self.assertTrue(
328+
b2.hasFlags(Flags.FUEL | Flags.TEST | Flags.DEPLETABLE, exact=True)
329+
)
316330

317331
self.assertEqual(a1.p.flags, Flags.FUEL)
318332
self.assertTrue(a1.hasFlags(Flags.FUEL, exact=True))

armi/reactor/blueprints/tests/test_blueprints.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,12 @@ def test_specialIsotopicVectors(self):
8787
self.assertAlmostEqual(mox["PU239"], 0.00286038)
8888

8989
def test_componentDimensions(self):
90-
"""Tests that the user can specifiy the dimensions of a component with arbitray fidelity."""
90+
"""Tests that the user can specify the dimensions of a component with arbitrary fidelity.
91+
92+
.. test:: Test that a component can be correctly created from a blueprint file
93+
:id: T_ARMI_BP_COMP
94+
:tests: R_ARMI_BP_COMP
95+
"""
9196
fuelAssem = self.blueprints.constructAssem(self.cs, name="igniter fuel")
9297
fuel = fuelAssem.getComponents(Flags.FUEL)[0]
9398
self.assertAlmostEqual(fuel.getDimension("od", cold=True), 0.86602)

armi/reactor/blueprints/tests/test_gridBlueprints.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,13 +314,27 @@ def test_contents(self):
314314
self.assertIn("core", self.grids)
315315

316316
def test_roundTrip(self):
317+
"""
318+
Test saving blueprint data to a stream.
319+
320+
.. test:: Write blueprints settings to disk
321+
:id: T_ARMI_BP_TO_DB
322+
:tests: R_ARMI_BP_TO_DB
323+
"""
317324
stream = io.StringIO()
318325
saveToStream(stream, self.grids, False, True)
319326
stream.seek(0)
320327
gridBp = Grids.load(stream)
321328
self.assertIn("third", gridBp["core"].symmetry)
322329

323330
def test_tiny_map(self):
331+
"""
332+
Test that a lattice map can be defined, written, and read in from blueprint file.
333+
334+
.. test:: Define a lattice map in reactor core
335+
:id: T_ARMI_BP_GRID1
336+
:tests: R_ARMI_BP_GRID
337+
"""
324338
grid = Grids.load(TINY_GRID)
325339
stream = io.StringIO()
326340
saveToStream(stream, grid, full=True, tryMap=True)
@@ -381,6 +395,12 @@ def test_simpleRead(self):
381395
self.assertEqual(gridDesign4.gridContents[-4, -3], "1")
382396

383397
def test_simpleReadLatticeMap(self):
398+
"""Read lattice map and create a grid.
399+
400+
.. test:: Define a lattice map in reactor core
401+
:id: T_ARMI_BP_GRID0
402+
:tests: R_ARMI_BP_GRID
403+
"""
384404
# Cartesian full, even/odd hybrid
385405
gridDesign4 = self.grids["sfp even"]
386406
_grid = gridDesign4.construct()

armi/reactor/blueprints/tests/test_reactorBlueprints.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@
1616
import os
1717
import unittest
1818

19+
from armi.reactor.assemblyLists import SpentFuelPool
1920
from armi.reactor import blueprints
21+
from armi.reactor.reactors import Core
2022
from armi import settings
2123
from armi.reactor import reactors
2224
from armi.reactor.blueprints import reactorBlueprint
@@ -101,11 +103,23 @@ def _setupReactor(self):
101103
return core, sfp
102104

103105
def test_construct(self):
104-
"""Actually construct some reactor systems."""
106+
"""Actually construct some reactor systems.
107+
108+
.. test:: Create core and spent fuel pool with blueprint
109+
:id: T_ARMI_BP_SYSTEMS
110+
:tests: R_ARMI_BP_SYSTEMS
111+
112+
.. test:: Create core object with blueprint
113+
:id: T_ARMI_BP_CORE
114+
:tests: R_ARMI_BP_CORE
115+
"""
105116
core, sfp = self._setupReactor()
106117
self.assertEqual(len(core), 2)
107118
self.assertEqual(len(sfp), 4)
108119

120+
self.assertIsInstance(core, Core)
121+
self.assertIsInstance(sfp, SpentFuelPool)
122+
109123
def test_materialDataSummary(self):
110124
"""Test that the material data summary for the core is valid as a printout to the stdout."""
111125
expectedMaterialData = [

0 commit comments

Comments
 (0)