Greatly expanded documentation.

This commit is contained in:
Paul Romano 2012-03-28 10:30:52 -04:00
parent 54feb3fe20
commit 84dde9b1e3
19 changed files with 877 additions and 356 deletions

View file

@ -1,8 +1,8 @@
.. _usersguide_input:
========================
Creating XML Input Files
========================
=======================
Writing XML Input Files
=======================
Unlike many other Monte Carlo codes which use an arbitrary-format ASCII file
with "cards" to specify a particular geometry, materials, and associated run
@ -12,7 +12,9 @@ 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
particular piece of data will follow. Let us examine the follow example::
particular piece of data will follow. Let us examine the follow example:
.. code-block:: xml
<person>
<firstname>John</firstname>
@ -35,14 +37,190 @@ Overview of Files
-----------------
To assemble a complete model for OpenMC, one needs to create separate XML files
for the geometry, materials, and settings. Additionally, an optional tallies XML
file specifies physical quantities to be tallied. OpenMC expects that these
files are called:
for the geometry, materials, and settings. Additionally, there are two optional
input files. The first is a tallies XML file that specifies physical quantities
to be tallied. The second is a plots XML file that specifies regions of geometry
which should be plotted. OpenMC expects that these files are called:
* ``geometry.xml``
* ``materials.xml``
* ``setings.xml``
* ``tallies.xml``
* ``plots.xml``
--------------------------------------
Settings Specification -- settings.xml
--------------------------------------
All simulation parameters and miscellaneous options are specified in the
settings.xml file.
``<criticality>`` Element
-------------------------
The ``<criticality>`` element indicates that a criticality calculation should be
performed. It has the following attributes/sub-elements:
:batches:
The total number of batches, where each batch corresponds to multiple
fission source iterations. Batching is done to eliminate correlation between
realizations of random variables.
*Default*: None
:generations_per_batch:
The number of total fission source iterations per batch.
*Default*: 1
:inactive:
The number of inactive batches. In general, the starting cycles in a
criticality calculation can not be used to contribute to tallies since the
fission source distribution and eigenvalue are generally not converged
immediately.
*Default*: None
:particles:
The number of neutrons to simulate per fission source iteration.
*Default*: None
.. _cross_sections:
``<cross_sections>`` Element
----------------------------
The ``<cross_sections>`` element has no attributes and simply indicates the path
to an XML cross section listing file (usually named cross_sections.xml). If this
element is absent from the settings.xml file, the :envvar:`CROSS_SECTIONS`
environment variable will be used to find the path to the XML cross section
listing.
``<cutoff>`` Element
--------------------
The ``<cutoff>`` element indicates the weight cutoff used below which particles
undergo Russian roulette. Surviving particles are assigned a user-determined
weight. Note that weight cutoffs and Russian rouletting are not turned on by
default. This element has the following attributes/sub-elements:
:weight:
The weight below which particles undergo Russian roulette.
*Default*: 0.25
:weight_avg:
The weight that is assigned to particles that are not killed after Russian
roulette.
*Default*: 1.0
``<energy_grid>`` Element
-------------------------
The ``<energy_grid>`` element determines the treatment of the energy grid during
a simulation. Setting this element to "nuclide" will cause OpenMC to use a
nuclide's energy grid when determining what points to interpolate between for
determining cross sections (i.e. non-unionized energy grid). To use a unionized
energy grid, set this element to "union". Note that the unionized energy grid
treatment is slightly different than that employed in Serpent.
*Default*: union
``<entropy>`` Element
---------------------
The ``<entropy>`` element describes a mesh that is used for calculting Shannon
entropy. This mesh should cover all possible fissionable materials in the
problem. It has the following attributes/sub-elements:
:dimension:
The number of mesh cells in the x, y, and z directions, respectively.
*Default*: If this tag is not present, the number of mesh cells is
automatically determined by the code.
:lower_left:
The Cartersian coordinates of the lower-left corner of the mesh.
*Default*: None
:upper_right:
The Cartersian coordinates of the upper-right corner of the mesh.
*Default*: None
``<ptables>`` Element
---------------------
The ``<ptables>`` element determines whether probability tables should be used
in the unresolved resonance range if available. This element has no attributes
or sub-elements and can be set to either "off" or "on".
*Default*: on
``<seed>`` Element
------------------
The ``seed`` element is used to set the seed used for the linear congruential
pseudo-random number generator.
*Default*: 1
``<source>`` Element
--------------------
The ``source`` element gives information on an initial source guess for
criticality calculations. It takes the following attributes:
:type:
The type of source distribution. Setting this to "box" indicates that the
starting source should be sampled uniformly in a parallelepiped. Setting
this to "point" indicates that the starting source should be sampled from an
isotropic point source. Setting this to "file" indicates that the starting
source should be sampled from a ``source.binary`` file.
:coeffs:
For a "box" source distribution, ``coeffs`` should be given as six real
numbers, the first three of which specify the lower-left corner of a
parallelepiped and the last three of which specify the upper-right
corner. Source sites are sampled uniformly through that parallelepiped.
For a "point" source distribution, ``coeffs`` should be given as three real
numbers which specify the (x,y,z) location of an isotropic point source
For a "file" source distribution, ``coeffs`` should not be specified.
``<survival_biasing>`` Element
------------------------------
The ``<survival_biasing>`` element has no attributes and assumes wither the
value ``on`` or ``off``. If turned on, this option will enable the use of
survival biasing, otherwise known as implicit capture or absorption.
*Default*: off
``<trace>`` Element
-------------------
The ``<trace>`` element can be used to print out detailed information about a
single particle during a simulation. This element should be followed by three
integers: the batch number, generation number, and particle number.
*Default*: None
``<verbosity>`` Element
-----------------------
The ``<verbosity>`` element tells the code how much information to display to
the standard output. A higher verbosity corresponds to more information being
displayed. This element takes the following attributes:
:value:
The specified verbosity between 1 and 10.
*Default*: 5
--------------------------------------
Geometry Specification -- geometry.xml
@ -57,9 +235,11 @@ 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::
number of cells, surfaces, and lattices. Let us look at the following example:
<?xml version="1.0">
.. code-block:: xml
<?xml version="1.0"?>
<geometry>
<!-- This is a comment -->
@ -83,7 +263,9 @@ At the beginning of this file is a comment, denoted by a tag starting with
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::
could be written as:
.. code-block:: xml
<?xml version="1.0">
<geometry>
@ -94,10 +276,10 @@ could be written as::
</geometry>
``surface`` Element
-------------------
``<surface>`` Element
---------------------
Each ``surface`` element can have the following attributes or sub-elements:
Each ``<surface>`` element can have the following attributes or sub-elements:
:id:
A unique integer that can be used to identify the surface.
@ -105,8 +287,8 @@ Each ``surface`` element can have the following attributes or sub-elements:
*Default*: None
:type:
The type of the surfaces. This can be ``x-plane``, ``y-plane``, ``z-plane``,
``plane``, ``x-cylinder``, ``y-cylinder``, ``z-cylinder``, or ``sphere``.
The type of the surfaces. This can be "x-plane", "y-plane", "z-plane",
"plane", "x-cylinder", "y-cylinder", "z-cylinder", or "sphere".
*Default*: None
@ -117,10 +299,10 @@ Each ``surface`` element can have the following attributes or sub-elements:
*Default*: None
:boundary:
The boundary condition for the surface. This can be ``transmission``,
``vacuum``, or ``reflective``.
The boundary condition for the surface. This can be "transmission",
"vacuum", or "reflective".
*Default*: ``transmission``
*Default*: "transmission"
The following quadratic surfaces can be modeled:
@ -159,10 +341,10 @@ The following quadratic surfaces can be modeled:
A sphere of the form :math:`(x - x_0)^2 + (y - y_0)^2 + (z - z_0)^2 =
R^2`. The coefficients specified are ":math:`x_0 \: y_0 \: z_0 \: R`".
``cell`` Element
----------------
``<cell>`` Element
------------------
Each ``cell`` element can have the following attributes or sub-elements:
Each ``<cell>`` element can have the following attributes or sub-elements:
:id:
A unique integer that can be used to identify the surface.
@ -195,13 +377,13 @@ Each ``cell`` element can have the following attributes or sub-elements:
*Default*: None
``lattice`` Element
-------------------
``<lattice>`` Element
---------------------
The ``lattice`` can be used to represent repeating structures (e.g. fuel pins in
an assembly) or other geometry which naturally fits into a two-dimensional
The ``<lattice>`` can be used to represent repeating structures (e.g. fuel pins
in an assembly) or other geometry which naturally fits into a two-dimensional
structured mesh. Each cell within the lattice is filled with a specified
universe. A ``lattice`` accepts the following attributes or sub-elements:
universe. A ``<lattice>`` accepts the following attributes or sub-elements:
:id:
A unique integer that can be used to identify the surface.
@ -240,8 +422,8 @@ universe. A ``lattice`` accepts the following attributes or sub-elements:
Materials Specification -- materials.xml
----------------------------------------
``material`` Element
--------------------
``<material>`` Element
----------------------
Each ``material`` element can have the following attributes or sub-elements:
@ -249,12 +431,13 @@ Each ``material`` element can have the following attributes or sub-elements:
A unique integer that can be used to identify the material.
:density:
An element with attributes/sub-elements called ``value`` and ``units``. The
``value`` attribute is the numeric value of the density while the ``units``
can be "g/cm3", "kg/m3", "atom/b-cm", or "atom/cm3". For example, this could
be specified as::
<density value="4.5" units="g/cm3" />
can be "g/cm3", "kg/m3", "atom/b-cm", "atom/cm3", or "sum". The "sum" unit
indicates that the density should be calculated as the sum of the atom
fractions for each nuclide in the material. This should not be used in
conjunction with weight percents.
*Default*: None
@ -282,182 +465,18 @@ Each ``material`` element can have the following attributes or sub-elements:
*Default*: None
``default_xs`` Element
----------------------
``<default_xs>`` Element
------------------------
In some circumstances, the cross-section identifier may be the same for many or
all nuclides in a given problem. In this case, rather than specifying the
``xs=...`` attribute on every nuclide, a ``default_xs`` element can be used to
``xs=...`` attribute on every nuclide, a ``<default_xs>`` element can be used to
set the default cross-section identifier for any nuclide without an identifier
explicitly listed. This element has no attributes and accepts a 3-letter string
that indicates the default cross-section identifier, e.g. "70c".
*Default*: None
--------------------------------------
Settings Specification -- settings.xml
--------------------------------------
All simulation parameters and miscellaneous options are specified in the
settings.xml file.
``criticality`` Element
-----------------------
The ``criticality`` element indicates that a criticality calculation should be
performed. It has the following attributes/sub-elements:
:batches:
The total number of batches, where each batch corresponds to multiple
fission source iterations. Batching is done to eliminate correlation between
realizations of random variables.
*Default*: None
:generations_per_batch:
The number of total fission source iterations per batch.
*Default*: 1
:inactive:
The number of inactive batches. In general, the starting cycles in a
criticality calculation can not be used to contribute to tallies since the
fission source distribution and eigenvalue are generally not converged
immediately.
*Default*: None
:particles:
The number of neutrons to simulate per fission source iteration.
*Default*: None
``cross_sections`` Element
--------------------------
The ``cross_sections`` element has no attributes and simply indicates the path
to an XML cross section listing file (usually named cross_sections.xml). If this
element is absent from the settings.xml file, the environment variable
``CROSS_SECTIONS`` will be used to find the path to the XML cross section
listing.
``cutoff`` Element
------------------
The ``cutoff`` element indicates the weight cutoff used below which particles
undergo Russian roulette. Surviving particles are assigned a user-determined
weight. Note that weight cutoffs and Russian rouletting are not turned on by
default. This element has the following attributes/sub-elements:
:weight:
The weight below which particles undergo Russian roulette.
*Default*: 0.25
:weight_avg:
The weight that is assigned to particles that are not killed after Russian
roulette.
*Default*: 1.0
``energy_grid`` Element
-----------------------
The ``energy_grid`` element determines the treatment of the energy grid during a
simulation. Setting this element to "nuclide" will cause OpenMC to use a
nuclide's energy grid when determining what points to interpolate between for
determining cross sections (i.e. non-unionized energy grid). To use a unionized
energy grid, set this element to "union". Note that the unionized energy grid
treatment is slightly different than that employed in Serpent.
*Default*: union
``entropy`` Element
-------------------
This element describes a mesh that is used for calculting Shannon entropy. This
mesh should cover all possible fissionable materials in the problem. It has the
following attributes/sub-elements:
:dimension:
The number of mesh cells in the x, y, and z directions, respectively.
*Default*: If this tag is not present, the number of mesh cells is
automatically determined by the code.
:lower_left:
The Cartersian coordinates of the lower-left corner of the mesh.
*Default*: None
:upper_right:
The Cartersian coordinates of the upper-right corner of the mesh.
*Default*: None
``ptables`` Element
-------------------
The ``ptables`` element determines whether probability tables should be used in
the unresolved resonance range if available. This element has no attributes or
sub-elements and can be set to either "off" or "on".
*Default*: on
``seed`` Element
----------------
The ``seed`` element is used to set the seed used for the linear congruential
pseudo-random number generator.
*Default*: 1
``source`` Element
------------------
The ``source`` element gives information on an initial source guess for
criticality calculations. It takes the following attributes:
:type:
The type of source distribution. Currently, the only accepted option is
"box"
:coeffs:
For a "box" source distribution, ``coeffs`` should be given as six integers,
the first three of which specify the lower-left corner of a parallelepiped
and the last three of which specify the upper-right corner. Source sites are
sampled uniformly through that parallelepiped.
``survival_biasing`` Element
----------------------------
The ``survival_biasing`` element has no attributes and assumes wither the
value ``on`` or ``off``. If turned on, this option will enable the use of
survival biasing, otherwise known as implicit capture or absorption.
*Default*: off
``trace`` Element
-----------------
The ``trace`` element can be used to print out detailed information about a
single particle during a simulation. This element should be followed by two
integers, the cycle and one for the particle number.
*Default*: None
``verbosity`` Element
---------------------
The ``verbosity`` element tells the code how much information to display to the
standard output. A higher verbosity corresponds to more information being
displayed. This element takes the following attributes:
:value:
The specified verbosity between 1 and 10.
*Default*: 5
------------------------------------
Tallies Specification -- tallies.xml
------------------------------------
@ -476,12 +495,12 @@ filters can be used for a tally. The following types of filter are available:
cell, universe, material, surface, birth region, pre-collision energy,
post-collision energy, and an arbitrary structured mesh.
The two valid elements in the tallies.xml file are ``tally`` and ``mesh``.
The two valid elements in the tallies.xml file are ``<tally>`` and ``<mesh>``.
``tally`` Element
-----------------
``<tally>`` Element
-------------------
The ``tally`` element accepts the following sub-elements:
The ``<tally>`` element accepts the following sub-elements:
:filters:
A list of filters to specify what region of phase space should contribute to
@ -561,11 +580,11 @@ The following responses can be tallied.
:nu-fission:
Total production of neutrons due to fission
``mesh`` Element
----------------
``<mesh>`` Element
------------------
If a structured mesh is desired as a filter for a tally, it must be specified in
a separate element with the tag name ``mesh``. This element has the following
a separate element with the tag name ``<mesh>``. This element has the following
attributes/sub-elements:
:type:
@ -582,8 +601,8 @@ attributes/sub-elements:
:width:
The width of mesh cells in each direction.
``assume_separate`` Element
---------------------------
``<assume_separate>`` Element
-----------------------------
In cases where the user needs to specify many different tallies each of which
are spatially separate, this tag can be used to cut down on some of the tally
@ -596,16 +615,16 @@ tallies. This element should be followed by "yes" or "no"
*Default*: no
-------------------------------------------
Geometry Plotting Specification -- plot.xml
-------------------------------------------
--------------------------------------------
Geometry Plotting Specification -- plots.xml
--------------------------------------------
A basic 2D plotting capability is available in OpenMC by creating a
plots.xml file and subsequently running with the command-line flag ``-plot``. The
root element of the plot.xml is simply ``<plots>`` and any number output
figures can be defined with ``<plot>`` sub-elements.
A basic 2D plotting capability is 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 figures can
be defined with ``<plot>`` sub-elements.
``plot`` Element
``<plot>`` Element
------------------
Each plot must contain a combination of the following attributes or sub-elements:
@ -627,14 +646,14 @@ Each plot must contain a combination of the following attributes or sub-elements
*Default*: ``cell``
:origin:
Specifies the XYZ coordinate of the center of the plot. Should be 3 floats
separated by spaces.
Specifies the (x,y,z) coordinate of the center of the plot. Should be three
floats separated by spaces.
*Default*: None - Required entry
:width:
Specifies the width of the plot along each of the basis directions.
Should be 2 or 3 floats separated by spaces for 2D plots and 3D plots,
Specifies the width of the plot along each of the basis directions. Should
be two or three floats separated by spaces for 2D plots and 3D plots,
respectively.
*Default*: None - Required entry
@ -652,18 +671,18 @@ Each plot must contain a combination of the following attributes or sub-elements
*Default*: "slice"
``plot`` elements of ``type`` ``slice`` also contain the following attributes or
sub-elements:
``<plot>`` elements of ``type`` "slice" also contain the following attributes or
sub-elements:
:basis:
Keyword specifying the plane of the plot for ``slice`` type plots. Can be
one of: ``xy``, ``xz``, ``yz``.
one of: "xy", "xz", "yz".
*Default*: ``xy``
*Default*: "xy"
:pixels:
Specifies the number of pixes to be used along each of the basis directions for
``slice`` plots. Should be 2 integers separated by spaces.
Specifies the number of pixes to be used along each of the basis directions
for "slice" plots. Should be two integers separated by spaces.
.. warning:: The ``pixels`` input determines the output file size. For the PPM
format, 10 million pixels will result in a file just under 30 MB in
@ -675,16 +694,16 @@ sub-elements:
.. warning:: Geometry features along a basis direction smaller than ``width``/``pixels``
along that basis direction may not appear in the plot.
*Default*: None - Required entry for ``slice`` plots
*Default*: None - Required entry for "slice" plots
:background:
Specifies the RGB color of the regions where no OpenMC cell can be found. Should
be 3 integers deparated by spaces.
be three integers separated by spaces.
*Default*: 0 0 0 (white)
:col_spec:
Any number of this optional tag may be included in each ``plot`` element, which can
Any number of this optional tag may be included in each ``<plot>`` element, which can
override the default random colors for cells or materials. Each ``col_spec``
element must contain ``id`` and ``rgb`` sub-elements.