From 3347aeaa032ffa4668e6d149e5400d9d16dd2d7e Mon Sep 17 00:00:00 2001 From: Paul Romano Date: Fri, 21 Oct 2022 07:07:44 -0500 Subject: [PATCH 1/6] Fixes related to #2253 and #2270 --- include/openmc/constants.h | 5 ----- src/output.cpp | 7 ++++--- src/volume_calc.cpp | 11 +++++------ 3 files changed, 9 insertions(+), 14 deletions(-) diff --git a/include/openmc/constants.h b/include/openmc/constants.h index 8bb2cb1bfa2..a1cc2939c7f 100644 --- a/include/openmc/constants.h +++ b/include/openmc/constants.h @@ -340,11 +340,6 @@ enum class RunMode { enum class GeometryType { CSG, DAG }; -//============================================================================== -// Volume Calculation Constants - -constexpr uint64_t UINT64_T_MAX {std::numeric_limits::max()}; - } // namespace openmc #endif // OPENMC_CONSTANTS_H diff --git a/src/output.cpp b/src/output.cpp index 59cb1571275..18efed65614 100644 --- a/src/output.cpp +++ b/src/output.cpp @@ -1,8 +1,8 @@ #include "openmc/output.h" #include // for transform, max -#include // for strlen #include // for stdout +#include // for strlen #include // for time, localtime #include #include // for setw, setprecision, put_time @@ -134,9 +134,10 @@ void header(const char* msg, int level) auto out = header(msg); // Print header based on verbosity level. - if (settings::verbosity >= level) + if (settings::verbosity >= level) { fmt::print("\n{}\n\n", out); std::fflush(stdout); + } } //============================================================================== @@ -396,7 +397,7 @@ void print_build_info() fmt::print("DAGMC support: {}\n", dagmc); fmt::print("libMesh support: {}\n", libmesh); fmt::print("Coverage testing: {}\n", coverage); - fmt::print("Profiling flags: {}\n", profiling); + fmt::print("Profiling flags: {}\n", profiling); } } diff --git a/src/volume_calc.cpp b/src/volume_calc.cpp index e36b8890413..0b1ea357505 100644 --- a/src/volume_calc.cpp +++ b/src/volume_calc.cpp @@ -225,12 +225,11 @@ vector VolumeCalculation::execute() const iterations++; uint64_t total_samples = iterations * n_samples_; - // warn user if total sample size is greater than what the size_t type can + // warn user if total sample size is greater than what the uin64_t type can // represent - if (total_samples == UINT64_T_MAX) { + if (total_samples == std::numeric_limits::max()) { warning("The number of samples has exceeded the type used to track hits. " - "Volume " - "results may be inaccurate."); + "Volume results may be inaccurate."); } // reset @@ -246,8 +245,8 @@ vector VolumeCalculation::execute() const // Create 2D array to store atoms/uncertainty for each nuclide. Later this // is compressed into vectors storing only those nuclides that are // non-zero - auto n_nuc = settings::run_CE ? data::nuclides.size() - : data::mg.nuclides_.size(); + auto n_nuc = + settings::run_CE ? data::nuclides.size() : data::mg.nuclides_.size(); xt::xtensor atoms({n_nuc, 2}, 0.0); #ifdef OPENMC_MPI From a0e5ba441865309aeca84ad87604002e5fba99a8 Mon Sep 17 00:00:00 2001 From: Paul Romano Date: Tue, 18 Oct 2022 13:34:30 -0500 Subject: [PATCH 2/6] Add 0.13.2 release notes --- docs/source/io_formats/statepoint.rst | 3 +- docs/source/pythonapi/stats.rst | 6 ++ docs/source/releasenotes/0.14.0.rst | 99 +++++++++++++++++++++++++++ docs/source/releasenotes/index.rst | 1 + openmc/material.py | 4 ++ openmc/universe.py | 9 ++- 6 files changed, 120 insertions(+), 2 deletions(-) create mode 100644 docs/source/releasenotes/0.14.0.rst diff --git a/docs/source/io_formats/statepoint.rst b/docs/source/io_formats/statepoint.rst index a05034a2db2..9a08eed737d 100644 --- a/docs/source/io_formats/statepoint.rst +++ b/docs/source/io_formats/statepoint.rst @@ -109,7 +109,8 @@ The current version of the statepoint file format is 17.0. - **y** (*double[]*) -- Interpolant values for energyfunction interpolation. Only used for 'energyfunction' filters. - :Attributes: - **interpolation** (*int*) -- Interpolation type. Only used for + :Attributes: + - **interpolation** (*int*) -- Interpolation type. Only used for 'energyfunction' filters. **/tallies/derivatives/derivative /** diff --git a/docs/source/pythonapi/stats.rst b/docs/source/pythonapi/stats.rst index 10be9454fd2..fb6383fc7d3 100644 --- a/docs/source/pythonapi/stats.rst +++ b/docs/source/pythonapi/stats.rst @@ -22,6 +22,12 @@ Univariate Probability Distributions openmc.stats.Legendre openmc.stats.Mixture openmc.stats.Normal + +.. autosummary:: + :toctree: generated + :nosignatures: + :template: myfunction.rst + openmc.stats.muir Angular Distributions diff --git a/docs/source/releasenotes/0.14.0.rst b/docs/source/releasenotes/0.14.0.rst new file mode 100644 index 00000000000..a1f84adb597 --- /dev/null +++ b/docs/source/releasenotes/0.14.0.rst @@ -0,0 +1,99 @@ +==================== +What's New in 0.14.0 +==================== + +.. currentmodule:: openmc + +------- +Summary +------- + +This release of OpenMC includes several bug fixes, performance improvements for +complex geometries and depletion simulations, and other general enhancements. +Notably, a capability has been added to compute the photon spectra from decay of +unstable nuclides. Alongside that, a new :data:`openmc.config` configuration +variable has been introduced that allows easier configuration of data sources. +Additionally, users can now perform cell or material rejection when sampling +external source distributions. Finally, + +------------------------------------ +Compatibility Notes and Deprecations +------------------------------------ + +- If you are building against libMesh for unstructured mesh tally support, + version 1.6 or higher is now required. +- The ``openmc.stats.Muir`` class has been replaced by a + :func:`openmc.stats.muir` function that returns an instance of + :class:`openmc.stats.Normal`. + +------------ +New Features +------------ + +- The :meth:`openmc.Material.get_nuclide_atom_densities` method now takes an + optional ``nuclide`` argument. +- Functions/methods in the :mod:`openmc.deplete` module now accept times in + Julian years (``'a'``). +- The :meth:`openmc.Universe.plot` method now allows a pre-existing axes object + to be passed in. +- Performance optimization for geometries with many complex regions. +- Performance optimization for depletion by avoiding deepcopies and caching + reaction rates. +- The :class:`openmc.RegularMesh` class now has a + :meth:`~openmc.RegularMesh.from_domain` classmethod. +- The :class:`openmc.CylindricalMesh` class now has a + :meth:`~openmc.CylindricalMesh.from_domain` classmethod. +- Improved method to condense diffusion coefficients from the :mod:`openmc.mgxs` + module. +- A new :data:`openmc.config` configuration variable has been introduced that + allows data sources to be specified at runtime or via environment variables. +- The :class:`openmc.EnergyFunctionFilter` class now supports multiple + interpolation schemes, not just linear-linear interpolation. +- The :class:`openmc.DAGMCUniverse` class now has ``material_names``, + ``n_cells``, and ``n_surfaces`` attributes. +- A new :func:`openmc.data.decay_photon_energy` function has been added that + returns the energy spectrum of photons emitted from the decay of an unstable + nuclide. +- The :class:`openmc.Material` class also has a new + :attr:`~openmc.Material.decay_photon_energy` attribute that gives the decay + photon energy spectrum from the material based on its constituent nuclides. +- The :class:`openmc.deplete.StepResult` now has a + :meth:`~openmc.deplete.StepResult.get_material` method. +- The :class:`openmc.Source` class now takes a ``domains`` argument that + specifies a list of cells, materials, or universes that is used to reject + source sites (i.e., if the sampled sites are not within the specified domain, + they are rejected). + +--------- +Bug Fixes +--------- + +- `Delay call to Tally::set_strides ` +- `Fix reading reference direction from XML for angular distributions `_ +- `Fix erroneous behavior in Material.add_components `_ +- `Fix reading thermal elastic data from ACE `_ +- `Fix reading source file with time attribute `_ +- `Fix conversion of multiple thermal scattering data files from ACE `_ +- `Fix reading values from wwinp file `_ +- `Handle possibility of .ppm file in Universe.plot `_ +- `Update volume calc types to mitigate overflow issues `_ + +------------ +Contributors +------------ + +- `Lewis Gross `_ +- `Andrew Johnson `_ +- `Miriam Kreher `_ +- `James Logan `_ +- `Jose Ignacio Marquez Damien `_ +- `Josh May `_ +- `Patrick Myers `_ +- `Adam Nelson `_ +- `April Novak `_ +- `Ethan Peterson `_ +- `Gavin Ridley `_ +- `Paul Romano `_ +- `Patrick Shriwise `_ +- `Jonathan Shimwell `_ +- `Olek Yardas `_ diff --git a/docs/source/releasenotes/index.rst b/docs/source/releasenotes/index.rst index 34ddb285ae6..5753c8bae6c 100644 --- a/docs/source/releasenotes/index.rst +++ b/docs/source/releasenotes/index.rst @@ -7,6 +7,7 @@ Release Notes .. toctree:: :maxdepth: 1 + 0.14.0 0.13.1 0.13.0 0.12.2 diff --git a/openmc/material.py b/openmc/material.py index e99eec52c47..652ee89a93f 100644 --- a/openmc/material.py +++ b/openmc/material.py @@ -825,6 +825,8 @@ def get_nuclides(self, element: Optional[str] = None): element : str Specifies the element to match when searching through the nuclides + .. versionadded:: 0.14.0 + Returns ------- nuclides : list of str @@ -877,6 +879,8 @@ def get_nuclide_atom_densities(self, nuclide: Optional[str] = None): Nuclide for which atom density is desired. If not specified, the atom density for each nuclide in the material is given. + .. versionadded:: 0.14.0 + Returns ------- nuclides : dict diff --git a/openmc/universe.py b/openmc/universe.py index db828e33c44..b74d98adb10 100644 --- a/openmc/universe.py +++ b/openmc/universe.py @@ -650,19 +650,26 @@ class DAGMCUniverse(UniverseBase): bounding_box : 2-tuple of numpy.array Lower-left and upper-right coordinates of an axis-aligned bounding box of the universe. + + .. versionadded:: 0.13.1 material_names : list of str Return a sorted list of materials names that are contained within the DAGMC h5m file. This is useful when naming openmc.Material() objects as each material name present in the DAGMC h5m file must have a matching openmc.Material() with the same name. + + .. versionadded:: 0.14.0 n_cells : int The number of cells in the DAGMC model. This is the number of cells at runtime and accounts for the implicit complement whether or not is it present in the DAGMC file. + + .. versionadded:: 0.14.0 n_surfaces : int The number of surfaces in the model. - .. versionadded:: 0.13.1 + .. versionadded:: 0.14.0 + """ def __init__(self, From 53b6d8ab11a300b8c8a373d5a62e558f90b5dade Mon Sep 17 00:00:00 2001 From: Paul Romano Date: Wed, 19 Oct 2022 08:04:50 -0500 Subject: [PATCH 3/6] Change 0.14.0 --> 0.13.2 --- CMakeLists.txt | 4 ++-- docs/source/conf.py | 4 ++-- docs/source/releasenotes/{0.14.0.rst => 0.13.2.rst} | 2 +- docs/source/releasenotes/index.rst | 2 +- openmc/__init__.py | 2 +- openmc/data/decay.py | 2 +- openmc/deplete/stepresult.py | 2 +- openmc/material.py | 6 +++--- openmc/stats/univariate.py | 2 +- openmc/universe.py | 6 +++--- 10 files changed, 16 insertions(+), 16 deletions(-) rename docs/source/releasenotes/{0.14.0.rst => 0.13.2.rst} (99%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 04c712a17b8..3fb04850cc4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,8 +3,8 @@ project(openmc C CXX) # Set version numbers set(OPENMC_VERSION_MAJOR 0) -set(OPENMC_VERSION_MINOR 14) -set(OPENMC_VERSION_RELEASE 0) +set(OPENMC_VERSION_MINOR 13) +set(OPENMC_VERSION_RELEASE 2) set(OPENMC_VERSION ${OPENMC_VERSION_MAJOR}.${OPENMC_VERSION_MINOR}.${OPENMC_VERSION_RELEASE}) configure_file(include/openmc/version.h.in "${CMAKE_BINARY_DIR}/include/openmc/version.h" @ONLY) diff --git a/docs/source/conf.py b/docs/source/conf.py index 98ccdee4471..29b5ae84cdb 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -69,9 +69,9 @@ # built documents. # # The short X.Y version. -version = "0.14" +version = "0.13" # The full version, including alpha/beta/rc tags. -release = "0.14.0" +release = "0.13.2" # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/docs/source/releasenotes/0.14.0.rst b/docs/source/releasenotes/0.13.2.rst similarity index 99% rename from docs/source/releasenotes/0.14.0.rst rename to docs/source/releasenotes/0.13.2.rst index a1f84adb597..e00a02baee2 100644 --- a/docs/source/releasenotes/0.14.0.rst +++ b/docs/source/releasenotes/0.13.2.rst @@ -1,5 +1,5 @@ ==================== -What's New in 0.14.0 +What's New in 0.13.2 ==================== .. currentmodule:: openmc diff --git a/docs/source/releasenotes/index.rst b/docs/source/releasenotes/index.rst index 5753c8bae6c..910737a414e 100644 --- a/docs/source/releasenotes/index.rst +++ b/docs/source/releasenotes/index.rst @@ -7,7 +7,7 @@ Release Notes .. toctree:: :maxdepth: 1 - 0.14.0 + 0.13.2 0.13.1 0.13.0 0.12.2 diff --git a/openmc/__init__.py b/openmc/__init__.py index 214695e67ff..bee851ae19e 100644 --- a/openmc/__init__.py +++ b/openmc/__init__.py @@ -38,4 +38,4 @@ from openmc.model import rectangular_prism, hexagonal_prism, Model -__version__ = '0.14.0-dev' +__version__ = '0.13.2-dev' diff --git a/openmc/data/decay.py b/openmc/data/decay.py index 29574e001bf..8268d4a3652 100644 --- a/openmc/data/decay.py +++ b/openmc/data/decay.py @@ -587,7 +587,7 @@ def decay_photon_energy(nuclide: str) -> Optional[Univariate]: for the first time, you need to ensure that a depletion chain has been specified in openmc.config['chain_file']. - .. versionadded:: 0.14.0 + .. versionadded:: 0.13.2 Parameters ---------- diff --git a/openmc/deplete/stepresult.py b/openmc/deplete/stepresult.py index e462f175420..c8b35a1fa27 100644 --- a/openmc/deplete/stepresult.py +++ b/openmc/deplete/stepresult.py @@ -202,7 +202,7 @@ def distribute(self, local_materials, ranges): def get_material(self, mat_id): """Return material object for given depleted composition - .. versionadded:: 0.14.0 + .. versionadded:: 0.13.2 Parameters ---------- diff --git a/openmc/material.py b/openmc/material.py index 652ee89a93f..1979b395881 100644 --- a/openmc/material.py +++ b/openmc/material.py @@ -98,7 +98,7 @@ class Material(IDManagerMixin): this distribution is the total intensity of the photon source in [decay/sec]. - .. versionadded:: 0.14.0 + .. versionadded:: 0.13.2 """ @@ -825,7 +825,7 @@ def get_nuclides(self, element: Optional[str] = None): element : str Specifies the element to match when searching through the nuclides - .. versionadded:: 0.14.0 + .. versionadded:: 0.13.2 Returns ------- @@ -879,7 +879,7 @@ def get_nuclide_atom_densities(self, nuclide: Optional[str] = None): Nuclide for which atom density is desired. If not specified, the atom density for each nuclide in the material is given. - .. versionadded:: 0.14.0 + .. versionadded:: 0.13.2 Returns ------- diff --git a/openmc/stats/univariate.py b/openmc/stats/univariate.py index 28f60de6d7a..de8d08dedb1 100644 --- a/openmc/stats/univariate.py +++ b/openmc/stats/univariate.py @@ -729,7 +729,7 @@ def muir(e0, m_rat, kt): distribution: the mean energy of particles ``e0``, the mass of reactants ``m_rat``, and the ion temperature ``kt``. - .. versionadded:: 0.14.0 + .. versionadded:: 0.13.2 Parameters ---------- diff --git a/openmc/universe.py b/openmc/universe.py index b74d98adb10..94ea5624abe 100644 --- a/openmc/universe.py +++ b/openmc/universe.py @@ -658,17 +658,17 @@ class DAGMCUniverse(UniverseBase): as each material name present in the DAGMC h5m file must have a matching openmc.Material() with the same name. - .. versionadded:: 0.14.0 + .. versionadded:: 0.13.2 n_cells : int The number of cells in the DAGMC model. This is the number of cells at runtime and accounts for the implicit complement whether or not is it present in the DAGMC file. - .. versionadded:: 0.14.0 + .. versionadded:: 0.13.2 n_surfaces : int The number of surfaces in the model. - .. versionadded:: 0.14.0 + .. versionadded:: 0.13.2 """ From 6d499fa0c0c343764550ae95f0314fd68ef29861 Mon Sep 17 00:00:00 2001 From: Paul Romano Date: Wed, 19 Oct 2022 11:17:39 -0500 Subject: [PATCH 4/6] Fix missing underscore in release notes --- docs/source/releasenotes/0.13.2.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/source/releasenotes/0.13.2.rst b/docs/source/releasenotes/0.13.2.rst index e00a02baee2..e9175358b4c 100644 --- a/docs/source/releasenotes/0.13.2.rst +++ b/docs/source/releasenotes/0.13.2.rst @@ -68,7 +68,7 @@ New Features Bug Fixes --------- -- `Delay call to Tally::set_strides ` +- `Delay call to Tally::set_strides `_ - `Fix reading reference direction from XML for angular distributions `_ - `Fix erroneous behavior in Material.add_components `_ - `Fix reading thermal elastic data from ACE `_ From 2e433653cce277bd58400c1641d236be88b41a35 Mon Sep 17 00:00:00 2001 From: Paul Romano Date: Wed, 19 Oct 2022 09:42:16 -0500 Subject: [PATCH 5/6] Avoid warning message on clang --- src/source.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/source.cpp b/src/source.cpp index fc50115cd82..d201e3c033e 100644 --- a/src/source.cpp +++ b/src/source.cpp @@ -224,7 +224,8 @@ SourceSite IndependentSource::sample(uint64_t* seed) const auto id = (domain_type_ == DomainType::CELL) ? model::cells[coord.cell]->id_ : model::universes[coord.universe]->id_; - if (found = contains(domain_ids_, id)) break; + if ((found = contains(domain_ids_, id))) + break; } } } From 4fd665c008dcc2467d652c4ffedfd5ac88a87d27 Mon Sep 17 00:00:00 2001 From: Paul Romano Date: Wed, 19 Oct 2022 09:43:35 -0500 Subject: [PATCH 6/6] Remove -dev on version number --- include/openmc/version.h.in | 2 +- openmc/__init__.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/openmc/version.h.in b/include/openmc/version.h.in index e1c2b0541a5..a518e0d63b0 100644 --- a/include/openmc/version.h.in +++ b/include/openmc/version.h.in @@ -10,7 +10,7 @@ namespace openmc { constexpr int VERSION_MAJOR {@OPENMC_VERSION_MAJOR@}; constexpr int VERSION_MINOR {@OPENMC_VERSION_MINOR@}; constexpr int VERSION_RELEASE {@OPENMC_VERSION_RELEASE@}; -constexpr bool VERSION_DEV {true}; +constexpr bool VERSION_DEV {false}; constexpr std::array VERSION {VERSION_MAJOR, VERSION_MINOR, VERSION_RELEASE}; // clang-format on diff --git a/openmc/__init__.py b/openmc/__init__.py index bee851ae19e..ca21bf17b81 100644 --- a/openmc/__init__.py +++ b/openmc/__init__.py @@ -38,4 +38,4 @@ from openmc.model import rectangular_prism, hexagonal_prism, Model -__version__ = '0.13.2-dev' +__version__ = '0.13.2'