mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 14:15:42 -04:00
Continue working through new user's manual
This commit is contained in:
parent
8a2035a191
commit
6c40fb640a
13 changed files with 483 additions and 84 deletions
|
|
@ -1,5 +1,5 @@
|
|||
.. _io_cross_sections:
|
||||
|
||||
============================================
|
||||
Cross Sections Locator -- cross_sections.xml
|
||||
Cross Sections Listing -- cross_sections.xml
|
||||
============================================
|
||||
|
|
|
|||
|
|
@ -4,55 +4,6 @@
|
|||
Geometry Specification -- geometry.xml
|
||||
======================================
|
||||
|
||||
The geometry in OpenMC is described using `constructive solid geometry`_ (CSG),
|
||||
also sometimes referred to as combinatorial geometry. CSG allows a user to
|
||||
create complex objects using Boolean operators on a set of simpler surfaces. In
|
||||
the geometry model, each unique volume is defined by its bounding surfaces. In
|
||||
OpenMC, most `quadratic surfaces`_ can be modeled and used as bounding surfaces.
|
||||
|
||||
Every geometry.xml must have an XML declaration at the beginning of the file and
|
||||
a root element named geometry. Within the root element the user can define any
|
||||
number of cells, surfaces, and lattices. Let us look at the following example:
|
||||
|
||||
.. code-block:: xml
|
||||
|
||||
<?xml version="1.0"?>
|
||||
<geometry>
|
||||
<!-- This is a comment -->
|
||||
|
||||
<surface>
|
||||
<id>1</id>
|
||||
<type>sphere</type>
|
||||
<coeffs>0.0 0.0 0.0 5.0</coeffs>
|
||||
<boundary>vacuum</boundary>
|
||||
<surface>
|
||||
|
||||
<cell>
|
||||
<id>1</id>
|
||||
<universe>0</universe>
|
||||
<material>1</material>
|
||||
<region>-1</region>
|
||||
</cell>
|
||||
</geometry>
|
||||
|
||||
At the beginning of this file is a comment, denoted by a tag starting with
|
||||
``<!--`` and ending with ``-->``. Comments, as well as any other type of input,
|
||||
may span multiple lines. One convenient feature of the XML input format is that
|
||||
sub-elements of the ``cell`` and ``surface`` elements can also be equivalently
|
||||
expressed of attributes of the original element, e.g. the geometry file above
|
||||
could be written as:
|
||||
|
||||
.. code-block:: xml
|
||||
|
||||
<?xml version="1.0"?>
|
||||
<geometry>
|
||||
<!-- This is a comment -->
|
||||
|
||||
<surface id="1" type="sphere" coeffs="0.0 0.0 0.0 5.0" boundary="vacuum" />
|
||||
<cell id="1" universe="0" material="1" region="-1" />
|
||||
|
||||
</geometry>
|
||||
|
||||
.. _surface_element:
|
||||
|
||||
---------------------
|
||||
|
|
@ -412,7 +363,3 @@ Here is an example of a properly defined 2d hexagonal lattice:
|
|||
202
|
||||
</universes>
|
||||
</hex_lattice>
|
||||
|
||||
.. _constructive solid geometry: http://en.wikipedia.org/wiki/Constructive_solid_geometry
|
||||
|
||||
.. _quadratic surfaces: http://en.wikipedia.org/wiki/Quadric
|
||||
|
|
|
|||
|
|
@ -4,11 +4,11 @@
|
|||
Geometry Plotting Specification -- plots.xml
|
||||
============================================
|
||||
|
||||
Basic plotting capabilities are available in OpenMC by creating a plots.xml
|
||||
file and subsequently running with the command-line flag ``-plot``. The root
|
||||
element of the plots.xml is simply ``<plots>`` and any number output plots can
|
||||
be defined with ``<plot>`` sub-elements. Two plot types are currently
|
||||
implemented in openMC:
|
||||
Basic plotting capabilities are available in OpenMC by creating a plots.xml file
|
||||
and subsequently running with the ``--plot``command-line flag. The root element
|
||||
of the plots.xml is simply ``<plots>`` and any number output plots can be
|
||||
defined with ``<plot>`` sub-elements. Two plot types are currently implemented
|
||||
in openMC:
|
||||
|
||||
* ``slice`` 2D pixel plot along one of the major axes. Produces a PPM image
|
||||
file.
|
||||
|
|
@ -72,10 +72,10 @@ sub-elements:
|
|||
default Gnome viewer, IrfanView, etc.). The "voxel" plot type produces a
|
||||
binary datafile containing voxel grid positioning and the cell or material
|
||||
(specified by the ``color`` tag) at the center of each voxel. These
|
||||
datafiles can be processed into 3D SILO files using the
|
||||
``openmc-voxel-to-silovtk`` utility provided with the OpenMC source, and
|
||||
subsequently viewed with a 3D viewer such as VISIT or Paraview. See the
|
||||
:ref:`io_voxel` for information about the datafile structure.
|
||||
datafiles can be processed into 3D SILO files using the :ref:`scripts_voxel`
|
||||
script provided with OpenMC, and subsequently viewed with a 3D viewer such
|
||||
as VISIT or Paraview. See the :ref:`io_voxel` for information about the
|
||||
datafile structure.
|
||||
|
||||
.. note:: Since the PPM format is saved without any kind of compression,
|
||||
the resulting file sizes can be quite large. Saving the image in
|
||||
|
|
|
|||
|
|
@ -247,6 +247,8 @@ Spatial Distributions
|
|||
openmc.stats.Box
|
||||
openmc.stats.Point
|
||||
|
||||
.. _pythonapi_mgxs:
|
||||
|
||||
----------------------------------------------------------
|
||||
:mod:`openmc.mgxs` -- Multi-Group Cross Section Generation
|
||||
----------------------------------------------------------
|
||||
|
|
@ -350,6 +352,8 @@ Classes
|
|||
|
||||
openmc.model.Model
|
||||
|
||||
.. _pythonapi_data:
|
||||
|
||||
--------------------------------------------
|
||||
:mod:`openmc.data` -- Nuclear Data Interface
|
||||
--------------------------------------------
|
||||
|
|
|
|||
|
|
@ -4,9 +4,9 @@
|
|||
Basics of Using OpenMC
|
||||
======================
|
||||
|
||||
-----------
|
||||
Input Files
|
||||
-----------
|
||||
----------------
|
||||
Creating a Model
|
||||
----------------
|
||||
|
||||
When you build and install OpenMC, you will have an :ref:`scripts_openmc`
|
||||
executable on your system. When you run ``openmc``, the first thing it will do
|
||||
|
|
@ -88,18 +88,23 @@ Creating Input Files
|
|||
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".
|
||||
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.
|
||||
|
||||
Alternatively, input files can be generated using OpenMC's :ref:`pythonapi`. The
|
||||
Python API defines a set of functions and classes that roughly correspond to
|
||||
elements in the XML files. For example, the :class:`openmc.Cell` Python class
|
||||
directly corresponds to the :ref:`cell_element` in XML. Each XML file itself
|
||||
also has a corresponding class: :class:`openmc.Geometry` for ``geometry.xml``,
|
||||
:class:`openmc.Materials` for ``materials.xml``, :class:`openmc.Settings` for
|
||||
``settings.xml``, and so on. To create a model then, one creates instances of
|
||||
these classes and then uses the ``export_to_xml()`` method,
|
||||
e.g. :meth:`Geometry.export_to_xml`. Most scripts that generate a full model
|
||||
will look something like the following:
|
||||
----------
|
||||
Python API
|
||||
----------
|
||||
|
||||
OpenMC's Python API defines a set of functions and classes that roughly
|
||||
correspond to elements in the XML files. For example, the :class:`openmc.Cell`
|
||||
Python class directly corresponds to the :ref:`cell_element` in XML. Each XML
|
||||
file itself also has a corresponding class: :class:`openmc.Geometry` for
|
||||
``geometry.xml``, :class:`openmc.Materials` for ``materials.xml``,
|
||||
:class:`openmc.Settings` for ``settings.xml``, and so on. To create a model
|
||||
then, one creates instances of these classes and then uses the
|
||||
``export_to_xml()`` method, e.g. :meth:`Geometry.export_to_xml`. Most scripts
|
||||
that generate a full model will look something like the following:
|
||||
|
||||
.. code-block:: Python
|
||||
|
||||
|
|
@ -122,9 +127,61 @@ 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
|
||||
-------------------
|
||||
|
||||
In the XML user input files, each object (cell, surface, tally, etc.) has to be
|
||||
uniquely identified by a positive integer (ID) in the same manner as MCNP and
|
||||
Serpent. In the Python API, integer IDs can be assigned but it is not strictly
|
||||
required. When IDs are not explicitly assigned to instances of the OpenMC Python
|
||||
classes, they will be automatically assigned.
|
||||
|
||||
-----------------------------
|
||||
Viewing and Analyzing Results
|
||||
-----------------------------
|
||||
|
||||
After a simulation has been completed by running :ref:`scripts_openmc`, you will
|
||||
have several output files that were created:
|
||||
|
||||
``tallies.out``
|
||||
An ASCII file showing the mean and standard deviation of the mean for any
|
||||
user-defined tallies.
|
||||
|
||||
``summary.h5``
|
||||
An HDF5 file with a complete description of the geometry and materials used in
|
||||
the simulation.
|
||||
|
||||
``statepoint.#.h5``
|
||||
An HDF5 file with the complete results of the simulation, including tallies as
|
||||
well as the final source distribution. This file can be used both to
|
||||
view/analyze results as well as restart a simulation if desired.
|
||||
|
||||
For a simple simulation with few tallies, looking at the ``tallies.out`` file
|
||||
might be sufficient. For anything more complicated (plotting results, finding a
|
||||
subset of results, etc.), you will likely find it easier to work with the
|
||||
statepoint file directly using the :class:`openmc.StatePoint` class. For more
|
||||
details on working with statepoints, see FIXME.
|
||||
|
||||
--------------
|
||||
Physical Units
|
||||
--------------
|
||||
|
|
|
|||
203
docs/source/usersguide/geometry.rst
Normal file
203
docs/source/usersguide/geometry.rst
Normal file
|
|
@ -0,0 +1,203 @@
|
|||
.. _usersguide_geometry:
|
||||
|
||||
=================
|
||||
Defining Geometry
|
||||
=================
|
||||
|
||||
--------------------
|
||||
Surfaces and Regions
|
||||
--------------------
|
||||
|
||||
The geometry of a model in OpenMC is defined using `constructive solid
|
||||
geometry`_ (CSG), also sometimes referred to as combinatorial geometry. CSG
|
||||
allows a user to create complex regions using Boolean operators (intersection,
|
||||
union, and complement) on simpler regions. In order to define a region that we
|
||||
can assign to a cell, we must first define surfaces which bound the region. A
|
||||
surface is a locus of zeros of a function of Cartesian coordinates
|
||||
:math:`x,y,z`, e.g.
|
||||
|
||||
- A plane perpendicular to the :math:`x` axis: :math:`x − x_0 = 0`
|
||||
- A cylinder perpendicular to the :math:`z` axis: :math:`(x − x_0)^2 + (y −
|
||||
y_0)^2 − R^2 = 0`
|
||||
- A sphere: :math:`(x − x_0)^2 + (y − y_0)^2 + (z − z_0)^2 − R^2 = 0`
|
||||
|
||||
Defining a surface alone is not sufficient to specify a volume -- in order to
|
||||
define an actual volume, one must reference the *half-space* of a surface. A
|
||||
surface half-space is the region whose points satisfy a positive of negative
|
||||
inequality of the surface equation. For example, for a sphere of radius one
|
||||
centered at the origin, the surface equation is :math:`f(x,y,z) = x^2 + y^2 +
|
||||
z^2 − 1 = 0`. Thus, we say that the negative half-space of the sphere, is
|
||||
defined as the collection of points satisfying :math:`f(x,y,z) < 0`, which one
|
||||
can reason is the inside of the sphere. Conversely, the positive half-space of
|
||||
the sphere would correspond to all points outside of the sphere, satisfying
|
||||
:math:`f(x,y,z) > 0`.
|
||||
|
||||
In the Python API, surfaces are created via subclasses of
|
||||
:class:`openmc.Surface`. The available surface types and their corresponding
|
||||
classes are listed in the following table.
|
||||
|
||||
.. table:: Surface types available in OpenMC.
|
||||
|
||||
+----------------------+------------------------------+---------------------------+
|
||||
| Surface | Equation | Class |
|
||||
+======================+==============================+===========================+
|
||||
| Plane perpendicular | :math:`x - x_0 = 0` | :class:`openmc.XPlane` |
|
||||
| to :math:`x`-axis | | |
|
||||
+----------------------+------------------------------+---------------------------+
|
||||
| Plane perpendicular | :math:`y - y_0 = 0` | :class:`openmc.YPlane` |
|
||||
| to :math:`y`-axis | | |
|
||||
+----------------------+------------------------------+---------------------------+
|
||||
| Plane perpendicular | :math:`z - z_0 = 0` | :class:`openmc.ZPlane` |
|
||||
| to :math:`z`-axis | | |
|
||||
+----------------------+------------------------------+---------------------------+
|
||||
| Arbitrary plane | :math:`Ax + By + Cz = D` | :class:`openmc.Plane` |
|
||||
+----------------------+------------------------------+---------------------------+
|
||||
| Infinite cylinder | :math:`(y-y_0)^2 + (z-z_0)^2 | :class:`openmc.XCylinder` |
|
||||
| parallel to | - R^2 = 0` | |
|
||||
| :math:`x`-axis | | |
|
||||
+----------------------+------------------------------+---------------------------+
|
||||
| Infinite cylinder | :math:`(x-x_0)^2 + (z-z_0)^2 | :class:`openmc.YCylinder` |
|
||||
| parallel to | - R^2 = 0` | |
|
||||
| :math:`y`-axis | | |
|
||||
+----------------------+------------------------------+---------------------------+
|
||||
| Infinite cylinder | :math:`(x-x_0)^2 + (y-y_0)^2 | :class:`openmc.ZCylinder` |
|
||||
| parallel to | - R^2 = 0` | |
|
||||
| :math:`z`-axis | | |
|
||||
+----------------------+------------------------------+---------------------------+
|
||||
| Sphere | :math:`(x-x_0)^2 + (y-y_0)^2 | :class:`openmc.Sphere` |
|
||||
| | + (z-z_0)^2 - R^2 = 0` | |
|
||||
+----------------------+------------------------------+---------------------------+
|
||||
| Cone parallel to the | :math:`(y-y_0)^2 + (z-z_0)^2 | :class:`openmc.XCone` |
|
||||
| :math:`x`-axis | - R^2(x-x_0)^2 = 0` | |
|
||||
+----------------------+------------------------------+---------------------------+
|
||||
| Cone parallel to the | :math:`(x-x_0)^2 + (z-z_0)^2 | :class:`openmc.YCone` |
|
||||
| :math:`y`-axis | - R^2(y-y_0)^2 = 0` | |
|
||||
+----------------------+------------------------------+---------------------------+
|
||||
| Cone parallel to the | :math:`(x-x_0)^2 + (y-y_0)^2 | :class:`openmc.ZCone` |
|
||||
| :math:`z`-axis | - R^2(z-z_0)^2 = 0` | |
|
||||
+----------------------+------------------------------+---------------------------+
|
||||
| General quadric | :math:`Ax^2 + By^2 + Cz^2 + | :class:`openmc.Quadric` |
|
||||
| surface | Dxy + Eyz + Fxz \\+Gx + Hy + | |
|
||||
| | Jz + K = 0` | |
|
||||
+----------------------+------------------------------+---------------------------+
|
||||
|
||||
Each surface is characterized by several parameters. As one example, the
|
||||
parameters for a sphere are the :math:`x,y,z` coordinates of the center of the
|
||||
sphere and the radius of the sphere. All of these parameters can be set either
|
||||
as optional keyword arguments to the class constructor or via attributes::
|
||||
|
||||
sphere = openmc.Sphere(R=10.0)
|
||||
|
||||
# ..or..
|
||||
sphere = openmc.Sphere()
|
||||
sphere.r = 10.0
|
||||
|
||||
Once a surface has been created, half-spaces can be obtained by applying the
|
||||
unary ``-`` or ``+`` operators, corresponding to the negative and positive
|
||||
half-spaces, respectively. For example::
|
||||
|
||||
>>> sphere = openmc.Sphere(R=10.0)
|
||||
>>> inside_sphere = -sphere
|
||||
>>> outside_sphere = +sphere
|
||||
>>> type(inside_sphere)
|
||||
<class 'openmc.surface.Halfspace'>
|
||||
|
||||
Instances of :class:`openmc.Halfspace` can be combined together using the
|
||||
Boolean operators ``&`` (intersection), ``|`` (union), and ``~`` (complement)::
|
||||
|
||||
>>> inside_sphere = -openmc.Sphere()
|
||||
>>> above_plane = +openmc.ZPlane()
|
||||
>>> northern_hemisphere = inside_sphere & above_plane
|
||||
>>> type(northern_hemisphere)
|
||||
<class 'openmc.region.Intersection'>
|
||||
|
||||
For many regions, a bounding-box can be determined automatically::
|
||||
|
||||
>>> northern_hemisphere.bounding_box
|
||||
(array([-1., -1., 0.]), array([1., 1., 1.]))
|
||||
|
||||
Boundary Conditions
|
||||
-------------------
|
||||
|
||||
When a surface is created, by default particles that pass through the surface
|
||||
will consider it to be transmissive, i.e., they pass through the surface
|
||||
freely. If your model does not extend to infinity in all spatial dimensions, you
|
||||
may want to specify different behavior for particles passing through a
|
||||
surface. To specify a vacuum boundary condition, simply change the
|
||||
:attr:`Surface.boundary_type` attribute to 'vacuum'::
|
||||
|
||||
outer_surface = openmc.Sphere(R=100.0, boundary_type='vacuum')
|
||||
|
||||
# ..or..
|
||||
outer_surface = openmc.Sphere(R=100.0)
|
||||
outer_surface.boundary_type = 'vacuum'
|
||||
|
||||
Reflective and periodic boundary conditions can be set with the strings
|
||||
'reflective' and 'periodic'. Vacuum and reflective boundary conditions can be
|
||||
applied to any type of surface. Periodic boundary conditions can only be applied
|
||||
to pairs of axis-aligned planar surfaces.
|
||||
|
||||
-----
|
||||
Cells
|
||||
-----
|
||||
|
||||
Once you have a material created and a region of space defined, you need to
|
||||
define a *cell* that assigns the material to the region. Cells are created using
|
||||
the :class:`openmc.Cell` class::
|
||||
|
||||
fuel = openmc.Cell(fill=uo2, region=pellet)
|
||||
|
||||
# ..or..
|
||||
fuel = openmc.Cell()
|
||||
fuel.fill = uo2
|
||||
fuel.region = pellet
|
||||
|
||||
The classes :class:`Halfspace`, :class:`Intersection`, :class:`Union`, and
|
||||
:class:`Complement` and all instances of :class:`openmc.Region` and can be
|
||||
assigned to the :attr:`Cell.region` attribute.
|
||||
|
||||
---------
|
||||
Universes
|
||||
---------
|
||||
|
||||
Similar to MCNP and Serpent, OpenMC is capable of using *universes*, collections
|
||||
of cells that can be used as repeatable units of geometry. At a minimum, there
|
||||
must be one "root" universe present in the model. To create a universe, the
|
||||
:class:`openmc.Universe` is used::
|
||||
|
||||
universe = openmc.Universe(cells=[cell1, cell2, cell3])
|
||||
|
||||
# ..or..
|
||||
universe = openmc.Universe()
|
||||
universe.add_cells([cell1, cell2])
|
||||
universe.add_cell(cell3)
|
||||
|
||||
Universes are generally used in three ways:
|
||||
|
||||
1. To be assigned to a :class:`Geometry` object (see
|
||||
:ref:`usersguide_geom_export`),
|
||||
2. To be assigned as the fill for a cell via the :attr:`Cell.fill` attribute,
|
||||
and
|
||||
3. To be used in a regular arrangement of universes in a :ref:`lattice
|
||||
<usersguide_lattices>`.
|
||||
|
||||
.. _usersguide_lattices:
|
||||
|
||||
--------
|
||||
Lattices
|
||||
--------
|
||||
|
||||
|
||||
------------------
|
||||
Hexagonal Lattices
|
||||
------------------
|
||||
|
||||
|
||||
.. _usersguide_geom_export:
|
||||
|
||||
--------------------------
|
||||
Exporting a Geometry Model
|
||||
--------------------------
|
||||
|
||||
.. _constructive solid geometry: http://en.wikipedia.org/wiki/Constructive_solid_geometry
|
||||
.. _quadratic surfaces: http://en.wikipedia.org/wiki/Quadric
|
||||
|
|
@ -14,6 +14,9 @@ essential aspects of using OpenMC to perform simulations.
|
|||
beginners
|
||||
install
|
||||
basics
|
||||
materials
|
||||
geometry
|
||||
settings
|
||||
scripts
|
||||
processing
|
||||
troubleshoot
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ 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:
|
||||
|
||||
|
|
@ -320,7 +320,7 @@ Recent versions of Windows 10 include a subsystem for Linux that allows one to
|
|||
run Bash within Ubuntu running in Windows. First, follow the installation guide
|
||||
`here <https://msdn.microsoft.com/en-us/commandline/wsl/install_guide>`_ to get
|
||||
Bash on Ubuntu on Windows setup. Once you are within bash, obtain the necessary
|
||||
:ref:`prerequisites <prerequisites>` via ``apt-get``. Finally, follow the
|
||||
:ref:`prerequisites <prerequisites>` via ``apt``. Finally, follow the
|
||||
:ref:`instructions for compiling on linux <compile_linux>`.
|
||||
|
||||
Compiling for the Intel Xeon Phi
|
||||
|
|
|
|||
173
docs/source/usersguide/materials.rst
Normal file
173
docs/source/usersguide/materials.rst
Normal file
|
|
@ -0,0 +1,173 @@
|
|||
.. _usersguide_materials:
|
||||
|
||||
.. currentmodule:: openmc
|
||||
|
||||
=====================
|
||||
Material Compositions
|
||||
=====================
|
||||
|
||||
Materials in OpenMC are defined as a set of nuclides/elements at specified
|
||||
densities and are created using the :class:`openmc.Material` class. Once a
|
||||
material has been instantiated, nuclides can be added with
|
||||
:meth:`Material.add_nuclide` and elements can be added with
|
||||
:meth:`Material.add_element`. Densities can be specified using atom fractions or
|
||||
weight fractions. For example, to create a material and add Gd152 at 0.5 atom
|
||||
percent, you'd run:
|
||||
|
||||
::
|
||||
|
||||
mat = openmc.Material()
|
||||
mat.add_nuclide('Gd152', 0.5, 'ao')
|
||||
|
||||
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.,
|
||||
|
||||
::
|
||||
|
||||
mat.set_density('g/cm3', 4.5)
|
||||
|
||||
----------------
|
||||
Natural Elements
|
||||
----------------
|
||||
|
||||
The :meth:`Material.add_element` method works exactly the same as
|
||||
:meth:`Material.add_nuclide`, except that instead of specifying a single isotope
|
||||
of an element, you specify the element itself. For example,
|
||||
|
||||
::
|
||||
|
||||
mat.add_element('C', 1.0)
|
||||
|
||||
Internally, OpenMC stores data on the atomic masses and natural abundances of
|
||||
all known isotopes and then uses this data to determine what isotopes should be
|
||||
added to the material. When the material is later exported to XML for use by the
|
||||
:ref:`scripts_openmc` executable, you'll see that any natural elements are
|
||||
expanded to the naturally-occurring isotopes.
|
||||
|
||||
Often, cross section libraries don't actually have all naturally-occurring
|
||||
isotopes for a given element. For example, in ENDF/B-VII.1, cross section
|
||||
evaluations are given for O16 and O17 but not for O18. If OpenMC is aware of
|
||||
what cross sections you will be using (either through the
|
||||
:attr:`Materials.cross_sections` attribute or the
|
||||
:envvar:`OPENMC_CROSS_SECTIONS` environment variable), it will attempt to only
|
||||
put isotopes in your model for which you have cross section data. In the case of
|
||||
oxygen in ENDF/B-VII.1, the abundance of O18 would end up being lumped with O16.
|
||||
|
||||
-----------------------
|
||||
Thermal Scattering Data
|
||||
-----------------------
|
||||
|
||||
If you have a moderating material in your model like water or graphite, you
|
||||
should assign thermal scattering data (so-called :math:`S(\alpha,\beta)`) using
|
||||
the :meth:`Material.add_s_alpha_beta` method. For example, to model light water,
|
||||
you would need to add hydrogen and oxygen to a material and then assign the
|
||||
``c_H_in_H2O`` thermal scattering data:
|
||||
|
||||
::
|
||||
|
||||
water = openmc.Material()
|
||||
water.add_nuclide('H1', 2.0)
|
||||
water.add_nuclide('O16', 1.0)
|
||||
water.add_s_alpha_beta('c_H_in_H2O')
|
||||
water.set_density('g/cm3', 1.0)
|
||||
|
||||
------------------
|
||||
Naming Conventions
|
||||
------------------
|
||||
|
||||
OpenMC uses the GND_ naming convention for nuclides, metastable states, and
|
||||
compounds:
|
||||
|
||||
:Nuclides: ``SymA`` where "A" is the mass number (e.g., ``Fe56``)
|
||||
:Elements: ``Sym0`` (e.g., ``Fe0`` or ``C0``)
|
||||
:Excited states: ``SymA_eN`` (e.g., ``V51_e1`` for the first excited state of
|
||||
Vanadium-51.) This is only used in decay data.
|
||||
:Metastable states: ``SymA_mN`` (e.g., ``Am242_m1`` for the first excited state
|
||||
of Americium-242).
|
||||
:Compounds: ``c_String_Describing_Material`` (e.g., ``c_H_in_H2O``). Used for
|
||||
thermal scattering data.
|
||||
|
||||
.. important:: The element syntax, e.g., ``C0``, is only used when the cross
|
||||
section evaluation is an elemental evaluation, like carbon in
|
||||
ENDF/B-VII.1! If you are adding an element via
|
||||
:meth:`Material.add_element`, just use ``Sym``.
|
||||
|
||||
.. _GND: https://www.oecd-nea.org/science/wpec/sg38/Meetings/2016_May/tlh4gnd-main.pdf
|
||||
|
||||
|
||||
-----------
|
||||
Temperature
|
||||
-----------
|
||||
|
||||
Some Monte Carlo codes define temperature implicitly through the cross section
|
||||
data, which is itself given only at a particular temperature. In OpenMC, the
|
||||
material definition is decoupled from the specification of temperature. Instead,
|
||||
temperatures are assigned to cells (FIXME add link) directly. Alternatively, a
|
||||
default temperature can be assigned to a material that is to be applied to any
|
||||
cell where the material is used. In the absence of 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.
|
||||
|
||||
To assign a default material temperature, one should use the ``temperature``
|
||||
attribute, e.g.,
|
||||
|
||||
::
|
||||
|
||||
hot_fuel = openmc.Material()
|
||||
hot_fuel.temperature = 1200.0 # temperature in Kelvin
|
||||
|
||||
.. warning:: MCNP_ users should be aware that OpenMC does not use the concept of
|
||||
cross section suffixes like "71c" or "80c". Temperatures in Kelvin
|
||||
should be assigned directly per material or per cell using the
|
||||
:attr:`Material.temperature` or :attr:`Cell.temperature`
|
||||
attributes, respectively.
|
||||
|
||||
--------------------
|
||||
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.
|
||||
|
||||
::
|
||||
|
||||
materials = openmc.Materials()
|
||||
materials.append(water)
|
||||
materials += [uo2, zircaloy]
|
||||
materials.export_to_xml()
|
||||
|
||||
# This is equivalent
|
||||
materials = openmc.Materials([water, uo2, zircaloy])
|
||||
materials.export_to_xml()
|
||||
|
||||
Cross Sections
|
||||
--------------
|
||||
|
||||
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
|
||||
: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:
|
||||
|
||||
::
|
||||
|
||||
materials.cross_sections = '/path/to/cross_sections.xml'
|
||||
|
||||
.. _MCNP: https://mcnp.lanl.gov/
|
||||
|
|
@ -115,6 +115,8 @@ Message Description
|
|||
[VALID] XML file matches RelaxNG.
|
||||
======================== ===================================
|
||||
|
||||
.. _scripts_voxel:
|
||||
|
||||
---------------------------
|
||||
``openmc-voxel-to-silovtk``
|
||||
---------------------------
|
||||
|
|
|
|||
5
docs/source/usersguide/settings.rst
Normal file
5
docs/source/usersguide/settings.rst
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
.. _usersguide_settings:
|
||||
|
||||
==================
|
||||
Execution Settings
|
||||
==================
|
||||
|
|
@ -29,8 +29,13 @@ DENSITY_UNITS = ['g/cm3', 'g/cc', 'kg/cm3', 'atom/b-cm', 'atom/cm3', 'sum',
|
|||
|
||||
|
||||
class Material(object):
|
||||
"""A material composed of a collection of nuclides/elements that can be
|
||||
assigned to a region of space.
|
||||
"""A material composed of a collection of nuclides/elements.
|
||||
|
||||
To create a material, one should create an instance of this class, add
|
||||
nuclides or elements with :meth:`Material.add_nuclide` or
|
||||
`Material.add_element`, respectively, and set the total material density
|
||||
with `Material.export_to_xml()`. The material can then be assigned to a cell
|
||||
using the :attr:`Cell.fill` attribute.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
|
|
|
|||
|
|
@ -1177,7 +1177,7 @@ class Sphere(Surface):
|
|||
y-coordinate of the center of the sphere
|
||||
z0 : float
|
||||
z-coordinate of the center of the sphere
|
||||
R : float
|
||||
r : float
|
||||
Radius of the sphere
|
||||
boundary_type : {'transmission, 'vacuum', 'reflective'}
|
||||
Boundary condition that defines the behavior for particles hitting the
|
||||
|
|
@ -1325,7 +1325,7 @@ class Cone(Surface):
|
|||
y-coordinate of the apex
|
||||
z0 : float
|
||||
z-coordinate of the apex
|
||||
R2 : float
|
||||
r2 : float
|
||||
Parameter related to the aperature
|
||||
boundary_type : {'transmission, 'vacuum', 'reflective'}
|
||||
Boundary condition that defines the behavior for particles hitting the
|
||||
|
|
@ -2033,4 +2033,4 @@ def get_hexagonal_prism(edge_length=1., orientation='y',
|
|||
# y = sqrt(3)*(x + a)
|
||||
upper_left = Plane(A=-c, B=1., D=c*l, boundary_type=boundary_type)
|
||||
return Intersection(-top, +bottom, -upper_right, +lower_right,
|
||||
+lower_left, -upper_left)
|
||||
+lower_left, -upper_left)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue