Skip to content

Commit 7982238

Browse files
committed
Merge branch 'main' into doc_str_details
2 parents 8d61f72 + ba5e352 commit 7982238

File tree

139 files changed

+2084
-2601
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

139 files changed

+2084
-2601
lines changed

.github/workflows/docs.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ jobs:
5555
cd doc
5656
git submodule init
5757
git submodule update
58+
git fetch
5859
echo "make html:"
5960
make html
6061
echo "make latex:"

.gitignore

+7-3
Original file line numberDiff line numberDiff line change
@@ -73,16 +73,20 @@ tags
7373
temp-*
7474
venv*/
7575

76-
# Ignore common data files
76+
# Ignore certain data files
7777
*.avi
7878
*.diff
79+
*.flux_bg
80+
*.flux_ufg
7981
*.h5
8082
*.html
8183
*.mp4
84+
*.nucdata
85+
*.out
8286
*.ppm
87+
*.sum
8388
*.txt
84-
85-
# vis files
8689
*.vtd
8790
*.vtu
8891
*.xdmf
92+
*dlayxs*

CONTRIBUTING.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Contribution License Agreement
22

3-
For information on how to contribute to ARMI, see [our official documenation](https://terrapower.github.io/armi/developer/first_time_contributors.html).
3+
For information on how to contribute to ARMI, see [our official documentation](https://terrapower.github.io/armi/developer/first_time_contributors.html).
44

55
This Contribution License Agreement (**"Agreement"**) is agreed to by the party signing below (**"You"**), and conveys certain license rights to TerraPower, LLC and its affiliates (**"TerraPower"**) for Your contributions to TerraPower open source projects. This Agreement is effective as of the latest signature date below.
66

README.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,7 @@ The ARMI system is licensed as follows:
420420
limitations under the License.
421421
422422
Be careful when including any dependency in ARMI (say in the ``pyproject.toml`` file) not
423-
to include anything with a license that superceeds our Apache license. For instance,
423+
to include anything with a license that supersedes our Apache license. For instance,
424424
any third-party Python library included in ARMI with a GPL license will make the whole
425425
project fall under the GPL license. But a lot of potential users of ARMI will want to
426426
keep some of their work private, so we can't allow any GPL dependencies.

armi/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ def init(choice=None, fName=None, cs=None, skipInspection=False):
134134
The path to a settings file to load: my_case.yaml
135135
136136
cs : Settings, optional
137-
If supplied, this CS object will supercede the other case input methods and use
137+
If supplied, this CS object will supersede the other case input methods and use
138138
the object directly.
139139
140140
skipInspection : bool, optional

armi/bookkeeping/db/database.py

+144-184
Large diffs are not rendered by default.

armi/bookkeeping/db/databaseInterface.py

+6-18
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,9 @@ def initDB(self, fName: Optional[os.PathLike] = None):
103103
104104
Notes
105105
-----
106-
Main Interface calls this so that the database is available as early as
107-
possible in the run. The database interface interacts near the end of the
108-
interface stack (so that all the parameters have been updated) while the Main
109-
Interface interacts first.
106+
Main Interface calls this so that the database is available as early as possible in the run.
107+
The database interface interacts near the end of the interface stack (so that all the
108+
parameters have been updated) while the Main Interface interacts first.
110109
"""
111110
if fName is None:
112111
self._dbPath = pathlib.Path(self.cs.caseTitle + ".h5")
@@ -120,18 +119,7 @@ def initDB(self, fName: Optional[os.PathLike] = None):
120119
)
121120
self._db = Database(self._dbPath, "w")
122121
self._db.open()
123-
124-
# Grab geomString here because the DB-level has no access to the reactor or
125-
# blueprints or anything.
126-
# There's not always a geomFile; we are moving towards the core grid definition
127-
# living in the blueprints themselves. In this case, the db doesnt need to store
128-
# a geomFile at all.
129-
if self.cs["geomFile"]:
130-
with open(os.path.join(self.cs.inputDirectory, self.cs["geomFile"])) as f:
131-
geomString = f.read()
132-
else:
133-
geomString = ""
134-
self._db.writeInputsToDB(self.cs, geomString=geomString)
122+
self._db.writeInputsToDB(self.cs)
135123

136124
def interactEveryNode(self, cycle, node):
137125
"""
@@ -141,8 +129,8 @@ def interactEveryNode(self, cycle, node):
141129
142130
Notes
143131
-----
144-
- if tight coupling is enabled, the DB will be written in operator.py::Operator::_timeNodeLoop
145-
via writeDBEveryNode
132+
- If tight coupling is enabled, the DB will be written in ``Operator::_timeNodeLoop`` via
133+
writeDBEveryNode.
146134
"""
147135
if self.o.cs["tightCoupling"]:
148136
# h5 cant handle overwriting so we skip here and write once the tight coupling loop has completed

armi/bookkeeping/db/factory.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def databaseFactory(dbName: str, permission: str, version: Optional[str] = None)
3030
dbName: str
3131
Path to db file, e.g. `baseCase.h5`
3232
permission: str
33-
String defining permission, `r` for read only. See armi.bookeeping.db.permissions
33+
String defining permission, `r` for read only. See armi.bookkeeping.db.permissions
3434
version: str, optional
3535
Version of database you want to read or write. In most cases ARMI will
3636
auto-detect. For advanced users.

armi/bookkeeping/db/tests/test_comparedb3.py

+2-6
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,7 @@ def test_compareDatabaseDuplicate(self):
114114
# validate the file exists, and force it to be readable again
115115
b = h5py.File(db._fullPath, "r")
116116
self.assertEqual(list(b.keys()), ["inputs"])
117-
self.assertEqual(
118-
sorted(b["inputs"].keys()), ["blueprints", "geomFile", "settings"]
119-
)
117+
self.assertEqual(sorted(b["inputs"].keys()), ["blueprints", "settings"])
120118
b.close()
121119

122120
# append to lists
@@ -168,9 +166,7 @@ def test_compareDatabaseSim(self):
168166
self.assertEqual(len(dbKeys), 3)
169167
self.assertIn("inputs", dbKeys)
170168
self.assertIn("c00n00", dbKeys)
171-
self.assertEqual(
172-
sorted(b["inputs"].keys()), ["blueprints", "geomFile", "settings"]
173-
)
169+
self.assertEqual(sorted(b["inputs"].keys()), ["blueprints", "settings"])
174170
b.close()
175171

176172
# append to lists

armi/bookkeeping/db/tests/test_database3.py

+3-5
Original file line numberDiff line numberDiff line change
@@ -555,17 +555,15 @@ def test_readInputsFromDB(self):
555555
:tests: R_ARMI_DB_BP
556556
"""
557557
inputs = self.db.readInputsFromDB()
558-
self.assertEqual(len(inputs), 3)
558+
self.assertEqual(len(inputs), 2)
559559

560560
# settings
561561
self.assertGreater(len(inputs[0]), 100)
562562
self.assertIn("settings:", inputs[0])
563563

564-
self.assertEqual(len(inputs[1]), 0)
565-
566564
# blueprints
567-
self.assertGreater(len(inputs[2]), 100)
568-
self.assertIn("blocks:", inputs[2])
565+
self.assertGreater(len(inputs[1]), 2400)
566+
self.assertIn("blocks:", inputs[1])
569567

570568
def test_deleting(self):
571569
self.assertTrue(isinstance(self.db, database.Database))

armi/bookkeeping/db/tests/test_databaseInterface.py

+8-12
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,10 @@ def getSimpleDBOperator(cs):
4444
It's used to make the db unit tests run very quickly.
4545
"""
4646
newSettings = {}
47-
newSettings[CONF_LOADING_FILE] = "smallestTestReactor/refOneBlockReactor.yaml"
47+
newSettings[CONF_LOADING_FILE] = "smallestTestReactor/refSmallestReactor.yaml"
4848
newSettings["verbosity"] = "important"
4949
newSettings["db"] = True
5050
newSettings["runType"] = "Standard"
51-
newSettings["geomFile"] = "geom1Assem.xml"
5251
newSettings["nCycles"] = 1
5352
cs = cs.modified(newSettings=newSettings)
5453
genDBCase = case.Case(cs)
@@ -301,7 +300,6 @@ def goodMethod(cycle, node):
301300
self.assertEqual(h5.attrs["version"], version)
302301

303302
self.assertIn("caseTitle", h5.attrs)
304-
self.assertIn("geomFile", h5["inputs"])
305303
self.assertIn("settings", h5["inputs"])
306304
self.assertIn("blueprints", h5["inputs"])
307305

@@ -344,7 +342,7 @@ def test_getHistory(self):
344342
expectedFluxes7 = {}
345343

346344
def setFluxAwesome(cycle, node):
347-
for bi, b in enumerate(self.r.core.getBlocks()):
345+
for bi, b in enumerate(self.r.core.iterBlocks()):
348346
b.p.flux = 1e6 * bi + 1e3 * cycle + node
349347
if bi == 0:
350348
expectedFluxes0[cycle, node] = b.p.flux
@@ -358,8 +356,7 @@ def getFluxAwesome(cycle, node):
358356
if cycle != 0 or node != 2:
359357
return
360358

361-
blocks = self.r.core.getBlocks()
362-
b0 = blocks[0]
359+
b0 = next(self.r.core.iterBlocks())
363360

364361
db = self.o.getInterface("database")._db
365362

@@ -378,15 +375,14 @@ def getFluxAwesome(cycle, node):
378375

379376
def test_getHistoryByLocation(self):
380377
def setFluxAwesome(cycle, node):
381-
for bi, b in enumerate(self.r.core.getBlocks()):
378+
for bi, b in enumerate(self.r.core.iterBlocks()):
382379
b.p.flux = 1e6 * bi + 1e3 * cycle + node
383380

384381
def getFluxAwesome(cycle, node):
385382
if cycle != 1 or node != 2:
386383
return
387384

388-
blocks = self.r.core.getBlocks()
389-
b = blocks[0]
385+
b = next(self.r.core.iterBlocks())
390386

391387
db = self.o.getInterface("database").database
392388

@@ -426,7 +422,7 @@ def setUpClass(cls):
426422

427423
# update a few parameters
428424
def writeFlux(cycle, node):
429-
for bi, b in enumerate(o.r.core.getBlocks()):
425+
for bi, b in enumerate(o.r.core.iterBlocks()):
430426
b.p.flux = 1e6 * bi + cycle * 100 + node
431427
b.p.mgFlux = np.repeat(b.p.flux / 33, 33)
432428

@@ -555,11 +551,11 @@ def test_readWithoutInputs(self):
555551
with Database(self.dbName, "r") as db:
556552
r2 = db.load(0, 0)
557553

558-
for b1, b2 in zip(self.r.core.getBlocks(), r2.core.getBlocks()):
554+
for b1, b2 in zip(self.r.core.iterBlocks(), r2.core.iterBlocks()):
559555
for c1, c2 in zip(sorted(b1), sorted(b2)):
560556
self.assertEqual(c1.name, c2.name)
561557

562-
for bi, b in enumerate(r2.core.getBlocks()):
558+
for bi, b in enumerate(r2.core.iterBlocks()):
563559
assert_allclose(b.p.flux, 1e6 * bi)
564560

565561
def test_variousTypesWork(self):

armi/bookkeeping/db/tests/test_passiveDBLoadPlugin.py

+6
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,19 @@ def setUp(self):
3636
"""
3737
self.app = getApp()
3838
self._backupApp = deepcopy(self.app)
39+
self._cacheBPSections = PassiveDBLoadPlugin.SKIP_BP_SECTIONS
40+
self._cacheUnkownParams = PassiveDBLoadPlugin.UNKNOWN_PARAMS
41+
PassiveDBLoadPlugin.SKIP_BP_SECTIONS = []
42+
PassiveDBLoadPlugin.UNKNOWN_PARAMS = {}
3943

4044
def tearDown(self):
4145
"""Restore the App to its original state."""
4246
import armi
4347

4448
armi._app = self._backupApp
4549
context.APP_NAME = "armi"
50+
PassiveDBLoadPlugin.SKIP_BP_SECTIONS = self._cacheBPSections
51+
PassiveDBLoadPlugin.UNKNOWN_PARAMS = self._cacheUnkownParams
4652

4753
def test_passiveDBLoadPlugin(self):
4854
plug = PassiveDBLoadPlugin()

armi/bookkeeping/mainInterface.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def describeInterfaces(_cs):
4141

4242
class MainInterface(interfaces.Interface):
4343
"""
44-
Do some basic manipulations, calls, Instantiates the databse.
44+
Do some basic manipulations, calls, Instantiates the database.
4545
4646
Notes
4747
-----

armi/bookkeeping/report/reportInterface.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ def reportSFP(sfp):
172172
runLog.important(title)
173173
runLog.important("-" * len(title))
174174
totFis = 0.0
175-
for a in sfp.getChildren():
175+
for a in sfp:
176176
runLog.important(
177177
"{assembly:15s} discharged at t={dTime:10f} after {residence:10f} yrs. It entered at cycle: {cycle}. "
178178
"It has {fiss:10f} kg (x {mult}) fissile and peak BU={bu:.2f} %.".format(
@@ -196,16 +196,16 @@ def reportSFP(sfp):
196196
@staticmethod
197197
def countAssembliesSFP(sfp):
198198
"""Report on the count of assemblies in the SFP at each timestep."""
199-
if not sfp.getChildren():
199+
if not len(sfp):
200200
return
201201

202202
runLog.important("Count:")
203203
totCount = 0
204204
thisTimeCount = 0
205-
a = sfp.getChildren()[0]
205+
a = sfp[0]
206206
lastTime = a.getAge() / units.DAYS_PER_YEAR + a.p.chargeTime
207207

208-
for a in sfp.getChildren():
208+
for a in sfp:
209209
thisTime = a.getAge() / units.DAYS_PER_YEAR + a.p.chargeTime
210210

211211
if thisTime != lastTime:

armi/bookkeeping/report/reportingUtils.py

+5-12
Original file line numberDiff line numberDiff line change
@@ -109,14 +109,10 @@ def _listInputFiles(cs):
109109
includedBlueprints = []
110110

111111
inputInfo = []
112-
inputFiles = (
113-
[
114-
("Case Settings", cs.caseTitle + ".yaml"),
115-
("Blueprints", cs[CONF_LOADING_FILE]),
116-
]
117-
+ [("Included blueprints", inclBp) for inclBp in includedBlueprints]
118-
+ [("Geometry", cs["geomFile"])]
119-
)
112+
inputFiles = [
113+
("Case Settings", cs.caseTitle + ".yaml"),
114+
("Blueprints", cs[CONF_LOADING_FILE]),
115+
] + [("Included blueprints", inclBp) for inclBp in includedBlueprints]
120116

121117
activeInterfaces = interfaces.getActiveInterfaceInfo(cs)
122118
for klass, kwargs in activeInterfaces:
@@ -672,7 +668,7 @@ def summarizePinDesign(core):
672668
designInfo = collections.defaultdict(list)
673669

674670
try:
675-
for b in core.getBlocks(Flags.FUEL):
671+
for b in core.iterBlocks(Flags.FUEL):
676672
fuel = b.getComponent(Flags.FUEL)
677673
duct = b.getComponent(Flags.DUCT)
678674
clad = b.getComponent(Flags.CLAD)
@@ -831,9 +827,6 @@ def _setGeneralCoreDesignData(cs, coreDesignTable):
831827
report.setData(
832828
"Run Type", "{}".format(cs["runType"]), coreDesignTable, report.DESIGN
833829
)
834-
report.setData(
835-
"Geometry File", "{}".format(cs["geomFile"]), coreDesignTable, report.DESIGN
836-
)
837830
report.setData(
838831
"Loading File",
839832
"{}".format(cs[CONF_LOADING_FILE]),

armi/bookkeeping/tests/test_historyTracker.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ def test_calcMGFluence(self):
111111
r"""
112112
This test confirms that mg flux has many groups when loaded with the history tracker.
113113
114-
armi.bookeeping.db.hdf.hdfDB.readBlocksHistory requires
114+
armi.bookkeeping.db.hdf.hdfDB.readBlocksHistory requires
115115
historical_values\[historical_indices\] to be cast as a list to read more than the
116116
first energy group. This test shows that this behavior is preserved.
117117

armi/bookkeeping/visualization/tests/test_vis.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def setUpClass(cls):
6868
inputFileName="smallestTestReactor/armiRunSmallest.yaml"
6969
)
7070

71-
cls.hexBlock = cls.r.core.getBlocks()[0]
71+
cls.hexBlock = next(cls.r.core.iterBlocks())
7272

7373
cls.cartesianBlock = blocks.CartesianBlock("TestCartesianBlock", caseSetting)
7474
cartesianComponent = components.HoledSquare(

0 commit comments

Comments
 (0)