diff --git a/armi/physics/executers.py b/armi/physics/executers.py index 8a118aa65..c88a919f8 100644 --- a/armi/physics/executers.py +++ b/armi/physics/executers.py @@ -59,6 +59,8 @@ class ExecutionOptions: savePhysicsFiles : bool Dump the physics kernel I/O files from the execution to a dedicated directory that will not be overwritten so they will be available after the run. + copyOutput : bool + Copy the output from running the executable back to the working directory. applyResultsToReactor : bool Update the in-memory reactor model with results upon completion. Set to False when information from a run is needed for auxiliary purposes rather than progressing @@ -78,6 +80,7 @@ def __init__(self, label=None): self.applyResultsToReactor = True self.paramsToScaleSubset = None self.savePhysicsFiles = False + self.copyOutput = True def __repr__(self): return f"<{self.__class__.__name__}: {self.label}>" diff --git a/armi/physics/neutronics/globalFlux/globalFluxInterface.py b/armi/physics/neutronics/globalFlux/globalFluxInterface.py index 9bb0e66d2..aad44b5ed 100644 --- a/armi/physics/neutronics/globalFlux/globalFluxInterface.py +++ b/armi/physics/neutronics/globalFlux/globalFluxInterface.py @@ -339,7 +339,6 @@ def __init__(self, label: Optional[str] = None): # can happen in eig if Fredholm Alternative satisfied self.includeFixedSource = False self.eigenvalueProblem = True - self.copyOutput = True self.kernelName: str self.isRestart = None self.energyDepoCalcMethodStep = None # for gamma transport/normalization diff --git a/armi/physics/neutronics/globalFlux/tests/test_globalFluxInterface.py b/armi/physics/neutronics/globalFlux/tests/test_globalFluxInterface.py index ada941b37..1658adf75 100644 --- a/armi/physics/neutronics/globalFlux/tests/test_globalFluxInterface.py +++ b/armi/physics/neutronics/globalFlux/tests/test_globalFluxInterface.py @@ -31,7 +31,6 @@ from armi.reactor.tests import test_reactors from armi.tests import ISOAA_PATH - # pylint: disable=abstract-method class MockReactorParams: def __init__(self): @@ -223,31 +222,6 @@ def _setTightCouplingTrue(self): def _setTightCouplingFalse(self): self.cs["tightCoupling"] = False - def test_collectInputsAndOutputs(self): - """ - Verify that the executer can select to not copy back output. - """ - executer = self.gfi.getExecuter() - cs = settings.Settings() - executer.options.fromUserSettings(cs) - executer.options.inputFile = "test.inp" - executer.options.outputFile = "test.out" - executer.options.copyOutput = False - inputs, outputs = executer._collectInputsAndOutputs() - self.assertEqual( - "test.inp", inputs[0], "Input file was not successfully identified." - ) - self.assertTrue(outputs == [], "Outputs were returned erroneously!") - - executer.options.copyOutput = True - inputs, outputs = executer._collectInputsAndOutputs() - self.assertEqual( - "test.inp", inputs[0], "Input file was not successfully identified." - ) - self.assertEqual( - "test.out", outputs[0], "Output file was not successfully identified." - ) - class TestGlobalFluxInterfaceWithExecutersNonUniform(unittest.TestCase): """Tests for global flux execution with non-uniform assemblies.""" diff --git a/armi/physics/tests/test_executers.py b/armi/physics/tests/test_executers.py index c5aa5681c..4c34c98a7 100644 --- a/armi/physics/tests/test_executers.py +++ b/armi/physics/tests/test_executers.py @@ -17,8 +17,35 @@ import os import unittest +from armi.reactor import geometry +from armi import settings from armi.physics import executers +# pylint: disable=abstract-method +class MockReactorParams: + def __init__(self): + self.cycle = 1 + self.timeNode = 2 + + +class MockCoreParams: + pass + + +class MockCore: + def __init__(self): + # just pick a random geomType + self.geomType = geometry.GeomType.CARTESIAN + self.symmetry = "full" + self.p = MockCoreParams() + + +class MockReactor: + def __init__(self): + self.core = MockCore() + self.o = None + self.p = MockReactorParams() + class TestExecutionOptions(unittest.TestCase): def test_runningDirectoryPath(self): @@ -39,5 +66,34 @@ def test_runningDirectoryPath(self): self.assertEqual(os.path.basename(e.runDir), "9c1c83cb-0") +class TestExecuters(unittest.TestCase): + def setUp(self): + e = executers.ExecutionOptions(label=None) + self.executer = executers.DefaultExecuter(e, MockReactor()) + + def test_collectInputsAndOutputs(self): + """ + Verify that the executer can select to not copy back output. + """ + cs = settings.Settings() + self.executer.options.inputFile = "test.inp" + self.executer.options.outputFile = "test.out" + self.executer.options.copyOutput = False + inputs, outputs = self.executer._collectInputsAndOutputs() + self.assertEqual( + "test.inp", inputs[0], "Input file was not successfully identified." + ) + self.assertTrue(outputs == [], "Outputs were returned erroneously!") + + self.executer.options.copyOutput = True + inputs, outputs = self.executer._collectInputsAndOutputs() + self.assertEqual( + "test.inp", inputs[0], "Input file was not successfully identified." + ) + self.assertEqual( + "test.out", outputs[0], "Output file was not successfully identified." + ) + + if __name__ == "__main__": unittest.main() diff --git a/doc/release/0.2.rst b/doc/release/0.2.rst index 1ea7751ec..a6ccff326 100644 --- a/doc/release/0.2.rst +++ b/doc/release/0.2.rst @@ -11,7 +11,7 @@ What's new in ARMI #. The method ``Material.density3`` is now called ``density``, and the old ``density`` is now called ``pseudoDensity``. (`PR#1163 `_) #. Added documentation for the thermal expansion approach used in ARMI. (`PR#1204 `_) #. Use TemporaryDirectoryChanger for executer.run() so dirs are cleaned up during run. (`PR#1219 `_) -#. New option ``copyOutput`` for globalFluxInterface to not copy output back to working directory. (`PR#1218 `_) +#. New option ``copyOutput`` for globalFluxInterface to not copy output back to working directory. (`PR#1218 `_, `PR#1227 `_) Bug fixes ---------