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.

fromUserSettings(cs)[source]

Set options from a particular Settings object.

fromReactor(reactor)[source]

Set options from a particular reactor object.

resolveDerivedOptions()[source]

Called by executers right before executing.

setRunDirFromCaseTitle(caseTitle: str) None[source]

Set run directory derived from case title and label.

This is optional (you can set runDir to whatever you want). If you use this, you will get a relatively consistent naming convention for your fast-path folders.

describe() str[source]

Make a string summary of all options.

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.

run()[source]

Run the executer steps.

This should use the current state of the reactor as input, perform some kind of calculation, and update the reactor with the output.

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 and ExecuterOptions and other utilities.

writeInput()[source]