openmc.calculate_volumes

openmc.calculate_volumes(threads=None, output=True, cwd='.', openmc_exec='openmc', mpi_args=None, path_input=None)[source]

Run stochastic volume calculations in OpenMC.

This function runs OpenMC in stochastic volume calculation mode. To specify the parameters of a volume calculation, one must first create a openmc.VolumeCalculation instance and assign it to openmc.Settings.volume_calculations. For example:

>>> vol = openmc.VolumeCalculation(domains=[cell1, cell2], samples=100000)
>>> settings = openmc.Settings()
>>> settings.volume_calculations = [vol]
>>> settings.export_to_xml()
>>> openmc.calculate_volumes()
Parameters
  • threads (int, optional) – Number of OpenMP threads. If OpenMC is compiled with OpenMP threading enabled, the default is implementation-dependent but is usually equal to the number of hardware threads available (or a value set by the OMP_NUM_THREADS environment variable).

  • output (bool, optional) – Capture OpenMC output from standard out

  • openmc_exec (str, optional) – Path to OpenMC executable. Defaults to ‘openmc’.

  • mpi_args (list of str, optional) – MPI execute command and any additional MPI arguments to pass, e.g., [‘mpiexec’, ‘-n’, ‘8’].

  • cwd (str, optional) – Path to working directory to run in. Defaults to the current working directory.

  • path_input (str or PathLike) – Path to a single XML file or a directory containing XML files for the OpenMC executable to read.

Raises

RuntimeError – If the openmc executable returns a non-zero status