From 02f18152991d2d1992a71ff5feaa7f43e92d24ce Mon Sep 17 00:00:00 2001 From: Paul Romano Date: Fri, 29 Jul 2022 10:08:33 -0500 Subject: [PATCH 01/10] Add missing versionadded directives --- openmc/data/kalbach_mann.py | 5 +++++ openmc/deplete/coupled_operator.py | 6 ++++++ openmc/deplete/independent_operator.py | 5 +++-- openmc/deplete/microxs.py | 8 +++++--- openmc/filter.py | 2 ++ openmc/material.py | 4 +++- openmc/region.py | 2 ++ openmc/stats/univariate.py | 2 ++ openmc/universe.py | 6 ++++++ openmc/weight_windows.py | 4 +++- 10 files changed, 37 insertions(+), 7 deletions(-) diff --git a/openmc/data/kalbach_mann.py b/openmc/data/kalbach_mann.py index a036da6949..f98bb41869 100644 --- a/openmc/data/kalbach_mann.py +++ b/openmc/data/kalbach_mann.py @@ -178,6 +178,8 @@ def kalbach_slope(energy_projectile, energy_emitted, za_projectile, energies are not calculated with the AWR number, but approximated with the number of mass instead. + .. versionadded:: 0.13.1 + Parameters ---------- energy_projectile : float @@ -593,6 +595,9 @@ class KalbachMann(AngleEnergy): If the projectile is a neutron, the slope is calculated when it is not given explicitly. + .. versionchanged:: 0.13.1 + Arguments changed to accommodate slope calculation + Parameters ---------- file_obj : file-like object diff --git a/openmc/deplete/coupled_operator.py b/openmc/deplete/coupled_operator.py index eba90f60d9..dd14f282fc 100644 --- a/openmc/deplete/coupled_operator.py +++ b/openmc/deplete/coupled_operator.py @@ -56,6 +56,7 @@ def _find_cross_sections(model): ) return cross_sections + def _get_nuclides_with_data(cross_sections): """Loads cross_sections.xml file to find nuclides with neutron data @@ -81,6 +82,7 @@ def _get_nuclides_with_data(cross_sections): return nuclides + class CoupledOperator(OpenMCOperator): """Transport-coupled transport operator. @@ -93,6 +95,9 @@ class CoupledOperator(OpenMCOperator): The geometry and settings parameters have been replaced with a model parameter that takes a :class:`~openmc.model.Model` object + .. versionchanged:: 0.13.1 + Name changed from ``Operator`` to ``CoupledOperator`` + Parameters ---------- model : openmc.model.Model @@ -534,6 +539,7 @@ class CoupledOperator(OpenMCOperator): if self.cleanup_when_done: openmc.lib.finalize() + # Retain deprecated name for the time being def Operator(*args, **kwargs): # warn of name change diff --git a/openmc/deplete/independent_operator.py b/openmc/deplete/independent_operator.py index a2d89e441e..20267f9489 100644 --- a/openmc/deplete/independent_operator.py +++ b/openmc/deplete/independent_operator.py @@ -6,8 +6,6 @@ transport solver by using user-provided one-group cross sections. """ import copy -from collections import OrderedDict -from warnings import warn from itertools import product import numpy as np @@ -22,6 +20,7 @@ from .microxs import MicroXS from .results import Results from .helpers import ChainFissionHelper, ConstantFissionYieldHelper, SourceRateHelper + class IndependentOperator(OpenMCOperator): """Transport-independent transport operator that uses one-group cross sections to calculate reaction rates. @@ -32,6 +31,8 @@ class IndependentOperator(OpenMCOperator): passed to an integrator class, such as :class:`openmc.deplete.CECMIntegrator`. + .. versionadded:: 0.13.1 + Parameters ---------- materials : openmc.Materials diff --git a/openmc/deplete/microxs.py b/openmc/deplete/microxs.py index ccbfab5389..72d87d3b73 100644 --- a/openmc/deplete/microxs.py +++ b/openmc/deplete/microxs.py @@ -25,8 +25,10 @@ _valid_rxns.append('fission') class MicroXS(DataFrame): - """Stores microscopic cross section data for use in - transport-independent depletion. + """Microscopic cross section data for use in transport-independent depletion. + + .. versionadded:: 0.13.1 + """ @classmethod @@ -59,7 +61,7 @@ class MicroXS(DataFrame): energy_bound : 2-tuple of float, optional Bounds for the energy group. run_kwargs : dict, optional - Keyword arguments for :meth:`openmc.model.Model.run()` + Keyword arguments passed to :meth:`openmc.model.Model.run` Returns ------- diff --git a/openmc/filter.py b/openmc/filter.py index d7ab3f27e7..7874a775b2 100644 --- a/openmc/filter.py +++ b/openmc/filter.py @@ -1340,6 +1340,8 @@ class EnergyFilter(RealFilter): def from_group_structure(cls, group_structure): """Construct an EnergyFilter instance from a standard group structure. + .. versionadded:: 0.13.1 + Parameters ---------- group_structure : str diff --git a/openmc/material.py b/openmc/material.py index 6c23d3319a..167eaba84a 100644 --- a/openmc/material.py +++ b/openmc/material.py @@ -463,6 +463,8 @@ class Material(IDManagerMixin): def remove_element(self, element): """Remove an element from the material + .. versionadded:: 0.13.1 + Parameters ---------- element : str @@ -918,7 +920,7 @@ class Material(IDManagerMixin): Returns ------- Union[dict, float] - If by_nuclide is True then a dictionary whose keys are nuclide + If by_nuclide is True then a dictionary whose keys are nuclide names and values are activity is returned. Otherwise the activity of the material is returned as a float. """ diff --git a/openmc/region.py b/openmc/region.py index 4e74a08adc..5d0e680204 100644 --- a/openmc/region.py +++ b/openmc/region.py @@ -269,6 +269,8 @@ class Region(ABC): inplace : bool Whether or not to return a region based on new surfaces or one based on the original surfaces that have been modified. + + .. versionadded:: 0.13.1 memo : dict or None Dictionary used for memoization. This parameter is used internally and should not be specified by the user. diff --git a/openmc/stats/univariate.py b/openmc/stats/univariate.py index 0c30526251..d6b8a75735 100644 --- a/openmc/stats/univariate.py +++ b/openmc/stats/univariate.py @@ -205,6 +205,8 @@ class Discrete(Univariate): def merge(cls, dists, probs): """Merge multiple discrete distributions into a single distribution + .. versionadded:: 0.13.1 + Parameters ---------- dists : iterable of openmc.stats.Discrete diff --git a/openmc/universe.py b/openmc/universe.py index 4aa1775fb1..081fff4ff0 100644 --- a/openmc/universe.py +++ b/openmc/universe.py @@ -644,6 +644,8 @@ 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 """ def __init__(self, @@ -726,6 +728,9 @@ class DAGMCUniverse(UniverseBase): def bounding_region(self, bounded_type='box', boundary_type='vacuum', starting_id=10000): """Creates a either a spherical or box shaped bounding region around the DAGMC geometry. + + .. versionadded:: 0.13.1 + Parameters ---------- bounded_type : str @@ -740,6 +745,7 @@ class DAGMCUniverse(UniverseBase): Starting ID of the surface(s) used in the region. For bounded_type 'box', the next 5 IDs will also be used. Defaults to 10000 to reduce the chance of an overlap of surface IDs with the DAGMC geometry. + Returns ------- openmc.Region diff --git a/openmc/weight_windows.py b/openmc/weight_windows.py index c5b7a00b66..9183bb08b7 100644 --- a/openmc/weight_windows.py +++ b/openmc/weight_windows.py @@ -409,7 +409,9 @@ class WeightWindows(IDManagerMixin): def wwinp_to_wws(path): - """Creates WeightWindows classes from a wwinp file + """Create WeightWindows instances from a wwinp file + + .. versionadded:: 0.13.1 Parameters ---------- From 7b0189125906fbc8e351cae1e54933e6369bc6f4 Mon Sep 17 00:00:00 2001 From: Paul Romano Date: Fri, 29 Jul 2022 10:08:47 -0500 Subject: [PATCH 02/10] Start release notes for 0.13.1 --- docs/source/pythonapi/stats.rst | 7 ++ docs/source/releasenotes/0.13.1.rst | 179 ++++++++++++++++++++++++++++ docs/source/releasenotes/index.rst | 1 + 3 files changed, 187 insertions(+) create mode 100644 docs/source/releasenotes/0.13.1.rst diff --git a/docs/source/pythonapi/stats.rst b/docs/source/pythonapi/stats.rst index 1d4ef03026..b4f1158548 100644 --- a/docs/source/pythonapi/stats.rst +++ b/docs/source/pythonapi/stats.rst @@ -51,3 +51,10 @@ Spatial Distributions openmc.stats.SphericalIndependent openmc.stats.Box openmc.stats.Point + +.. autosummary:: + :toctree: generated + :nosignatures: + :template: myfunction.rst + + openmc.stats.spherical_uniform diff --git a/docs/source/releasenotes/0.13.1.rst b/docs/source/releasenotes/0.13.1.rst new file mode 100644 index 0000000000..501d54090a --- /dev/null +++ b/docs/source/releasenotes/0.13.1.rst @@ -0,0 +1,179 @@ +==================== +What's New in 0.13.1 +==================== + +.. currentmodule:: openmc + +------- +Summary +------- + +This release of OpenMC includes many bug fixes as well as improvements in +geometry modeling, mesh functionality, source specification, depletion +capabilities, and other general enhancements. The depletion module features a +new transport operator, :class:`openmc.deplete.IndependentOperator`, that allows +a depletion calculation to be performed using arbitrary one-group cross sections +(e.g., generated by an external solver). The track file generation capability +has been significantly overhauled and a new :class:`openmc.Tracks` class was +introduced to allow access to information in track files from the Python API. +Support has been added for new ENDF thermal scattering evaluations that use +mixed coherent/incoherent elastic scattering. + +------------------------------------ +Compatibility Notes and Deprecations +------------------------------------ + +- The ``openmc.deplete.Operator`` class has been renamed + :class:`openmc.deplete.CoupledOperator`. +- The ``openmc.deplete.ResultsList`` class has been renamed to + :class:`openmc.deplete.Results` and no longer requires you to call the + ``from_hdf5()`` method in order to create it; instead, you can directly + instantiate it. +- A few methods that represent k-effective have been renamed for the sake of + consistency: + + - ``openmc.StatePoint.k_combined`` is now :attr:`openmc.StatePoint.keff` + - ``openmc.deplete.ResultsList.get_eigenvalue`` is now + :meth:`openmc.deplete.Results.get_keff` + +- The :class:`openmc.stats.SphericalIndependent` class, which used to + accept a distribution for ``theta`` now accepts a distribution for ``cos_theta`` + instead in order to more easily handle the common case of specifying a uniform + spatial distribution over a sphere (also see the new + :func:`openmc.stats.spherical_uniform` function). + +- If you are building OpenMC from source, note that several of our CMake options + have been changed: + + ========== ====================== + Old option New option + ========== ====================== + debug --- + optimize --- + profile OPENMC_ENABLE_PROFILE + coverage OPENMC_ENABLE_COVERAGE + openmp OPENMC_USE_OPENMP + --- OPENMC_USE_MPI + dagmc OPENMC_USE_DAGMC + libmesh OPENMC_USE_LIBMESH + ========== ====================== + + The ``debug`` and ``optimize`` options have been removed; instead, use the + standard `CMAKE_BUILD_TYPE + `_ + variable. + +------------ +New Features +------------ + +- An :class:`openmc.model.IsogonalOctagon` composite surface. +- The :class:`~openmc.DAGMCUniverse` class now has a + :attr:`~openmc.DAGMCUniverse.bounding_box` attribute and a + :meth:`~openmc.DAGMCUniverse.bounding_region` method. +- When translating a :class:`~openmc.Region` using the + :meth:`~openmc.Region.translate` method, there is now an ``inplace`` argument. +- The :class:`~openmc.Material` class has several new methods and attributes: + + - The :meth:`~openmc.Material.add_components` methods allows you to add + multiple nuclides/elements to a material with a single call by passing a + dictionary. + - The :meth:`~openmc.Material.get_activity` method returns the activity of a + material in Bq, Bq/g, or Bq/cm³. + - The :meth:`~openmc.Material.remove_element` method removes an element from a + material + - The :meth:`~openmc.Material.get_nuclide_atoms` method gives the number of + atoms of each nuclide in a material + +- All mesh classes now have a ``volumes`` property that provides the volume of + each mesh element as well as ``write_data_to_vtk`` methods. +- Support for externally managed MOAB meshes or libMesh meshes. +- Multiple discrete distributions can be merged with the new + :meth:`~openmc.stats.Discrete.merge` method. +- The :func:`openmc.stats.spherical_uniform` function creates a uniform + distribution over a sphere using the + :class:`~openmc.stats.SphericalIndependent` class. +- Univariate distributions in the :mod:`openmc.stats` module now have + ``sample()`` methods. +- An ``openmc_sample_external_source`` function has been added to the C API with + a corresponding Python binding :func:`openmc.lib.sample_external_source`. +- The track file generation capability has been completely overhauled. Track + files now include much more information, and a new :class:`~openmc.TrackFile` + class allows access to track file information from the Python API. Multiple + tracks are now written to a single file (one per MPI rank). +- A new :func:`openmc.wwinp_to_wws` function that converts weight windows from a + ``wwinp`` file to a list of :class:`~openmc.WeightWindows` objects. +- The new :meth:`openmc.EnergyFilter.from_group_structure` method provides a + way of creating an energy filter with a group structure identified by name. +- The :class:`openmc.data.Decay` class now has a + :attr:`~openmc.data.Decay.sources` property that provides radioactive decay + source distributions. +- A :class:`openmc.mgxs.ReducedAbsorptionXS` class produces a multigroup cross + section representing "reduced" absorption (absorption less neutron production + from (n,xn) reactions). +- Added support in the Python API and HDF5 nuclear data format for new ENDF + thermal neutron scattering evaluations with mixed coherent elastic and + incoherent elastic. +- CMake now relies on ``find_package(MPI)`` for a more standard means of + identifying an MPI compiler configuration. + +--------- +Bug Fixes +--------- + +- `Fix bug when a rotation matrix is passed to Halfspace.rotate `_ +- `Fix bug for spherical mesh string repr `_ +- `Fix package_data specification to include pyx files `_ +- `Allow meshes with same ID to appear in multiple files `_ +- `Fix overwritten variable in get_libraries_from_xsdata `_ +- `Write output files to correct directory `_ +- `Allow CMake to properly find third-party packages `_ +- `Fix Region.from_expression when ")(" appears in specification `_ +- `Move lost particle reset from finalize() to reset() `_ +- `Minor typo fixes in test_lattice.py `_ +- `Fix color assignment in Universe.plot `_ +- `Several depletion-related fixes `_ +- `Allow control of C++ standard used by compiler `_ +- `Fix IO format documentation for surface source read/write `_ +- `Make sure basis gets set in Plot.from_geometry `_ +- `Improve robustness of torus distance calculation `_ +- `Allow use of redundant fission when adjusting KERMA in from_njoy `_ +- `Disable GNU extensions for CMake target `_ +- `Two from_xml fixes `_ +- `Fix for rare infinite loop when finding cell `_ +- `Allow photon heating to be tallied by nuclide `_ +- `Use UTF-8 encoding when reading dose coefficients `_ +- `Fix a corner case in Region.from_expression `_ +- `Fix bug in spherical and cylindrical meshes `_ +- `Ensure weight window bounds are flattened when writing to XML `_ +- `Fix for std::cout sync bug in output.cpp `_ +- `Allow compiling against fmt v9 `_ +- `Fix TimeFilter for small time intervals `_ + +------------ +Contributors +------------ + +- `David Andrs `_ +- `Hunter Belanger `_ +- `Helen Brooks `_ +- `Rémi Delaporte-Mathurin `_ +- `Joffrey Dorville `_ +- `Christopher Fichtlscherer `_ +- `Lewis Gross `_ +- `Andrew Johnson `_ +- `Kalin Kiesling `_ +- `Amanda Lund `_ +- `Richard Morrison `_ +- `Patrick Myers `_ +- `Adam Nelson `_ +- `April Novak `_ +- `Ethan Peterson `_ +- `Gavin Ridley `_ +- `Paul Romano `_ +- `Jonathan Shimwell `_ +- `Patrick Shriwise `_ +- `Amelia Trainer `_ +- `John Tramm `_ +- `Bob Urberger `_ +- `Olek Yardas `_ diff --git a/docs/source/releasenotes/index.rst b/docs/source/releasenotes/index.rst index 75db7ebc9b..34ddb285ae 100644 --- a/docs/source/releasenotes/index.rst +++ b/docs/source/releasenotes/index.rst @@ -7,6 +7,7 @@ Release Notes .. toctree:: :maxdepth: 1 + 0.13.1 0.13.0 0.12.2 0.12.1 From 28b8f9ecc565c1fcfe5716dd31fc126a0c911044 Mon Sep 17 00:00:00 2001 From: Paul Romano Date: Fri, 12 Aug 2022 14:37:39 -0500 Subject: [PATCH 03/10] Change Operator --> CoupledOperator in a few places --- examples/pincell_depletion/restart_depletion.py | 2 +- examples/pincell_depletion/run_depletion.py | 2 +- openmc/model/model.py | 6 +++--- tests/regression_tests/deplete_with_transport/test.py | 2 +- tests/unit_tests/test_deplete_activation.py | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/examples/pincell_depletion/restart_depletion.py b/examples/pincell_depletion/restart_depletion.py index 95bbb9954b..6bb715f3b5 100644 --- a/examples/pincell_depletion/restart_depletion.py +++ b/examples/pincell_depletion/restart_depletion.py @@ -43,7 +43,7 @@ model = openmc.Model(geometry=geometry, settings=settings) # Create depletion "operator" chain_file = 'chain_simple.xml' -op = openmc.deplete.Operator(model, chain_file, previous_results) +op = openmc.deplete.CoupledOperator(model, chain_file, previous_results) # Perform simulation using the predictor algorithm time_steps = [1.0, 1.0, 1.0, 1.0, 1.0] # days diff --git a/examples/pincell_depletion/run_depletion.py b/examples/pincell_depletion/run_depletion.py index ae069334ed..6a6c25f59b 100644 --- a/examples/pincell_depletion/run_depletion.py +++ b/examples/pincell_depletion/run_depletion.py @@ -88,7 +88,7 @@ model = openmc.Model(geometry=geometry, settings=settings) # Create depletion "operator" chain_file = 'chain_simple.xml' -op = openmc.deplete.Operator(model, chain_file) +op = openmc.deplete.CoupledOperator(model, chain_file) # Perform simulation using the predictor algorithm time_steps = [1.0, 1.0, 1.0, 1.0, 1.0] # days diff --git a/openmc/model/model.py b/openmc/model/model.py index 52c52154e3..ab99ac9787 100644 --- a/openmc/model/model.py +++ b/openmc/model/model.py @@ -331,7 +331,7 @@ class Model: Indicate whether or not a transport solve should be run at the end of the last timestep. Defaults to running this transport solve. operator_kwargs : dict - Keyword arguments passed to the depletion Operator initializer + Keyword arguments passed to the depletion operator initializer (e.g., :func:`openmc.deplete.Operator`) directory : str, optional Directory to write XML files to. If it doesn't exist already, it @@ -360,8 +360,8 @@ class Model: with _change_directory(Path(directory)): with openmc.lib.quiet_dll(output): - depletion_operator = \ - dep.Operator(self, **op_kwargs) + # TODO: Support use of IndependentOperator too + depletion_operator = dep.CoupledOperator(self, **op_kwargs) # Tell depletion_operator.finalize NOT to clear C API memory when # it is done diff --git a/tests/regression_tests/deplete_with_transport/test.py b/tests/regression_tests/deplete_with_transport/test.py index 0c2a4cd973..58065035f3 100644 --- a/tests/regression_tests/deplete_with_transport/test.py +++ b/tests/regression_tests/deplete_with_transport/test.py @@ -53,7 +53,7 @@ def test_full(run_in_tmpdir, problem, multiproc): # Create operator chain_file = Path(__file__).parents[2] / 'chain_simple.xml' - op = openmc.deplete.Operator(model, chain_file) + op = openmc.deplete.CoupledOperator(model, chain_file) op.round_number = True # Power and timesteps diff --git a/tests/unit_tests/test_deplete_activation.py b/tests/unit_tests/test_deplete_activation.py index cb3b86b9c8..1842ad8ac8 100644 --- a/tests/unit_tests/test_deplete_activation.py +++ b/tests/unit_tests/test_deplete_activation.py @@ -64,7 +64,7 @@ def test_activation(run_in_tmpdir, model, reaction_rate_mode, reaction_rate_opts chain.export_to_xml('test_chain.xml') # Create transport operator - op = openmc.deplete.Operator( + op = openmc.deplete.CoupledOperator( model, 'test_chain.xml', normalization_mode="source-rate", reaction_rate_mode=reaction_rate_mode, @@ -144,7 +144,7 @@ def test_decay(run_in_tmpdir): model = openmc.Model(geometry=geometry, settings=settings) # Create transport operator - op = openmc.deplete.Operator( + op = openmc.deplete.CoupledOperator( model, 'test_chain.xml', normalization_mode="source-rate" ) From c252930c4990fa71e3f00ec7d3e90dd4df7116d1 Mon Sep 17 00:00:00 2001 From: Paul Romano Date: Mon, 15 Aug 2022 12:33:24 -0500 Subject: [PATCH 04/10] Support passing Path objects to Summary() --- openmc/summary.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/openmc/summary.py b/openmc/summary.py index 41bae7f26b..43224334d0 100644 --- a/openmc/summary.py +++ b/openmc/summary.py @@ -14,6 +14,11 @@ _VERSION_SUMMARY = 6 class Summary: """Summary of model used in a simulation. + Parameters + ---------- + filename : str or path-like + Path to file to load + Attributes ---------- date_and_time : str @@ -33,8 +38,9 @@ class Summary: """ def __init__(self, filename): + filename = str(filename) if not filename.endswith(('.h5', '.hdf5')): - msg = 'Unable to open "{0}" which is not an HDF5 summary file' + msg = f'Unable to open "{filename}" which is not an HDF5 summary file' raise ValueError(msg) self._f = h5py.File(filename, 'r') From d31b083685f7109348a817a12d9bb7e0ff079cba Mon Sep 17 00:00:00 2001 From: Paul Romano Date: Tue, 16 Aug 2022 16:19:55 -0500 Subject: [PATCH 05/10] Address @yardasol review comments --- docs/source/releasenotes/0.13.1.rst | 16 +++++++++------- openmc/deplete/results.py | 3 +++ openmc/deplete/stepresult.py | 3 +++ openmc/mgxs/mgxs.py | 2 ++ openmc/model/surface_composite.py | 4 ++++ openmc/stats/multivariate.py | 7 +++++-- openmc/stats/univariate.py | 2 +- openmc/tracks.py | 6 +++++- 8 files changed, 32 insertions(+), 11 deletions(-) diff --git a/docs/source/releasenotes/0.13.1.rst b/docs/source/releasenotes/0.13.1.rst index 501d54090a..4df31e4569 100644 --- a/docs/source/releasenotes/0.13.1.rst +++ b/docs/source/releasenotes/0.13.1.rst @@ -13,11 +13,12 @@ geometry modeling, mesh functionality, source specification, depletion capabilities, and other general enhancements. The depletion module features a new transport operator, :class:`openmc.deplete.IndependentOperator`, that allows a depletion calculation to be performed using arbitrary one-group cross sections -(e.g., generated by an external solver). The track file generation capability -has been significantly overhauled and a new :class:`openmc.Tracks` class was -introduced to allow access to information in track files from the Python API. -Support has been added for new ENDF thermal scattering evaluations that use -mixed coherent/incoherent elastic scattering. +(e.g., generated by an external solver) along with a +:class:`openmc.deplete.MicroXS` class for managing one-group cross sections. The +track file generation capability has been significantly overhauled and a new +:class:`openmc.Tracks` class was introduced to allow access to information in +track files from the Python API. Support has been added for new ENDF thermal +scattering evaluations that use mixed coherent/incoherent elastic scattering. ------------------------------------ Compatibility Notes and Deprecations @@ -67,7 +68,8 @@ Compatibility Notes and Deprecations New Features ------------ -- An :class:`openmc.model.IsogonalOctagon` composite surface. +- Two new composite surfaces: :class:`openmc.model.IsogonalOctagon` and + :class:`openmc.model.CylinderSector`. - The :class:`~openmc.DAGMCUniverse` class now has a :attr:`~openmc.DAGMCUniverse.bounding_box` attribute and a :meth:`~openmc.DAGMCUniverse.bounding_region` method. @@ -98,7 +100,7 @@ New Features - An ``openmc_sample_external_source`` function has been added to the C API with a corresponding Python binding :func:`openmc.lib.sample_external_source`. - The track file generation capability has been completely overhauled. Track - files now include much more information, and a new :class:`~openmc.TrackFile` + files now include much more information, and a new :class:`~openmc.Tracks` class allows access to track file information from the Python API. Multiple tracks are now written to a single file (one per MPI rank). - A new :func:`openmc.wwinp_to_wws` function that converts weight windows from a diff --git a/openmc/deplete/results.py b/openmc/deplete/results.py index c2138b55c6..b38dcf0589 100644 --- a/openmc/deplete/results.py +++ b/openmc/deplete/results.py @@ -46,6 +46,9 @@ class Results(list): each depletion step and provides extra methods for interrogating these results. + .. versionchanged:: 0.13.1 + Name changed from ``ResultsList`` to ``Results`` + Parameters ---------- filename : str diff --git a/openmc/deplete/stepresult.py b/openmc/deplete/stepresult.py index c54f9edcf1..db5260c808 100644 --- a/openmc/deplete/stepresult.py +++ b/openmc/deplete/stepresult.py @@ -23,6 +23,9 @@ __all__ = ["StepResult"] class StepResult: """Result of a single depletion timestep + .. versionchanged:: 0.13.1 + Name changed from ``Results`` to ``StepResult`` + Attributes ---------- k : list of (float, float) diff --git a/openmc/mgxs/mgxs.py b/openmc/mgxs/mgxs.py index f9798c24a4..46a6ed35c9 100644 --- a/openmc/mgxs/mgxs.py +++ b/openmc/mgxs/mgxs.py @@ -3107,6 +3107,8 @@ class ReducedAbsorptionXS(MGXS): 3\sigma_{n,4n}(r,E) \right) \psi (r, E, \Omega)}{\int_{r \in V} dr \int_{4\pi} d\Omega \int_{E_g}^{E_{g-1}} dE \; \psi (r, E, \Omega)}. + .. versionadded:: 0.13.1 + """ def __init__(self, domain=None, domain_type=None, energy_groups=None, diff --git a/openmc/model/surface_composite.py b/openmc/model/surface_composite.py index 51019b0d8e..4c76c77864 100644 --- a/openmc/model/surface_composite.py +++ b/openmc/model/surface_composite.py @@ -64,6 +64,8 @@ class CylinderSector(CompositeSurface): operators applied to it will produce a half-space. The negative side is defined to be the region inside of the cylinder sector. + .. versionadded:: 0.13.1 + Parameters ---------- r1 : float @@ -225,6 +227,8 @@ class IsogonalOctagon(CompositeSurface): operators applied to it will produce a half-space. The negative side is defined to be the region inside of the octogonal prism. + .. versionadded:: 0.13.1 + Parameters ---------- center : iterable of float diff --git a/openmc/stats/multivariate.py b/openmc/stats/multivariate.py index 98c76ea674..f34bf0d1fb 100644 --- a/openmc/stats/multivariate.py +++ b/openmc/stats/multivariate.py @@ -377,7 +377,10 @@ class SphericalIndependent(Spatial): :math:`\theta`, and :math:`\phi` components are sampled independently from one another and centered on the coordinates (x0, y0, z0). - .. versionadded: 0.12 + .. versionadded:: 0.12 + + .. versionchanged:: 0.13.1 + Accepts ``cos_theta`` instead of ``theta`` Parameters ---------- @@ -787,7 +790,7 @@ def spherical_uniform(r_outer, r_inner=0.0, thetas=(0., pi), phis=(0., 2*pi), shell between `r_inner` and `r_outer`. Optionally, the range of angles can be restricted by the `thetas` and `phis` arguments. - .. versionadded: 0.13.1 + .. versionadded:: 0.13.1 Parameters ---------- diff --git a/openmc/stats/univariate.py b/openmc/stats/univariate.py index d6b8a75735..5298499ce4 100644 --- a/openmc/stats/univariate.py +++ b/openmc/stats/univariate.py @@ -1059,7 +1059,7 @@ class Tabular(Univariate): def integral(self): """Return integral of distribution - .. versionadded: 0.13.1 + .. versionadded:: 0.13.1 Returns ------- diff --git a/openmc/tracks.py b/openmc/tracks.py index 671aa65cfc..15bd297274 100644 --- a/openmc/tracks.py +++ b/openmc/tracks.py @@ -47,6 +47,8 @@ class Track(Sequence): primary/secondary particle is stored in the :attr:`particle_tracks` attribute. + .. versionadded:: 0.13.1 + Parameters ---------- dset : h5py.Dataset @@ -201,6 +203,8 @@ class Tracks(list): This class behaves like a list and can be indexed using the normal subscript notation. Each element in the list is a :class:`openmc.Track` object. + .. versionadded:: 0.13.1 + Parameters ---------- filepath : str or pathlib.Path @@ -286,7 +290,7 @@ class Tracks(list): # Initialize data arrays and offset. points = vtk.vtkPoints() cells = vtk.vtkCellArray() - + point_offset = 0 for particle in self: for pt in particle.particle_tracks: From 282c8115dfd436e51e2ee5704917156d5b61ce43 Mon Sep 17 00:00:00 2001 From: Paul Romano Date: Tue, 16 Aug 2022 16:38:21 -0500 Subject: [PATCH 06/10] Fix error in equation in depletion user docs --- docs/source/usersguide/depletion.rst | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/docs/source/usersguide/depletion.rst b/docs/source/usersguide/depletion.rst index 229e90a4cf..e8dc21bca7 100644 --- a/docs/source/usersguide/depletion.rst +++ b/docs/source/usersguide/depletion.rst @@ -14,7 +14,7 @@ are requested. The depletion module is designed such that the reaction rate solution (the transport "operator") is completely isolated from the solution of the -transmutation equations and the method used for advancing time. +transmutation equations and the method used for advancing time. :mod:`openmc.deplete` supports multiple time-integration methods for determining material compositions over time. Each method appears as a different class. @@ -40,7 +40,7 @@ time:: Note that the coupling between the reaction rate solver and the transmutation solver happens in-memory rather than by reading/writing files on disk. OpenMC has two categories of transport operators for obtaining transmutation reaction -rates. +rates. .. _coupled-depletion: @@ -65,7 +65,7 @@ Any material that contains a fissionable nuclide is depleted by default, but this can behavior can be changed with the :attr:`Material.depletable` attribute. .. important:: - + The volume must be specified for each material that is depleted by setting the :attr:`Material.volume` attribute. This is necessary in order to calculate the proper normalization of tally results based on the source rate. @@ -198,8 +198,8 @@ Transport-independent depletion =============================== .. warning:: - - This feature is still under heavy development and has yet to be rigorously + + This feature is still under heavy development and has yet to be rigorously verified. API changes and feature additions are possible and likely in the near future. @@ -237,7 +237,7 @@ object:: 'U236': 4.57e18, 'O16': 4.64e22, 'O17': 1.76e19} - volume = 0.5 + volume = 0.5 op = openmc.deplete.IndependentOperator.from_nuclides(volume, nuclides, micro_xs, @@ -250,8 +250,8 @@ transport-depletion calculation and follow the same steps from there. .. note:: Ideally, one-group cross section data should be available for every - reaction in the depletion chain. If a nuclide that has a reaction - associated with it in the depletion chain is present in the `nuclides` + reaction in the depletion chain. If a nuclide that has a reaction + associated with it in the depletion chain is present in the `nuclides` parameter but not the cross section data, that reaction will not be simulated. @@ -289,7 +289,7 @@ or from data arrays:: .. important:: Both :meth:`~openmc.deplete.MicroXS.from_csv()` and - :meth:`~openmc.deplete.MicroXS.from_array()` assume the cross section values + :meth:`~openmc.deplete.MicroXS.from_array()` assume the cross section values provided are in barns by defualt, but have no way of verifying this. Make sure your cross sections are in the correct units before passing to a :class:`~openmc.deplete.IndependentOperator` object. @@ -315,11 +315,11 @@ normalizing reaction rates: the cross-sections by the ``source-rate``. 2. ``fission-q`` normalization, which uses the ``power`` or ``power_density`` provided by the time integrator to obtain reaction rates by computing a value - for the flux based on this power. The general equation for the flux is + for the flux based on this power. The general equation for the flux is .. math:: - \phi = \frac{P}{V \cdot \sum_i (Q_i \cdot \sigma^f_i \cdot \n_i)} + \phi = \frac{P}{V \cdot \sum\limits_i (Q_i \cdot \sigma^f_i \cdot n_i)} where :math:`\sum_i` is the sum over all nuclides :math:`i`. This equation makes the same assumptions and issues as discussed in @@ -328,13 +328,13 @@ normalizing reaction rates: However, there is a method to converge to a more accurate value for flux by using substeps during time integration. `This paper `_ provides a - good discussion of this method. + good discussion of this method. .. warning:: The accuracy of results when using ``fission-q`` is entirely dependent on your depletion chain. Make sure it has sufficient data to resolve the - dynamics of your particular scenario. + dynamics of your particular scenario. Multiple Materials ~~~~~~~~~~~~~~~~~~ From bee89f2c1ac10f728af0fec1e26093b0baf8c4a4 Mon Sep 17 00:00:00 2001 From: yardasol Date: Tue, 16 Aug 2022 18:10:05 -0500 Subject: [PATCH 07/10] cleanup rxn rate calculation in _IndependentRateHelper --- openmc/deplete/independent_operator.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/openmc/deplete/independent_operator.py b/openmc/deplete/independent_operator.py index 20267f9489..200bc195e7 100644 --- a/openmc/deplete/independent_operator.py +++ b/openmc/deplete/independent_operator.py @@ -272,15 +272,15 @@ class IndependentOperator(OpenMCOperator): This class does not generate tallies, and instead stores cross sections for each nuclide and transmutation reaction relevant for a depletion - calculation. The reaction rate is calculated by multiplying the flux by the - cross sections. + calculation. The reaction rate is calculated by multiplying the flux by + the cross sections. Parameters ---------- op : openmc.deplete.IndependentOperator Reference to the object encapsulate _IndependentRateHelper. - We pass this so we don't have to duplicate the :attr:`IndependentOperator.number` object. - + We pass this so we don't have to duplicate the + :attr:`IndependentOperator.number` object. Attributes ---------- @@ -317,15 +317,14 @@ class IndependentOperator(OpenMCOperator): """ self._results_cache.fill(0.0) - volume = self._op.number.get_mat_volume(mat_id) for i_nuc, i_react in product(nuc_index, react_index): nuc = self.nuc_ind_map[i_nuc] rxn = self.rxn_ind_map[i_react] - density = self._op.number.get_atom_density(mat_id, nuc) - # Sigma^j_i * V = sigma^j_i * rho * V + # Sigma^j_i * V = sigma^j_i * n_i * V = sigma^j_i * N_i self._results_cache[i_nuc,i_react] = \ - self._op.cross_sections[rxn][nuc] * density * volume + self._op.cross_sections[rxn][nuc] * \ + self._op.number[mat_id, nuc] return self._results_cache From aec246be729c1e91f73b081fcbdfc0a2230c17cb Mon Sep 17 00:00:00 2001 From: Paul Romano Date: Tue, 16 Aug 2022 22:09:58 -0500 Subject: [PATCH 08/10] Rename Tracks.write_tracks_to_vtk --> Tracks.write_to_vtk --- docs/source/releasenotes/0.13.1.rst | 3 ++- openmc/tracks.py | 2 +- scripts/openmc-track-to-vtk | 2 +- tests/unit_tests/test_tracks.py | 4 ++-- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/docs/source/releasenotes/0.13.1.rst b/docs/source/releasenotes/0.13.1.rst index 4df31e4569..70c8609ac3 100644 --- a/docs/source/releasenotes/0.13.1.rst +++ b/docs/source/releasenotes/0.13.1.rst @@ -101,7 +101,8 @@ New Features a corresponding Python binding :func:`openmc.lib.sample_external_source`. - The track file generation capability has been completely overhauled. Track files now include much more information, and a new :class:`~openmc.Tracks` - class allows access to track file information from the Python API. Multiple + class allows access to track file information from the Python API and has a + :meth:`~openmc.Tracks.write_to_vtk` method for writing a VTK file. Multiple tracks are now written to a single file (one per MPI rank). - A new :func:`openmc.wwinp_to_wws` function that converts weight windows from a ``wwinp`` file to a list of :class:`~openmc.WeightWindows` objects. diff --git a/openmc/tracks.py b/openmc/tracks.py index 15bd297274..9b4b55247d 100644 --- a/openmc/tracks.py +++ b/openmc/tracks.py @@ -271,7 +271,7 @@ class Tracks(list): track.plot(ax) return ax - def write_tracks_to_vtk(self, filename=Path('tracks.vtp')): + def write_to_vtk(self, filename=Path('tracks.vtp')): """Creates a VTP file of the tracks Parameters diff --git a/scripts/openmc-track-to-vtk b/scripts/openmc-track-to-vtk index 118e658274..82439bea73 100755 --- a/scripts/openmc-track-to-vtk +++ b/scripts/openmc-track-to-vtk @@ -35,7 +35,7 @@ def main(): # Write coordinate values to points array. track_file = openmc.Tracks(args.input) - track_file.write_tracks_to_vtk(args.out) + track_file.write_to_vtk(args.out) if __name__ == '__main__': main() diff --git a/tests/unit_tests/test_tracks.py b/tests/unit_tests/test_tracks.py index 5f3940fadd..be75c6f881 100644 --- a/tests/unit_tests/test_tracks.py +++ b/tests/unit_tests/test_tracks.py @@ -143,7 +143,7 @@ def test_filter(sphere_model, run_in_tmpdir): assert matches == [] -def test_write_tracks_to_vtk(sphere_model): +def test_write_to_vtk(sphere_model): vtk = pytest.importorskip('vtk') # Set maximum number of tracks per process to write sphere_model.settings.max_tracks = 25 @@ -153,7 +153,7 @@ def test_write_tracks_to_vtk(sphere_model): generate_track_file(sphere_model, tracks=True) tracks = openmc.Tracks('tracks.h5') - polydata = tracks.write_tracks_to_vtk('tracks.vtp') + polydata = tracks.write_to_vtk('tracks.vtp') assert isinstance(polydata, vtk.vtkPolyData) assert Path('tracks.vtp').is_file() From 6e1e18ab36fbaaec882d6f62010d3fbd98e81347 Mon Sep 17 00:00:00 2001 From: Paul Romano Date: Tue, 16 Aug 2022 22:18:55 -0500 Subject: [PATCH 09/10] Define terms in flux equation for depletion docs --- docs/source/usersguide/depletion.rst | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/docs/source/usersguide/depletion.rst b/docs/source/usersguide/depletion.rst index e8dc21bca7..2d03e167b0 100644 --- a/docs/source/usersguide/depletion.rst +++ b/docs/source/usersguide/depletion.rst @@ -319,16 +319,18 @@ normalizing reaction rates: .. math:: - \phi = \frac{P}{V \cdot \sum\limits_i (Q_i \cdot \sigma^f_i \cdot n_i)} + \phi = \frac{P}{\sum\limits_i (Q_i \sigma^f_i n_i)} - where :math:`\sum_i` is the sum over all nuclides :math:`i`. This equation - makes the same assumptions and issues as discussed in - :ref:`energy-deposition`. Unfortunately, the proposed solution in that + where :math:`P` is the power, :math:`Q_i` is the fission Q value for nuclide + :math:`i`, :math:`\sigma_i^f` is the microscopic fission cross section for + nuclide :math:`i`, and :math:`N_i` is the number of atoms of nuclide + :math:`i`. This equation makes the same assumptions and issues as discussed + in :ref:`energy-deposition`. Unfortunately, the proposed solution in that section does not apply here since we are decoupled from transport code. However, there is a method to converge to a more accurate value for flux by - using substeps during time integration. - `This paper `_ provides a - good discussion of this method. + using substeps during time integration. `This paper + `_ provides a good discussion + of this method. .. warning:: From 2a7a6b171ed59dd8c6d2ed599be4151549c50015 Mon Sep 17 00:00:00 2001 From: Paul Romano Date: Wed, 17 Aug 2022 09:26:46 -0500 Subject: [PATCH 10/10] Fix flux equation per @yardasol suggestion Co-authored-by: Olek <45364492+yardasol@users.noreply.github.com> --- docs/source/usersguide/depletion.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/source/usersguide/depletion.rst b/docs/source/usersguide/depletion.rst index 2d03e167b0..be94061822 100644 --- a/docs/source/usersguide/depletion.rst +++ b/docs/source/usersguide/depletion.rst @@ -319,7 +319,7 @@ normalizing reaction rates: .. math:: - \phi = \frac{P}{\sum\limits_i (Q_i \sigma^f_i n_i)} + \phi = \frac{P}{\sum\limits_i (Q_i \sigma^f_i N_i)} where :math:`P` is the power, :math:`Q_i` is the fission Q value for nuclide :math:`i`, :math:`\sigma_i^f` is the microscopic fission cross section for