Skip to content

Commit

Permalink
Merge e0fd48d into 5062694
Browse files Browse the repository at this point in the history
  • Loading branch information
john-science authored Dec 1, 2021
2 parents 5062694 + e0fd48d commit 4497350
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 15 deletions.
3 changes: 3 additions & 0 deletions armi/settings/settingsIO.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,9 @@ def _readYaml(self, stream, handleInvalids=True):
for settingName, settingVal in caseSettings.items():
self._applySettings(settingName, settingVal)

if handleInvalids:
self._checkInvalidSettings()

def _checkInvalidSettings(self):
if not self.invalidSettings:
return
Expand Down
10 changes: 9 additions & 1 deletion armi/tests/test_fuelHandlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""
Tests some capabilities of the fuel handling machine.
Expand Down Expand Up @@ -499,11 +498,20 @@ def test_buReducingAssemblyRotation(self):
def test_buildRingSchedule(self):
fh = fuelHandlers.FuelHandler(self.o)
schedule, widths = fh.buildRingSchedule(17, 1, jumpRingFrom=14)

# test 1
self.assertEqual(
schedule, [13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 14, 15, 16, 17]
)
self.assertEqual(widths, [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])

# test 2
schedule, widths = fh.buildRingSchedule(1, 17, jumpRingFrom=5)
self.assertEqual(
schedule, [17, 16, 15, 14, 13, 12, 11, 10, 6, 7, 8, 9, 5, 4, 3, 2, 1]
)
self.assertEqual(widths, [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])

def test_buildConvergentRingSchedule(self):
fh = fuelHandlers.FuelHandler(self.o)
schedule, widths = fh.buildConvergentRingSchedule(17, 1)
Expand Down
52 changes: 38 additions & 14 deletions armi/tests/test_lwrInputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,21 @@
# See the License for the specific language governing permissions and
# limitations under the License.
"""Tests for C5G7 input files."""
import unittest
# pylint: disable=missing-function-docstring,missing-class-docstring,abstract-method,protected-access
from logging import WARNING
import os
import unittest

import numpy

from armi.utils import directoryChangers
from armi.tests import TEST_ROOT
from armi.reactor.flags import Flags
from armi import Mode
from armi import runLog
from armi import init as armi_init
from armi.bookkeeping import db
from armi.reactor.flags import Flags
from armi.tests import mockRunLogs
from armi.tests import TEST_ROOT
from armi.utils import directoryChangers

TEST_INPUT_TITLE = "c5g7-settings"

Expand All @@ -42,15 +47,34 @@ def tearDownClass(cls):
def test_loadC5G7(self):
"""
Load the C5G7 case from input and check basic counts.
(Also, check that we are getting warnings when reading the YAML.)
"""
o = armi_init(fName=TEST_INPUT_TITLE + ".yaml")
b = o.r.core.getFirstBlock(Flags.MOX)
# there are 100 of each high, medium, and low MOX pins
fuelPinsHigh = b.getComponent(Flags.HIGH | Flags.MOX)
self.assertEqual(fuelPinsHigh.getDimension("mult"), 100)
with mockRunLogs.BufferLog() as mock:
# we should start with a clean slate
self.assertEqual("", mock._outputStream)
runLog.LOG.startLog("test_loadC5G7")
runLog.LOG.setVerbosity(WARNING)

# ingest the settings file
Mode.setMode(Mode.BATCH)
o = armi_init(fName=TEST_INPUT_TITLE + ".yaml")
b = o.r.core.getFirstBlock(Flags.MOX)

# test warnings are being logged for malformed isotopics info in the settings file
streamVal = mock._outputStream
self.assertGreater(streamVal.count("[warn]"), 32, msg=streamVal)
self.assertGreater(streamVal.count("custom isotopics"), 32, msg=streamVal)
self.assertIn("Uranium Oxide", streamVal, msg=streamVal)
self.assertIn("SaturatedWater", streamVal, msg=streamVal)
self.assertIn("invalid settings: fakeBad", streamVal, msg=streamVal)

# test that there are 100 of each high, medium, and low MOX pins
fuelPinsHigh = b.getComponent(Flags.HIGH | Flags.MOX)
self.assertEqual(fuelPinsHigh.getDimension("mult"), 100)

gt = b.getComponent(Flags.GUIDE_TUBE)
self.assertEqual(gt.getDimension("mult"), 24)
# test the Guide Tube dimensions
gt = b.getComponent(Flags.GUIDE_TUBE)
self.assertEqual(gt.getDimension("mult"), 24)

def test_runAndLoadC5G7(self):
"""
Expand All @@ -59,17 +83,17 @@ def test_runAndLoadC5G7(self):
This ensures that these kinds of cases can be read from DB.
"""

def _loadLocs(o, locs):
def loadLocs(o, locs):
for b in o.r.core.getBlocks():
indices = b.spatialLocator.getCompleteIndices()
locs[indices] = b.spatialLocator.getGlobalCoordinates()

o = armi_init(fName=TEST_INPUT_TITLE + ".yaml")
locsInput, locsDB = {}, {}
_loadLocs(o, locsInput)
loadLocs(o, locsInput)
o.operate()
o2 = db.loadOperator(TEST_INPUT_TITLE + ".h5", 0, 0)
_loadLocs(o2, locsDB)
loadLocs(o2, locsDB)

for indices, coordsInput in sorted(locsInput.items()):
coordsDB = locsDB[indices]
Expand Down
1 change: 1 addition & 0 deletions armi/tests/tutorials/c5g7-settings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ metadata:
version: uncontrolled
settings:
availabilityFactor: 0.9
fakeBad: 123456
power: 1000000000.0
cycleLength: 411.11
loadingFile: c5g7-blueprints.yaml
Expand Down

0 comments on commit 4497350

Please sign in to comment.