Respond to comments on #850

This commit is contained in:
Paul Romano 2017-04-05 07:11:57 -05:00
parent 973b66c1d0
commit 5c74b85713
28 changed files with 985 additions and 758 deletions

37
.gitignore vendored
View file

@ -59,16 +59,17 @@ src/cmake_install.cmake
src/install_manifest.txt
# Nuclear data
data/nndc
data/nndc_hdf5
data/wmp
data/multipole_lib.tar.gz
data/ENDF-B-VII.1-*.tar.gz
data/JEFF32-ACE-*.tar.gz
data/JEFF32-ACE-*.zip
data/TSLs.tar.gz
data/jeff-3.2
data/jeff-3.2-hdf5
scripts/nndc
scripts/nndc_hdf5
scripts/wmp
scripts/multipole_lib.tar.gz
scripts/ENDF-B-VII.1-*.tar.gz
scripts/JEFF32-ACE-*.tar.gz
scripts/JEFF32-ACE-*.zip
scripts/TSLs.tar.gz
scripts/jeff-3.2
scripts/jeff-3.2-hdf5
scripts/*.tar.xz
# Images
*.ppm
@ -82,13 +83,15 @@ data/jeff-3.2-hdf5
.ipynb_checkpoints
# Multi-group cross section IPython Notebook
docs/source/pythonapi/examples/*.xml
docs/source/pythonapi/examples/*.png
docs/source/pythonapi/examples/*.xls
docs/source/pythonapi/examples/mgxs
docs/source/pythonapi/examples/tracks
docs/source/pythonapi/examples/fission-rates
docs/source/pythonapi/examples/plots
docs/source/examples/*.xml
docs/source/examples/*.png
docs/source/examples/*.xls
docs/source/examples/*.ace
docs/source/examples/*.endf
docs/source/examples/mgxs
docs/source/examples/tracks
docs/source/examples/fission-rates
docs/source/examples/plots
# Cython files
*.c

View file

@ -139,14 +139,7 @@
}
],
"source": [
"plot_args = {\n",
" 'width': (2*calendria_or, 2*calendria_or),\n",
" 'colors': {\n",
" fuel: 'black',\n",
" clad: 'silver',\n",
" heavy_water: 'blue'\n",
" }\n",
" }\n",
"plot_args = {'width': (2*calendria_or, 2*calendria_or)}\n",
"bundle_universe = openmc.Universe(cells=water_cells)\n",
"bundle_universe.plot(**plot_args)"
]
@ -325,7 +318,11 @@
"source": [
"p = openmc.Plot.from_geometry(geom)\n",
"p.color_by = 'material'\n",
"p.colors = plot_args['colors']\n",
"p.colors = {\n",
" fuel: 'black',\n",
" clad: 'silver',\n",
" heavy_water: 'blue'\n",
"}\n",
"openmc.plot_inline(p)"
]
},

View file

@ -411,7 +411,7 @@
}
],
"source": [
"water.remove_nuclide(openmc.Nuclide('O16'))\n",
"water.remove_nuclide('O16')\n",
"water.add_element('O', 1.0)\n",
"\n",
"mats.export_to_xml()\n",
@ -516,7 +516,7 @@
"\n",
"Note that defining a surface 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 $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 $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.\n",
"\n",
"Let's go ahead and create a sphere and confirm that we've told you is true."
"Let's go ahead and create a sphere and confirm that what we've told you is true."
]
},
{
@ -1417,7 +1417,7 @@
"source": [
"## Geometry plotting\n",
"\n",
"We saw before that we could call the `Universe.plot()` method to show a universe while we were creating out geometry. There is also a built-in plotter in the Fortran codebase that is much faster than the Python plotter and has more options. The interface looks somewhat similar to the `Universe.plot()` method. Instead though, we create `Plot` instances, assign them to a `Plots` collection, export it to XML, and then run OpenMC in geometry plotting mode. As an example, let's specify that we want the plot to be colored by material (rather than by cell) and we assign yellow to fuel and blue to water."
"We saw before that we could call the `Universe.plot()` method to show a universe while we were creating our geometry. There is also a built-in plotter in the Fortran codebase that is much faster than the Python plotter and has more options. The interface looks somewhat similar to the `Universe.plot()` method. Instead though, we create `Plot` instances, assign them to a `Plots` collection, export it to XML, and then run OpenMC in geometry plotting mode. As an example, let's specify that we want the plot to be colored by material (rather than by cell) and we assign yellow to fuel and blue to water."
]
},
{

View file

@ -75,7 +75,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"To actually create individual TRISO particles, we first need to create a universe that will be used within each particle. The reason we use the same universe for each TRISO particle is to reduce the total number of cells/surfaces needed which can improve performance by a factor of two over using unique cells/surfaces in each."
"To actually create individual TRISO particles, we first need to create a universe that will be used within each particle. The reason we use the same universe for each TRISO particle is to reduce the total number of cells/surfaces needed which can substantially improve performance over using unique cells/surfaces in each."
]
},
{
@ -101,7 +101,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Now that we have a universe that can be used for each TRISO particle, we need to randomly select locations. In this example, we will select locations at random within in a 1 cm x 1 cm x 1 cm box centered at the origin with a packing fraction of 30%. Note that `pack_trisos` can handle up to the theoretical maximum of 60% (it will just be slow)."
"Now that we have a universe that can be used for each TRISO particle, we need to randomly select locations. In this example, we will select locations at random within a 1 cm x 1 cm x 1 cm box centered at the origin with a packing fraction of 30%. Note that `pack_trisos` can handle up to the theoretical maximum of 60% (it will just be slow)."
]
},
{

View file

@ -3,3 +3,49 @@
============================================
Cross Sections Listing -- cross_sections.xml
============================================
.. _directory_element:
-----------------------
``<directory>`` Element
-----------------------
The ``<directory>`` element specifies a root directory to which the path for all
files listed in a :ref:`library_element` are given relative to. This element has
no attributes or sub-elements; the directory should be given within the text
node. For example,
.. code-block:: xml
<directory>/opt/data/cross_sections/</directory>
.. _library_element:
---------------------
``<library>`` Element
---------------------
The ``<library>`` element indicates where an HDF5 cross section file is located,
whether it contains incident neutron or thermal scattering data, and what
materials are listed within. It has the following attributes:
:materials:
A space-separated list of nuclides or thermal scattering tables. For
example,
.. code-block:: xml
<library materials="U234 U235 U238" />
<library materials="c_H_in_H2O c_D_in_G2O" />
Often, just a single nuclide or thermal scattering table is contained in a
given file.
:path:
Path to the HDF5 file. If the :ref:`directory_element` is specified, the
path is relative to the directory given. Otherwise, it is relative to the
directory containing the ``cross_sections.xml`` file.
:type:
The type of data contained in the file, either 'neutron' or 'thermal'.

View file

@ -5,7 +5,7 @@ Geometry Plotting Specification -- plots.xml
============================================
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
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:

View file

@ -1657,7 +1657,7 @@ another.
.. _OECD: http://www.oecd-nea.org/dbprog/MMRW-BOOKS.html
.. _NJOY: http://t2.lanl.gov/codes.shtml
.. _NJOY: https://njoy.github.io/NJOY2016/
.. _PREPRO: http://www-nds.iaea.org/ndspub/endf/prepro/

View file

@ -0,0 +1,197 @@
------------------------------------
:mod:`openmc` -- Basic Functionality
------------------------------------
Handling nuclear data
---------------------
.. autosummary::
:toctree: generated
:nosignatures:
:template: myclass.rst
openmc.XSdata
openmc.MGXSLibrary
Simulation Settings
-------------------
.. autosummary::
:toctree: generated
:nosignatures:
:template: myclass.rst
openmc.Source
openmc.VolumeCalculation
openmc.Settings
Material Specification
----------------------
.. autosummary::
:toctree: generated
:nosignatures:
:template: myclass.rst
openmc.Nuclide
openmc.Element
openmc.Macroscopic
openmc.Material
openmc.Materials
Cross sections for nuclides, elements, and materials can be plotted using the
following function:
.. autosummary::
:toctree: generated
:nosignatures:
:template: myfunction.rst
openmc.plot_xs
Building geometry
-----------------
.. autosummary::
:toctree: generated
:nosignatures:
:template: myclass.rst
openmc.Plane
openmc.XPlane
openmc.YPlane
openmc.ZPlane
openmc.XCylinder
openmc.YCylinder
openmc.ZCylinder
openmc.Sphere
openmc.Cone
openmc.XCone
openmc.YCone
openmc.ZCone
openmc.Quadric
openmc.Halfspace
openmc.Intersection
openmc.Union
openmc.Complement
openmc.Cell
openmc.Universe
openmc.RectLattice
openmc.HexLattice
openmc.Geometry
Many of the above classes are derived from several abstract classes:
.. autosummary::
:toctree: generated
:nosignatures:
:template: myclass.rst
openmc.Surface
openmc.Region
openmc.Lattice
Two helper function are also available to create rectangular and hexagonal
prisms defined by the intersection of four and six surface half-spaces,
respectively.
.. autosummary::
:toctree: generated
:nosignatures:
:template: myfunction.rst
openmc.get_hexagonal_prism
openmc.get_rectangular_prism
.. _pythonapi_tallies:
Constructing Tallies
--------------------
.. autosummary::
:toctree: generated
:nosignatures:
:template: myclass.rst
openmc.Filter
openmc.UniverseFilter
openmc.MaterialFilter
openmc.CellFilter
openmc.CellbornFilter
openmc.SurfaceFilter
openmc.MeshFilter
openmc.EnergyFilter
openmc.EnergyoutFilter
openmc.MuFilter
openmc.PolarFilter
openmc.AzimuthalFilter
openmc.DistribcellFilter
openmc.DelayedGroupFilter
openmc.EnergyFunctionFilter
openmc.Mesh
openmc.Trigger
openmc.TallyDerivative
openmc.Tally
openmc.Tallies
Coarse Mesh Finite Difference Acceleration
------------------------------------------
.. autosummary::
:toctree: generated
:nosignatures:
:template: myclass.rst
openmc.CMFDMesh
openmc.CMFD
Geometry Plotting
-----------------
.. autosummary::
:toctree: generated
:nosignatures:
:template: myclass.rst
openmc.Plot
openmc.Plots
Running OpenMC
--------------
.. autosummary::
:toctree: generated
:nosignatures:
:template: myfunction.rst
openmc.run
openmc.calculate_volumes
openmc.plot_geometry
openmc.plot_inline
openmc.search_for_keff
Post-processing
---------------
.. autosummary::
:toctree: generated
:nosignatures:
:template: myclass.rst
openmc.Particle
openmc.StatePoint
openmc.Summary
Various classes may be created when performing tally slicing and/or arithmetic:
.. autosummary::
:toctree: generated
:nosignatures:
:template: myclass.rst
openmc.arithmetic.CrossScore
openmc.arithmetic.CrossNuclide
openmc.arithmetic.CrossFilter
openmc.arithmetic.AggregateScore
openmc.arithmetic.AggregateNuclide
openmc.arithmetic.AggregateFilter

View file

@ -0,0 +1,134 @@
--------------------------------------------
:mod:`openmc.data` -- Nuclear Data Interface
--------------------------------------------
Core Classes
------------
.. autosummary::
:toctree: generated
:nosignatures:
:template: myclass.rst
openmc.data.IncidentNeutron
openmc.data.Reaction
openmc.data.Product
openmc.data.Tabulated1D
openmc.data.FissionEnergyRelease
openmc.data.ThermalScattering
openmc.data.CoherentElastic
openmc.data.FissionEnergyRelease
openmc.data.DataLibrary
openmc.data.Decay
openmc.data.FissionProductYields
openmc.data.WindowedMultipole
Core Functions
--------------
.. autosummary::
:toctree: generated
:nosignatures:
:template: myfunction.rst
openmc.data.atomic_mass
openmc.data.linearize
openmc.data.thin
openmc.data.write_compact_458_library
Angle-Energy Distributions
--------------------------
.. autosummary::
:toctree: generated
:nosignatures:
:template: myclass.rst
openmc.data.AngleEnergy
openmc.data.KalbachMann
openmc.data.CorrelatedAngleEnergy
openmc.data.UncorrelatedAngleEnergy
openmc.data.NBodyPhaseSpace
openmc.data.LaboratoryAngleEnergy
openmc.data.AngleDistribution
openmc.data.EnergyDistribution
openmc.data.ArbitraryTabulated
openmc.data.GeneralEvaporation
openmc.data.MaxwellEnergy
openmc.data.Evaporation
openmc.data.WattEnergy
openmc.data.MadlandNix
openmc.data.DiscretePhoton
openmc.data.LevelInelastic
openmc.data.ContinuousTabular
Resonance Data
--------------
.. autosummary::
:toctree: generated
:nosignatures:
:template: myclass.rst
openmc.data.Resonances
openmc.data.ResonanceRange
openmc.data.SingleLevelBreitWigner
openmc.data.MultiLevelBreitWigner
openmc.data.ReichMoore
openmc.data.RMatrixLimited
openmc.data.ParticlePair
openmc.data.SpinGroup
openmc.data.Unresolved
ACE Format
----------
Classes
+++++++
.. autosummary::
:toctree: generated
:nosignatures:
:template: myclass.rst
openmc.data.ace.Library
openmc.data.ace.Table
Functions
+++++++++
.. autosummary::
:toctree: generated
:nosignatures:
:template: myfunction.rst
openmc.data.ace.ascii_to_binary
ENDF Format
-----------
Classes
+++++++
.. autosummary::
:toctree: generated
:nosignatures:
:template: myclass.rst
openmc.data.endf.Evaluation
Functions
+++++++++
.. autosummary::
:toctree: generated
:nosignatures:
:template: myfunction.rst
openmc.data.endf.float_endf
openmc.data.endf.get_cont_record
openmc.data.endf.get_evaluations
openmc.data.endf.get_head_record
openmc.data.endf.get_tab1_record
openmc.data.endf.get_tab2_record
openmc.data.endf.get_text_record

View file

@ -6,516 +6,45 @@ Python API
OpenMC includes a rich Python API that enables programmatic pre- and
post-processing. The easiest way to begin using the API is to take a look at the
example Jupyter_ notebooks provided in the :ref:`examples` section of the
documentation. However, this assumes that you are already familiar with Python
and common third-party packages such as NumPy_. If you have never programmed in
Python before, there are many good tutorials available online. We recommend
going through the modules from Codecademy_ and/or the `Scipy lectures`_. The
full API documentation serves to provide more information on a given module or
class.
------------------------------------
:mod:`openmc` -- Basic Functionality
------------------------------------
Handling nuclear data
---------------------
.. autosummary::
:toctree: generated
:nosignatures:
:template: myclass.rst
openmc.XSdata
openmc.MGXSLibrary
Simulation Settings
-------------------
.. autosummary::
:toctree: generated
:nosignatures:
:template: myclass.rst
openmc.Source
openmc.VolumeCalculation
openmc.Settings
Material Specification
----------------------
.. autosummary::
:toctree: generated
:nosignatures:
:template: myclass.rst
openmc.Nuclide
openmc.Element
openmc.Macroscopic
openmc.Material
openmc.Materials
Building geometry
-----------------
.. autosummary::
:toctree: generated
:nosignatures:
:template: myclass.rst
openmc.Plane
openmc.XPlane
openmc.YPlane
openmc.ZPlane
openmc.XCylinder
openmc.YCylinder
openmc.ZCylinder
openmc.Sphere
openmc.Cone
openmc.XCone
openmc.YCone
openmc.ZCone
openmc.Quadric
openmc.Halfspace
openmc.Intersection
openmc.Union
openmc.Complement
openmc.Cell
openmc.Universe
openmc.RectLattice
openmc.HexLattice
openmc.Geometry
Many of the above classes are derived from several abstract classes:
.. autosummary::
:toctree: generated
:nosignatures:
:template: myclass.rst
openmc.Surface
openmc.Region
openmc.Lattice
Two helper function are also available to create rectangular and hexagonal
prisms defined by the intersection of four and six surface half-spaces,
respectively.
.. autosummary::
:toctree: generated
:nosignatures:
:template: myfunction.rst
openmc.get_hexagonal_prism
openmc.get_rectangular_prism
.. _pythonapi_tallies:
Constructing Tallies
--------------------
.. autosummary::
:toctree: generated
:nosignatures:
:template: myclass.rst
openmc.UniverseFilter
openmc.MaterialFilter
openmc.CellFilter
openmc.CellbornFilter
openmc.SurfaceFilter
openmc.MeshFilter
openmc.EnergyFilter
openmc.EnergyoutFilter
openmc.MuFilter
openmc.PolarFilter
openmc.AzimuthalFilter
openmc.DistribcellFilter
openmc.DelayedGroupFilter
openmc.EnergyFunctionFilter
openmc.Mesh
openmc.Trigger
openmc.TallyDerivative
openmc.Tally
openmc.Tallies
Coarse Mesh Finite Difference Acceleration
------------------------------------------
.. autosummary::
:toctree: generated
:nosignatures:
:template: myclass.rst
openmc.CMFDMesh
openmc.CMFD
Plotting
--------
.. autosummary::
:toctree: generated
:nosignatures:
:template: myclass.rst
openmc.Plot
openmc.Plots
Running OpenMC
--------------
.. autosummary::
:toctree: generated
:nosignatures:
:template: myfunction.rst
openmc.run
openmc.calculate_volumes
openmc.plot_geometry
openmc.plot_inline
openmc.search_for_keff
Post-processing
---------------
.. autosummary::
:toctree: generated
:nosignatures:
:template: myclass.rst
openmc.Particle
openmc.StatePoint
openmc.Summary
Various classes may be created when performing tally slicing and/or arithmetic:
.. autosummary::
:toctree: generated
:nosignatures:
:template: myclass.rst
openmc.arithmetic.CrossScore
openmc.arithmetic.CrossNuclide
openmc.arithmetic.CrossFilter
openmc.arithmetic.AggregateScore
openmc.arithmetic.AggregateNuclide
openmc.arithmetic.AggregateFilter
.. _pythonapi_stats:
---------------------------------
:mod:`openmc.stats` -- Statistics
---------------------------------
Univariate Probability Distributions
------------------------------------
.. autosummary::
:toctree: generated
:nosignatures:
:template: myclass.rst
openmc.stats.Univariate
openmc.stats.Discrete
openmc.stats.Uniform
openmc.stats.Maxwell
openmc.stats.Watt
openmc.stats.Tabular
openmc.stats.Legendre
openmc.stats.Mixture
Angular Distributions
---------------------
.. autosummary::
:toctree: generated
:nosignatures:
:template: myclass.rst
openmc.stats.UnitSphere
openmc.stats.PolarAzimuthal
openmc.stats.Isotropic
openmc.stats.Monodirectional
Spatial Distributions
---------------------
.. autosummary::
:toctree: generated
:nosignatures:
:template: myclass.rst
openmc.stats.Spatial
openmc.stats.CartesianIndependent
openmc.stats.Box
openmc.stats.Point
.. _pythonapi_mgxs:
----------------------------------------------------------
:mod:`openmc.mgxs` -- Multi-Group Cross Section Generation
----------------------------------------------------------
Energy Groups
-------------
.. autosummary::
:toctree: generated
:nosignatures:
:template: myclass.rst
openmc.mgxs.EnergyGroups
Multi-group Cross Sections
--------------------------
.. autosummary::
:toctree: generated
:nosignatures:
:template: myclassinherit.rst
openmc.mgxs.MGXS
openmc.mgxs.AbsorptionXS
openmc.mgxs.CaptureXS
openmc.mgxs.Chi
openmc.mgxs.FissionXS
openmc.mgxs.InverseVelocity
openmc.mgxs.KappaFissionXS
openmc.mgxs.MultiplicityMatrixXS
openmc.mgxs.NuFissionMatrixXS
openmc.mgxs.ScatterXS
openmc.mgxs.ScatterMatrixXS
openmc.mgxs.ScatterProbabilityMatrix
openmc.mgxs.TotalXS
openmc.mgxs.TransportXS
Multi-delayed-group Cross Sections
----------------------------------
.. autosummary::
:toctree: generated
:nosignatures:
:template: myclassinherit.rst
openmc.mgxs.MDGXS
openmc.mgxs.ChiDelayed
openmc.mgxs.DelayedNuFissionXS
openmc.mgxs.DelayedNuFissionMatrixXS
openmc.mgxs.Beta
openmc.mgxs.DecayRate
Multi-group Cross Section Libraries
-----------------------------------
.. autosummary::
:toctree: generated
:nosignatures:
:template: myclass.rst
openmc.mgxs.Library
-------------------------------------
:mod:`openmc.model` -- Model Building
-------------------------------------
TRISO Fuel Modeling
-------------------
Classes
+++++++
.. autosummary::
:toctree: generated
:nosignatures:
:template: myclass.rst
openmc.model.TRISO
Functions
+++++++++
.. autosummary::
:toctree: generated
:nosignatures:
:template: myfunction.rst
openmc.model.create_triso_lattice
openmc.model.pack_trisos
Model Container
---------------
Classes
+++++++
.. autosummary::
:toctree: generated
:nosignatures:
:template: myclass.rst
openmc.model.Model
.. _pythonapi_data:
--------------------------------------------
:mod:`openmc.data` -- Nuclear Data Interface
--------------------------------------------
Core Classes
------------
.. autosummary::
:toctree: generated
:nosignatures:
:template: myclass.rst
openmc.data.IncidentNeutron
openmc.data.Reaction
openmc.data.Product
openmc.data.Tabulated1D
openmc.data.FissionEnergyRelease
openmc.data.ThermalScattering
openmc.data.CoherentElastic
openmc.data.FissionEnergyRelease
openmc.data.DataLibrary
openmc.data.Decay
openmc.data.FissionProductYields
openmc.data.WindowedMultipole
Core Functions
--------------
.. autosummary::
:toctree: generated
:nosignatures:
:template: myfunction.rst
openmc.data.atomic_mass
openmc.data.linearize
openmc.data.thin
openmc.data.write_compact_458_library
Angle-Energy Distributions
--------------------------
.. autosummary::
:toctree: generated
:nosignatures:
:template: myclass.rst
openmc.data.AngleEnergy
openmc.data.KalbachMann
openmc.data.CorrelatedAngleEnergy
openmc.data.UncorrelatedAngleEnergy
openmc.data.NBodyPhaseSpace
openmc.data.LaboratoryAngleEnergy
openmc.data.AngleDistribution
openmc.data.EnergyDistribution
openmc.data.ArbitraryTabulated
openmc.data.GeneralEvaporation
openmc.data.MaxwellEnergy
openmc.data.Evaporation
openmc.data.WattEnergy
openmc.data.MadlandNix
openmc.data.DiscretePhoton
openmc.data.LevelInelastic
openmc.data.ContinuousTabular
Resonance Data
--------------
.. autosummary::
:toctree: generated
:nosignatures:
:template: myclass.rst
openmc.data.Resonances
openmc.data.ResonanceRange
openmc.data.SingleLevelBreitWigner
openmc.data.MultiLevelBreitWigner
openmc.data.ReichMoore
openmc.data.RMatrixLimited
openmc.data.ParticlePair
openmc.data.SpinGroup
openmc.data.Unresolved
ACE Format
----------
Classes
+++++++
.. autosummary::
:toctree: generated
:nosignatures:
:template: myclass.rst
openmc.data.ace.Library
openmc.data.ace.Table
Functions
+++++++++
.. autosummary::
:toctree: generated
:nosignatures:
:template: myfunction.rst
openmc.data.ace.ascii_to_binary
ENDF Format
-----------
Classes
+++++++
.. autosummary::
:toctree: generated
:nosignatures:
:template: myclass.rst
openmc.data.endf.Evaluation
Functions
+++++++++
.. autosummary::
:toctree: generated
:nosignatures:
:template: myfunction.rst
openmc.data.endf.float_endf
openmc.data.endf.get_cont_record
openmc.data.endf.get_evaluations
openmc.data.endf.get_head_record
openmc.data.endf.get_tab1_record
openmc.data.endf.get_tab2_record
openmc.data.endf.get_text_record
---------------------------------------------------------
:mod:`openmc.openmoc_compatible` -- OpenMOC Compatibility
---------------------------------------------------------
.. autosummary::
:toctree: generated
:nosignatures:
:template: myfunction.rst
openmc.openmoc_compatible.get_openmoc_material
openmc.openmoc_compatible.get_openmc_material
openmc.openmoc_compatible.get_openmoc_surface
openmc.openmoc_compatible.get_openmc_surface
openmc.openmoc_compatible.get_openmoc_cell
openmc.openmoc_compatible.get_openmc_cell
openmc.openmoc_compatible.get_openmoc_universe
openmc.openmoc_compatible.get_openmc_universe
openmc.openmoc_compatible.get_openmoc_lattice
openmc.openmoc_compatible.get_openmc_lattice
openmc.openmoc_compatible.get_openmoc_geometry
openmc.openmoc_compatible.get_openmc_geometry
.. _Jupyter: https://jupyter.org/
.. _NumPy: http://www.numpy.org/
.. _Codecademy: https://www.codecademy.com/tracks/python
.. _Scipy lectures: https://scipy-lectures.github.io/
:ref:`examples`. This assumes that you are already familiar with Python and
common third-party packages such as `NumPy <http://www.numpy.org/>`_. 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 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
- Automated multi-group cross section generation (:mod:`openmc.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 nuclear data interface (:mod:`openmc.data`)
For those new to Python, there are many good tutorials available online. We
recommend going through the modules from `Codecademy
<https://www.codecademy.com/tracks/python>`_ and/or the `Scipy lectures
<https://scipy-lectures.github.io/>`_.
The full API documentation serves to provide more information on a given module
or class.
.. tip:: Users are strongly encouraged to use the Python API to generate input
files and analyze results.
-------
Modules
-------
.. toctree::
:maxdepth: 2
base
stats
mgxs
model
data
openmoc

View file

@ -0,0 +1,61 @@
----------------------------------------------------------
:mod:`openmc.mgxs` -- Multi-Group Cross Section Generation
----------------------------------------------------------
Energy Groups
-------------
.. autosummary::
:toctree: generated
:nosignatures:
:template: myclass.rst
openmc.mgxs.EnergyGroups
Multi-group Cross Sections
--------------------------
.. autosummary::
:toctree: generated
:nosignatures:
:template: myclassinherit.rst
openmc.mgxs.MGXS
openmc.mgxs.AbsorptionXS
openmc.mgxs.CaptureXS
openmc.mgxs.Chi
openmc.mgxs.FissionXS
openmc.mgxs.InverseVelocity
openmc.mgxs.KappaFissionXS
openmc.mgxs.MultiplicityMatrixXS
openmc.mgxs.NuFissionMatrixXS
openmc.mgxs.ScatterXS
openmc.mgxs.ScatterMatrixXS
openmc.mgxs.ScatterProbabilityMatrix
openmc.mgxs.TotalXS
openmc.mgxs.TransportXS
Multi-delayed-group Cross Sections
----------------------------------
.. autosummary::
:toctree: generated
:nosignatures:
:template: myclassinherit.rst
openmc.mgxs.MDGXS
openmc.mgxs.ChiDelayed
openmc.mgxs.DelayedNuFissionXS
openmc.mgxs.DelayedNuFissionMatrixXS
openmc.mgxs.Beta
openmc.mgxs.DecayRate
Multi-group Cross Section Libraries
-----------------------------------
.. autosummary::
:toctree: generated
:nosignatures:
:template: myclass.rst
openmc.mgxs.Library

View file

@ -0,0 +1,40 @@
-------------------------------------
:mod:`openmc.model` -- Model Building
-------------------------------------
TRISO Fuel Modeling
-------------------
Classes
+++++++
.. autosummary::
:toctree: generated
:nosignatures:
:template: myclass.rst
openmc.model.TRISO
Functions
+++++++++
.. autosummary::
:toctree: generated
:nosignatures:
:template: myfunction.rst
openmc.model.create_triso_lattice
openmc.model.pack_trisos
Model Container
---------------
Classes
+++++++
.. autosummary::
:toctree: generated
:nosignatures:
:template: myclass.rst
openmc.model.Model

View file

@ -0,0 +1,24 @@
---------------------------------------------------------
:mod:`openmc.openmoc_compatible` -- OpenMOC Compatibility
---------------------------------------------------------
Core Classes
------------
.. autosummary::
:toctree: generated
:nosignatures:
:template: myfunction.rst
openmc.openmoc_compatible.get_openmoc_material
openmc.openmoc_compatible.get_openmc_material
openmc.openmoc_compatible.get_openmoc_surface
openmc.openmoc_compatible.get_openmc_surface
openmc.openmoc_compatible.get_openmoc_cell
openmc.openmoc_compatible.get_openmc_cell
openmc.openmoc_compatible.get_openmoc_universe
openmc.openmoc_compatible.get_openmc_universe
openmc.openmoc_compatible.get_openmoc_lattice
openmc.openmoc_compatible.get_openmc_lattice
openmc.openmoc_compatible.get_openmoc_geometry
openmc.openmoc_compatible.get_openmc_geometry

View file

@ -0,0 +1,48 @@
.. _pythonapi_stats:
---------------------------------
:mod:`openmc.stats` -- Statistics
---------------------------------
Univariate Probability Distributions
------------------------------------
.. autosummary::
:toctree: generated
:nosignatures:
:template: myclass.rst
openmc.stats.Univariate
openmc.stats.Discrete
openmc.stats.Uniform
openmc.stats.Maxwell
openmc.stats.Watt
openmc.stats.Tabular
openmc.stats.Legendre
openmc.stats.Mixture
Angular Distributions
---------------------
.. autosummary::
:toctree: generated
:nosignatures:
:template: myclass.rst
openmc.stats.UnitSphere
openmc.stats.PolarAzimuthal
openmc.stats.Isotropic
openmc.stats.Monodirectional
Spatial Distributions
---------------------
.. autosummary::
:toctree: generated
:nosignatures:
:template: myclass.rst
openmc.stats.Spatial
openmc.stats.CartesianIndependent
openmc.stats.Box
openmc.stats.Point

View file

@ -106,6 +106,10 @@ should specify an installation directory where you have write access, e.g.
cmake -DCMAKE_INSTALL_PREFIX=$HOME/.local ..
If you want to build a parallel version of OpenMC (using OpenMP or MPI),
directions can be found in the `detailed installation instructions
<usersguide_build>`_.
.. _GitHub: https://github.com/mit-crpg/openmc
.. _git: http://git-scm.com
.. _gfortran: http://gcc.gnu.org/wiki/GFortran

View file

@ -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
-------------------

View 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

View file

@ -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()

View file

@ -13,6 +13,7 @@ essential aspects of using OpenMC to perform simulations.
beginners
install
cross_sections
basics
materials
geometry

View file

@ -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

View file

@ -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::

View file

@ -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

View file

@ -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.

View file

@ -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``
-----------------------------

View file

@ -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`,

View file

@ -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']

View file

@ -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

View file

@ -47,17 +47,17 @@ is affected by the following environment variables.
Indicates the default path to the cross_sections.xml summary file that is used
to locate HDF5 format cross section libraries if the user has not specified the
<cross_sections> tag in
.I settings.xml\fP.
.I materials.xml\fP.
.TP
.B OPENMC_MG_CROSS_SECTIONS
Indicates the default path to the mgxs.xml file that contains multi-group cross
Indicates the default path to an HDF5 file that contains multi-group cross
section libraries if the user has not specified the <cross_sections> tag in
.I settings.xml\fP.
.I materials.xml\fP.
.TP
.B OPENMC_MULTIPOLE_LIBRARY
Indicates the default path to a directory containing windowed multipole data if
the user has not specified the <multipole_library> tag in
.I settings.xml\fP.
.I materials.xml\fP.
.SH LICENSE
Copyright \(co 2011-2017 Massachusetts Institute of Technology.
.PP