Merge branch 'develop' into collisionFilter

This commit is contained in:
Amelia J Trainer 2021-04-07 11:22:43 -04:00 committed by GitHub
commit ab32931870
105 changed files with 2976 additions and 1362 deletions

View file

@ -63,16 +63,16 @@ master_doc = 'index'
# General information about the project.
project = 'OpenMC'
copyright = '2011-2020, Massachusetts Institute of Technology and OpenMC contributors'
copyright = '2011-2021, Massachusetts Institute of Technology and OpenMC contributors'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = "0.12"
version = "0.13"
# The full version, including alpha/beta/rc tags.
release = "0.12.1-dev"
release = "0.13.0-dev"
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
@ -215,6 +215,7 @@ latex_elements = {
\hypersetup{bookmarksdepth=3}
\setcounter{tocdepth}{2}
\numberwithin{equation}{section}
\DeclareUnicodeCharacter{03B1}{$\alpha$}
""",
'printindex': r""
}

View file

@ -215,7 +215,7 @@ Documentation
-------------
Classes, structs, and functions are to be annotated for the `Doxygen
<http://www.doxygen.nl/>`_ documentation generation tool. Use the ``\`` form of
<https://www.doxygen.nl/>`_ documentation generation tool. Use the ``\`` form of
Doxygen commands, e.g., ``\brief`` instead of ``@brief``.
------

View file

@ -14,7 +14,7 @@ functions/classes in the OpenMC Python API.
Prerequisites
-------------
- The test suite relies on the third-party `pytest <https://pytest.org>`_
- The test suite relies on the third-party `pytest <https://docs.pytest.org>`_
package. To run either or both the regression and unit test suites, it is
assumed that you have OpenMC fully installed, i.e., the :ref:`scripts_openmc`
executable is available on your :envvar:`PATH` and the :mod:`openmc` Python
@ -46,7 +46,7 @@ To execute the test suite, go to the ``tests/`` directory and run::
pytest
If you want to collect information about source line coverage in the Python API,
you must have the `pytest-cov <https://pypi.python.org/pypi/pytest-cov>`_ plugin
you must have the `pytest-cov <https://pypi.org/project/pytest-cov>`_ plugin
installed and run::
pytest --cov=../openmc --cov-report=html

View file

@ -65,7 +65,7 @@ developer or send a message to the `developers mailing list`_.
.. _property attribute: https://docs.python.org/3.6/library/functions.html#property
.. _XML Schema Part 2: http://www.w3.org/TR/xmlschema-2/
.. _boolean: http://www.w3.org/TR/xmlschema-2/#boolean
.. _RELAX NG: http://relaxng.org/
.. _compact syntax: http://relaxng.org/compact-tutorial-20030326.html
.. _trang: http://www.thaiopensource.com/relaxng/trang.html
.. _RELAX NG: https://relaxng.org/
.. _compact syntax: https://relaxng.org/compact-tutorial-20030326.html
.. _trang: https://relaxng.org/jclark/trang.html
.. _developers mailing list: https://groups.google.com/forum/?fromgroups=#!forum/openmc-dev

View file

@ -122,11 +122,11 @@ can interfere with virtual environments.
.. _git: http://git-scm.com/
.. _GitHub: https://github.com/
.. _git flow: http://nvie.com/git-model
.. _valgrind: http://valgrind.org/
.. _git flow: https://nvie.com/git-model
.. _valgrind: https://www.valgrind.org/
.. _style guide: https://docs.openmc.org/en/latest/devguide/styleguide.html
.. _pull request: https://help.github.com/articles/using-pull-requests
.. _pull request: https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/about-pull-requests
.. _openmc-dev/openmc: https://github.com/openmc-dev/openmc
.. _paid plan: https://github.com/plans
.. _paid plan: https://github.com/pricing
.. _Bitbucket: https://bitbucket.org
.. _pip: https://pip.pypa.io/en/stable/

View file

@ -1,474 +0,0 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"This notebook shows how to use the OpenMC C/C++ API through the openmc.lib module. This module is particularly useful for multiphysics coupling because it allows you to update the density of materials and the temperatures of cells in memory, without stopping the simulation.\n",
"\n",
"Warning: these bindings are still somewhat experimental and may be subject to change in future versions of OpenMC."
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"%matplotlib inline\n",
"import openmc\n",
"import openmc.lib"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"<b>Generate Input Files</b>\n",
"\n",
"Let's start by creating a fuel rod geometry. We will make 10 zones in the z-direction which will allow us to make changes to each zone. Changes in temperature have to be made on the cell, so will make 10 cells in the axial direction. Changes in density have to be made on the material, so we will make 10 water materials. "
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Materials: we will make a fuel, helium, zircaloy, and 10 water materials. "
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"material_list = []"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"uo2 = openmc.Material(material_id=1, name='UO2 fuel at 2.4% wt enrichment')\n",
"uo2.set_density('g/cm3', 10.29769)\n",
"uo2.add_element('U', 1., enrichment=2.4)\n",
"uo2.add_element('O', 2.)\n",
"material_list.append(uo2)\n",
"\n",
"helium = openmc.Material(material_id=2, name='Helium for gap')\n",
"helium.set_density('g/cm3', 0.001598)\n",
"helium.add_element('He', 2.4044e-4)\n",
"material_list.append(helium)\n",
"\n",
"zircaloy = openmc.Material(material_id=3, name='Zircaloy 4')\n",
"zircaloy.set_density('g/cm3', 6.55)\n",
"zircaloy.add_element('Sn', 0.014, 'wo')\n",
"zircaloy.add_element('Fe', 0.00165, 'wo')\n",
"zircaloy.add_element('Cr', 0.001, 'wo')\n",
"zircaloy.add_element('Zr', 0.98335, 'wo')\n",
"material_list.append(zircaloy)\n",
"\n",
"for i in range(4, 14):\n",
" water = openmc.Material(material_id=i)\n",
" water.set_density('g/cm3', 0.7)\n",
" water.add_element('H', 2.0)\n",
" water.add_element('O', 1.0)\n",
" water.add_s_alpha_beta('c_H_in_H2O')\n",
" material_list.append(water)\n",
" \n",
"materials_file = openmc.Materials(material_list)\n",
"materials_file.export_to_xml()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Cells: we will make a fuel cylinder, a gap cylinder, a cladding cylinder, and a water exterior. Each one will be broken into 10 cells which are the 10 axial zones. The z_list is the list of axial positions that delimit those 10 zones. To keep track of all the cells, we will create lists: fuel_list, gap_list, clad_list, and water_list. "
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
"pitch = 1.25984\n",
"fuel_or = openmc.ZCylinder(r=0.39218)\n",
"clad_ir = openmc.ZCylinder(r=0.40005)\n",
"clad_or = openmc.ZCylinder(r=0.4572)\n",
"left = openmc.XPlane(x0=-pitch/2)\n",
"right = openmc.XPlane(x0=pitch/2)\n",
"back = openmc.YPlane(y0=-pitch/2)\n",
"front = openmc.YPlane(y0=pitch/2)\n",
"z = [0., 30., 60., 90., 120., 150., 180., 210., 240., 270., 300.]\n",
"z_list = [openmc.ZPlane(z0=z_i) for z_i in z]"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
"left.boundary_type = 'reflective'\n",
"right.boundary_type = 'reflective'\n",
"front.boundary_type = 'reflective'\n",
"back.boundary_type = 'reflective'\n",
"z_list[0].boundary_type = 'vacuum'\n",
"z_list[-1].boundary_type = 'vacuum'"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
"fuel_list = []\n",
"gap_list = []\n",
"clad_list = []\n",
"water_list = []\n",
"for i in range(1, 11):\n",
" fuel_list.append(openmc.Cell(cell_id=i))\n",
" gap_list.append(openmc.Cell(cell_id=i+10))\n",
" clad_list.append(openmc.Cell(cell_id=i+20))\n",
" water_list.append(openmc.Cell(cell_id=i+30))\n",
" \n",
"for j, fuels in enumerate(fuel_list):\n",
" fuels.region = -fuel_or & +z_list[j] & -z_list[j+1]\n",
" fuels.fill = uo2\n",
" fuels.temperature = 800.\n",
"\n",
"for j, gaps in enumerate(gap_list):\n",
" gaps.region = +fuel_or & -clad_ir & +z_list[j] & -z_list[j+1]\n",
" gaps.fill = helium\n",
" gaps.temperature = 700.\n",
"\n",
"for j, clads in enumerate(clad_list):\n",
" clads.region = +clad_ir & -clad_or & +z_list[j] & -z_list[j+1]\n",
" clads.fill = zircaloy\n",
" clads.temperature = 600.\n",
"\n",
"for j, waters in enumerate(water_list):\n",
" waters.region = +clad_or & +left & -right & +back & -front & +z_list[j] & -z_list[j+1]\n",
" waters.fill = material_list[j+3]\n",
" waters.temperature = 500."
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [],
"source": [
"root = openmc.Universe(name='root universe')\n",
"root.add_cells(fuel_list)\n",
"root.add_cells(gap_list)\n",
"root.add_cells(clad_list)\n",
"root.add_cells(water_list)\n",
"geometry_file = openmc.Geometry(root)\n",
"geometry_file.export_to_xml()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"If you are coupling this externally to a heat transfer solver, you will want to know the heat deposited by each fuel cell. So let's create a cell filter for the recoverable fission heat. "
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [],
"source": [
"cell_filter = openmc.CellFilter(fuel_list)\n",
"t = openmc.Tally(tally_id=1)\n",
"t.filters.append(cell_filter)\n",
"t.scores = ['fission-q-recoverable']\n",
"tallies = openmc.Tallies([t])\n",
"tallies.export_to_xml()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Let's plot our geometry to make sure it looks like we expect. Since we made new water materials in each axial cell, and we have centered the plot at 150, we should see one color for the water material in the bottom half and a different color for the water material in the top half. "
]
},
{
"cell_type": "code",
"execution_count": 19,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<matplotlib.image.AxesImage at 0x126d642e0>"
]
},
"execution_count": 19,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAFcAAAD4CAYAAACZgnpXAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/Il7ecAAAACXBIWXMAAAsTAAALEwEAmpwYAAAIMElEQVR4nO3df6jddR3H8ecrh2K41JhL04071CxHueqiEAXSDzWhppU0CwwR1h8O+sNKK1iL9I8U8x8zmBVCxMQ/KsvKoKAWodSdqXOOxXQ2N3/MZURKaXPv/jhf19nd/XE85/u63nPu6wGX7fv9nvO9H54cvjuHe9/7qqoIjze83gsYZYlrlLhGiWuUuEaLXu8FACxZsqTGxsamPf78gV2HbR+7859sP/noVr73O555mX+fcfxh+968aMWMz9myZcv+qjpptnPPi7hjY2NMTExMe3zTvs8etv2uS+7l3V9a1sr3vuumJ3n4pxcdtu/ypT+a8TmS/tbLuXNZMEpco8Q1SlyjxDVKXKPENUpco8Q1SlyjxDVKXKPENUpco8Q1SlyjxDWaNa6kH0jaJ+mRrn0bJO2V9GDzdfGk5yyX9IKkLzoWPSx6eeXeAVw0xf5bqmpV8/XLSce+Dfxq0MUNu1l/hlZVmyWN9XpCSZcAu4AX+1/WaBjkmrtO0sPNZeNEAEnHAdcC35jtyZLWSpqQNPHcc88NsIz5q9+43wVOB1YBTwM3N/s30LlcvDDbCapqY1WNV9X4SSfN+lPqodTXj9ar6tlX/y7pduCeZvM84FOSbgROAA5K+k9V3TroQodRX3ElnVJVTzeblwKPAFTVB7oeswF4YaGGhR7iStoEnA8skbQH+DpwvqRVQAFPAJ/3LXF49fJu4fIpdn+/h+dt6GdBoySf0IwS1yhxjRLXKHGNEtcocY0S1yhxjRLXKHGNEtcocY0S1yhxjRLXKHGNEtcocY0S1yhxjRLXKHGNEtcocY0S1yhxjRLXKHGNEtcocY0S1yhxjRLXqNXxVEkfkbRF0tbmzw86Fz/ftT2euh/4WFW9E/gc8MN2ljmcWh1Praq/dG1uA46VdExVvdTn+oZaq+Opk3wSeGChhoX2x1MBkLQS+BYzzKdl9ncaVfVsVb1SVQeB24FzXz0m6TTgJ8AVVfXYDOcY+dnfvuJKOqVr89B4qqQTgF8A11XVHwde3ZBrezx1HXAGsF7S+mbfBVW1r91lD4dWx1Or6nrg+kEXNSryCc0ocY0S1yhxjRLXKHGNEtcocY0S1yhxjRLXKHGNEtcocY0S1yhxjRLXKHGNEtcocY0S1yhxjRLXKHGNEtcocY0S1yhxjRLXKHGNEtcocY0S1yhxjRLXqPVb00r6iqSdknZIutC18GHQ6uyvpLOBNcDK5jm3STqqrcUOm1njVtVm4Pkez7cauLOqXqqqXcBOugYAF5q+7kHZWCfpCmACuKaq/gGcCtzf9Zg9zb4jSFoLrAVYvnz5jN9o1aYbD9s+yL19L7qX8/OFds5rmf3tRcZTpzHD7O9eYFnXQ09r9i1Irc7+Aj8D1kg6RtIK4EzgT4MtcXi1OvtbVdsk3QU8ChwArq6qVywrHwKt35q2qm4AbhhkUaMin9CMEtcocY0S1yhxjRLXKHGNEtcocY0S1yhxjRLXKHGNEtcocY0S1yhxjRLXKHGNEtcocY0S1yhxjRLXKHGNEtcocY0S1yhxjRLXKHGNEtcocY0S16inuFONqHYdu0ZSSVrSbB8v6eeSHpK0TdKVbS96WPT6yr2DKUZUJS0DLgB2d+2+Gni0qs6hM6hys6SjB1vmcOop7gwjqrcAX6Yz1XPo4cBiSQKOa553YMB1DqW+x1MlrQb2VtVDnY6H3EpnHu0pYDHw6WYYcMHpd8jvjcBXgfVTHL4QeBB4K53x1VslvWmKc+TWtNM4HVgBPCTpCTpjqA9IOhm4EvhxdewEdgFvn3yChTD729dloaq2Aktf3W4Cj1fVfkm7gQ8Bf5D0FuAs4PEW1jp0en0rtgm4DzhL0h5JV83w8G8C75O0FfgtcG1V7R98qcOnp1fuNCOq3cfHuv7+FJ23ZwtePqEZJa5R4holrlHiGiWuUeIaJa5R4holrlHiGiWuUeIaJa5R4holrlHiGiWuUeIaJa5R4holrlHiGiWuUeIaJa5R4holrlHiGiWuUeIaJa5R4holrlHiGvV1a9quY4fN/Tb7zm9uV7tN0u/bXvAw6fvWtFPN/Uo6AbgN+HhVrQQua2WVQ2qQW9NONff7GToDfrub5+5rY5HDqt/x1ENzv5MOvQ04UdLvJG1pbl073TlGfjz1NU9Qds39TjVrtgh4L50JymOB+yTdX1V/nfzAqtoIbAQYHx+vycdHQT/jqd1zv/D/ud9z6dxE+e9V9SLwoqTNwDnAEXEXgtd8WaiqrVW1tKrGmsnJPcB7quoZ4G7g/ZIWNa/w84Dtra54iPTyVqznud+q2g7cCzxM536/36uqI97CLRT93pq2+/jYpO2bgJsGW9ZoyCc0o8Q1SlyjxDVKXKPENUpco8Q1SlyjxDVKXKPENUpco8Q1SlyjxDVS1ev/s0FJ/wJ2GE69BHD8D6hnVdXi2R7U93+r3bIdVTXe9kklTbjO28vjclkwSlyj+RJ34yied178gzaq5ssrdyQlrtG8iSvpsuYXpg9KGvjtk6SLJO2QtFPSdS2tcdpfBJ/KvIkLPAJ8Atg86IkkHQV8B/gocDZwuaSzBz0v0/wi+HTmTdyq2l5VbX1KOxfYWVWPV9XLwJ3A6kFPOsMvgk9p3sRt2anAk13be5p9c2pOP/5K+g1w8hSHvlZVd8/lWubCnMatqg/P0bfaCyzr2j6t2TenRvWy8GfgTEkrmrsIrqFzj7a5VVXz4gu4lM618SXgWeDXA57vYjrjAo/Ruey0scZNwNPAf5u1XjXT4/Px12hULwvzQuIaJa5R4holrlHiGiWu0f8AXl9L6QNoVkwAAAAASUVORK5CYII=\n",
"text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"root.plot(basis='yz', width=[2, 10], color_by='material', origin=[0., 0., 150.], pixels=[400, 400])"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Settings: everything will be standard except for the temperature settings. Since we will be working with specified temperatures, you will need temperature dependent data. I typically use the endf data found here: https://openmc.org/official-data-libraries/\n",
"Make sure your cross sections environment variable is pointing to temperature-dependent data before using the following settings."
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {},
"outputs": [],
"source": [
"lower_left = [-0.62992, -pitch/2, 0]\n",
"upper_right = [+0.62992, +pitch/2, +300]\n",
"uniform_dist = openmc.stats.Box(lower_left, upper_right, only_fissionable=True)\n",
"\n",
"settings_file = openmc.Settings()\n",
"settings_file.batches = 100\n",
"settings_file.inactive = 10\n",
"settings_file.particles = 10000\n",
"settings_file.temperature = {'multipole': True, 'method': 'interpolation', 'range': [290, 2500]}\n",
"settings_file.source = openmc.source.Source(space=uniform_dist)\n",
"settings_file.export_to_xml()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"To run a regular simulation, just use openmc.run(). \n",
"However, we want to run a simulation that we can stop in the middle and update the material and cell properties. So we will use openmc.lib."
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {},
"outputs": [],
"source": [
"openmc.lib.init()\n",
"openmc.lib.simulation_init()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"There are 10 inactive batches, so we need to run next_batch() at least 10 times before the tally is activated. "
]
},
{
"cell_type": "code",
"execution_count": 15,
"metadata": {},
"outputs": [],
"source": [
"for _ in range(14):\n",
" openmc.lib.next_batch()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Let's take a look at the tally. There are 10 entries, one for each cell in the fuel."
]
},
{
"cell_type": "code",
"execution_count": 16,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[[ 4178272.4202991 ]\n",
" [ 9595363.82759911]\n",
" [12307462.30060902]\n",
" [11772927.66594472]\n",
" [11892601.29001472]\n",
" [12203397.88895767]\n",
" [12851791.20965905]\n",
" [11760027.45873386]\n",
" [ 9293110.94735569]\n",
" [ 4511597.61592287]]\n"
]
}
],
"source": [
"t = openmc.lib.tallies[1]\n",
"print(t.mean)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Now, let's make some changes to the temperatures. For this, we need to identify each cell by its id. We can use get_temperature() to compare the temperatures of the cells before and after the change. "
]
},
{
"cell_type": "code",
"execution_count": 17,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"fuel temperature is: \n",
"800.0\n",
"gap temperature is: \n",
"700.0\n",
"clad temperature is: \n",
"600.0\n",
"water temperature is: \n",
"500.00000000000006\n"
]
}
],
"source": [
"print(\"fuel temperature is: \")\n",
"print(openmc.lib.cells[5].get_temperature())\n",
"print(\"gap temperature is: \")\n",
"print(openmc.lib.cells[15].get_temperature())\n",
"print(\"clad temperature is: \")\n",
"print(openmc.lib.cells[25].get_temperature())\n",
"print(\"water temperature is: \")\n",
"print(openmc.lib.cells[35].get_temperature())"
]
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {},
"outputs": [],
"source": [
"for i in range(1, 11):\n",
" temp = 900.0\n",
" openmc.lib.cells[i].set_temperature(temp)"
]
},
{
"cell_type": "code",
"execution_count": 19,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"fuel temperature is: \n",
"899.9999999999999\n"
]
}
],
"source": [
"print(\"fuel temperature is: \")\n",
"print(openmc.lib.cells[5].get_temperature())"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Let's make a similar change for the water density. Again, we need to identify each material by its id."
]
},
{
"cell_type": "code",
"execution_count": 20,
"metadata": {},
"outputs": [],
"source": [
"for i in range(4, 14):\n",
" density = 0.65\n",
" openmc.lib.materials[i].set_density(density, units='g/cm3')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The new batches we run will use the new material and cell properties."
]
},
{
"cell_type": "code",
"execution_count": 21,
"metadata": {},
"outputs": [],
"source": [
"for _ in range(14):\n",
" openmc.lib.next_batch()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"When you're ready to end the simulation, use the following:"
]
},
{
"cell_type": "code",
"execution_count": 22,
"metadata": {},
"outputs": [],
"source": [
"openmc.lib.simulation_finalize()\n",
"openmc.lib.finalize()"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.0"
}
},
"nbformat": 4,
"nbformat_minor": 4
}

View file

@ -0,0 +1 @@
../../../examples/jupyter/capi.ipynb

View file

@ -19,7 +19,7 @@ General Usage
post-processing
pandas-dataframes
tally-arithmetic
CAPI
capi
expansion-filters
search
nuclear-data

View file

@ -13,8 +13,8 @@ programming model.
OpenMC was originally developed by members of the `Computational Reactor Physics
Group <http://crpg.mit.edu>`_ at the `Massachusetts Institute of Technology
<http://web.mit.edu>`_ starting in 2011. Various universities, laboratories, and
other organizations now contribute to the development of OpenMC. For more
<https://web.mit.edu>`_ starting in 2011. Various universities, laboratories,
and other organizations now contribute to the development of OpenMC. For more
information on OpenMC, feel free to post a message on the `OpenMC Discourse
Forum <https://openmc.discourse.group/>`_.

View file

@ -49,4 +49,4 @@ Windowed Multipole Library Format
windows[i, 1] are, respectively, the indexes (1-based) of the first and
last pole in window i.
.. _h5py: http://docs.h5py.org/en/latest/
.. _h5py: https://docs.h5py.org/en/latest/

View file

@ -44,7 +44,6 @@ Output Files
statepoint
source
surface_source
summary
depletion_results
particle_restart

View file

@ -21,7 +21,7 @@ nuclides or materials.
The current version of the multi-group library file format is 1.0.
.. _HDF5: http://www.hdfgroup.org/HDF5/
.. _HDF5: https://www.hdfgroup.org/solutions/hdf5/
.. _mgxs_lib_spec:

View file

@ -162,5 +162,5 @@ All values are given in seconds and are measured on the master process.
source sites between processes for load balancing.
- **accumulating tallies** (*double*) -- Time spent communicating
tally results and evaluating their statistics.
- **writing statepoints** (*double*) -- Time spent writing statepoint
files
- **writing statepoints** (*double*) -- Time spent writing statepoint
files

View file

@ -4,7 +4,7 @@
License Agreement
=================
Copyright © 2011-2020 Massachusetts Institute of Technology and OpenMC contributors
Copyright © 2011-2021 Massachusetts Institute of Technology and OpenMC contributors
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in

View file

@ -186,10 +186,10 @@ The data governing the interaction of particles with various nuclei or materials
are represented using a multi-group library format specific to the OpenMC code.
The format is described in the :ref:`mgxs_lib_spec`. The data itself can be
prepared via traditional paths or directly from a continuous-energy OpenMC
calculation by use of the Python API as is shown in the
:ref:`notebook_mg_mode_part_i` example notebook. This multi-group library
consists of meta-data (such as the energy group structure) and multiple `xsdata`
objects which contains the required microscopic or macroscopic multi-group data.
calculation by use of the Python API as is shown in an `example notebook
<../examples/mg-mode-part-i.ipynb>`_. This multi-group library consists of
meta-data (such as the energy group structure) and multiple `xsdata` objects
which contains the required microscopic or macroscopic multi-group data.
At a minimum, the library must contain the absorption cross section
(:math:`\sigma_{a,g}`) and a scattering matrix. If the problem is an eigenvalue
@ -269,12 +269,12 @@ or even isotropic scattering.
.. _logarithmic mapping technique:
https://laws.lanl.gov/vhosts/mcnp.lanl.gov/pdf_files/la-ur-14-24530.pdf
.. _Hwang: http://www.ans.org/pubs/journals/nse/a_16381
.. _Hwang: https://doi.org/10.13182/NSE87-A16381
.. _Josey: https://doi.org/10.1016/j.jcp.2015.08.013
.. _WMP Library: https://github.com/mit-crpg/WMP_Library
.. _MCNP: http://mcnp.lanl.gov
.. _MCNP: https://mcnp.lanl.gov
.. _Serpent: http://montecarlo.vtt.fi
.. _NJOY: http://t2.lanl.gov/codes.shtml
.. _ENDF/B data: http://www.nndc.bnl.gov/endf
.. _NJOY: https://www.njoy21.io/NJOY21/
.. _ENDF/B data: https://www.nndc.bnl.gov/endf/b8.0/
.. _Leppanen: https://doi.org/10.1016/j.anucene.2009.03.019
.. _algorithms: http://ab-initio.mit.edu/wiki/index.php/Faddeeva_Package

View file

@ -962,6 +962,6 @@ surface is known as in :ref:`reflection`.
.. _constructive solid geometry: https://en.wikipedia.org/wiki/Constructive_solid_geometry
.. _surfaces: https://en.wikipedia.org/wiki/Surface
.. _MCNP: http://mcnp.lanl.gov
.. _MCNP: https://mcnp.lanl.gov
.. _Serpent: http://montecarlo.vtt.fi
.. _Monte Carlo Performance benchmark: https://github.com/mit-crpg/benchmarks/tree/master/mc-performance/openmc

View file

@ -76,10 +76,11 @@ absorption cross section (this includes fission), and :math:`\sigma_f` is the
total fission cross section. If this condition is met, then the neutron is
killed and we proceed to simulate the next neutron from the source bank.
No secondary particles from disappearance reactions such as photons or
alpha-particles are produced or tracked. To truly capture the affects of gamma
heating in a problem, it would be necessary to explicitly track photons
originating from :math:`(n,\gamma)` and other reactions.
Note that photons arising from :math:`(n,\gamma)` and other neutron reactions
are not produced in a microscopically correct manner. Instead, photons are
sampled probabilistically at each neutron collision, regardless of what reaction
actually takes place. This is described in more detail in
:ref:`photon_production`.
------------------
Elastic Scattering
@ -1694,7 +1695,7 @@ another.
.. _SIGMA1 method: https://doi.org/10.13182/NSE76-1
.. _scaled interpolation: http://www.ans.org/pubs/journals/nse/a_26575
.. _scaled interpolation: https://doi.org/10.13182/NSE73-A26575
.. _probability table method: https://doi.org/10.13182/NSE72-3
@ -1702,23 +1703,23 @@ another.
.. _Foderaro: http://hdl.handle.net/1721.1/1716
.. _OECD: http://www.oecd-nea.org/tools/abstract/detail/NEA-1792
.. _OECD: https://www.oecd-nea.org/tools/abstract/detail/NEA-1792
.. _NJOY: https://www.njoy21.io/NJOY2016/
.. _PREPRO: http://www-nds.iaea.org/ndspub/endf/prepro/
.. _PREPRO: https://www-nds.iaea.org/ndspub/endf/prepro/
.. _endf102: https://www.oecd-nea.org/dbdata/data/manual-endf/endf102.pdf
.. _Monte Carlo Sampler: https://laws.lanl.gov/vhosts/mcnp.lanl.gov/pdf_files/la-9721.pdf
.. _Monte Carlo Sampler: https://permalink.lanl.gov/object/tr?what=info:lanl-repo/lareport/LA-09721-MS
.. _LA-UR-14-27694: http://permalink.lanl.gov/object/tr?what=info:lanl-repo/lareport/LA-UR-14-27694
.. _LA-UR-14-27694: https://permalink.lanl.gov/object/tr?what=info:lanl-repo/lareport/LA-UR-14-27694
.. _MC21: http://www.osti.gov/bridge/servlets/purl/903083-HT5p1o/903083.pdf
.. _MC21: https://www.osti.gov/biblio/903083
.. _Romano: https://doi.org/10.1016/j.cpc.2014.11.001
.. _Sutton and Brown: http://www.osti.gov/bridge/product.biblio.jsp?osti_id=307911
.. _Sutton and Brown: https://www.osti.gov/biblio/307911
.. _lectures: https://laws.lanl.gov/vhosts/mcnp.lanl.gov/pdf_files/la-ur-05-4983.pdf

View file

@ -251,8 +251,8 @@ depending on how many nodes are communicating and the size of the message. Using
multiple algorithms allows one to minimize latency for small messages and
minimize bandwidth for long messages.
We will focus here on the implementation of broadcast in the MPICH2_
implementation. For short messages, MPICH2 uses a `binomial tree`_ algorithm. In
We will focus here on the implementation of broadcast in the MPICH_
implementation. For short messages, MPICH uses a `binomial tree`_ algorithm. In
this algorithm, the root process sends the data to one node in the first step,
and then in the subsequent, both the root and the other node can send the data
to other nodes. Thus, it takes a total of :math:`\lceil \log_2 p \rceil` steps
@ -266,7 +266,7 @@ to complete the communication. The time to complete the communication is
This algorithm works well for short messages since the latency term scales
logarithmically with the number of nodes. However, for long messages, an
algorithm that has lower bandwidth has been proposed by Barnett_ and implemented
in MPICH2. Rather than using a binomial tree, the broadcast is divided into a
in MPICH. Rather than using a binomial tree, the broadcast is divided into a
scatter and an allgather. The time to complete the scatter is :math:` \log_2 p
\: \alpha + \frac{p-1}{p} N\beta` using a binomial tree algorithm. The allgather
is performed using a ring algorithm that completes in :math:`p-1) \alpha +
@ -613,7 +613,7 @@ is actually independent of the number of nodes:
.. _Brissenden and Garlick: https://doi.org/10.1016/0306-4549(86)90095-2
.. _MPICH2: http://www.mcs.anl.gov/mpi/mpich
.. _MPICH: http://www.mpich.org
.. _binomial tree: https://www.mcs.anl.gov/~thakur/papers/ijhpca-coll.pdf
@ -629,19 +629,19 @@ is actually independent of the number of nodes:
.. _message-passing interface: https://en.wikipedia.org/wiki/Message_Passing_Interface
.. _PVM: http://www.csm.ornl.gov/pvm/pvm_home.html
.. _PVM: https://www.csm.ornl.gov/pvm/pvm_home.html
.. _MPI: http://www.mcs.anl.gov/research/projects/mpi/
.. _MPI: https://www.mcs.anl.gov/research/projects/mpi/
.. _embarrassingly parallel: https://en.wikipedia.org/wiki/Embarrassingly_parallel
.. _sends: http://www.mcs.anl.gov/research/projects/mpi/www/www3/MPI_Send.html
.. _sends: https://www.mpich.org//static/docs/latest/www3/MPI_Send.html
.. _broadcasts: http://www.mcs.anl.gov/research/projects/mpi/www/www3/MPI_Bcast.html
.. _broadcasts: https://www.mpich.org//static/docs/latest/www3/MPI_Bcast.html
.. _scatter: http://www.mcs.anl.gov/research/projects/mpi/www/www3/MPI_Scatter.html
.. _scatter: https://www.mpich.org//static/docs/latest/www3/MPI_Scatter.html
.. _allgather: http://www.mcs.anl.gov/research/projects/mpi/www/www3/MPI_Allgather.html
.. _allgather: https://www.mpich.org//static/docs/latest/www3/MPI_Allgather.html
.. _Cauchy distribution: https://en.wikipedia.org/wiki/Cauchy_distribution

View file

@ -1004,6 +1004,8 @@ direction of the incident charged particle, which is a reasonable approximation
at higher energies when the bremsstrahlung radiation is emitted at small
angles.
.. _photon_production:
-----------------
Photon Production
-----------------
@ -1067,6 +1069,6 @@ emitted photon.
.. _Kaltiaisenaho: https://aaltodoc.aalto.fi/bitstream/handle/123456789/21004/master_Kaltiaisenaho_Toni_2016.pdf
.. _Salvat: http://www.oecd-nea.org/globalsearch/download.php?doc=77434
.. _Salvat: https://www.oecd-nea.org/globalsearch/download.php?doc=77434
.. _Sternheimer: https://doi.org/10.1103/PhysRevB.26.6067

View file

@ -7,8 +7,8 @@ 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
: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
common third-party packages such as `NumPy <https://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:
@ -28,7 +28,7 @@ there are many substantial benefits to using the Python API, including:
For those new to Python, there are many good tutorials available online. We
recommend going through the modules from `Codecademy
<https://www.codecademy.com/learn/learn-python-3>`_ and/or the `Scipy lectures
<https://scipy-lectures.github.io/>`_.
<https://scipy-lectures.org/>`_.
The full API documentation serves to provide more information on a given module
or class.

View file

@ -12,7 +12,7 @@ OpenMC, see :ref:`usersguide_install` in the User's Manual.
Installing on Linux/Mac with conda-forge
----------------------------------------
`Conda <http://conda.pydata.org/docs/>`_ is an open source package management
`Conda <https://conda.io/en/latest/>`_ is an open source package management
system and environment management system for installing multiple versions of
software packages and their dependencies and switching easily between them. If
you have `conda` installed on your system, OpenMC can be installed via the
@ -25,16 +25,16 @@ you have `conda` installed on your system, OpenMC can be installed via the
To list the versions of OpenMC that are available on the `conda-forge` channel,
in your terminal window or an Anaconda Prompt run:
.. code-block:: sh
.. code-block:: sh
conda search openmc
OpenMC can then be installed with:
.. code-block:: sh
conda create -n openmc-env openmc
This will install OpenMC in a conda environment called `openmc-env`. To activate
the environment, run:
@ -42,66 +42,61 @@ the environment, run:
conda activate openmc-env
--------------------------------
Installing on Ubuntu through PPA
--------------------------------
For users with Ubuntu 15.04 or later, a binary package for OpenMC is available
through a `Personal Package Archive`_ (PPA) and can be installed through the
`APT package manager`_. First, add the following PPA to the repository sources:
.. code-block:: sh
sudo apt-add-repository ppa:paulromano/staging
Next, resynchronize the package index files:
.. code-block:: sh
sudo apt update
Now OpenMC should be recognized within the repository and can be installed:
.. code-block:: sh
sudo apt install openmc
Binary packages from this PPA may exist for earlier versions of Ubuntu, but they
are no longer supported.
.. _Personal Package Archive: https://launchpad.net/~paulromano/+archive/staging
.. _APT package manager: https://help.ubuntu.com/community/AptGet/Howto
-------------------------------------------
Installing on Linux/Mac/Windows with Docker
-------------------------------------------
OpenMC can be easily deployed using `Docker <https://www.docker.com/>`_ on any
Windows, Mac or Linux system. With Docker running, execute the following
command in the shell to download and run a `Docker image`_ with the most recent release of OpenMC from `DockerHub <https://hub.docker.com/>`_ called ``openmc/openmc:v0.10.0``:
Windows, Mac, or Linux system. With Docker running, execute the following command
in the shell to download and run a `Docker image`_ with the most recent release
of OpenMC from `DockerHub <https://hub.docker.com/>`_:
.. code-block:: sh
docker run openmc/openmc:v0.10.0
docker run openmc/openmc:latest
This will take several minutes to run depending on your internet download speed. The command will place you in an interactive shell running in a `Docker container`_ with OpenMC installed.
This will take several minutes to run depending on your internet download speed.
The command will place you in an interactive shell running in a `Docker
container`_ with OpenMC installed.
.. note:: The ``docker run`` command supports many `options`_ for spawning
containers -- including `mounting volumes`_ from the host
filesystem -- which many users will find useful.
containers including `mounting volumes`_ from the host filesystem,
which many users will find useful.
.. _Docker image: https://docs.docker.com/engine/reference/commandline/images/
.. _Docker container: https://www.docker.com/resources/what-container
.. _options: https://docs.docker.com/engine/reference/commandline/run/
.. _mounting volumes: https://docs.docker.com/storage/volumes/
---------------------------------------
Installing from Source on Ubuntu 15.04+
---------------------------------------
----------------------------------
Installing from Source using Spack
----------------------------------
Spack_ is a package management tool designed to support multiple versions and
configurations of software on a wide variety of platforms and environments.
Please follow Spack's `setup guide`_ to configure the Spack system.
To install the latest OpenMC with the Python API, use the following command:
.. code-block:: sh
spack install py-openmc
For more information about customizations including MPI, see the
:ref:`detailed installation instructions using Spack <install-spack>`.
Once installed, environment/lmod modules can be generated or Spack's `load` feature
can be used to access the installed packages.
.. _Spack: https://spack.readthedocs.io/en/latest/
.. _setup guide: https://spack.readthedocs.io/en/latest/getting_started.html
--------------------------------
Installing from Source on Ubuntu
--------------------------------
To build OpenMC from source, several :ref:`prerequisites <prerequisites>` are
needed. If you are using Ubuntu 15.04 or higher, all prerequisites can be
installed directly from the package manager.
needed. If you are using Ubuntu or higher, all prerequisites can be installed
directly from the package manager:
.. code-block:: sh
@ -117,9 +112,9 @@ Installing from Source on Linux or Mac OS X
All OpenMC source code is hosted on `GitHub
<https://github.com/openmc-dev/openmc>`_. If you have `git
<https://git-scm.com>`_, the `gcc <https://gcc.gnu.org/>`_ compiler suite,
`CMake <http://www.cmake.org>`_, and `HDF5 <https://www.hdfgroup.org/HDF5/>`_
installed, you can download and install OpenMC be entering the following
commands in a terminal:
`CMake <https://cmake.org>`_, and `HDF5
<https://www.hdfgroup.org/solutions/hdf5/>`_ installed, you can download and
install OpenMC be entering the following commands in a terminal:
.. code-block:: sh
@ -140,8 +135,8 @@ should specify an installation directory where you have write access, e.g.
The :mod:`openmc` Python package must be installed separately. The easiest way
to install it is using `pip <https://pip.pypa.io/en/stable/>`_, which is
included by default in Python 2.7 and Python 3.4+. From the root directory of
the OpenMC distribution/repository, run:
included by default in Python 3.4+. From the root directory of the OpenMC
distribution/repository, run:
.. code-block:: sh

View file

@ -0,0 +1,122 @@
====================
What's New in 0.12.1
====================
.. currentmodule:: openmc
-------
Summary
-------
This release of OpenMC includes an assortment of new features and many bug
fixes. The :mod:`openmc.deplete` module incorporates a number of improvements in
usability, accuracy, and performance. Other enhancements include generalized
rotational periodic boundary conditions, expanded source modeling capabilities,
and a capability to generate windowed multipole library files from ENDF files.
------------
New Features
------------
- Boundary conditions have been refactored and generalized. Rotational periodic
boundary conditions can now be applied to any N-fold symmetric geometry.
- External source distributions have been refactored and extended. Users writing
their own C++ custom sources need to write a class that derives from
``openmc::Source``. These changes have enabled new functionality, such as:
- Mixing more than one custom source library together
- Mixing a normal source with a custom source
- Using a file-based source for fixed source simulations
- Using a file-based source for eigenvalue simulations even when the number of
particles doesn't match
- New capability to read and write a source file based on particles that cross a
surface (known as a "surface source").
- Various improvements related to depletion:
- Reactions used in a depletion chain can now be configured through the
``reactions`` argument to :meth:`openmc.deplete.Chain.from_endf`.
- Specifying a power of zero during a depletion simulation no longer results
in an unnecessary transport solve.
- Reaction rates can be computed either directly or using multigroup flux
tallies that are used to collapse reaction rates afterward. This is enabled
through the ``reaction_rate_mode`` and ``reaction_rate_opts`` to
:class:`openmc.deplete.Operator`.
- Depletion results can be used to create a new :class:`openmc.Materials`
object using the :meth:`openmc.deplete.ResultsList.export_to_materials`
method.
- Multigroup current and diffusion cross sections can be generated through the
:class:`openmc.mgxs.Current` and :class:`openmc.mgxs.DiffusionCoefficient`
classes.
- Added :func:`openmc.data.isotopes` function that returns a list of naturally
occurring isotopes for a given element.
- Windowed multipole libraries can now be generated directly from the Python API
using :meth:`openmc.data.WindowedMultipole.from_endf`.
- The new :func:`openmc.write_source_file` function allows source files to be
generated programmatically.
---------
Bug Fixes
---------
- `Proper detection of MPI wrappers <https://github.com/openmc-dev/openmc/pull/1619>`_
- `Fix related to declaration order of maps/vectors <https://github.com/openmc-dev/openmc/pull/1622>`_
- `Check for existence of decay rate attribute <https://github.com/openmc-dev/openmc/pull/1629>`_
- `Small updates to deal with JEFF 3.3 data <https://github.com/openmc-dev/openmc/pull/1638>`_
- `Fix for depletion chain generation <https://github.com/openmc-dev/openmc/pull/1642>`_
- `Fix call to superclass constructor in MeshPlotter <https://github.com/openmc-dev/openmc/pull/1644>`_
- `Fix for data crossover in VTK files <https://github.com/openmc-dev/openmc/pull/1645>`_
- `Make sure reaction names are recognized as valid tally scores <https://github.com/openmc-dev/openmc/pull/1647>`_
- `Fix bug related to logging of particle restarts <https://github.com/openmc-dev/openmc/pull/1649>`_
- `Examine if region exists before removing redundant surfaces <https://github.com/openmc-dev/openmc/pull/1650>`_
- `Fix plotting of individual universe levels <https://github.com/openmc-dev/openmc/pull/1651>`_
- `Mixed materials should inherit depletable attribute <https://github.com/openmc-dev/openmc/pull/1657>`_
- `Fix typo in energy units in dose coefficients <https://github.com/openmc-dev/openmc/pull/1659/files>`_
- `Fixes for large tally cases <https://github.com/openmc-dev/openmc/pull/1666>`_
- `Fix verification of volume calculation results <https://github.com/openmc-dev/openmc/pull/1677>`_
- `Fix calculation of decay energy for depletion chains <https://github.com/openmc-dev/openmc/pull/1679>`_
- `Fix pointers in CartesianIndependent <https://github.com/openmc-dev/openmc/pull/1681>`_
- `Ensure correct initialization of members for RegularMesh <https://github.com/openmc-dev/openmc/pull/1683>`_
- `Add missing import in depletion module <https://github.com/openmc-dev/openmc/pull/1715>`_
- `Fixed several bugs related to decay-rate <https://github.com/openmc-dev/openmc/pull/1718>`_
- `Fix how depletion operator distributes burnable materials <https://github.com/openmc-dev/openmc/pull/1719>`_
- `Fix assignment of elemental carbon in JEFF 3.3 <https://github.com/openmc-dev/openmc/pull/1722>`_
- `Fix typo in RectangularParallelepiped.__pos__ <https://github.com/openmc-dev/openmc/pull/1724>`_
- `Fix temperature tolerance with S(a,b) data <https://github.com/openmc-dev/openmc/pull/1733>`_
- `Fix sampling or normal distribution <https://github.com/openmc-dev/openmc/pull/1739>`_
- `Fix for SharedArray relaxed memory ordering <https://github.com/openmc-dev/openmc/pull/1764>`_
- `Check for proper format of source files <https://github.com/openmc-dev/openmc/pull/1771>`_
- `Ensure (n,gamma) reaction rate tally uses sampled cross section <https://github.com/openmc-dev/openmc/pull/1776>`_
- `Fix for temperature range behavior <https://github.com/openmc-dev/openmc/pull/1777>`_
------------
Contributors
------------
This release contains new contributions from the following people:
- `Andrew Davis <https://github.com/makeclean>`_
- `Guillaume Giudicelli <https://github.com/GiudGiud>`_
- `Sterling Harper <https://github.com/smharper>`_
- `Bryan Herman <https://github.com/bryanherman>`_
- `Yue Jin <https://github.com/kingyue737>`_
- `Andrew Johnson <https://github.com/drewejohnson>`_
- `Miriam Kreher <https://github.com/mkreher13>`_
- `Shikhar Kumar <https://github.com/shikhar413>`_
- `Jingang Liang <https://github.com/liangjg>`_
- `Amanda Lund <https://github.com/amandalund>`_
- `Adam Nelson <https://github.com/nelsonag>`_
- `April Novak <https://github.com/aprilnovak>`_
- `YoungHui Park <https://github.com/ypark234>`_
- `Ariful Islam Pranto <https://github.com/AI-Pranto>`_
- `Ron Rahaman <https://github.com/RonRahaman>`_
- `Gavin Ridley <https://github.com/gridley>`_
- `Paul Romano <https://github.com/paulromano>`_
- `Jonathan Shimwell <https://github.com/Shimwell>`_
- `Dan Short <https://github.com/DanShort12>`_
- `Patrick Shriwise <https://github.com/pshriwise>`_
- `Roy Stogner <https://github.com/roystgnr>`_
- `John Tramm <https://github.com/jtramm>`_
- `Cyrus Wyett <https://github.com/cjwyett>`_
- `Jiankai Yu <https://github.com/rockfool>`_

View file

@ -7,6 +7,7 @@ Release Notes
.. toctree::
:maxdepth: 1
0.12.1
0.12.0
0.11.0
0.10.0

View file

@ -5,13 +5,13 @@ Basics of Using OpenMC
======================
----------------
Creating a Model
Running 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
is look for a set of XML_ files that describe the model you want to
simulation. Three of these files are required and another three are optional, as
simulate. Three of these files are required and another three are optional, as
described below.
.. admonition:: Required
@ -43,6 +43,10 @@ described below.
This file gives specifications for producing slice or voxel plots of the
geometry.
.. warning::
OpenMC models should be treated as code, and it is important to be careful with code from untrusted sources.
eXtensible Markup Language (XML)
--------------------------------

View file

@ -113,7 +113,7 @@ or Mac OS X (also Unix-derived), `this tutorial
commonly-used commands.
To reap the full benefits of OpenMC, you should also have basic proficiency in
the use of `Python <http://www.python.org/>`_, as OpenMC includes a rich Python
the use of `Python <https://www.python.org/>`_, as OpenMC includes a rich Python
API that offers many usability improvements over dealing with raw XML input
files.
@ -126,8 +126,9 @@ at the git documentation website. The `OpenMC source code`_ and documentation
are hosted at `GitHub`_. In order to receive updates to the code directly,
submit `bug reports`_, and perform other development tasks, you may want to sign
up for a free account on GitHub. Once you have an account, you can follow `these
instructions <https://help.github.com/articles/set-up-git/>`_ on how to set up
your computer for using GitHub.
instructions
<https://docs.github.com/en/github/getting-started-with-github/set-up-git>`_ on
how to set up your computer for using GitHub.
If you are new to nuclear engineering, you may want to review the NRC's `Reactor
Concepts Manual`_. This manual describes the basics of nuclear power for
@ -149,7 +150,7 @@ and `Volume II`_. You may also find it helpful to review the following terms:
.. _discretization: https://en.wikipedia.org/wiki/Discretization
.. _constructive solid geometry: https://en.wikipedia.org/wiki/Constructive_solid_geometry
.. _git: http://git-scm.com/
.. _git tutorials: http://git-scm.com/documentation
.. _git tutorials: https://git-scm.com/doc
.. _Reactor Concepts Manual: http://www.tayloredge.com/periodic/trivia/ReactorConcepts.pdf
.. _Volume I: https://www.standards.doe.gov/standards-documents/1000/1019-bhdbk-1993-v1
.. _Volume II: https://www.standards.doe.gov/standards-documents/1000/1019-bhdbk-1993-v2

View file

@ -124,7 +124,7 @@ 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.
see the `example notebook <../examples/nuclear-data.ipynb>`__.
Manually Creating a Library from ENDF files
-------------------------------------------
@ -252,15 +252,15 @@ 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`.
For an example of how to create a multi-group library, see the `example notebook
<../examples/mg-mode-part-i.ipynb>`__.
.. _NJOY: http://www.njoy21.io/
.. _NNDC: https://www.nndc.bnl.gov/endf
.. _MCNP: https://mcnp.lanl.gov
.. _Serpent: http://montecarlo.vtt.fi
.. _ENDF/B: https://www.nndc.bnl.gov/endf/b7.1/acefiles.html
.. _JEFF: http://www.oecd-nea.org/dbdata/jeff/jeff33/
.. _JEFF: https://www.oecd-nea.org/dbdata/jeff/jeff33/
.. _TENDL: https://tendl.web.psi.ch/tendl_2017/tendl2017.html
.. _Seltzer and Berger: https://doi.org/10.1016/0092-640X(86)90014-8
.. _NIST ESTAR database: https://physics.nist.gov/PhysRefData/Star/Text/ESTAR.html

View file

@ -30,6 +30,12 @@ operator class requires a :class:`openmc.Geometry` instance and a
Any material that contains a fissionable nuclide is depleted by default, but
this can behavior can be changed with the :attr:`Material.depletable` attribute.
.. important:: The volume must be specified for each material that is depleted by
setting the :attr:`Material.volume` attribute. This is necessary
in order to calculate the proper normalization of tally results
based on the source rate.
:mod:`openmc.deplete` supports multiple time-integration methods for determining
material compositions over time. Each method appears as a different class.
For example, :class:`openmc.deplete.CECMIntegrator` runs a depletion calculation

View file

@ -261,7 +261,7 @@ lowest-level cell at that location::
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.
have `matplotlib <https://matplotlib.org/>`_ installed.
.. _usersguide_lattices:

View file

@ -12,11 +12,11 @@ Installation and Configuration
Installing on Linux/Mac with conda-forge
----------------------------------------
`Conda <http://conda.pydata.org/docs/>`_ is an open source package management
system and environment management system for installing multiple versions of
software packages and their dependencies and switching easily between them. If
you have `conda` installed on your system, OpenMC can be installed via the
`conda-forge` channel. First, add the `conda-forge` channel with:
Conda_ is an open source package management system and environment management
system for installing multiple versions of software packages and their
dependencies and switching easily between them. If you have `conda` installed on
your system, OpenMC can be installed via the `conda-forge` channel. First, add
the `conda-forge` channel with:
.. code-block:: sh
@ -25,16 +25,16 @@ you have `conda` installed on your system, OpenMC can be installed via the
To list the versions of OpenMC that are available on the `conda-forge` channel,
in your terminal window or an Anaconda Prompt run:
.. code-block:: sh
.. code-block:: sh
conda search openmc
OpenMC can then be installed with:
.. code-block:: sh
conda create -n openmc-env openmc
This will install OpenMC in a conda environment called `openmc-env`. To activate
the environment, run:
@ -42,37 +42,118 @@ the environment, run:
conda activate openmc-env
.. _install_ppa:
-------------------------------------------
Installing on Linux/Mac/Windows with Docker
-------------------------------------------
-----------------------------
Installing on Ubuntu with PPA
-----------------------------
For users with Ubuntu 15.04 or later, a binary package for OpenMC is available
through a `Personal Package Archive`_ (PPA) and can be installed through the
`APT package manager`_. First, add the following PPA to the repository sources:
OpenMC can be easily deployed using `Docker <https://www.docker.com/>`_ on any
Windows, Mac, or Linux system. With Docker running, execute the following
command in the shell to download and run a `Docker image`_ with the most recent
release of OpenMC from `DockerHub <https://hub.docker.com/>`_:
.. code-block:: sh
sudo apt-add-repository ppa:paulromano/staging
docker run openmc/openmc:latest
Next, resynchronize the package index files:
This will take several minutes to run depending on your internet download speed.
The command will place you in an interactive shell running in a `Docker
container`_ with OpenMC installed.
.. note:: The ``docker run`` command supports many `options`_ for spawning
containers including `mounting volumes`_ from the host filesystem,
which many users will find useful.
.. _Docker image: https://docs.docker.com/engine/reference/commandline/images/
.. _Docker container: https://www.docker.com/resources/what-container
.. _options: https://docs.docker.com/engine/reference/commandline/run/
.. _mounting volumes: https://docs.docker.com/storage/volumes/
.. _install-spack:
----------------------------------
Installing from Source using Spack
----------------------------------
Spack_ is a package management tool designed to support multiple versions and
configurations of software on a wide variety of platforms and environments.
Please follow Spack's `setup guide`_ to configure the Spack system.
The OpenMC Spack recipe has been configured with variants that match most
options provided in the CMakeLists.txt file. To see a list of these variants and
other information use:
.. code-block:: sh
sudo apt update
spack info openmc
Now OpenMC should be recognized within the repository and can be installed:
.. note::
It should be noted that by default OpenMC builds with ``-O2 -g`` flags which
are equivalent to a CMake build type of `RelwithDebInfo`. In addition, MPI
is OFF while OpenMP is ON.
It is recommended to install OpenMC with the Python API. Information about this
Spack recipe can be found with the following command:
.. code-block:: sh
sudo apt install openmc
spack info py-openmc
Binary packages from this PPA may exist for earlier versions of Ubuntu, but they
are no longer supported.
.. note::
The only variant for the Python API is ``mpi``.
The most basic installation of OpenMC can be accomplished by entering the
following command:
.. code-block::
spack install py-openmc
.. caution::
When installing any Spack package, dependencies are assumed to be at
configured defaults unless otherwise specfied in the specification on the
command line. In the above example, assuming the default options weren't
changed in Spack's package configuration, py-openmc will link against a
non-optimized non-MPI openmc. Even if an optimized openmc was built
separately, it will rebuild openmc with optimization OFF. Thus, if you are
trying to link against dependencies that were configured different than
defaults, ``^openmc[variants]`` will have to be present in the command.
For a more performant build of OpenMC with optimization turned ON and MPI
provided by OpenMPI, the following command can be used:
.. code-block:: sh
spack install py-openmc+mpi ^openmc+optimize ^openmpi
.. note::
``+mpi`` is automatically forwarded to OpenMC.
.. tip::
When installing py-openmc, it will use Spack's preferred Python. For
example, assuming Spack's preferred Python is 3.8.7, to build py-openmc
against the latest Python 3.7 instead, ``^python@3.7.0:3.7.99`` should be
added to the specification on the command line. Additionally, a compiler
type and version can be specified at the end of the command using
``%gcc@<version>``, ``%intel@<version>``, etc.
A useful tool in Spack is to look at the dependency tree before installation.
This can be observed using Spack's ``spec`` tool:
.. code-block::
spack spec py-openmc+mpi ^openmc+optimize
Once installed, environment/lmod modules can be generated or Spack's ``load``
feature can be used to access the installed packages.
.. _Spack: https://spack.readthedocs.io/en/latest/
.. _setup guide: https://spack.readthedocs.io/en/latest/getting_started.html
.. _Personal Package Archive: https://launchpad.net/~paulromano/+archive/staging
.. _APT package manager: https://help.ubuntu.com/community/AptGet/Howto
.. _install_source:
@ -162,9 +243,9 @@ Prerequisites
.. _gcc: https://gcc.gnu.org/
.. _CMake: http://www.cmake.org
.. _OpenMPI: http://www.open-mpi.org
.. _MPICH: http://www.mpich.org
.. _CMake: https://cmake.org
.. _OpenMPI: https://www.open-mpi.org
.. _MPICH: https://www.mpich.org
.. _HDF5: https://www.hdfgroup.org/solutions/hdf5/
.. _DAGMC: https://svalinn.github.io/DAGMC/index.html
@ -176,10 +257,10 @@ directly from GitHub or, if you have the git_ version control software installed
on your computer, you can use git to obtain the source code. The latter method
has the benefit that it is easy to receive updates directly from the GitHub
repository. GitHub has a good set of `instructions
<http://help.github.com/set-up-git-redirect>`_ for how to set up git to work
with GitHub since this involves setting up ssh_ keys. With git installed and
setup, the following command will download the full source code from the GitHub
repository::
<https://docs.github.com/en/github/getting-started-with-github/set-up-git>`_ for
how to set up git to work with GitHub since this involves setting up ssh_ keys.
With git installed and setup, the following command will download the full
source code from the GitHub repository::
git clone --recurse-submodules https://github.com/openmc-dev/openmc.git
@ -328,36 +409,11 @@ Compiling on Windows 10
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
`here <https://docs.microsoft.com/en-us/windows/wsl/install-win10>`_ to get Bash
on Ubuntu on Windows setup. Once you are within bash, obtain the necessary
:ref:`prerequisites <prerequisites>` via ``apt``. Finally, follow the
:ref:`instructions for compiling on linux <compile_linux>`.
Compiling for the Intel Xeon Phi
--------------------------------
For the second generation Knights Landing architecture, nothing special is
required to compile OpenMC. You may wish to experiment with compiler flags that
control generation of vector instructions to see what configuration gives
optimal performance for your target problem.
For the first generation Knights Corner architecture, it is necessary to
cross-compile OpenMC. If you are using the Intel compiler, it is necessary to
specify that all objects be compiled with the ``-mmic`` flag as follows:
.. code-block:: sh
mkdir build && cd build
CXX=icpc CXXFLAGS=-mmic cmake -Dopenmp=on ..
make
Note that unless an HDF5 build for the Intel Xeon Phi (Knights Corner) is
already on your target machine, you will need to cross-compile HDF5 for the Xeon
Phi. An `example script`_ to build zlib and HDF5 provides several necessary
workarounds.
.. _example script: https://github.com/paulromano/install-scripts/blob/master/install-hdf5-mic
Testing Build
-------------
@ -369,16 +425,16 @@ section library along with windowed multipole data. Please refer to our
Installing Python API
---------------------
If you installed OpenMC using :ref:`Conda <install_conda>` or :ref:`PPA
<install_ppa>`, no further steps are necessary in order to use OpenMC's
:ref:`Python API <pythonapi>`. However, if you are :ref:`installing from source
<install_source>`, the Python API is not installed by default when ``make
install`` is run because in many situations it doesn't make sense to install a
Python package in the same location as the ``openmc`` executable (for example,
if you are installing the package into a `virtual environment
<https://docs.python.org/3/tutorial/venv.html>`_). The easiest way to install
the :mod:`openmc` Python package is to use pip_, which is included by default in
Python 3.4+. From the root directory of the OpenMC distribution/repository, run:
If you installed OpenMC using :ref:`Conda <install_conda>`, no further steps are
necessary in order to use OpenMC's :ref:`Python API <pythonapi>`. However, if
you are :ref:`installing from source <install_source>`, the Python API is not
installed by default when ``make install`` is run because in many situations it
doesn't make sense to install a Python package in the same location as the
``openmc`` executable (for example, if you are installing the package into a
`virtual environment <https://docs.python.org/3/tutorial/venv.html>`_). The
easiest way to install the :mod:`openmc` Python package is to use pip_, which is
included by default in Python 3.4+. From the root directory of the OpenMC
distribution/repository, run:
.. code-block:: sh
@ -414,7 +470,7 @@ distributions.
.. admonition:: Required
:class: error
`NumPy <http://www.numpy.org/>`_
`NumPy <https://numpy.org/>`_
NumPy is used extensively within the Python API for its powerful
N-dimensional array.
@ -422,23 +478,23 @@ distributions.
SciPy's special functions, sparse matrices, and spatial data structures
are used for several optional features in the API.
`pandas <http://pandas.pydata.org/>`_
`pandas <https://pandas.pydata.org/>`_
Pandas is used to generate tally DataFrames as demonstrated in
:ref:`examples_pandas` example notebook.
an `example notebook <../examples/pandas-dataframes.ipynb>`_.
`h5py <http://www.h5py.org/>`_
h5py provides Python bindings to the HDF5 library. Since OpenMC outputs
various HDF5 files, h5py is needed to provide access to data within these
files from Python.
`Matplotlib <http://matplotlib.org/>`_
`Matplotlib <https://matplotlib.org/>`_
Matplotlib is used to providing plotting functionality in the API like the
:meth:`Universe.plot` method and the :func:`openmc.plot_xs` function.
`uncertainties <https://pythonhosted.org/uncertainties/>`_
Uncertainties are used for decay data in the :mod:`openmc.data` module.
`lxml <http://lxml.de/>`_
`lxml <https://lxml.de/>`_
lxml is used for the :ref:`scripts_validate` script and various other
parts of the Python API.
@ -450,11 +506,11 @@ distributions.
parallel runs. This package is needed if you plan on running depletion
simulations in parallel using MPI.
`Cython <http://cython.org/>`_
`Cython <https://cython.org/>`_
Cython is used for resonance reconstruction for ENDF data converted to
:class:`openmc.data.IncidentNeutron`.
`vtk <http://www.vtk.org/>`_
`vtk <https://vtk.org/>`_
The Python VTK bindings are needed to convert voxel and track files to VTK
format.
@ -508,8 +564,7 @@ schemas.xml file in your own OpenMC source directory.
.. _GNU Emacs: http://www.gnu.org/software/emacs/
.. _validation: https://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
.. _Conda: https://docs.conda.io/en/latest/
.. _RELAX NG: https://relaxng.org/
.. _ctest: https://cmake.org/cmake/help/latest/manual/ctest.1.html
.. _Conda: https://conda.io/en/latest/
.. _pip: https://pip.pypa.io/en/stable/

View file

@ -45,7 +45,7 @@ This method can also accept case-insensitive element names such as
::
mat.add_element('aluminium', 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
@ -105,7 +105,7 @@ you would need to add hydrogen and oxygen to a material and then assign the
Naming Conventions
------------------
OpenMC uses the GND_ naming convention for nuclides, metastable states, and
OpenMC uses the GNDS_ naming convention for nuclides, metastable states, and
compounds:
:Nuclides: ``SymA`` where "A" is the mass number (e.g., ``Fe56``)
@ -122,7 +122,7 @@ compounds:
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
.. _GNDS: https://www.oecd-nea.org/jcms/pl_39689/specifications-for-the-generalised-nuclear-database-structure-gnds
-----------
Temperature
@ -160,26 +160,26 @@ Material Mixtures
-----------------
In OpenMC it is possible to mix any number of materials to create a new material
with the correct nuclide composition and density. The
with the correct nuclide composition and density. The
:meth:`Material.mix_materials` method takes a list of materials and
a list of their mixing fractions. Mixing fractions can be provided as atomic
a list of their mixing fractions. Mixing fractions can be provided as atomic
fractions, weight fractions, or volume fractions. The fraction type
can be specified by passing 'ao', 'wo', or 'vo' as the third argument, respectively.
For example, assuming the required materials have already been defined, a MOX
can be specified by passing 'ao', 'wo', or 'vo' as the third argument, respectively.
For example, assuming the required materials have already been defined, a MOX
material with 3% plutonium oxide by weight could be created using the following:
::
mox = openmc.Material.mix_materials([uo2, puo2], [0.97, 0.03], 'wo')
It should be noted that, if mixing fractions are specifed as atomic or weight
It should be noted that, if mixing fractions are specifed as atomic or weight
fractions, the supplied fractions should sum to one. If the fractions are specified
as volume fractions, and the sum of the fractions is less than one, then the remaining
fraction is set as void material.
as volume fractions, and the sum of the fractions is less than one, then the remaining
fraction is set as void material.
.. warning:: Materials with :math:`S(\alpha,\beta)` thermal scattering data
cannot be used in :meth:`Material.mix_materials`. However, thermal
scattering data can be added to a material created by
scattering data can be added to a material created by
:meth:`Material.mix_materials`.
--------------------

View file

@ -8,8 +8,8 @@ If you are running a simulation on a computer with multiple cores, multiple
sockets, or multiple nodes (i.e., a cluster), you can benefit from the fact that
OpenMC is able to use all available hardware resources if configured
correctly. OpenMC is capable of using both distributed-memory (`MPI
<http://mpi-forum.org/>`_) and shared-memory (`OpenMP
<http://www.openmp.org/>`_) parallelism. If you are on a single-socket
<https://www.mpi-forum.org/>`_) and shared-memory (`OpenMP
<https://www.openmp.org/>`_) parallelism. If you are on a single-socket
workstation or a laptop, using shared-memory parallelism is likely
sufficient. On a multi-socket node, cluster, or supercomputer, chances are you
will need to use both distributed-memory (across nodes) and shared-memory
@ -49,7 +49,7 @@ Distributed-Memory Parallelism (MPI)
MPI defines a library specification for message-passing between processes. There
are two major implementations of MPI, `OpenMPI <https://www.open-mpi.org/>`_ and
`MPICH <http://www.mpich.org/>`_. Both implementations are known to work with
`MPICH <https://www.mpich.org/>`_. Both implementations are known to work with
OpenMC; there is no obvious reason to prefer one over the other. Building OpenMC
with support for MPI requires that you have one of these implementations
installed on your system. For instructions on obtaining MPI, see

View file

@ -97,7 +97,7 @@ derivatives: ``sudo apt install imagemagick``). Images are then converted like:
convert myplot.ppm myplot.png
Alternatively, if you're working within a `Jupyter <http://jupyter.org/>`_
Alternatively, if you're working within a `Jupyter <https://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.
@ -122,7 +122,7 @@ should be three items long, e.g.::
The voxel plot data is written to an :ref:`HDF5 file <io_voxel>`. The voxel file
can subsequently be converted into a standard mesh format that can be viewed in
`ParaView <http://www.paraview.org/>`_, `VisIt
`ParaView <https://www.paraview.org/>`_, `VisIt
<https://wci.llnl.gov/simulation/computer-codes/visit>`_, etc. This typically
will compress the size of the file significantly. The provided
:ref:`scripts_voxel` script can convert the HDF5 voxel file to VTK formats. Once

View file

@ -34,13 +34,13 @@ as requested; it is used in many of the provided plotting utilities, OpenMC's
regression test suite, and can be used in user-created scripts to carry out
manipulations of the data.
An :ref:`example IPython notebook <notebook_post_processing>` demonstrates how
to extract data from a statepoint using the Python API.
An `example notebook <../examples/post-processing.ipynb>`_ demonstrates how to
extract data from a statepoint using the Python API.
Plotting in 2D
--------------
The :ref:`IPython notebook example <notebook_post_processing>` also demonstrates
The `notebook example <../examples/post-processing.ipynb>`_ also demonstrates
how to plot a structured mesh tally in two dimensions using the Python API. One
can also use the :ref:`scripts_plot` script which provides an interactive GUI to
explore and plot structured mesh tallies for any scores and filter bins.
@ -54,7 +54,7 @@ Getting Data into MATLAB
There is currently no front-end utility to dump tally data to MATLAB files, but
the process is straightforward. First extract the data using the Python API via
``openmc.statepoint`` and then use the `Scipy MATLAB IO routines
<http://docs.scipy.org/doc/scipy/reference/tutorial/io.html>`_ to save to a MAT
<https://docs.scipy.org/doc/scipy/reference/tutorial/io.html>`_ to save to a MAT
file. Note that all arrays that are accessible in a statepoint are already in
NumPy arrays that can be reshaped and dumped to MATLAB in one step.
@ -101,5 +101,5 @@ For eigenvalue problems, OpenMC will store information on the fission source
sites in the statepoint file by default. For each source site, the weight,
position, sampled direction, and sampled energy are stored. To extract this data
from a statepoint file, the ``openmc.statepoint`` module can be used. An
:ref:`example IPython notebook <notebook_post_processing>` demontrates how to
`example notebook <../examples/post-processing.ipynb>`_ demontrates how to
analyze and plot source information.

View file

@ -13,7 +13,13 @@ Executables and Scripts
Once you have a model built (see :ref:`usersguide_basics`), you can either run
the openmc executable directly from the directory containing your XML input
files, or you can specify as a command-line argument the directory containing
the XML input files. For example, if your XML input files are in the directory
the XML input files.
.. warning::
OpenMC models should be treated as code, and it is important to be careful with code from untrusted sources.
For example, if your XML input files are in the directory
``/home/username/somemodel/``, one way to run the simulation would be:
.. code-block:: sh
@ -96,61 +102,6 @@ otherwise.
--fission_energy_release FISSION_ENERGY_RELEASE
HDF5 file containing fission energy release data
.. _scripts_compton:
-----------------------
``openmc-make-compton``
-----------------------
This script generates an HDF5 file called ``compton_profiles.h5`` that contains
Compton profile data using an existing data library from `Geant4
<http://geant4.cern.ch/>`_. Note that OpenMC includes this data file by default
so it should not be necessary in practice to generate it yourself.
.. _scripts_depletion_chain:
-------------------------------
``openmc-make-depletion-chain``
-------------------------------
This script generates a depletion chain file called ``chain_endfb71.xml``
using ENDF/B-VII.1 nuclear data. If the :envvar:`OPENMC_ENDF_DATA` variable
is not set, and ``"neutron"``, ``"decay"``, ``"nfy"`` directories
do not exist, then ENDF/B-VII.1 data will be downloaded.
.. _scripts_depletion_chain_casl:
------------------------------------
``openmc-make-depletion-chain-casl``
------------------------------------
This script generates a depletion chain called ``chain_casl.xml``
using ENDF/B-VII.1 nuclear data for a simplified chain.
The nuclides were chosen by CASL-ORIGEN, which can be found in
Appendix A of Kang Seog Kim, `"Specification for the VERA Depletion
Benchmark Suite" <https://doi.org/10.2172/1256820>`_,
CASL-U-2015-1014-000, Rev. 0, ORNL/TM-2016/53, 2016.
``Te129`` has been added into this chain due to its link to
``I129`` production.
If the :envvar:`OPENMC_ENDF_DATA` variable is not set,
and ``"neutron"``, ``"decay"``, ``"nfy"`` directories
to not exist, then ENDF/B-VII.1 data will be downloaded.
.. _scripts_stopping:
-------------------------------
``openmc-make-stopping-powers``
-------------------------------
This script generates an HDF5 file called ``stopping_power.h5`` that contains
radiative and collision stopping powers and mean excitation energy pulled from
the `NIST ESTAR database
<https://physics.nist.gov/PhysRefData/Star/Text/ESTAR.html>`_. Note that OpenMC
includes this data file by default so it should not be necessary in practice to
generate it yourself.
.. _scripts_plot:
--------------------------
@ -244,7 +195,7 @@ Message Description
When OpenMC generates :ref:`voxel plots <usersguide_voxel>`, they are in an
:ref:`HDF5 format <io_voxel>` that is not terribly useful by itself. The
``openmc-voxel-to-vtk`` script converts a voxel HDF5 file to a `VTK
<http://www.vtk.org/>`_ file. To run this script, you will need to have the VTK
<https://vtk.org/>`_ file. To run this script, you will need to have the VTK
Python bindings installed. To convert a voxel file, simply provide the path to
the file:

View file

@ -54,9 +54,9 @@ If you don't specify a run mode, the default run mode is 'eigenvalue'.
.. _usersguide_particles:
-------------------
Number of Particles
-------------------
------------
Run Strategy
------------
For a fixed source simulation, the total number of source particle histories
simulated is broken up into a number of *batches*, each corresponding to a
@ -88,6 +88,79 @@ for accumulating tallies.
settings.batches = 150
settings.inactive = 5
.. _usersguide_batches:
Number of Batches
-----------------
In general, the stochastic uncertainty in your simulation results is directly
related to how many total active particles are simulated (the product of the
number of active batches, number of generations per batch, and number of
particles). At a minimum, you should use enough active batches so that the
central limit theorem is satisfied (about 30). Otherwise, reducing the overall
uncertainty in your simulation by a factor of 2 will require using 4 times as
many batches (since the standard deviation decreases as :math:`1/\sqrt{N}`).
Number of Inactive Batches
--------------------------
For :math:`k` eigenvalue simulations, the source distribution is not known a
priori. Thus, a "guess" of the source distribution is made and then iterated on,
with the source evolving closer to the true distribution at each iteration. Once
the source distribution has converged, it is then safe to start accumulating
tallies. Consequently, a preset number of inactive batches are run before the
active batches (where tallies are turned on) begin. The number of inactive
batches necessary to reach a converged source depends on the spatial extent of
the problem, its dominance ratio, what boundary conditions are used, and many
other factors. For small problems, using 50--100 inactive batches is likely
sufficient. For larger models, many hundreds of inactive batches may be
necessary. Users are recommended to use the :ref:`Shannon entropy
<usersguide_entropy>` diagnostic as a way of determining how many inactive
batches are necessary.
Specifying the initial source used for the very first batch is described in
:ref:`below <usersguide_source>`. Although the initial source is arbitrary in
the sense that any source will eventually converge to the correct distribution,
using a source guess that is closer to the actual converged source distribution
will translate into needing fewer inactive batches (and hence less simulation
time).
For fixed source simulations, the source distribution is known exactly, so no
inactive batches are needed. In this case the :attr:`Settings.inactive`
attribute can be omitted since it defaults to zero.
Number of Generations per Batch
-------------------------------
The standard deviation of tally results is calculated assuming that all
realizations (batches) are independent. However, in a :math:`k` eigenvalue
calculation, the source sites for each batch are produced from fissions in the
preceding batch, resulting in a correlation between successive batches. This
correlation can result in an underprediction of the variance. That is, the
variance reported is actually less than the true variance. To mitigate this
effect, OpenMC allows you to group together multiple fission generations into a
single batch for statistical purposes, rather than having each fission
generation be a separate batch, which is the default behavior.
Number of Particles per Generation
----------------------------------
There are several considerations for choosing the number of particles per
generation. As discussed in :ref:`usersguide_batches`, the total number of
active particles will determine the level of stochastic uncertainty in
simulation results, so using a higher number of particles will result in less
uncertainty. For parallel simulations that use OpenMP and/or MPI, the number of
particles per generation should be large enough to ensure good load balancing
between threads. For example, if you are running on a single processor with 32
cores, each core should have at least 100 particles or so (i.e., at least 3,200
particles per generation should be used). Using a larger number of particles per
generation can also help reduce the cost of synchronization and communication
between batches. For :math:`k` eigenvalue calculations, experts recommend_ at
least 10,000 particles per generation to avoid any bias in the estimate of
:math:`k` eigenvalue or tallies.
.. _recommend: https://permalink.lanl.gov/object/tr?what=info:lanl-repo/lareport/LA-UR-09-03136
.. _usersguide_source:
-----------------------------
@ -175,6 +248,32 @@ following would generate a photon source::
For a full list of all classes related to statistical distributions, see
:ref:`pythonapi_stats`.
File-based Sources
------------------
OpenMC can use a pregenerated HDF5 source file by specifying the ``filename``
argument to :class:`openmc.Source`::
settings.source = openmc.Source(filename='source.h5')
Statepoint and source files are generated automatically when a simulation is run
and can be used as the starting source in a new simulation. Alternatively, a
source file can be manually generated with the :func:`openmc.write_source_file`
function. This is particularly useful for coupling OpenMC with another program
that generates a source to be used in OpenMC.
A source file based on particles that cross one or more surfaces can be
generated during a simulation using the :attr:`Settings.surf_source_write`
attribute::
settings.surf_source_write = {
'surfaces_ids': [1, 2, 3],
'max_particles': 10000
}
In this example, at most 10,000 source particles are stored when particles cross
surfaces with IDs of 1, 2, or 3.
.. _custom_source:
Custom Sources
@ -301,6 +400,8 @@ the source class when it is created:
As with the basic custom source functionality, the custom source library
location must be provided in the :attr:`openmc.Source.library` attribute.
.. _usersguide_entropy:
---------------
Shannon Entropy
---------------