mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 06:05:58 -04:00
Respond to comments on #850
This commit is contained in:
parent
973b66c1d0
commit
5c74b85713
28 changed files with 985 additions and 758 deletions
|
|
@ -52,9 +52,10 @@ eXtensible Markup Language (XML)
|
|||
|
||||
Unlike many other Monte Carlo codes which use an arbitrary-format ASCII file
|
||||
with "cards" to specify a particular geometry, materials, and associated run
|
||||
settings, the input files for OpenMC are structured in a set of XML_ files. XML,
|
||||
which stands for eXtensible Markup Language, is a simple format that allows data
|
||||
to be exchanged efficiently between different programs and interfaces.
|
||||
settings, the input files for OpenMC are structured in a set of `XML
|
||||
<http://www.w3.org/XML/>`_ files. XML, which stands for eXtensible Markup
|
||||
Language, is a simple format that allows data to be exchanged efficiently
|
||||
between different programs and interfaces.
|
||||
|
||||
Anyone who has ever seen webpages written in HTML will be familiar with the
|
||||
structure of XML whereby "tags" enclosed in angle brackets denote that a
|
||||
|
|
@ -76,21 +77,21 @@ indicate characteristics about the person being described.
|
|||
In much the same way, OpenMC input uses XML tags to describe the geometry, the
|
||||
materials, and settings for a Monte Carlo simulation. Note that because the XML
|
||||
files have a well-defined structure, they can be validated using the
|
||||
:ref:`scripts_validate` script.
|
||||
|
||||
.. _XML: http://www.w3.org/XML/
|
||||
:ref:`scripts_validate` script or using :ref:`Emacs nXML mode
|
||||
<usersguide_nxml>`.
|
||||
|
||||
Creating Input Files
|
||||
--------------------
|
||||
|
||||
.. currentmodule:: openmc
|
||||
|
||||
The simplest option to create input files is to simply write them from scratch
|
||||
using the :ref:`XML format specifications <io_file_formats_input>`. This
|
||||
approach will feel familiar to users of other Monte Carlo codes such as MCNP and
|
||||
Serpent, with the added bonus that the XML formats feel much more
|
||||
"readable". Alternatively, input files can be generated using OpenMC's
|
||||
:ref:`Python API <pythonapi>`, which is introduced in the following section.
|
||||
The most rudimentary option for creating input files is to simply write them
|
||||
from scratch using the :ref:`XML format specifications
|
||||
<io_file_formats_input>`. This approach will feel familiar to users of other
|
||||
Monte Carlo codes such as MCNP and Serpent, with the added bonus that the XML
|
||||
formats feel much more "readable". Alternatively, input files can be generated
|
||||
using OpenMC's :ref:`Python API <pythonapi>`, which is introduced in the
|
||||
following section.
|
||||
|
||||
----------
|
||||
Python API
|
||||
|
|
@ -114,9 +115,9 @@ that generate a full model will look something like the following:
|
|||
materials.export_to_xml()
|
||||
|
||||
# Create geometry
|
||||
geom = openmc.Geometry()
|
||||
geometry = openmc.Geometry()
|
||||
...
|
||||
geom.export_to_xml()
|
||||
geometry.export_to_xml()
|
||||
|
||||
# Assign simulation settings
|
||||
settings = openmc.Settings()
|
||||
|
|
@ -127,26 +128,6 @@ One a model has been created and exported to XML, a simulation can be run either
|
|||
by calling :ref:`scripts_openmc` directly from a shell or by using the
|
||||
:func:`openmc.run()` function from Python.
|
||||
|
||||
If you have never used Python before, the prospect of learning a new code *and*
|
||||
a programming language might sound daunting. However, you should keep mind in
|
||||
mind that there are many substantial benefits to using the Python API,
|
||||
including:
|
||||
|
||||
- The ability to define dimensions using variables.
|
||||
- Availability of standard-library modules for working with files.
|
||||
- An entire ecosystem of third-party packages for scientific computing.
|
||||
- Ability to create materials based on natural elements or uranium enrichment
|
||||
- :ref:`Automated multi-group cross section generation <pythonapi_mgxs>`
|
||||
- Convenience functions (e.g., a function returning a hexagonal region)
|
||||
- Ability to plot individual universes as geometry is being created
|
||||
- A :math:`k_\text{eff}` search function (:func:`openmc.search_for_keff`)
|
||||
- Random sphere packing for generating TRISO particle locations
|
||||
(:func:`openmc.model.pack_trisos`)
|
||||
- A fully-featured :ref:`nuclear data interface <pythonapi_data>`.
|
||||
|
||||
.. tip:: Users are strongly encouraged to use the Python API to generate input
|
||||
files and analyze results.
|
||||
|
||||
Identifying Objects
|
||||
-------------------
|
||||
|
||||
|
|
|
|||
234
docs/source/usersguide/cross_sections.rst
Normal file
234
docs/source/usersguide/cross_sections.rst
Normal file
|
|
@ -0,0 +1,234 @@
|
|||
.. _usersguide_cross_sections:
|
||||
|
||||
===========================
|
||||
Cross Section Configuration
|
||||
===========================
|
||||
|
||||
In order to run a simulation with OpenMC, you will need cross section data for
|
||||
each nuclide or material in your problem. OpenMC can be run in continuous-energy
|
||||
or multi-group mode.
|
||||
|
||||
In continuous-energy mode, OpenMC uses a native `HDF5
|
||||
<https://support.hdfgroup.org/HDF5/>`_ format (see :ref:`io_nuclear_data`) to
|
||||
store all nuclear data. If you have ACE format data that was produced with
|
||||
NJOY_, such as that distributed with MCNP_ or Serpent_, it can be converted to
|
||||
the HDF5 format using the :ref:`scripts_ace` script (or :ref:`using the Python
|
||||
API <create_xs_library>`). Several sources provide openly available ACE data as
|
||||
described below and can be easily converted using the provided scripts. The
|
||||
TALYS-based evaluated nuclear data library, TENDL_, is also available in ACE
|
||||
format. In addition to tabulated cross sections in the HDF5 files, OpenMC relies
|
||||
on :ref:`windowed multipole <windowed_multipole>` data to perform on-the-fly
|
||||
Doppler broadening.
|
||||
|
||||
In multi-group mode, OpenMC utilizes an HDF5-based library format which can be
|
||||
used to describe nuclide- or material-specific quantities.
|
||||
|
||||
---------------------
|
||||
Environment Variables
|
||||
---------------------
|
||||
|
||||
When :ref:`scripts_openmc` is run, it will look for several environment
|
||||
variables that indicate where cross sections can be found. While the location of
|
||||
cross sections can also be indicated through the :class:`openmc.Materials` class
|
||||
(or in the :ref:`materials.xml <io_materials>` file), if you always use the same
|
||||
set of cross section data, it is often easier to just set an environment
|
||||
variable that will be picked up by default every time OpenMC is run. The
|
||||
following environment variables are used:
|
||||
|
||||
:envvar:`OPENMC_CROSS_SECTIONS`
|
||||
Indicates the path to the :ref:`cross_sections.xml <io_cross_sections>`
|
||||
summary file that is used to locate HDF5 format cross section libraries if the
|
||||
user has not specified :attr:`Materials.cross_sections` (equivalently, the
|
||||
:ref:`cross_sections` in :ref:`materials.xml <io_materials>`).
|
||||
|
||||
:envvar:`OPENMC_MULTIPOLE_LIBRARY`
|
||||
Indicates the path to a directory containing windowed multipole data if the
|
||||
user has not specified :attr:`Materials.multipole_library` (equivalently, the
|
||||
:ref:`multipole_library` in :ref:`materials.xml <io_materials>`)
|
||||
|
||||
:envvar:`OPENMC_MG_CROSS_SECTIONS`
|
||||
Indicates the path to the an :ref:`HDF5 file <io_mgxs_library>` that contains
|
||||
multi-group cross sections if the user has not specified
|
||||
:attr:`Materials.cross_sections` (equivalently, the :ref:`cross_sections` in
|
||||
:ref:`materials.xml <io_materials>`).
|
||||
|
||||
To set these environment variables persistently, export them from your shell
|
||||
profile (``.profile`` or ``.bashrc`` in bash_).
|
||||
|
||||
.. _bash: http://www.linuxfromscratch.org/blfs/view/6.3/postlfs/profile.html
|
||||
|
||||
--------------------------------
|
||||
Continuous-Energy Cross Sections
|
||||
--------------------------------
|
||||
|
||||
Using ENDF/B-VII.1 Cross Sections from NNDC
|
||||
-------------------------------------------
|
||||
|
||||
The NNDC_ provides ACE data from the ENDF/B-VII.1 neutron and thermal scattering
|
||||
sublibraries at room temperature processed using NJOY_. To use this data with
|
||||
OpenMC, the :ref:`scripts_nndc` script can be used to automatically download and
|
||||
extract the ACE data, fix any deficiencies, and create an HDF5 library:
|
||||
|
||||
.. code-block:: sh
|
||||
|
||||
openmc-get-nndc-data
|
||||
|
||||
At this point, you should set the :envvar:`OPENMC_CROSS_SECTIONS` environment
|
||||
variable to the absolute path of the file ``nndc_hdf5/cross_sections.xml``. This
|
||||
cross section set is used by the test suite.
|
||||
|
||||
Using JEFF Cross Sections from OECD/NEA
|
||||
---------------------------------------
|
||||
|
||||
The NEA_ provides processed ACE data from the JEFF_ library. To use this data
|
||||
with OpenMC, the :ref:`scripts_jeff` script can be used to automatically
|
||||
download and extract the ACE data, fix any deficiencies, and create an HDF5
|
||||
library.
|
||||
|
||||
.. code-block:: sh
|
||||
|
||||
openmc-get-jeff-data
|
||||
|
||||
At this point, you should set the :envvar:`OPENMC_CROSS_SECTIONS` environment
|
||||
variable to the absolute path of the file ``jeff-3.2-hdf5/cross_sections.xml``.
|
||||
|
||||
Using Cross Sections from MCNP
|
||||
------------------------------
|
||||
|
||||
OpenMC provides two scripts (:ref:`scripts_mcnp70` and :ref:`scripts_mcnp71`)
|
||||
that will automatically convert ENDF/B-VII.0 and ENDF/B-VII.1 ACE data that is
|
||||
provided with MCNP5 or MCNP6. To convert the ENDF/B-VII.0 ACE files
|
||||
(``endf70[a-k]`` and ``endf70sab``) into the native HDF5 format, run the
|
||||
following:
|
||||
|
||||
.. code-block:: sh
|
||||
|
||||
openmc-convert-mcnp70-data /path/to/mcnpdata/
|
||||
|
||||
where ``/path/to/mcnpdata`` is the directory containing the ``endf70[a-k]``
|
||||
files.
|
||||
|
||||
To convert the ENDF/B-VII.1 ACE files (the endf71x and ENDF71SaB libraries), use
|
||||
the following script:
|
||||
|
||||
.. code-block:: sh
|
||||
|
||||
openmc-convert-mcnp71-data /path/to/mcnpdata
|
||||
|
||||
where ``/path/to/mcnpdata`` is the directory containing the ``endf71x`` and
|
||||
``ENDF71SaB`` directories.
|
||||
|
||||
.. _other_cross_sections:
|
||||
|
||||
Using Other Cross Sections
|
||||
--------------------------
|
||||
|
||||
If you have a library of ACE format cross sections other than those listed above
|
||||
that you need to convert to OpenMC's HDF5 format, the :ref:`scripts_ace` script
|
||||
can be used. There are four different ways you can specify ACE libraries that
|
||||
are to be converted:
|
||||
|
||||
1. List each ACE library as a positional argument. This is very useful in
|
||||
conjunction with the usual shell utilities (ls, find, etc.).
|
||||
2. Use the ``--xml`` option to specify a pre-v0.9 cross_sections.xml file.
|
||||
3. Use the ``--xsdir`` option to specify a MCNP xsdir file.
|
||||
4. Use the ``--xsdata`` option to specify a Serpent xsdata file.
|
||||
|
||||
The script does not use any extra information from cross_sections.xml/ xsdir/
|
||||
xsdata files to determine whether the nuclide is metastable. Instead, the
|
||||
``--metastable`` argument can be used to specify whether the ZAID naming
|
||||
convention follows the NNDC data convention (1000*Z + A + 300 + 100*m), or the
|
||||
MCNP data convention (essentially the same as NNDC, except that the first
|
||||
metastable state of Am242 is 95242 and the ground state is 95642).
|
||||
|
||||
.. _create_xs_library:
|
||||
|
||||
Manually Creating a Library
|
||||
---------------------------
|
||||
|
||||
.. currentmodule:: openmc.data
|
||||
|
||||
The scripts described above use the :mod:`openmc.data` module in the Python API
|
||||
to convert ACE data and create a :ref:`cross_sections.xml <io_cross_sections>`
|
||||
file. For those who prefer to use the API directly, the
|
||||
:class:`openmc.data.IncidentNeutron` and :class:`openmc.data.ThermalScattering`
|
||||
classes can be used to read ACE data and convert it to HDF5. For
|
||||
continuous-energy incident neutron data, use the
|
||||
:meth:`IncidentNeutron.from_ace` class method to read in an existing ACE file
|
||||
and the :meth:`IncidentNeutron.export_to_hdf5` method to write the data to an
|
||||
HDF5 file.
|
||||
|
||||
::
|
||||
|
||||
u235 = openmc.data.IncidentNeutron.from_ace('92235.710nc')
|
||||
u235.export_to_hdf5('U235.h5')
|
||||
|
||||
If you have multiple ACE files for the same nuclide at different temperatures,
|
||||
you can use the :meth:`IncidentNeutron.add_temperature_from_ace` method to
|
||||
append cross sections to an existing :class:`IncidentNeutron` instance::
|
||||
|
||||
u235 = openmc.data.IncidentNeutron.from_ace('92235.710nc')
|
||||
for suffix in [711, 712, 713, 714, 715, 716]:
|
||||
u235.add_temperature_from_ace('92235.{}nc'.format(suffix))
|
||||
u235.export_to_hdf5('U235.h5')
|
||||
|
||||
Similar methods exist for thermal scattering data:
|
||||
|
||||
::
|
||||
|
||||
light_water = openmc.data.ThermalScattering.from_ace('lwtr.20t')
|
||||
for suffix in range(21, 28):
|
||||
light_water.add_temperature_from_ace('lwtr.{}t'.format(suffix))
|
||||
light_water.export_to_hdf5('lwtr.h5')
|
||||
|
||||
Once you have created corresponding HDF5 files for each of your ACE files, you
|
||||
can create a library and export it to XML using the
|
||||
:class:`openmc.data.DataLibrary` class::
|
||||
|
||||
library = openmc.data.DataLibrary()
|
||||
library.register_file('U235.h5')
|
||||
library.register_file('lwtr.h5')
|
||||
...
|
||||
library.export_to_xml()
|
||||
|
||||
At this point, you will have a ``cross_sections.xml`` file that you can use in
|
||||
OpenMC.
|
||||
|
||||
.. hint:: The :class:`IncidentNeutron` class allows you to view/modify cross
|
||||
sections, secondary angle/energy distributions, probability tables,
|
||||
etc. For a more thorough overview of the capabilities of this class,
|
||||
see the :ref:`notebook_nuclear_data` example notebook.
|
||||
|
||||
-----------------------
|
||||
Windowed Multipole Data
|
||||
-----------------------
|
||||
|
||||
OpenMC is capable of using windowed multipole data for on-the-fly Doppler
|
||||
broadening. While such data is not yet available for all nuclides, an
|
||||
experimental multipole library is available that contains data for 70
|
||||
nuclides. To obtain this library, you can run :ref:`scripts_multipole` which
|
||||
will download and extract it into a ``wmp`` directory. Once the library has been
|
||||
downloaded, set the :envvar:`OPENMC_MULTIPOLE_LIBRARY` environment variable (or
|
||||
the :attr:`Materials.multipole_library` attribute) to the ``wmp`` directory.
|
||||
|
||||
--------------------------
|
||||
Multi-Group Cross Sections
|
||||
--------------------------
|
||||
|
||||
Multi-group cross section libraries are generally tailored to the specific
|
||||
calculation to be performed. Therefore, at this point in time, OpenMC is not
|
||||
distributed with any pre-existing multi-group cross section libraries.
|
||||
However, if obtained or generated their own library, the user
|
||||
should set the :envvar:`OPENMC_MG_CROSS_SECTIONS` environment variable
|
||||
to the absolute path of the file library expected to used most frequently.
|
||||
|
||||
For an example of how to create a multi-group library, see
|
||||
:ref:`notebook_mg_mode_part_i`.
|
||||
|
||||
.. _NJOY: https://njoy.github.io/NJOY2016/
|
||||
.. _NNDC: http://www.nndc.bnl.gov/endf/b7.1/acefiles.html
|
||||
.. _NEA: http://www.oecd-nea.org
|
||||
.. _JEFF: https://www.oecd-nea.org/dbforms/data/eva/evatapes/jeff_32/
|
||||
.. _MCNP: http://mcnp.lanl.gov
|
||||
.. _Serpent: http://montecarlo.vtt.fi
|
||||
.. _TENDL: https://tendl.web.psi.ch/tendl_2015/tendl2015.html
|
||||
|
|
@ -90,7 +90,7 @@ as optional keyword arguments to the class constructor or via attributes::
|
|||
|
||||
sphere = openmc.Sphere(R=10.0)
|
||||
|
||||
# ..or..
|
||||
# This is equivalent
|
||||
sphere = openmc.Sphere()
|
||||
sphere.r = 10.0
|
||||
|
||||
|
|
@ -118,6 +118,18 @@ For many regions, a bounding-box can be determined automatically::
|
|||
>>> northern_hemisphere.bounding_box
|
||||
(array([-1., -1., 0.]), array([1., 1., 1.]))
|
||||
|
||||
While a bounding box can be determined for regions involving half-spaces of
|
||||
spheres, cylinders, and axis-aligned planes, it generally cannot be determined
|
||||
if the region involves cones, non-axis-aligned planes, or other exotic
|
||||
second-order surfaces. For example, the :func:`openmc.get_hexagonal_prism`
|
||||
function returns the interior region of a hexagonal prism; because it is bounded
|
||||
by a :class:`openmc.Plane`, trying to get its bounding box won't work::
|
||||
|
||||
>>> hex = openmc.get_hexagonal_prism()
|
||||
>>> hex.bounding_box
|
||||
(array([-0.8660254, -inf, -inf]),
|
||||
array([ 0.8660254, inf, inf]))
|
||||
|
||||
Boundary Conditions
|
||||
-------------------
|
||||
|
||||
|
|
@ -130,7 +142,7 @@ surface. To specify a vacuum boundary condition, simply change the
|
|||
|
||||
outer_surface = openmc.Sphere(R=100.0, boundary_type='vacuum')
|
||||
|
||||
# ..or..
|
||||
# This is equivalent
|
||||
outer_surface = openmc.Sphere(R=100.0)
|
||||
outer_surface.boundary_type = 'vacuum'
|
||||
|
||||
|
|
@ -151,7 +163,7 @@ the :class:`openmc.Cell` class::
|
|||
|
||||
fuel = openmc.Cell(fill=uo2, region=pellet)
|
||||
|
||||
# ..or..
|
||||
# This is equivalent
|
||||
fuel = openmc.Cell()
|
||||
fuel.fill = uo2
|
||||
fuel.region = pellet
|
||||
|
|
@ -179,7 +191,7 @@ methods. Alternatively, a list of cells can be specified in the constructor::
|
|||
|
||||
universe = openmc.Universe(cells=[cell1, cell2, cell3])
|
||||
|
||||
# ..or..
|
||||
# This is equivalent
|
||||
universe = openmc.Universe()
|
||||
universe.add_cells([cell1, cell2])
|
||||
universe.add_cell(cell3)
|
||||
|
|
@ -193,9 +205,25 @@ Universes are generally used in three ways:
|
|||
3. To be used in a regular arrangement of universes in a :ref:`lattice
|
||||
<usersguide_lattices>`.
|
||||
|
||||
Note that as you are building a geometry, it is possible to display a plot of
|
||||
single universe using the :meth:`Universe.plot` method. This method requires
|
||||
that you have `matplotlib <http://matplotlib.org/>`_ installed.
|
||||
Once a universe is constructed, it can actually be used to determine what cell
|
||||
or material is found at a given location by using the :meth:`Universe.find`
|
||||
method, which returns a list of universes, cells, and lattices which are
|
||||
traversed to find a given point. The last element of that list would contain the
|
||||
lowest-level cell at that location::
|
||||
|
||||
>>> universe.find((0., 0., 0.))[-1]
|
||||
Cell
|
||||
ID = 10000
|
||||
Name = cell 1
|
||||
Fill = Material 10000
|
||||
Region = -10000
|
||||
Rotation = None
|
||||
Temperature = None
|
||||
Translation = None
|
||||
|
||||
As you are building a geometry, it is also possible to display a plot of single
|
||||
universe using the :meth:`Universe.plot` method. This method requires that you
|
||||
have `matplotlib <http://matplotlib.org/>`_ installed.
|
||||
|
||||
.. _usersguide_lattices:
|
||||
|
||||
|
|
@ -212,7 +240,7 @@ through the :class:`openmc.RectLattice` and :class:`openmc.HexLattice` classes.
|
|||
Rectangular Lattices
|
||||
--------------------
|
||||
|
||||
A rectangular lattice defines a two-dimension or three-dimensional array of
|
||||
A rectangular lattice defines a two-dimensional or three-dimensional array of
|
||||
universes that are filled into rectangular prisms (lattice elements) each of
|
||||
which has the same width, length, and height. To completely define a rectangular
|
||||
lattice, one needs to specify
|
||||
|
|
@ -239,9 +267,10 @@ lattice element is 5cm by 5cm and is filled by a universe ``u``, one could run::
|
|||
Note that because this is a two-dimensional lattice, the lower-left coordinates
|
||||
and pitch only need to specify the :math:`x,y` values. The order that the
|
||||
universes appear is such that the first row corresponds to lattice elements with
|
||||
the highest y-value. Note that the :attr:`RectLattice.universes` attribute
|
||||
expects a doubly-nested iterable of type :class:`openmc.Universe` --- this can
|
||||
be normal Python lists, as shown above, or a NumPy array can be used as well::
|
||||
the highest :math:`y` -value. Note that the :attr:`RectLattice.universes`
|
||||
attribute expects a doubly-nested iterable of type :class:`openmc.Universe` ---
|
||||
this can be normal Python lists, as shown above, or a NumPy array can be used as
|
||||
well::
|
||||
|
||||
lattice.universes = np.tile(u, (3, 3))
|
||||
|
||||
|
|
@ -280,7 +309,7 @@ set with the :attr:`RectLattice.outer` attribute.
|
|||
Hexagonal Lattices
|
||||
------------------
|
||||
|
||||
OpenMC also allows creationg of 2D and 3D hexagonal lattices. Creating a
|
||||
OpenMC also allows creation of 2D and 3D hexagonal lattices. Creating a
|
||||
hexagonal lattice is similar to creating a rectangular lattice with a few
|
||||
differences:
|
||||
|
||||
|
|
@ -288,6 +317,8 @@ differences:
|
|||
- For a 2D hexagonal lattice, a single value for the pitch should be specified,
|
||||
although it still needs to appear in a list. For a 3D hexagonal lattice, the
|
||||
pitch in the radial and axial directions should be given.
|
||||
- For a hexagonal lattice, the :attr:`HexLattice.universes` attribute cannot be
|
||||
given as a NumPy array for reasons explained below.
|
||||
- As with rectangular lattices, the :attr:`HexLattice.outer` attribute will
|
||||
specify an outer universe.
|
||||
|
||||
|
|
@ -312,10 +343,11 @@ to help figure out how to place universes::
|
|||
|
||||
|
||||
Note that by default, hexagonal lattices are positioned such that each lattice
|
||||
element has two faces that are parallel to the y-axis. As one example, to create
|
||||
a three-ring lattice centered at the origin with a pitch of 10 cm where all the
|
||||
lattice elements centered along the y-axis are filled with universe ``u`` and
|
||||
the remainder and filled with universe ``q``, the following code would work::
|
||||
element has two faces that are parallel to the :math:`y` axis. As one example,
|
||||
to create a three-ring lattice centered at the origin with a pitch of 10 cm
|
||||
where all the lattice elements centered along the :math:`y` axis are filled with
|
||||
universe ``u`` and the remainder are filled with universe ``q``, the following
|
||||
code would work::
|
||||
|
||||
hexlat = openmc.HexLattice()
|
||||
hexlat.center = (0, 0)
|
||||
|
|
@ -344,7 +376,7 @@ if needed, lattices, the last step is to create an instance of
|
|||
geom = openmc.Geometry(root_univ)
|
||||
geom.export_to_xml()
|
||||
|
||||
# ..or..
|
||||
# This is equivalent
|
||||
geom = openmc.Geometry()
|
||||
geom.root_universe = root_univ
|
||||
geom.export_to_xml()
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ essential aspects of using OpenMC to perform simulations.
|
|||
|
||||
beginners
|
||||
install
|
||||
cross_sections
|
||||
basics
|
||||
materials
|
||||
geometry
|
||||
|
|
|
|||
|
|
@ -4,6 +4,8 @@
|
|||
Installation and Configuration
|
||||
==============================
|
||||
|
||||
.. currentmodule:: openmc
|
||||
|
||||
----------------------------------------
|
||||
Installing on Linux/Mac with conda-forge
|
||||
----------------------------------------
|
||||
|
|
@ -188,6 +190,8 @@ switch to the source of the latest stable release, run the following commands::
|
|||
.. _git: http://git-scm.com
|
||||
.. _ssh: http://en.wikipedia.org/wiki/Secure_Shell
|
||||
|
||||
.. _usersguide_build:
|
||||
|
||||
Build Configuration
|
||||
-------------------
|
||||
|
||||
|
|
@ -418,8 +422,8 @@ distributions.
|
|||
:meth:`Universe.plot` method and the :func:`openmc.plot_xs` function.
|
||||
|
||||
`uncertainties <https://pythonhosted.org/uncertainties/>`_
|
||||
Uncertainties are optionally used for decay data in the :ref:`openmc.data
|
||||
<pythonapi_data>`.
|
||||
Uncertainties are optionally used for decay data in the :mod:`openmc.data`
|
||||
module.
|
||||
|
||||
`Cython <http://cython.org/>`_
|
||||
Cython is used for resonance reconstruction for ENDF data converted to
|
||||
|
|
@ -436,121 +440,7 @@ distributions.
|
|||
`lxml <http://lxml.de/>`_
|
||||
lxml is used for the :ref:`scripts_validate` script.
|
||||
|
||||
---------------------------
|
||||
Cross Section Configuration
|
||||
---------------------------
|
||||
|
||||
In order to run a simulation with OpenMC, you will need cross section data for
|
||||
each nuclide or material in your problem. OpenMC can be run in continuous-energy
|
||||
or multi-group mode.
|
||||
|
||||
In continuous-energy mode, OpenMC uses a native HDF5 format to store all nuclear
|
||||
data. If you have ACE format data that was produced with NJOY_, such as that
|
||||
distributed with MCNP_ or Serpent_, it can be converted to the HDF5 format using
|
||||
the :ref:`scripts_ace` script. Several sources provide openly available ACE
|
||||
data as described below. The TALYS-based evaluated nuclear data library, TENDL_,
|
||||
is also available in ACE format.
|
||||
|
||||
In multi-group mode, OpenMC utilizes an XML-based library format which can be
|
||||
used to describe nuclide- or material-specific quantities.
|
||||
|
||||
Using ENDF/B-VII.1 Cross Sections from NNDC
|
||||
-------------------------------------------
|
||||
|
||||
The NNDC_ provides ACE data from the ENDF/B-VII.1 neutron and thermal scattering
|
||||
sublibraries at room temperature processed using NJOY_. To use this data with
|
||||
OpenMC, the :ref:`scripts_nndc` script can be used to automatically download and
|
||||
extract the ACE data, fix any deficiencies, and create an HDF5 library:
|
||||
|
||||
.. code-block:: sh
|
||||
|
||||
openmc-get-nndc-data
|
||||
|
||||
At this point, you should set the :envvar:`OPENMC_CROSS_SECTIONS` environment
|
||||
variable to the absolute path of the file ``nndc_hdf5/cross_sections.xml``. This
|
||||
cross section set is used by the test suite.
|
||||
|
||||
Using JEFF Cross Sections from OECD/NEA
|
||||
---------------------------------------
|
||||
|
||||
The NEA_ provides processed ACE data from the JEFF_ library. To use this data
|
||||
with OpenMC, the :ref:`scripts_jeff` script can be used to automatically
|
||||
download and extract the ACE data, fix any deficiencies, and create an HDF5
|
||||
library.
|
||||
|
||||
.. code-block:: sh
|
||||
|
||||
openmc-get-jeff-data
|
||||
|
||||
At this point, you should set the :envvar:`OPENMC_CROSS_SECTIONS` environment
|
||||
variable to the absolute path of the file ``jeff-3.2-hdf5/cross_sections.xml``.
|
||||
|
||||
Using Cross Sections from MCNP
|
||||
------------------------------
|
||||
|
||||
OpenMC provides two scripts (:ref:`scripts_mcnp70` and :ref:`scripts_mcnp71`)
|
||||
that will automatically convert ENDF/B-VII.0 and ENDF/B-VII.1 ACE data that is
|
||||
provided with MCNP5 or MCNP6. To convert the ENDF/B-VII.0 ACE files
|
||||
(``endf70[a-k]`` and ``endf70sab``) into the native HDF5 format, run the
|
||||
following:
|
||||
|
||||
.. code-block:: sh
|
||||
|
||||
openmc-convert-mcnp70-data /path/to/mcnpdata/
|
||||
|
||||
where ``/path/to/mcnpdata`` is the directory containing the ``endf70[a-k]``
|
||||
files.
|
||||
|
||||
To convert the ENDF/B-VII.1 ACE files (the endf71x and ENDF71SaB libraries), use
|
||||
the following script:
|
||||
|
||||
.. code-block:: sh
|
||||
|
||||
openmc-convert-mcnp71-data /path/to/mcnpdata
|
||||
|
||||
where ``/path/to/mcnpdata`` is the directory containing the ``endf71x`` and
|
||||
``ENDF71SaB`` directories.
|
||||
|
||||
.. _other_cross_sections:
|
||||
|
||||
Using Other Cross Sections
|
||||
--------------------------
|
||||
|
||||
If you have a library of ACE format cross sections other than those listed above
|
||||
that you need to convert to OpenMC's HDF5 format, the :ref:`scripts_ace` script
|
||||
can be used. There are four different ways you can specify ACE libraries that
|
||||
are to be converted:
|
||||
|
||||
1. List each ACE library as a positional argument. This is very useful in
|
||||
conjunction with the usual shell utilities (ls, find, etc.).
|
||||
2. Use the ``--xml`` option to specify a pre-v0.9 cross_sections.xml file.
|
||||
3. Use the ``--xsdir`` option to specify a MCNP xsdir file.
|
||||
4. Use the ``--xsdata`` option to specify a Serpent xsdata file.
|
||||
|
||||
The script does not use any extra information from cross_sections.xml/ xsdir/
|
||||
xsdata files to determine whether the nuclide is metastable. Instead, the
|
||||
``--metastable`` argument can be used to specify whether the ZAID naming
|
||||
convention follows the NNDC data convention (1000*Z + A + 300 + 100*m), or the
|
||||
MCNP data convention (essentially the same as NNDC, except that the first
|
||||
metastable state of Am242 is 95242 and the ground state is 95642).
|
||||
|
||||
Using Multi-Group Cross Sections
|
||||
--------------------------------
|
||||
|
||||
Multi-group cross section libraries are generally tailored to the specific
|
||||
calculation to be performed. Therefore, at this point in time, OpenMC is not
|
||||
distributed with any pre-existing multi-group cross section libraries.
|
||||
However, if the user has obtained or generated their own library, the user
|
||||
should set the :envvar:`OPENMC_MG_CROSS_SECTIONS` environment variable
|
||||
to the absolute path of the file library expected to used most frequently.
|
||||
|
||||
.. _NJOY: http://t2.lanl.gov/nis/codes/NJOY12/
|
||||
.. _NNDC: http://www.nndc.bnl.gov/endf/b7.1/acefiles.html
|
||||
.. _NEA: http://www.oecd-nea.org
|
||||
.. _JEFF: https://www.oecd-nea.org/dbforms/data/eva/evatapes/jeff_32/
|
||||
.. _MCNP: http://mcnp.lanl.gov
|
||||
.. _Serpent: http://montecarlo.vtt.fi
|
||||
.. _TENDL: https://tendl.web.psi.ch/tendl_2015/tendl2015.html
|
||||
.. _usersguide_nxml:
|
||||
|
||||
-----------------------------------------------------
|
||||
Configuring Input Validation with GNU Emacs nXML mode
|
||||
|
|
@ -575,4 +465,5 @@ schemas.xml file in your own OpenMC source directory.
|
|||
.. _GNU Emacs: http://www.gnu.org/software/emacs/
|
||||
.. _validation: http://en.wikipedia.org/wiki/XML_validation
|
||||
.. _RELAX NG: http://relaxng.org/
|
||||
.. _NNDC: http://www.nndc.bnl.gov/endf/b7.1/acefiles.html
|
||||
.. _ctest: http://www.cmake.org/cmake/help/v2.8.12/ctest.html
|
||||
|
|
|
|||
|
|
@ -21,8 +21,8 @@ The third argument to :meth:`Material.add_nuclide` can also be 'wo' for weight
|
|||
percent. The densities specified for each nuclide/element are relative and are
|
||||
renormalized based on the total density of the material. The total density is
|
||||
set using the :meth:`Material.set_density` method. The density can be specified
|
||||
in gram per cubic centimeter, atom per barn-cm, or kilogram per cubic meter,
|
||||
e.g.,
|
||||
in gram per cubic centimeter ('g/cm3'), atom per barn-cm ('atom/b-cm'), or
|
||||
kilogram per cubic meter ('kg/m3'), e.g.,
|
||||
|
||||
::
|
||||
|
||||
|
|
@ -96,7 +96,6 @@ compounds:
|
|||
|
||||
.. _GND: https://www.oecd-nea.org/science/wpec/sg38/Meetings/2016_May/tlh4gnd-main.pdf
|
||||
|
||||
|
||||
-----------
|
||||
Temperature
|
||||
-----------
|
||||
|
|
@ -111,7 +110,8 @@ any cell or material temperature specification, a global default temperature can
|
|||
be set that is applied to all cells and materials. Anytime a material
|
||||
temperature is specified, it will override the global default
|
||||
temperature. Similarly, anytime a cell temperatures is specified, it will
|
||||
override the material or global default temperatures.
|
||||
override the material or global default temperature. All temperatures should be
|
||||
given in units of Kelvin.
|
||||
|
||||
To assign a default material temperature, one should use the ``temperature``
|
||||
attribute, e.g.,
|
||||
|
|
@ -134,11 +134,11 @@ Material Collections
|
|||
The :ref:`scripts_openmc` executable expects to find a ``materials.xml`` file
|
||||
when it is run. To create this file, one needs to instantiate the
|
||||
:class:`openmc.Materials` class and add materials to it. The :class:`Materials`
|
||||
class acts like a list (in fact, it is a subclass of Python's built-in ``list``
|
||||
class), so materials can be added by passing a list to the constructor, using
|
||||
methods like ``append()``, or through the operator ``+=``. Once materials have
|
||||
been added to the collection, it can be exported using the
|
||||
:meth:`Materials.export_to_xml` method.
|
||||
class acts like a list (in fact, it is a subclass of Python's built-in
|
||||
:class:`list` class), so materials can be added by passing a list to the
|
||||
constructor, using methods like ``append()``, or through the operator
|
||||
``+=``. Once materials have been added to the collection, it can be exported
|
||||
using the :meth:`Materials.export_to_xml` method.
|
||||
|
||||
::
|
||||
|
||||
|
|
@ -158,8 +158,8 @@ OpenMC uses a file called :ref:`cross_sections.xml <io_cross_sections>` to
|
|||
indicate where cross section data can be found on the filesystem. This file
|
||||
serves the same role that ``xsdir`` does for MCNP_ or ``xsdata`` does for
|
||||
Serpent. Information on how to generate a cross section listing file can be
|
||||
found in FIXME. Once you have a cross sections file that has been generated, you
|
||||
can tell OpenMC to use this file either by setting
|
||||
found in :ref:`create_xs_library`. Once you have a cross sections file that has
|
||||
been generated, you can tell OpenMC to use this file either by setting
|
||||
:attr:`Materials.cross_sections` or by setting the
|
||||
:envvar:`OPENMC_CROSS_SECTIONS` environment variable to the path of the
|
||||
``cross_sections.xml`` file. The former approach would look like::
|
||||
|
|
|
|||
|
|
@ -23,12 +23,12 @@ When using OpenMP, multiple threads will be launched and each is capable of
|
|||
simulating a particle independently of all other threads. The primary benefit of
|
||||
using OpenMP within a node is that it requires very little extra memory per
|
||||
thread. To use OpenMP, you need to pass the ``-Dopenmp=on`` flag when running
|
||||
``CMake``::
|
||||
``CMake``:
|
||||
|
||||
.. code-block:: sh
|
||||
|
||||
cmake -Dopenmp=on /path/to/openmc/root
|
||||
make
|
||||
cmake -Dopenmp=on /path/to/openmc/root
|
||||
make
|
||||
|
||||
The only requirement is that the Fortran compiler you use must support the
|
||||
OpenMP 3.1 or higher standard. Most recent compilers do support the use of
|
||||
|
|
@ -65,7 +65,7 @@ OpenMC following :ref:`usersguide_compile_mpi`.
|
|||
|
||||
To run a simulation using MPI, :ref:`scripts_openmc` needs to be called using
|
||||
the `mpiexec <https://www.mpich.org/static/docs/v3.1/www1/mpiexec.html>`_
|
||||
wrapper. For example, to run OpenMC using 32 processes::
|
||||
wrapper. For example, to run OpenMC using 32 processes:
|
||||
|
||||
.. code-block:: sh
|
||||
|
||||
|
|
|
|||
|
|
@ -8,12 +8,11 @@ Geometry Visualization
|
|||
|
||||
OpenMC is capable of producing two-dimensional slice plots of a geometry as well
|
||||
as three-dimensional voxel plots using the geometry plotting :ref:`run mode
|
||||
<usersguide_run_modes>` is a geometry plotting mode. The geometry plotting mode
|
||||
relies on the presence of a :ref:`plots.xml <io_plots>` file that indicates what
|
||||
plots should be created. To create this file, one needs to create one or more
|
||||
:class:`openmc.Plot` instances, add them to a :class:`openmc.Plots` collection,
|
||||
and then use the :class:`Plots.export_to_xml` method to write the ``plots.xml``
|
||||
file.
|
||||
<usersguide_run_modes>`. The geometry plotting mode relies on the presence of a
|
||||
:ref:`plots.xml <io_plots>` file that indicates what plots should be created. To
|
||||
create this file, one needs to create one or more :class:`openmc.Plot`
|
||||
instances, add them to a :class:`openmc.Plots` collection, and then use the
|
||||
:class:`Plots.export_to_xml` method to write the ``plots.xml`` file.
|
||||
|
||||
-----------
|
||||
Slice Plots
|
||||
|
|
@ -27,11 +26,11 @@ that a 2D slice plot should be made. You can specify the origin of the plot
|
|||
(:attr:`Plot.origin`), the width of the plot in each direction
|
||||
(:attr:`Plot.width`), the number of pixels to use in each direction
|
||||
(:attr:`Plot.pixels`), and the basis directions for the plot. For example, to
|
||||
create a x-z plot centered at (5.0, 2.0, 3.0) with a width of (50., 50.) and
|
||||
400x400 pixels::
|
||||
create a :math:`x` - :math:`z` plot centered at (5.0, 2.0, 3.0) with a width of
|
||||
(50., 50.) and 400x400 pixels::
|
||||
|
||||
plot = openmc.Plot()
|
||||
plot.basis = 'yz'
|
||||
plot.basis = 'xz'
|
||||
plot.origin = (5.0, 2.0, 3.0)
|
||||
plot.width = (50., 50.)
|
||||
plot.pixels = (400, 400)
|
||||
|
|
@ -44,7 +43,7 @@ that location.
|
|||
.. note:: In this example, pixels are 50/400=0.125 cm wide. Thus, this plot may
|
||||
miss any features smaller than 0.125 cm, since they could exist
|
||||
between pixel centers. More pixels can be used to resolve finer
|
||||
features, but could result in larger files.
|
||||
features but will result in larger files.
|
||||
|
||||
By default, a unique color will be assigned to each cell in the geometry. If you
|
||||
want your plot to be colored by material instead, change the
|
||||
|
|
@ -60,7 +59,7 @@ particular cells/materials should be given colors of your choosing::
|
|||
clad: 'black'
|
||||
}
|
||||
|
||||
# ..or..
|
||||
# This is equivalent
|
||||
plot.colors = {
|
||||
water: (0, 0, 255),
|
||||
clad: (0, 0, 0)
|
||||
|
|
@ -75,7 +74,7 @@ assign them to a :class:`openmc.Plots` collection and export it to XML::
|
|||
plots = openmc.Plots([plot1, plot2, plot3])
|
||||
plots.export_to_xml()
|
||||
|
||||
# ..or..
|
||||
# This is equivalent
|
||||
plots = openmc.Plots()
|
||||
plots.append(plot1)
|
||||
plots += [plot2, plot3]
|
||||
|
|
@ -98,7 +97,7 @@ derivatives: ``sudo apt install imagemagick``). Images are then converted like:
|
|||
|
||||
convert myplot.ppm myplot.png
|
||||
|
||||
Alternatively, if you're working with in a `Jupyter <http://jupyter.org/>`_
|
||||
Alternatively, if you're working within a `Jupyter <http://jupyter.org/>`_
|
||||
Notebook or QtConsole, you can use the :func:`openmc.plot_inline` to run OpenMC
|
||||
in plotting mode and display the resulting plot within the notebook.
|
||||
|
||||
|
|
|
|||
|
|
@ -28,9 +28,8 @@ Alternatively, you could run from any directory:
|
|||
openmc /home/username/somemodel
|
||||
|
||||
Note that in the latter case, any output files will be placed in the present
|
||||
working directory which may be different from ``/home/username/somemodel``. If
|
||||
you're using the Python API, :func:`openmc.run` is equivalent to running
|
||||
``openmc`` from the command line. ``openmc`` accepts the following command line
|
||||
working directory which may be different from
|
||||
``/home/username/somemodel``. ``openmc`` accepts the following command line
|
||||
flags:
|
||||
|
||||
-c, --volume Run in stochastic volume calculation mode
|
||||
|
|
@ -45,6 +44,9 @@ flags:
|
|||
-v, --version Show version information
|
||||
-h, --help Show help message
|
||||
|
||||
.. note:: If you're using the Python API, :func:`openmc.run` is equivalent to
|
||||
running ``openmc`` from the command line.
|
||||
|
||||
.. _scripts_ace:
|
||||
|
||||
----------------------
|
||||
|
|
@ -56,7 +58,7 @@ you have existing ACE files. There are four different ways you can specify ACE
|
|||
libraries that are to be converted:
|
||||
|
||||
1. List each ACE library as a positional argument. This is very useful in
|
||||
conjunction with the usual shell utilities (ls, find, etc.).
|
||||
conjunction with the usual shell utilities (``ls``, ``find``, etc.).
|
||||
2. Use the ``--xml`` option to specify a pre-v0.9 cross_sections.xml file.
|
||||
3. Use the ``--xsdir`` option to specify a MCNP xsdir file.
|
||||
4. Use the ``--xsdata`` option to specify a Serpent xsdata file.
|
||||
|
|
@ -78,7 +80,7 @@ otherwise.
|
|||
-h, --help show help message and exit
|
||||
|
||||
-d DESTINATION, --destination DESTINATION
|
||||
Directory to create new library in (default: .)
|
||||
Directory to create new library in
|
||||
|
||||
-m META, --metastable META
|
||||
How to interpret ZAIDs for metastable nuclides. META
|
||||
|
|
@ -147,6 +149,8 @@ the following optional arguments:
|
|||
and processing the data may require as much as 40 GB of additional
|
||||
free disk space.
|
||||
|
||||
.. _scripts_multipole:
|
||||
|
||||
-----------------------------
|
||||
``openmc-get-multipole-data``
|
||||
-----------------------------
|
||||
|
|
|
|||
|
|
@ -50,6 +50,8 @@ would need to instantiate a :class:`openmc.Settings` object and assign the
|
|||
settings = openmc.Settings()
|
||||
settings.run_mode = 'fixed source'
|
||||
|
||||
If you don't specify a run mode, the default run mode is 'eigenvalue'.
|
||||
|
||||
.. _usersguide_particles:
|
||||
|
||||
-------------------
|
||||
|
|
@ -106,8 +108,9 @@ The :class:`openmc.Source` class has three main attributes that one can set:
|
|||
|
||||
The spatial distribution can be set equal to a sub-class of
|
||||
:class:`openmc.stats.Spatial`; common choices are :class:`openmc.stats.Point` or
|
||||
:class:`openmc.stats.Box`. To independently specify distributions in the x, y,
|
||||
and z coordinates, you can use :class:`openmc.stats.CartesianIndependent`.
|
||||
:class:`openmc.stats.Box`. To independently specify distributions in the
|
||||
:math:`x`, :math:`y`, and :math:`z` coordinates, you can use
|
||||
:class:`openmc.stats.CartesianIndependent`.
|
||||
|
||||
The angular distribution can be set equal to a sub-class of
|
||||
:class:`openmc.stats.UnitSphere` such as :class:`openmc.stats.Isotropic`,
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ instance through the :attr:`Tally.filters` attribute::
|
|||
tally.filters.append(cell_filter)
|
||||
tally.filters.append(energy_filter)
|
||||
|
||||
# ..or..
|
||||
# This is equivalent
|
||||
tally.filters = [cell_filter, energy_filter]
|
||||
|
||||
.. note:: You are actually not required to assign any filters to a tally. If you
|
||||
|
|
@ -82,7 +82,7 @@ particular nuclide or set of nuclides, you can set the :attr:`Tally.nuclides`
|
|||
attribute to a list of strings indicating which nuclides. The nuclide names
|
||||
should follow the same :ref:`naming convention <usersguide_naming>` as that used
|
||||
for material specification. If we wanted the reaction rates only for U235 and
|
||||
U238, we'd set::
|
||||
U238 (separately), we'd set::
|
||||
|
||||
tally.nuclides = ['U235', 'U238']
|
||||
|
||||
|
|
|
|||
|
|
@ -50,17 +50,16 @@ to 'volume' and run :func:`openmc.run`, or alternatively run
|
|||
|
||||
When your volume calculations have finished, you can load the results using the
|
||||
:meth:`VolumeCalculation.load_results` method on an existing object. If you
|
||||
don't have an exiting :class:`VolumeCalculation` object, you can create one and
|
||||
don't have an existing :class:`VolumeCalculation` object, you can create one and
|
||||
load results simultaneously using the :meth:`VolumeCalculation.from_hdf5` class
|
||||
method::
|
||||
|
||||
vol_calc = openmc.VolumeCalculation(...)
|
||||
...
|
||||
openmc.calculate_volumes()
|
||||
|
||||
vol_calc.load_results('volume_1.h5')
|
||||
|
||||
# ..or..
|
||||
# ..or we can create a new object
|
||||
vol_calc = openmc.VolumeCalculation.from_hdf5('volume_1.h5')
|
||||
|
||||
After the results are loaded, volume estimates will be stored in
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue