From 8f95199fa1f1784a8b278b622843c13368c95b9b Mon Sep 17 00:00:00 2001 From: Paul Romano Date: Sun, 24 Dec 2017 17:43:14 +0700 Subject: [PATCH 1/7] Update release notes, release version, fix doc build bug --- docs/source/conf.py | 6 +- docs/source/pythonapi/capi.rst | 56 ++++++------ docs/source/releasenotes.rst | 151 +++++++++++---------------------- openmc/__init__.py | 2 +- src/constants.F90 | 2 +- src/output.F90 | 2 +- 6 files changed, 84 insertions(+), 135 deletions(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index ae8bfe6b5..834c47a40 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -27,7 +27,7 @@ except ImportError: MOCK_MODULES = ['numpy', 'numpy.polynomial', 'numpy.polynomial.polynomial', 'numpy.ctypeslib', 'scipy', 'scipy.sparse', 'scipy.interpolate', 'scipy.integrate', 'scipy.optimize', 'scipy.special', - 'scipy.stats', 'h5py', 'pandas', 'uncertainties', + 'scipy.stats', 'h5py', 'pandas', 'uncertainties', 'matplotlib', 'matplotlib.pyplot','openmoc', 'openmc.data.reconstruct'] sys.modules.update((mod_name, MagicMock()) for mod_name in MOCK_MODULES) @@ -76,9 +76,9 @@ copyright = u'2011-2017, Massachusetts Institute of Technology' # built documents. # # The short X.Y version. -version = "0.9" +version = "0.10" # The full version, including alpha/beta/rc tags. -release = "0.9.0" +release = "0.10.0" # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/docs/source/pythonapi/capi.rst b/docs/source/pythonapi/capi.rst index 3c6300bb6..f35823399 100644 --- a/docs/source/pythonapi/capi.rst +++ b/docs/source/pythonapi/capi.rst @@ -1,6 +1,6 @@ ---------------------------------------------------- -:data:`openmc.capi` -- Python bindings to the C API ---------------------------------------------------- +-------------------------------------------------- +:mod:`openmc.capi` -- Python bindings to the C API +-------------------------------------------------- .. automodule:: openmc.capi @@ -12,25 +12,25 @@ Functions :nosignatures: :template: myfunction.rst - openmc.capi.calculate_volumes - openmc.capi.finalize - openmc.capi.find_cell - openmc.capi.find_material - openmc.capi.hard_reset - openmc.capi.init - openmc.capi.iter_batches - openmc.capi.keff - openmc.capi.load_nuclide - openmc.capi.next_batch - openmc.capi.num_realizations - openmc.capi.plot_geometry - openmc.capi.reset - openmc.capi.run - openmc.capi.run_in_memory - openmc.capi.simulation_init - openmc.capi.simulation_finalize - openmc.capi.source_bank - openmc.capi.statepoint_write + calculate_volumes + finalize + find_cell + find_material + hard_reset + init + iter_batches + keff + load_nuclide + next_batch + num_realizations + plot_geometry + reset + run + run_in_memory + simulation_init + simulation_finalize + source_bank + statepoint_write Classes ------- @@ -40,9 +40,9 @@ Classes :nosignatures: :template: myclass.rst - openmc.capi.Cell - openmc.capi.EnergyFilter - openmc.capi.MaterialFilter - openmc.capi.Material - openmc.capi.Nuclide - openmc.capi.Tally + Cell + EnergyFilter + MaterialFilter + Material + Nuclide + Tally diff --git a/docs/source/releasenotes.rst b/docs/source/releasenotes.rst index d647f1ff3..4cacd4a7f 100644 --- a/docs/source/releasenotes.rst +++ b/docs/source/releasenotes.rst @@ -1,59 +1,38 @@ .. _releasenotes: -============================== -Release Notes for OpenMC 0.9.0 -============================== +=============================== +Release Notes for OpenMC 0.10.0 +=============================== .. currentmodule:: openmc -This release of OpenMC is the first release to use a new native HDF5 cross -section format rather than ACE format cross sections. Other significant new -features include a nuclear data interface in the Python API (:mod:`openmc.data`) -a stochastic volume calculation capability, a random sphere packing algorithm -that can handle packing fractions up to 60%, and a new XML parser with -significantly better performance than the parser used previously. - -.. caution:: With the new cross section format, the default energy units are now - **electronvolts (eV)** rather than megaelectronvolts (MeV)! If you - are specifying an energy filter for a tally, make sure you use - units of eV now. +This release of OpenMC includes several new features, performance improvements, +and bug fixes compared to version 0.9.0. Notably, a C API has been added that +enables in-memory coupling of neutronics to other physics fields, e.g., burnup +calculations and thermal-hydraulics. The C API is also backed by Python bindings +in a new :mod:`openmc.capi` package. Users should be forewarned that the C API +is still in an experimental state and the interface is likely to undergo changes +in future versions. The Python API continues to improve over time; several backwards incompatible changes were made in the API which users of previous versions should take note of: -- Each type of tally filter is now specified with a separate class. For example:: +- To indicate that nuclides in a material should be treated such that elastic + scattering is isotropic in the laboratory system, there is a new + :attr:`Material.isotropic` property:: - energy_filter = openmc.EnergyFilter([0.0, 0.625, 4.0, 1.0e6, 20.0e6]) + mat = openmc.Material() + mat.add_nuclide('H1', 1.0) + mat.isotropic = ['H1'] -- Several attributes of the :class:`Plot` class have changed (``color`` -> - ``color_by`` and ``col_spec`` > ``colors``). :attr:`Plot.colors` now accepts a - dictionary mapping :class:`Cell` or :class:`Material` instances to RGB - 3-tuples or string colors names, e.g.:: +- The initializers for :class:`openmc.Intersection` and :class:`openmc.Union` + now expect an iterable. - plot.colors = { - fuel: 'yellow', - water: 'blue' - } +- Auto-generated unique IDs for classes now start from 1 rather than 10000. -- ``make_hexagon_region`` is now :func:`get_hexagonal_prism` -- Several changes in :class:`Settings` attributes: - - - ``weight`` is now set as ``Settings.cutoff['weight']`` - - Shannon entropy is now specified by passing a :class:`openmc.Mesh` to - :attr:`Settings.entropy_mesh` - - Uniform fission site method is now specified by passing a - :class:`openmc.Mesh` to :attr:`Settings.ufs_mesh` - - All ``sourcepoint_*`` options are now specified in a - :attr:`Settings.sourcepoint` dictionary - - Resonance scattering method is now specified as a dictionary in - :attr:`Settings.resonance_scattering` - - Multipole is now turned on by setting ``Settings.temperature['multipole'] = - True`` - - The ``output_path`` attribute is now ``Settings.output['path']`` - -- All the ``openmc.mgxs.Nu*`` classes are gone. Instead, a ``nu`` argument was - added to the constructor of the corresponding classes. +.. attention:: This is the last release of OpenMC that will support Python + 2.7. Future releases of OpenMC will require Python 3.4 or later. ------------------- System Requirements @@ -69,69 +48,34 @@ problem at hand (mostly on the number of nuclides and tallies in the problem). New Features ------------ -- Stochastic volume calculations -- Multi-delayed group cross section generation -- Ability to calculate multi-group cross sections over meshes -- Temperature interpolation on cross section data -- Nuclear data interface in Python API, :mod:`openmc.data` -- Allow cutoff energy via :attr:`Settings.cutoff` -- Ability to define fuel by enrichment (see :meth:`Material.add_element`) -- Random sphere packing for TRISO particle generation, - :func:`openmc.model.pack_trisos` -- Critical eigenvalue search, :func:`openmc.search_for_keff` -- Model container, :class:`openmc.model.Model` -- In-line plotting in Jupyter, :func:`openmc.plot_inline` -- Energy function tally filters, :class:`openmc.EnergyFunctionFilter` -- Replaced FoX XML parser with `pugixml `_ -- Cell/material instance counting, :meth:`Geometry.determine_paths` -- Differential tallies (see :class:`openmc.TallyDerivative`) -- Consistent multi-group scattering matrices -- Improved documentation and new Jupyter notebooks -- OpenMOC compatibility module, :mod:`openmc.openmoc_compatible` +- Rotationally-periodic boundary conditions +- C API (with Python bindings) for in-memory coupling +- Improved correlation for Uranium enrichment +- Support for partial S(a,b) tables +- Improved handling of autogenerated IDs +- Many performance/memory improvements --------- Bug Fixes --------- -- c5df6c_: Fix mesh filter max iterator check -- 1cfa39_: Reject external source only if 95% of sites are rejected -- 335359_: Fix bug in plotting meshlines -- 17c678_: Make sure system_clock uses high-resolution timer -- 23ec0b_: Fix use of S(a,b) with multipole data -- 7eefb7_: Fix several bugs in tally module -- 7880d4_: Allow plotting calculation with no boundary conditions -- ad2d9f_: Fix filter weight missing when scoring all nuclides -- 59fdca_: Fix use of source files for fixed source calculations -- 9eff5b_: Fix thermal scattering bugs -- 7848a9_: Fix combined k-eff estimator producing NaN -- f139ce_: Fix printing bug for tallies with AggregateNuclide -- b8ddfa_: Bugfix for short tracks near tally mesh edges -- ec3cfb_: Fix inconsistency in filter weights -- 5e9b06_: Fix XML representation for verbosity -- c39990_: Fix bug tallying reaction rates with multipole on -- c6b67e_: Fix fissionable source sampling bug -- 489540_: Check for void materials in tracklength tallies -- f0214f_: Fixes/improvements to the ARES algorithm +- 937469_: Fix energy group sampling for multi-group simulations +- a149ef_: Ensure mutable objects are not hashable +- 2c9b21_: Preserve backwards compatibility for generated HDF5 libraries +- 8047f6_: Handle units of division for tally arithmetic correctly +- 0beb4c_: Compatibility with newer versions of Pandas +- f124be_: Fix generating 0K data with openmc.data.njoy module +- 0c6915_: Bugfix for generating thermal scattering data +- 61ecb4_: Fix bugs in Python multipole objects -.. _c5df6c: https://github.com/mit-crpg/openmc/commit/c5df6c -.. _1cfa39: https://github.com/mit-crpg/openmc/commit/1cfa39 -.. _335359: https://github.com/mit-crpg/openmc/commit/335359 -.. _17c678: https://github.com/mit-crpg/openmc/commit/17c678 -.. _23ec0b: https://github.com/mit-crpg/openmc/commit/23ec0b -.. _7eefb7: https://github.com/mit-crpg/openmc/commit/7eefb7 -.. _7880d4: https://github.com/mit-crpg/openmc/commit/7880d4 -.. _ad2d9f: https://github.com/mit-crpg/openmc/commit/ad2d9f -.. _59fdca: https://github.com/mit-crpg/openmc/commit/59fdca -.. _9eff5b: https://github.com/mit-crpg/openmc/commit/9eff5b -.. _7848a9: https://github.com/mit-crpg/openmc/commit/7848a9 -.. _f139ce: https://github.com/mit-crpg/openmc/commit/f139ce -.. _b8ddfa: https://github.com/mit-crpg/openmc/commit/b8ddfa -.. _ec3cfb: https://github.com/mit-crpg/openmc/commit/ec3cfb -.. _5e9b06: https://github.com/mit-crpg/openmc/commit/5e9b06 -.. _c39990: https://github.com/mit-crpg/openmc/commit/c39990 -.. _c6b67e: https://github.com/mit-crpg/openmc/commit/c6b67e -.. _489540: https://github.com/mit-crpg/openmc/commit/489540 -.. _f0214f: https://github.com/mit-crpg/openmc/commit/f0214f +.. _937469: https://github.com/mit-crpg/openmc/commit/937469 +.. _a149ef: https://github.com/mit-crpg/openmc/commit/a149ef +.. _2c9b21: https://github.com/mit-crpg/openmc/commit/2c9b21 +.. _8047f6: https://github.com/mit-crpg/openmc/commit/8047f6 +.. _0beb4c: https://github.com/mit-crpg/openmc/commit/0beb4c +.. _f124be: https://github.com/mit-crpg/openmc/commit/f124be +.. _0c6915: https://github.com/mit-crpg/openmc/commit/0c6915 +.. _61ecb4: https://github.com/mit-crpg/openmc/commit/61ecb4 ------------ Contributors @@ -139,14 +83,19 @@ Contributors This release contains new contributions from the following people: +- `Brody Bassett `_ - `Will Boyd `_ +- `Guillaume Giudicelli `_ +- `Brittany Grayson `_ - `Sterling Harper `_ -- `Qingming He <906459647@qq.com>`_ - `Colin Josey `_ - `Travis Labossiere-Hickman `_ - `Jingang Liang `_ +- `Alex Lindsay `_ +- `Johnny Liu `_ - `Amanda Lund `_ +- `April Novak `_ - `Adam Nelson `_ +- `Jose Salcedo Perez `_ - `Paul Romano `_ - `Sam Shaner `_ -- `Jon Walsh `_ diff --git a/openmc/__init__.py b/openmc/__init__.py index 13dac05e7..9b13fa692 100644 --- a/openmc/__init__.py +++ b/openmc/__init__.py @@ -32,4 +32,4 @@ from . import examples # Import a few convencience functions that used to be here from openmc.model import get_rectangular_prism, get_hexagonal_prism -__version__ = '0.9.0' +__version__ = '0.10.0' diff --git a/src/constants.F90 b/src/constants.F90 index 3968781e9..331a644f0 100644 --- a/src/constants.F90 +++ b/src/constants.F90 @@ -9,7 +9,7 @@ module constants ! OpenMC major, minor, and release numbers integer, parameter :: VERSION_MAJOR = 0 - integer, parameter :: VERSION_MINOR = 9 + integer, parameter :: VERSION_MINOR = 10 integer, parameter :: VERSION_RELEASE = 0 integer, parameter :: & VERSION(3) = [VERSION_MAJOR, VERSION_MINOR, VERSION_RELEASE] diff --git a/src/output.F90 b/src/output.F90 index d09beda1b..f9660638a 100644 --- a/src/output.F90 +++ b/src/output.F90 @@ -79,7 +79,7 @@ contains ' Copyright | 2011-2017 Massachusetts Institute of Technology' write(UNIT=OUTPUT_UNIT, FMT=*) & ' License | http://openmc.readthedocs.io/en/latest/license.html' - write(UNIT=OUTPUT_UNIT, FMT='(11X,"Version | ",I1,".",I1,".",I1)') & + write(UNIT=OUTPUT_UNIT, FMT='(11X,"Version | ",I1,".",I2,".",I1)') & VERSION_MAJOR, VERSION_MINOR, VERSION_RELEASE #ifdef GIT_SHA1 write(UNIT=OUTPUT_UNIT, FMT='(10X,"Git SHA1 | ",A)') GIT_SHA1 From 98b2bcb275136d460aa10939b95ec0efbd4c2479 Mon Sep 17 00:00:00 2001 From: Paul Romano Date: Sun, 24 Dec 2017 22:04:27 +0700 Subject: [PATCH 2/7] Various fixes/updates in documentation --- docs/source/devguide/docbuild.rst | 3 +- docs/source/quickinstall.rst | 8 +-- docs/source/usersguide/cross_sections.rst | 7 +++ docs/source/usersguide/install.rst | 75 +++++++++-------------- docs/source/usersguide/settings.rst | 2 +- 5 files changed, 40 insertions(+), 55 deletions(-) diff --git a/docs/source/devguide/docbuild.rst b/docs/source/devguide/docbuild.rst index 079a69a2c..be4607cc6 100644 --- a/docs/source/devguide/docbuild.rst +++ b/docs/source/devguide/docbuild.rst @@ -40,7 +40,7 @@ on your computer as well as Inkscape_, which is used to convert .svg files to .. code-block:: sh - sudo apt-get install inkscape + sudo apt install inkscape One the pre-requisites are installed, simply go to the ``docs`` directory and run: @@ -50,6 +50,5 @@ run: make latexpdf .. _Sphinx: http://sphinx-doc.org -.. _sphinxcontrib-tikz: https://bitbucket.org/philexander/tikz .. _Numfig: https://pypi.python.org/pypi/sphinx_numfig .. _Inkscape: https://inkscape.org diff --git a/docs/source/quickinstall.rst b/docs/source/quickinstall.rst index 6bc09c044..97980037c 100644 --- a/docs/source/quickinstall.rst +++ b/docs/source/quickinstall.rst @@ -44,13 +44,13 @@ Next, resynchronize the package index files: .. code-block:: sh - sudo apt-get update + sudo apt update Now OpenMC should be recognized within the repository and can be installed: .. code-block:: sh - sudo apt-get install openmc + sudo apt install openmc Binary packages from this PPA may exist for earlier versions of Ubuntu, but they are no longer supported. @@ -69,9 +69,7 @@ installed directly from the package manager. .. code-block:: sh - sudo apt-get install gfortran - sudo apt-get install cmake - sudo apt-get install libhdf5-dev + sudo apt install gfortran g++ cmake libhdf5-dev After the packages have been installed, follow the instructions below for building and installing OpenMC from source. diff --git a/docs/source/usersguide/cross_sections.rst b/docs/source/usersguide/cross_sections.rst index 48cccfb67..058daf23a 100644 --- a/docs/source/usersguide/cross_sections.rst +++ b/docs/source/usersguide/cross_sections.rst @@ -222,6 +222,13 @@ named ``njoy`` available on your path. If you want to explicitly name the executable, the ``njoy_exec`` optional argument can be used. Additionally, the ``stdout`` argument can be used to show the progress of the NJOY run. +To generate a thermal scattering file, you need to specify both an ENDF incident +neutron sub-library file as well as a thermal neutron scattering sub-library +file; for example:: + + light_water = openmc.data.ThermalScattering.from_njoy( + 'neutrons/n-001_H_001.endf', 'thermal_scatt/tsl-HinH2O.endf') + Once you have instances of :class:`IncidentNeutron` and :class:`ThermalScattering`, a library can be created by using the ``export_to_hdf5()`` methods and the :class:`DataLibrary` class as described in diff --git a/docs/source/usersguide/install.rst b/docs/source/usersguide/install.rst index 09fc4520c..1fee22e71 100644 --- a/docs/source/usersguide/install.rst +++ b/docs/source/usersguide/install.rst @@ -95,10 +95,10 @@ Prerequisites * A C/C++ compiler such as gcc_ - OpenMC includes two libraries written in C and C++, respectively. These - libraries have been tested to work with a wide variety of compilers. If - you are using a Debian-based distribution, you can install the g++ - compiler using the following command:: + OpenMC includes various source files written in C and C++, + respectively. These source files have been tested to work with a wide + variety of compilers. If you are using a Debian-based distribution, you + can install the g++ compiler using the following command:: sudo apt install g++ @@ -113,34 +113,32 @@ Prerequisites * HDF5_ Library for portable binary output format - OpenMC uses HDF5 for binary output files. As such, you will need to have - HDF5 installed on your computer. The installed version will need to have - been compiled with the same compiler you intend to compile OpenMC with. If - you are using HDF5 in conjunction with MPI, we recommend that your HDF5 - installation be built with parallel I/O features. An example of - configuring HDF5_ is listed below:: + OpenMC uses HDF5 for many input/output files. As such, you will need to + have HDF5 installed on your computer. The installed version will need to + have been compiled with the same compiler you intend to compile OpenMC + with. On Debian derivatives, HDF5 and/or parallel HDF5 can be installed + through the APT package manager: - FC=/opt/mpich/3.1/bin/mpif90 CC=/opt/mpich/3.1/bin/mpicc \ - ./configure --prefix=/opt/hdf5/1.8.12 --enable-fortran \ - --enable-fortran2003 --enable-parallel + .. code-block:: sh + + sudo apt install libhdf5-dev + + Note that the exact package names may vary depending on your particular + distribution and version. If you are using HDF5 in conjunction with MPI, + we recommend that your HDF5 installation be built with parallel I/O + features. An example of configuring HDF5_ is listed below:: + + FC=/opt/mpich/3.2/bin/mpif90 CC=/opt/mpich/3.2/bin/mpicc \ + ./configure --prefix=/opt/hdf5/1.10.1 --enable-fortran \ + --enable-parallel You may omit ``--enable-parallel`` if you want to compile HDF5_ in serial. .. important:: - OpenMC uses various parts of the HDF5 Fortran 2003 API; as such you - must include ``--enable-fortran2003`` or else OpenMC will not be able - to compile. - - On Debian derivatives, HDF5 and/or parallel HDF5 can be installed through - the APT package manager: - - .. code-block:: sh - - sudo apt install libhdf5-dev hdf5-helpers - - Note that the exact package names may vary depending on your particular - distribution and version. + If you are building HDF5 version 1.8.x or earlier, you must include + ``--enable-fortran2003`` when configuring HDF5 or else OpenMC will not + be able to compile. .. admonition:: Optional :class: note @@ -163,7 +161,7 @@ Prerequisites .. _CMake: http://www.cmake.org .. _OpenMPI: http://www.open-mpi.org .. _MPICH: http://www.mpich.org -.. _HDF5: http://www.hdfgroup.org/HDF5/ +.. _HDF5: https://www.hdfgroup.org/solutions/hdf5/ Obtaining the Source -------------------- @@ -358,26 +356,9 @@ workarounds. Testing Build ------------- -If you have ENDF/B-VII.1 cross sections from NNDC_ you can test your build. -Make sure the **OPENMC_CROSS_SECTIONS** environmental variable is set to the -*cross_sections.xml* file in the *data/nndc* directory. -There are two ways to run tests. The first is to use the Makefile present in -the source directory and run the following: - -.. code-block:: sh - - make test - -If you want more options for testing you can use ctest_ command. For example, -if we wanted to run only the plot tests with 4 processors, we run: - -.. code-block:: sh - - cd build - ctest -j 4 -R plot - -If you want to run the full test suite with different build options please -refer to our :ref:`test suite` documentation. +To run the test suite, you will first need to download a pre-generated cross +section library along with windowed multipole data. Please refer to our +:ref:`test suite` documentation for further details. -------------------- Python Prerequisites diff --git a/docs/source/usersguide/settings.rst b/docs/source/usersguide/settings.rst index 6e49777f0..978649a2f 100644 --- a/docs/source/usersguide/settings.rst +++ b/docs/source/usersguide/settings.rst @@ -39,7 +39,7 @@ be specified: 'plot' Generates slice or voxel plots (see :ref:`usersguide_plots`). -'particle_restart' +'particle restart' Simulate a single source particle using a particle restart file. From 6b48fe9f6ba61acbed6966b5a3aa57117e347222 Mon Sep 17 00:00:00 2001 From: Paul Romano Date: Fri, 29 Dec 2017 15:10:55 -0600 Subject: [PATCH 3/7] Use sphinx.ext.imgconverter for converting SVG images for PDF doc builds --- docs/Makefile | 12 ------------ docs/source/conf.py | 3 ++- docs/source/devguide/docbuild.rst | 24 +++++++----------------- docs/source/methods/geometry.rst | 8 ++++---- 4 files changed, 13 insertions(+), 34 deletions(-) diff --git a/docs/Makefile b/docs/Makefile index 2f3c029db..a93338df3 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -13,10 +13,6 @@ PAPEROPT_a4 = -D latex_paper_size=a4 PAPEROPT_letter = -D latex_paper_size=letter ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source -# SVG to PDF conversion -SVG2PDF = inkscape -PDFS = $(patsubst %.svg,%.pdf,$(wildcard $(IMAGEDIR)/*.svg)) - # Tikz to PNG conversion PNGS = $(patsubst %.tex,%.png,$(wildcard $(IMAGEDIR)/*.tex)) @@ -41,21 +37,13 @@ help: @echo " linkcheck to check all external links for integrity" @echo " doctest to run all doctests embedded in the documentation (if enabled)" -# Pattern rule for converting SVG to PDF -%.pdf: %.svg - $(SVG2PDF) -f $< -A $@ - %.png: %.tex pdflatex --interaction=nonstopmode --output-directory=$(IMAGEDIR) $< pdftoppm -r 120 -singlefile $(patsubst %.tex,%.pdf, $<) $(basename $<) convert -trim -fuzz 2% -transparent white $(patsubst %.tex,%.ppm,$<) $@ -# Rule to build PDFs -images: $(PDFS) $(PNGS) - clean: -rm -rf $(BUILDDIR)/* - -rm -rf $(PDFS) -rm -rf source/pythonapi/generated/ html: diff --git a/docs/source/conf.py b/docs/source/conf.py index 834c47a40..928755cf8 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -52,6 +52,7 @@ extensions = ['sphinx.ext.autodoc', 'sphinx.ext.autosummary', 'sphinx.ext.intersphinx', 'sphinx.ext.viewcode', + 'sphinx.ext.imgconverter', 'sphinx_numfig', 'notebook_sphinxext'] @@ -253,5 +254,5 @@ intersphinx_mapping = { 'python': ('https://docs.python.org/3', None), 'numpy': ('https://docs.scipy.org/doc/numpy/', None), 'pandas': ('http://pandas.pydata.org/pandas-docs/stable/', None), - 'matplotlib': ('http://matplotlib.org/', None) + 'matplotlib': ('https://matplotlib.org/', None) } diff --git a/docs/source/devguide/docbuild.rst b/docs/source/devguide/docbuild.rst index be4607cc6..5cbbb65bb 100644 --- a/docs/source/devguide/docbuild.rst +++ b/docs/source/devguide/docbuild.rst @@ -5,15 +5,16 @@ Building Sphinx Documentation ============================= In order to build the documentation in the ``docs`` directory, you will need to -have the Sphinx_ third-party Python package. The easiest way to install Sphinx -is via pip: +have the `Sphinx `_ third-party Python +package. The easiest way to install Sphinx is via pip: .. code-block:: sh sudo pip install sphinx Additionally, you will also need a Sphinx extension for numbering figures. The -Numfig_ package can be installed directly with pip: +`Numfig `_ package can be installed +directly with pip: .. code-block:: sh @@ -24,7 +25,7 @@ Building Documentation as a Webpage ----------------------------------- To build the documentation as a webpage (what appears at -http://mit-crpg.github.io/openmc), simply go to the ``docs`` directory and run: +http://openmc.readthedocs.io), simply go to the ``docs`` directory and run: .. code-block:: sh @@ -35,20 +36,9 @@ Building Documentation as a PDF ------------------------------- To build PDF documentation, you will need to have a LaTeX distribution installed -on your computer as well as Inkscape_, which is used to convert .svg files to -.pdf files. Inkscape can be installed in a Debian-derivative with: - -.. code-block:: sh - - sudo apt install inkscape - -One the pre-requisites are installed, simply go to the ``docs`` directory and -run: +on your computer. Once you have a LaTeX distribution installed, simply go to the +``docs`` directory and run: .. code-block:: sh make latexpdf - -.. _Sphinx: http://sphinx-doc.org -.. _Numfig: https://pypi.python.org/pypi/sphinx_numfig -.. _Inkscape: https://inkscape.org diff --git a/docs/source/methods/geometry.rst b/docs/source/methods/geometry.rst index 36c252bb1..4e90dd992 100644 --- a/docs/source/methods/geometry.rst +++ b/docs/source/methods/geometry.rst @@ -47,7 +47,7 @@ dividing space into two half-spaces. .. _fig-halfspace: -.. figure:: ../_images/halfspace.* +.. figure:: ../_images/halfspace.svg :align: center :figclass: align-center @@ -63,7 +63,7 @@ defined as the intersection of an ellipse and two planes. .. _fig-union: -.. figure:: ../_images/union.* +.. figure:: ../_images/union.svg :align: center :figclass: align-center @@ -482,7 +482,7 @@ upper-right tiles, respectively. .. _fig-rect-lat: -.. figure:: ../_images/rect_lat.* +.. figure:: ../_images/rect_lat.svg :align: center :figclass: align-center :width: 400px @@ -521,7 +521,7 @@ right side. .. _fig-hex-lat: -.. figure:: ../_images/hex_lat.* +.. figure:: ../_images/hex_lat.svg :align: center :figclass: align-center :width: 400px From 7e19b82f9388b5beb8079fbb6a3f056a0e7f748a Mon Sep 17 00:00:00 2001 From: Paul Romano Date: Fri, 29 Dec 2017 17:20:02 -0600 Subject: [PATCH 4/7] Update C API documentation --- docs/source/capi/index.rst | 417 +++++++++++++++++++++++++---------- include/openmc.h | 104 +++++++++ openmc/capi/cell.py | 2 + src/api.F90 | 7 +- src/geometry_header.F90 | 2 +- src/simulation.F90 | 1 + src/tallies/tally_header.F90 | 1 + 7 files changed, 417 insertions(+), 117 deletions(-) create mode 100644 include/openmc.h diff --git a/docs/source/capi/index.rst b/docs/source/capi/index.rst index 581f358d4..ff19758bb 100644 --- a/docs/source/capi/index.rst +++ b/docs/source/capi/index.rst @@ -8,14 +8,43 @@ C API Run a stochastic volume calculation +.. c:function:: int openmc_cell_get_fill(int32_t index, int* type, int32_t** indices, int32_t* n) + + Get the fill for a cell + + :param int32_t index: Index in the cells array + :param int* type: Type of the fill + :param int32_t** indices: Array of material indices for cell + :param int32_t n: Length of indices array + :return: Return status (negative if an error occurred) + :rtype: int + .. c:function:: int openmc_cell_get_id(int32_t index, int32_t* id) Get the ID of a cell - :param index: Index in the cells array - :type index: int32_t - :param id: ID of the cell - :type id: int32_t* + :param int32_t index: Index in the cells array + :param int32_t* id: ID of the cell + :return: Return status (negative if an error occurred) + :rtype: int + +.. c:function:: int openmc_cell_set_fill(int32_t index, int type, int32_t n, int32_t* indices) + + Set the fill for a cell + + :param int32_t index: Index in the cells array + :param int type: Type of the fill + :param int32_t n: Length of indices array + :param int32_t* indices: Array of material indices for cell + :return: Return status (negative if an error occurred) + :rtype: int + +.. c:function:: int openmc_cell_set_id(int32_t index, int32_t id) + + Set the ID of a cell + + :param int32_t index: Index in the cells array + :param int32_t id: ID of the cell :return: Return status (negative if an error occurred) :rtype: int @@ -23,13 +52,88 @@ C API Set the temperature of a cell. - :param index: Index in the cells array - :type index: int32_t - :param T: Temperature in Kelvin - :type T: double - :param instance: Which instance of the cell. To set the temperature for all - instances, pass a null pointer. - :type instance: int32_t* + :param int32_t index: Index in the cells array + :param double T: Temperature in Kelvin + :param int32_t* instance: Which instance of the cell. To set the temperature + for all instances, pass a null pointer. + :return: Return status (negative if an error occurred) + :rtype: int + +.. c:function:: int openmc_energy_filter_get_bins(int32_t index, double** energies, int32_t* n) + + Return the bounding energies for an energy filter + + :param int32_t index: Index in the filters array + :param double** energies: Bounding energies of the bins for the energy filter + :param int32_t* n: Number of energies specified + :return: Return status (negative if an error occurred) + :rtype: int + +.. c:function:: int openmc_energy_filter_set_bins(int32_t index, int32_t n, double* energies) + + Set the bounding energies for an energy filter + + :param int32_t index: Index in the filters array + :param int32_t n: Number of energies specified + :param double* energies: Bounding energies of the bins for the energy filter + :return: Return status (negative if an error occurred) + :rtype: int + +.. c:function:: int openmc_extend_cells(int32_t n, int32_t* index_start, int32_t* index_end) + + Extend the cells array by n elements + + :param int32_t n: Number of cells to create + :param int32_t* index_start: Index of first new cell + :param int32_t* index_end: Index of last new cell + :return: Return status (negative if an error occurred) + :rtype: int + +.. c:function:: int openmc_extend_filters(int32_t n, int32_t* index_start, int32_t* index_end) + + Extend the filters array by n elements + + :param int32_t n: Number of filters to create + :param int32_t* index_start: Index of first new filter + :param int32_t* index_end: Index of last new filter + :return: Return status (negative if an error occurred) + :rtype: int + +.. c:function:: int openmc_extend_materials(int32_t n, int32_t* index_start, int32_t* index_end) + + Extend the materials array by n elements + + :param int32_t n: Number of materials to create + :param int32_t* index_start: Index of first new material + :param int32_t* index_end: Index of last new material + :return: Return status (negative if an error occurred) + :rtype: int + +.. c:function:: int openmc_extend_tallies(int32_t n, int32_t* index_start, int32_t* index_end) + + Extend the tallies array by n elements + + :param int32_t n: Number of tallies to create + :param int32_t* index_start: Index of first new tally + :param int32_t* index_end: Index of last new tally + :return: Return status (negative if an error occurred) + :rtype: int + +.. c:function:: int openmc_filter_get_id(int32_t index, int32_t* id) + + Get the ID of a filter + + :param int32_t index: Index in the filters array + :param int32_t* id: ID of the filter + :return: Return status (negative if an error occurred) + :rtype: int + +.. c:function:: int openmc_filter_set_id(int32_t index, int32_t id) + + Set the ID of a filter + + :param int32_t index: Index in the filters array + :param int32_t id: ID of the filter :return: Return status (negative if an error occurred) :rtype: int @@ -41,54 +145,41 @@ C API Determine the ID of the cell/material containing a given point - :param xyz: Cartesian coordinates - :type xyz: double[3] - :param rtype: Which ID to return (1=cell, 2=material) - :type rtype: int - :param id: ID of the cell/material found. If a material is requested and the - point is in a void, the ID is 0. If an error occurs, the ID is -1. - :type id: int32_t* - :param instance: If a cell is repetaed in the geometry, the instance of the - cell that was found and zero otherwise. - :type instance: int32_t* + :param double[3] xyz: Cartesian coordinates + :param int rtype: Which ID to return (1=cell, 2=material) + :param int32_t* id: ID of the cell/material found. If a material is requested + and the point is in a void, the ID is 0. If an error + occurs, the ID is -1. + :param int32_t* instance: If a cell is repetaed in the geometry, the instance + of the cell that was found and zero otherwise. .. c:function:: int openmc_get_cell_index(int32_t id, int32_t* index) Get the index in the cells array for a cell with a given ID - :param id: ID of the cell - :type id: int32_t - :param index: Index in the cells array - :type index: int32_t* + :param int32_t id: ID of the cell + :param int32_t* index: Index in the cells array :return: Return status (negative if an error occurs) :rtype: int +.. c:function:: int openmc_get_filter_index(int32_t id, int32_t* index) + + Get the index in the filters array for a filter with a given ID + + :param int32_t id: ID of the filter + :param int32_t* index: Index in the filters array + :return: Return status (negative if an error occurs) + :rtype: int + +.. c:function:: void openmc_get_filter_next_id(int32_t* id) + + Get an integer ID that has not been used by any filters. + + :param int32_t* id: Unused integer ID + .. c:function:: int openmc_get_keff(double k_combined[]) - :param k_combined: Combined estimate of k-effective - :type k_combined: double[2] - :return: Return status (negative if an error occurs) - :rtype: int - -.. c:function:: int openmc_get_nuclide_index(char name[], int* index) - - Get the index in the nuclides array for a nuclide with a given name - - :param name: Name of the nuclide - :type name: char[] - :param index: Index in the nuclides array - :type index: int* - :return: Return status (negative if an error occurs) - :rtype: int - -.. c:function:: int openmc_get_tally_index(int32_t id, int32_t* index) - - Get the index in the tallies array for a tally with a given ID - - :param id: ID of the tally - :type id: int32_t - :param index: Index in the tallies array - :type index: int32_t* + :param double[2] k_combined: Combined estimate of k-effective :return: Return status (negative if an error occurs) :rtype: int @@ -96,10 +187,26 @@ C API Get the index in the materials array for a material with a given ID - :param id: ID of the material - :type id: int32_t - :param index: Index in the materials array - :type index: int32_t* + :param int32_t id: ID of the material + :param int32_t* index: Index in the materials array + :return: Return status (negative if an error occurs) + :rtype: int + +.. c:function:: int openmc_get_nuclide_index(char name[], int* index) + + Get the index in the nuclides array for a nuclide with a given name + + :param char[] name: Name of the nuclide + :param int* index: Index in the nuclides array + :return: Return status (negative if an error occurs) + :rtype: int + +.. c:function:: int openmc_get_tally_index(int32_t id, int32_t* index) + + Get the index in the tallies array for a tally with a given ID + + :param int32_t id: ID of the tally + :param int32_t* index: Index in the tallies array :return: Return status (negative if an error occurs) :rtype: int @@ -111,15 +218,13 @@ C API Initialize OpenMC - :param intracomm: MPI intracommunicator - :type intracomm: int + :param int intracomm: MPI intracommunicator .. c:function:: int openmc_load_nuclide(char name[]) Load data for a nuclide from the HDF5 data library. - :param name: Name of the nuclide. - :type name: char[] + :param char[] name: Name of the nuclide. :return: Return status (negative if an error occurs) :rtype: int @@ -128,27 +233,20 @@ C API Add a nuclide to an existing material. If the nuclide already exists, the density is overwritten. - :param index: Index in the materials array - :type index: int32_t - :param name: Name of the nuclide - :type name: char[] - :param density: Density in atom/b-cm - :type density: double + :param int32_t index: Index in the materials array + :param char[] name: Name of the nuclide + :param double density: Density in atom/b-cm :return: Return status (negative if an error occurs) :rtype: int -.. c:function:: int openmc_material_get_densities(int32_t index, int* nuclides[], double* densities[]) +.. c:function:: int openmc_material_get_densities(int32_t index, int* nuclides[], double* densities[], int* n) Get density for each nuclide in a material. - :param index: Index in the materials array - :type index: int32_t - :param nuclides: Pointer to array of nuclide indices - :type nuclides: int** - :param densities: Pointer to the array of densities - :type densities: double** - :param n: Length of the array - :type n: int + :param int32_t index: Index in the materials array + :param int** nuclides: Pointer to array of nuclide indices + :param double** densities: Pointer to the array of densities + :param int* n: Length of the array :return: Return status (negative if an error occurs) :rtype: int @@ -156,10 +254,8 @@ C API Get the ID of a material - :param index: Index in the materials array - :type index: int32_t - :param id: ID of the material - :type id: int32_t* + :param int32_t index: Index in the materials array + :param int32_t* id: ID of the material :return: Return status (negative if an error occurred) :rtype: int @@ -167,34 +263,72 @@ C API Set the density of a material. - :param index: Index in the materials array - :type index: int32_t - :param density: Density of the material in atom/b-cm - :type density: double + :param int32_t index: Index in the materials array + :param double density: Density of the material in atom/b-cm :return: Return status (negative if an error occurs) :rtype: int -.. c:function:: int openmc_material_set_densities(int32_t, n, char* name[], double density[]) +.. c:function:: int openmc_material_set_densities(int32_t index, int n, char* name[], double density[]) - :param index: Index in the materials array - :type index: int32_t - :param n: Length of name/density - :type n: int - :param name: Array of nuclide names - :type name: char** - :param density: Array of densities - :type density: double[] + :param int32_t index: Index in the materials array + :param int n: Length of name/density + :param char** name: Array of nuclide names + :param double[] density: Array of densities :return: Return status (negative if an error occurs) :rtype: int +.. c:function:: int openmc_material_set_id(int32_t index, int32_t id) + + Set the ID of a material + + :param int32_t index: Index in the materials array + :param int32_t id: ID of the material + :return: Return status (negative if an error occurred) + :rtype: int + +.. c:function:: int openmc_material_filter_get_bins(int32_t index, int32_t** bins, int32_t* n) + + Get the bins for a material filter + + :param int32_t index: Index in the filters array + :param int32_t** bins: Index in the materials array for each bin + :param int32_t* n: Number of bins + :return: Return status (negative if an error occurred) + :rtype: int + +.. c:function:: int openmc_material_filter_set_bins(int32_t index, int32_t n, int32_t* bins) + + Set the bins for a material filter + + :param int32_t index: Index in the filters array + :param int32_t n: Number of bins + :param int32_t* bins: Index in the materials array for each bin + :return: Return status (negative if an error occurred) + :rtype: int + +.. c:function:: int openmc_mesh_filter_set_mesh(int32_t index, int32_t index_mesh) + + Set the mesh for a mesh filter + + :param int32_t index: Index in the filters array + :param int32_t index_mesh: Index in the meshes array + :return: Return status (negative if an error occurred) + :rtype: int + +.. c:function:: int openmc_next_batch() + + Simulate next batch of particles. Must be called after openmc_simulation_init(). + + :return: Integer indicating whether simulation has finished (negative) or not + finished (zero). + :rtype: int + .. c:function:: int openmc_nuclide_name(int index, char* name[]) Get name of a nuclide - :param index: Index in the nuclides array - :type index: int - :param name: Name of the nuclide - :type name: char** + :param int index: Index in the nuclides array + :param char** name: Name of the nuclide :return: Return status (negative if an error occurs) :rtype: int @@ -210,14 +344,37 @@ C API Run a simulation +.. c:function:: void openmc_simulation_finalize() + + Finalize a simulation. + +.. c:function:: void openmc_simulation_init() + + Initialize a simulation. Must be called after openmc_init(). + .. c:function:: int openmc_tally_get_id(int32_t index, int32_t* id) Get the ID of a tally - :param index: Index in the tallies array - :type index: int32_t - :param id: ID of the tally - :type id: int32_t* + :param int32_t index: Index in the tallies array + :param int32_t* id: ID of the tally + :return: Return status (negative if an error occurred) + :rtype: int + +.. c:function:: int openmc_tally_get_filters(int32_t index, int32_t** indices, int* n) + + Get filters specified in a tally + + :param int32_t index: Index in the tallies array + :param int32_t** indices: Array of filter indices + :param int* n: Number of filters + :return: Return status (negative if an error occurred) + :rtype: int + +.. c:function:: int openmc_tally_get_n_realizations(int32_t index, int32_t* n) + + :param int32_t index: Index in the tallies array + :param int32_t* n: Number of realizations :return: Return status (negative if an error occurred) :rtype: int @@ -225,12 +382,19 @@ C API Get nuclides specified in a tally - :param index: Index in the tallies array - :type index: int32_t - :param nuclides: Array of nuclide indices - :type nuclides: int** - :param n: Number of nuclides - :type n: int* + :param int32_t index: Index in the tallies array + :param int** nuclides: Array of nuclide indices + :param int* n: Number of nuclides + :return: Return status (negative if an error occurred) + :rtype: int + +.. c:function:: int openmc_tally_get_scores(int32_t index, int** scores, int* n) + + Get scores specified for a tally + + :param int32_t index: Index in the tallies array + :param int** scores: Array of scores + :param int* n: Number of scores :return: Return status (negative if an error occurred) :rtype: int @@ -238,12 +402,28 @@ C API Get a pointer to tally results array. - :param index: Index in the tallies array - :type index: int32_t - :param ptr: Pointer to the results array - :type ptr: double** - :param shape_: Shape of the results array - :type shape_: int[3] + :param int32_t index: Index in the tallies array + :param double** ptr: Pointer to the results array + :param int[3] shape_: Shape of the results array + :return: Return status (negative if an error occurred) + :rtype: int + +.. c:function:: int openmc_tally_set_filters(int32_t index, int n, int32_t* indices) + + Set filters for a tally + + :param int32_t index: Index in the tallies array + :param int n: Number of filters + :param int32_t* indices: Array of filter indices + :return: Return status (negative if an error occurred) + :rtype: int + +.. c:function:: int openmc_tally_set_id(int32_t index, int32_t id) + + Set the ID of a tally + + :param int32_t index: Index in the tallies array + :param int32_t id: ID of the tally :return: Return status (negative if an error occurred) :rtype: int @@ -251,11 +431,18 @@ C API Set the nuclides for a tally - :param index: Index in the tallies array - :type index: int32_t - :param n: Number of nuclides - :type n: int - :param nuclides: Array of nuclide names - :type nuclides: char** + :param int32_t index: Index in the tallies array + :param int n: Number of nuclides + :param char** nuclides: Array of nuclide names + :return: Return status (negative if an error occurred) + :rtype: int + +.. c:function:: int openmc_tally_set_scores(int32_t index, int n, int* scores) + + Set scores for a tally + + :param int32_t index: Index in the tallies array + :param int n: Number of scores + :param int* scores: Array of scores :return: Return status (negative if an error occurred) :rtype: int diff --git a/include/openmc.h b/include/openmc.h new file mode 100644 index 000000000..5f72e99ed --- /dev/null +++ b/include/openmc.h @@ -0,0 +1,104 @@ +#ifndef OPENMC_H +#define OPENMC_H + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + + void openmc_calculate_voumes(); + void openmc_finalize(); + void openmc_hard_reset(); + int openmc_next_batch(); + void openmc_plot_geometry(); + void openmc_reset(); + void openmc_run(); + void openmc_simulation_finalize(); + void openmc_simulation_init(); + + int openmc_cell_get_fill(int32_t index, int* type, int32_t** indices, int32_t* n); + int openmc_cell_get_id(int32_t index, int32_t* id); + int openmc_cell_set_fill(int32_t index, int type, int32_t n, int32_t* indices); + int openmc_cell_set_id(int32_t index, int32_t id); + int openmc_cell_set_temperature(int32_t index, double T, int32_t* instance); + int openmc_energy_filter_get_bins(int32_t index, double** energies, int32_t* n); + int openmc_energy_filter_set_bins(int32_t index, int32_t n, double* energies); + int openmc_extend_cells(int32_t n, int32_t* index_start, int32_t* index_end); + int openmc_extend_filters(int32_t n, int32_t* index_start, int32_t* index_end); + int openmc_extend_materials(int32_t n, int32_t* index_start, int32_t* index_end); + int openmc_extend_tallies(int32_t n, int32_t* index_start, int32_t* index_end); + int openmc_filter_get_id(int32_t index, int32_t* id); + int openmc_filter_set_id(int32_t index, int32_t id); + int openmc_find(double* xyz, int rtype, int32_t* id, int32_t* instance); + int openmc_get_cell_index(int32_t id, int32_t* index); + int openmc_get_filter_index(int32_t id, int32_t* index); + void openmc_get_filter_next_id(int32_t* id); + int openmc_get_keff(double k_combined[]); + int openmc_get_material_index(int32_t id, int32_t* index); + int openmc_get_nuclide_index(char name[], int* index); + int openmc_get_tally_tally(int32_t id, int32_t* index); + int openmc_load_nuclide(char name[]); + int openmc_material_add_nuclide(int32_t index, char name[], double density); + int openmc_material_get_densities(int32_t index, int* nuclides[], double* densities[], int* n); + int openmc_material_get_id(int32_t index, int32_t* id); + int openmc_material_set_density(int32_t index, double density); + int openmc_material_set_densities(int32_t index, int n, char* name[], double density[]); + int openmc_material_set_id(int32_t index, int32_t id); + int openmc_material_filter_get_bins(int32_t index, int32_t** bins, int32_t* n); + int openmc_material_filter_set_bins(int32_t index, int32_t n, int32_t* bins); + int openmc_mesh_filter_set_mesh(int32_t index, int32_t index_mesh); + int openmc_nuclide_name(int index, char* name[]); + int openmc_tally_get_id(int32_t index, int32_t* id); + int openmc_tally_get_filters(int32_t index, int32_t** indices, int* n); + int openmc_tally_get_n_realizations(int32_t index, int32_t* n); + int openmc_tally_get_nuclides(int32_t index, int* nuclides[], int* n); + int openmc_tally_get_scores(int32_t index, int** scores, int* n); + int openmc_tally_results(int32_t index, double** ptr, int shape_[3]); + int openmc_tally_set_filters(int32_t index, int n, int32_t* indices); + int openmc_tally_set_id(int32_t index, int32_t id); + int openmc_tally_set_nuclides(int32_t index, int n, char* nuclides[]); + int openmc_tally_set_scores(int32_t index, int n, int* scores); + + // Error codes + extern int E_UNASSIGNED; + extern int E_ALLOCATE; + extern int E_OUT_OF_BOUNDS; + extern int E_INVALID_SIZE; + extern int E_INVALID_ARGUMENT; + extern int E_INVALID_TYPE; + extern int E_INVALID_ID; + extern int E_GEOMETRY; + extern int E_DATA; + extern int E_PHYSICS; + extern int E_WARNING; + + // Global variables + extern char openmc_err_msg[256]; + extern double keff; + extern double keff_std; + extern int32_t n_batches; + extern int32_t n_cells; + extern int32_t n_filters; + extern int32_t n_inactive; + extern int32_t n_lattices; + extern int32_t n_materials; + extern int32_t n_meshes; + extern int64_t n_particles; + extern int32_t n_plots; + extern int32_t n_realizations; + extern int32_t n_sab_tables; + extern int32_t n_sources; + extern int32_t n_surfaces; + extern int32_t n_tallies; + extern int32_t n_universes; + extern int run_mode; + extern bool simulation_initialized; + extern int verbosity; + +#ifdef __cplusplus +} +#endif + +#endif // OPENMC_H diff --git a/openmc/capi/cell.py b/openmc/capi/cell.py index f13f64a04..0c4b72c74 100644 --- a/openmc/capi/cell.py +++ b/openmc/capi/cell.py @@ -21,6 +21,8 @@ _dll.openmc_cell_get_id.restype = c_int _dll.openmc_cell_get_id.errcheck = _error_handler _dll.openmc_cell_get_fill.argtypes = [ c_int32, POINTER(c_int), POINTER(POINTER(c_int32)), POINTER(c_int32)] +_dll.openmc_cell_get_fill.restype = c_int +_dll.openmc_cell_get_fill.errcheck = _error_handler _dll.openmc_cell_set_fill.argtypes = [ c_int32, c_int, c_int32, POINTER(c_int32)] _dll.openmc_cell_set_fill.restype = c_int diff --git a/src/api.F90 b/src/api.F90 index 326b755b6..9db06ac20 100644 --- a/src/api.F90 +++ b/src/api.F90 @@ -24,7 +24,7 @@ module openmc_api use tally_filter_header use tally_filter use tally, only: openmc_tally_set_type - use simulation, only: openmc_run + use simulation use string, only: to_f_string use timer_header use volume_calc, only: openmc_calculate_volumes @@ -57,6 +57,7 @@ module openmc_api public :: openmc_get_material_index public :: openmc_get_nuclide_index public :: openmc_get_tally_index + public :: openmc_global_tallies public :: openmc_hard_reset public :: openmc_init public :: openmc_load_nuclide @@ -69,12 +70,16 @@ module openmc_api public :: openmc_material_filter_get_bins public :: openmc_material_filter_set_bins public :: openmc_mesh_filter_set_mesh + public :: openmc_next_batch public :: openmc_nuclide_name public :: openmc_plot_geometry public :: openmc_reset public :: openmc_run + public :: openmc_simulation_finalize + public :: openmc_simulation_init public :: openmc_tally_get_id public :: openmc_tally_get_filters + public :: openmc_tally_get_n_realizations public :: openmc_tally_get_nuclides public :: openmc_tally_get_scores public :: openmc_tally_results diff --git a/src/geometry_header.F90 b/src/geometry_header.F90 index b827c055c..e71916d09 100644 --- a/src/geometry_header.F90 +++ b/src/geometry_header.F90 @@ -524,7 +524,7 @@ contains function openmc_cell_set_fill(index, type, n, indices) result(err) bind(C) - ! Set the fill for a fill + ! Set the fill for a cell integer(C_INT32_T), value, intent(in) :: index ! index in cells integer(C_INT), value, intent(in) :: type integer(c_INT32_T), value, intent(in) :: n diff --git a/src/simulation.F90 b/src/simulation.F90 index e8997fc9b..026c9c61e 100644 --- a/src/simulation.F90 +++ b/src/simulation.F90 @@ -43,6 +43,7 @@ module simulation implicit none private + public :: openmc_next_batch public :: openmc_run public :: openmc_simulation_init public :: openmc_simulation_finalize diff --git a/src/tallies/tally_header.F90 b/src/tallies/tally_header.F90 index fa397632f..474e77d1c 100644 --- a/src/tallies/tally_header.F90 +++ b/src/tallies/tally_header.F90 @@ -26,6 +26,7 @@ module tally_header public :: openmc_global_tallies public :: openmc_tally_get_id public :: openmc_tally_get_filters + public :: openmc_tally_get_n_realizations public :: openmc_tally_get_nuclides public :: openmc_tally_get_scores public :: openmc_tally_results From e28f16eefd9666cdd1728cdc51167f0b38edac3a Mon Sep 17 00:00:00 2001 From: Paul Romano Date: Mon, 1 Jan 2018 15:19:51 -0600 Subject: [PATCH 5/7] Happy new year 2018! --- LICENSE | 2 +- docs/source/conf.py | 2 +- docs/source/license.rst | 2 +- man/man1/openmc.1 | 2 +- src/output.F90 | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/LICENSE b/LICENSE index 660806c88..a11dc44a2 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2011-2017 Massachusetts Institute of Technology +Copyright (c) 2011-2018 Massachusetts Institute of Technology Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in diff --git a/docs/source/conf.py b/docs/source/conf.py index 928755cf8..933031590 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -70,7 +70,7 @@ master_doc = 'index' # General information about the project. project = u'OpenMC' -copyright = u'2011-2017, Massachusetts Institute of Technology' +copyright = u'2011-2018, Massachusetts Institute of Technology' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the diff --git a/docs/source/license.rst b/docs/source/license.rst index 1e5f88bdc..e9cba3d8a 100644 --- a/docs/source/license.rst +++ b/docs/source/license.rst @@ -4,7 +4,7 @@ License Agreement ================= -Copyright © 2011-2017 Massachusetts Institute of Technology +Copyright © 2011-2018 Massachusetts Institute of Technology Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in diff --git a/man/man1/openmc.1 b/man/man1/openmc.1 index 8384da9a8..f49d80bad 100644 --- a/man/man1/openmc.1 +++ b/man/man1/openmc.1 @@ -59,7 +59,7 @@ Indicates the default path to a directory containing windowed multipole data if the user has not specified the tag in .I materials.xml\fP. .SH LICENSE -Copyright \(co 2011-2017 Massachusetts Institute of Technology. +Copyright \(co 2011-2018 Massachusetts Institute of Technology. .PP Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in diff --git a/src/output.F90 b/src/output.F90 index f9660638a..9a144721d 100644 --- a/src/output.F90 +++ b/src/output.F90 @@ -76,7 +76,7 @@ contains write(UNIT=OUTPUT_UNIT, FMT=*) & ' | The OpenMC Monte Carlo Code' write(UNIT=OUTPUT_UNIT, FMT=*) & - ' Copyright | 2011-2017 Massachusetts Institute of Technology' + ' Copyright | 2011-2018 Massachusetts Institute of Technology' write(UNIT=OUTPUT_UNIT, FMT=*) & ' License | http://openmc.readthedocs.io/en/latest/license.html' write(UNIT=OUTPUT_UNIT, FMT='(11X,"Version | ",I1,".",I2,".",I1)') & From ec0604b354e867b22c01cc6a9ee39003f9f2c6b8 Mon Sep 17 00:00:00 2001 From: Paul Romano Date: Mon, 8 Jan 2018 08:04:57 -0600 Subject: [PATCH 6/7] Update C API documentation and include file --- docs/source/capi/index.rst | 147 ++++++++++++++++++++++++++++++------- include/openmc.h | 56 ++++++++------ src/api.F90 | 6 ++ src/source_header.F90 | 2 + 4 files changed, 161 insertions(+), 50 deletions(-) diff --git a/docs/source/capi/index.rst b/docs/source/capi/index.rst index ff19758bb..d63ed1f3a 100644 --- a/docs/source/capi/index.rst +++ b/docs/source/capi/index.rst @@ -4,6 +4,48 @@ C API ===== +The libopenmc shared library that is built when installing OpenMC exports a +number of C interoperable functions and global variables that can be used for +in-memory coupling. While it is possible to directly use the C API as documented +here for coupling, most advanced users will find it easier to work with the +Python bindings in the :py:mod:`openmc.capi` module. + +.. warning:: The C API is still experimental and may undergo substantial changes + in future releases. + +---------------- +Type Definitions +---------------- + +.. c:type:: Bank + + Attributes of a source particle. + + .. c:member:: double wgt + + Weight of the particle + + .. c:member:: double xyz[3] + + Position of the particle (units of cm) + + .. c:member:: double uvw[3] + + Unit vector indicating direction of the particle + + .. c:member:: double E + + Energy of the particle in eV + + .. c:member:: int delayed_group + + If the particle is a delayed neutron, indicates which delayed precursor + group it was born from. If not a delayed neutron, this member is zero. + +--------- +Functions +--------- + .. c:function:: void openmc_calculate_volumes() Run a stochastic volume calculation @@ -15,7 +57,7 @@ C API :param int32_t index: Index in the cells array :param int* type: Type of the fill :param int32_t** indices: Array of material indices for cell - :param int32_t n: Length of indices array + :param int32_t* n: Length of indices array :return: Return status (negative if an error occurred) :rtype: int @@ -28,14 +70,15 @@ C API :return: Return status (negative if an error occurred) :rtype: int -.. c:function:: int openmc_cell_set_fill(int32_t index, int type, int32_t n, int32_t* indices) +.. c:function:: int openmc_cell_set_fill(int32_t index, int type, int32_t n, const int32_t* indices) Set the fill for a cell :param int32_t index: Index in the cells array :param int type: Type of the fill :param int32_t n: Length of indices array - :param int32_t* indices: Array of material indices for cell + :param indices: Array of material indices for cell + :type indices: const int32_t* :return: Return status (negative if an error occurred) :rtype: int @@ -48,14 +91,15 @@ C API :return: Return status (negative if an error occurred) :rtype: int -.. c:function:: int openmc_cell_set_temperature(index index, double T, int32_t* instance) +.. c:function:: int openmc_cell_set_temperature(index index, double T, const int32_t* instance) Set the temperature of a cell. :param int32_t index: Index in the cells array :param double T: Temperature in Kelvin - :param int32_t* instance: Which instance of the cell. To set the temperature - for all instances, pass a null pointer. + :param instance: Which instance of the cell. To set the temperature for all + instances, pass a null pointer. + :type instance: const int32_t* :return: Return status (negative if an error occurred) :rtype: int @@ -69,13 +113,14 @@ C API :return: Return status (negative if an error occurred) :rtype: int -.. c:function:: int openmc_energy_filter_set_bins(int32_t index, int32_t n, double* energies) +.. c:function:: int openmc_energy_filter_set_bins(int32_t index, int32_t n, const double* energies) Set the bounding energies for an energy filter :param int32_t index: Index in the filters array :param int32_t n: Number of energies specified - :param double* energies: Bounding energies of the bins for the energy filter + :param energies: Bounding energies of the bins for the energy filter + :type energies: const double* :return: Return status (negative if an error occurred) :rtype: int @@ -109,6 +154,16 @@ C API :return: Return status (negative if an error occurred) :rtype: int +.. c:function:: int openmc_extend_sources(int32_t n, int32_t* index_start, int32_t* index_end) + + Extend the external sources array by n elements + + :param int32_t n: Number of sources to create + :param int32_t* index_start: Index of first new source + :param int32_t* index_end: Index of last new source + :return: Return status (negative if an error occurred) + :rtype: int + .. c:function:: int openmc_extend_tallies(int32_t n, int32_t* index_start, int32_t* index_end) Extend the tallies array by n elements @@ -150,7 +205,7 @@ C API :param int32_t* id: ID of the cell/material found. If a material is requested and the point is in a void, the ID is 0. If an error occurs, the ID is -1. - :param int32_t* instance: If a cell is repetaed in the geometry, the instance + :param int32_t* instance: If a cell is repeated in the geometry, the instance of the cell that was found and zero otherwise. .. c:function:: int openmc_get_cell_index(int32_t id, int32_t* index) @@ -177,7 +232,7 @@ C API :param int32_t* id: Unused integer ID -.. c:function:: int openmc_get_keff(double k_combined[]) +.. c:function:: int openmc_get_keff(double k_combined[2]) :param double[2] k_combined: Combined estimate of k-effective :return: Return status (negative if an error occurs) @@ -214,11 +269,13 @@ C API Reset tallies, timers, and pseudo-random number generator state -.. c:function:: void openmc_init(int intracomm) +.. c:function:: void openmc_init(const int* intracomm) Initialize OpenMC - :param int intracomm: MPI intracommunicator + :param intracomm: MPI intracommunicator. If MPI is not being used, a null + pointer should be passed. + :type intracomm: const int* .. c:function:: int openmc_load_nuclide(char name[]) @@ -228,18 +285,19 @@ C API :return: Return status (negative if an error occurs) :rtype: int -.. c:function:: int openmc_material_add_nuclide(int32_t index, char name[], double density) +.. c:function:: int openmc_material_add_nuclide(int32_t index, const char name[], double density) Add a nuclide to an existing material. If the nuclide already exists, the density is overwritten. :param int32_t index: Index in the materials array - :param char[] name: Name of the nuclide + :param name: Name of the nuclide + :type name: const char[] :param double density: Density in atom/b-cm :return: Return status (negative if an error occurs) :rtype: int -.. c:function:: int openmc_material_get_densities(int32_t index, int* nuclides[], double* densities[], int* n) +.. c:function:: int openmc_material_get_densities(int32_t index, int** nuclides, double** densities, int* n) Get density for each nuclide in a material. @@ -268,12 +326,14 @@ C API :return: Return status (negative if an error occurs) :rtype: int -.. c:function:: int openmc_material_set_densities(int32_t index, int n, char* name[], double density[]) +.. c:function:: int openmc_material_set_densities(int32_t index, int n, const char** name, const double density*) :param int32_t index: Index in the materials array :param int n: Length of name/density - :param char** name: Array of nuclide names - :param double[] density: Array of densities + :param name: Array of nuclide names + :type name: const char** + :param density: Array of densities + :type density: const double* :return: Return status (negative if an error occurs) :rtype: int @@ -296,13 +356,14 @@ C API :return: Return status (negative if an error occurred) :rtype: int -.. c:function:: int openmc_material_filter_set_bins(int32_t index, int32_t n, int32_t* bins) +.. c:function:: int openmc_material_filter_set_bins(int32_t index, int32_t n, const int32_t* bins) Set the bins for a material filter :param int32_t index: Index in the filters array :param int32_t n: Number of bins - :param int32_t* bins: Index in the materials array for each bin + :param bins: Index in the materials array for each bin + :type bins: const int32_t* :return: Return status (negative if an error occurred) :rtype: int @@ -323,7 +384,7 @@ C API finished (zero). :rtype: int -.. c:function:: int openmc_nuclide_name(int index, char* name[]) +.. c:function:: int openmc_nuclide_name(int index, char** name) Get name of a nuclide @@ -352,6 +413,33 @@ C API Initialize a simulation. Must be called after openmc_init(). +.. c:function:: int openmc_source_bank(struct Bank** ptr, int64_t* n) + + Return a pointer to the source bank array. + + :param ptr: Pointer to the source bank array + :type ptr: struct Bank** + :param int64_t* n: Length of the source bank array + :return: Return status (negative if an error occurred) + :rtype: int + +.. c:function:: int openmc_source_set_strength(int32_t index, double strength) + + Set the strength of an external source + + :param int32_t index: Index in the external source array + :param double strength: Source strength + :return: Return status (negative if an error occurred) + :rtype: int + +.. c:function:: void openmc_statepoint_write(const char filename[]) + + Write a statepoint file + + :param filename: Name of file to create. If a null pointer is passed, a + filename is assigned automatically. + :type filename: const char[] + .. c:function:: int openmc_tally_get_id(int32_t index, int32_t* id) Get the ID of a tally @@ -378,7 +466,7 @@ C API :return: Return status (negative if an error occurred) :rtype: int -.. c:function:: int openmc_tally_get_nuclides(int32_t index, int* nuclides[], int* n) +.. c:function:: int openmc_tally_get_nuclides(int32_t index, int** nuclides, int* n) Get nuclides specified in a tally @@ -408,13 +496,14 @@ C API :return: Return status (negative if an error occurred) :rtype: int -.. c:function:: int openmc_tally_set_filters(int32_t index, int n, int32_t* indices) +.. c:function:: int openmc_tally_set_filters(int32_t index, int n, const int32_t* indices) Set filters for a tally :param int32_t index: Index in the tallies array :param int n: Number of filters - :param int32_t* indices: Array of filter indices + :param indices: Array of filter indices + :type indices: const int32_t* :return: Return status (negative if an error occurred) :rtype: int @@ -427,22 +516,24 @@ C API :return: Return status (negative if an error occurred) :rtype: int -.. c:function:: int openmc_tally_set_nuclides(int32_t index, int n, char* nuclides[]) +.. c:function:: int openmc_tally_set_nuclides(int32_t index, int n, const char** nuclides) Set the nuclides for a tally :param int32_t index: Index in the tallies array :param int n: Number of nuclides - :param char** nuclides: Array of nuclide names + :param nuclides: Array of nuclide names + :type nuclides: const char** :return: Return status (negative if an error occurred) :rtype: int -.. c:function:: int openmc_tally_set_scores(int32_t index, int n, int* scores) +.. c:function:: int openmc_tally_set_scores(int32_t index, int n, const int* scores) Set scores for a tally :param int32_t index: Index in the tallies array :param int n: Number of scores - :param int* scores: Array of scores + :param scores: Array of scores + :type scores: const int* :return: Return status (negative if an error occurred) :rtype: int diff --git a/include/openmc.h b/include/openmc.h index 5f72e99ed..bb04907a5 100644 --- a/include/openmc.h +++ b/include/openmc.h @@ -8,29 +8,30 @@ extern "C" { #endif - void openmc_calculate_voumes(); - void openmc_finalize(); - void openmc_hard_reset(); - int openmc_next_batch(); - void openmc_plot_geometry(); - void openmc_reset(); - void openmc_run(); - void openmc_simulation_finalize(); - void openmc_simulation_init(); + struct Bank { + double wgt; + double xyz[3]; + double uvw[3]; + double E; + int delayed_group; + }; + void openmc_calculate_voumes(); int openmc_cell_get_fill(int32_t index, int* type, int32_t** indices, int32_t* n); int openmc_cell_get_id(int32_t index, int32_t* id); - int openmc_cell_set_fill(int32_t index, int type, int32_t n, int32_t* indices); + int openmc_cell_set_fill(int32_t index, int type, int32_t n, const int32_t* indices); int openmc_cell_set_id(int32_t index, int32_t id); - int openmc_cell_set_temperature(int32_t index, double T, int32_t* instance); + int openmc_cell_set_temperature(int32_t index, double T, const int32_t* instance); int openmc_energy_filter_get_bins(int32_t index, double** energies, int32_t* n); - int openmc_energy_filter_set_bins(int32_t index, int32_t n, double* energies); + int openmc_energy_filter_set_bins(int32_t index, int32_t n, const double* energies); int openmc_extend_cells(int32_t n, int32_t* index_start, int32_t* index_end); int openmc_extend_filters(int32_t n, int32_t* index_start, int32_t* index_end); int openmc_extend_materials(int32_t n, int32_t* index_start, int32_t* index_end); + int openmc_extend_sources(int32_t n, int32_t* index_start, int32_t* index_end); int openmc_extend_tallies(int32_t n, int32_t* index_start, int32_t* index_end); int openmc_filter_get_id(int32_t index, int32_t* id); int openmc_filter_set_id(int32_t index, int32_t id); + void openmc_finalize(); int openmc_find(double* xyz, int rtype, int32_t* id, int32_t* instance); int openmc_get_cell_index(int32_t id, int32_t* index); int openmc_get_filter_index(int32_t id, int32_t* index); @@ -38,28 +39,39 @@ extern "C" { int openmc_get_keff(double k_combined[]); int openmc_get_material_index(int32_t id, int32_t* index); int openmc_get_nuclide_index(char name[], int* index); - int openmc_get_tally_tally(int32_t id, int32_t* index); + int openmc_get_tally_index(int32_t id, int32_t* index); + void openmc_hard_reset(); + void openmc_init(const int* intracomm); int openmc_load_nuclide(char name[]); - int openmc_material_add_nuclide(int32_t index, char name[], double density); - int openmc_material_get_densities(int32_t index, int* nuclides[], double* densities[], int* n); + int openmc_material_add_nuclide(int32_t index, const char name[], double density); + int openmc_material_get_densities(int32_t index, int** nuclides, double** densities, int* n); int openmc_material_get_id(int32_t index, int32_t* id); int openmc_material_set_density(int32_t index, double density); - int openmc_material_set_densities(int32_t index, int n, char* name[], double density[]); + int openmc_material_set_densities(int32_t index, int n, const char** name, const double* density); int openmc_material_set_id(int32_t index, int32_t id); int openmc_material_filter_get_bins(int32_t index, int32_t** bins, int32_t* n); - int openmc_material_filter_set_bins(int32_t index, int32_t n, int32_t* bins); + int openmc_material_filter_set_bins(int32_t index, int32_t n, const int32_t* bins); int openmc_mesh_filter_set_mesh(int32_t index, int32_t index_mesh); - int openmc_nuclide_name(int index, char* name[]); + int openmc_next_batch(); + int openmc_nuclide_name(int index, char** name); + void openmc_plot_geometry(); + void openmc_reset(); + void openmc_run(); + void openmc_simulation_finalize(); + void openmc_simulation_init(); + int openmc_source_bank(struct Bank** ptr, int64_t* n); + int openmc_source_set_strength(int32_t index, double strength); + void openmc_statepoint_write(const char filename[]); int openmc_tally_get_id(int32_t index, int32_t* id); int openmc_tally_get_filters(int32_t index, int32_t** indices, int* n); int openmc_tally_get_n_realizations(int32_t index, int32_t* n); - int openmc_tally_get_nuclides(int32_t index, int* nuclides[], int* n); + int openmc_tally_get_nuclides(int32_t index, int** nuclides, int* n); int openmc_tally_get_scores(int32_t index, int** scores, int* n); int openmc_tally_results(int32_t index, double** ptr, int shape_[3]); - int openmc_tally_set_filters(int32_t index, int n, int32_t* indices); + int openmc_tally_set_filters(int32_t index, int n, const int32_t* indices); int openmc_tally_set_id(int32_t index, int32_t id); - int openmc_tally_set_nuclides(int32_t index, int n, char* nuclides[]); - int openmc_tally_set_scores(int32_t index, int n, int* scores); + int openmc_tally_set_nuclides(int32_t index, int n, const char** nuclides); + int openmc_tally_set_scores(int32_t index, int n, const int* scores); // Error codes extern int E_UNASSIGNED; diff --git a/src/api.F90 b/src/api.F90 index 9db06ac20..eb9a99695 100644 --- a/src/api.F90 +++ b/src/api.F90 @@ -4,6 +4,7 @@ module openmc_api use hdf5, only: HID_T, h5tclose_f, h5close_f + use bank_header, only: openmc_source_bank use constants, only: K_BOLTZMANN use eigenvalue, only: k_sum, openmc_get_keff use error @@ -20,6 +21,8 @@ module openmc_api use random_lcg, only: seed, openmc_set_seed use settings use simulation_header + use source_header, only: openmc_extend_sources, openmc_source_set_strength + use state_point, only: openmc_statepoint_write use tally_header use tally_filter_header use tally_filter @@ -43,6 +46,7 @@ module openmc_api public :: openmc_extend_filters public :: openmc_extend_cells public :: openmc_extend_materials + public :: openmc_extend_sources public :: openmc_extend_tallies public :: openmc_filter_get_id public :: openmc_filter_get_type @@ -77,6 +81,8 @@ module openmc_api public :: openmc_run public :: openmc_simulation_finalize public :: openmc_simulation_init + public :: openmc_source_bank + public :: openmc_source_set_strength public :: openmc_tally_get_id public :: openmc_tally_get_filters public :: openmc_tally_get_n_realizations diff --git a/src/source_header.F90 b/src/source_header.F90 index fca05d816..da15046ab 100644 --- a/src/source_header.F90 +++ b/src/source_header.F90 @@ -17,6 +17,8 @@ module source_header implicit none private public :: free_memory_source + public :: openmc_extend_sources + public :: openmc_source_set_strength integer :: n_accept = 0 ! Number of samples accepted integer :: n_reject = 0 ! Number of samples rejected From 59b15fe0be0ef5389df3b1af61408dc500f63add Mon Sep 17 00:00:00 2001 From: Paul Romano Date: Mon, 8 Jan 2018 08:34:57 -0600 Subject: [PATCH 7/7] Address a few @nelsonag comments in review --- docs/source/releasenotes.rst | 3 +++ docs/source/usersguide/install.rst | 24 +++++++++++++++--------- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/docs/source/releasenotes.rst b/docs/source/releasenotes.rst index 4cacd4a7f..28af52f5f 100644 --- a/docs/source/releasenotes.rst +++ b/docs/source/releasenotes.rst @@ -26,6 +26,9 @@ of: mat.add_nuclide('H1', 1.0) mat.isotropic = ['H1'] + To treat all nuclides in a material this way, the + :meth:`Material.make_isotropic_in_lab` method can still be used. + - The initializers for :class:`openmc.Intersection` and :class:`openmc.Union` now expect an iterable. diff --git a/docs/source/usersguide/install.rst b/docs/source/usersguide/install.rst index 1fee22e71..b59572923 100644 --- a/docs/source/usersguide/install.rst +++ b/docs/source/usersguide/install.rst @@ -116,21 +116,27 @@ Prerequisites OpenMC uses HDF5 for many input/output files. As such, you will need to have HDF5 installed on your computer. The installed version will need to have been compiled with the same compiler you intend to compile OpenMC - with. On Debian derivatives, HDF5 and/or parallel HDF5 can be installed - through the APT package manager: - - .. code-block:: sh + with. If compiling with gcc from the APT repositories, users of Debian + derivatives can install HDF5 and/or parallel HDF5 through the package + manager:: sudo apt install libhdf5-dev + Parallel versions of the HDF5 library called `libhdf5-mpich-dev` and + `libhdf5-openmpi-dev` exist which are built against MPICH and OpenMPI, + respectively. To link against a parallel HDF5 library, make sure to set + the HDF5_PREFER_PARALLEL CMake option, e.g.:: + + FC=mpifort.mpich cmake -DHDF5_PREFER_PARALLEL=on .. + Note that the exact package names may vary depending on your particular - distribution and version. If you are using HDF5 in conjunction with MPI, - we recommend that your HDF5 installation be built with parallel I/O + distribution and version. + + If you are using building HDF5 from source in conjunction with MPI, we + recommend that your HDF5 installation be built with parallel I/O features. An example of configuring HDF5_ is listed below:: - FC=/opt/mpich/3.2/bin/mpif90 CC=/opt/mpich/3.2/bin/mpicc \ - ./configure --prefix=/opt/hdf5/1.10.1 --enable-fortran \ - --enable-parallel + FC=mpifort ./configure --enable-fortran --enable-parallel You may omit ``--enable-parallel`` if you want to compile HDF5_ in serial.