From 8d36b9b81336c45b2bd9d9de84278b71f5f13bd1 Mon Sep 17 00:00:00 2001 From: Patrick Shriwise Date: Sat, 26 Jun 2021 18:46:14 -0500 Subject: [PATCH] Add a note about unable to write errors for summary/statepoint files on OpenMC re-runs from Python API. --- docs/source/usersguide/troubleshoot.rst | 17 +++++++++++++++++ examples/jupyter/chain_simple.xml | 1 + 2 files changed, 18 insertions(+) create mode 120000 examples/jupyter/chain_simple.xml diff --git a/docs/source/usersguide/troubleshoot.rst b/docs/source/usersguide/troubleshoot.rst index 7fb5723d93..259b21aa45 100644 --- a/docs/source/usersguide/troubleshoot.rst +++ b/docs/source/usersguide/troubleshoot.rst @@ -45,6 +45,23 @@ with the :envvar:`OPENMC_CROSS_SECTIONS` environment variable. It is recommended to add a line in your ``.profile`` or ``.bash_profile`` setting the :envvar:`OPENMC_CROSS_SECTIONS` environment variable. +RuntimeError: Failed to open HDF5 file with mode 'w': summary.h5 +**************************************************************** + +This often occurs when working with the Python API and executing multiple OpenMC +runs in a script. If an :class:`openmc.StatePoint` is open in the Python interpreter, +the file handle of the statpoint file as well as the linked `summary.h5` file will +be unavailable for writing, causing this error to appear. To avoid the situation, +it is recommended that data be extracted from statepoint files in a context manager: + +.. code-block:: python + + with openmc.StatePoint('statepoint.10.h5') as sp: + k_eff = sp.k_combined + +or that the :meth:`StatePoint.close` method is called before executing a subsequent +OpenMC run. + Geometry Debugging ****************** diff --git a/examples/jupyter/chain_simple.xml b/examples/jupyter/chain_simple.xml new file mode 120000 index 0000000000..96f6fa8818 --- /dev/null +++ b/examples/jupyter/chain_simple.xml @@ -0,0 +1 @@ +../../tests/chain_simple.xml \ No newline at end of file