armi.physics.executers module
Executors are useful for having a standard way to run physics calculations.
They may involve external codes (with inputs/execution/output) or in-memory data pathways.
- class armi.physics.executers.ExecutionOptions(label=None)[source]
Bases:
object
A data structure representing all options needed for a physics kernel.
- Variables:
inputFile (str) – Name of main input file. Often passed to stdin of external code.
outputFile (str) – Name of main output file. Often the stdout of external code.
extraInputFiles (list of tuples) – (sourceName, destName) pairs of file names that will be brought from the working dir into the runDir. Allows renames while in transit.
extraOutputFiles (list of tuples) – (sourceName, destName) pairs of file names that will be extracted from the runDir to the working dir
executablePath (str) – Path to external executable to run (if external code is used)
runDir (str) – Path on running system where the run will take place. This is often used to ensure external codes that use hard-drive disk space run on a local disk rather than a shared network drive
workingDir (str) – Path on system where results will be placed after the run. This is often a shared network location. Auto-applied during execution by default.
label (str) – A name for the run that may be used as a prefix for input/output files generated.
interface (str) – A name for the interface calling the Executer that may be used to organize the input/output files generated within sub-folders under the working directory.
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 the reactor model.
- class armi.physics.executers.Executer(options, reactor)[source]
Bases:
object
Short-lived object that coordinates a calculation step and updates a reactor.
Notes
This is deliberately not a
MpiAction
. Thus, Executers can run as potentially multiple steps in a parent (parallelizable ) MpiAction or in other flexible ways. This is intended to maximize reusability.
- class armi.physics.executers.DefaultExecuter(options, reactor)[source]
Bases:
Executer
An Executer that uses a common run sequence.
This sequence has been found to be relatively common in many externally-executed physics codes. It is here for convenience but is not required. The sequence look like:
Choose modeling options (either from the global run settings input or dictated programmatically)
Apply geometry transformations to the ARMI Reactor as needed
Build run-specific working directory
Write input file(s)
Put specific input files and libs in run directory
Run the analysis (external execution, or not)
Process output while still in run directory
Check error conditions
Move desired output files back to main working directory
Clean up run directory
Un-apply geometry transformations as needed
Update ARMI data model as desired
- run()[source]
Run the executer steps.
Warning
If a calculation requires anything different from what this method does, do not update this method with new complexity! Instead, simply make your own run sequence and/or class. This pattern is useful only in that it is fairly simple. By all means, do use
DirectoryChanger
andExecuterOptions
and other utilities.