From c3d3b5a71f9c478a0b49d59aa7a678138732dc1d Mon Sep 17 00:00:00 2001 From: Paul Romano Date: Thu, 6 Aug 2020 08:23:23 -0500 Subject: [PATCH] Increment version of depletion results file, and support reading older version --- docs/source/io_formats/depletion_results.rst | 9 ++++++--- openmc/deplete/results.py | 8 ++++++-- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/docs/source/io_formats/depletion_results.rst b/docs/source/io_formats/depletion_results.rst index de28b04777..ad6f858f2c 100644 --- a/docs/source/io_formats/depletion_results.rst +++ b/docs/source/io_formats/depletion_results.rst @@ -4,7 +4,7 @@ Depletion Results File Format ============================= -The current version of the depletion results file format is 1.0. +The current version of the depletion results file format is 1.1. **/** @@ -14,7 +14,7 @@ The current version of the depletion results file format is 1.0. :Datasets: - **eigenvalues** (*double[][][2]*) -- k-eigenvalues at each time/stage. This array has shape (number of timesteps, number of - stages, value). The last axis contains the eigenvalue and the + stages, value). The last axis contains the eigenvalue and the associated uncertainty - **number** (*double[][][][]*) -- Total number of atoms. This array has shape (number of timesteps, number of stages, number of @@ -25,7 +25,10 @@ The current version of the depletion results file format is 1.0. nuclides, number of reactions). - **time** (*double[][2]*) -- Time in [s] at beginning/end of each step. - - **depletion time** (*double[]*) -- Average process time in [s] + - **source_rate** (*double[][]*) -- Power in [W] or source rate in + [neutrons/sec]. This array has shape (number of timesteps, number + of stages). + - **depletion time** (*double[]*) -- Average process time in [s] spent depleting a material across all burnable materials and, if applicable, MPI processes. diff --git a/openmc/deplete/results.py b/openmc/deplete/results.py index 90e7573f21..ce8331e825 100644 --- a/openmc/deplete/results.py +++ b/openmc/deplete/results.py @@ -12,7 +12,7 @@ import numpy as np from . import comm, MPI from .reaction_rates import ReactionRates -VERSION_RESULTS = (1, 0) +VERSION_RESULTS = (1, 1) __all__ = ["Results"] @@ -394,7 +394,11 @@ class Results: number_dset = handle["/number"] eigenvalues_dset = handle["/eigenvalues"] time_dset = handle["/time"] - source_rate_dset = handle["/source_rate"] + if "source_rate" in handle: + source_rate_dset = handle["/source_rate"] + else: + # Older versions used "power" instead of "source_rate" + source_rate_dset = handle["/power"] results.data = number_dset[step, :, :, :] results.k = eigenvalues_dset[step, :]