Skip to content

Commit

Permalink
Removing duplicate, incorrect setting of core power parameter (#749)
Browse files Browse the repository at this point in the history
  • Loading branch information
keckler committed Jul 7, 2022
1 parent 3f834e0 commit dbbd432
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 10 deletions.
2 changes: 1 addition & 1 deletion armi/bookkeeping/db/tests/test_comparedb3.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ def test_compareDatabaseSim(self):

# end-to-end validation that comparing a photocopy database works
diffs = compareDatabases(dbs[0]._fullPath, dbs[1]._fullPath)
self.assertEqual(len(diffs.diffs), 459)
self.assertEqual(len(diffs.diffs), 456)
self.assertEqual(diffs.nDiffs(), 3)


Expand Down
31 changes: 24 additions & 7 deletions armi/bookkeeping/db/tests/test_database3.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
from armi.reactor import grids
from armi.reactor.tests import test_reactors
from armi.tests import TEST_ROOT
from armi.utils import getPreviousTimeNode
from armi.utils.directoryChangers import TemporaryDirectoryChanger


Expand Down Expand Up @@ -138,14 +139,20 @@ def test_prepRestartRun(self):
# first successfully call to prepRestartRun
o, r = test_reactors.loadTestReactor(TEST_ROOT)
cs = o.cs
ratedPower = cs["power"]
startCycle = cs["startCycle"]
startNode = cs["startNode"]
cyclesSetting = [
{"step days": [1000, 1000], "power fractions": [1, 1]},
{"step days": [1000, 1000], "power fractions": [1, 1]},
{"step days": [1000, 1000], "power fractions": [1, 1]},
]
cycleP, nodeP = getPreviousTimeNode(startCycle, startNode, cs)
cyclesSetting[cycleP]["power fractions"][nodeP] = 0.5
cs = cs.modified(
newSettings={
"nCycles": 3,
"cycles": [
{"step days": [1000, 1000], "power fractions": [1, 1]},
{"step days": [1000, 1000], "power fractions": [1, 1]},
{"step days": [1000, 1000], "power fractions": [1, 1]},
],
"cycles": cyclesSetting,
"reloadDBName": "something_fake.h5",
}
)
Expand All @@ -155,16 +162,26 @@ def test_prepRestartRun(self):
dbi.initDB(fName="reloadingDB.h5")
db = dbi.database

# populate the db with something
# populate the db with some things
for cycle, node in ((cycle, node) for cycle in range(3) for node in range(2)):
r.p.cycle = cycle
r.p.timeNode = node
r.p.cycleLength = 2000
r.p.cycleLength = sum(cyclesSetting[cycle]["step days"])
r.core.p.power = ratedPower * cyclesSetting[cycle]["power fractions"][node]
db.writeToDB(r)
db.close()

self.dbi.prepRestartRun()

# prove that the reloaded reactor has the correct power
self.assertEqual(self.o.r.p.cycle, cycleP)
self.assertEqual(self.o.r.p.timeNode, nodeP)
self.assertEqual(cyclesSetting[cycleP]["power fractions"][nodeP], 0.5)
self.assertEqual(
self.o.r.core.p.power,
ratedPower * cyclesSetting[cycleP]["power fractions"][nodeP],
)

# now make the cycle histories clash and confirm that an error is thrown
cs = cs.modified(
newSettings={
Expand Down
2 changes: 0 additions & 2 deletions armi/reactor/reactors.py
Original file line number Diff line number Diff line change
Expand Up @@ -2215,8 +2215,6 @@ def processLoading(self, cs):
"=========== Initializing Mesh, Assembly Zones, and Nuclide Categories =========== "
)

self.p.power = cs["power"]

for b in self.getBlocks():
if b.p.molesHmBOL > 0.0:
break
Expand Down

0 comments on commit dbbd432

Please sign in to comment.