Skip to content

Commit

Permalink
Merge 06914ad into 908c92d
Browse files Browse the repository at this point in the history
  • Loading branch information
john-science authored Sep 24, 2022
2 parents 908c92d + 06914ad commit 117f378
Show file tree
Hide file tree
Showing 10 changed files with 296 additions and 531 deletions.
5 changes: 4 additions & 1 deletion armi/operators/settingsValidation.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ def resolve(self):
raise KeyboardInterrupt
except RunLogPromptCancel as ki:
raise KeyboardInterrupt from ki

except RunLogPromptUnresolvable:
self.autoResolved = False
self._passed = True
Expand Down Expand Up @@ -221,6 +220,7 @@ def run(self, cs=None):
"some issues are creating cyclic resolutions: {}".format(issues)
)
runLog.debug("{} has finished querying.".format(self.__class__.__name__))

return correctionsMade

def addQuery(self, condition, statement, question, correction):
Expand Down Expand Up @@ -439,6 +439,7 @@ def _inspectSettings(self):
self.NO_ACTION,
)

# TODO: Move from nested function to staticmethod, to make this testable.
def _willBeCopiedFrom(fName):
for copyFile in self.cs["copyFilesFrom"]:
if fName == os.path.split(copyFile)[1]:
Expand Down Expand Up @@ -523,6 +524,7 @@ def _willBeCopiedFrom(fName):
self.NO_ACTION,
)

# TODO: Move from nested function to staticmethod, to make this testable.
def _factorsAreValid(factors, maxVal=1.0):
try:
expandedList = expandRepeatedFloats(factors)
Expand Down Expand Up @@ -585,6 +587,7 @@ def _factorsAreValid(factors, maxVal=1.0):
self.NO_ACTION,
)

# TODO: Move from nested function to staticmethod, to make this testable.
def decayCyclesHaveInputThatWillBeIgnored():
"""Check if there is any decay-related input that will be ignored."""
try:
Expand Down
12 changes: 5 additions & 7 deletions armi/physics/fuelCycle/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,14 @@

import voluptuous as vol

from armi import runLog
from armi import interfaces
from armi import plugins
from armi import operators
from armi.utils import directoryChangers
from armi import plugins
from armi import runLog
from armi.operators import RunTypes


from . import fuelHandlers
from . import settings
from armi.physics.fuelCycle import fuelHandlers
from armi.physics.fuelCycle import settings
from armi.utils import directoryChangers

ORDER = interfaces.STACK_ORDER.FUEL_MANAGEMENT

Expand Down
8 changes: 4 additions & 4 deletions armi/physics/fuelCycle/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,17 @@
from armi.settings import setting
from armi.operators import settingsValidation

CONF_ASSEMBLY_ROTATION_ALG = "assemblyRotationAlgorithm"
CONF_ASSEM_ROTATION_STATIONARY = "assemblyRotationStationary"
CONF_ASSEMBLY_ROTATION_ALG = "assemblyRotationAlgorithm"
CONF_CIRCULAR_RING_MODE = "circularRingMode"
CONF_CIRCULAR_RING_ORDER = "circularRingOrder"
CONF_CUSTOM_FUEL_MANAGEMENT_INDEX = "customFuelManagementIndex"
CONF_RUN_LATTICE_BEFORE_SHUFFLING = "runLatticePhysicsBeforeShuffling"
CONF_SHUFFLE_LOGIC = "shuffleLogic"
CONF_PLOT_SHUFFLE_ARROWS = "plotShuffleArrows"
CONF_FUEL_HANDLER_NAME = "fuelHandlerName"
CONF_JUMP_RING_NUM = "jumpRingNum"
CONF_LEVELS_PER_CASCADE = "levelsPerCascade"
CONF_PLOT_SHUFFLE_ARROWS = "plotShuffleArrows"
CONF_RUN_LATTICE_BEFORE_SHUFFLING = "runLatticePhysicsBeforeShuffling"
CONF_SHUFFLE_LOGIC = "shuffleLogic"


def getFuelCycleSettings():
Expand Down
10 changes: 5 additions & 5 deletions armi/physics/fuelPerformance/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,18 @@
# See the License for the specific language governing permissions and
# limitations under the License.

"""Settings related to fuel performance."""
"""Settings related to fuel performance"""

from armi.settings import setting
from armi.operators.settingsValidation import Query
from armi.settings import setting


CONF_FUEL_PERFORMANCE_ENGINE = "fuelPerformanceEngine"
CONF_AXIAL_EXPANSION = "axialExpansion"
CONF_BOND_REMOVAL = "bondRemoval"
CONF_FGR_REMOVAL = "fgRemoval"
CONF_CLADDING_WASTAGE = "claddingWastage"
CONF_CLADDING_STRAIN = "claddingStrain"
CONF_CLADDING_WASTAGE = "claddingWastage"
CONF_FGR_REMOVAL = "fgRemoval"
CONF_FUEL_PERFORMANCE_ENGINE = "fuelPerformanceEngine"


def defineSettings():
Expand Down
55 changes: 10 additions & 45 deletions armi/physics/neutronics/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,12 @@

import os

import yamlize
import numpy
import tabulate

from armi import plugins
from armi.physics.neutronics.const import CONF_CROSS_SECTION
from armi.utils import directoryChangers
from armi import runLog
from armi.physics.neutronics.const import CONF_CROSS_SECTION


class NeutronicsPlugin(plugins.ArmiPlugin):
Expand Down Expand Up @@ -83,7 +81,7 @@ def defineEntryPoints():
@staticmethod
@plugins.HOOKIMPL
def defineSettings():
from . import settings as neutronicsSettings
from armi.physics.neutronics import settings as neutronicsSettings
from armi.physics.neutronics import crossSectionSettings
from armi.physics.neutronics.fissionProductModel import (
fissionProductModelSettings,
Expand All @@ -102,38 +100,10 @@ def defineSettings():
@staticmethod
@plugins.HOOKIMPL
def defineSettingsValidators(inspector):
"""
Check neutronics settings.
"""
from armi.operators import settingsValidation # avoid cyclic import
from armi.scripts.migration.crossSectionBlueprintsToSettings import (
migrateCrossSectionsFromBlueprints,
)
"""Implementation of settings inspections for neutronics settings."""
from armi.physics.neutronics.settings import getNeutronicsSettingValidators

queries = []

def blueprintsHasOldXSInput(path):
with directoryChangers.DirectoryChanger(inspector.cs.inputDirectory):
with open(os.path.expandvars(path)) as f:
for line in f:
if line.startswith("cross sections:"):
return True
return False

queries.append(
settingsValidation.Query(
lambda: inspector.cs["loadingFile"]
and blueprintsHasOldXSInput(inspector.cs["loadingFile"]),
"The specified blueprints input file '{0}' contains compound cross section settings. "
"".format(inspector.cs["loadingFile"]),
"Automatically move them to the settings file, {}? WARNING: if multiple settings files point "
"to this blueprints input you must manually update the others.".format(
inspector.cs.path
),
lambda: migrateCrossSectionsFromBlueprints(inspector.cs),
)
)
return queries
return getNeutronicsSettingValidators(inspector)

@staticmethod
@plugins.HOOKIMPL
Expand All @@ -143,25 +113,20 @@ def onProcessCoreLoading(core, cs, dbLoad):
@staticmethod
@plugins.HOOKIMPL
def getReportContents(r, cs, report, stage, blueprint):
"""
Generates the Report Content for the Neutronics Report
"""

"""Generates the Report Content for the Neutronics Report"""
from armi.physics.neutronics import reports

return reports.insertNeutronicsReport(r, cs, report, stage)


from .const import (
from armi.physics.neutronics.const import (
ALL,
FLUXFILES,
GAMMA,
INPUTOUTPUT,
NEUTRON,
NEUTRONGAMMA,
ALL,
RESTARTFILES,
INPUTOUTPUT,
FLUXFILES,
)


Expand Down
Loading

0 comments on commit 117f378

Please sign in to comment.