From 60d92f89d23b95beb32d71a4f968adc21ad66d0f Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Fri, 12 Jul 2019 14:17:46 -0500 Subject: [PATCH] Add temperatures to statepoints, Material.from_hdf5 Also include material attributes to summary format documentation --- docs/source/io_formats/summary.rst | 7 +++++++ openmc/material.py | 2 ++ src/material.cpp | 3 +++ 3 files changed, 12 insertions(+) diff --git a/docs/source/io_formats/summary.rst b/docs/source/io_formats/summary.rst index ee0d85fe3..cf0eca4aa 100644 --- a/docs/source/io_formats/summary.rst +++ b/docs/source/io_formats/summary.rst @@ -116,6 +116,13 @@ The current version of the summary file format is 6.0. - **sab_names** (*char[][]*) -- Names of S(:math:`\alpha,\beta`) tables assigned to the material. +:Attributes: - **volume** (*double[]*) -- Volume of this material [cm^3]. Only + present if ``volume`` supplied + - **temperature** (*double[]*) -- Temperature of this material [K]. + Only present in ``temperature`` supplied + - **depletable** (*int[]*) -- ``1`` if the material can be depleted, + ``0`` otherwise. Always present + **/nuclides/** :Attributes: - **n_nuclides** (*int*) -- Number of nuclides in the problem. diff --git a/openmc/material.py b/openmc/material.py index f372dd663..375e1dca1 100644 --- a/openmc/material.py +++ b/openmc/material.py @@ -287,6 +287,8 @@ class Material(IDManagerMixin): material.depletable = bool(group.attrs['depletable']) if 'volume' in group.attrs: material.volume = group.attrs['volume'] + if "temperature" in group.attrs: + material.temperature = group.attrs["temperature"] # Read the names of the S(a,b) tables for this Material and add them if 'sab_names' in group: diff --git a/src/material.cpp b/src/material.cpp index ccbbe57a8..f9116a935 100644 --- a/src/material.cpp +++ b/src/material.cpp @@ -898,6 +898,9 @@ void Material::to_hdf5(hid_t group) const if (volume_ > 0.0) { write_attribute(material_group, "volume", volume_); } + if (temperature_ > 0.0) { + write_attribute(material_group, "temperature", temperature_); + } write_dataset(material_group, "name", name_); write_dataset(material_group, "atom_density", density_);