mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-27 13:45:36 -04:00
Updating tests and merging
This commit is contained in:
commit
a90a2f14dd
125 changed files with 4588 additions and 4641 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -26,6 +26,7 @@ examples/python/**/*.xml
|
|||
docs/build
|
||||
docs/source/_images/*.pdf
|
||||
docs/source/_images/*.aux
|
||||
docs/source/pythonapi/generated/
|
||||
|
||||
# Source build
|
||||
build
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ before_install:
|
|||
- conda config --set always_yes yes --set changeps1 no
|
||||
- conda update -q conda
|
||||
- conda info -a
|
||||
- conda create -q -n test-environment python=$TRAVIS_PYTHON_VERSION numpy scipy h5py pandas
|
||||
- conda create -q -n test-environment python=$TRAVIS_PYTHON_VERSION numpy scipy h5py=2.5 pandas
|
||||
- source activate test-environment
|
||||
|
||||
# Install GCC, MPICH, HDF5, PHDF5
|
||||
|
|
|
|||
7
docs/source/_templates/myclass.rst
Normal file
7
docs/source/_templates/myclass.rst
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
{{ fullname }}
|
||||
{{ underline }}
|
||||
|
||||
.. currentmodule:: {{ module }}
|
||||
|
||||
.. autoclass:: {{ objname }}
|
||||
:members:
|
||||
6
docs/source/_templates/myfunction.rst
Normal file
6
docs/source/_templates/myfunction.rst
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
{{ fullname }}
|
||||
{{ underline }}
|
||||
|
||||
.. currentmodule:: {{ module }}
|
||||
|
||||
.. autofunction:: {{ objname }}
|
||||
|
|
@ -24,13 +24,8 @@ except ImportError:
|
|||
from mock import Mock as MagicMock
|
||||
|
||||
|
||||
class Mock(MagicMock):
|
||||
@classmethod
|
||||
def __getattr__(cls, name):
|
||||
return Mock()
|
||||
|
||||
MOCK_MODULES = ['numpy', 'h5py', 'pandas', 'opencg']
|
||||
sys.modules.update((mod_name, Mock()) for mod_name in MOCK_MODULES)
|
||||
sys.modules.update((mod_name, MagicMock()) for mod_name in MOCK_MODULES)
|
||||
|
||||
|
||||
# If extensions (or modules to document with autodoc) are in another directory,
|
||||
|
|
@ -48,6 +43,8 @@ extensions = ['sphinx.ext.autodoc',
|
|||
'sphinx.ext.napoleon',
|
||||
'sphinx.ext.mathjax',
|
||||
'sphinx.ext.autosummary',
|
||||
'sphinx.ext.intersphinx',
|
||||
'sphinx.ext.viewcode',
|
||||
'sphinx_numfig',
|
||||
'notebook_sphinxext']
|
||||
|
||||
|
|
@ -65,7 +62,7 @@ master_doc = 'index'
|
|||
|
||||
# General information about the project.
|
||||
project = u'OpenMC'
|
||||
copyright = u'2011-2015, Massachusetts Institute of Technology'
|
||||
copyright = u'2011-2016, Massachusetts Institute of Technology'
|
||||
|
||||
# The version info for the project you're documenting, acts as replacement for
|
||||
# |version| and |release|, also used in various other places throughout the
|
||||
|
|
@ -122,20 +119,13 @@ pygments_style = 'tango'
|
|||
|
||||
# -- Options for HTML output ---------------------------------------------------
|
||||
|
||||
# The theme to use for HTML and HTML Help pages. Major themes that come with
|
||||
# Sphinx are currently 'default' and 'sphinxdoc'.
|
||||
if on_rtd:
|
||||
html_theme = 'default'
|
||||
html_logo = '_images/openmc200px.png'
|
||||
else:
|
||||
html_theme = 'haiku'
|
||||
html_theme_options = {'full_logo': True,
|
||||
'linkcolor': '#0c3762',
|
||||
'visitedlinkcolor': '#0c3762'}
|
||||
html_logo = '_images/openmc.png'
|
||||
# The theme to use for HTML and HTML Help pages
|
||||
if not on_rtd:
|
||||
import sphinx_rtd_theme
|
||||
html_theme = 'sphinx_rtd_theme'
|
||||
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
|
||||
|
||||
# Add any paths that contain custom themes here, relative to this directory.
|
||||
#html_theme_path = ["_theme"]
|
||||
html_logo = '_images/openmc200px.png'
|
||||
|
||||
# The name for this set of Sphinx documents. If None, it defaults to
|
||||
# "<project> v<release> documentation".
|
||||
|
|
@ -248,4 +238,12 @@ latex_elements = {
|
|||
#Autodocumentation Flags
|
||||
#autodoc_member_order = "groupwise"
|
||||
#autoclass_content = "both"
|
||||
#autosummary_generate = []
|
||||
autosummary_generate = True
|
||||
|
||||
napoleon_use_ivar = True
|
||||
|
||||
intersphinx_mapping = {
|
||||
'python': ('https://docs.python.org/3', None),
|
||||
'numpy': ('http://docs.scipy.org/doc/numpy/', None),
|
||||
'pandas': ('http://pandas.pydata.org/pandas-docs/stable/', None)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,11 +13,14 @@ OpenMC was originally developed by members of the `Computational Reactor Physics
|
|||
Group`_ at the `Massachusetts Institute of Technology`_ starting
|
||||
in 2011. Various universities, laboratories, and other organizations now
|
||||
contribute to the development of OpenMC. For more information on OpenMC, feel
|
||||
free to send a message to the User's Group `mailing list`_.
|
||||
free to send a message to the User's Group `mailing list`_. Documentation for
|
||||
the latest developmental version of the develop branch can be found on
|
||||
`Read the Docs`_.
|
||||
|
||||
.. _Computational Reactor Physics Group: http://crpg.mit.edu
|
||||
.. _Massachusetts Institute of Technology: http://web.mit.edu
|
||||
.. _mailing list: https://groups.google.com/forum/?fromgroups=#!forum/openmc-users
|
||||
.. _Read the Docs: http://openmc.readthedocs.io/en/latest/
|
||||
|
||||
.. only:: html
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
License Agreement
|
||||
=================
|
||||
|
||||
Copyright © 2011-2015 Massachusetts Institute of Technology
|
||||
Copyright © 2011-2016 Massachusetts Institute of Technology
|
||||
|
||||
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
|
||||
|
|
|
|||
|
|
@ -1,8 +0,0 @@
|
|||
.. _pythonapi_ace:
|
||||
|
||||
==========
|
||||
ACE Format
|
||||
==========
|
||||
|
||||
.. automodule:: openmc.ace
|
||||
:members:
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
.. _pythonapi_cmfd:
|
||||
|
||||
====
|
||||
CMFD
|
||||
====
|
||||
|
||||
.. automodule:: openmc.cmfd
|
||||
:members:
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
.. _pythonapi_element:
|
||||
|
||||
=======
|
||||
Element
|
||||
=======
|
||||
|
||||
.. automodule:: openmc.element
|
||||
:members:
|
||||
|
|
@ -141,15 +141,12 @@
|
|||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"%matplotlib inline\n",
|
||||
"import numpy as np\n",
|
||||
"import matplotlib.pyplot as plt\n",
|
||||
"\n",
|
||||
"import openmc\n",
|
||||
"import openmc.mgxs as mgxs\n",
|
||||
"from openmc.source import Source\n",
|
||||
"from openmc.stats import Box\n",
|
||||
"\n",
|
||||
"%matplotlib inline"
|
||||
"import openmc.mgxs as mgxs"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
|
@ -204,7 +201,7 @@
|
|||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"With our material, we can now create a `MaterialsFile` object that can be exported to an actual XML file."
|
||||
"With our material, we can now create a `Materials` object that can be exported to an actual XML file."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
|
@ -215,10 +212,9 @@
|
|||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# Instantiate a MaterialsFile, register all Materials, and export to XML\n",
|
||||
"materials_file = openmc.MaterialsFile()\n",
|
||||
"# Instantiate a Materials collection and export to XML\n",
|
||||
"materials_file = openmc.Materials([inf_medium])\n",
|
||||
"materials_file.default_xs = '71c'\n",
|
||||
"materials_file.add_material(inf_medium)\n",
|
||||
"materials_file.export_to_xml()"
|
||||
]
|
||||
},
|
||||
|
|
@ -293,7 +289,7 @@
|
|||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"We now must create a geometry that is assigned a root universe, put the geometry into a `GeometryFile` object, and export it to XML."
|
||||
"We now must create a geometry that is assigned a root universe and export it to XML."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
|
@ -308,12 +304,8 @@
|
|||
"openmc_geometry = openmc.Geometry()\n",
|
||||
"openmc_geometry.root_universe = root_universe\n",
|
||||
"\n",
|
||||
"# Instantiate a GeometryFile\n",
|
||||
"geometry_file = openmc.GeometryFile()\n",
|
||||
"geometry_file.geometry = openmc_geometry\n",
|
||||
"\n",
|
||||
"# Export to \"geometry.xml\"\n",
|
||||
"geometry_file.export_to_xml()"
|
||||
"openmc_geometry.export_to_xml()"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
|
@ -336,15 +328,17 @@
|
|||
"inactive = 10\n",
|
||||
"particles = 2500\n",
|
||||
"\n",
|
||||
"# Instantiate a SettingsFile\n",
|
||||
"settings_file = openmc.SettingsFile()\n",
|
||||
"# Instantiate a Settings object\n",
|
||||
"settings_file = openmc.Settings()\n",
|
||||
"settings_file.batches = batches\n",
|
||||
"settings_file.inactive = inactive\n",
|
||||
"settings_file.particles = particles\n",
|
||||
"settings_file.output = {'tallies': True}\n",
|
||||
"\n",
|
||||
"# Create an initial uniform spatial source distribution over fissionable zones\n",
|
||||
"bounds = [-0.63, -0.63, -0.63, 0.63, 0.63, 0.63]\n",
|
||||
"settings_file.source = Source(space=Box(\n",
|
||||
" bounds[:3], bounds[3:], only_fissionable=True))\n",
|
||||
"uniform_dist = openmc.stats.Box(bounds[:3], bounds[3:], only_fissionable=True)\n",
|
||||
"settings_file.source = openmc.source.Source(space=uniform_dist)\n",
|
||||
"\n",
|
||||
"# Export to \"settings.xml\"\n",
|
||||
"settings_file.export_to_xml()"
|
||||
|
|
@ -423,22 +417,24 @@
|
|||
"data": {
|
||||
"text/plain": [
|
||||
"OrderedDict([('flux', Tally\n",
|
||||
" \tID =\t10000\n",
|
||||
" \tName =\t\n",
|
||||
" \tFilters =\t\n",
|
||||
" \t\tcell\t[1]\n",
|
||||
" \t\tenergy\t[ 0.00000000e+00 6.25000000e-07 2.00000000e+01]\n",
|
||||
" \tNuclides =\ttotal \n",
|
||||
" \tScores =\t['flux']\n",
|
||||
" \tEstimator =\ttracklength), ('absorption', Tally\n",
|
||||
" \tID =\t10001\n",
|
||||
" \tName =\t\n",
|
||||
" \tFilters =\t\n",
|
||||
" \t\tcell\t[1]\n",
|
||||
" \t\tenergy\t[ 0.00000000e+00 6.25000000e-07 2.00000000e+01]\n",
|
||||
" \tNuclides =\ttotal \n",
|
||||
" \tScores =\t['absorption']\n",
|
||||
" \tEstimator =\ttracklength)])"
|
||||
"\tID =\t10000\n",
|
||||
"\tName =\t\n",
|
||||
"\tFilters =\t\n",
|
||||
" \t\tcell\t[1]\n",
|
||||
" \t\tenergy\t[ 0.00000000e+00 6.25000000e-07 2.00000000e+01]\n",
|
||||
"\tNuclides =\ttotal \n",
|
||||
"\tScores =\t['flux']\n",
|
||||
"\tEstimator =\ttracklength\n",
|
||||
"), ('absorption', Tally\n",
|
||||
"\tID =\t10001\n",
|
||||
"\tName =\t\n",
|
||||
"\tFilters =\t\n",
|
||||
" \t\tcell\t[1]\n",
|
||||
" \t\tenergy\t[ 0.00000000e+00 6.25000000e-07 2.00000000e+01]\n",
|
||||
"\tNuclides =\ttotal \n",
|
||||
"\tScores =\t['absorption']\n",
|
||||
"\tEstimator =\ttracklength\n",
|
||||
")])"
|
||||
]
|
||||
},
|
||||
"execution_count": 13,
|
||||
|
|
@ -454,7 +450,7 @@
|
|||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"The `Absorption` object includes tracklength tallies for the 'absorption' and 'flux' scores in the 2-group structure in cell 1. Now that each `MGXS` object contains the tallies that it needs, we must add these tallies to a `TalliesFile` object to generate the \"tallies.xml\" input file for OpenMC."
|
||||
"The `Absorption` object includes tracklength tallies for the 'absorption' and 'flux' scores in the 2-group structure in cell 1. Now that each `MGXS` object contains the tallies that it needs, we must add these tallies to a `Tallies` object to generate the \"tallies.xml\" input file for OpenMC."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
|
@ -465,21 +461,18 @@
|
|||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# Instantiate an empty TalliesFile\n",
|
||||
"tallies_file = openmc.TalliesFile()\n",
|
||||
"# Instantiate an empty Tallies object\n",
|
||||
"tallies_file = openmc.Tallies()\n",
|
||||
"\n",
|
||||
"# Add total tallies to the tallies file\n",
|
||||
"for tally in total.tallies.values():\n",
|
||||
" tallies_file.add_tally(tally)\n",
|
||||
"tallies_file += total.tallies.values()\n",
|
||||
"\n",
|
||||
"# Add absorption tallies to the tallies file\n",
|
||||
"for tally in absorption.tallies.values():\n",
|
||||
" tallies_file.add_tally(tally)\n",
|
||||
"tallies_file += absorption.tallies.values()\n",
|
||||
"\n",
|
||||
"# Add scattering tallies to the tallies file\n",
|
||||
"for tally in scattering.tallies.values():\n",
|
||||
" tallies_file.add_tally(tally)\n",
|
||||
" \n",
|
||||
"tallies_file += scattering.tallies.values()\n",
|
||||
"\n",
|
||||
"# Export to \"tallies.xml\"\n",
|
||||
"tallies_file.export_to_xml()"
|
||||
]
|
||||
|
|
@ -518,10 +511,9 @@
|
|||
" Copyright: 2011-2015 Massachusetts Institute of Technology\n",
|
||||
" License: http://mit-crpg.github.io/openmc/license.html\n",
|
||||
" Version: 0.7.1\n",
|
||||
" Git SHA1: 5f252e2df51930b9175fd41bafa8db01f3eaeb92\n",
|
||||
" Date/Time: 2016-03-23 14:42:51\n",
|
||||
" Git SHA1: eeb5091ca3a34cc85df73a3318cae2b6c7097413\n",
|
||||
" Date/Time: 2016-04-13 11:24:09\n",
|
||||
" MPI Processes: 1\n",
|
||||
" OpenMP Threads: 16\n",
|
||||
"\n",
|
||||
" ===========================================================================\n",
|
||||
" ========================> INITIALIZATION <=========================\n",
|
||||
|
|
@ -606,20 +598,20 @@
|
|||
"\n",
|
||||
" =======================> TIMING STATISTICS <=======================\n",
|
||||
"\n",
|
||||
" Total time for initialization = 4.6200E-01 seconds\n",
|
||||
" Reading cross sections = 1.3100E-01 seconds\n",
|
||||
" Total time in simulation = 2.4000E+00 seconds\n",
|
||||
" Time in transport only = 2.1340E+00 seconds\n",
|
||||
" Time in inactive batches = 2.6400E-01 seconds\n",
|
||||
" Time in active batches = 2.1360E+00 seconds\n",
|
||||
" Time synchronizing fission bank = 2.0000E-03 seconds\n",
|
||||
" Sampling source sites = 2.0000E-03 seconds\n",
|
||||
" SEND/RECV source sites = 0.0000E+00 seconds\n",
|
||||
" Total time for initialization = 4.6300E-01 seconds\n",
|
||||
" Reading cross sections = 1.2100E-01 seconds\n",
|
||||
" Total time in simulation = 1.6504E+01 seconds\n",
|
||||
" Time in transport only = 1.6479E+01 seconds\n",
|
||||
" Time in inactive batches = 1.9620E+00 seconds\n",
|
||||
" Time in active batches = 1.4542E+01 seconds\n",
|
||||
" Time synchronizing fission bank = 1.0000E-02 seconds\n",
|
||||
" Sampling source sites = 4.0000E-03 seconds\n",
|
||||
" SEND/RECV source sites = 3.0000E-03 seconds\n",
|
||||
" Time accumulating tallies = 0.0000E+00 seconds\n",
|
||||
" Total time for finalization = 1.0000E-03 seconds\n",
|
||||
" Total time elapsed = 2.8800E+00 seconds\n",
|
||||
" Calculation Rate (inactive) = 94697.0 neutrons/second\n",
|
||||
" Calculation Rate (active) = 46816.5 neutrons/second\n",
|
||||
" Total time for finalization = 0.0000E+00 seconds\n",
|
||||
" Total time elapsed = 1.6977E+01 seconds\n",
|
||||
" Calculation Rate (inactive) = 12742.1 neutrons/second\n",
|
||||
" Calculation Rate (active) = 6876.63 neutrons/second\n",
|
||||
"\n",
|
||||
" ============================> RESULTS <============================\n",
|
||||
"\n",
|
||||
|
|
@ -644,8 +636,7 @@
|
|||
],
|
||||
"source": [
|
||||
"# Run OpenMC\n",
|
||||
"executor = openmc.Executor()\n",
|
||||
"executor.run_simulation()"
|
||||
"openmc.run()"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
|
@ -914,7 +905,7 @@
|
|||
" <td>6.250000e-07</td>\n",
|
||||
" <td>total</td>\n",
|
||||
" <td>(((total / flux) - (absorption / flux)) - (sca...</td>\n",
|
||||
" <td>8.881784e-16</td>\n",
|
||||
" <td>-3.774758e-15</td>\n",
|
||||
" <td>0.011292</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
|
|
@ -924,7 +915,7 @@
|
|||
" <td>2.000000e+01</td>\n",
|
||||
" <td>total</td>\n",
|
||||
" <td>(((total / flux) - (absorption / flux)) - (sca...</td>\n",
|
||||
" <td>-9.992007e-16</td>\n",
|
||||
" <td>1.443290e-15</td>\n",
|
||||
" <td>0.002570</td>\n",
|
||||
" </tr>\n",
|
||||
" </tbody>\n",
|
||||
|
|
@ -937,8 +928,8 @@
|
|||
"1 1 6.25e-07 2.00e+01 total \n",
|
||||
"\n",
|
||||
" score mean std. dev. \n",
|
||||
"0 (((total / flux) - (absorption / flux)) - (sca... 8.88e-16 1.13e-02 \n",
|
||||
"1 (((total / flux) - (absorption / flux)) - (sca... -9.99e-16 2.57e-03 "
|
||||
"0 (((total / flux) - (absorption / flux)) - (sca... -3.77e-15 1.13e-02 \n",
|
||||
"1 (((total / flux) - (absorption / flux)) - (sca... 1.44e-15 2.57e-03 "
|
||||
]
|
||||
},
|
||||
"execution_count": 23,
|
||||
|
|
@ -1201,7 +1192,7 @@
|
|||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython2",
|
||||
"version": "2.7.11"
|
||||
"version": "2.7.6"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -33,13 +33,7 @@
|
|||
"from IPython.display import Image\n",
|
||||
"import numpy as np\n",
|
||||
"\n",
|
||||
"import openmc\n",
|
||||
"from openmc.statepoint import StatePoint\n",
|
||||
"from openmc.summary import Summary\n",
|
||||
"from openmc.source import Source\n",
|
||||
"from openmc.stats import Box\n",
|
||||
"\n",
|
||||
"%matplotlib inline"
|
||||
"import openmc"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
|
@ -123,11 +117,8 @@
|
|||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# Instantiate a MaterialsFile, add Materials\n",
|
||||
"materials_file = openmc.MaterialsFile()\n",
|
||||
"materials_file.add_material(fuel)\n",
|
||||
"materials_file.add_material(water)\n",
|
||||
"materials_file.add_material(zircaloy)\n",
|
||||
"# Instantiate a Materials collection\n",
|
||||
"materials_file = openmc.Materials((fuel, water, zircaloy))\n",
|
||||
"materials_file.default_xs = '71c'\n",
|
||||
"\n",
|
||||
"# Export to \"materials.xml\"\n",
|
||||
|
|
@ -255,12 +246,8 @@
|
|||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# Instantiate a GeometryFile\n",
|
||||
"geometry_file = openmc.GeometryFile()\n",
|
||||
"geometry_file.geometry = geometry\n",
|
||||
"\n",
|
||||
"# Export to \"geometry.xml\"\n",
|
||||
"geometry_file.export_to_xml()"
|
||||
"geometry.export_to_xml()"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
|
@ -283,15 +270,17 @@
|
|||
"inactive = 5\n",
|
||||
"particles = 2500\n",
|
||||
"\n",
|
||||
"# Instantiate a SettingsFile\n",
|
||||
"settings_file = openmc.SettingsFile()\n",
|
||||
"# Instantiate a Settings object\n",
|
||||
"settings_file = openmc.Settings()\n",
|
||||
"settings_file.batches = batches\n",
|
||||
"settings_file.inactive = inactive\n",
|
||||
"settings_file.particles = particles\n",
|
||||
"settings_file.output = {'tallies': True}\n",
|
||||
"source_bounds = [-0.63, -0.63, -0.63, 0.63, 0.63, 0.63]\n",
|
||||
"settings_file.source = Source(space=Box(\n",
|
||||
" source_bounds[:3], source_bounds[3:]))\n",
|
||||
"\n",
|
||||
"# Create an initial uniform spatial source distribution over fissionable zones\n",
|
||||
"bounds = [-0.63, -0.63, -0.63, 0.63, 0.63, 0.63]\n",
|
||||
"uniform_dist = openmc.stats.Box(bounds[:3], bounds[3:], only_fissionable=True)\n",
|
||||
"settings_file.source = openmc.source.Source(space=uniform_dist)\n",
|
||||
"\n",
|
||||
"# Export to \"settings.xml\"\n",
|
||||
"settings_file.export_to_xml()"
|
||||
|
|
@ -320,9 +309,8 @@
|
|||
"plot.pixels = [250, 250]\n",
|
||||
"plot.color = 'mat'\n",
|
||||
"\n",
|
||||
"# Instantiate a PlotsFile, add Plot, and export to \"plots.xml\"\n",
|
||||
"plot_file = openmc.PlotsFile()\n",
|
||||
"plot_file.add_plot(plot)\n",
|
||||
"# Instantiate a Plots collection and export to \"plots.xml\"\n",
|
||||
"plot_file = openmc.Plots([plot])\n",
|
||||
"plot_file.export_to_xml()"
|
||||
]
|
||||
},
|
||||
|
|
@ -353,8 +341,7 @@
|
|||
],
|
||||
"source": [
|
||||
"# Run openmc in plotting mode\n",
|
||||
"executor = openmc.Executor()\n",
|
||||
"executor.plot_geometry(output=False)"
|
||||
"openmc.plot_geometry(output=False)"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
|
@ -366,7 +353,7 @@
|
|||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAPoAAAD6AgMAAAD1grKuAAAABGdBTUEAALGPC/xhBQAAACBjSFJN\nAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAADFBMVEX///9yEhLpgJFNv8Tq\nQYT7AAAAAWJLR0QAiAUdSAAAAAd0SU1FB+ADFxIyLefz284AAALKSURBVGje7dpLcqQwDAbgHHE2\nYeEj+D4cwQucBUfo+3CEXoSp8OhuhF70T4qpKXmdr21LogK2Pj7A8QmNP+HDhw8fPnz48Kf6VH9G\n+66vy+je8k19jnf8C5dXIPv86ms56lPdjvaYbyodx3ze+XLE76cXFiD4zPji99z0/AJ4n1lfvJ6f\nnl0A6x+578efMSg1wPr172/jPO5yFXM+Ef78gdblM+WPHyguP//t1/g6pA0wfln+ho/fwgYYn19C\n/xwDvwHGc9OvC+hs37DTrwuwfWanXxdQTC9Mvyygs3wjTL8uwPJpn/tNDbSGz7T0SBEWw4vLXzbQ\n6b6RoveIoO6TvPxlA63qs7z8ZQPF9F+SH22vbX8OQKf5Rtv+EgDNJ3X58wZaxWd1+fMGiuFvir8b\nvjp8J/tGy/6jAmRvhW8fwL3vVT+o3grfPoB7r/IpALI3tz8FoJN84/NV873hB8UnM3xzANtf8nb4\ndwmg3grfFEDJO8JPE0i9Ff4pAYL3pI8mkHor/HMCeO9JH00g9SafEsh7T/ppARBvp48UwJnelT5S\nACd7O31TAlnvKx9SQCd7B58KgPO+8iMFuPWe9E8F8BveWX7bAjzX9y4//Jve+fhsH6Ctv7n8PTzj\nvY/v9gEOHz58+PBX+6v/f/wPvnd54f3j6venE/yl769Xv7+j3x/o98/V32/o9+fl389Xnx+g5x/o\n+Qt6/oOeP6HnX+j5G3z+h54/ouefV5/foufP6Pk3ev4On/+j9w/o/Qd6/4Le/6D3T/D9V67Y/ZsV\nQBq+s+8f0ftP+P41axXguP9NWgDuu/Cdfv+N3r/D9/9TAID+A7T/Ae2/gPs/0P4TtP8F7r9J3AIO\n9P+g/Udw/9Oygbf7r9D+L7j/DO1/Q/vv4P4/tP8Q7n9E+y/h/k+0/xTuf4X7b+H+X7T/+BPuf3aM\n8OHDhw8fPnz4w/4vzcvgeY10sY0AAAAldEVYdGRhdGU6Y3JlYXRlADIwMTYtMDMtMjNUMTQ6NTA6\nNDUtMDQ6MDD1gtVmAAAAJXRFWHRkYXRlOm1vZGlmeQAyMDE2LTAzLTIzVDE0OjUwOjQ1LTA0OjAw\nhN9t2gAAAABJRU5ErkJggg==\n",
|
||||
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAPoAAAD6AgMAAAD1grKuAAAABGdBTUEAALGPC/xhBQAAACBjSFJN\nAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAADFBMVEX///9yEhLpgJFNv8Tq\nQYT7AAAAAWJLR0QAiAUdSAAAAAd0SU1FB+AEHgslKE7FoLIAAALKSURBVGje7dpLcqQwDAbgHHE2\nYeEj+D4cwQucBUfo+3CEXoSp8OhuhF70T4qpKXmdr21LogK2Pj7A8QmNP+HDhw8fPnz48Kf6VH9G\n+66vy+je8k19jnf8C5dXIPv86ms56lPdjvaYbyodx3ze+XLE76cXFiD4zPji99z0/AJ4n1lfvJ6f\nnl0A6x+578efMSg1wPr172/jPO5yFXM+Ef78gdblM+WPHyguP//t1/g6pA0wfln+ho/fwgYYn19C\n/xwDvwHGc9OvC+hs37DTrwuwfWanXxdQTC9Mvyygs3wjTL8uwPJpn/tNDbSGz7T0SBEWw4vLXzbQ\n6b6RoveIoO6TvPxlA63qs7z8ZQPF9F+SH22vbX8OQKf5Rtv+EgDNJ3X58wZaxWd1+fMGiuFvir8b\nvjp8J/tGy/6jAmRvhW8fwL3vVT+o3grfPoB7r/IpALI3tz8FoJN84/NV873hB8UnM3xzANtf8nb4\ndwmg3grfFEDJO8JPE0i9Ff4pAYL3pI8mkHor/HMCeO9JH00g9SafEsh7T/ppARBvp48UwJnelT5S\nACd7O31TAlnvKx9SQCd7B58KgPO+8iMFuPWe9E8F8BveWX7bAjzX9y4//Jve+fhsH6Ctv7n8PTzj\nvY/v9gEOHz58+PBX+6v/f/wPvnd54f3j6venE/yl769Xv7+j3x/o98/V32/o9+fl389Xnx+g5x/o\n+Qt6/oOeP6HnX+j5G3z+h54/ouefV5/foufP6Pk3ev4On/+j9w/o/Qd6/4Le/6D3T/D9V67Y/ZsV\nQBq+s+8f0ftP+P41axXguP9NWgDuu/Cdfv+N3r/D9/9TAID+A7T/Ae2/gPs/0P4TtP8F7r9J3AIO\n9P+g/Udw/9Oygbf7r9D+L7j/DO1/Q/vv4P4/tP8Q7n9E+y/h/k+0/xTuf4X7b+H+X7T/+BPuf3aM\n8OHDhw8fPnz4w/4vzcvgeY10sY0AAAAldEVYdGRhdGU6Y3JlYXRlADIwMTYtMDQtMzBUMDY6Mzc6\nNDAtMDU6MDAMbOxZAAAAJXRFWHRkYXRlOm1vZGlmeQAyMDE2LTA0LTMwVDA2OjM3OjQwLTA1OjAw\nfTFU5QAAAABJRU5ErkJggg==\n",
|
||||
"text/plain": [
|
||||
"<IPython.core.display.Image object>"
|
||||
]
|
||||
|
|
@ -399,8 +386,8 @@
|
|||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# Instantiate an empty TalliesFile\n",
|
||||
"tallies_file = openmc.TalliesFile()"
|
||||
"# Instantiate an empty Tallies object\n",
|
||||
"tallies_file = openmc.Tallies()"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
|
@ -421,7 +408,7 @@
|
|||
"tally.filters = [openmc.Filter(type='cell', bins=[fuel_cell.id, moderator_cell.id])]\n",
|
||||
"tally.filters.append(energy_filter)\n",
|
||||
"tally.scores = ['flux']\n",
|
||||
"tallies_file.add_tally(tally)\n",
|
||||
"tallies_file.append(tally)\n",
|
||||
"\n",
|
||||
"# Instantiate reaction rate Tally in fuel\n",
|
||||
"tally = openmc.Tally(name='fuel rxn rates')\n",
|
||||
|
|
@ -429,7 +416,7 @@
|
|||
"tally.filters.append(energy_filter)\n",
|
||||
"tally.scores = ['nu-fission', 'scatter']\n",
|
||||
"tally.nuclides = [u238, u235]\n",
|
||||
"tallies_file.add_tally(tally)\n",
|
||||
"tallies_file.append(tally)\n",
|
||||
"\n",
|
||||
"# Instantiate reaction rate Tally in moderator\n",
|
||||
"tally = openmc.Tally(name='moderator rxn rates')\n",
|
||||
|
|
@ -437,7 +424,7 @@
|
|||
"tally.filters.append(energy_filter)\n",
|
||||
"tally.scores = ['absorption', 'total']\n",
|
||||
"tally.nuclides = [o16, h1]\n",
|
||||
"tallies_file.add_tally(tally)"
|
||||
"tallies_file.append(tally)"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
|
@ -453,8 +440,7 @@
|
|||
"abs_rate = openmc.Tally(name='abs. rate')\n",
|
||||
"fiss_rate.scores = ['nu-fission']\n",
|
||||
"abs_rate.scores = ['absorption']\n",
|
||||
"tallies_file.add_tally(fiss_rate)\n",
|
||||
"tallies_file.add_tally(abs_rate)"
|
||||
"tallies_file += (fiss_rate, abs_rate)"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
|
@ -469,7 +455,7 @@
|
|||
"therm_abs_rate = openmc.Tally(name='therm. abs. rate')\n",
|
||||
"therm_abs_rate.scores = ['absorption']\n",
|
||||
"therm_abs_rate.filters = [openmc.Filter(type='energy', bins=[0., 0.625e-6])]\n",
|
||||
"tallies_file.add_tally(therm_abs_rate)"
|
||||
"tallies_file.append(therm_abs_rate)"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
|
@ -485,7 +471,7 @@
|
|||
"fuel_therm_abs_rate.scores = ['absorption']\n",
|
||||
"fuel_therm_abs_rate.filters = [openmc.Filter(type='energy', bins=[0., 0.625e-6]),\n",
|
||||
" openmc.Filter(type='cell', bins=[fuel_cell.id])]\n",
|
||||
"tallies_file.add_tally(fuel_therm_abs_rate)"
|
||||
"tallies_file.append(fuel_therm_abs_rate)"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
|
@ -500,7 +486,7 @@
|
|||
"therm_fiss_rate = openmc.Tally(name='therm. fiss. rate')\n",
|
||||
"therm_fiss_rate.scores = ['nu-fission']\n",
|
||||
"therm_fiss_rate.filters = [openmc.Filter(type='energy', bins=[0., 0.625e-6])]\n",
|
||||
"tallies_file.add_tally(therm_fiss_rate)"
|
||||
"tallies_file.append(therm_fiss_rate)"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
|
@ -520,7 +506,7 @@
|
|||
"tally.filters.append(energy_filter)\n",
|
||||
"tally.scores = ['nu-fission', 'scatter']\n",
|
||||
"tally.nuclides = [h1, u238]\n",
|
||||
"tallies_file.add_tally(tally)"
|
||||
"tallies_file.append(tally)"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
|
@ -567,13 +553,11 @@
|
|||
" 888\n",
|
||||
" 888\n",
|
||||
"\n",
|
||||
" Copyright: 2011-2015 Massachusetts Institute of Technology\n",
|
||||
" License: http://mit-crpg.github.io/openmc/license.html\n",
|
||||
" Copyright: 2011-2016 Massachusetts Institute of Technology\n",
|
||||
" License: http://openmc.readthedocs.org/en/latest/license.html\n",
|
||||
" Version: 0.7.1\n",
|
||||
" Git SHA1: 5f252e2df51930b9175fd41bafa8db01f3eaeb92\n",
|
||||
" Date/Time: 2016-03-23 14:50:46\n",
|
||||
" MPI Processes: 1\n",
|
||||
" OpenMP Threads: 16\n",
|
||||
" Git SHA1: ae083cf5d491e6a778d5b762dad19c8d5fe45238\n",
|
||||
" Date/Time: 2016-04-30 06:37:41\n",
|
||||
"\n",
|
||||
" ===========================================================================\n",
|
||||
" ========================> INITIALIZATION <=========================\n",
|
||||
|
|
@ -600,26 +584,26 @@
|
|||
"\n",
|
||||
" Bat./Gen. k Average k \n",
|
||||
" ========= ======== ==================== \n",
|
||||
" 1/1 1.03167 \n",
|
||||
" 2/1 1.03535 \n",
|
||||
" 3/1 1.02709 \n",
|
||||
" 4/1 1.00637 \n",
|
||||
" 5/1 0.99250 \n",
|
||||
" 6/1 1.06116 \n",
|
||||
" 7/1 1.04289 1.05202 +/- 0.00913\n",
|
||||
" 8/1 1.04779 1.05061 +/- 0.00546\n",
|
||||
" 9/1 1.04695 1.04969 +/- 0.00397\n",
|
||||
" 10/1 0.98778 1.03731 +/- 0.01276\n",
|
||||
" 11/1 1.05810 1.04078 +/- 0.01098\n",
|
||||
" 12/1 1.01539 1.03715 +/- 0.00996\n",
|
||||
" 13/1 1.08644 1.04331 +/- 0.01060\n",
|
||||
" 14/1 1.06425 1.04564 +/- 0.00963\n",
|
||||
" 15/1 1.01768 1.04284 +/- 0.00906\n",
|
||||
" 16/1 1.05877 1.04429 +/- 0.00832\n",
|
||||
" 17/1 1.02195 1.04243 +/- 0.00782\n",
|
||||
" 18/1 1.02488 1.04108 +/- 0.00732\n",
|
||||
" 19/1 1.06285 1.04263 +/- 0.00695\n",
|
||||
" 20/1 0.98751 1.03896 +/- 0.00744\n",
|
||||
" 1/1 1.03471 \n",
|
||||
" 2/1 1.03257 \n",
|
||||
" 3/1 1.00600 \n",
|
||||
" 4/1 1.04547 \n",
|
||||
" 5/1 1.02287 \n",
|
||||
" 6/1 1.05752 \n",
|
||||
" 7/1 1.04283 1.05017 +/- 0.00734\n",
|
||||
" 8/1 1.05189 1.05074 +/- 0.00428\n",
|
||||
" 9/1 1.01645 1.04217 +/- 0.00909\n",
|
||||
" 10/1 1.04978 1.04369 +/- 0.00721\n",
|
||||
" 11/1 1.03459 1.04218 +/- 0.00608\n",
|
||||
" 12/1 1.04019 1.04189 +/- 0.00514\n",
|
||||
" 13/1 1.05985 1.04414 +/- 0.00499\n",
|
||||
" 14/1 1.02111 1.04158 +/- 0.00509\n",
|
||||
" 15/1 1.04774 1.04219 +/- 0.00459\n",
|
||||
" 16/1 1.00733 1.03902 +/- 0.00523\n",
|
||||
" 17/1 1.02224 1.03763 +/- 0.00497\n",
|
||||
" 18/1 1.03263 1.03724 +/- 0.00459\n",
|
||||
" 19/1 1.01611 1.03573 +/- 0.00451\n",
|
||||
" 20/1 1.04692 1.03648 +/- 0.00426\n",
|
||||
" Creating state point statepoint.20.h5...\n",
|
||||
"\n",
|
||||
" ===========================================================================\n",
|
||||
|
|
@ -629,27 +613,27 @@
|
|||
"\n",
|
||||
" =======================> TIMING STATISTICS <=======================\n",
|
||||
"\n",
|
||||
" Total time for initialization = 5.0400E-01 seconds\n",
|
||||
" Reading cross sections = 1.5000E-01 seconds\n",
|
||||
" Total time in simulation = 2.1570E+00 seconds\n",
|
||||
" Time in transport only = 1.9760E+00 seconds\n",
|
||||
" Time in inactive batches = 3.3600E-01 seconds\n",
|
||||
" Time in active batches = 1.8210E+00 seconds\n",
|
||||
" Time synchronizing fission bank = 4.0000E-03 seconds\n",
|
||||
" Sampling source sites = 3.0000E-03 seconds\n",
|
||||
" SEND/RECV source sites = 1.0000E-03 seconds\n",
|
||||
" Total time for initialization = 7.0900E-01 seconds\n",
|
||||
" Reading cross sections = 4.0400E-01 seconds\n",
|
||||
" Total time in simulation = 1.7108E+01 seconds\n",
|
||||
" Time in transport only = 1.7093E+01 seconds\n",
|
||||
" Time in inactive batches = 3.3970E+00 seconds\n",
|
||||
" Time in active batches = 1.3711E+01 seconds\n",
|
||||
" Time synchronizing fission bank = 1.0000E-03 seconds\n",
|
||||
" Sampling source sites = 1.0000E-03 seconds\n",
|
||||
" SEND/RECV source sites = 0.0000E+00 seconds\n",
|
||||
" Time accumulating tallies = 0.0000E+00 seconds\n",
|
||||
" Total time for finalization = 2.0000E-03 seconds\n",
|
||||
" Total time elapsed = 2.6800E+00 seconds\n",
|
||||
" Calculation Rate (inactive) = 37202.4 neutrons/second\n",
|
||||
" Calculation Rate (active) = 20593.1 neutrons/second\n",
|
||||
" Total time for finalization = 1.0000E-03 seconds\n",
|
||||
" Total time elapsed = 1.7835E+01 seconds\n",
|
||||
" Calculation Rate (inactive) = 3679.72 neutrons/second\n",
|
||||
" Calculation Rate (active) = 2735.03 neutrons/second\n",
|
||||
"\n",
|
||||
" ============================> RESULTS <============================\n",
|
||||
"\n",
|
||||
" k-effective (Collision) = 1.03965 +/- 0.00597\n",
|
||||
" k-effective (Track-length) = 1.03896 +/- 0.00744\n",
|
||||
" k-effective (Absorption) = 1.03976 +/- 0.00606\n",
|
||||
" Combined k-effective = 1.03991 +/- 0.00536\n",
|
||||
" k-effective (Collision) = 1.03296 +/- 0.00669\n",
|
||||
" k-effective (Track-length) = 1.03648 +/- 0.00426\n",
|
||||
" k-effective (Absorption) = 1.03431 +/- 0.00702\n",
|
||||
" Combined k-effective = 1.03621 +/- 0.00456\n",
|
||||
" Leakage Fraction = 0.00000 +/- 0.00000\n",
|
||||
"\n"
|
||||
]
|
||||
|
|
@ -669,8 +653,8 @@
|
|||
"# Remove old HDF5 (summary, statepoint) files\n",
|
||||
"!rm statepoint.*\n",
|
||||
"\n",
|
||||
"# Run OpenMC with MPI!\n",
|
||||
"executor.run_simulation()"
|
||||
"# Run OpenMC!\n",
|
||||
"openmc.run()"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
|
@ -697,7 +681,7 @@
|
|||
"outputs": [],
|
||||
"source": [
|
||||
"# Load the statepoint file\n",
|
||||
"sp = StatePoint('statepoint.20.h5')"
|
||||
"sp = openmc.StatePoint('statepoint.20.h5')"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
|
@ -717,7 +701,7 @@
|
|||
"outputs": [],
|
||||
"source": [
|
||||
"# Load the summary file and link with statepoint\n",
|
||||
"su = Summary('summary.h5')\n",
|
||||
"su = openmc.Summary('summary.h5')\n",
|
||||
"sp.link_with_summary(su)"
|
||||
]
|
||||
},
|
||||
|
|
@ -756,8 +740,8 @@
|
|||
" <th>0</th>\n",
|
||||
" <td>total</td>\n",
|
||||
" <td>(nu-fission / absorption)</td>\n",
|
||||
" <td>1.036847</td>\n",
|
||||
" <td>0.009685</td>\n",
|
||||
" <td>1.038387</td>\n",
|
||||
" <td>0.006141</td>\n",
|
||||
" </tr>\n",
|
||||
" </tbody>\n",
|
||||
"</table>\n",
|
||||
|
|
@ -765,7 +749,7 @@
|
|||
],
|
||||
"text/plain": [
|
||||
" nuclide score mean std. dev.\n",
|
||||
"0 total (nu-fission / absorption) 1.04e+00 9.69e-03"
|
||||
"0 total (nu-fission / absorption) 1.04e+00 6.14e-03"
|
||||
]
|
||||
},
|
||||
"execution_count": 26,
|
||||
|
|
@ -816,12 +800,12 @@
|
|||
" <tbody>\n",
|
||||
" <tr>\n",
|
||||
" <th>0</th>\n",
|
||||
" <td>0</td>\n",
|
||||
" <td>0.0</td>\n",
|
||||
" <td>6.250000e-07</td>\n",
|
||||
" <td>total</td>\n",
|
||||
" <td>absorption</td>\n",
|
||||
" <td>0.692034</td>\n",
|
||||
" <td>0.007217</td>\n",
|
||||
" <td>0.693337</td>\n",
|
||||
" <td>0.004109</td>\n",
|
||||
" </tr>\n",
|
||||
" </tbody>\n",
|
||||
"</table>\n",
|
||||
|
|
@ -829,7 +813,7 @@
|
|||
],
|
||||
"text/plain": [
|
||||
" energy low [MeV] energy high [MeV] nuclide score mean std. dev.\n",
|
||||
"0 0.00e+00 6.25e-07 total absorption 6.92e-01 7.22e-03"
|
||||
"0 0.00e+00 6.25e-07 total absorption 6.93e-01 4.11e-03"
|
||||
]
|
||||
},
|
||||
"execution_count": 27,
|
||||
|
|
@ -878,12 +862,12 @@
|
|||
" <tbody>\n",
|
||||
" <tr>\n",
|
||||
" <th>0</th>\n",
|
||||
" <td>0</td>\n",
|
||||
" <td>0.0</td>\n",
|
||||
" <td>6.250000e-07</td>\n",
|
||||
" <td>total</td>\n",
|
||||
" <td>nu-fission</td>\n",
|
||||
" <td>1.202298</td>\n",
|
||||
" <td>0.013385</td>\n",
|
||||
" <td>1.203042</td>\n",
|
||||
" <td>0.0076</td>\n",
|
||||
" </tr>\n",
|
||||
" </tbody>\n",
|
||||
"</table>\n",
|
||||
|
|
@ -891,7 +875,7 @@
|
|||
],
|
||||
"text/plain": [
|
||||
" energy low [MeV] energy high [MeV] nuclide score mean std. dev.\n",
|
||||
"0 0.00e+00 6.25e-07 total nu-fission 1.20e+00 1.34e-02"
|
||||
"0 0.00e+00 6.25e-07 total nu-fission 1.20e+00 7.60e-03"
|
||||
]
|
||||
},
|
||||
"execution_count": 28,
|
||||
|
|
@ -942,13 +926,13 @@
|
|||
" <tbody>\n",
|
||||
" <tr>\n",
|
||||
" <th>0</th>\n",
|
||||
" <td>0</td>\n",
|
||||
" <td>0.0</td>\n",
|
||||
" <td>6.250000e-07</td>\n",
|
||||
" <td>10000</td>\n",
|
||||
" <td>total</td>\n",
|
||||
" <td>absorption</td>\n",
|
||||
" <td>0.749151</td>\n",
|
||||
" <td>0.009003</td>\n",
|
||||
" <td>0.748413</td>\n",
|
||||
" <td>0.004723</td>\n",
|
||||
" </tr>\n",
|
||||
" </tbody>\n",
|
||||
"</table>\n",
|
||||
|
|
@ -956,10 +940,10 @@
|
|||
],
|
||||
"text/plain": [
|
||||
" energy low [MeV] energy high [MeV] cell nuclide score mean \\\n",
|
||||
"0 0.00e+00 6.25e-07 10000 total absorption 7.49e-01 \n",
|
||||
"0 0.00e+00 6.25e-07 10000 total absorption 7.48e-01 \n",
|
||||
"\n",
|
||||
" std. dev. \n",
|
||||
"0 9.00e-03 "
|
||||
"0 4.72e-03 "
|
||||
]
|
||||
},
|
||||
"execution_count": 29,
|
||||
|
|
@ -1008,13 +992,13 @@
|
|||
" <tbody>\n",
|
||||
" <tr>\n",
|
||||
" <th>0</th>\n",
|
||||
" <td>0</td>\n",
|
||||
" <td>0.0</td>\n",
|
||||
" <td>6.250000e-07</td>\n",
|
||||
" <td>10000</td>\n",
|
||||
" <td>total</td>\n",
|
||||
" <td>(nu-fission / absorption)</td>\n",
|
||||
" <td>1.663435</td>\n",
|
||||
" <td>0.019976</td>\n",
|
||||
" <td>1.663385</td>\n",
|
||||
" <td>0.011253</td>\n",
|
||||
" </tr>\n",
|
||||
" </tbody>\n",
|
||||
"</table>\n",
|
||||
|
|
@ -1025,7 +1009,7 @@
|
|||
"0 0.00e+00 6.25e-07 10000 total \n",
|
||||
"\n",
|
||||
" score mean std. dev. \n",
|
||||
"0 (nu-fission / absorption) 1.66e+00 2.00e-02 "
|
||||
"0 (nu-fission / absorption) 1.66e+00 1.13e-02 "
|
||||
]
|
||||
},
|
||||
"execution_count": 30,
|
||||
|
|
@ -1073,13 +1057,13 @@
|
|||
" <tbody>\n",
|
||||
" <tr>\n",
|
||||
" <th>0</th>\n",
|
||||
" <td>0</td>\n",
|
||||
" <td>0.0</td>\n",
|
||||
" <td>6.250000e-07</td>\n",
|
||||
" <td>10000</td>\n",
|
||||
" <td>total</td>\n",
|
||||
" <td>(((absorption * nu-fission) * absorption) * (n...</td>\n",
|
||||
" <td>1.036847</td>\n",
|
||||
" <td>0.023674</td>\n",
|
||||
" <td>1.038387</td>\n",
|
||||
" <td>0.01316</td>\n",
|
||||
" </tr>\n",
|
||||
" </tbody>\n",
|
||||
"</table>\n",
|
||||
|
|
@ -1090,7 +1074,7 @@
|
|||
"0 0.00e+00 6.25e-07 10000 total \n",
|
||||
"\n",
|
||||
" score mean std. dev. \n",
|
||||
"0 (((absorption * nu-fission) * absorption) * (n... 1.04e+00 2.37e-02 "
|
||||
"0 (((absorption * nu-fission) * absorption) * (n... 1.04e+00 1.32e-02 "
|
||||
]
|
||||
},
|
||||
"execution_count": 31,
|
||||
|
|
@ -1160,8 +1144,8 @@
|
|||
" <td>6.250000e-07</td>\n",
|
||||
" <td>(U-238 / total)</td>\n",
|
||||
" <td>(nu-fission / flux)</td>\n",
|
||||
" <td>6.627781e-07</td>\n",
|
||||
" <td>7.082494e-09</td>\n",
|
||||
" <td>6.636968e-07</td>\n",
|
||||
" <td>4.132875e-09</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>1</th>\n",
|
||||
|
|
@ -1170,8 +1154,8 @@
|
|||
" <td>6.250000e-07</td>\n",
|
||||
" <td>(U-238 / total)</td>\n",
|
||||
" <td>(scatter / flux)</td>\n",
|
||||
" <td>2.099843e-01</td>\n",
|
||||
" <td>2.003686e-03</td>\n",
|
||||
" <td>2.099856e-01</td>\n",
|
||||
" <td>1.232455e-03</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>2</th>\n",
|
||||
|
|
@ -1180,8 +1164,8 @@
|
|||
" <td>6.250000e-07</td>\n",
|
||||
" <td>(U-235 / total)</td>\n",
|
||||
" <td>(nu-fission / flux)</td>\n",
|
||||
" <td>3.547246e-01</td>\n",
|
||||
" <td>3.854562e-03</td>\n",
|
||||
" <td>3.552458e-01</td>\n",
|
||||
" <td>2.252681e-03</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>3</th>\n",
|
||||
|
|
@ -1190,8 +1174,8 @@
|
|||
" <td>6.250000e-07</td>\n",
|
||||
" <td>(U-235 / total)</td>\n",
|
||||
" <td>(scatter / flux)</td>\n",
|
||||
" <td>5.554185e-03</td>\n",
|
||||
" <td>5.316706e-05</td>\n",
|
||||
" <td>5.554345e-03</td>\n",
|
||||
" <td>3.265385e-05</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>4</th>\n",
|
||||
|
|
@ -1200,8 +1184,8 @@
|
|||
" <td>2.000000e+01</td>\n",
|
||||
" <td>(U-238 / total)</td>\n",
|
||||
" <td>(nu-fission / flux)</td>\n",
|
||||
" <td>7.151165e-03</td>\n",
|
||||
" <td>5.480545e-05</td>\n",
|
||||
" <td>7.126668e-03</td>\n",
|
||||
" <td>5.296883e-05</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>5</th>\n",
|
||||
|
|
@ -1210,8 +1194,8 @@
|
|||
" <td>2.000000e+01</td>\n",
|
||||
" <td>(U-238 / total)</td>\n",
|
||||
" <td>(scatter / flux)</td>\n",
|
||||
" <td>2.278981e-01</td>\n",
|
||||
" <td>6.424480e-04</td>\n",
|
||||
" <td>2.277460e-01</td>\n",
|
||||
" <td>1.003558e-03</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>6</th>\n",
|
||||
|
|
@ -1220,8 +1204,8 @@
|
|||
" <td>2.000000e+01</td>\n",
|
||||
" <td>(U-235 / total)</td>\n",
|
||||
" <td>(nu-fission / flux)</td>\n",
|
||||
" <td>8.073636e-03</td>\n",
|
||||
" <td>4.374754e-05</td>\n",
|
||||
" <td>8.010911e-03</td>\n",
|
||||
" <td>6.802256e-05</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>7</th>\n",
|
||||
|
|
@ -1230,8 +1214,8 @@
|
|||
" <td>2.000000e+01</td>\n",
|
||||
" <td>(U-235 / total)</td>\n",
|
||||
" <td>(scatter / flux)</td>\n",
|
||||
" <td>3.369592e-03</td>\n",
|
||||
" <td>8.971220e-06</td>\n",
|
||||
" <td>3.367794e-03</td>\n",
|
||||
" <td>1.443644e-05</td>\n",
|
||||
" </tr>\n",
|
||||
" </tbody>\n",
|
||||
"</table>\n",
|
||||
|
|
@ -1249,14 +1233,14 @@
|
|||
"7 10000 6.25e-07 2.00e+01 (U-235 / total) \n",
|
||||
"\n",
|
||||
" score mean std. dev. \n",
|
||||
"0 (nu-fission / flux) 6.63e-07 7.08e-09 \n",
|
||||
"1 (scatter / flux) 2.10e-01 2.00e-03 \n",
|
||||
"2 (nu-fission / flux) 3.55e-01 3.85e-03 \n",
|
||||
"3 (scatter / flux) 5.55e-03 5.32e-05 \n",
|
||||
"4 (nu-fission / flux) 7.15e-03 5.48e-05 \n",
|
||||
"5 (scatter / flux) 2.28e-01 6.42e-04 \n",
|
||||
"6 (nu-fission / flux) 8.07e-03 4.37e-05 \n",
|
||||
"7 (scatter / flux) 3.37e-03 8.97e-06 "
|
||||
"0 (nu-fission / flux) 6.64e-07 4.13e-09 \n",
|
||||
"1 (scatter / flux) 2.10e-01 1.23e-03 \n",
|
||||
"2 (nu-fission / flux) 3.55e-01 2.25e-03 \n",
|
||||
"3 (scatter / flux) 5.55e-03 3.27e-05 \n",
|
||||
"4 (nu-fission / flux) 7.13e-03 5.30e-05 \n",
|
||||
"5 (scatter / flux) 2.28e-01 1.00e-03 \n",
|
||||
"6 (nu-fission / flux) 8.01e-03 6.80e-05 \n",
|
||||
"7 (scatter / flux) 3.37e-03 1.44e-05 "
|
||||
]
|
||||
},
|
||||
"execution_count": 33,
|
||||
|
|
@ -1287,11 +1271,11 @@
|
|||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"[[[ 6.62778145e-07]\n",
|
||||
" [ 3.54724568e-01]]\n",
|
||||
"[[[ 6.63696783e-07]\n",
|
||||
" [ 3.55245846e-01]]\n",
|
||||
"\n",
|
||||
" [[ 7.15116511e-03]\n",
|
||||
" [ 8.07363630e-03]]]\n"
|
||||
" [[ 7.12666800e-03]\n",
|
||||
" [ 8.01091088e-03]]]\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
|
|
@ -1319,9 +1303,9 @@
|
|||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"[[[ 0.00555418]]\n",
|
||||
"[[[ 0.00555435]]\n",
|
||||
"\n",
|
||||
" [[ 0.00336959]]]\n"
|
||||
" [[ 0.00336779]]]\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
|
|
@ -1343,8 +1327,8 @@
|
|||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"[[[ 0.22789806]\n",
|
||||
" [ 0.00336959]]]\n"
|
||||
"[[[ 0.22774598]\n",
|
||||
" [ 0.00336779]]]\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
|
|
@ -1396,7 +1380,7 @@
|
|||
" <td>U-238</td>\n",
|
||||
" <td>nu-fission</td>\n",
|
||||
" <td>0.000002</td>\n",
|
||||
" <td>1.338459e-08</td>\n",
|
||||
" <td>7.473789e-09</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>1</th>\n",
|
||||
|
|
@ -1405,8 +1389,8 @@
|
|||
" <td>6.250000e-07</td>\n",
|
||||
" <td>U-235</td>\n",
|
||||
" <td>nu-fission</td>\n",
|
||||
" <td>0.864141</td>\n",
|
||||
" <td>7.363278e-03</td>\n",
|
||||
" <td>0.861547</td>\n",
|
||||
" <td>4.131310e-03</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>2</th>\n",
|
||||
|
|
@ -1415,8 +1399,8 @@
|
|||
" <td>2.000000e+01</td>\n",
|
||||
" <td>U-238</td>\n",
|
||||
" <td>nu-fission</td>\n",
|
||||
" <td>0.082111</td>\n",
|
||||
" <td>6.090952e-04</td>\n",
|
||||
" <td>0.082356</td>\n",
|
||||
" <td>5.560461e-04</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>3</th>\n",
|
||||
|
|
@ -1425,8 +1409,8 @@
|
|||
" <td>2.000000e+01</td>\n",
|
||||
" <td>U-235</td>\n",
|
||||
" <td>nu-fission</td>\n",
|
||||
" <td>0.092703</td>\n",
|
||||
" <td>4.695215e-04</td>\n",
|
||||
" <td>0.092574</td>\n",
|
||||
" <td>7.315442e-04</td>\n",
|
||||
" </tr>\n",
|
||||
" </tbody>\n",
|
||||
"</table>\n",
|
||||
|
|
@ -1435,15 +1419,15 @@
|
|||
"text/plain": [
|
||||
" cell energy low [MeV] energy high [MeV] nuclide score mean \\\n",
|
||||
"0 10000 0.00e+00 6.25e-07 U-238 nu-fission 1.61e-06 \n",
|
||||
"1 10000 0.00e+00 6.25e-07 U-235 nu-fission 8.64e-01 \n",
|
||||
"2 10000 6.25e-07 2.00e+01 U-238 nu-fission 8.21e-02 \n",
|
||||
"3 10000 6.25e-07 2.00e+01 U-235 nu-fission 9.27e-02 \n",
|
||||
"1 10000 0.00e+00 6.25e-07 U-235 nu-fission 8.62e-01 \n",
|
||||
"2 10000 6.25e-07 2.00e+01 U-238 nu-fission 8.24e-02 \n",
|
||||
"3 10000 6.25e-07 2.00e+01 U-235 nu-fission 9.26e-02 \n",
|
||||
"\n",
|
||||
" std. dev. \n",
|
||||
"0 1.34e-08 \n",
|
||||
"1 7.36e-03 \n",
|
||||
"2 6.09e-04 \n",
|
||||
"3 4.70e-04 "
|
||||
"0 7.47e-09 \n",
|
||||
"1 4.13e-03 \n",
|
||||
"2 5.56e-04 \n",
|
||||
"3 7.32e-04 "
|
||||
]
|
||||
},
|
||||
"execution_count": 37,
|
||||
|
|
@ -1489,8 +1473,8 @@
|
|||
" <td>1.080060e-07</td>\n",
|
||||
" <td>H-1</td>\n",
|
||||
" <td>scatter</td>\n",
|
||||
" <td>4.591022</td>\n",
|
||||
" <td>0.043961</td>\n",
|
||||
" <td>4.599225</td>\n",
|
||||
" <td>0.015973</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>1</th>\n",
|
||||
|
|
@ -1499,8 +1483,8 @@
|
|||
" <td>1.166529e-06</td>\n",
|
||||
" <td>H-1</td>\n",
|
||||
" <td>scatter</td>\n",
|
||||
" <td>2.032481</td>\n",
|
||||
" <td>0.010876</td>\n",
|
||||
" <td>2.037260</td>\n",
|
||||
" <td>0.011236</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>2</th>\n",
|
||||
|
|
@ -1509,8 +1493,8 @@
|
|||
" <td>1.259921e-05</td>\n",
|
||||
" <td>H-1</td>\n",
|
||||
" <td>scatter</td>\n",
|
||||
" <td>1.654187</td>\n",
|
||||
" <td>0.012130</td>\n",
|
||||
" <td>1.662552</td>\n",
|
||||
" <td>0.010280</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>3</th>\n",
|
||||
|
|
@ -1519,8 +1503,8 @@
|
|||
" <td>1.360790e-04</td>\n",
|
||||
" <td>H-1</td>\n",
|
||||
" <td>scatter</td>\n",
|
||||
" <td>1.864771</td>\n",
|
||||
" <td>0.011649</td>\n",
|
||||
" <td>1.872201</td>\n",
|
||||
" <td>0.012136</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>4</th>\n",
|
||||
|
|
@ -1529,8 +1513,8 @@
|
|||
" <td>1.469734e-03</td>\n",
|
||||
" <td>H-1</td>\n",
|
||||
" <td>scatter</td>\n",
|
||||
" <td>2.056893</td>\n",
|
||||
" <td>0.008555</td>\n",
|
||||
" <td>2.080459</td>\n",
|
||||
" <td>0.013155</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>5</th>\n",
|
||||
|
|
@ -1539,8 +1523,8 @@
|
|||
" <td>1.587401e-02</td>\n",
|
||||
" <td>H-1</td>\n",
|
||||
" <td>scatter</td>\n",
|
||||
" <td>2.138833</td>\n",
|
||||
" <td>0.015180</td>\n",
|
||||
" <td>2.154996</td>\n",
|
||||
" <td>0.011975</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>6</th>\n",
|
||||
|
|
@ -1549,8 +1533,8 @@
|
|||
" <td>1.714488e-01</td>\n",
|
||||
" <td>H-1</td>\n",
|
||||
" <td>scatter</td>\n",
|
||||
" <td>2.207209</td>\n",
|
||||
" <td>0.014853</td>\n",
|
||||
" <td>2.218740</td>\n",
|
||||
" <td>0.008528</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>7</th>\n",
|
||||
|
|
@ -1559,8 +1543,8 @@
|
|||
" <td>1.851749e+00</td>\n",
|
||||
" <td>H-1</td>\n",
|
||||
" <td>scatter</td>\n",
|
||||
" <td>1.999407</td>\n",
|
||||
" <td>0.009053</td>\n",
|
||||
" <td>2.010517</td>\n",
|
||||
" <td>0.009187</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>8</th>\n",
|
||||
|
|
@ -1569,8 +1553,8 @@
|
|||
" <td>2.000000e+01</td>\n",
|
||||
" <td>H-1</td>\n",
|
||||
" <td>scatter</td>\n",
|
||||
" <td>0.368760</td>\n",
|
||||
" <td>0.003373</td>\n",
|
||||
" <td>0.372022</td>\n",
|
||||
" <td>0.003196</td>\n",
|
||||
" </tr>\n",
|
||||
" </tbody>\n",
|
||||
"</table>\n",
|
||||
|
|
@ -1578,26 +1562,26 @@
|
|||
],
|
||||
"text/plain": [
|
||||
" cell energy low [MeV] energy high [MeV] nuclide score mean \\\n",
|
||||
"0 10002 1.00e-08 1.08e-07 H-1 scatter 4.59e+00 \n",
|
||||
"1 10002 1.08e-07 1.17e-06 H-1 scatter 2.03e+00 \n",
|
||||
"2 10002 1.17e-06 1.26e-05 H-1 scatter 1.65e+00 \n",
|
||||
"3 10002 1.26e-05 1.36e-04 H-1 scatter 1.86e+00 \n",
|
||||
"4 10002 1.36e-04 1.47e-03 H-1 scatter 2.06e+00 \n",
|
||||
"5 10002 1.47e-03 1.59e-02 H-1 scatter 2.14e+00 \n",
|
||||
"6 10002 1.59e-02 1.71e-01 H-1 scatter 2.21e+00 \n",
|
||||
"7 10002 1.71e-01 1.85e+00 H-1 scatter 2.00e+00 \n",
|
||||
"8 10002 1.85e+00 2.00e+01 H-1 scatter 3.69e-01 \n",
|
||||
"0 10002 1.00e-08 1.08e-07 H-1 scatter 4.60e+00 \n",
|
||||
"1 10002 1.08e-07 1.17e-06 H-1 scatter 2.04e+00 \n",
|
||||
"2 10002 1.17e-06 1.26e-05 H-1 scatter 1.66e+00 \n",
|
||||
"3 10002 1.26e-05 1.36e-04 H-1 scatter 1.87e+00 \n",
|
||||
"4 10002 1.36e-04 1.47e-03 H-1 scatter 2.08e+00 \n",
|
||||
"5 10002 1.47e-03 1.59e-02 H-1 scatter 2.15e+00 \n",
|
||||
"6 10002 1.59e-02 1.71e-01 H-1 scatter 2.22e+00 \n",
|
||||
"7 10002 1.71e-01 1.85e+00 H-1 scatter 2.01e+00 \n",
|
||||
"8 10002 1.85e+00 2.00e+01 H-1 scatter 3.72e-01 \n",
|
||||
"\n",
|
||||
" std. dev. \n",
|
||||
"0 4.40e-02 \n",
|
||||
"1 1.09e-02 \n",
|
||||
"2 1.21e-02 \n",
|
||||
"3 1.16e-02 \n",
|
||||
"4 8.56e-03 \n",
|
||||
"5 1.52e-02 \n",
|
||||
"6 1.49e-02 \n",
|
||||
"7 9.05e-03 \n",
|
||||
"8 3.37e-03 "
|
||||
"0 1.60e-02 \n",
|
||||
"1 1.12e-02 \n",
|
||||
"2 1.03e-02 \n",
|
||||
"3 1.21e-02 \n",
|
||||
"4 1.32e-02 \n",
|
||||
"5 1.20e-02 \n",
|
||||
"6 8.53e-03 \n",
|
||||
"7 9.19e-03 \n",
|
||||
"8 3.20e-03 "
|
||||
]
|
||||
},
|
||||
"execution_count": 38,
|
||||
|
|
@ -1616,21 +1600,21 @@
|
|||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Python 2",
|
||||
"display_name": "Python 3",
|
||||
"language": "python",
|
||||
"name": "python2"
|
||||
"name": "python3"
|
||||
},
|
||||
"language_info": {
|
||||
"codemirror_mode": {
|
||||
"name": "ipython",
|
||||
"version": 2
|
||||
"version": 3
|
||||
},
|
||||
"file_extension": ".py",
|
||||
"mimetype": "text/x-python",
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython2",
|
||||
"version": "2.7.11"
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.5.1"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
|
|
|
|||
|
|
@ -1,8 +0,0 @@
|
|||
.. _pythonapi_executor:
|
||||
|
||||
========
|
||||
Executor
|
||||
========
|
||||
|
||||
.. automodule:: openmc.executor
|
||||
:members:
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
.. _pythonapi_filter:
|
||||
|
||||
======
|
||||
Filter
|
||||
======
|
||||
|
||||
.. automodule:: openmc.filter
|
||||
:members:
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
.. _pythonapi_geometry:
|
||||
|
||||
========
|
||||
Geometry
|
||||
========
|
||||
|
||||
.. automodule:: openmc.geometry
|
||||
:members:
|
||||
|
|
@ -13,61 +13,9 @@ 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.
|
||||
|
||||
**Handling nuclear data:**
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
|
||||
ace
|
||||
mgxs_library
|
||||
|
||||
**Creating input files:**
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
|
||||
cmfd
|
||||
element
|
||||
filter
|
||||
geometry
|
||||
material
|
||||
mesh
|
||||
nuclide
|
||||
opencg_compatible
|
||||
plots
|
||||
settings
|
||||
source
|
||||
stats
|
||||
surface
|
||||
tallies
|
||||
trigger
|
||||
universe
|
||||
|
||||
**Running OpenMC:**
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
|
||||
executor
|
||||
|
||||
**Post-processing:**
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
|
||||
particle_restart
|
||||
statepoint
|
||||
summary
|
||||
tallies
|
||||
|
||||
**Multi-Group Cross Section Generation**
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
|
||||
mgxs
|
||||
|
||||
**Example Jupyter Notebooks:**
|
||||
-------------------------
|
||||
Example Jupyter Notebooks
|
||||
-------------------------
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
|
|
@ -79,6 +27,264 @@ on a given module or class.
|
|||
examples/mgxs-part-ii
|
||||
examples/mgxs-part-iii
|
||||
|
||||
------------------------------------
|
||||
:mod:`openmc` -- Basic Functionality
|
||||
------------------------------------
|
||||
|
||||
Handling nuclear data
|
||||
---------------------
|
||||
|
||||
Classes
|
||||
+++++++
|
||||
|
||||
.. autosummary::
|
||||
:toctree: generated
|
||||
:nosignatures:
|
||||
:template: myclass.rst
|
||||
|
||||
openmc.XSdata
|
||||
openmc.MGXSLibrary
|
||||
|
||||
Functions
|
||||
+++++++++
|
||||
|
||||
.. autosummary::
|
||||
:toctree: generated
|
||||
:nosignatures:
|
||||
|
||||
openmc.ace.ascii_to_binary
|
||||
|
||||
Simulation Settings
|
||||
-------------------
|
||||
|
||||
.. autosummary::
|
||||
:toctree: generated
|
||||
:nosignatures:
|
||||
:template: myclass.rst
|
||||
|
||||
openmc.Source
|
||||
openmc.ResonanceScattering
|
||||
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
|
||||
|
||||
Constructing Tallies
|
||||
--------------------
|
||||
|
||||
.. autosummary::
|
||||
:toctree: generated
|
||||
:nosignatures:
|
||||
:template: myclass.rst
|
||||
|
||||
openmc.Filter
|
||||
openmc.Mesh
|
||||
openmc.Trigger
|
||||
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.plot_geometry
|
||||
|
||||
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
|
||||
|
||||
---------------------------------
|
||||
: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
|
||||
|
||||
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
|
||||
|
||||
----------------------------------------------------------
|
||||
: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: myclass.rst
|
||||
|
||||
openmc.mgxs.MGXS
|
||||
openmc.mgxs.AbsorptionXS
|
||||
openmc.mgxs.CaptureXS
|
||||
openmc.mgxs.Chi
|
||||
openmc.mgxs.FissionXS
|
||||
openmc.mgxs.NuFissionXS
|
||||
openmc.mgxs.NuScatterXS
|
||||
openmc.mgxs.NuScatterMatrixXS
|
||||
openmc.mgxs.ScatterXS
|
||||
openmc.mgxs.ScatterMatrixXS
|
||||
openmc.mgxs.TotalXS
|
||||
openmc.mgxs.TransportXS
|
||||
|
||||
Multi-group Cross Section Libraries
|
||||
-----------------------------------
|
||||
|
||||
.. autosummary::
|
||||
:toctree: generated
|
||||
:nosignatures:
|
||||
:template: myclass.rst
|
||||
|
||||
openmc.mgxs.Library
|
||||
|
||||
.. _Jupyter: https://jupyter.org/
|
||||
.. _NumPy: http://www.numpy.org/
|
||||
.. _Codecademy: https://www.codecademy.com/tracks/python
|
||||
|
|
|
|||
|
|
@ -1,8 +0,0 @@
|
|||
.. _pythonapi_material:
|
||||
|
||||
=========
|
||||
Materials
|
||||
=========
|
||||
|
||||
.. automodule:: openmc.material
|
||||
:members:
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
.. _pythonapi_mesh:
|
||||
|
||||
====
|
||||
Mesh
|
||||
====
|
||||
|
||||
.. automodule:: openmc.mesh
|
||||
:members:
|
||||
|
|
@ -1,95 +0,0 @@
|
|||
.. _pythonapi_mgxs:
|
||||
|
||||
==========================
|
||||
Multi-Group Cross Sections
|
||||
==========================
|
||||
|
||||
----------------------------
|
||||
Summary of Available Classes
|
||||
----------------------------
|
||||
|
||||
Energy Groups
|
||||
-------------
|
||||
|
||||
.. currentmodule:: openmc.mgxs.groups
|
||||
|
||||
.. autosummary::
|
||||
|
||||
EnergyGroups
|
||||
|
||||
Multi-group Cross Sections
|
||||
--------------------------
|
||||
|
||||
.. currentmodule:: openmc.mgxs.mgxs
|
||||
|
||||
.. autosummary::
|
||||
|
||||
MGXS
|
||||
AbsorptionXS
|
||||
CaptureXS
|
||||
Chi
|
||||
FissionXS
|
||||
NuFissionXS
|
||||
NuScatterXS
|
||||
NuScatterMatrixXS
|
||||
ScatterXS
|
||||
ScatterMatrixXS
|
||||
TotalXS
|
||||
TransportXS
|
||||
|
||||
Multi-group Cross Section Libraries
|
||||
-----------------------------------
|
||||
|
||||
.. currentmodule:: openmc.mgxs.library
|
||||
|
||||
.. autosummary::
|
||||
|
||||
Library
|
||||
|
||||
-------------------
|
||||
Class Documentation
|
||||
-------------------
|
||||
|
||||
.. automodule:: openmc.mgxs.groups
|
||||
:members:
|
||||
|
||||
.. currentmodule:: openmc.mgxs.mgxs
|
||||
|
||||
.. autoclass:: MGXS
|
||||
:members:
|
||||
|
||||
.. autoclass:: AbsorptionXS
|
||||
:members:
|
||||
|
||||
.. autoclass:: CaptureXS
|
||||
:members:
|
||||
|
||||
.. autoclass:: Chi
|
||||
:members:
|
||||
|
||||
.. autoclass:: FissionXS
|
||||
:members:
|
||||
|
||||
.. autoclass:: NuFissionXS
|
||||
:members:
|
||||
|
||||
.. autoclass:: NuScatterXS
|
||||
:members:
|
||||
|
||||
.. autoclass:: NuScatterMatrixXS
|
||||
:members:
|
||||
|
||||
.. autoclass:: ScatterXS
|
||||
:members:
|
||||
|
||||
.. autoclass:: ScatterMatrixXS
|
||||
:members:
|
||||
|
||||
.. autoclass:: TotalXS
|
||||
:members:
|
||||
|
||||
.. autoclass:: TransportXS
|
||||
:members:
|
||||
|
||||
.. automodule:: openmc.mgxs.library
|
||||
:members:
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
.. _pythonapi_mgxs_library:
|
||||
|
||||
==============================
|
||||
Multi-group Cross Section Data
|
||||
==============================
|
||||
|
||||
.. automodule:: openmc.mgxs_library
|
||||
:members:
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
.. _pythonapi_nuclide:
|
||||
|
||||
=======
|
||||
Nuclide
|
||||
=======
|
||||
|
||||
.. automodule:: openmc.nuclide
|
||||
:members:
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
.. _pythonapi_particle_restart:
|
||||
|
||||
================
|
||||
Particle Restart
|
||||
================
|
||||
|
||||
.. automodule:: openmc.particle_restart
|
||||
:members:
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
.. _pythonapi_plots:
|
||||
|
||||
=====
|
||||
Plots
|
||||
=====
|
||||
|
||||
.. automodule:: openmc.plots
|
||||
:members:
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
.. _pythonapi_settings:
|
||||
|
||||
========
|
||||
Settings
|
||||
========
|
||||
|
||||
.. automodule:: openmc.settings
|
||||
:members:
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
.. _pythonapi_source:
|
||||
|
||||
======
|
||||
Source
|
||||
======
|
||||
|
||||
.. automodule:: openmc.source
|
||||
:members:
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
.. _pythonapi_statepoint:
|
||||
|
||||
==========
|
||||
Statepoint
|
||||
==========
|
||||
|
||||
.. automodule:: openmc.statepoint
|
||||
:members:
|
||||
|
|
@ -1,58 +0,0 @@
|
|||
.. _pythonapi_stats:
|
||||
|
||||
=====================
|
||||
Statistical Functions
|
||||
=====================
|
||||
|
||||
----------------------------
|
||||
Summary of Available Classes
|
||||
----------------------------
|
||||
|
||||
Univariate Probability Distributions
|
||||
------------------------------------
|
||||
|
||||
.. currentmodule:: openmc.stats.univariate
|
||||
|
||||
.. autosummary::
|
||||
|
||||
Univariate
|
||||
Discrete
|
||||
Uniform
|
||||
Maxwell
|
||||
Watt
|
||||
Tabular
|
||||
|
||||
Angular Distributions
|
||||
---------------------
|
||||
|
||||
.. currentmodule:: openmc.stats.multivariate
|
||||
|
||||
.. autosummary::
|
||||
|
||||
UnitSphere
|
||||
PolarAzimuthal
|
||||
Isotropic
|
||||
Monodirectional
|
||||
|
||||
Spatial Distributions
|
||||
---------------------
|
||||
|
||||
.. autosummary::
|
||||
|
||||
Spatial
|
||||
CartesianIndependent
|
||||
Box
|
||||
Point
|
||||
|
||||
|
||||
Univariate Probability Distributions
|
||||
------------------------------------
|
||||
|
||||
.. automodule:: openmc.stats.univariate
|
||||
:members:
|
||||
|
||||
Multivariate Probability Distributions
|
||||
--------------------------------------
|
||||
|
||||
.. automodule:: openmc.stats.multivariate
|
||||
:members:
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
.. _pythonapi_summary:
|
||||
|
||||
=======
|
||||
Summary
|
||||
=======
|
||||
|
||||
.. automodule:: openmc.summary
|
||||
:members:
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
.. _pythonapi_surface:
|
||||
|
||||
=======
|
||||
Surface
|
||||
=======
|
||||
|
||||
.. automodule:: openmc.surface
|
||||
:members:
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
.. _pythonapi_tallies:
|
||||
|
||||
=======
|
||||
Tallies
|
||||
=======
|
||||
|
||||
.. automodule:: openmc.tallies
|
||||
:members:
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
.. _pythonapi_trigger:
|
||||
|
||||
=======
|
||||
Trigger
|
||||
=======
|
||||
|
||||
.. automodule:: openmc.trigger
|
||||
:members:
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
.. _pythonapi_universe:
|
||||
|
||||
========
|
||||
Universe
|
||||
========
|
||||
|
||||
.. automodule:: openmc.universe
|
||||
:members:
|
||||
|
|
@ -196,10 +196,10 @@ Data Extraction
|
|||
|
||||
A great deal of information is available in statepoint files (See
|
||||
:ref:`usersguide_statepoint`), all of which is accessible through the Python
|
||||
API. The ``openmc.statepoint`` module (see :ref:`pythonapi_statepoint`) provides
|
||||
a class to load statepoints and access data 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.
|
||||
API. The :class:`openmc.StatePoint` class can load statepoints and access data
|
||||
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.
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
import openmc
|
||||
from openmc.source import Source
|
||||
from openmc.stats import Box
|
||||
|
||||
|
||||
###############################################################################
|
||||
# Simulation Input File Parameters
|
||||
|
|
@ -13,7 +12,7 @@ particles = 10000
|
|||
|
||||
|
||||
###############################################################################
|
||||
# Exporting to OpenMC materials.xml File
|
||||
# Exporting to OpenMC materials.xml file
|
||||
###############################################################################
|
||||
|
||||
# Instantiate some Nuclides
|
||||
|
|
@ -32,15 +31,14 @@ fuel = openmc.Material(material_id=40, name='fuel')
|
|||
fuel.set_density('g/cc', 4.5)
|
||||
fuel.add_nuclide(u235, 1.)
|
||||
|
||||
# Instantiate a MaterialsFile, register all Materials, and export to XML
|
||||
materials_file = openmc.MaterialsFile()
|
||||
# Instantiate a Materials collection and export to XML
|
||||
materials_file = openmc.Materials([moderator, fuel])
|
||||
materials_file.default_xs = '71c'
|
||||
materials_file.add_materials([moderator, fuel])
|
||||
materials_file.export_to_xml()
|
||||
|
||||
|
||||
###############################################################################
|
||||
# Exporting to OpenMC geometry.xml File
|
||||
# Exporting to OpenMC geometry.xml file
|
||||
###############################################################################
|
||||
|
||||
# Instantiate ZCylinder surfaces
|
||||
|
|
@ -75,31 +73,32 @@ cell1.fill = universe1
|
|||
universe1.add_cells([cell2, cell3])
|
||||
root.add_cells([cell1, cell4])
|
||||
|
||||
# Instantiate a Geometry and register the root Universe
|
||||
# Instantiate a Geometry, register the root Universe, and export to XML
|
||||
geometry = openmc.Geometry()
|
||||
geometry.root_universe = root
|
||||
|
||||
# Instantiate a GeometryFile, register Geometry, and export to XML
|
||||
geometry_file = openmc.GeometryFile()
|
||||
geometry_file.geometry = geometry
|
||||
geometry_file.export_to_xml()
|
||||
geometry.export_to_xml()
|
||||
|
||||
|
||||
###############################################################################
|
||||
# Exporting to OpenMC settings.xml File
|
||||
# Exporting to OpenMC settings.xml file
|
||||
###############################################################################
|
||||
|
||||
# Instantiate a SettingsFile, set all runtime parameters, and export to XML
|
||||
settings_file = openmc.SettingsFile()
|
||||
# Instantiate a Settings object, set all runtime parameters, and export to XML
|
||||
settings_file = openmc.Settings()
|
||||
settings_file.batches = batches
|
||||
settings_file.inactive = inactive
|
||||
settings_file.particles = particles
|
||||
settings_file.source = Source(space=Box([-4, -4, -4], [4, 4, 4]))
|
||||
|
||||
# Create an initial uniform spatial source distribution over fissionable zones
|
||||
bounds = [-4., -4., -4., 4., 4., 4.]
|
||||
uniform_dist = openmc.stats.Box(bounds[:3], bounds[3:], only_fissionable=True)
|
||||
settings_file.source = openmc.source.Source(space=uniform_dist)
|
||||
|
||||
settings_file.export_to_xml()
|
||||
|
||||
|
||||
###############################################################################
|
||||
# Exporting to OpenMC tallies.xml File
|
||||
# Exporting to OpenMC tallies.xml file
|
||||
###############################################################################
|
||||
|
||||
# Instantiate some tally Filters
|
||||
|
|
@ -124,9 +123,6 @@ third_tally = openmc.Tally(tally_id=3, name='third tally')
|
|||
third_tally.filters = [cell_filter, energy_filter, energyout_filter]
|
||||
third_tally.scores = ['scatter', 'nu-scatter', 'nu-fission']
|
||||
|
||||
# Instantiate a TalliesFile, register all Tallies, and export to XML
|
||||
tallies_file = openmc.TalliesFile()
|
||||
tallies_file.add_tally(first_tally)
|
||||
tallies_file.add_tally(second_tally)
|
||||
tallies_file.add_tally(third_tally)
|
||||
# Instantiate a Tallies collection and export to XML
|
||||
tallies_file = openmc.Tallies((first_tally, second_tally, third_tally))
|
||||
tallies_file.export_to_xml()
|
||||
|
|
|
|||
|
|
@ -1,8 +1,5 @@
|
|||
import numpy as np
|
||||
|
||||
import openmc
|
||||
from openmc.source import Source
|
||||
from openmc.stats import Box
|
||||
|
||||
###############################################################################
|
||||
# Simulation Input File Parameters
|
||||
|
|
@ -39,15 +36,14 @@ moderator.add_nuclide(h1, 2.)
|
|||
moderator.add_nuclide(o16, 1.)
|
||||
moderator.add_s_alpha_beta('HH2O', '71t')
|
||||
|
||||
# Instantiate a MaterialsFile, register all Materials, and export to XML
|
||||
materials_file = openmc.MaterialsFile()
|
||||
# Instantiate a Materials collection and export to XML
|
||||
materials_file = openmc.Materials([fuel1, fuel2, moderator])
|
||||
materials_file.default_xs = '71c'
|
||||
materials_file.add_materials([fuel1, fuel2, moderator])
|
||||
materials_file.export_to_xml()
|
||||
|
||||
|
||||
###############################################################################
|
||||
# Exporting to OpenMC geometry.xml File
|
||||
# Exporting to OpenMC geometry.xml file
|
||||
###############################################################################
|
||||
|
||||
# Instantiate planar surfaces
|
||||
|
|
@ -100,26 +96,26 @@ outer_box.fill = moderator
|
|||
root = openmc.Universe(universe_id=0, name='root universe')
|
||||
root.add_cells([inner_box, middle_box, outer_box])
|
||||
|
||||
# Instantiate a Geometry and register the root Universe
|
||||
# Instantiate a Geometry, register the root Universe, and export to XML
|
||||
geometry = openmc.Geometry()
|
||||
geometry.root_universe = root
|
||||
|
||||
# Instantiate a GeometryFile, register Geometry, and export to XML
|
||||
geometry_file = openmc.GeometryFile()
|
||||
geometry_file.geometry = geometry
|
||||
geometry_file.export_to_xml()
|
||||
geometry.export_to_xml()
|
||||
|
||||
|
||||
###############################################################################
|
||||
# Exporting to OpenMC settings.xml File
|
||||
###############################################################################
|
||||
|
||||
# Instantiate a SettingsFile, set all runtime parameters, and export to XML
|
||||
settings_file = openmc.SettingsFile()
|
||||
# Instantiate a Settings object, set all runtime parameters, and export to XML
|
||||
settings_file = openmc.Settings()
|
||||
settings_file.batches = batches
|
||||
settings_file.inactive = inactive
|
||||
settings_file.particles = particles
|
||||
settings_file.source = Source(space=Box(*outer_cube.bounding_box))
|
||||
|
||||
# Create an initial uniform spatial source distribution over fissionable zones
|
||||
uniform_dist = openmc.stats.Box(*outer_cube.bounding_box, only_fissionable=True)
|
||||
settings_file.source = openmc.source.Source(space=uniform_dist)
|
||||
|
||||
settings_file.export_to_xml()
|
||||
|
||||
###############################################################################
|
||||
|
|
@ -132,7 +128,6 @@ plot.width = [20, 20]
|
|||
plot.pixels = [200, 200]
|
||||
plot.color = 'cell'
|
||||
|
||||
# Instantiate a PlotsFile, add Plot, and export to XML
|
||||
plot_file = openmc.PlotsFile()
|
||||
plot_file.add_plot(plot)
|
||||
# Instantiate a Plots collection and export to XML
|
||||
plot_file = openmc.Plots([plot])
|
||||
plot_file.export_to_xml()
|
||||
|
|
|
|||
|
|
@ -1,6 +1,4 @@
|
|||
import openmc
|
||||
from openmc.source import Source
|
||||
from openmc.stats import Box
|
||||
|
||||
###############################################################################
|
||||
# Simulation Input File Parameters
|
||||
|
|
@ -37,15 +35,14 @@ iron = openmc.Material(material_id=3, name='iron')
|
|||
iron.set_density('g/cc', 7.9)
|
||||
iron.add_nuclide(fe56, 1.)
|
||||
|
||||
# Instantiate a MaterialsFile, register all Materials, and export to XML
|
||||
materials_file = openmc.MaterialsFile()
|
||||
# Instantiate a Materials collection and export to XML
|
||||
materials_file = openmc.Materials([moderator, fuel, iron])
|
||||
materials_file.default_xs = '71c'
|
||||
materials_file.add_materials([moderator, fuel, iron])
|
||||
materials_file.export_to_xml()
|
||||
|
||||
|
||||
###############################################################################
|
||||
# Exporting to OpenMC geometry.xml File
|
||||
# Exporting to OpenMC geometry.xml file
|
||||
###############################################################################
|
||||
|
||||
# Instantiate Surfaces
|
||||
|
|
@ -107,27 +104,27 @@ lattice.outer = univ2
|
|||
# Fill Cell with the Lattice
|
||||
cell1.fill = lattice
|
||||
|
||||
# Instantiate a Geometry and register the root Universe
|
||||
# Instantiate a Geometry, register the root Universe, and export to XML
|
||||
geometry = openmc.Geometry()
|
||||
geometry.root_universe = root
|
||||
|
||||
# Instantiate a GeometryFile, register Geometry, and export to XML
|
||||
geometry_file = openmc.GeometryFile()
|
||||
geometry_file.geometry = geometry
|
||||
geometry_file.export_to_xml()
|
||||
geometry.export_to_xml()
|
||||
|
||||
|
||||
###############################################################################
|
||||
# Exporting to OpenMC settings.xml File
|
||||
# Exporting to OpenMC settings.xml file
|
||||
###############################################################################
|
||||
|
||||
# Instantiate a SettingsFile, set all runtime parameters, and export to XML
|
||||
settings_file = openmc.SettingsFile()
|
||||
# Instantiate a Settings object, set all runtime parameters, and export to XML
|
||||
settings_file = openmc.Settings()
|
||||
settings_file.batches = batches
|
||||
settings_file.inactive = inactive
|
||||
settings_file.particles = particles
|
||||
settings_file.source = Source(space=Box(
|
||||
[-1, -1, -1], [1, 1, 1]))
|
||||
|
||||
# Create an initial uniform spatial source distribution over fissionable zones
|
||||
bounds = [-1, -1, -1, 1, 1, 1]
|
||||
uniform_dist = openmc.stats.Box(bounds[:3], bounds[3:], only_fissionable=True)
|
||||
settings_file.source = openmc.source.Source(space=uniform_dist)
|
||||
|
||||
settings_file.keff_trigger = {'type' : 'std_dev', 'threshold' : 5E-4}
|
||||
settings_file.trigger_active = True
|
||||
settings_file.trigger_max_batches = 100
|
||||
|
|
@ -135,7 +132,7 @@ settings_file.export_to_xml()
|
|||
|
||||
|
||||
###############################################################################
|
||||
# Exporting to OpenMC plots.xml File
|
||||
# Exporting to OpenMC plots.xml file
|
||||
###############################################################################
|
||||
|
||||
plot_xy = openmc.Plot(plot_id=1)
|
||||
|
|
@ -153,10 +150,8 @@ plot_yz.width = [8, 8]
|
|||
plot_yz.pixels = [400, 400]
|
||||
plot_yz.color = 'mat'
|
||||
|
||||
# Instantiate a PlotsFile, add Plot, and export to XML
|
||||
plot_file = openmc.PlotsFile()
|
||||
plot_file.add_plot(plot_xy)
|
||||
plot_file.add_plot(plot_yz)
|
||||
# Instantiate a Plots collection, add plots, and export to XML
|
||||
plot_file = openmc.Plots((plot_xy, plot_yz))
|
||||
plot_file.export_to_xml()
|
||||
|
||||
|
||||
|
|
@ -169,7 +164,6 @@ tally = openmc.Tally(tally_id=1)
|
|||
tally.filters = [openmc.Filter(type='distribcell', bins=[cell2.id])]
|
||||
tally.scores = ['total']
|
||||
|
||||
# Instantiate a TalliesFile, register Tally/Mesh, and export to XML
|
||||
tallies_file = openmc.TalliesFile()
|
||||
tallies_file.add_tally(tally)
|
||||
# Instantiate a Tallies collection and export to XML
|
||||
tallies_file = openmc.Tallies([tally])
|
||||
tallies_file.export_to_xml()
|
||||
|
|
|
|||
|
|
@ -1,6 +1,4 @@
|
|||
import openmc
|
||||
from openmc.source import Source
|
||||
from openmc.stats import Box
|
||||
|
||||
###############################################################################
|
||||
# Simulation Input File Parameters
|
||||
|
|
@ -13,7 +11,7 @@ particles = 10000
|
|||
|
||||
|
||||
###############################################################################
|
||||
# Exporting to OpenMC materials.xml File
|
||||
# Exporting to OpenMC materials.xml file
|
||||
###############################################################################
|
||||
|
||||
# Instantiate some Nuclides
|
||||
|
|
@ -32,15 +30,14 @@ moderator.add_nuclide(h1, 2.)
|
|||
moderator.add_nuclide(o16, 1.)
|
||||
moderator.add_s_alpha_beta('HH2O', '71t')
|
||||
|
||||
# Instantiate a MaterialsFile, register all Materials, and export to XML
|
||||
materials_file = openmc.MaterialsFile()
|
||||
# Instantiate a Materials collection and export to XML
|
||||
materials_file = openmc.Materials((moderator, fuel))
|
||||
materials_file.default_xs = '71c'
|
||||
materials_file.add_materials([moderator, fuel])
|
||||
materials_file.export_to_xml()
|
||||
|
||||
|
||||
###############################################################################
|
||||
# Exporting to OpenMC geometry.xml File
|
||||
# Exporting to OpenMC geometry.xml file
|
||||
###############################################################################
|
||||
|
||||
# Instantiate Surfaces
|
||||
|
|
@ -118,32 +115,32 @@ lattice2.universes = [[univ4, univ4],
|
|||
cell1.fill = lattice2
|
||||
cell2.fill = lattice1
|
||||
|
||||
# Instantiate a Geometry and register the root Universe
|
||||
# Instantiate a Geometry, register the root Universe, and export to XML
|
||||
geometry = openmc.Geometry()
|
||||
geometry.root_universe = root
|
||||
|
||||
# Instantiate a GeometryFile, register Geometry, and export to XML
|
||||
geometry_file = openmc.GeometryFile()
|
||||
geometry_file.geometry = geometry
|
||||
geometry_file.export_to_xml()
|
||||
geometry.export_to_xml()
|
||||
|
||||
|
||||
###############################################################################
|
||||
# Exporting to OpenMC settings.xml File
|
||||
# Exporting to OpenMC settings.xml file
|
||||
###############################################################################
|
||||
|
||||
# Instantiate a SettingsFile, set all runtime parameters, and export to XML
|
||||
settings_file = openmc.SettingsFile()
|
||||
# Instantiate a Settings object, set all runtime parameters, and export to XML
|
||||
settings_file = openmc.Settings()
|
||||
settings_file.batches = batches
|
||||
settings_file.inactive = inactive
|
||||
settings_file.particles = particles
|
||||
settings_file.source = Source(space=Box(
|
||||
[-1, -1, -1], [1, 1, 1]))
|
||||
|
||||
# Create an initial uniform spatial source distribution over fissionable zones
|
||||
bounds = [-1, -1, -1, 1, 1, 1]
|
||||
uniform_dist = openmc.stats.Box(bounds[:3], bounds[3:], only_fissionable=True)
|
||||
settings_file.source = openmc.source.Source(space=uniform_dist)
|
||||
|
||||
settings_file.export_to_xml()
|
||||
|
||||
|
||||
###############################################################################
|
||||
# Exporting to OpenMC plots.xml File
|
||||
# Exporting to OpenMC plots.xml file
|
||||
###############################################################################
|
||||
|
||||
plot = openmc.Plot(plot_id=1)
|
||||
|
|
@ -152,14 +149,13 @@ plot.width = [4, 4]
|
|||
plot.pixels = [400, 400]
|
||||
plot.color = 'mat'
|
||||
|
||||
# Instantiate a PlotsFile, add Plot, and export to XML
|
||||
plot_file = openmc.PlotsFile()
|
||||
plot_file.add_plot(plot)
|
||||
# Instantiate a Plots object and export to XML
|
||||
plot_file = openmc.Plots([plot])
|
||||
plot_file.export_to_xml()
|
||||
|
||||
|
||||
###############################################################################
|
||||
# Exporting to OpenMC tallies.xml File
|
||||
# Exporting to OpenMC tallies.xml file
|
||||
###############################################################################
|
||||
|
||||
# Instantiate a tally mesh
|
||||
|
|
@ -178,8 +174,6 @@ tally = openmc.Tally(tally_id=1)
|
|||
tally.filters = [mesh_filter]
|
||||
tally.scores = ['total']
|
||||
|
||||
# Instantiate a TalliesFile, register Tally/Mesh, and export to XML
|
||||
tallies_file = openmc.TalliesFile()
|
||||
tallies_file.add_mesh(mesh)
|
||||
tallies_file.add_tally(tally)
|
||||
# Instantiate a Tallies collection, register Tally/Mesh, and export to XML
|
||||
tallies_file = openmc.Tallies([tally])
|
||||
tallies_file.export_to_xml()
|
||||
|
|
|
|||
|
|
@ -1,6 +1,4 @@
|
|||
import openmc
|
||||
from openmc.source import Source
|
||||
from openmc.stats import Box
|
||||
|
||||
###############################################################################
|
||||
# Simulation Input File Parameters
|
||||
|
|
@ -13,7 +11,7 @@ particles = 10000
|
|||
|
||||
|
||||
###############################################################################
|
||||
# Exporting to OpenMC materials.xml File
|
||||
# Exporting to OpenMC materials.xml file
|
||||
###############################################################################
|
||||
|
||||
# Instantiate some Nuclides
|
||||
|
|
@ -32,15 +30,14 @@ moderator.add_nuclide(h1, 2.)
|
|||
moderator.add_nuclide(o16, 1.)
|
||||
moderator.add_s_alpha_beta('HH2O', '71t')
|
||||
|
||||
# Instantiate a MaterialsFile, register all Materials, and export to XML
|
||||
materials_file = openmc.MaterialsFile()
|
||||
# Instantiate a Materials collection and export to XML
|
||||
materials_file = openmc.Materials([moderator, fuel])
|
||||
materials_file.default_xs = '71c'
|
||||
materials_file.add_materials([moderator, fuel])
|
||||
materials_file.export_to_xml()
|
||||
|
||||
|
||||
###############################################################################
|
||||
# Exporting to OpenMC geometry.xml File
|
||||
# Exporting to OpenMC geometry.xml file
|
||||
###############################################################################
|
||||
|
||||
# Instantiate Surfaces
|
||||
|
|
@ -108,34 +105,34 @@ lattice.universes = [[univ1, univ2, univ1, univ2],
|
|||
# Fill Cell with the Lattice
|
||||
cell1.fill = lattice
|
||||
|
||||
# Instantiate a Geometry and register the root Universe
|
||||
# Instantiate a Geometry, register the root Universe, and export to XML
|
||||
geometry = openmc.Geometry()
|
||||
geometry.root_universe = root
|
||||
|
||||
# Instantiate a GeometryFile, register Geometry, and export to XML
|
||||
geometry_file = openmc.GeometryFile()
|
||||
geometry_file.geometry = geometry
|
||||
geometry_file.export_to_xml()
|
||||
geometry.export_to_xml()
|
||||
|
||||
|
||||
###############################################################################
|
||||
# Exporting to OpenMC settings.xml File
|
||||
# Exporting to OpenMC settings.xml file
|
||||
###############################################################################
|
||||
|
||||
# Instantiate a SettingsFile, set all runtime parameters, and export to XML
|
||||
settings_file = openmc.SettingsFile()
|
||||
# Instantiate a Settings object, set all runtime parameters, and export to XML
|
||||
settings_file = openmc.Settings()
|
||||
settings_file.batches = batches
|
||||
settings_file.inactive = inactive
|
||||
settings_file.particles = particles
|
||||
settings_file.source = Source(space=Box(
|
||||
[-1, -1, -1], [1, 1, 1]))
|
||||
|
||||
# Create an initial uniform spatial source distribution over fissionable zones
|
||||
bounds = [-1, -1, -1, 1, 1, 1]
|
||||
uniform_dist = openmc.stats.Box(bounds[:3], bounds[3:], only_fissionable=True)
|
||||
settings_file.source = openmc.source.Source(space=uniform_dist)
|
||||
|
||||
settings_file.trigger_active = True
|
||||
settings_file.trigger_max_batches = 100
|
||||
settings_file.export_to_xml()
|
||||
|
||||
|
||||
###############################################################################
|
||||
# Exporting to OpenMC plots.xml File
|
||||
# Exporting to OpenMC plots.xml file
|
||||
###############################################################################
|
||||
|
||||
plot = openmc.Plot(plot_id=1)
|
||||
|
|
@ -144,14 +141,13 @@ plot.width = [4, 4]
|
|||
plot.pixels = [400, 400]
|
||||
plot.color = 'mat'
|
||||
|
||||
# Instantiate a PlotsFile, add Plot, and export to XML
|
||||
plot_file = openmc.PlotsFile()
|
||||
plot_file.add_plot(plot)
|
||||
# Instantiate a Plots collection and export to XML
|
||||
plot_file = openmc.Plots([plot])
|
||||
plot_file.export_to_xml()
|
||||
|
||||
|
||||
###############################################################################
|
||||
# Exporting to OpenMC tallies.xml File
|
||||
# Exporting to OpenMC tallies.xml file
|
||||
###############################################################################
|
||||
|
||||
# Instantiate a tally mesh
|
||||
|
|
@ -175,8 +171,6 @@ tally.filters = [mesh_filter]
|
|||
tally.scores = ['total']
|
||||
tally.triggers = [trigger]
|
||||
|
||||
# Instantiate a TalliesFile, register Tally/Mesh, and export to XML
|
||||
tallies_file = openmc.TalliesFile()
|
||||
tallies_file.add_mesh(mesh)
|
||||
tallies_file.add_tally(tally)
|
||||
# Instantiate a Tallies collection and export to XML
|
||||
tallies_file = openmc.Tallies([tally])
|
||||
tallies_file.export_to_xml()
|
||||
|
|
|
|||
|
|
@ -1,6 +1,4 @@
|
|||
import openmc
|
||||
from openmc.source import Source
|
||||
from openmc.stats import Box
|
||||
|
||||
###############################################################################
|
||||
# Simulation Input File Parameters
|
||||
|
|
@ -13,7 +11,7 @@ particles = 1000
|
|||
|
||||
|
||||
###############################################################################
|
||||
# Exporting to OpenMC materials.xml File
|
||||
# Exporting to OpenMC materials.xml file
|
||||
###############################################################################
|
||||
|
||||
# Instantiate some Nuclides
|
||||
|
|
@ -102,15 +100,14 @@ borated_water.add_nuclide(o16, 2.4672e-2)
|
|||
borated_water.add_nuclide(o17, 6.0099e-5)
|
||||
borated_water.add_s_alpha_beta('HH2O', '71t')
|
||||
|
||||
# Instantiate a MaterialsFile, register all Materials, and export to XML
|
||||
materials_file = openmc.MaterialsFile()
|
||||
# Instantiate a Materials collection and export to XML
|
||||
materials_file = openmc.Materials([uo2, helium, zircaloy, borated_water])
|
||||
materials_file.default_xs = '71c'
|
||||
materials_file.add_materials([uo2, helium, zircaloy, borated_water])
|
||||
materials_file.export_to_xml()
|
||||
|
||||
|
||||
###############################################################################
|
||||
# Exporting to OpenMC geometry.xml File
|
||||
# Exporting to OpenMC geometry.xml file
|
||||
###############################################################################
|
||||
|
||||
# Instantiate ZCylinder surfaces
|
||||
|
|
@ -151,27 +148,27 @@ root = openmc.Universe(universe_id=0, name='root universe')
|
|||
# Register Cells with Universe
|
||||
root.add_cells([fuel, gap, clad, water])
|
||||
|
||||
# Instantiate a Geometry and register the root Universe
|
||||
# Instantiate a Geometry, register the root Universe, and export to XML
|
||||
geometry = openmc.Geometry()
|
||||
geometry.root_universe = root
|
||||
|
||||
# Instantiate a GeometryFile, register Geometry, and export to XML
|
||||
geometry_file = openmc.GeometryFile()
|
||||
geometry_file.geometry = geometry
|
||||
geometry_file.export_to_xml()
|
||||
geometry.export_to_xml()
|
||||
|
||||
|
||||
###############################################################################
|
||||
# Exporting to OpenMC settings.xml File
|
||||
# Exporting to OpenMC settings.xml file
|
||||
###############################################################################
|
||||
|
||||
# Instantiate a SettingsFile, set all runtime parameters, and export to XML
|
||||
settings_file = openmc.SettingsFile()
|
||||
# Instantiate a Settings object, set all runtime parameters, and export to XML
|
||||
settings_file = openmc.Settings()
|
||||
settings_file.batches = batches
|
||||
settings_file.inactive = inactive
|
||||
settings_file.particles = particles
|
||||
settings_file.source = Source(space=Box(
|
||||
[-0.62992, -0.62992, -1], [0.62992, 0.62992, 1]))
|
||||
|
||||
# Create an initial uniform spatial source distribution over fissionable zones
|
||||
bounds = [-0.62992, -0.62992, -1, 0.62992, 0.62992, 1]
|
||||
uniform_dist = openmc.stats.Box(bounds[:3], bounds[3:], only_fissionable=True)
|
||||
settings_file.source = openmc.source.Source(space=uniform_dist)
|
||||
|
||||
settings_file.entropy_lower_left = [-0.39218, -0.39218, -1.e50]
|
||||
settings_file.entropy_upper_right = [0.39218, 0.39218, 1.e50]
|
||||
settings_file.entropy_dimension = [10, 10, 1]
|
||||
|
|
@ -179,7 +176,7 @@ settings_file.export_to_xml()
|
|||
|
||||
|
||||
###############################################################################
|
||||
# Exporting to OpenMC tallies.xml File
|
||||
# Exporting to OpenMC tallies.xml file
|
||||
###############################################################################
|
||||
|
||||
# Instantiate a tally mesh
|
||||
|
|
@ -199,8 +196,6 @@ tally = openmc.Tally(tally_id=1, name='tally 1')
|
|||
tally.filters = [energy_filter, mesh_filter]
|
||||
tally.scores = ['flux', 'fission', 'nu-fission']
|
||||
|
||||
# Instantiate a TalliesFile, register all Tallies, and export to XML
|
||||
tallies_file = openmc.TalliesFile()
|
||||
tallies_file.add_mesh(mesh)
|
||||
tallies_file.add_tally(tally)
|
||||
# Instantiate a Tallies collection and export to XML
|
||||
tallies_file = openmc.Tallies([tally])
|
||||
tallies_file.export_to_xml()
|
||||
|
|
|
|||
|
|
@ -1,8 +1,6 @@
|
|||
import numpy as np
|
||||
import openmc
|
||||
import openmc.mgxs
|
||||
from openmc.source import Source
|
||||
from openmc.stats import Box
|
||||
import numpy as np
|
||||
|
||||
###############################################################################
|
||||
# Simulation Input File Parameters
|
||||
|
|
@ -14,7 +12,7 @@ inactive = 10
|
|||
particles = 1000
|
||||
|
||||
###############################################################################
|
||||
# Exporting to OpenMC mg_cross_sections.xml File
|
||||
# Exporting to OpenMC mg_cross_sections.xml file
|
||||
###############################################################################
|
||||
|
||||
# Instantiate the energy group data
|
||||
|
|
@ -61,13 +59,13 @@ scatter = [[[0.0444777, 0.1134000, 0.0007235, 0.0000037, 0.0000001, 0.0000000, 0
|
|||
[0.0000000, 0.0000000, 0.0000000, 0.0000000, 0.0000000, 0.1324400, 2.4807000]]]
|
||||
h2o_xsdata.scatter = np.array(scatter)
|
||||
|
||||
mg_cross_sections_file = openmc.MGXSLibraryFile(groups)
|
||||
mg_cross_sections_file = openmc.MGXSLibrary(groups)
|
||||
mg_cross_sections_file.add_xsdatas([uo2_xsdata,h2o_xsdata])
|
||||
mg_cross_sections_file.export_to_xml()
|
||||
|
||||
|
||||
###############################################################################
|
||||
# Exporting to OpenMC materials.xml File
|
||||
# Exporting to OpenMC materials.xml file
|
||||
###############################################################################
|
||||
|
||||
# Instantiate some Macroscopic Data
|
||||
|
|
@ -83,15 +81,14 @@ water = openmc.Material(material_id=2, name='Water')
|
|||
water.set_density('macro', 1.0)
|
||||
water.add_macroscopic(h2o_data)
|
||||
|
||||
# Instantiate a MaterialsFile, register all Materials, and export to XML
|
||||
materials_file = openmc.MaterialsFile()
|
||||
# Instantiate a Materials collection and export to XML
|
||||
materials_file = openmc.Materials([uo2, water])
|
||||
materials_file.default_xs = '300K'
|
||||
materials_file.add_materials([uo2, water])
|
||||
materials_file.export_to_xml()
|
||||
|
||||
|
||||
###############################################################################
|
||||
# Exporting to OpenMC geometry.xml File
|
||||
# Exporting to OpenMC geometry.xml file
|
||||
###############################################################################
|
||||
|
||||
# Instantiate ZCylinder surfaces
|
||||
|
|
@ -124,31 +121,33 @@ root = openmc.Universe(universe_id=0, name='root universe')
|
|||
# Register Cells with Universe
|
||||
root.add_cells([fuel, moderator])
|
||||
|
||||
# Instantiate a Geometry and register the root Universe
|
||||
# Instantiate a Geometry, register the root Universe, and export to XML
|
||||
geometry = openmc.Geometry()
|
||||
geometry.root_universe = root
|
||||
|
||||
# Instantiate a GeometryFile, register Geometry, and export to XML
|
||||
geometry_file = openmc.GeometryFile()
|
||||
geometry_file.geometry = geometry
|
||||
geometry_file.export_to_xml()
|
||||
geometry.export_to_xml()
|
||||
|
||||
|
||||
###############################################################################
|
||||
# Exporting to OpenMC settings.xml File
|
||||
# Exporting to OpenMC settings.xml file
|
||||
###############################################################################
|
||||
|
||||
# Instantiate a SettingsFile, set all runtime parameters, and export to XML
|
||||
settings_file = openmc.SettingsFile()
|
||||
# Instantiate a Settings object, set all runtime parameters, and export to XML
|
||||
settings_file = openmc.Settings()
|
||||
settings_file.energy_mode = "multi-group"
|
||||
settings_file.cross_sections = "./mg_cross_sections.xml"
|
||||
settings_file.batches = batches
|
||||
settings_file.inactive = inactive
|
||||
settings_file.particles = particles
|
||||
settings_file.source = Source(space=Box([-0.63, -0.63, -1.], [0.63, 0.63, 1.]))
|
||||
|
||||
# Create an initial uniform spatial source distribution over fissionable zones
|
||||
bounds = [-0.63, -0.63, -1, 0.63, 0.63, 1]
|
||||
uniform_dist = openmc.stats.Box(bounds[:3], bounds[3:])
|
||||
settings_file.source = openmc.source.Source(space=uniform_dist)
|
||||
|
||||
settings_file.export_to_xml()
|
||||
|
||||
###############################################################################
|
||||
# Exporting to OpenMC tallies.xml File
|
||||
# Exporting to OpenMC tallies.xml file
|
||||
###############################################################################
|
||||
|
||||
# Instantiate a tally mesh
|
||||
|
|
@ -167,14 +166,9 @@ mesh_filter.mesh = mesh
|
|||
|
||||
# Instantiate the Tally
|
||||
tally = openmc.Tally(tally_id=1, name='tally 1')
|
||||
tally.add_filter(energy_filter)
|
||||
tally.add_filter(mesh_filter)
|
||||
tally.add_score('flux')
|
||||
tally.add_score('fission')
|
||||
tally.add_score('nu-fission')
|
||||
tally.filters = [energy_filter, mesh_filter]
|
||||
tally.scores = ['flux', 'fission', 'nu-fission']
|
||||
|
||||
# Instantiate a TalliesFile, register all Tallies, and export to XML
|
||||
tallies_file = openmc.TalliesFile()
|
||||
tallies_file.add_mesh(mesh)
|
||||
tallies_file.add_tally(tally)
|
||||
# Instantiate a Tallies collection, register all Tallies, and export to XML
|
||||
tallies_file = openmc.Tallies([tally])
|
||||
tallies_file.export_to_xml()
|
||||
|
|
|
|||
|
|
@ -1,8 +1,5 @@
|
|||
import numpy as np
|
||||
|
||||
import openmc
|
||||
from openmc.stats import Box
|
||||
from openmc.source import Source
|
||||
|
||||
###############################################################################
|
||||
# Simulation Input File Parameters
|
||||
|
|
@ -15,7 +12,7 @@ particles = 10000
|
|||
|
||||
|
||||
###############################################################################
|
||||
# Exporting to OpenMC materials.xml File
|
||||
# Exporting to OpenMC materials.xml file
|
||||
###############################################################################
|
||||
|
||||
# Instantiate a Nuclides
|
||||
|
|
@ -26,15 +23,14 @@ fuel = openmc.Material(material_id=1, name='fuel')
|
|||
fuel.set_density('g/cc', 4.5)
|
||||
fuel.add_nuclide(u235, 1.)
|
||||
|
||||
# Instantiate a MaterialsFile, register Material, and export to XML
|
||||
materials_file = openmc.MaterialsFile()
|
||||
# Instantiate a Materials collection and export to XML
|
||||
materials_file = openmc.Materials([fuel])
|
||||
materials_file.default_xs = '71c'
|
||||
materials_file.add_material(fuel)
|
||||
materials_file.export_to_xml()
|
||||
|
||||
|
||||
###############################################################################
|
||||
# Exporting to OpenMC geometry.xml File
|
||||
# Exporting to OpenMC geometry.xml file
|
||||
###############################################################################
|
||||
|
||||
# Instantiate Surfaces
|
||||
|
|
@ -67,24 +63,25 @@ root = openmc.Universe(universe_id=0, name='root universe')
|
|||
# Register Cell with Universe
|
||||
root.add_cell(cell)
|
||||
|
||||
# Instantiate a Geometry and register the root Universe
|
||||
# Instantiate a Geometry, register the root Universe, and export to XML
|
||||
geometry = openmc.Geometry()
|
||||
geometry.root_universe = root
|
||||
|
||||
# Instantiate a GeometryFile, register Geometry, and export to XML
|
||||
geometry_file = openmc.GeometryFile()
|
||||
geometry_file.geometry = geometry
|
||||
geometry_file.export_to_xml()
|
||||
geometry.export_to_xml()
|
||||
|
||||
|
||||
###############################################################################
|
||||
# Exporting to OpenMC settings.xml File
|
||||
# Exporting to OpenMC settings.xml file
|
||||
###############################################################################
|
||||
|
||||
# Instantiate a SettingsFile, set all runtime parameters, and export to XML
|
||||
settings_file = openmc.SettingsFile()
|
||||
# Instantiate a Settings object, set all runtime parameters, and export to XML
|
||||
settings_file = openmc.Settings()
|
||||
settings_file.batches = batches
|
||||
settings_file.inactive = inactive
|
||||
settings_file.particles = particles
|
||||
settings_file.source = Source(space=Box(*cell.region.bounding_box))
|
||||
|
||||
# Create an initial uniform spatial source distribution over fissionable zones
|
||||
uniform_dist = openmc.stats.Box(*cell.region.bounding_box,
|
||||
only_fissionable=True)
|
||||
settings_file.source = openmc.source.Source(space=uniform_dist)
|
||||
|
||||
settings_file.export_to_xml()
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
from openmc.cell import *
|
||||
from openmc.lattice import *
|
||||
from openmc.element import *
|
||||
from openmc.geometry import *
|
||||
from openmc.nuclide import *
|
||||
|
|
@ -16,6 +18,9 @@ from openmc.cmfd import *
|
|||
from openmc.executor import *
|
||||
from openmc.statepoint import *
|
||||
from openmc.summary import *
|
||||
from openmc.region import *
|
||||
from openmc.source import *
|
||||
from openmc.particle_restart import *
|
||||
|
||||
try:
|
||||
from openmc.opencg_compatible import *
|
||||
|
|
|
|||
447
openmc/cell.py
Normal file
447
openmc/cell.py
Normal file
|
|
@ -0,0 +1,447 @@
|
|||
from collections import OrderedDict, Iterable
|
||||
from numbers import Real, Integral
|
||||
from xml.etree import ElementTree as ET
|
||||
import sys
|
||||
import warnings
|
||||
|
||||
import openmc
|
||||
import openmc.checkvalue as cv
|
||||
from openmc.surface import Halfspace
|
||||
from openmc.region import Region, Intersection, Complement
|
||||
|
||||
if sys.version_info[0] >= 3:
|
||||
basestring = str
|
||||
|
||||
|
||||
# A static variable for auto-generated Cell IDs
|
||||
AUTO_CELL_ID = 10000
|
||||
|
||||
|
||||
def reset_auto_cell_id():
|
||||
global AUTO_CELL_ID
|
||||
AUTO_CELL_ID = 10000
|
||||
|
||||
|
||||
class Cell(object):
|
||||
"""A region of space defined as the intersection of half-space created by
|
||||
quadric surfaces.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
cell_id : int, optional
|
||||
Unique identifier for the cell. If not specified, an identifier will
|
||||
automatically be assigned.
|
||||
name : str, optional
|
||||
Name of the cell. If not specified, the name is the empty string.
|
||||
|
||||
Attributes
|
||||
----------
|
||||
id : int
|
||||
Unique identifier for the cell
|
||||
name : str
|
||||
Name of the cell
|
||||
fill : openmc.Material or openmc.Universe or openmc.Lattice or 'void' or iterable of openmc.Material
|
||||
Indicates what the region of space is filled with
|
||||
region : openmc.Region
|
||||
Region of space that is assigned to the cell.
|
||||
rotation : numpy.ndarray
|
||||
If the cell is filled with a universe, this array specifies the angles
|
||||
in degrees about the x, y, and z axes that the filled universe should be
|
||||
rotated.
|
||||
translation : numpy.ndarray
|
||||
If the cell is filled with a universe, this array specifies a vector
|
||||
that is used to translate (shift) the universe.
|
||||
offsets : ndarray
|
||||
Array of offsets used for distributed cell searches
|
||||
distribcell_index : int
|
||||
Index of this cell in distribcell arrays
|
||||
|
||||
"""
|
||||
|
||||
def __init__(self, cell_id=None, name=''):
|
||||
# Initialize Cell class attributes
|
||||
self.id = cell_id
|
||||
self.name = name
|
||||
self._fill = None
|
||||
self._type = None
|
||||
self._region = None
|
||||
self._rotation = None
|
||||
self._translation = None
|
||||
self._offsets = None
|
||||
self._distribcell_index = None
|
||||
|
||||
def __eq__(self, other):
|
||||
if not isinstance(other, Cell):
|
||||
return False
|
||||
elif self.id != other.id:
|
||||
return False
|
||||
elif self.name != other.name:
|
||||
return False
|
||||
elif self.fill != other.fill:
|
||||
return False
|
||||
elif self.region != other.region:
|
||||
return False
|
||||
elif self.rotation != other.rotation:
|
||||
return False
|
||||
elif self.translation != other.translation:
|
||||
return False
|
||||
else:
|
||||
return True
|
||||
|
||||
def __ne__(self, other):
|
||||
return not self == other
|
||||
|
||||
def __hash__(self):
|
||||
return hash(repr(self))
|
||||
|
||||
def __repr__(self):
|
||||
string = 'Cell\n'
|
||||
string += '{0: <16}{1}{2}\n'.format('\tID', '=\t', self._id)
|
||||
string += '{0: <16}{1}{2}\n'.format('\tName', '=\t', self._name)
|
||||
|
||||
if isinstance(self._fill, openmc.Material):
|
||||
string += '{0: <16}{1}{2}\n'.format('\tMaterial', '=\t',
|
||||
self._fill._id)
|
||||
elif isinstance(self._fill, Iterable):
|
||||
string += '{0: <16}{1}'.format('\tMaterial', '=\t')
|
||||
string += '['
|
||||
string += ', '.join(['void' if m == 'void' else str(m.id)
|
||||
for m in self.fill])
|
||||
string += ']\n'
|
||||
elif isinstance(self._fill, (openmc.Universe, openmc.Lattice)):
|
||||
string += '{0: <16}{1}{2}\n'.format('\tFill', '=\t',
|
||||
self._fill._id)
|
||||
else:
|
||||
string += '{0: <16}{1}{2}\n'.format('\tFill', '=\t', self._fill)
|
||||
|
||||
string += '{0: <16}{1}{2}\n'.format('\tRegion', '=\t', self._region)
|
||||
|
||||
string += '{0: <16}{1}{2}\n'.format('\tRotation', '=\t',
|
||||
self._rotation)
|
||||
string += '{0: <16}{1}{2}\n'.format('\tTranslation', '=\t',
|
||||
self._translation)
|
||||
string += '{0: <16}{1}{2}\n'.format('\tOffset', '=\t', self._offsets)
|
||||
string += '{0: <16}{1}{2}\n'.format('\tDistribcell index', '=\t',
|
||||
self._distribcell_index)
|
||||
|
||||
return string
|
||||
|
||||
@property
|
||||
def id(self):
|
||||
return self._id
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
return self._name
|
||||
|
||||
@property
|
||||
def fill(self):
|
||||
return self._fill
|
||||
|
||||
@property
|
||||
def fill_type(self):
|
||||
if isinstance(self.fill, openmc.Material):
|
||||
return 'material'
|
||||
elif isinstance(self.fill, openmc.Universe):
|
||||
return 'universe'
|
||||
elif isinstance(self.fill, openmc.Lattice):
|
||||
return 'lattice'
|
||||
else:
|
||||
return None
|
||||
|
||||
@property
|
||||
def region(self):
|
||||
return self._region
|
||||
|
||||
@property
|
||||
def rotation(self):
|
||||
return self._rotation
|
||||
|
||||
@property
|
||||
def translation(self):
|
||||
return self._translation
|
||||
|
||||
@property
|
||||
def offsets(self):
|
||||
return self._offsets
|
||||
|
||||
@property
|
||||
def distribcell_index(self):
|
||||
return self._distribcell_index
|
||||
|
||||
@id.setter
|
||||
def id(self, cell_id):
|
||||
if cell_id is None:
|
||||
global AUTO_CELL_ID
|
||||
self._id = AUTO_CELL_ID
|
||||
AUTO_CELL_ID += 1
|
||||
else:
|
||||
cv.check_type('cell ID', cell_id, Integral)
|
||||
cv.check_greater_than('cell ID', cell_id, 0, equality=True)
|
||||
self._id = cell_id
|
||||
|
||||
@name.setter
|
||||
def name(self, name):
|
||||
if name is not None:
|
||||
cv.check_type('cell name', name, basestring)
|
||||
self._name = name
|
||||
else:
|
||||
self._name = ''
|
||||
|
||||
@fill.setter
|
||||
def fill(self, fill):
|
||||
if isinstance(fill, basestring):
|
||||
if fill.strip().lower() == 'void':
|
||||
self._type = 'void'
|
||||
else:
|
||||
msg = 'Unable to set Cell ID="{0}" to use a non-Material or ' \
|
||||
'Universe fill "{1}"'.format(self._id, fill)
|
||||
raise ValueError(msg)
|
||||
|
||||
elif isinstance(fill, openmc.Material):
|
||||
self._type = 'normal'
|
||||
|
||||
elif isinstance(fill, Iterable):
|
||||
cv.check_type('cell.fill', fill, Iterable,
|
||||
(openmc.Material, basestring))
|
||||
self._type = 'normal'
|
||||
|
||||
elif isinstance(fill, openmc.Universe):
|
||||
self._type = 'fill'
|
||||
|
||||
elif isinstance(fill, openmc.Lattice):
|
||||
self._type = 'lattice'
|
||||
|
||||
else:
|
||||
msg = 'Unable to set Cell ID="{0}" to use a non-Material or ' \
|
||||
'Universe fill "{1}"'.format(self._id, fill)
|
||||
raise ValueError(msg)
|
||||
|
||||
self._fill = fill
|
||||
|
||||
@rotation.setter
|
||||
def rotation(self, rotation):
|
||||
cv.check_type('cell rotation', rotation, Iterable, Real)
|
||||
cv.check_length('cell rotation', rotation, 3)
|
||||
self._rotation = rotation
|
||||
|
||||
@translation.setter
|
||||
def translation(self, translation):
|
||||
cv.check_type('cell translation', translation, Iterable, Real)
|
||||
cv.check_length('cell translation', translation, 3)
|
||||
self._translation = translation
|
||||
|
||||
@offsets.setter
|
||||
def offsets(self, offsets):
|
||||
cv.check_type('cell offsets', offsets, Iterable)
|
||||
self._offsets = offsets
|
||||
|
||||
@region.setter
|
||||
def region(self, region):
|
||||
cv.check_type('cell region', region, Region)
|
||||
self._region = region
|
||||
|
||||
@distribcell_index.setter
|
||||
def distribcell_index(self, ind):
|
||||
cv.check_type('distribcell index', ind, Integral)
|
||||
self._distribcell_index = ind
|
||||
|
||||
def add_surface(self, surface, halfspace):
|
||||
"""Add a half-space to the list of half-spaces whose intersection defines the
|
||||
cell.
|
||||
|
||||
.. deprecated:: 0.7.1
|
||||
Use the :attr:`Cell.region` property to directly specify a Region
|
||||
expression.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
surface : openmc.Surface
|
||||
Quadric surface dividing space
|
||||
halfspace : {-1, 1}
|
||||
Indicate whether the negative or positive half-space is to be used
|
||||
|
||||
"""
|
||||
|
||||
warnings.warn("Cell.add_surface(...) has been deprecated and may be "
|
||||
"removed in a future version. The region for a Cell "
|
||||
"should be defined using the region property directly.",
|
||||
DeprecationWarning)
|
||||
|
||||
if not isinstance(surface, openmc.Surface):
|
||||
msg = 'Unable to add Surface "{0}" to Cell ID="{1}" since it is ' \
|
||||
'not a Surface object'.format(surface, self._id)
|
||||
raise ValueError(msg)
|
||||
|
||||
if halfspace not in [-1, +1]:
|
||||
msg = 'Unable to add Surface "{0}" to Cell ID="{1}" with halfspace ' \
|
||||
'"{2}" since it is not +/-1'.format(surface, self._id, halfspace)
|
||||
raise ValueError(msg)
|
||||
|
||||
# If no region has been assigned, simply use the half-space. Otherwise,
|
||||
# take the intersection of the current region and the half-space
|
||||
# specified
|
||||
region = +surface if halfspace == 1 else -surface
|
||||
if self.region is None:
|
||||
self.region = region
|
||||
else:
|
||||
if isinstance(self.region, Intersection):
|
||||
self.region.nodes.append(region)
|
||||
else:
|
||||
self.region = Intersection(self.region, region)
|
||||
|
||||
def get_cell_instance(self, path, distribcell_index):
|
||||
|
||||
# If the Cell is filled by a Material
|
||||
if self._type == 'normal' or self._type == 'void':
|
||||
offset = 0
|
||||
|
||||
# If the Cell is filled by a Universe
|
||||
elif self._type == 'fill':
|
||||
offset = self.offsets[distribcell_index-1]
|
||||
offset += self.fill.get_cell_instance(path, distribcell_index)
|
||||
|
||||
# If the Cell is filled by a Lattice
|
||||
else:
|
||||
offset = self.fill.get_cell_instance(path, distribcell_index)
|
||||
|
||||
return offset
|
||||
|
||||
def get_all_nuclides(self):
|
||||
"""Return all nuclides contained in the cell
|
||||
|
||||
Returns
|
||||
-------
|
||||
nuclides : dict
|
||||
Dictionary whose keys are nuclide names and values are 2-tuples of
|
||||
(nuclide, density)
|
||||
|
||||
"""
|
||||
|
||||
nuclides = OrderedDict()
|
||||
|
||||
if self._type != 'void':
|
||||
nuclides.update(self._fill.get_all_nuclides())
|
||||
|
||||
return nuclides
|
||||
|
||||
def get_all_cells(self):
|
||||
"""Return all cells that are contained within this one if it is filled with a
|
||||
universe or lattice
|
||||
|
||||
Returns
|
||||
-------
|
||||
cells : dict
|
||||
Dictionary whose keys are cell IDs and values are :class:`Cell`
|
||||
instances
|
||||
|
||||
"""
|
||||
|
||||
cells = OrderedDict()
|
||||
|
||||
if self._type == 'fill' or self._type == 'lattice':
|
||||
cells.update(self._fill.get_all_cells())
|
||||
|
||||
return cells
|
||||
|
||||
def get_all_materials(self):
|
||||
"""Return all materials that are contained within the cell
|
||||
|
||||
Returns
|
||||
-------
|
||||
materials : dict
|
||||
Dictionary whose keys are material IDs and values are
|
||||
:class:`Material` instances
|
||||
|
||||
"""
|
||||
|
||||
materials = OrderedDict()
|
||||
if self.fill_type == 'material':
|
||||
materials[self.fill.id] = self.fill
|
||||
|
||||
# Append all Cells in each Cell in the Universe to the dictionary
|
||||
cells = self.get_all_cells()
|
||||
for cell_id, cell in cells.items():
|
||||
materials.update(cell.get_all_materials())
|
||||
|
||||
return materials
|
||||
|
||||
def get_all_universes(self):
|
||||
"""Return all universes that are contained within this one if any of
|
||||
its cells are filled with a universe or lattice.
|
||||
|
||||
Returns
|
||||
-------
|
||||
universes : dict
|
||||
Dictionary whose keys are universe IDs and values are
|
||||
:class:`Universe` instances
|
||||
|
||||
"""
|
||||
|
||||
universes = OrderedDict()
|
||||
|
||||
if self._type == 'fill':
|
||||
universes[self._fill._id] = self._fill
|
||||
universes.update(self._fill.get_all_universes())
|
||||
elif self._type == 'lattice':
|
||||
universes.update(self._fill.get_all_universes())
|
||||
|
||||
return universes
|
||||
|
||||
def create_xml_subelement(self, xml_element):
|
||||
element = ET.Element("cell")
|
||||
element.set("id", str(self.id))
|
||||
|
||||
if len(self._name) > 0:
|
||||
element.set("name", str(self.name))
|
||||
|
||||
if isinstance(self.fill, basestring):
|
||||
element.set("material", "void")
|
||||
|
||||
elif isinstance(self.fill, openmc.Material):
|
||||
element.set("material", str(self.fill.id))
|
||||
|
||||
elif isinstance(self.fill, Iterable):
|
||||
element.set("material", ' '.join([m if m == 'void' else str(m.id)
|
||||
for m in self.fill]))
|
||||
|
||||
elif isinstance(self.fill, (openmc.Universe, openmc.Lattice)):
|
||||
element.set("fill", str(self.fill.id))
|
||||
self.fill.create_xml_subelement(xml_element)
|
||||
|
||||
else:
|
||||
element.set("fill", str(self.fill))
|
||||
self.fill.create_xml_subelement(xml_element)
|
||||
|
||||
if self.region is not None:
|
||||
# Set the region attribute with the region specification
|
||||
element.set("region", str(self.region))
|
||||
|
||||
# Only surfaces that appear in a region are added to the geometry
|
||||
# file, so the appropriate check is performed here. First we create
|
||||
# a function which is called recursively to navigate through the CSG
|
||||
# tree. When it reaches a leaf (a Halfspace), it creates a <surface>
|
||||
# element for the corresponding surface if none has been created
|
||||
# thus far.
|
||||
def create_surface_elements(node, element):
|
||||
if isinstance(node, Halfspace):
|
||||
path = './surface[@id=\'{0}\']'.format(node.surface.id)
|
||||
if xml_element.find(path) is None:
|
||||
surface_subelement = node.surface.create_xml_subelement()
|
||||
xml_element.append(surface_subelement)
|
||||
elif isinstance(node, Complement):
|
||||
create_surface_elements(node.node, element)
|
||||
else:
|
||||
for subnode in node.nodes:
|
||||
create_surface_elements(subnode, element)
|
||||
|
||||
# Call the recursive function from the top node
|
||||
create_surface_elements(self.region, xml_element)
|
||||
|
||||
if self.translation is not None:
|
||||
element.set("translation", ' '.join(map(str, self.translation)))
|
||||
|
||||
if self.rotation is not None:
|
||||
element.set("rotation", ' '.join(map(str, self.rotation)))
|
||||
|
||||
return element
|
||||
|
|
@ -1,3 +1,4 @@
|
|||
import copy
|
||||
from collections import Iterable
|
||||
from numbers import Integral, Real
|
||||
|
||||
|
|
@ -57,7 +58,7 @@ def check_type(name, value, expected_type, expected_iter_type=None):
|
|||
else:
|
||||
msg = 'Unable to set "{0}" to "{1}" which is not of type "{2}"'.format(
|
||||
name, value, expected_type.__name__)
|
||||
raise ValueError(msg)
|
||||
raise TypeError(msg)
|
||||
|
||||
if expected_iter_type:
|
||||
for item in value:
|
||||
|
|
@ -71,7 +72,7 @@ def check_type(name, value, expected_type, expected_iter_type=None):
|
|||
msg = 'Unable to set "{0}" to "{1}" since each item must be ' \
|
||||
'of type "{2}"'.format(name, value,
|
||||
expected_iter_type.__name__)
|
||||
raise ValueError(msg)
|
||||
raise TypeError(msg)
|
||||
|
||||
|
||||
def check_iterable_type(name, value, expected_type, min_depth=1, max_depth=1):
|
||||
|
|
@ -122,7 +123,7 @@ def check_iterable_type(name, value, expected_type, min_depth=1, max_depth=1):
|
|||
if len(tree) < min_depth:
|
||||
msg = 'Error setting "{0}": The item at {1} does not meet the '\
|
||||
'minimum depth of {2}'.format(name, ind_str, min_depth)
|
||||
raise ValueError(msg)
|
||||
raise TypeError(msg)
|
||||
|
||||
# This item is okay. Move on to the next item.
|
||||
index[-1] += 1
|
||||
|
|
@ -140,7 +141,7 @@ def check_iterable_type(name, value, expected_type, min_depth=1, max_depth=1):
|
|||
msg = 'Error setting {0}: Found an iterable at {1}, items '\
|
||||
'in that iterable exceed the maximum depth of {2}' \
|
||||
.format(name, ind_str, max_depth)
|
||||
raise ValueError(msg)
|
||||
raise TypeError(msg)
|
||||
|
||||
else:
|
||||
# This item is completely unexpected.
|
||||
|
|
@ -148,7 +149,7 @@ def check_iterable_type(name, value, expected_type, min_depth=1, max_depth=1):
|
|||
"item at {2} is of type '{3}'"\
|
||||
.format(name, expected_type.__name__, ind_str,
|
||||
type(current_item).__name__)
|
||||
raise ValueError(msg)
|
||||
raise TypeError(msg)
|
||||
|
||||
|
||||
def check_length(name, value, length_min, length_max=None):
|
||||
|
|
@ -278,6 +279,21 @@ class CheckedList(list):
|
|||
for item in items:
|
||||
self.append(item)
|
||||
|
||||
def __add__(self, other):
|
||||
new_instance = copy.copy(self)
|
||||
new_instance += other
|
||||
return new_instance
|
||||
|
||||
def __radd__(self, other):
|
||||
return self + other
|
||||
|
||||
def __iadd__(self, other):
|
||||
check_type('CheckedList add operand', other, Iterable,
|
||||
self.expected_type)
|
||||
for item in other:
|
||||
self.append(item)
|
||||
return self
|
||||
|
||||
def append(self, item):
|
||||
"""Append item to list
|
||||
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ class CMFDMesh(object):
|
|||
to any tallies far away from fission source neutron regions. A ``2``
|
||||
must be used to identify any fission source region.
|
||||
|
||||
"""
|
||||
"""
|
||||
|
||||
def __init__(self):
|
||||
self._lower_left = None
|
||||
|
|
@ -187,7 +187,7 @@ class CMFDMesh(object):
|
|||
return element
|
||||
|
||||
|
||||
class CMFDFile(object):
|
||||
class CMFD(object):
|
||||
"""Parameters that control the use of coarse-mesh finite difference acceleration
|
||||
in OpenMC. This corresponds directly to the cmfd.xml input file.
|
||||
|
||||
|
|
@ -219,7 +219,7 @@ class CMFDFile(object):
|
|||
inner tolerance for Gauss-Seidel iterations when performing CMFD.
|
||||
ktol : float
|
||||
Tolerance on the eigenvalue when performing CMFD power iteration
|
||||
cmfd_mesh : CMFDMesh
|
||||
cmfd_mesh : openmc.CMFDMesh
|
||||
Structured mesh to be used for acceleration
|
||||
norm : float
|
||||
Normalization factor applied to the CMFD fission source distribution
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ class Element(object):
|
|||
Chemical symbol of the element, e.g. Pu
|
||||
xs : str
|
||||
Cross section identifier, e.g. 71c
|
||||
scattering : 'data' or 'iso-in-lab' or None
|
||||
scattering : {'data', 'iso-in-lab', None}
|
||||
The type of angular scattering distribution to use
|
||||
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -1,131 +1,103 @@
|
|||
from __future__ import print_function
|
||||
import subprocess
|
||||
from numbers import Integral
|
||||
import os
|
||||
import sys
|
||||
|
||||
from openmc.checkvalue import check_type
|
||||
|
||||
if sys.version_info[0] >= 3:
|
||||
basestring = str
|
||||
|
||||
|
||||
class Executor(object):
|
||||
"""Control execution of OpenMC
|
||||
def _run(command, output, cwd):
|
||||
# Launch a subprocess
|
||||
p = subprocess.Popen(command, shell=True, cwd=cwd, stdout=subprocess.PIPE,
|
||||
stderr=subprocess.STDOUT, universal_newlines=True)
|
||||
|
||||
Attributes
|
||||
# Capture and re-print OpenMC output in real-time
|
||||
while True:
|
||||
# If OpenMC is finished, break loop
|
||||
line = p.stdout.readline()
|
||||
if not line and p.poll() != None:
|
||||
break
|
||||
|
||||
# If user requested output, print to screen
|
||||
if output:
|
||||
print(line, end='')
|
||||
|
||||
# Return the returncode (integer, zero if no problems encountered)
|
||||
return p.returncode
|
||||
|
||||
|
||||
def plot_geometry(output=True, openmc_exec='openmc', cwd='.'):
|
||||
"""Run OpenMC in plotting mode
|
||||
|
||||
Parameters
|
||||
----------
|
||||
working_directory : str
|
||||
Path to working directory to run in
|
||||
output : bool
|
||||
Capture OpenMC output from standard out
|
||||
openmc_exec : str
|
||||
Path to OpenMC executable
|
||||
cwd : str, optional
|
||||
Path to working directory to run in. Defaults to the current working directory.
|
||||
|
||||
"""
|
||||
|
||||
def __init__(self):
|
||||
self._working_directory = '.'
|
||||
return _run(openmc_exec + ' -p', output, cwd)
|
||||
|
||||
def _run_openmc(self, command, output):
|
||||
# Launch a subprocess to run OpenMC
|
||||
p = subprocess.Popen(command, shell=True,
|
||||
cwd=self._working_directory,
|
||||
stdout=subprocess.PIPE,
|
||||
universal_newlines=True)
|
||||
|
||||
# Capture and re-print OpenMC output in real-time
|
||||
while True:
|
||||
# If OpenMC is finished, break loop
|
||||
line = p.stdout.readline()
|
||||
if not line and p.poll() != None:
|
||||
break
|
||||
def run(particles=None, threads=None, geometry_debug=False,
|
||||
restart_file=None, tracks=False, mpi_procs=1, output=True,
|
||||
openmc_exec='openmc', mpi_exec='mpiexec', cwd='.'):
|
||||
"""Run an OpenMC simulation.
|
||||
|
||||
# If user requested output, print to screen
|
||||
if output:
|
||||
print(line, end='')
|
||||
Parameters
|
||||
----------
|
||||
particles : int, optional
|
||||
Number of particles to simulate per generation.
|
||||
threads : int, optional
|
||||
Number of OpenMP threads. If OpenMC is compiled with OpenMP threading
|
||||
enabled, the default is implementation-dependent but is usually equal to
|
||||
the number of hardware threads available (or a value set by the
|
||||
OMP_NUM_THREADS environment variable).
|
||||
geometry_debug : bool, optional
|
||||
Turn on geometry debugging during simulation. Defaults to False.
|
||||
restart_file : str, optional
|
||||
Path to restart file to use
|
||||
tracks : bool, optional
|
||||
Write tracks for all particles. Defaults to False.
|
||||
mpi_procs : int, optional
|
||||
Number of MPI processes.
|
||||
output : bool, optional
|
||||
Capture OpenMC output from standard out. Defaults to True.
|
||||
openmc_exec : str, optional
|
||||
Path to OpenMC executable. Defaults to 'openmc'.
|
||||
mpi_exec : str, optional
|
||||
MPI execute command. Defaults to 'mpiexec'.
|
||||
cwd : str, optional
|
||||
Path to working directory to run in. Defaults to the current working directory.
|
||||
|
||||
# Return the returncode (integer, zero if no problems encountered)
|
||||
return p.returncode
|
||||
"""
|
||||
|
||||
@property
|
||||
def working_directory(self):
|
||||
return self._working_directory
|
||||
post_args = ' '
|
||||
pre_args = ''
|
||||
|
||||
@working_directory.setter
|
||||
def working_directory(self, working_directory):
|
||||
check_type("Executor's working directory", working_directory,
|
||||
basestring)
|
||||
if not os.path.isdir(working_directory):
|
||||
msg = 'Unable to set Executor\'s working directory to "{0}" ' \
|
||||
'which does not exist'.format(working_directory)
|
||||
raise ValueError(msg)
|
||||
if isinstance(particles, Integral) and particles > 0:
|
||||
post_args += '-n {0} '.format(particles)
|
||||
|
||||
self._working_directory = working_directory
|
||||
if isinstance(threads, Integral) and threads > 0:
|
||||
post_args += '-s {0} '.format(threads)
|
||||
|
||||
def plot_geometry(self, output=True, openmc_exec='openmc'):
|
||||
"""Run OpenMC in plotting mode"""
|
||||
if geometry_debug:
|
||||
post_args += '-g '
|
||||
|
||||
return self._run_openmc(openmc_exec + ' -p', output)
|
||||
if isinstance(restart_file, basestring):
|
||||
post_args += '-r {0} '.format(restart_file)
|
||||
|
||||
def run_simulation(self, particles=None, threads=None,
|
||||
geometry_debug=False, restart_file=None,
|
||||
tracks=False, mpi_procs=1, output=True,
|
||||
openmc_exec='openmc', mpi_exec=None):
|
||||
"""Run an OpenMC simulation.
|
||||
if tracks:
|
||||
post_args += '-t'
|
||||
|
||||
Parameters
|
||||
----------
|
||||
particles : int
|
||||
Number of particles to simulate per generation
|
||||
threads : int
|
||||
Number of OpenMP threads
|
||||
geometry_debug : bool
|
||||
Turn on geometry debugging during simulation
|
||||
restart_file : str
|
||||
Path to restart file to use
|
||||
tracks : bool
|
||||
Write tracks for all particles
|
||||
mpi_procs : int
|
||||
Number of MPI processes
|
||||
output : bool
|
||||
Capture OpenMC output from standard out
|
||||
openmc_exec : str
|
||||
Path to OpenMC executable
|
||||
if isinstance(mpi_procs, Integral) and mpi_procs > 1:
|
||||
pre_args += '{} -n {} '.format(mpi_exec, mpi_procs)
|
||||
|
||||
"""
|
||||
command = pre_args + openmc_exec + ' ' + post_args
|
||||
|
||||
post_args = ' '
|
||||
pre_args = ''
|
||||
|
||||
if isinstance(particles, Integral) and particles > 0:
|
||||
post_args += '-n {0} '.format(particles)
|
||||
|
||||
if isinstance(threads, Integral) and threads > 0:
|
||||
post_args += '-s {0} '.format(threads)
|
||||
|
||||
if geometry_debug:
|
||||
post_args += '-g '
|
||||
|
||||
if isinstance(restart_file, basestring):
|
||||
post_args += '-r {0} '.format(restart_file)
|
||||
|
||||
if tracks:
|
||||
post_args += '-t'
|
||||
|
||||
if isinstance(mpi_procs, Integral) and mpi_procs > 1:
|
||||
np_present = True
|
||||
else:
|
||||
np_present = False
|
||||
|
||||
if mpi_exec is not None and isinstance(mpi_exec, basestring):
|
||||
mpi_exec_present = True
|
||||
else:
|
||||
mpi_exec_present = False
|
||||
|
||||
if np_present or mpi_exec_present:
|
||||
if mpi_exec_present:
|
||||
pre_args += mpi_exec + ' '
|
||||
else:
|
||||
pre_args += 'mpirun '
|
||||
pre_args += '-n {0} '.format(mpi_procs)
|
||||
|
||||
command = pre_args + openmc_exec + ' ' + post_args
|
||||
|
||||
return self._run_openmc(command, output)
|
||||
return _run(command, output, cwd)
|
||||
|
|
|
|||
|
|
@ -27,7 +27,8 @@ class Filter(object):
|
|||
type : str
|
||||
The type of the tally filter. Acceptable values are "universe",
|
||||
"material", "cell", "cellborn", "surface", "mesh", "energy",
|
||||
"energyout", and "distribcell".
|
||||
"energyout", "distribcell", "mu", "polar", "azimuthal", and
|
||||
"delayedgroup".
|
||||
bins : Integral or Iterable of Integral or Iterable of Real
|
||||
The bins for the filter. This takes on different meaning for different
|
||||
filters. See the OpenMC online documentation for more details.
|
||||
|
|
@ -40,7 +41,7 @@ class Filter(object):
|
|||
The bins for the filter
|
||||
num_bins : Integral
|
||||
The number of filter bins
|
||||
mesh : Mesh or None
|
||||
mesh : openmc.Mesh or None
|
||||
A Mesh object for 'mesh' type filters.
|
||||
stride : Integral
|
||||
The number of filter, nuclide and score bins within each of this
|
||||
|
|
@ -265,7 +266,7 @@ class Filter(object):
|
|||
|
||||
Parameters
|
||||
----------
|
||||
other : Filter
|
||||
other : openmc.Filter
|
||||
Filter to compare with
|
||||
|
||||
Returns
|
||||
|
|
@ -310,12 +311,12 @@ class Filter(object):
|
|||
|
||||
Parameters
|
||||
----------
|
||||
other : Filter
|
||||
other : openmc.Filter
|
||||
Filter to merge with
|
||||
|
||||
Returns
|
||||
-------
|
||||
merged_filter : Filter
|
||||
merged_filter : openmc.Filter
|
||||
Filter resulting from the merge
|
||||
|
||||
"""
|
||||
|
|
@ -355,7 +356,7 @@ class Filter(object):
|
|||
|
||||
Parameters
|
||||
----------
|
||||
other : Filter
|
||||
other : openmc.Filter
|
||||
The filter to query as a subset of this filter
|
||||
|
||||
Returns
|
||||
|
|
@ -519,8 +520,8 @@ class Filter(object):
|
|||
"""Builds a Pandas DataFrame for the Filter's bins.
|
||||
|
||||
This method constructs a Pandas DataFrame object for the filter with
|
||||
columns annotated by filter bin information. This is a helper method
|
||||
for the Tally.get_pandas_dataframe(...) method.
|
||||
columns annotated by filter bin information. This is a helper method for
|
||||
:meth:`Tally.get_pandas_dataframe`.
|
||||
|
||||
This capability has been tested for Pandas >=0.13.1. However, it is
|
||||
recommended to use v0.16 or newer versions of Pandas since this method
|
||||
|
|
@ -530,7 +531,7 @@ class Filter(object):
|
|||
----------
|
||||
data_size : Integral
|
||||
The total number of bins in the tally corresponding to this filter
|
||||
summary : None or Summary
|
||||
summary : None or openmc.Summary
|
||||
An optional Summary object to be used to construct columns for
|
||||
distribcell tally filters (default is None). The geometric
|
||||
information in the Summary object is embedded into a Multi-index
|
||||
|
|
|
|||
|
|
@ -17,13 +17,12 @@ class Geometry(object):
|
|||
|
||||
Attributes
|
||||
----------
|
||||
root_universe : openmc.universe.Universe
|
||||
root_universe : openmc.Universe
|
||||
Root universe which contains all others
|
||||
|
||||
"""
|
||||
|
||||
def __init__(self):
|
||||
# Initialize Geometry class attributes
|
||||
self._root_universe = None
|
||||
self._offsets = {}
|
||||
|
||||
|
|
@ -42,6 +41,27 @@ class Geometry(object):
|
|||
|
||||
self._root_universe = root_universe
|
||||
|
||||
def export_to_xml(self):
|
||||
"""Create a geometry.xml file that can be used for a simulation.
|
||||
|
||||
"""
|
||||
|
||||
# Clear OpenMC written IDs used to optimize XML generation
|
||||
openmc.universe.WRITTEN_IDS = {}
|
||||
|
||||
# Create XML representation
|
||||
geometry_file = ET.Element("geometry")
|
||||
self.root_universe.create_xml_subelement(geometry_file)
|
||||
|
||||
# Clean the indentation in the file to be user-readable
|
||||
sort_xml_elements(geometry_file)
|
||||
clean_xml_indentation(geometry_file)
|
||||
|
||||
# Write the XML Tree to the geometry.xml file
|
||||
tree = ET.ElementTree(geometry_file)
|
||||
tree.write("geometry.xml", xml_declaration=True, encoding='utf-8',
|
||||
method="xml")
|
||||
|
||||
def get_cell_instance(self, path):
|
||||
"""Return the instance number for the final cell in a geometry path.
|
||||
|
||||
|
|
@ -95,7 +115,7 @@ class Geometry(object):
|
|||
|
||||
Returns
|
||||
-------
|
||||
list of openmc.universe.Cell
|
||||
list of openmc.Cell
|
||||
Cells in the geometry
|
||||
|
||||
"""
|
||||
|
|
@ -116,7 +136,7 @@ class Geometry(object):
|
|||
|
||||
Returns
|
||||
-------
|
||||
list of openmc.universe.Universe
|
||||
list of openmc.Universe
|
||||
Universes in the geometry
|
||||
|
||||
"""
|
||||
|
|
@ -136,7 +156,7 @@ class Geometry(object):
|
|||
|
||||
Returns
|
||||
-------
|
||||
list of openmc.nuclide.Nuclide
|
||||
list of openmc.Nuclide
|
||||
Nuclides in the geometry
|
||||
|
||||
"""
|
||||
|
|
@ -154,7 +174,7 @@ class Geometry(object):
|
|||
|
||||
Returns
|
||||
-------
|
||||
list of openmc.material.Material
|
||||
list of openmc.Material
|
||||
Materials in the geometry
|
||||
|
||||
"""
|
||||
|
|
@ -177,7 +197,7 @@ class Geometry(object):
|
|||
|
||||
Returns
|
||||
-------
|
||||
list of openmc.universe.Cell
|
||||
list of openmc.Cell
|
||||
Cells filled by Materials in the geometry
|
||||
|
||||
"""
|
||||
|
|
@ -198,7 +218,7 @@ class Geometry(object):
|
|||
|
||||
Returns
|
||||
-------
|
||||
list of openmc.universe.Universe
|
||||
list of openmc.Universe
|
||||
Universes with non-fill cells
|
||||
|
||||
"""
|
||||
|
|
@ -221,7 +241,7 @@ class Geometry(object):
|
|||
|
||||
Returns
|
||||
-------
|
||||
list of openmc.universe.Lattice
|
||||
list of openmc.Lattice
|
||||
Lattices in the geometry
|
||||
|
||||
"""
|
||||
|
|
@ -252,7 +272,7 @@ class Geometry(object):
|
|||
|
||||
Returns
|
||||
-------
|
||||
list of openmc.material.Material
|
||||
list of openmc.Material
|
||||
Materials matching the queried name
|
||||
|
||||
"""
|
||||
|
|
@ -292,7 +312,7 @@ class Geometry(object):
|
|||
|
||||
Returns
|
||||
-------
|
||||
list of openmc.universe.Cell
|
||||
list of openmc.Cell
|
||||
Cells matching the queried name
|
||||
|
||||
"""
|
||||
|
|
@ -332,7 +352,7 @@ class Geometry(object):
|
|||
|
||||
Returns
|
||||
-------
|
||||
list of openmc.universe.Cell
|
||||
list of openmc.Cell
|
||||
Cells with fills matching the queried name
|
||||
|
||||
"""
|
||||
|
|
@ -372,7 +392,7 @@ class Geometry(object):
|
|||
|
||||
Returns
|
||||
-------
|
||||
list of openmc.universe.Universe
|
||||
list of openmc.Universe
|
||||
Universes matching the queried name
|
||||
|
||||
"""
|
||||
|
|
@ -412,7 +432,7 @@ class Geometry(object):
|
|||
|
||||
Returns
|
||||
-------
|
||||
list of openmc.universe.Lattice
|
||||
list of openmc.Lattice
|
||||
Lattices matching the queried name
|
||||
|
||||
"""
|
||||
|
|
@ -436,52 +456,3 @@ class Geometry(object):
|
|||
lattices = list(lattices)
|
||||
lattices.sort(key=lambda x: x.id)
|
||||
return lattices
|
||||
|
||||
|
||||
class GeometryFile(object):
|
||||
"""Geometry file used for an OpenMC simulation. Corresponds directly to the
|
||||
geometry.xml input file.
|
||||
|
||||
Attributes
|
||||
----------
|
||||
geometry : Geometry
|
||||
The geometry to be used
|
||||
|
||||
"""
|
||||
|
||||
def __init__(self):
|
||||
# Initialize GeometryFile class attributes
|
||||
self._geometry = None
|
||||
self._geometry_file = ET.Element("geometry")
|
||||
|
||||
@property
|
||||
def geometry(self):
|
||||
return self._geometry
|
||||
|
||||
@geometry.setter
|
||||
def geometry(self, geometry):
|
||||
check_type('the geometry', geometry, Geometry)
|
||||
self._geometry = geometry
|
||||
|
||||
def export_to_xml(self):
|
||||
"""Create a geometry.xml file that can be used for a simulation.
|
||||
|
||||
"""
|
||||
|
||||
# Clear OpenMC written IDs used to optimize XML generation
|
||||
openmc.universe.WRITTEN_IDS = {}
|
||||
|
||||
# Reset xml element tree
|
||||
self._geometry_file.clear()
|
||||
|
||||
root_universe = self.geometry.root_universe
|
||||
root_universe.create_xml_subelement(self._geometry_file)
|
||||
|
||||
# Clean the indentation in the file to be user-readable
|
||||
sort_xml_elements(self._geometry_file)
|
||||
clean_xml_indentation(self._geometry_file)
|
||||
|
||||
# Write the XML Tree to the geometry.xml file
|
||||
tree = ET.ElementTree(self._geometry_file)
|
||||
tree.write("geometry.xml", xml_declaration=True,
|
||||
encoding='utf-8', method="xml")
|
||||
|
|
|
|||
870
openmc/lattice.py
Normal file
870
openmc/lattice.py
Normal file
|
|
@ -0,0 +1,870 @@
|
|||
import abc
|
||||
from collections import OrderedDict, Iterable
|
||||
from numbers import Real, Integral
|
||||
from xml.etree import ElementTree as ET
|
||||
import sys
|
||||
|
||||
import numpy as np
|
||||
|
||||
import openmc.checkvalue as cv
|
||||
import openmc
|
||||
|
||||
if sys.version_info[0] >= 3:
|
||||
basestring = str
|
||||
|
||||
|
||||
class Lattice(object):
|
||||
"""A repeating structure wherein each element is a universe.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
lattice_id : int, optional
|
||||
Unique identifier for the lattice. If not specified, an identifier will
|
||||
automatically be assigned.
|
||||
name : str, optional
|
||||
Name of the lattice. If not specified, the name is the empty string.
|
||||
|
||||
Attributes
|
||||
----------
|
||||
id : int
|
||||
Unique identifier for the lattice
|
||||
name : str
|
||||
Name of the lattice
|
||||
pitch : float
|
||||
Pitch of the lattice in cm
|
||||
outer : int
|
||||
The unique identifier of a universe to fill all space outside the
|
||||
lattice
|
||||
universes : numpy.ndarray of openmc.Universe
|
||||
An array of universes filling each element of the lattice
|
||||
|
||||
"""
|
||||
|
||||
# This is an abstract class which cannot be instantiated
|
||||
__metaclass__ = abc.ABCMeta
|
||||
|
||||
def __init__(self, lattice_id=None, name=''):
|
||||
# Initialize Lattice class attributes
|
||||
self.id = lattice_id
|
||||
self.name = name
|
||||
self._pitch = None
|
||||
self._outer = None
|
||||
self._universes = None
|
||||
|
||||
def __eq__(self, other):
|
||||
if not isinstance(other, Lattice):
|
||||
return False
|
||||
elif self.id != other.id:
|
||||
return False
|
||||
elif self.name != other.name:
|
||||
return False
|
||||
elif self.pitch != other.pitch:
|
||||
return False
|
||||
elif self.outer != other.outer:
|
||||
return False
|
||||
elif self.universes != other.universes:
|
||||
return False
|
||||
else:
|
||||
return True
|
||||
|
||||
def __ne__(self, other):
|
||||
return not self == other
|
||||
|
||||
@property
|
||||
def id(self):
|
||||
return self._id
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
return self._name
|
||||
|
||||
@property
|
||||
def pitch(self):
|
||||
return self._pitch
|
||||
|
||||
@property
|
||||
def outer(self):
|
||||
return self._outer
|
||||
|
||||
@property
|
||||
def universes(self):
|
||||
return self._universes
|
||||
|
||||
@id.setter
|
||||
def id(self, lattice_id):
|
||||
if lattice_id is None:
|
||||
self._id = openmc.universe.AUTO_UNIVERSE_ID
|
||||
openmc.universe.AUTO_UNIVERSE_ID += 1
|
||||
else:
|
||||
cv.check_type('lattice ID', lattice_id, Integral)
|
||||
cv.check_greater_than('lattice ID', lattice_id, 0, equality=True)
|
||||
self._id = lattice_id
|
||||
|
||||
@name.setter
|
||||
def name(self, name):
|
||||
if name is not None:
|
||||
cv.check_type('lattice name', name, basestring)
|
||||
self._name = name
|
||||
else:
|
||||
self._name = ''
|
||||
|
||||
@outer.setter
|
||||
def outer(self, outer):
|
||||
cv.check_type('outer universe', outer, openmc.Universe)
|
||||
self._outer = outer
|
||||
|
||||
@universes.setter
|
||||
def universes(self, universes):
|
||||
cv.check_iterable_type('lattice universes', universes, openmc.Universe,
|
||||
min_depth=2, max_depth=3)
|
||||
self._universes = np.asarray(universes)
|
||||
|
||||
def get_unique_universes(self):
|
||||
"""Determine all unique universes in the lattice
|
||||
|
||||
Returns
|
||||
-------
|
||||
universes : collections.OrderedDict
|
||||
Dictionary whose keys are universe IDs and values are
|
||||
:class:`openmc.Universe` instances
|
||||
|
||||
"""
|
||||
|
||||
univs = OrderedDict()
|
||||
for k in range(len(self._universes)):
|
||||
for j in range(len(self._universes[k])):
|
||||
if isinstance(self._universes[k][j], openmc.Universe):
|
||||
u = self._universes[k][j]
|
||||
univs[u._id] = u
|
||||
else:
|
||||
for i in range(len(self._universes[k][j])):
|
||||
u = self._universes[k][j][i]
|
||||
assert isinstance(u, openmc.Universe)
|
||||
univs[u._id] = u
|
||||
|
||||
if self.outer is not None:
|
||||
univs[self.outer._id] = self.outer
|
||||
|
||||
return univs
|
||||
|
||||
def get_all_nuclides(self):
|
||||
"""Return all nuclides contained in the lattice
|
||||
|
||||
Returns
|
||||
-------
|
||||
nuclides : collections.OrderedDict
|
||||
Dictionary whose keys are nuclide names and values are 2-tuples of
|
||||
(nuclide, density)
|
||||
|
||||
"""
|
||||
|
||||
nuclides = OrderedDict()
|
||||
|
||||
# Get all unique Universes contained in each of the lattice cells
|
||||
unique_universes = self.get_unique_universes()
|
||||
|
||||
# Append all Universes containing each cell to the dictionary
|
||||
for universe_id, universe in unique_universes.items():
|
||||
nuclides.update(universe.get_all_nuclides())
|
||||
|
||||
return nuclides
|
||||
|
||||
def get_all_cells(self):
|
||||
"""Return all cells that are contained within the lattice
|
||||
|
||||
Returns
|
||||
-------
|
||||
cells : collections.OrderedDict
|
||||
Dictionary whose keys are cell IDs and values are :class:`Cell`
|
||||
instances
|
||||
|
||||
"""
|
||||
|
||||
cells = OrderedDict()
|
||||
unique_universes = self.get_unique_universes()
|
||||
|
||||
for universe_id, universe in unique_universes.items():
|
||||
cells.update(universe.get_all_cells())
|
||||
|
||||
return cells
|
||||
|
||||
def get_all_materials(self):
|
||||
"""Return all materials that are contained within the lattice
|
||||
|
||||
Returns
|
||||
-------
|
||||
materials : collections.OrderedDict
|
||||
Dictionary whose keys are material IDs and values are
|
||||
:class:`Material` instances
|
||||
|
||||
"""
|
||||
|
||||
materials = OrderedDict()
|
||||
|
||||
# Append all Cells in each Cell in the Universe to the dictionary
|
||||
cells = self.get_all_cells()
|
||||
for cell_id, cell in cells.items():
|
||||
materials.update(cell.get_all_materials())
|
||||
|
||||
return materials
|
||||
|
||||
def get_all_universes(self):
|
||||
"""Return all universes that are contained within the lattice
|
||||
|
||||
Returns
|
||||
-------
|
||||
universes : collections.OrderedDict
|
||||
Dictionary whose keys are universe IDs and values are
|
||||
:class:`Universe` instances
|
||||
|
||||
"""
|
||||
|
||||
# Initialize a dictionary of all Universes contained by the Lattice
|
||||
# in each nested Universe level
|
||||
all_universes = OrderedDict()
|
||||
|
||||
# Get all unique Universes contained in each of the lattice cells
|
||||
unique_universes = self.get_unique_universes()
|
||||
|
||||
# Add the unique Universes filling each Lattice cell
|
||||
all_universes.update(unique_universes)
|
||||
|
||||
# Append all Universes containing each cell to the dictionary
|
||||
for universe_id, universe in unique_universes.items():
|
||||
all_universes.update(universe.get_all_universes())
|
||||
|
||||
return all_universes
|
||||
|
||||
|
||||
class RectLattice(Lattice):
|
||||
"""A lattice consisting of rectangular prisms.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
lattice_id : int, optional
|
||||
Unique identifier for the lattice. If not specified, an identifier will
|
||||
automatically be assigned.
|
||||
name : str, optional
|
||||
Name of the lattice. If not specified, the name is the empty string.
|
||||
|
||||
Attributes
|
||||
----------
|
||||
id : int
|
||||
Unique identifier for the lattice
|
||||
name : str
|
||||
Name of the lattice
|
||||
dimension : Iterable of int
|
||||
An array of two or three integers representing the number of lattice
|
||||
cells in the x- and y- (and z-) directions, respectively.
|
||||
lower_left : Iterable of float
|
||||
The coordinates of the lower-left corner of the lattice. If the lattice
|
||||
is two-dimensional, only the x- and y-coordinates are specified.
|
||||
|
||||
"""
|
||||
|
||||
def __init__(self, lattice_id=None, name=''):
|
||||
super(RectLattice, self).__init__(lattice_id, name)
|
||||
|
||||
# Initialize Lattice class attributes
|
||||
self._dimension = None
|
||||
self._lower_left = None
|
||||
self._offsets = None
|
||||
|
||||
def __eq__(self, other):
|
||||
if not isinstance(other, RectLattice):
|
||||
return False
|
||||
elif not super(RectLattice, self).__eq__(other):
|
||||
return False
|
||||
elif self.dimension != other.dimension:
|
||||
return False
|
||||
elif self.lower_left != other.lower_left:
|
||||
return False
|
||||
else:
|
||||
return True
|
||||
|
||||
def __ne__(self, other):
|
||||
return not self == other
|
||||
|
||||
def __hash__(self):
|
||||
return hash(repr(self))
|
||||
|
||||
def __repr__(self):
|
||||
string = 'RectLattice\n'
|
||||
string += '{0: <16}{1}{2}\n'.format('\tID', '=\t', self._id)
|
||||
string += '{0: <16}{1}{2}\n'.format('\tName', '=\t', self._name)
|
||||
string += '{0: <16}{1}{2}\n'.format('\tDimension', '=\t',
|
||||
self._dimension)
|
||||
string += '{0: <16}{1}{2}\n'.format('\tLower Left', '=\t',
|
||||
self._lower_left)
|
||||
string += '{0: <16}{1}{2}\n'.format('\tPitch', '=\t', self._pitch)
|
||||
|
||||
if self._outer is not None:
|
||||
string += '{0: <16}{1}{2}\n'.format('\tOuter', '=\t',
|
||||
self._outer._id)
|
||||
else:
|
||||
string += '{0: <16}{1}{2}\n'.format('\tOuter', '=\t',
|
||||
self._outer)
|
||||
|
||||
string += '{0: <16}\n'.format('\tUniverses')
|
||||
|
||||
# Lattice nested Universe IDs - column major for Fortran
|
||||
for i, universe in enumerate(np.ravel(self._universes)):
|
||||
string += '{0} '.format(universe._id)
|
||||
|
||||
# Add a newline character every time we reach end of row of cells
|
||||
if (i+1) % self._dimension[-1] == 0:
|
||||
string += '\n'
|
||||
|
||||
string = string.rstrip('\n')
|
||||
|
||||
if self._offsets is not None:
|
||||
string += '{0: <16}\n'.format('\tOffsets')
|
||||
|
||||
# Lattice cell offsets
|
||||
for i, offset in enumerate(np.ravel(self._offsets)):
|
||||
string += '{0} '.format(offset)
|
||||
|
||||
# Add a newline character when we reach end of row of cells
|
||||
if (i+1) % self._dimension[-1] == 0:
|
||||
string += '\n'
|
||||
|
||||
string = string.rstrip('\n')
|
||||
|
||||
return string
|
||||
|
||||
@property
|
||||
def dimension(self):
|
||||
return self._dimension
|
||||
|
||||
@property
|
||||
def lower_left(self):
|
||||
return self._lower_left
|
||||
|
||||
@property
|
||||
def offsets(self):
|
||||
return self._offsets
|
||||
|
||||
@dimension.setter
|
||||
def dimension(self, dimension):
|
||||
cv.check_type('lattice dimension', dimension, Iterable, Integral)
|
||||
cv.check_length('lattice dimension', dimension, 2, 3)
|
||||
for dim in dimension:
|
||||
cv.check_greater_than('lattice dimension', dim, 0)
|
||||
self._dimension = dimension
|
||||
|
||||
@lower_left.setter
|
||||
def lower_left(self, lower_left):
|
||||
cv.check_type('lattice lower left corner', lower_left, Iterable, Real)
|
||||
cv.check_length('lattice lower left corner', lower_left, 2, 3)
|
||||
self._lower_left = lower_left
|
||||
|
||||
@offsets.setter
|
||||
def offsets(self, offsets):
|
||||
cv.check_type('lattice offsets', offsets, Iterable)
|
||||
self._offsets = offsets
|
||||
|
||||
@Lattice.pitch.setter
|
||||
def pitch(self, pitch):
|
||||
cv.check_type('lattice pitch', pitch, Iterable, Real)
|
||||
cv.check_length('lattice pitch', pitch, 2, 3)
|
||||
for dim in pitch:
|
||||
cv.check_greater_than('lattice pitch', dim, 0.0)
|
||||
self._pitch = pitch
|
||||
|
||||
def get_cell_instance(self, path, distribcell_index):
|
||||
|
||||
# Extract the lattice element from the path
|
||||
next_index = path.index('-')
|
||||
lat_id_indices = path[:next_index]
|
||||
path = path[next_index+2:]
|
||||
|
||||
# Extract the lattice cell indices from the path
|
||||
i1 = lat_id_indices.index('(')
|
||||
i2 = lat_id_indices.index(')')
|
||||
i = lat_id_indices[i1+1:i2]
|
||||
lat_x = int(i.split(',')[0]) - 1
|
||||
lat_y = int(i.split(',')[1]) - 1
|
||||
lat_z = int(i.split(',')[2]) - 1
|
||||
|
||||
# For 2D Lattices
|
||||
if len(self._dimension) == 2:
|
||||
offset = self._offsets[lat_z, lat_y, lat_x, distribcell_index-1]
|
||||
offset += self._universes[lat_x][lat_y].get_cell_instance(path,
|
||||
distribcell_index)
|
||||
|
||||
# For 3D Lattices
|
||||
else:
|
||||
offset = self._offsets[lat_z, lat_y, lat_x, distribcell_index-1]
|
||||
offset += self._universes[lat_z][lat_y][lat_x].get_cell_instance(
|
||||
path, distribcell_index)
|
||||
|
||||
return offset
|
||||
|
||||
def create_xml_subelement(self, xml_element):
|
||||
|
||||
# Determine if XML element already contains subelement for this Lattice
|
||||
path = './lattice[@id=\'{0}\']'.format(self._id)
|
||||
test = xml_element.find(path)
|
||||
|
||||
# If the element does contain the Lattice subelement, then return
|
||||
if test is not None:
|
||||
return
|
||||
|
||||
lattice_subelement = ET.Element("lattice")
|
||||
lattice_subelement.set("id", str(self._id))
|
||||
|
||||
if len(self._name) > 0:
|
||||
lattice_subelement.set("name", str(self._name))
|
||||
|
||||
# Export the Lattice cell pitch
|
||||
pitch = ET.SubElement(lattice_subelement, "pitch")
|
||||
pitch.text = ' '.join(map(str, self._pitch))
|
||||
|
||||
# Export the Lattice outer Universe (if specified)
|
||||
if self._outer is not None:
|
||||
outer = ET.SubElement(lattice_subelement, "outer")
|
||||
outer.text = '{0}'.format(self._outer._id)
|
||||
self._outer.create_xml_subelement(xml_element)
|
||||
|
||||
# Export Lattice cell dimensions
|
||||
dimension = ET.SubElement(lattice_subelement, "dimension")
|
||||
dimension.text = ' '.join(map(str, self._dimension))
|
||||
|
||||
# Export Lattice lower left
|
||||
lower_left = ET.SubElement(lattice_subelement, "lower_left")
|
||||
lower_left.text = ' '.join(map(str, self._lower_left))
|
||||
|
||||
# Export the Lattice nested Universe IDs - column major for Fortran
|
||||
universe_ids = '\n'
|
||||
|
||||
# 3D Lattices
|
||||
if len(self._dimension) == 3:
|
||||
for z in range(self._dimension[2]):
|
||||
for y in range(self._dimension[1]):
|
||||
for x in range(self._dimension[0]):
|
||||
universe = self._universes[z][y][x]
|
||||
|
||||
# Append Universe ID to the Lattice XML subelement
|
||||
universe_ids += '{0} '.format(universe._id)
|
||||
|
||||
# Create XML subelement for this Universe
|
||||
universe.create_xml_subelement(xml_element)
|
||||
|
||||
# Add newline character when we reach end of row of cells
|
||||
universe_ids += '\n'
|
||||
|
||||
# Add newline character when we reach end of row of cells
|
||||
universe_ids += '\n'
|
||||
|
||||
# 2D Lattices
|
||||
else:
|
||||
for y in range(self._dimension[1]):
|
||||
for x in range(self._dimension[0]):
|
||||
universe = self._universes[y][x]
|
||||
|
||||
# Append Universe ID to Lattice XML subelement
|
||||
universe_ids += '{0} '.format(universe._id)
|
||||
|
||||
# Create XML subelement for this Universe
|
||||
universe.create_xml_subelement(xml_element)
|
||||
|
||||
# Add newline character when we reach end of row of cells
|
||||
universe_ids += '\n'
|
||||
|
||||
# Remove trailing newline character from Universe IDs string
|
||||
universe_ids = universe_ids.rstrip('\n')
|
||||
|
||||
universes = ET.SubElement(lattice_subelement, "universes")
|
||||
universes.text = universe_ids
|
||||
|
||||
# Append the XML subelement for this Lattice to the XML element
|
||||
xml_element.append(lattice_subelement)
|
||||
|
||||
|
||||
class HexLattice(Lattice):
|
||||
"""A lattice consisting of hexagonal prisms.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
lattice_id : int, optional
|
||||
Unique identifier for the lattice. If not specified, an identifier will
|
||||
automatically be assigned.
|
||||
name : str, optional
|
||||
Name of the lattice. If not specified, the name is the empty string.
|
||||
|
||||
Attributes
|
||||
----------
|
||||
id : int
|
||||
Unique identifier for the lattice
|
||||
name : str
|
||||
Name of the lattice
|
||||
num_rings : int
|
||||
Number of radial ring positions in the xy-plane
|
||||
num_axial : int
|
||||
Number of positions along the z-axis.
|
||||
center : Iterable of float
|
||||
Coordinates of the center of the lattice. If the lattice does not have
|
||||
axial sections then only the x- and y-coordinates are specified
|
||||
|
||||
"""
|
||||
|
||||
def __init__(self, lattice_id=None, name=''):
|
||||
super(HexLattice, self).__init__(lattice_id, name)
|
||||
|
||||
# Initialize Lattice class attributes
|
||||
self._num_rings = None
|
||||
self._num_axial = None
|
||||
self._center = None
|
||||
|
||||
def __eq__(self, other):
|
||||
if not isinstance(other, HexLattice):
|
||||
return False
|
||||
elif not super(HexLattice, self).__eq__(other):
|
||||
return False
|
||||
elif self.num_rings != other.num_rings:
|
||||
return False
|
||||
elif self.num_axial != other.num_axial:
|
||||
return False
|
||||
elif self.center != other.center:
|
||||
return False
|
||||
else:
|
||||
return True
|
||||
|
||||
def __ne__(self, other):
|
||||
return not self == other
|
||||
|
||||
def __hash__(self):
|
||||
return hash(repr(self))
|
||||
|
||||
def __repr__(self):
|
||||
string = 'HexLattice\n'
|
||||
string += '{0: <16}{1}{2}\n'.format('\tID', '=\t', self._id)
|
||||
string += '{0: <16}{1}{2}\n'.format('\tName', '=\t', self._name)
|
||||
string += '{0: <16}{1}{2}\n'.format('\t# Rings', '=\t', self._num_rings)
|
||||
string += '{0: <16}{1}{2}\n'.format('\t# Axial', '=\t', self._num_axial)
|
||||
string += '{0: <16}{1}{2}\n'.format('\tCenter', '=\t',
|
||||
self._center)
|
||||
string += '{0: <16}{1}{2}\n'.format('\tPitch', '=\t', self._pitch)
|
||||
|
||||
if self._outer is not None:
|
||||
string += '{0: <16}{1}{2}\n'.format('\tOuter', '=\t',
|
||||
self._outer._id)
|
||||
else:
|
||||
string += '{0: <16}{1}{2}\n'.format('\tOuter', '=\t',
|
||||
self._outer)
|
||||
|
||||
string += '{0: <16}\n'.format('\tUniverses')
|
||||
|
||||
if self._num_axial is not None:
|
||||
slices = [self._repr_axial_slice(x) for x in self._universes]
|
||||
string += '\n'.join(slices)
|
||||
|
||||
else:
|
||||
string += self._repr_axial_slice(self._universes)
|
||||
|
||||
return string
|
||||
|
||||
@property
|
||||
def num_rings(self):
|
||||
return self._num_rings
|
||||
|
||||
@property
|
||||
def num_axial(self):
|
||||
return self._num_axial
|
||||
|
||||
@property
|
||||
def center(self):
|
||||
return self._center
|
||||
|
||||
@num_rings.setter
|
||||
def num_rings(self, num_rings):
|
||||
cv.check_type('number of rings', num_rings, Integral)
|
||||
cv.check_greater_than('number of rings', num_rings, 0)
|
||||
self._num_rings = num_rings
|
||||
|
||||
@num_axial.setter
|
||||
def num_axial(self, num_axial):
|
||||
cv.check_type('number of axial', num_axial, Integral)
|
||||
cv.check_greater_than('number of axial', num_axial, 0)
|
||||
self._num_axial = num_axial
|
||||
|
||||
@center.setter
|
||||
def center(self, center):
|
||||
cv.check_type('lattice center', center, Iterable, Real)
|
||||
cv.check_length('lattice center', center, 2, 3)
|
||||
self._center = center
|
||||
|
||||
@Lattice.pitch.setter
|
||||
def pitch(self, pitch):
|
||||
cv.check_type('lattice pitch', pitch, Iterable, Real)
|
||||
cv.check_length('lattice pitch', pitch, 1, 2)
|
||||
for dim in pitch:
|
||||
cv.check_greater_than('lattice pitch', dim, 0)
|
||||
self._pitch = pitch
|
||||
|
||||
@Lattice.universes.setter
|
||||
def universes(self, universes):
|
||||
# Call Lattice.universes parent class setter property
|
||||
Lattice.universes.fset(self, universes)
|
||||
|
||||
# NOTE: This routine assumes that the user creates a "ragged" list of
|
||||
# lists, where each sub-list corresponds to one ring of Universes.
|
||||
# The sub-lists are ordered from outermost ring to innermost ring.
|
||||
# The Universes within each sub-list are ordered from the "top" in a
|
||||
# clockwise fashion.
|
||||
|
||||
# Check to see if the given universes look like a 2D or a 3D array.
|
||||
if isinstance(self._universes[0][0], openmc.Universe):
|
||||
n_dims = 2
|
||||
|
||||
elif isinstance(self._universes[0][0][0], openmc.Universe):
|
||||
n_dims = 3
|
||||
|
||||
else:
|
||||
msg = 'HexLattice ID={0:d} does not appear to be either 2D or ' \
|
||||
'3D. Make sure set_universes was given a two-deep or ' \
|
||||
'three-deep iterable of universes.'.format(self._id)
|
||||
raise RuntimeError(msg)
|
||||
|
||||
# Set the number of axial positions.
|
||||
if n_dims == 3:
|
||||
self.num_axial = len(self._universes)
|
||||
else:
|
||||
self._num_axial = None
|
||||
|
||||
# Set the number of rings and make sure this number is consistent for
|
||||
# all axial positions.
|
||||
if n_dims == 3:
|
||||
self.num_rings = len(self._universes)
|
||||
for rings in self._universes:
|
||||
if len(rings) != self._num_rings:
|
||||
msg = 'HexLattice ID={0:d} has an inconsistent number of ' \
|
||||
'rings per axial positon'.format(self._id)
|
||||
raise ValueError(msg)
|
||||
|
||||
else:
|
||||
self.num_rings = len(self._universes)
|
||||
|
||||
# Make sure there are the correct number of elements in each ring.
|
||||
if n_dims == 3:
|
||||
for axial_slice in self._universes:
|
||||
# Check the center ring.
|
||||
if len(axial_slice[-1]) != 1:
|
||||
msg = 'HexLattice ID={0:d} has the wrong number of ' \
|
||||
'elements in the innermost ring. Only 1 element is ' \
|
||||
'allowed in the innermost ring.'.format(self._id)
|
||||
raise ValueError(msg)
|
||||
|
||||
# Check the outer rings.
|
||||
for r in range(self._num_rings-1):
|
||||
if len(axial_slice[r]) != 6*(self._num_rings - 1 - r):
|
||||
msg = 'HexLattice ID={0:d} has the wrong number of ' \
|
||||
'elements in ring number {1:d} (counting from the '\
|
||||
'outermost ring). This ring should have {2:d} ' \
|
||||
'elements.'.format(self._id, r,
|
||||
6*(self._num_rings - 1 - r))
|
||||
raise ValueError(msg)
|
||||
|
||||
else:
|
||||
axial_slice = self._universes
|
||||
# Check the center ring.
|
||||
if len(axial_slice[-1]) != 1:
|
||||
msg = 'HexLattice ID={0:d} has the wrong number of ' \
|
||||
'elements in the innermost ring. Only 1 element is ' \
|
||||
'allowed in the innermost ring.'.format(self._id)
|
||||
raise ValueError(msg)
|
||||
|
||||
# Check the outer rings.
|
||||
for r in range(self._num_rings-1):
|
||||
if len(axial_slice[r]) != 6*(self._num_rings - 1 - r):
|
||||
msg = 'HexLattice ID={0:d} has the wrong number of ' \
|
||||
'elements in ring number {1:d} (counting from the '\
|
||||
'outermost ring). This ring should have {2:d} ' \
|
||||
'elements.'.format(self._id, r,
|
||||
6*(self._num_rings - 1 - r))
|
||||
raise ValueError(msg)
|
||||
|
||||
def create_xml_subelement(self, xml_element):
|
||||
# Determine if XML element already contains subelement for this Lattice
|
||||
path = './hex_lattice[@id=\'{0}\']'.format(self._id)
|
||||
test = xml_element.find(path)
|
||||
|
||||
# If the element does contain the Lattice subelement, then return
|
||||
if test is not None:
|
||||
return
|
||||
|
||||
lattice_subelement = ET.Element("hex_lattice")
|
||||
lattice_subelement.set("id", str(self._id))
|
||||
|
||||
if len(self._name) > 0:
|
||||
lattice_subelement.set("name", str(self._name))
|
||||
|
||||
# Export the Lattice cell pitch
|
||||
pitch = ET.SubElement(lattice_subelement, "pitch")
|
||||
pitch.text = ' '.join(map(str, self._pitch))
|
||||
|
||||
# Export the Lattice outer Universe (if specified)
|
||||
if self._outer is not None:
|
||||
outer = ET.SubElement(lattice_subelement, "outer")
|
||||
outer.text = '{0}'.format(self._outer._id)
|
||||
self._outer.create_xml_subelement(xml_element)
|
||||
|
||||
lattice_subelement.set("n_rings", str(self._num_rings))
|
||||
|
||||
if self._num_axial is not None:
|
||||
lattice_subelement.set("n_axial", str(self._num_axial))
|
||||
|
||||
# Export Lattice cell center
|
||||
dimension = ET.SubElement(lattice_subelement, "center")
|
||||
dimension.text = ' '.join(map(str, self._center))
|
||||
|
||||
# Export the Lattice nested Universe IDs.
|
||||
|
||||
# 3D Lattices
|
||||
if self._num_axial is not None:
|
||||
slices = []
|
||||
for z in range(self._num_axial):
|
||||
# Initialize the center universe.
|
||||
universe = self._universes[z][-1][0]
|
||||
universe.create_xml_subelement(xml_element)
|
||||
|
||||
# Initialize the remaining universes.
|
||||
for r in range(self._num_rings-1):
|
||||
for theta in range(6*(self._num_rings - 1 - r)):
|
||||
universe = self._universes[z][r][theta]
|
||||
universe.create_xml_subelement(xml_element)
|
||||
|
||||
# Get a string representation of the universe IDs.
|
||||
slices.append(self._repr_axial_slice(self._universes[z]))
|
||||
|
||||
# Collapse the list of axial slices into a single string.
|
||||
universe_ids = '\n'.join(slices)
|
||||
|
||||
# 2D Lattices
|
||||
else:
|
||||
# Initialize the center universe.
|
||||
universe = self._universes[-1][0]
|
||||
universe.create_xml_subelement(xml_element)
|
||||
|
||||
# Initialize the remaining universes.
|
||||
for r in range(self._num_rings - 1):
|
||||
for theta in range(6*(self._num_rings - 1 - r)):
|
||||
universe = self._universes[r][theta]
|
||||
universe.create_xml_subelement(xml_element)
|
||||
|
||||
# Get a string representation of the universe IDs.
|
||||
universe_ids = self._repr_axial_slice(self._universes)
|
||||
|
||||
universes = ET.SubElement(lattice_subelement, "universes")
|
||||
universes.text = '\n' + universe_ids
|
||||
|
||||
# Append the XML subelement for this Lattice to the XML element
|
||||
xml_element.append(lattice_subelement)
|
||||
|
||||
def _repr_axial_slice(self, universes):
|
||||
"""Return string representation for the given 2D group of universes.
|
||||
|
||||
The 'universes' argument should be a list of lists of universes where
|
||||
each sub-list represents a single ring. The first list should be the
|
||||
outer ring.
|
||||
"""
|
||||
|
||||
# Find the largest universe ID and count the number of digits so we can
|
||||
# properly pad the output string later.
|
||||
largest_id = max([max([univ._id for univ in ring])
|
||||
for ring in universes])
|
||||
n_digits = len(str(largest_id))
|
||||
pad = ' '*n_digits
|
||||
id_form = '{: ^' + str(n_digits) + 'd}'
|
||||
|
||||
# Initialize the list for each row.
|
||||
rows = [[] for i in range(1 + 4 * (self._num_rings-1))]
|
||||
middle = 2 * (self._num_rings - 1)
|
||||
|
||||
# Start with the degenerate first ring.
|
||||
universe = universes[-1][0]
|
||||
rows[middle] = [id_form.format(universe._id)]
|
||||
|
||||
# Add universes one ring at a time.
|
||||
for r in range(1, self._num_rings):
|
||||
# r_prime increments down while r increments up.
|
||||
r_prime = self._num_rings - 1 - r
|
||||
theta = 0
|
||||
y = middle + 2*r
|
||||
|
||||
# Climb down the top-right.
|
||||
for i in range(r):
|
||||
# Add the universe.
|
||||
universe = universes[r_prime][theta]
|
||||
rows[y].append(id_form.format(universe._id))
|
||||
|
||||
# Translate the indices.
|
||||
y -= 1
|
||||
theta += 1
|
||||
|
||||
# Climb down the right.
|
||||
for i in range(r):
|
||||
# Add the universe.
|
||||
universe = universes[r_prime][theta]
|
||||
rows[y].append(id_form.format(universe._id))
|
||||
|
||||
# Translate the indices.
|
||||
y -= 2
|
||||
theta += 1
|
||||
|
||||
# Climb down the bottom-right.
|
||||
for i in range(r):
|
||||
# Add the universe.
|
||||
universe = universes[r_prime][theta]
|
||||
rows[y].append(id_form.format(universe._id))
|
||||
|
||||
# Translate the indices.
|
||||
y -= 1
|
||||
theta += 1
|
||||
|
||||
# Climb up the bottom-left.
|
||||
for i in range(r):
|
||||
# Add the universe.
|
||||
universe = universes[r_prime][theta]
|
||||
rows[y].insert(0, id_form.format(universe._id))
|
||||
|
||||
# Translate the indices.
|
||||
y += 1
|
||||
theta += 1
|
||||
|
||||
# Climb up the left.
|
||||
for i in range(r):
|
||||
# Add the universe.
|
||||
universe = universes[r_prime][theta]
|
||||
rows[y].insert(0, id_form.format(universe._id))
|
||||
|
||||
# Translate the indices.
|
||||
y += 2
|
||||
theta += 1
|
||||
|
||||
# Climb up the top-left.
|
||||
for i in range(r):
|
||||
# Add the universe.
|
||||
universe = universes[r_prime][theta]
|
||||
rows[y].insert(0, id_form.format(universe._id))
|
||||
|
||||
# Translate the indices.
|
||||
y += 1
|
||||
theta += 1
|
||||
|
||||
# Flip the rows and join each row into a single string.
|
||||
rows = [pad.join(x) for x in rows[::-1]]
|
||||
|
||||
# Pad the beginning of the rows so they line up properly.
|
||||
for y in range(self._num_rings - 1):
|
||||
rows[y] = (self._num_rings - 1 - y)*pad + rows[y]
|
||||
rows[-1 - y] = (self._num_rings - 1 - y)*pad + rows[-1 - y]
|
||||
|
||||
for y in range(self._num_rings % 2, self._num_rings, 2):
|
||||
rows[middle + y] = pad + rows[middle + y]
|
||||
if y != 0:
|
||||
rows[middle - y] = pad + rows[middle - y]
|
||||
|
||||
# Join the rows together and return the string.
|
||||
universe_ids = '\n'.join(rows)
|
||||
return universe_ids
|
||||
|
|
@ -8,7 +8,7 @@ if sys.version_info[0] >= 3:
|
|||
basestring = str
|
||||
|
||||
import openmc
|
||||
from openmc.checkvalue import check_type, check_value, check_greater_than
|
||||
import openmc.checkvalue as cv
|
||||
from openmc.clean_xml import *
|
||||
|
||||
|
||||
|
|
@ -25,9 +25,6 @@ def reset_auto_material_id():
|
|||
DENSITY_UNITS = ['g/cm3', 'g/cc', 'kg/cm3', 'atom/b-cm', 'atom/cm3', 'sum',
|
||||
'macro']
|
||||
|
||||
# Constant for density when not needed
|
||||
NO_DENSITY = 99999.
|
||||
|
||||
|
||||
class Material(object):
|
||||
"""A material composed of a collection of nuclides/elements that can be
|
||||
|
|
@ -141,9 +138,9 @@ class Material(object):
|
|||
string += '{0: <16}\n'.format('\tElements')
|
||||
|
||||
for element in self._elements:
|
||||
percent = self._nuclides[element][1]
|
||||
percent_type = self._nuclides[element][2]
|
||||
string += '{0: >16}'.format('\t{0}'.format(element))
|
||||
percent = self._elements[element][1]
|
||||
percent_type = self._elements[element][2]
|
||||
string += '{0: <16}'.format('\t{0}'.format(element))
|
||||
string += '=\t{0: <12} [{1}]\n'.format(percent, percent_type)
|
||||
|
||||
return string
|
||||
|
|
@ -205,38 +202,38 @@ class Material(object):
|
|||
self._id = AUTO_MATERIAL_ID
|
||||
AUTO_MATERIAL_ID += 1
|
||||
else:
|
||||
check_type('material ID', material_id, Integral)
|
||||
check_greater_than('material ID', material_id, 0, equality=True)
|
||||
cv.check_type('material ID', material_id, Integral)
|
||||
cv.check_greater_than('material ID', material_id, 0, equality=True)
|
||||
self._id = material_id
|
||||
|
||||
@name.setter
|
||||
def name(self, name):
|
||||
if name is not None:
|
||||
check_type('name for Material ID="{0}"'.format(self._id),
|
||||
name, basestring)
|
||||
cv.check_type('name for Material ID="{0}"'.format(self._id),
|
||||
name, basestring)
|
||||
self._name = name
|
||||
else:
|
||||
self._name = ''
|
||||
|
||||
def set_density(self, units, density=NO_DENSITY):
|
||||
def set_density(self, units, density=None):
|
||||
"""Set the density of the material
|
||||
|
||||
Parameters
|
||||
----------
|
||||
units : str
|
||||
Physical units of density
|
||||
units : {'g/cm3', 'g/cc', 'km/cm3', 'atom/b-cm', 'atom/cm3', 'sum', 'macro'}
|
||||
Physical units of density.
|
||||
density : float, optional
|
||||
Value of the density. Must be specified unless units is given as
|
||||
'sum'.
|
||||
|
||||
"""
|
||||
|
||||
check_type('the density for Material ID="{0}"'.format(self._id),
|
||||
density, Real)
|
||||
check_value('density units', units, DENSITY_UNITS)
|
||||
cv.check_type('the density for Material ID="{0}"'.format(self._id),
|
||||
density, Real)
|
||||
cv.check_value('density units', units, DENSITY_UNITS)
|
||||
|
||||
if density == NO_DENSITY and units is not 'sum':
|
||||
msg = 'Unable to set the density Material ID="{0}" ' \
|
||||
if density is None and units is not 'sum':
|
||||
msg = 'Unable to set the density for Material ID="{0}" ' \
|
||||
'because a density must be set when not using ' \
|
||||
'sum unit'.format(self._id)
|
||||
raise ValueError(msg)
|
||||
|
|
@ -270,11 +267,11 @@ class Material(object):
|
|||
|
||||
Parameters
|
||||
----------
|
||||
nuclide : str or openmc.nuclide.Nuclide
|
||||
nuclide : str or openmc.Nuclide
|
||||
Nuclide to add
|
||||
percent : float
|
||||
Atom or weight percent
|
||||
percent_type : str
|
||||
percent_type : {'ao', 'wo'}
|
||||
'ao' for atom percent and 'wo' for weight percent
|
||||
|
||||
"""
|
||||
|
|
@ -284,7 +281,7 @@ class Material(object):
|
|||
'macroscopic data-set has already been added'.format(self._id)
|
||||
raise ValueError(msg)
|
||||
|
||||
if not isinstance(nuclide, (openmc.Nuclide, str)):
|
||||
if not isinstance(nuclide, (openmc.Nuclide, basestring)):
|
||||
msg = 'Unable to add a Nuclide to Material ID="{0}" with a ' \
|
||||
'non-Nuclide value "{1}"'.format(self._id, nuclide)
|
||||
raise ValueError(msg)
|
||||
|
|
@ -313,7 +310,7 @@ class Material(object):
|
|||
|
||||
Parameters
|
||||
----------
|
||||
nuclide : openmc.nuclide.Nuclide
|
||||
nuclide : openmc.Nuclide
|
||||
Nuclide to remove
|
||||
|
||||
"""
|
||||
|
|
@ -332,7 +329,7 @@ class Material(object):
|
|||
|
||||
Parameters
|
||||
----------
|
||||
macroscopic : str or Macroscopic
|
||||
macroscopic : str or openmc.Macroscopic
|
||||
Macroscopic to add
|
||||
|
||||
"""
|
||||
|
|
@ -371,7 +368,7 @@ class Material(object):
|
|||
|
||||
Parameters
|
||||
----------
|
||||
macroscopic : Macroscopic
|
||||
macroscopic : openmc.Macroscopic
|
||||
Macroscopic to remove
|
||||
|
||||
"""
|
||||
|
|
@ -390,11 +387,11 @@ class Material(object):
|
|||
|
||||
Parameters
|
||||
----------
|
||||
element : openmc.element.Element
|
||||
element : openmc.Element or str
|
||||
Element to add
|
||||
percent : float
|
||||
Atom or weight percent
|
||||
percent_type : str
|
||||
percent_type : {'ao', 'wo'}
|
||||
'ao' for atom percent and 'wo' for weight percent
|
||||
|
||||
"""
|
||||
|
|
@ -404,7 +401,7 @@ class Material(object):
|
|||
'macroscopic data-set has already been added'.format(self._id)
|
||||
raise ValueError(msg)
|
||||
|
||||
if not isinstance(element, openmc.Element):
|
||||
if not isinstance(element, (openmc.Element, basestring)):
|
||||
msg = 'Unable to add an Element to Material ID="{0}" with a ' \
|
||||
'non-Element value "{1}"'.format(self._id, element)
|
||||
raise ValueError(msg)
|
||||
|
|
@ -420,7 +417,10 @@ class Material(object):
|
|||
raise ValueError(msg)
|
||||
|
||||
# Copy this Element to separate it from same Element in other Materials
|
||||
element = deepcopy(element)
|
||||
if isinstance(element, openmc.Element):
|
||||
element = deepcopy(element)
|
||||
else:
|
||||
element = openmc.Element(element)
|
||||
|
||||
self._elements[element._name] = (element, percent, percent_type)
|
||||
|
||||
|
|
@ -429,7 +429,7 @@ class Material(object):
|
|||
|
||||
Parameters
|
||||
----------
|
||||
element : openmc.element.Element
|
||||
element : openmc.Element
|
||||
Element to remove
|
||||
|
||||
"""
|
||||
|
|
@ -498,7 +498,7 @@ class Material(object):
|
|||
xml_element.set("name", nuclide[0]._name)
|
||||
|
||||
if not distrib:
|
||||
if nuclide[2] is 'ao':
|
||||
if nuclide[2] == 'ao':
|
||||
xml_element.set("ao", str(nuclide[1]))
|
||||
else:
|
||||
xml_element.set("wo", str(nuclide[1]))
|
||||
|
|
@ -525,11 +525,14 @@ class Material(object):
|
|||
xml_element.set("name", str(element[0]._name))
|
||||
|
||||
if not distrib:
|
||||
if element[2] is 'ao':
|
||||
if element[2] == 'ao':
|
||||
xml_element.set("ao", str(element[1]))
|
||||
else:
|
||||
xml_element.set("wo", str(element[1]))
|
||||
|
||||
if element[0].xs is not None:
|
||||
xml_element.set("xs", element[0].xs)
|
||||
|
||||
if not element[0].scattering is None:
|
||||
xml_element.set("scattering", element[0].scattering)
|
||||
|
||||
|
|
@ -639,9 +642,25 @@ class Material(object):
|
|||
return element
|
||||
|
||||
|
||||
class MaterialsFile(object):
|
||||
"""Materials file used for an OpenMC simulation. Corresponds directly to the
|
||||
materials.xml input file.
|
||||
class Materials(cv.CheckedList):
|
||||
"""Collection of Materials used for an OpenMC simulation.
|
||||
|
||||
This class corresponds directly to the materials.xml input file. It can be
|
||||
thought of as a normal Python list where each member is a
|
||||
:class:`Material`. It behaves like a list as the following example
|
||||
demonstrates:
|
||||
|
||||
>>> fuel = openmc.Material()
|
||||
>>> clad = openmc.Material()
|
||||
>>> water = openmc.Material()
|
||||
>>> m = openmc.Materials([fuel])
|
||||
>>> m.append(water)
|
||||
>>> m += [clad]
|
||||
|
||||
Parameters
|
||||
----------
|
||||
materials : Iterable of openmc.Material
|
||||
Materials to add to the collection
|
||||
|
||||
Attributes
|
||||
----------
|
||||
|
|
@ -651,11 +670,12 @@ class MaterialsFile(object):
|
|||
|
||||
"""
|
||||
|
||||
def __init__(self):
|
||||
# Initialize MaterialsFile class attributes
|
||||
self._materials = []
|
||||
def __init__(self, materials=None):
|
||||
super(Materials, self).__init__(Material, 'materials collection')
|
||||
self._default_xs = None
|
||||
self._materials_file = ET.Element("materials")
|
||||
if materials is not None:
|
||||
self += materials
|
||||
|
||||
@property
|
||||
def default_xs(self):
|
||||
|
|
@ -663,63 +683,87 @@ class MaterialsFile(object):
|
|||
|
||||
@default_xs.setter
|
||||
def default_xs(self, xs):
|
||||
check_type('default xs', xs, basestring)
|
||||
cv.check_type('default xs', xs, basestring)
|
||||
self._default_xs = xs
|
||||
|
||||
def add_material(self, material):
|
||||
"""Add a material to the file.
|
||||
"""Append material to collection
|
||||
|
||||
.. deprecated:: 0.8
|
||||
Use :meth:`Materials.append` instead.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
material : Material
|
||||
material : openmc.Material
|
||||
Material to add
|
||||
|
||||
"""
|
||||
|
||||
if not isinstance(material, Material):
|
||||
msg = 'Unable to add a non-Material "{0}" to the ' \
|
||||
'MaterialsFile'.format(material)
|
||||
raise ValueError(msg)
|
||||
|
||||
self._materials.append(material)
|
||||
warnings.warn("Materials.add_material(...) has been deprecated and may be "
|
||||
"removed in a future version. Use Material.append(...) "
|
||||
"instead.", DeprecationWarning)
|
||||
self.append(material)
|
||||
|
||||
def add_materials(self, materials):
|
||||
"""Add multiple materials to the file.
|
||||
"""Add multiple materials to the collection
|
||||
|
||||
.. deprecated:: 0.8
|
||||
Use compound assignment instead.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
materials : tuple or list of Material
|
||||
materials : Iterable of openmc.Material
|
||||
Materials to add
|
||||
|
||||
"""
|
||||
|
||||
if not isinstance(materials, Iterable):
|
||||
msg = 'Unable to create OpenMC materials.xml file from "{0}" which ' \
|
||||
'is not iterable'.format(materials)
|
||||
raise ValueError(msg)
|
||||
|
||||
warnings.warn("Materials.add_materials(...) has been deprecated and may be "
|
||||
"removed in a future version. Use compound assignment "
|
||||
"instead.", DeprecationWarning)
|
||||
for material in materials:
|
||||
self.add_material(material)
|
||||
self.append(material)
|
||||
|
||||
def append(self, material):
|
||||
"""Append material to collection
|
||||
|
||||
Parameters
|
||||
----------
|
||||
material : openmc.Material
|
||||
Material to append
|
||||
|
||||
"""
|
||||
super(Materials, self).append(material)
|
||||
|
||||
def insert(self, index, material):
|
||||
"""Insert material before index
|
||||
|
||||
Parameters
|
||||
----------
|
||||
index : int
|
||||
Index in list
|
||||
material : openmc.Material
|
||||
Material to insert
|
||||
|
||||
"""
|
||||
super(Materials, self).insert(index, material)
|
||||
|
||||
def remove_material(self, material):
|
||||
"""Remove a material from the file
|
||||
|
||||
.. deprecated:: 0.8
|
||||
Use :meth:`Materials.remove` instead.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
material : Material
|
||||
material : openmc.Material
|
||||
Material to remove
|
||||
|
||||
"""
|
||||
|
||||
if not isinstance(material, Material):
|
||||
msg = 'Unable to remove a non-Material "{0}" from the ' \
|
||||
'MaterialsFile'.format(material)
|
||||
raise ValueError(msg)
|
||||
|
||||
self._materials.remove(material)
|
||||
warnings.warn("Materials.remove_material(...) has been deprecated and "
|
||||
"may be removed in a future version. Use "
|
||||
"Materials.remove(...) instead.", DeprecationWarning)
|
||||
self.remove(material)
|
||||
|
||||
def make_isotropic_in_lab(self):
|
||||
for material in self._materials:
|
||||
for material in self:
|
||||
material.make_isotropic_in_lab()
|
||||
|
||||
def _create_material_subelements(self):
|
||||
|
|
@ -727,7 +771,7 @@ class MaterialsFile(object):
|
|||
subelement = ET.SubElement(self._materials_file, "default_xs")
|
||||
subelement.text = self._default_xs
|
||||
|
||||
for material in self._materials:
|
||||
for material in self:
|
||||
xml_element = material.get_material_xml()
|
||||
self._materials_file.append(xml_element)
|
||||
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ class EnergyGroups(object):
|
|||
----------
|
||||
group_edges : Iterable of Real
|
||||
The energy group boundaries [MeV]
|
||||
num_groups : Integral
|
||||
num_groups : int
|
||||
The number of energy groups
|
||||
|
||||
"""
|
||||
|
|
@ -86,7 +86,7 @@ class EnergyGroups(object):
|
|||
|
||||
Parameters
|
||||
----------
|
||||
energy : Real
|
||||
energy : float
|
||||
The energy of interest in MeV
|
||||
|
||||
Returns
|
||||
|
|
@ -115,7 +115,7 @@ class EnergyGroups(object):
|
|||
|
||||
Parameters
|
||||
----------
|
||||
group : Integral
|
||||
group : int
|
||||
The energy group index, starting at 1 for the highest energies
|
||||
|
||||
Returns
|
||||
|
|
@ -153,7 +153,7 @@ class EnergyGroups(object):
|
|||
|
||||
Returns
|
||||
-------
|
||||
ndarray
|
||||
numpy.ndarray
|
||||
The ndarray array indices for each energy group of interest
|
||||
|
||||
Raises
|
||||
|
|
@ -200,7 +200,7 @@ class EnergyGroups(object):
|
|||
|
||||
Returns
|
||||
-------
|
||||
EnergyGroups
|
||||
openmc.mgxs.EnergyGroups
|
||||
A coarsened version of this EnergyGroups object.
|
||||
|
||||
Raises
|
||||
|
|
@ -244,7 +244,7 @@ class EnergyGroups(object):
|
|||
|
||||
Parameters
|
||||
----------
|
||||
other : EnergyGroups
|
||||
other : openmc.mgxs.EnergyGroups
|
||||
EnergyGroups to compare with
|
||||
|
||||
Returns
|
||||
|
|
@ -275,12 +275,12 @@ class EnergyGroups(object):
|
|||
|
||||
Parameters
|
||||
----------
|
||||
other : EnergyGroups
|
||||
other : openmc.mgxs.EnergyGroups
|
||||
EnergyGroups to merge with
|
||||
|
||||
Returns
|
||||
-------
|
||||
merged_groups : EnergyGroups
|
||||
merged_groups : openmc.mgxs.EnergyGroups
|
||||
EnergyGroups resulting from the merge
|
||||
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -53,22 +53,22 @@ class Library(object):
|
|||
The types of cross sections in the library (e.g., ['total', 'scatter'])
|
||||
domain_type : {'material', 'cell', 'distribcell', 'universe'}
|
||||
Domain type for spatial homogenization
|
||||
domains : Iterable of Material, Cell or Universe
|
||||
domains : Iterable of openmc.Material, openmc.Cell or openmc.Universe
|
||||
The spatial domain(s) for which MGXS in the Library are computed
|
||||
correction : 'P0' or None
|
||||
correction : {'P0', None}
|
||||
Apply the P0 correction to scattering matrices if set to 'P0'
|
||||
energy_groups : EnergyGroups
|
||||
energy_groups : openmc.mgxs.EnergyGroups
|
||||
Energy group structure for energy condensation
|
||||
tally_trigger : Trigger
|
||||
tally_trigger : openmc.Trigger
|
||||
An (optional) tally precision trigger given to each tally used to
|
||||
compute the cross section
|
||||
all_mgxs : OrderedDict
|
||||
all_mgxs : collections.OrderedDict
|
||||
MGXS objects keyed by domain ID and cross section type
|
||||
sp_filename : str
|
||||
The filename of the statepoint with tally data used to the
|
||||
compute cross sections
|
||||
keff : Real or None
|
||||
The combined keff from the statepoint file with tally data used to
|
||||
The combined keff from the statepoint file with tally data used to
|
||||
compute cross sections (for eigenvalue calculations only)
|
||||
name : str, optional
|
||||
Name of the multi-group cross section library. Used as a label to
|
||||
|
|
@ -308,7 +308,7 @@ class Library(object):
|
|||
"""
|
||||
|
||||
cv.check_type('sparse', sparse, bool)
|
||||
|
||||
|
||||
# Sparsify or densify each MGXS in the Library
|
||||
for domain in self.domains:
|
||||
for mgxs_type in self.mgxs_types:
|
||||
|
|
@ -350,12 +350,12 @@ class Library(object):
|
|||
def add_to_tallies_file(self, tallies_file, merge=True):
|
||||
"""Add all tallies from all MGXS objects to a tallies file.
|
||||
|
||||
NOTE: This assumes that build_library() has been called
|
||||
NOTE: This assumes that :meth:`Library.build_library` has been called
|
||||
|
||||
Parameters
|
||||
----------
|
||||
tallies_file : openmc.TalliesFile
|
||||
A TalliesFile object to add each MGXS' tallies to generate a
|
||||
tallies_file : openmc.Tallies
|
||||
A Tallies collection to add each MGXS' tallies to generate a
|
||||
"tallies.xml" input file for OpenMC
|
||||
merge : bool
|
||||
Indicate whether tallies should be merged when possible. Defaults
|
||||
|
|
@ -363,14 +363,14 @@ class Library(object):
|
|||
|
||||
"""
|
||||
|
||||
cv.check_type('tallies_file', tallies_file, openmc.TalliesFile)
|
||||
cv.check_type('tallies_file', tallies_file, openmc.Tallies)
|
||||
|
||||
# Add tallies from each MGXS for each domain and mgxs type
|
||||
for domain in self.domains:
|
||||
for mgxs_type in self.mgxs_types:
|
||||
mgxs = self.get_mgxs(domain, mgxs_type)
|
||||
for tally_id, tally in mgxs.tallies.items():
|
||||
tallies_file.add_tally(tally, merge=merge)
|
||||
tallies_file.append(tally, merge=merge)
|
||||
|
||||
def load_from_statepoint(self, statepoint):
|
||||
"""Extracts tallies in an OpenMC StatePoint with the data needed to
|
||||
|
|
@ -537,7 +537,7 @@ class Library(object):
|
|||
|
||||
Returns
|
||||
-------
|
||||
Library
|
||||
openmc.mgxs.Library
|
||||
A new multi-group cross section library averaged across subdomains
|
||||
|
||||
Raises
|
||||
|
|
|
|||
|
|
@ -59,11 +59,11 @@ class MGXS(object):
|
|||
|
||||
Parameters
|
||||
----------
|
||||
domain : Material or Cell or Universe
|
||||
domain : openmc.Material or openmc.Cell or openmc.Universe
|
||||
The domain for spatial homogenization
|
||||
domain_type : {'material', 'cell', 'distribcell', 'universe'}
|
||||
The domain type for spatial homogenization
|
||||
energy_groups : EnergyGroups
|
||||
energy_groups : openmc.mgxs.EnergyGroups
|
||||
The energy group structure for energy condensation
|
||||
by_nuclide : bool
|
||||
If true, computes cross sections for each nuclide in domain
|
||||
|
|
@ -83,26 +83,26 @@ class MGXS(object):
|
|||
Domain for spatial homogenization
|
||||
domain_type : {'material', 'cell', 'distribcell', 'universe'}
|
||||
Domain type for spatial homogenization
|
||||
energy_groups : EnergyGroups
|
||||
energy_groups : openmc.mgxs.EnergyGroups
|
||||
Energy group structure for energy condensation
|
||||
tally_trigger : Trigger
|
||||
tally_trigger : openmc.Trigger
|
||||
An (optional) tally precision trigger given to each tally used to
|
||||
compute the cross section
|
||||
tallies : OrderedDict
|
||||
tallies : collections.OrderedDict
|
||||
OpenMC tallies needed to compute the multi-group cross section
|
||||
rxn_rate_tally : Tally
|
||||
rxn_rate_tally : openmc.Tally
|
||||
Derived tally for the reaction rate tally used in the numerator to
|
||||
compute the multi-group cross section. This attribute is None
|
||||
unless the multi-group cross section has been computed.
|
||||
xs_tally : Tally
|
||||
xs_tally : openmc.Tally
|
||||
Derived tally for the multi-group cross section. This attribute
|
||||
is None unless the multi-group cross section has been computed.
|
||||
num_subdomains : Integral
|
||||
num_subdomains : int
|
||||
The number of subdomains is unity for 'material', 'cell' and 'universe'
|
||||
domain types. When the This is equal to the number of cell instances
|
||||
for 'distribcell' domain types (it is equal to unity prior to loading
|
||||
tally data from a statepoint file).
|
||||
num_nuclides : Integral
|
||||
num_nuclides : int
|
||||
The number of nuclides for which the multi-group cross section is
|
||||
being tracked. This is unity if the by_nuclide attribute is False.
|
||||
nuclides : Iterable of str or 'sum'
|
||||
|
|
@ -334,11 +334,11 @@ class MGXS(object):
|
|||
----------
|
||||
mgxs_type : {'total', 'transport', 'absorption', 'capture', 'fission', 'nu-fission', 'kappa-fission', 'scatter', 'nu-scatter', 'scatter matrix', 'nu-scatter matrix', 'chi'}
|
||||
The type of multi-group cross section object to return
|
||||
domain : Material or Cell or Universe
|
||||
domain : openmc.Material or openmc.Cell or openmc.Universe
|
||||
The domain for spatial homogenization
|
||||
domain_type : {'material', 'cell', 'distribcell', 'universe'}
|
||||
The domain type for spatial homogenization
|
||||
energy_groups : EnergyGroups
|
||||
energy_groups : openmc.mgxs.EnergyGroups
|
||||
The energy group structure for energy condensation
|
||||
by_nuclide : bool
|
||||
If true, computes cross sections for each nuclide in domain.
|
||||
|
|
@ -349,7 +349,7 @@ class MGXS(object):
|
|||
|
||||
Returns
|
||||
-------
|
||||
MGXS
|
||||
openmc.mgxs.MGXS
|
||||
A subclass of the abstract MGXS class for the multi-group cross
|
||||
section type requested by the user
|
||||
|
||||
|
|
@ -412,7 +412,7 @@ class MGXS(object):
|
|||
# Otherwise, return all nuclides in the spatial domain
|
||||
else:
|
||||
nuclides = self.domain.get_all_nuclides()
|
||||
return nuclides.keys()
|
||||
return list(nuclides.keys())
|
||||
|
||||
def get_nuclide_density(self, nuclide):
|
||||
"""Get the atomic number density in units of atoms/b-cm for a nuclide
|
||||
|
|
@ -425,7 +425,7 @@ class MGXS(object):
|
|||
|
||||
Returns
|
||||
-------
|
||||
Real
|
||||
float
|
||||
The atomic number density (atom/b-cm) for the nuclide of interest
|
||||
|
||||
Raises
|
||||
|
|
@ -464,7 +464,7 @@ class MGXS(object):
|
|||
|
||||
Returns
|
||||
-------
|
||||
ndarray of Real
|
||||
numpy.ndarray of float
|
||||
An array of the atomic number densities (atom/b-cm) for each of the
|
||||
nuclides in the spatial domain
|
||||
|
||||
|
|
@ -512,11 +512,11 @@ class MGXS(object):
|
|||
----------
|
||||
scores : Iterable of str
|
||||
Scores for each tally
|
||||
all_filters : Iterable of tuple of Filter
|
||||
all_filters : Iterable of tuple of openmc.Filter
|
||||
Tuples of non-spatial domain filters for each tally
|
||||
keys : Iterable of str
|
||||
Key string used to store each tally in the tallies dictionary
|
||||
estimator : {'analog' or 'tracklength'}
|
||||
estimator : {'analog', 'tracklength'}
|
||||
Type of estimator to use for each tally
|
||||
|
||||
"""
|
||||
|
|
@ -684,7 +684,7 @@ class MGXS(object):
|
|||
|
||||
Returns
|
||||
-------
|
||||
ndarray
|
||||
numpy.ndarray
|
||||
A NumPy array of the multi-group cross section indexed in the order
|
||||
each group, subdomain and nuclide is listed in the parameters.
|
||||
|
||||
|
|
@ -855,7 +855,7 @@ class MGXS(object):
|
|||
|
||||
Returns
|
||||
-------
|
||||
MGXS
|
||||
openmc.mgxs.MGXS
|
||||
A new MGXS averaged across the subdomains of interest
|
||||
|
||||
Raises
|
||||
|
|
@ -907,13 +907,13 @@ class MGXS(object):
|
|||
nuclides : list of str
|
||||
A list of nuclide name strings
|
||||
(e.g., ['U-235', 'U-238']; default is [])
|
||||
groups : list of Integral
|
||||
groups : list of int
|
||||
A list of energy group indices starting at 1 for the high energies
|
||||
(e.g., [1, 2, 3]; default is [])
|
||||
|
||||
Returns
|
||||
-------
|
||||
MGXS
|
||||
openmc.mgxs.MGXS
|
||||
A new tally which encapsulates the subset of data requested for the
|
||||
nuclide(s) and/or energy group(s) requested in the parameters.
|
||||
|
||||
|
|
@ -973,7 +973,7 @@ class MGXS(object):
|
|||
|
||||
Parameters
|
||||
----------
|
||||
other : MGXS
|
||||
other : openmc.mgxs.MGXS
|
||||
MGXS to check for merging
|
||||
|
||||
"""
|
||||
|
|
@ -1010,12 +1010,12 @@ class MGXS(object):
|
|||
|
||||
Parameters
|
||||
----------
|
||||
other : MGXS
|
||||
other : openmc.mgxs.MGXS
|
||||
MGXS to merge with this one
|
||||
|
||||
Returns
|
||||
-------
|
||||
merged_mgxs : MGXS
|
||||
merged_mgxs : openmc.mgxs.MGXS
|
||||
Merged MGXS
|
||||
|
||||
"""
|
||||
|
|
@ -1349,7 +1349,7 @@ class MGXS(object):
|
|||
xs_type='macro', summary=None):
|
||||
"""Build a Pandas DataFrame for the MGXS data.
|
||||
|
||||
This method leverages the Tally.get_pandas_dataframe(...) method, but
|
||||
This method leverages :meth:`openmc.Tally.get_pandas_dataframe`, but
|
||||
renames the columns with terminology appropriate for cross section data.
|
||||
|
||||
Parameters
|
||||
|
|
@ -1366,7 +1366,7 @@ class MGXS(object):
|
|||
xs_type: {'macro', 'micro'}
|
||||
Return macro or micro cross section in units of cm^-1 or barns.
|
||||
Defaults to 'macro'.
|
||||
summary : None or Summary
|
||||
summary : None or openmc.Summary
|
||||
An optional Summary object to be used to construct columns for
|
||||
distribcell tally filters (default is None). The geometric
|
||||
information in the Summary object is embedded into a multi-index
|
||||
|
|
@ -1933,16 +1933,16 @@ class ScatterMatrixXS(MGXS):
|
|||
nuclides : list of str
|
||||
A list of nuclide name strings
|
||||
(e.g., ['U-235', 'U-238']; default is [])
|
||||
in_groups : list of Integral
|
||||
in_groups : list of int
|
||||
A list of incoming energy group indices starting at 1 for the high
|
||||
energies (e.g., [1, 2, 3]; default is [])
|
||||
out_groups : list of Integral
|
||||
out_groups : list of int
|
||||
A list of outgoing energy group indices starting at 1 for the high
|
||||
energies (e.g., [1, 2, 3]; default is [])
|
||||
|
||||
Returns
|
||||
-------
|
||||
MGXS
|
||||
openmc.mgxs.MGXS
|
||||
A new tally which encapsulates the subset of data requested for the
|
||||
nuclide(s) and/or energy group(s) requested in the parameters.
|
||||
|
||||
|
|
@ -2379,12 +2379,12 @@ class Chi(MGXS):
|
|||
|
||||
Parameters
|
||||
----------
|
||||
other : MGXS
|
||||
other : openmc.mgxs.MGXS
|
||||
MGXS to merge with this one
|
||||
|
||||
Returns
|
||||
-------
|
||||
merged_mgxs : MGXS
|
||||
merged_mgxs : openmc.mgxs.MGXS
|
||||
Merged MGXS
|
||||
"""
|
||||
|
||||
|
|
@ -2452,7 +2452,7 @@ class Chi(MGXS):
|
|||
|
||||
Returns
|
||||
-------
|
||||
ndarray
|
||||
numpy.ndarray
|
||||
A NumPy array of the multi-group cross section indexed in the order
|
||||
each group, subdomain and nuclide is listed in the parameters.
|
||||
|
||||
|
|
@ -2560,7 +2560,7 @@ class Chi(MGXS):
|
|||
xs_type='macro', summary=None):
|
||||
"""Build a Pandas DataFrame for the MGXS data.
|
||||
|
||||
This method leverages the Tally.get_pandas_dataframe(...) method, but
|
||||
This method leverages :meth:`openmc.Tally.get_pandas_dataframe`, but
|
||||
renames the columns with terminology appropriate for cross section data.
|
||||
|
||||
Parameters
|
||||
|
|
@ -2577,7 +2577,7 @@ class Chi(MGXS):
|
|||
xs_type: {'macro', 'micro'}
|
||||
Return macro or micro cross section in units of cm^-1 or barns.
|
||||
Defaults to 'macro'.
|
||||
summary : None or Summary
|
||||
summary : None or openmc.Summary
|
||||
An optional Summary object to be used to construct columns for
|
||||
distribcell tally filters (default is None). The geometric
|
||||
information in the Summary object is embedded into a multi-index
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ def ndarray_to_string(arr):
|
|||
|
||||
Parameters
|
||||
----------
|
||||
arr : ndarray
|
||||
arr : numpy.ndarray
|
||||
Array to combine in to a string
|
||||
|
||||
Returns
|
||||
|
|
@ -647,7 +647,7 @@ class XSdata(object):
|
|||
return element
|
||||
|
||||
|
||||
class MGXSLibraryFile(object):
|
||||
class MGXSLibrary(object):
|
||||
"""Multi-Group Cross Sections file used for an OpenMC simulation.
|
||||
Corresponds directly to the MG version of the cross_sections.xml input file.
|
||||
|
||||
|
|
@ -657,12 +657,11 @@ class MGXSLibraryFile(object):
|
|||
Energy group structure.
|
||||
inverse_velocities : Iterable of Real
|
||||
Inverse of velocities, units of sec/cm
|
||||
xsdatas : Iterable of XSdata
|
||||
xsdatas : Iterable of openmc.XSdata
|
||||
Iterable of multi-Group cross section data objects
|
||||
"""
|
||||
|
||||
def __init__(self, energy_groups):
|
||||
# Initialize MGXSLibraryFile class attributes
|
||||
self._xsdatas = []
|
||||
self._energy_groups = energy_groups
|
||||
self._inverse_velocities = None
|
||||
|
|
@ -693,7 +692,7 @@ class MGXSLibraryFile(object):
|
|||
|
||||
Parameters
|
||||
----------
|
||||
xsdata : XSdata
|
||||
xsdata : openmc.XSdata
|
||||
MGXS information to add
|
||||
|
||||
"""
|
||||
|
|
@ -701,12 +700,12 @@ class MGXSLibraryFile(object):
|
|||
# Check the type
|
||||
if not isinstance(xsdata, XSdata):
|
||||
msg = 'Unable to add a non-XSdata "{0}" to the ' \
|
||||
'MGXSLibraryFile'.format(xsdata)
|
||||
'MGXSLibrary instance'.format(xsdata)
|
||||
raise ValueError(msg)
|
||||
|
||||
# Make sure energy groups match.
|
||||
if xsdata.energy_groups != self._energy_groups:
|
||||
msg = 'Energy groups of XSdata do not match that of MGXSLibraryFile!'
|
||||
msg = 'Energy groups of XSdata do not match that of MGXSLibrary.'
|
||||
raise ValueError(msg)
|
||||
|
||||
self._xsdatas.append(xsdata)
|
||||
|
|
@ -716,7 +715,7 @@ class MGXSLibraryFile(object):
|
|||
|
||||
Parameters
|
||||
----------
|
||||
xsdatas : tuple or list of XSdata
|
||||
xsdatas : tuple or list of openmc.XSdata
|
||||
XSdatas to add
|
||||
|
||||
"""
|
||||
|
|
@ -734,14 +733,14 @@ class MGXSLibraryFile(object):
|
|||
|
||||
Parameters
|
||||
----------
|
||||
xsdata : XSdata
|
||||
xsdata : openmc.XSdata
|
||||
XSdata to remove
|
||||
|
||||
"""
|
||||
|
||||
if not isinstance(xsdata, XSdata):
|
||||
msg = 'Unable to remove a non-XSdata "{0}" from the ' \
|
||||
'XSdatasFile'.format(xsdata)
|
||||
'MGXSLibrary instance'.format(xsdata)
|
||||
raise ValueError(msg)
|
||||
|
||||
self._xsdatas.remove(xsdata)
|
||||
|
|
|
|||
|
|
@ -393,9 +393,9 @@ def get_compatible_opencg_surfaces(opencg_surface):
|
|||
surfaces = [left, right, bottom, top]
|
||||
|
||||
elif opencg_surface.type == 'z-squareprism':
|
||||
x0 = opencg_surface.x0['x0']
|
||||
y0 = opencg_surface.y0['y0']
|
||||
R = opencg_surface.r['R']
|
||||
x0 = opencg_surface.x0
|
||||
y0 = opencg_surface.y0
|
||||
R = opencg_surface.r
|
||||
|
||||
# Create a list of the four planes we need
|
||||
left = opencg.XPlane(name=name, boundary=boundary, x0=x0-R)
|
||||
|
|
@ -528,7 +528,7 @@ def get_compatible_opencg_cells(opencg_cell, opencg_surface, halfspace):
|
|||
# Get the compatible Surfaces (XPlanes and YPlanes)
|
||||
compatible_surfaces = get_compatible_opencg_surfaces(opencg_surface)
|
||||
|
||||
opencg_cell.removeSurface(opencg_surface)
|
||||
opencg_cell.remove_surface(opencg_surface)
|
||||
|
||||
# If Cell is inside SquarePrism, add "inside" of Surface halfspaces
|
||||
if halfspace == -1:
|
||||
|
|
@ -595,7 +595,7 @@ def get_compatible_opencg_cells(opencg_cell, opencg_surface, halfspace):
|
|||
|
||||
# Remove redundant Surfaces from the Cells
|
||||
for cell in compatible_cells:
|
||||
cell.removeRedundantSurfaces()
|
||||
cell.remove_redundant_surfaces()
|
||||
|
||||
# Return the list of OpenMC compatible OpenCG Cells
|
||||
return compatible_cells
|
||||
|
|
@ -639,7 +639,7 @@ def make_opencg_cells_compatible(opencg_universe):
|
|||
surface, halfspace)
|
||||
|
||||
# Remove the non-compatible OpenCG Cell from the Universe
|
||||
opencg_universe.removeCell(opencg_cell)
|
||||
opencg_universe.remove_cell(opencg_cell)
|
||||
|
||||
# Add the compatible OpenCG Cells to the Universe
|
||||
opencg_universe.add_cells(cells)
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ from collections import Iterable
|
|||
from numbers import Real, Integral
|
||||
from xml.etree import ElementTree as ET
|
||||
import sys
|
||||
import warnings
|
||||
|
||||
import numpy as np
|
||||
|
||||
|
|
@ -125,7 +126,7 @@ class Plot(object):
|
|||
return self._background
|
||||
|
||||
@property
|
||||
def mask_componenets(self):
|
||||
def mask_components(self):
|
||||
return self._mask_components
|
||||
|
||||
@property
|
||||
|
|
@ -227,7 +228,7 @@ class Plot(object):
|
|||
|
||||
self._col_spec = col_spec
|
||||
|
||||
@mask_componenets.setter
|
||||
@mask_components.setter
|
||||
def mask_components(self, mask_components):
|
||||
cv.check_type('plot mask_components', mask_components, Iterable, Integral)
|
||||
for component in mask_components:
|
||||
|
|
@ -275,7 +276,7 @@ class Plot(object):
|
|||
The random number seed used to generate the color scheme
|
||||
|
||||
"""
|
||||
|
||||
|
||||
cv.check_type('geometry', geometry, openmc.Geometry)
|
||||
cv.check_type('seed', seed, Integral)
|
||||
cv.check_greater_than('seed', seed, 1, equality=True)
|
||||
|
|
@ -401,44 +402,90 @@ class Plot(object):
|
|||
return element
|
||||
|
||||
|
||||
class PlotsFile(object):
|
||||
"""Plots file used for an OpenMC simulation. Corresponds directly to the
|
||||
plots.xml input file.
|
||||
class Plots(cv.CheckedList):
|
||||
"""Collection of Plots used for an OpenMC simulation.
|
||||
|
||||
This class corresponds directly to the plots.xml input file. It can be
|
||||
thought of as a normal Python list where each member is a :class:`Plot`. It
|
||||
behaves like a list as the following example demonstrates:
|
||||
|
||||
>>> xz_plot = openmc.Plot()
|
||||
>>> big_plot = openmc.Plot()
|
||||
>>> small_plot = openmc.Plot()
|
||||
>>> p = openmc.Plots((xz_plot, big_plot))
|
||||
>>> p.append(small_plot)
|
||||
>>> small_plot = p.pop()
|
||||
|
||||
Parameters
|
||||
----------
|
||||
plots : Iterable of openmc.Plot
|
||||
Plots to add to the collection
|
||||
|
||||
"""
|
||||
|
||||
def __init__(self):
|
||||
# Initialize PlotsFile class attributes
|
||||
self._plots = []
|
||||
def __init__(self, plots=None):
|
||||
super(Plots, self).__init__(Plot, 'plots collection')
|
||||
self._plots_file = ET.Element("plots")
|
||||
if plots is not None:
|
||||
self += plots
|
||||
|
||||
def add_plot(self, plot):
|
||||
"""Add a plot to the file.
|
||||
|
||||
.. deprecated:: 0.8
|
||||
Use :meth:`Plots.append` instead.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
plot : Plot
|
||||
plot : openmc.Plot
|
||||
Plot to add
|
||||
|
||||
"""
|
||||
warnings.warn("Plots.add_plot(...) has been deprecated and may be "
|
||||
"removed in a future version. Use Plots.append(...) "
|
||||
"instead.", DeprecationWarning)
|
||||
self.append(plot)
|
||||
|
||||
if not isinstance(plot, Plot):
|
||||
msg = 'Unable to add a non-Plot "{0}" to the PlotsFile'.format(plot)
|
||||
raise ValueError(msg)
|
||||
def append(self, plot):
|
||||
"""Append plot to collection
|
||||
|
||||
self._plots.append(plot)
|
||||
Parameters
|
||||
----------
|
||||
plot : openmc.Plot
|
||||
Plot to append
|
||||
|
||||
"""
|
||||
super(Plots, self).append(plot)
|
||||
|
||||
def insert(self, index, plot):
|
||||
"""Insert plot before index
|
||||
|
||||
Parameters
|
||||
----------
|
||||
index : int
|
||||
Index in list
|
||||
plot : openmc.Plot
|
||||
Plot to insert
|
||||
|
||||
"""
|
||||
super(Plots, self).insert(index, plot)
|
||||
|
||||
def remove_plot(self, plot):
|
||||
"""Remove a plot from the file.
|
||||
|
||||
.. deprecated:: 0.8
|
||||
Use :meth:`Plots.remove` instead.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
plot : Plot
|
||||
plot : openmc.Plot
|
||||
Plot to remove
|
||||
|
||||
"""
|
||||
|
||||
self._plots.remove(plot)
|
||||
warnings.warn("Plots.remove_plot(...) has been deprecated and may be "
|
||||
"removed in a future version. Use Plots.remove(...) "
|
||||
"instead.", DeprecationWarning)
|
||||
self.remove(plot)
|
||||
|
||||
def colorize(self, geometry, seed=1):
|
||||
"""Generate a consistent color scheme for each domain in each plot.
|
||||
|
|
@ -456,7 +503,7 @@ class PlotsFile(object):
|
|||
|
||||
"""
|
||||
|
||||
for plot in self._plots:
|
||||
for plot in self:
|
||||
plot.colorize(geometry, seed)
|
||||
|
||||
|
||||
|
|
@ -482,11 +529,11 @@ class PlotsFile(object):
|
|||
|
||||
"""
|
||||
|
||||
for plot in self._plots:
|
||||
for plot in self:
|
||||
plot.highlight_domains(geometry, domains, seed, alpha, background)
|
||||
|
||||
def _create_plot_subelements(self):
|
||||
for plot in self._plots:
|
||||
for plot in self:
|
||||
xml_element = plot.get_plot_xml()
|
||||
|
||||
if len(plot._name) > 0:
|
||||
|
|
|
|||
|
|
@ -9,10 +9,11 @@ from openmc.checkvalue import check_type
|
|||
class Region(object):
|
||||
"""Region of space that can be assigned to a cell.
|
||||
|
||||
Region is an abstract base class that is inherited by Halfspace,
|
||||
Intersection, Union, and Complement. Each of those respective classes are
|
||||
typically not instantiated directly but rather are created through operators
|
||||
of the Surface and Region classes.
|
||||
Region is an abstract base class that is inherited by
|
||||
:class:`openmc.Halfspace`, :class:`openmc.Intersection`,
|
||||
:class:`openmc.Union`, and :class:`openmc.Complement`. Each of those
|
||||
respective classes are typically not instantiated directly but rather are
|
||||
created through operators of the Surface and Region classes.
|
||||
|
||||
"""
|
||||
|
||||
|
|
@ -201,11 +202,11 @@ class Intersection(Region):
|
|||
"""Intersection of two or more regions.
|
||||
|
||||
Instances of Intersection are generally created via the __and__ operator
|
||||
applied to two instances of Region. This is illustrated in the following
|
||||
example:
|
||||
applied to two instances of :class:`openmc.Region`. This is illustrated in
|
||||
the following example:
|
||||
|
||||
>>> equator = openmc.surface.ZPlane(z0=0.0)
|
||||
>>> earth = openmc.surface.Sphere(R=637.1e6)
|
||||
>>> equator = openmc.ZPlane(z0=0.0)
|
||||
>>> earth = openmc.Sphere(R=637.1e6)
|
||||
>>> northern_hemisphere = -earth & +equator
|
||||
>>> southern_hemisphere = -earth & -equator
|
||||
>>> type(northern_hemisphere)
|
||||
|
|
@ -213,12 +214,12 @@ class Intersection(Region):
|
|||
|
||||
Parameters
|
||||
----------
|
||||
*nodes
|
||||
\*nodes
|
||||
Regions to take the intersection of
|
||||
|
||||
Attributes
|
||||
----------
|
||||
nodes : tuple of Region
|
||||
nodes : tuple of openmc.Region
|
||||
Regions to take the intersection of
|
||||
bounding_box : tuple of numpy.array
|
||||
Lower-left and upper-right coordinates of an axis-aligned bounding box
|
||||
|
|
@ -255,21 +256,22 @@ class Union(Region):
|
|||
"""Union of two or more regions.
|
||||
|
||||
Instances of Union are generally created via the __or__ operator applied to
|
||||
two instances of Region. This is illustrated in the following example:
|
||||
two instances of :class:`openmc.Region`. This is illustrated in the
|
||||
following example:
|
||||
|
||||
>>> s1 = openmc.surface.ZPlane(z0=0.0)
|
||||
>>> s2 = openmc.surface.Sphere(R=637.1e6)
|
||||
>>> s1 = openmc.ZPlane(z0=0.0)
|
||||
>>> s2 = openmc.Sphere(R=637.1e6)
|
||||
>>> type(-s2 | +s1)
|
||||
<class 'openmc.region.Union'>
|
||||
|
||||
Parameters
|
||||
----------
|
||||
*nodes
|
||||
\*nodes
|
||||
Regions to take the union of
|
||||
|
||||
Attributes
|
||||
----------
|
||||
nodes : tuple of Region
|
||||
nodes : tuple of openmc.Region
|
||||
Regions to take the union of
|
||||
bounding_box : tuple of numpy.array
|
||||
Lower-left and upper-right coordinates of an axis-aligned bounding box
|
||||
|
|
@ -305,13 +307,13 @@ class Union(Region):
|
|||
class Complement(Region):
|
||||
"""Complement of a region.
|
||||
|
||||
The Complement of an existing Region can be created by using the __invert__
|
||||
operator as the following example demonstrates:
|
||||
The Complement of an existing :class:`openmc.Region` can be created by using
|
||||
the __invert__ operator as the following example demonstrates:
|
||||
|
||||
>>> xl = openmc.surface.XPlane(x0=-10.0)
|
||||
>>> xr = openmc.surface.XPlane(x0=10.0)
|
||||
>>> yl = openmc.surface.YPlane(y0=-10.0)
|
||||
>>> yr = openmc.surface.YPlane(y0=10.0)
|
||||
>>> xl = openmc.XPlane(x0=-10.0)
|
||||
>>> xr = openmc.XPlane(x0=10.0)
|
||||
>>> yl = openmc.YPlane(y0=-10.0)
|
||||
>>> yr = openmc.YPlane(y0=10.0)
|
||||
>>> inside_box = +xl & -xr & +yl & -yl
|
||||
>>> outside_box = ~inside_box
|
||||
>>> type(outside_box)
|
||||
|
|
@ -319,12 +321,12 @@ class Complement(Region):
|
|||
|
||||
Parameters
|
||||
----------
|
||||
node : Region
|
||||
node : openmc.Region
|
||||
Region to take the complement of
|
||||
|
||||
Attributes
|
||||
----------
|
||||
node : Region
|
||||
node : openmc.Region
|
||||
Regions to take the complement of
|
||||
bounding_box : tuple of numpy.array
|
||||
Lower-left and upper-right coordinates of an axis-aligned bounding box
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ if sys.version_info[0] >= 3:
|
|||
basestring = str
|
||||
|
||||
|
||||
class SettingsFile(object):
|
||||
class Settings(object):
|
||||
"""Settings file used for an OpenMC simulation. Corresponds directly to the
|
||||
settings.xml input file.
|
||||
|
||||
|
|
@ -38,7 +38,7 @@ class SettingsFile(object):
|
|||
type are 'variance', 'std_dev', and 'rel_err'. The threshold value
|
||||
should be a float indicating the variance, standard deviation, or
|
||||
relative error used.
|
||||
source : Iterable of openmc.source.Source
|
||||
source : Iterable of openmc.Source
|
||||
Distribution of source sites in space, angle, and energy
|
||||
output : dict
|
||||
Dictionary indicating what files to output. Valid keys are 'summary',
|
||||
|
|
@ -1125,19 +1125,19 @@ class ResonanceScattering(object):
|
|||
|
||||
Attributes
|
||||
----------
|
||||
nuclide : openmc.nuclide.Nuclide
|
||||
nuclide : openmc.Nuclide
|
||||
The nuclide affected by this resonance scattering treatment.
|
||||
nuclide_0K : openmc.nuclide.Nuclide
|
||||
nuclide_0K : openmc.Nuclide
|
||||
This should be the same isotope as the nuclide attribute above, but it
|
||||
should have an xs attribute that identifies 0 Kelvin data.
|
||||
method : str
|
||||
The method used to sample outgoing scattering energies. Valid options
|
||||
are 'ARES', 'CXS' (constant cross section), 'DBRC' (Doppler broadening
|
||||
rejection correction), and 'WCM' (weight correction method).
|
||||
E_min : Real
|
||||
E_min : float
|
||||
The minimum energy above which the specified method is applied. By
|
||||
default, CXS will be used below E_min.
|
||||
E_max : Real
|
||||
E_max : float
|
||||
The maximum energy below which the specified method is applied. By
|
||||
default, the asymptotic target-at-rest model is applied above E_max.
|
||||
|
||||
|
|
|
|||
|
|
@ -18,51 +18,51 @@ class StatePoint(object):
|
|||
----------
|
||||
cmfd_on : bool
|
||||
Indicate whether CMFD is active
|
||||
cmfd_balance : ndarray
|
||||
cmfd_balance : numpy.ndarray
|
||||
Residual neutron balance for each batch
|
||||
cmfd_dominance
|
||||
Dominance ratio for each batch
|
||||
cmfd_entropy : ndarray
|
||||
cmfd_entropy : numpy.ndarray
|
||||
Shannon entropy of CMFD fission source for each batch
|
||||
cmfd_indices : ndarray
|
||||
cmfd_indices : numpy.ndarray
|
||||
Number of CMFD mesh cells and energy groups. The first three indices
|
||||
correspond to the x-, y-, and z- spatial directions and the fourth index
|
||||
is the number of energy groups.
|
||||
cmfd_srccmp : ndarray
|
||||
cmfd_srccmp : numpy.ndarray
|
||||
Root-mean-square difference between OpenMC and CMFD fission source for
|
||||
each batch
|
||||
cmfd_src : ndarray
|
||||
cmfd_src : numpy.ndarray
|
||||
CMFD fission source distribution over all mesh cells and energy groups.
|
||||
current_batch : Integral
|
||||
current_batch : int
|
||||
Number of batches simulated
|
||||
date_and_time : str
|
||||
Date and time when simulation began
|
||||
entropy : ndarray
|
||||
entropy : numpy.ndarray
|
||||
Shannon entropy of fission source at each batch
|
||||
gen_per_batch : Integral
|
||||
Number of fission generations per batch
|
||||
global_tallies : ndarray of compound datatype
|
||||
global_tallies : numpy.ndarray of compound datatype
|
||||
Global tallies for k-effective estimates and leakage. The compound
|
||||
datatype has fields 'name', 'sum', 'sum_sq', 'mean', and 'std_dev'.
|
||||
k_combined : list
|
||||
Combined estimator for k-effective and its uncertainty
|
||||
k_col_abs : Real
|
||||
k_col_abs : float
|
||||
Cross-product of collision and absorption estimates of k-effective
|
||||
k_col_tra : Real
|
||||
k_col_tra : float
|
||||
Cross-product of collision and tracklength estimates of k-effective
|
||||
k_abs_tra : Real
|
||||
k_abs_tra : float
|
||||
Cross-product of absorption and tracklength estimates of k-effective
|
||||
k_generation : ndarray
|
||||
k_generation : numpy.ndarray
|
||||
Estimate of k-effective for each batch/generation
|
||||
meshes : dict
|
||||
Dictionary whose keys are mesh IDs and whose values are Mesh objects
|
||||
n_batches : Integral
|
||||
n_batches : int
|
||||
Number of batches
|
||||
n_inactive : Integral
|
||||
n_inactive : int
|
||||
Number of inactive batches
|
||||
n_particles : Integral
|
||||
n_particles : int
|
||||
Number of particles per generation
|
||||
n_realizations : Integral
|
||||
n_realizations : int
|
||||
Number of tally realizations
|
||||
path : str
|
||||
Working directory for simulation
|
||||
|
|
@ -71,9 +71,9 @@ class StatePoint(object):
|
|||
runtime : dict
|
||||
Dictionary whose keys are strings describing various runtime metrics
|
||||
and whose values are time values in seconds.
|
||||
seed : Integral
|
||||
seed : int
|
||||
Pseudorandom number generator seed
|
||||
source : ndarray of compound datatype
|
||||
source : numpy.ndarray of compound datatype
|
||||
Array of source sites. The compound datatype has fields 'wgt', 'xyz',
|
||||
'uvw', and 'E' corresponding to the weight, position, direction, and
|
||||
energy of the source site.
|
||||
|
|
@ -88,7 +88,7 @@ class StatePoint(object):
|
|||
Indicate whether user-defined tallies are present
|
||||
version: tuple of Integral
|
||||
Version of OpenMC
|
||||
summary : None or openmc.summary.Summary
|
||||
summary : None or openmc.Summary
|
||||
A summary object if the statepoint has been linked with a summary file
|
||||
|
||||
"""
|
||||
|
|
@ -504,7 +504,7 @@ class StatePoint(object):
|
|||
|
||||
Returns
|
||||
-------
|
||||
tally : Tally
|
||||
tally : openmc.Tally
|
||||
A tally matching the specified criteria
|
||||
|
||||
Raises
|
||||
|
|
@ -601,7 +601,7 @@ class StatePoint(object):
|
|||
|
||||
Parameters
|
||||
----------
|
||||
summary : Summary
|
||||
summary : openmc.Summary
|
||||
A Summary object.
|
||||
|
||||
Raises
|
||||
|
|
|
|||
|
|
@ -22,12 +22,12 @@ class UnitSphere(object):
|
|||
|
||||
Parameters
|
||||
----------
|
||||
reference_uvw : Iterable of Real
|
||||
reference_uvw : Iterable of float
|
||||
Direction from which polar angle is measured
|
||||
|
||||
Attributes
|
||||
----------
|
||||
reference_uvw : Iterable of Real
|
||||
reference_uvw : Iterable of float
|
||||
Direction from which polar angle is measured
|
||||
|
||||
"""
|
||||
|
|
@ -62,19 +62,19 @@ class PolarAzimuthal(UnitSphere):
|
|||
|
||||
Parameters
|
||||
----------
|
||||
mu : Univariate
|
||||
mu : openmc.stats.Univariate
|
||||
Distribution of the cosine of the polar angle
|
||||
phi : Univariate
|
||||
phi : openmc.stats.Univariate
|
||||
Distribution of the azimuthal angle in radians
|
||||
reference_uvw : Iterable of Real
|
||||
reference_uvw : Iterable of float
|
||||
Direction from which polar angle is measured. Defaults to the positive
|
||||
z-direction.
|
||||
|
||||
Attributes
|
||||
----------
|
||||
mu : Univariate
|
||||
mu : openmc.stats.Univariate
|
||||
Distribution of the cosine of the polar angle
|
||||
phi : Univariate
|
||||
phi : openmc.stats.Univariate
|
||||
Distribution of the azimuthal angle in radians
|
||||
|
||||
"""
|
||||
|
|
@ -142,7 +142,7 @@ class Monodirectional(UnitSphere):
|
|||
|
||||
Parameters
|
||||
----------
|
||||
reference_uvw : Iterable of Real
|
||||
reference_uvw : Iterable of float
|
||||
Direction from which polar angle is measured. Defaults to the positive
|
||||
x-direction.
|
||||
|
||||
|
|
@ -186,20 +186,20 @@ class CartesianIndependent(Spatial):
|
|||
|
||||
Parameters
|
||||
----------
|
||||
x : Univariate
|
||||
x : openmc.stats.Univariate
|
||||
Distribution of x-coordinates
|
||||
y : Univariate
|
||||
y : openmc.stats.Univariate
|
||||
Distribution of y-coordinates
|
||||
z : Univariate
|
||||
z : openmc.stats.Univariate
|
||||
Distribution of z-coordinates
|
||||
|
||||
Attributes
|
||||
----------
|
||||
x : Univariate
|
||||
x : openmc.stats.Univariate
|
||||
Distribution of x-coordinates
|
||||
y : Univariate
|
||||
y : openmc.stats.Univariate
|
||||
Distribution of y-coordinates
|
||||
z : Univariate
|
||||
z : openmc.stats.Univariate
|
||||
Distribution of z-coordinates
|
||||
|
||||
"""
|
||||
|
|
@ -252,9 +252,9 @@ class Box(Spatial):
|
|||
|
||||
Parameters
|
||||
----------
|
||||
lower_left : Iterable of Real
|
||||
lower_left : Iterable of float
|
||||
Lower-left coordinates of cuboid
|
||||
upper_right : Iterable of Real
|
||||
upper_right : Iterable of float
|
||||
Upper-right coordinates of cuboid
|
||||
only_fissionable : bool, optional
|
||||
Whether spatial sites should only be accepted if they occur in
|
||||
|
|
@ -262,9 +262,9 @@ class Box(Spatial):
|
|||
|
||||
Attributes
|
||||
----------
|
||||
lower_left : Iterable of Real
|
||||
lower_left : Iterable of float
|
||||
Lower-left coordinates of cuboid
|
||||
upper_right : Iterable of Real
|
||||
upper_right : Iterable of float
|
||||
Upper-right coordinates of cuboid
|
||||
only_fissionable : bool, optional
|
||||
Whether spatial sites should only be accepted if they occur in
|
||||
|
|
@ -328,12 +328,12 @@ class Point(Spatial):
|
|||
|
||||
Parameters
|
||||
----------
|
||||
xyz : Iterable of Real
|
||||
xyz : Iterable of float
|
||||
Cartesian coordinates of location
|
||||
|
||||
Attributes
|
||||
----------
|
||||
xyz : Iterable of Real
|
||||
xyz : Iterable of float
|
||||
Cartesian coordinates of location
|
||||
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -37,16 +37,16 @@ class Discrete(Univariate):
|
|||
|
||||
Parameters
|
||||
----------
|
||||
x : Iterable of Real
|
||||
x : Iterable of float
|
||||
Values of the random variable
|
||||
p : Iterable of Real
|
||||
p : Iterable of float
|
||||
Discrete probability for each value
|
||||
|
||||
Attributes
|
||||
----------
|
||||
x : Iterable of Real
|
||||
x : Iterable of float
|
||||
Values of the random variable
|
||||
p : Iterable of Real
|
||||
p : Iterable of float
|
||||
Discrete probability for each value
|
||||
|
||||
"""
|
||||
|
|
@ -243,9 +243,9 @@ class Tabular(Univariate):
|
|||
|
||||
Parameters
|
||||
----------
|
||||
x : Iterable of Real
|
||||
x : Iterable of float
|
||||
Tabulated values of the random variable
|
||||
p : Iterable of Real
|
||||
p : Iterable of float
|
||||
Tabulated probabilities
|
||||
interpolation : {'histogram', 'linear-linear'}, optional
|
||||
Indicate whether the density function is constant between tabulated
|
||||
|
|
@ -253,9 +253,9 @@ class Tabular(Univariate):
|
|||
|
||||
Attributes
|
||||
----------
|
||||
x : Iterable of Real
|
||||
x : Iterable of float
|
||||
Tabulated values of the random variable
|
||||
p : Iterable of Real
|
||||
p : Iterable of float
|
||||
Tabulated probabilities
|
||||
interpolation : {'histogram', 'linear-linear'}, optional
|
||||
Indicate whether the density function is constant between tabulated
|
||||
|
|
|
|||
|
|
@ -584,7 +584,7 @@ class Summary(object):
|
|||
|
||||
Returns
|
||||
-------
|
||||
material : openmc.material.Material
|
||||
material : openmc.Material
|
||||
Material with given id
|
||||
|
||||
"""
|
||||
|
|
@ -605,7 +605,7 @@ class Summary(object):
|
|||
|
||||
Returns
|
||||
-------
|
||||
surface : openmc.surface.Surface
|
||||
surface : openmc.Surface
|
||||
Surface with given id
|
||||
|
||||
"""
|
||||
|
|
@ -626,7 +626,7 @@ class Summary(object):
|
|||
|
||||
Returns
|
||||
-------
|
||||
cell : openmc.universe.Cell
|
||||
cell : openmc.Cell
|
||||
Cell with given id
|
||||
|
||||
"""
|
||||
|
|
@ -647,7 +647,7 @@ class Summary(object):
|
|||
|
||||
Returns
|
||||
-------
|
||||
universe : openmc.universe.Universe
|
||||
universe : openmc.Universe
|
||||
Universe with given id
|
||||
|
||||
"""
|
||||
|
|
@ -668,7 +668,7 @@ class Summary(object):
|
|||
|
||||
Returns
|
||||
-------
|
||||
lattice : openmc.universe.Lattice
|
||||
lattice : openmc.Lattice
|
||||
Lattice with given id
|
||||
|
||||
"""
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -51,7 +51,7 @@ class Tally(object):
|
|||
|
||||
Parameters
|
||||
----------
|
||||
tally_id : Integral, optional
|
||||
tally_id : int, optional
|
||||
Unique identifier for the tally. If none is specified, an identifier
|
||||
will automatically be assigned
|
||||
name : str, optional
|
||||
|
|
@ -59,43 +59,43 @@ class Tally(object):
|
|||
|
||||
Attributes
|
||||
----------
|
||||
id : Integral
|
||||
id : int
|
||||
Unique identifier for the tally
|
||||
name : str
|
||||
Name of the tally
|
||||
filters : list of openmc.filter.Filter
|
||||
filters : list of openmc.Filter
|
||||
List of specified filters for the tally
|
||||
nuclides : list of openmc.nuclide.Nuclide
|
||||
nuclides : list of openmc.Nuclide
|
||||
List of nuclides to score results for
|
||||
scores : list of str
|
||||
List of defined scores, e.g. 'flux', 'fission', etc.
|
||||
estimator : {'analog', 'tracklength', 'collision'}
|
||||
Type of estimator for the tally
|
||||
triggers : list of openmc.trigger.Trigger
|
||||
triggers : list of openmc.Trigger
|
||||
List of tally triggers
|
||||
num_scores : Integral
|
||||
num_scores : int
|
||||
Total number of scores, accounting for the fact that a single
|
||||
user-specified score, e.g. scatter-P3 or flux-Y2,2, might have multiple
|
||||
bins
|
||||
num_filter_bins : Integral
|
||||
num_filter_bins : int
|
||||
Total number of filter bins accounting for all filters
|
||||
num_bins : Integral
|
||||
num_bins : int
|
||||
Total number of bins for the tally
|
||||
shape : 3-tuple of Integral
|
||||
shape : 3-tuple of int
|
||||
The shape of the tally data array ordered as the number of filter bins,
|
||||
nuclide bins and score bins
|
||||
num_realizations : Integral
|
||||
num_realizations : int
|
||||
Total number of realizations
|
||||
with_summary : bool
|
||||
Whether or not a Summary has been linked
|
||||
sum : ndarray
|
||||
sum : numpy.ndarray
|
||||
An array containing the sum of each independent realization for each bin
|
||||
sum_sq : ndarray
|
||||
sum_sq : numpy.ndarray
|
||||
An array containing the sum of each independent realization squared for
|
||||
each bin
|
||||
mean : ndarray
|
||||
mean : numpy.ndarray
|
||||
An array containing the sample mean for each bin
|
||||
std_dev : ndarray
|
||||
std_dev : numpy.ndarray
|
||||
An array containing the sample standard deviation for each bin
|
||||
derived : bool
|
||||
Whether or not the tally is derived from one or more other tallies
|
||||
|
|
@ -444,7 +444,7 @@ class Tally(object):
|
|||
|
||||
Parameters
|
||||
----------
|
||||
trigger : openmc.trigger.Trigger
|
||||
trigger : openmc.Trigger
|
||||
Trigger to add
|
||||
|
||||
"""
|
||||
|
|
@ -688,7 +688,7 @@ class Tally(object):
|
|||
|
||||
Parameters
|
||||
----------
|
||||
old_filter : openmc.filter.Filter
|
||||
old_filter : openmc.Filter
|
||||
Filter to remove
|
||||
|
||||
"""
|
||||
|
|
@ -705,7 +705,7 @@ class Tally(object):
|
|||
|
||||
Parameters
|
||||
----------
|
||||
nuclide : openmc.nuclide.Nuclide
|
||||
nuclide : openmc.Nuclide
|
||||
Nuclide to remove
|
||||
|
||||
"""
|
||||
|
|
@ -727,7 +727,7 @@ class Tally(object):
|
|||
|
||||
Parameters
|
||||
----------
|
||||
other : Tally
|
||||
other : openmc.Tally
|
||||
Tally to check for mergeable filters
|
||||
|
||||
"""
|
||||
|
|
@ -780,7 +780,7 @@ class Tally(object):
|
|||
|
||||
Parameters
|
||||
----------
|
||||
other : Tally
|
||||
other : openmc.Tally
|
||||
Tally to check for mergeable nuclides
|
||||
|
||||
"""
|
||||
|
|
@ -817,7 +817,7 @@ class Tally(object):
|
|||
|
||||
Parameters
|
||||
----------
|
||||
other : Tally
|
||||
other : openmc.Tally
|
||||
Tally to check for mergeable scores
|
||||
|
||||
"""
|
||||
|
|
@ -858,7 +858,7 @@ class Tally(object):
|
|||
|
||||
Parameters
|
||||
----------
|
||||
other : Tally
|
||||
other : openmc.Tally
|
||||
Tally to check for merging
|
||||
|
||||
"""
|
||||
|
|
@ -903,12 +903,12 @@ class Tally(object):
|
|||
|
||||
Parameters
|
||||
----------
|
||||
other : Tally
|
||||
other : openmc.Tally
|
||||
Tally to merge with this one
|
||||
|
||||
Returns
|
||||
-------
|
||||
merged_tally : Tally
|
||||
merged_tally : openmc.Tally
|
||||
Merged tallies
|
||||
|
||||
"""
|
||||
|
|
@ -1151,7 +1151,7 @@ class Tally(object):
|
|||
|
||||
Returns
|
||||
-------
|
||||
filter_found : openmc.filter.Filter
|
||||
filter_found : openmc.Filter
|
||||
Filter from this tally with matching type, or None if no matching
|
||||
Filter is found
|
||||
|
||||
|
|
@ -1185,7 +1185,7 @@ class Tally(object):
|
|||
----------
|
||||
filter_type : str
|
||||
The type of Filter (e.g., 'cell', 'energy', etc.)
|
||||
filter_bin : Integral or tuple
|
||||
filter_bin : int or tuple
|
||||
The bin is an integer ID for 'material', 'surface', 'cell',
|
||||
'cellborn', and 'universe' Filters. The bin is an integer for the
|
||||
cell instance ID for 'distribcell' Filters. The bin is a 2-tuple of
|
||||
|
|
@ -1311,7 +1311,7 @@ class Tally(object):
|
|||
|
||||
Returns
|
||||
-------
|
||||
ndarray
|
||||
numpy.ndarray
|
||||
A NumPy array of the filter indices
|
||||
|
||||
"""
|
||||
|
|
@ -1393,7 +1393,7 @@ class Tally(object):
|
|||
|
||||
Returns
|
||||
-------
|
||||
ndarray
|
||||
numpy.ndarray
|
||||
A NumPy array of the nuclide indices
|
||||
|
||||
"""
|
||||
|
|
@ -1427,7 +1427,7 @@ class Tally(object):
|
|||
|
||||
Returns
|
||||
-------
|
||||
ndarray
|
||||
numpy.ndarray
|
||||
A NumPy array of the score indices
|
||||
|
||||
"""
|
||||
|
|
@ -1489,7 +1489,7 @@ class Tally(object):
|
|||
|
||||
Returns
|
||||
-------
|
||||
float or ndarray
|
||||
float or numpy.ndarray
|
||||
A scalar or NumPy array of the Tally data indexed in the order
|
||||
each filter, nuclide and score is listed in the parameters.
|
||||
|
||||
|
|
@ -1557,13 +1557,13 @@ class Tally(object):
|
|||
Include columns with nuclide bin information (default is True).
|
||||
scores : bool
|
||||
Include columns with score bin information (default is True).
|
||||
summary : None or Summary
|
||||
summary : None or openmc.Summary
|
||||
An optional Summary object to be used to construct columns for
|
||||
distribcell tally filters (default is None). The geometric
|
||||
information in the Summary object is embedded into a Multi-index
|
||||
column with a geometric "path" to each distribcell intance.
|
||||
NOTE: This option requires the OpenCG Python package.
|
||||
float_format : string
|
||||
float_format : str
|
||||
All floats in the DataFrame will be formatted using the given
|
||||
format string before printing.
|
||||
|
||||
|
|
@ -1683,8 +1683,8 @@ class Tally(object):
|
|||
|
||||
The tally data in OpenMC is stored as a 3D array with the dimensions
|
||||
corresponding to filters, nuclides and scores. As a result, tally data
|
||||
can be opaque for a user to directly index (i.e., without use of the
|
||||
Tally.get_values(...) method) since one must know how to properly use
|
||||
can be opaque for a user to directly index (i.e., without use of
|
||||
:meth:`openmc.Tally.get_values`) since one must know how to properly use
|
||||
the number of bins and strides for each filter to index into the first
|
||||
(filter) dimension.
|
||||
|
||||
|
|
@ -1704,7 +1704,7 @@ class Tally(object):
|
|||
|
||||
Returns
|
||||
-------
|
||||
ndarray
|
||||
numpy.ndarray
|
||||
The tally data array indexed by filters, nuclides and scores.
|
||||
|
||||
"""
|
||||
|
|
@ -1882,7 +1882,7 @@ class Tally(object):
|
|||
|
||||
Parameters
|
||||
----------
|
||||
other : Tally
|
||||
other : openmc.Tally
|
||||
The tally on the right hand side of the hybrid product
|
||||
binary_op : {'+', '-', '*', '/', '^'}
|
||||
The binary operation in the hybrid product
|
||||
|
|
@ -1904,7 +1904,7 @@ class Tally(object):
|
|||
|
||||
Returns
|
||||
-------
|
||||
Tally
|
||||
openmc.Tally
|
||||
A new Tally that is the hybrid product with this one.
|
||||
|
||||
Raises
|
||||
|
|
@ -2082,7 +2082,7 @@ class Tally(object):
|
|||
|
||||
Parameters
|
||||
----------
|
||||
other : Tally
|
||||
other : openmc.Tally
|
||||
The tally to outer product with this tally
|
||||
filter_product : {'entrywise'}
|
||||
The type of product to be performed between filter data. Currently,
|
||||
|
|
@ -2464,12 +2464,12 @@ class Tally(object):
|
|||
|
||||
Parameters
|
||||
----------
|
||||
other : Tally or Real
|
||||
other : openmc.Tally or float
|
||||
The tally or scalar value to add to this tally
|
||||
|
||||
Returns
|
||||
-------
|
||||
Tally
|
||||
openmc.Tally
|
||||
A new derived tally which is the sum of this tally and the other
|
||||
tally or scalar value in the addition.
|
||||
|
||||
|
|
@ -2536,12 +2536,12 @@ class Tally(object):
|
|||
|
||||
Parameters
|
||||
----------
|
||||
other : Tally or Real
|
||||
other : openmc.Tally or float
|
||||
The tally or scalar value to subtract from this tally
|
||||
|
||||
Returns
|
||||
-------
|
||||
Tally
|
||||
openmc.Tally
|
||||
A new derived tally which is the difference of this tally and the
|
||||
other tally or scalar value in the subtraction.
|
||||
|
||||
|
|
@ -2608,12 +2608,12 @@ class Tally(object):
|
|||
|
||||
Parameters
|
||||
----------
|
||||
other : Tally or Real
|
||||
other : openmc.Tally or float
|
||||
The tally or scalar value to multiply with this tally
|
||||
|
||||
Returns
|
||||
-------
|
||||
Tally
|
||||
openmc.Tally
|
||||
A new derived tally which is the product of this tally and the
|
||||
other tally or scalar value in the multiplication.
|
||||
|
||||
|
|
@ -2680,12 +2680,12 @@ class Tally(object):
|
|||
|
||||
Parameters
|
||||
----------
|
||||
other : Tally or Real
|
||||
other : openmc.Tally or float
|
||||
The tally or scalar value to divide this tally by
|
||||
|
||||
Returns
|
||||
-------
|
||||
Tally
|
||||
openmc.Tally
|
||||
A new derived tally which is the dividend of this tally and the
|
||||
other tally or scalar value in the division.
|
||||
|
||||
|
|
@ -2755,12 +2755,12 @@ class Tally(object):
|
|||
|
||||
Parameters
|
||||
----------
|
||||
power : Tally or Real
|
||||
power : openmc.Tally or float
|
||||
The tally or scalar value exponent
|
||||
|
||||
Returns
|
||||
-------
|
||||
Tally
|
||||
openmc.Tally
|
||||
A new derived tally which is this tally raised to the power of the
|
||||
other tally or scalar value in the exponentiation.
|
||||
|
||||
|
|
@ -2816,12 +2816,12 @@ class Tally(object):
|
|||
|
||||
Parameters
|
||||
----------
|
||||
other : Integer or Real
|
||||
other : float
|
||||
The scalar value to add to this tally
|
||||
|
||||
Returns
|
||||
-------
|
||||
Tally
|
||||
openmc.Tally
|
||||
A new derived tally of this tally added with the scalar value.
|
||||
|
||||
"""
|
||||
|
|
@ -2835,12 +2835,12 @@ class Tally(object):
|
|||
|
||||
Parameters
|
||||
----------
|
||||
other : Integer or Real
|
||||
other : float
|
||||
The scalar value to subtract this tally from
|
||||
|
||||
Returns
|
||||
-------
|
||||
Tally
|
||||
openmc.Tally
|
||||
A new derived tally of this tally subtracted from the scalar value.
|
||||
|
||||
"""
|
||||
|
|
@ -2854,12 +2854,12 @@ class Tally(object):
|
|||
|
||||
Parameters
|
||||
----------
|
||||
other : Integer or Real
|
||||
other : float
|
||||
The scalar value to multiply with this tally
|
||||
|
||||
Returns
|
||||
-------
|
||||
Tally
|
||||
openmc.Tally
|
||||
A new derived tally of this tally multiplied by the scalar value.
|
||||
|
||||
"""
|
||||
|
|
@ -2873,12 +2873,12 @@ class Tally(object):
|
|||
|
||||
Parameters
|
||||
----------
|
||||
other : Integer or Real
|
||||
other : float
|
||||
The scalar value to divide by this tally
|
||||
|
||||
Returns
|
||||
-------
|
||||
Tally
|
||||
openmc.Tally
|
||||
A new derived tally of the scalar value divided by this tally.
|
||||
|
||||
"""
|
||||
|
|
@ -2890,7 +2890,7 @@ class Tally(object):
|
|||
|
||||
Returns
|
||||
-------
|
||||
Tally
|
||||
openmc.Tally
|
||||
A new derived tally which is the absolute value of this tally.
|
||||
|
||||
"""
|
||||
|
|
@ -2904,7 +2904,7 @@ class Tally(object):
|
|||
|
||||
Returns
|
||||
-------
|
||||
Tally
|
||||
openmc.Tally
|
||||
A new derived tally which is the negated value of this tally.
|
||||
|
||||
"""
|
||||
|
|
@ -2946,7 +2946,7 @@ class Tally(object):
|
|||
|
||||
Returns
|
||||
-------
|
||||
Tally
|
||||
openmc.Tally
|
||||
A new tally which encapsulates the subset of data requested in the
|
||||
order each filter, nuclide and score is listed in the parameters.
|
||||
|
||||
|
|
@ -3069,7 +3069,7 @@ class Tally(object):
|
|||
filter_type : str
|
||||
A filter type string (e.g., 'cell', 'energy') corresponding to the
|
||||
filter bins to sum across
|
||||
filter_bins : Iterable of Integral or tuple
|
||||
filter_bins : Iterable of int or tuple
|
||||
A list of the filter bins corresponding to the filter_type parameter
|
||||
Each bin in the list is the integer ID for 'material', 'surface',
|
||||
'cell', 'cellborn', and 'universe' Filters. Each bin is an integer
|
||||
|
|
@ -3087,7 +3087,7 @@ class Tally(object):
|
|||
|
||||
Returns
|
||||
-------
|
||||
Tally
|
||||
openmc.Tally
|
||||
A new tally which encapsulates the sum of data requested.
|
||||
"""
|
||||
|
||||
|
|
@ -3217,7 +3217,7 @@ class Tally(object):
|
|||
filter_type : str
|
||||
A filter type string (e.g., 'cell', 'energy') corresponding to the
|
||||
filter bins to average across
|
||||
filter_bins : Iterable of Integral or tuple
|
||||
filter_bins : Iterable of int or tuple
|
||||
A list of the filter bins corresponding to the filter_type parameter
|
||||
Each bin in the list is the integer ID for 'material', 'surface',
|
||||
'cell', 'cellborn', and 'universe' Filters. Each bin is an integer
|
||||
|
|
@ -3235,7 +3235,7 @@ class Tally(object):
|
|||
|
||||
Returns
|
||||
-------
|
||||
Tally
|
||||
openmc.Tally
|
||||
A new tally which encapsulates the average of data requested.
|
||||
"""
|
||||
|
||||
|
|
@ -3368,7 +3368,7 @@ class Tally(object):
|
|||
|
||||
Returns
|
||||
-------
|
||||
Tally
|
||||
openmc.Tally
|
||||
A new derived Tally with data diagaonalized along the new filter.
|
||||
|
||||
"""
|
||||
|
|
@ -3419,76 +3419,120 @@ class Tally(object):
|
|||
return new_tally
|
||||
|
||||
|
||||
class TalliesFile(object):
|
||||
"""Tallies file used for an OpenMC simulation. Corresponds directly to the
|
||||
tallies.xml input file.
|
||||
class Tallies(cv.CheckedList):
|
||||
"""Collection of Tallies used for an OpenMC simulation.
|
||||
|
||||
This class corresponds directly to the tallies.xml input file. It can be
|
||||
thought of as a normal Python list where each member is a :class:`Tally`. It
|
||||
behaves like a list as the following example demonstrates:
|
||||
|
||||
>>> t1 = openmc.Tally()
|
||||
>>> t2 = openmc.Tally()
|
||||
>>> t3 = openmc.Tally()
|
||||
>>> tallies = openmc.Tallies([t1])
|
||||
>>> tallies.append(t2)
|
||||
>>> tallies += [t3]
|
||||
|
||||
Parameters
|
||||
----------
|
||||
tallies : Iterable of openmc.Tally
|
||||
Tallies to add to the collection
|
||||
|
||||
"""
|
||||
|
||||
def __init__(self):
|
||||
# Initialize TalliesFile class attributes
|
||||
self._tallies = []
|
||||
self._meshes = []
|
||||
def __init__(self, tallies=None):
|
||||
super(Tallies, self).__init__(Tally, 'tallies collection')
|
||||
self._tallies_file = ET.Element("tallies")
|
||||
|
||||
@property
|
||||
def tallies(self):
|
||||
return self._tallies
|
||||
|
||||
@property
|
||||
def meshes(self):
|
||||
return self._meshes
|
||||
if tallies is not None:
|
||||
self += tallies
|
||||
|
||||
def add_tally(self, tally, merge=False):
|
||||
"""Add a tally to the file
|
||||
"""Append tally to collection
|
||||
|
||||
.. deprecated:: 0.8
|
||||
Use :meth:`Tallies.append` instead.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
tally : Tally
|
||||
Tally to add to file
|
||||
|
||||
tally : openmc.Tally
|
||||
Tally to add
|
||||
merge : bool
|
||||
Indicate whether the tally should be merged with an existing tally,
|
||||
if possible. Defaults to False.
|
||||
|
||||
"""
|
||||
warnings.warn("Tallies.add_tally(...) has been deprecated and may be "
|
||||
"removed in a future version. Use Tallies.append(...) "
|
||||
"instead.", DeprecationWarning)
|
||||
self.append(tally, merge)
|
||||
|
||||
def append(self, tally, merge=False):
|
||||
"""Append tally to collection
|
||||
|
||||
Parameters
|
||||
----------
|
||||
tally : openmc.Tally
|
||||
Tally to append
|
||||
merge : bool
|
||||
Indicate whether the tally should be merged with an existing tally,
|
||||
if possible. Defaults to False.
|
||||
|
||||
"""
|
||||
if not isinstance(tally, Tally):
|
||||
msg = 'Unable to add a non-Tally "{0}" to the TalliesFile'.format(tally)
|
||||
raise ValueError(msg)
|
||||
msg = 'Unable to add a non-Tally "{0}" to the Tallies instance'.format(tally)
|
||||
raise TypeError(msg)
|
||||
|
||||
if merge:
|
||||
merged = False
|
||||
|
||||
# Look for a tally to merge with this one
|
||||
for i, tally2 in enumerate(self._tallies):
|
||||
for i, tally2 in enumerate(self):
|
||||
|
||||
# If a mergeable tally is found
|
||||
if tally2.can_merge(tally):
|
||||
# Replace tally 2 with the merged tally
|
||||
merged_tally = tally2.merge(tally)
|
||||
self._tallies[i] = merged_tally
|
||||
self[i] = merged_tally
|
||||
merged = True
|
||||
break
|
||||
|
||||
# If not mergeable tally was found, simply add this tally
|
||||
if not merged:
|
||||
self._tallies.append(tally)
|
||||
super(Tallies, self).append(tally)
|
||||
|
||||
else:
|
||||
self._tallies.append(tally)
|
||||
super(Tallies, self).append(tally)
|
||||
|
||||
def remove_tally(self, tally):
|
||||
"""Remove a tally from the file
|
||||
def insert(self, index, item):
|
||||
"""Insert tally before index
|
||||
|
||||
Parameters
|
||||
----------
|
||||
tally : Tally
|
||||
index : int
|
||||
Index in list
|
||||
item : openmc.Tally
|
||||
Tally to insert
|
||||
|
||||
"""
|
||||
super(Tallies, self).insert(index, item)
|
||||
|
||||
def remove_tally(self, tally):
|
||||
"""Remove a tally from the collection
|
||||
|
||||
.. deprecated:: 0.8
|
||||
Use :meth:`Tallies.remove` instead.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
tally : openmc.Tally
|
||||
Tally to remove
|
||||
|
||||
"""
|
||||
warnings.warn("Tallies.remove_tally(...) has been deprecated and may "
|
||||
"be removed in a future version. Use Tallies.remove(...) "
|
||||
"instead.", DeprecationWarning)
|
||||
|
||||
self._tallies.remove(tally)
|
||||
self.remove(tally)
|
||||
|
||||
def merge_tallies(self):
|
||||
"""Merge any mergeable tallies together. Note that n-way merges are
|
||||
|
|
@ -3496,8 +3540,8 @@ class TalliesFile(object):
|
|||
|
||||
"""
|
||||
|
||||
for i, tally1 in enumerate(self._tallies):
|
||||
for j, tally2 in enumerate(self._tallies):
|
||||
for i, tally1 in enumerate(self):
|
||||
for j, tally2 in enumerate(self):
|
||||
# Do not merge the same tally with itself
|
||||
if i == j:
|
||||
continue
|
||||
|
|
@ -3506,10 +3550,10 @@ class TalliesFile(object):
|
|||
if tally1.can_merge(tally2):
|
||||
# Replace tally 1 with the merged tally
|
||||
merged_tally = tally1.merge(tally2)
|
||||
self._tallies[i] = merged_tally
|
||||
self[i] = merged_tally
|
||||
|
||||
# Remove tally 2 since it is no longer needed
|
||||
self._tallies.pop(j)
|
||||
self.pop(j)
|
||||
|
||||
# Continue iterating from the first loop
|
||||
break
|
||||
|
|
@ -3517,43 +3561,54 @@ class TalliesFile(object):
|
|||
def add_mesh(self, mesh):
|
||||
"""Add a mesh to the file
|
||||
|
||||
.. deprecated:: 0.8
|
||||
Meshes that appear in a tally are automatically added to the
|
||||
collection.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
mesh : openmc.mesh.Mesh
|
||||
mesh : openmc.Mesh
|
||||
Mesh to add to the file
|
||||
|
||||
"""
|
||||
|
||||
if not isinstance(mesh, Mesh):
|
||||
msg = 'Unable to add a non-Mesh "{0}" to the TalliesFile'.format(mesh)
|
||||
raise ValueError(msg)
|
||||
|
||||
self._meshes.append(mesh)
|
||||
warnings.warn("Tallies.add_mesh(...) has been deprecated and may be "
|
||||
"removed in a future version. Meshes that appear in a "
|
||||
"tally are automatically added to the collection.",
|
||||
DeprecationWarning)
|
||||
|
||||
def remove_mesh(self, mesh):
|
||||
"""Remove a mesh from the file
|
||||
|
||||
.. deprecated:: 0.8
|
||||
Meshes do not need to be managed explicitly.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
mesh : openmc.mesh.Mesh
|
||||
mesh : openmc.Mesh
|
||||
Mesh to remove from the file
|
||||
|
||||
"""
|
||||
|
||||
self._meshes.remove(mesh)
|
||||
warnings.warn("Tallies.remove_mesh(...) has been deprecated and may be "
|
||||
"removed in a future version. Meshes do not need to be "
|
||||
"managed explicitly.", DeprecationWarning)
|
||||
|
||||
def _create_tally_subelements(self):
|
||||
for tally in self._tallies:
|
||||
for tally in self:
|
||||
xml_element = tally.get_tally_xml()
|
||||
self._tallies_file.append(xml_element)
|
||||
|
||||
def _create_mesh_subelements(self):
|
||||
for mesh in self._meshes:
|
||||
if len(mesh._name) > 0:
|
||||
self._tallies_file.append(ET.Comment(mesh._name))
|
||||
already_written = set()
|
||||
for tally in self:
|
||||
for f in tally.filters:
|
||||
if f.type == 'mesh' and f.mesh not in already_written:
|
||||
if len(f.mesh.name) > 0:
|
||||
self._tallies_file.append(ET.Comment(f.mesh.name))
|
||||
|
||||
xml_element = mesh.get_mesh_xml()
|
||||
self._tallies_file.append(xml_element)
|
||||
xml_element = f.mesh.get_mesh_xml()
|
||||
self._tallies_file.append(xml_element)
|
||||
already_written.add(f.mesh)
|
||||
|
||||
def export_to_xml(self):
|
||||
"""Create a tallies.xml file that can be used for a simulation.
|
||||
|
|
|
|||
1326
openmc/universe.py
1326
openmc/universe.py
File diff suppressed because it is too large
Load diff
|
|
@ -369,7 +369,7 @@ contains
|
|||
nuc % name = name
|
||||
nuc % awr = awr
|
||||
nuc % kT = kT
|
||||
nuc % zaid = NXS(2)
|
||||
nuc % zaid = listing % zaid
|
||||
end if
|
||||
|
||||
! read all blocks
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ module constants
|
|||
real(8), parameter :: FP_COINCIDENT = 1e-12_8
|
||||
|
||||
! Maximum number of collisions/crossings
|
||||
integer, parameter :: MAX_EVENTS = 10000
|
||||
integer, parameter :: MAX_EVENTS = 1000000
|
||||
integer, parameter :: MAX_SAMPLE = 100000
|
||||
|
||||
! Maximum number of secondary particles created
|
||||
|
|
|
|||
|
|
@ -92,18 +92,22 @@ contains
|
|||
type(NodeList), pointer :: node_scat_list => null()
|
||||
type(NodeList), pointer :: node_source_list => null()
|
||||
|
||||
! Display output message
|
||||
call write_message("Reading settings XML file...", 5)
|
||||
|
||||
! Check if settings.xml exists
|
||||
filename = trim(path_input) // "settings.xml"
|
||||
inquire(FILE=filename, EXIST=file_exists)
|
||||
if (.not. file_exists) then
|
||||
call fatal_error("Settings XML file '" // trim(filename) // "' does not &
|
||||
&exist! In order to run OpenMC, you first need a set of input files;&
|
||||
& at a minimum, this includes settings.xml, geometry.xml, and &
|
||||
&materials.xml. Please consult the user's guide at &
|
||||
&http://mit-crpg.github.io/openmc for further information.")
|
||||
if (run_mode /= MODE_PLOTTING) then
|
||||
call fatal_error("Settings XML file '" // trim(filename) // "' does &
|
||||
¬ exist! In order to run OpenMC, you first need a set of input &
|
||||
&files; at a minimum, this includes settings.xml, geometry.xml, &
|
||||
&and materials.xml. Please consult the user's guide at &
|
||||
&http://mit-crpg.github.io/openmc for further information.")
|
||||
else
|
||||
! The settings.xml file is optional if we just want to make a plot.
|
||||
return
|
||||
end if
|
||||
else
|
||||
call write_message("Reading settings XML file...", 5)
|
||||
end if
|
||||
|
||||
! Parse settings.xml file
|
||||
|
|
|
|||
|
|
@ -52,9 +52,9 @@ contains
|
|||
|
||||
! Write version information
|
||||
write(UNIT=OUTPUT_UNIT, FMT=*) &
|
||||
' Copyright: 2011-2015 Massachusetts Institute of Technology'
|
||||
' Copyright: 2011-2016 Massachusetts Institute of Technology'
|
||||
write(UNIT=OUTPUT_UNIT, FMT=*) &
|
||||
' License: http://mit-crpg.github.io/openmc/license.html'
|
||||
' License: http://openmc.readthedocs.org/en/latest/license.html'
|
||||
write(UNIT=OUTPUT_UNIT, FMT='(6X,"Version:",8X,I1,".",I1,".",I1)') &
|
||||
VERSION_MAJOR, VERSION_MINOR, VERSION_RELEASE
|
||||
#ifdef GIT_SHA1
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
module simulation
|
||||
|
||||
#ifdef MPI
|
||||
use mpi
|
||||
use message_passing
|
||||
#endif
|
||||
|
||||
use cmfd_execute, only: cmfd_init_batch, execute_cmfd
|
||||
|
|
|
|||
|
|
@ -5,9 +5,9 @@ from openmc.stats import Box
|
|||
|
||||
class InputSet(object):
|
||||
def __init__(self):
|
||||
self.settings = openmc.SettingsFile()
|
||||
self.materials = openmc.MaterialsFile()
|
||||
self.geometry = openmc.GeometryFile()
|
||||
self.settings = openmc.Settings()
|
||||
self.materials = openmc.Materials()
|
||||
self.geometry = openmc.Geometry()
|
||||
self.tallies = None
|
||||
self.plots = None
|
||||
|
||||
|
|
@ -267,9 +267,9 @@ class InputSet(object):
|
|||
|
||||
# Define the materials file.
|
||||
self.materials.default_xs = '71c'
|
||||
self.materials.add_materials((fuel, clad, cold_water, hot_water,
|
||||
rpv_steel, lower_rad_ref, upper_rad_ref, bot_plate, bot_nozzle,
|
||||
top_nozzle, top_fa, bot_fa))
|
||||
self.materials += (fuel, clad, cold_water, hot_water, rpv_steel,
|
||||
lower_rad_ref, upper_rad_ref, bot_plate,
|
||||
bot_nozzle, top_nozzle, top_fa, bot_fa)
|
||||
|
||||
# Define surfaces.
|
||||
s1 = openmc.ZCylinder(R=0.41, surface_id=1)
|
||||
|
|
@ -550,11 +550,8 @@ class InputSet(object):
|
|||
|
||||
root.add_cells((c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12))
|
||||
|
||||
# Define the geometry file.
|
||||
geometry = openmc.Geometry()
|
||||
geometry.root_universe = root
|
||||
|
||||
self.geometry.geometry = geometry
|
||||
# Assign root universe to geometry
|
||||
self.geometry.root_universe = root
|
||||
|
||||
def build_default_settings(self):
|
||||
self.settings.batches = 10
|
||||
|
|
@ -593,7 +590,7 @@ class MGInputSet(InputSet):
|
|||
|
||||
# Define the materials file.
|
||||
self.materials.default_xs = '71c'
|
||||
self.materials.add_materials((uo2, clad, water))
|
||||
self.materials += (uo2, clad, water)
|
||||
|
||||
# Define surfaces.
|
||||
|
||||
|
|
@ -630,12 +627,8 @@ class MGInputSet(InputSet):
|
|||
|
||||
root.add_cells((c1,c2,c3))
|
||||
|
||||
# Define the geometry file.
|
||||
geometry = openmc.Geometry()
|
||||
geometry.root_universe = root
|
||||
|
||||
self.geometry.geometry = geometry
|
||||
|
||||
# Assign root universe to geometry
|
||||
self.geometry.root_universe = root
|
||||
|
||||
def build_default_settings(self):
|
||||
self.settings.batches = 10
|
||||
|
|
@ -656,8 +649,3 @@ class MGInputSet(InputSet):
|
|||
plot.color = 'mat'
|
||||
|
||||
self.plots.add_plot(plot)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -300,9 +300,12 @@ if options.list_build_configs:
|
|||
|
||||
# Delete items of dictionary that don't match regular expression
|
||||
if options.build_config is not None:
|
||||
to_delete = []
|
||||
for key in tests:
|
||||
if not re.search(options.build_config, key):
|
||||
del tests[key]
|
||||
to_delete.append(key)
|
||||
for key in to_delete:
|
||||
del tests[key]
|
||||
|
||||
# Check for dashboard and determine whether to push results to server
|
||||
# Note that there are only 3 basic dashboards:
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
b9b4222c4beea80fe6083590f6b785303d174972d80671fb661bac8e030db6f4a61648240cfad6162799361fc0e08a23c61d31aff844d978528d6dad5b5fbc63
|
||||
9b859eb5501c05b6a652d299bd0cadc0a924ffae31117babbdc9f7f8ca87689322c275818eb0dde0ff5fa78317d8d8f1585b18dcc772e3ff4ed499de8a491dc3
|
||||
|
|
@ -1 +1 @@
|
|||
219ee21902e83b0f1b8e92ca4977db998e3a4a5ca36da5be9490f9ec4f30ab90cf15a257fe4113d2f1f9eb85cab159ed65638412b9751ce786d263870c208581
|
||||
bc8bef8121f9b6470e4fea817a4e48eabb1ecba1f42761a4cbd77d71181bf9e1612df4a3d6ddfbcd08a3086ac873e5f3c3e560bf96b2b7c959a2f7aad7e4e08d
|
||||
|
|
@ -7,8 +7,6 @@ import hashlib
|
|||
sys.path.insert(0, os.pardir)
|
||||
from testing_harness import PyAPITestHarness
|
||||
import openmc
|
||||
from openmc.source import Source
|
||||
from openmc.stats import Box
|
||||
|
||||
|
||||
class AsymmetricLatticeTestHarness(PyAPITestHarness):
|
||||
|
|
@ -20,7 +18,7 @@ class AsymmetricLatticeTestHarness(PyAPITestHarness):
|
|||
self._input_set.build_default_materials_and_geometry()
|
||||
|
||||
# Extract universes encapsulating fuel and water assemblies
|
||||
geometry = self._input_set.geometry.geometry
|
||||
geometry = self._input_set.geometry
|
||||
water = geometry.get_universes_by_name('water assembly (hot)')[0]
|
||||
fuel = geometry.get_universes_by_name('fuel assembly (hot)')[0]
|
||||
|
||||
|
|
@ -49,19 +47,18 @@ class AsymmetricLatticeTestHarness(PyAPITestHarness):
|
|||
root_univ.add_cell(root_cell)
|
||||
|
||||
# Over-ride geometry in the input set with this 3x3 lattice
|
||||
self._input_set.geometry.geometry.root_universe = root_univ
|
||||
self._input_set.geometry.root_universe = root_univ
|
||||
|
||||
# Initialize a "distribcell" filter for the fuel pin cell
|
||||
distrib_filter = openmc.Filter(type='distribcell', bins=[27])
|
||||
|
||||
# Initialize the tallies
|
||||
tally = openmc.Tally(name='distribcell tally', tally_id=27)
|
||||
tally.add_filter(distrib_filter)
|
||||
tally.add_score('nu-fission')
|
||||
tally.filters.append(distrib_filter)
|
||||
tally.scores.append('nu-fission')
|
||||
|
||||
# Initialize the tallies file
|
||||
tallies_file = openmc.TalliesFile()
|
||||
tallies_file.add_tally(tally)
|
||||
tallies_file = openmc.Tallies([tally])
|
||||
|
||||
# Assign the tallies file to the input set
|
||||
self._input_set.tallies = tallies_file
|
||||
|
|
@ -70,7 +67,7 @@ class AsymmetricLatticeTestHarness(PyAPITestHarness):
|
|||
self._input_set.build_default_settings()
|
||||
|
||||
# Specify summary output and correct source sampling box
|
||||
source = Source(space=Box([-32, -32, 0], [32, 32, 32]))
|
||||
source = openmc.Source(space=openmc.stats.Box([-32, -32, 0], [32, 32, 32]))
|
||||
source.space.only_fissionable = True
|
||||
self._input_set.settings.source = source
|
||||
self._input_set.settings.output = {'summary': True}
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
401b8be1b296db7f21ccae089c7ac480044d953b7264ca0ae8e34bb79e24cbb57195bcb568deda6f2f7e07366bbfac408a92306351b9169edd04499723707e1b
|
||||
96c54eb4f1da175445bf2187449ee32c9ff435d8c60e9421a4a16497aae9f233e3e494f531892dd55f6ac1a06e0240799503ff19e14e2436a0b0f0d83ba56cb8
|
||||
|
|
@ -28,9 +28,8 @@ class DistribmatTestHarness(PyAPITestHarness):
|
|||
light_fuel.set_density('g/cc', 2.0)
|
||||
light_fuel.add_nuclide('U-235', 1.0)
|
||||
|
||||
mats_file = openmc.MaterialsFile()
|
||||
mats_file = openmc.Materials([moderator, dense_fuel, light_fuel])
|
||||
mats_file.default_xs = '71c'
|
||||
mats_file.add_materials([moderator, dense_fuel, light_fuel])
|
||||
mats_file.export_to_xml()
|
||||
|
||||
|
||||
|
|
@ -74,16 +73,14 @@ class DistribmatTestHarness(PyAPITestHarness):
|
|||
|
||||
geometry = openmc.Geometry()
|
||||
geometry.root_universe = root_univ
|
||||
geo_file = openmc.GeometryFile()
|
||||
geo_file.geometry = geometry
|
||||
geo_file.export_to_xml()
|
||||
geometry.export_to_xml()
|
||||
|
||||
|
||||
####################
|
||||
# Settings
|
||||
####################
|
||||
|
||||
sets_file = openmc.SettingsFile()
|
||||
sets_file = openmc.Settings()
|
||||
sets_file.batches = 5
|
||||
sets_file.inactive = 0
|
||||
sets_file.particles = 1000
|
||||
|
|
@ -96,7 +93,7 @@ class DistribmatTestHarness(PyAPITestHarness):
|
|||
# Plots
|
||||
####################
|
||||
|
||||
plots_file = openmc.PlotsFile()
|
||||
plots_file = openmc.Plots()
|
||||
|
||||
plot = openmc.Plot(plot_id=1)
|
||||
plot.basis = 'xy'
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
k-combined:
|
||||
9.581523E-01 4.261823E-02
|
||||
9.581522E-01 4.261830E-02
|
||||
tally 1:
|
||||
0.000000E+00
|
||||
0.000000E+00
|
||||
|
|
@ -73,8 +73,8 @@ tally 1:
|
|||
0.000000E+00
|
||||
1.149324E-01
|
||||
1.320945E-02
|
||||
2.465049E-02
|
||||
3.049064E-04
|
||||
2.465048E-02
|
||||
3.049063E-04
|
||||
0.000000E+00
|
||||
0.000000E+00
|
||||
0.000000E+00
|
||||
|
|
@ -86,13 +86,13 @@ tally 1:
|
|||
0.000000E+00
|
||||
0.000000E+00
|
||||
7.002118E-02
|
||||
4.902966E-03
|
||||
4.902965E-03
|
||||
5.128548E-01
|
||||
1.258296E-01
|
||||
1.379070E+00
|
||||
4.300261E-01
|
||||
1.040956E+00
|
||||
3.089103E-01
|
||||
3.089102E-01
|
||||
1.237157E+00
|
||||
6.284409E-01
|
||||
9.539296E-01
|
||||
|
|
@ -121,14 +121,14 @@ tally 1:
|
|||
1.597365E-02
|
||||
8.612279E-02
|
||||
5.910825E-03
|
||||
9.004672E-01
|
||||
9.004671E-01
|
||||
2.791173E-01
|
||||
6.485841E+00
|
||||
1.046238E+01
|
||||
6.743595E+00
|
||||
1.135216E+01
|
||||
7.681047E-01
|
||||
1.896253E-01
|
||||
7.681046E-01
|
||||
1.896252E-01
|
||||
0.000000E+00
|
||||
0.000000E+00
|
||||
0.000000E+00
|
||||
|
|
@ -155,7 +155,7 @@ tally 1:
|
|||
2.287801E-01
|
||||
5.651386E-01
|
||||
1.286874E-01
|
||||
5.729904E-01
|
||||
5.729905E-01
|
||||
2.680764E-01
|
||||
5.509254E-01
|
||||
1.200498E-01
|
||||
|
|
@ -185,16 +185,16 @@ tally 1:
|
|||
5.854257E-02
|
||||
2.237774E+00
|
||||
1.109643E+00
|
||||
7.495197E-01
|
||||
7.495196E-01
|
||||
1.939234E-01
|
||||
3.804197E-01
|
||||
1.225870E-01
|
||||
1.009880E-01
|
||||
9.392498E-03
|
||||
9.392497E-03
|
||||
2.424177E+00
|
||||
1.613025E+00
|
||||
2.226123E+00
|
||||
1.203764E+00
|
||||
1.203763E+00
|
||||
1.939766E+00
|
||||
1.132042E+00
|
||||
3.953753E-01
|
||||
|
|
@ -207,7 +207,7 @@ tally 1:
|
|||
0.000000E+00
|
||||
0.000000E+00
|
||||
0.000000E+00
|
||||
2.501130E-02
|
||||
2.501129E-02
|
||||
6.255649E-04
|
||||
3.984785E-01
|
||||
1.486414E-01
|
||||
|
|
@ -233,11 +233,11 @@ tally 1:
|
|||
1.425606E+00
|
||||
1.377786E-01
|
||||
1.716503E-02
|
||||
3.011081E-02
|
||||
9.066609E-04
|
||||
3.011069E-02
|
||||
9.066538E-04
|
||||
0.000000E+00
|
||||
0.000000E+00
|
||||
5.118695E-02
|
||||
5.118696E-02
|
||||
2.620104E-03
|
||||
0.000000E+00
|
||||
0.000000E+00
|
||||
|
|
@ -260,14 +260,14 @@ tally 1:
|
|||
2.560771E-01
|
||||
6.557550E-02
|
||||
9.262861E-03
|
||||
8.580059E-05
|
||||
8.580060E-05
|
||||
2.505905E-01
|
||||
6.279558E-02
|
||||
5.136552E-01
|
||||
2.638417E-01
|
||||
1.441275E+00
|
||||
5.086866E-01
|
||||
2.913900E+00
|
||||
5.086865E-01
|
||||
2.913901E+00
|
||||
1.841912E+00
|
||||
6.978650E-01
|
||||
2.584000E-01
|
||||
|
|
@ -301,7 +301,7 @@ tally 1:
|
|||
1.575534E-01
|
||||
4.033076E-01
|
||||
5.492660E-02
|
||||
4.513269E+00
|
||||
4.513270E+00
|
||||
5.611449E+00
|
||||
1.653243E+00
|
||||
8.369762E-01
|
||||
|
|
@ -318,15 +318,15 @@ tally 1:
|
|||
5.709899E+00
|
||||
7.095076E+00
|
||||
1.194169E+00
|
||||
4.790399E-01
|
||||
4.790398E-01
|
||||
1.420269E-01
|
||||
2.017164E-02
|
||||
2.017163E-02
|
||||
0.000000E+00
|
||||
0.000000E+00
|
||||
3.214463E-01
|
||||
3.214464E-01
|
||||
1.033278E-01
|
||||
2.222164E-02
|
||||
4.938014E-04
|
||||
2.222160E-02
|
||||
4.937996E-04
|
||||
2.028040E-01
|
||||
4.112944E-02
|
||||
1.417427E+00
|
||||
|
|
@ -335,7 +335,7 @@ tally 1:
|
|||
6.697189E-01
|
||||
8.534416E-01
|
||||
2.290345E-01
|
||||
5.367405E+00
|
||||
5.367404E+00
|
||||
6.853344E+00
|
||||
1.237276E+00
|
||||
4.961691E-01
|
||||
|
|
@ -345,14 +345,14 @@ tally 1:
|
|||
1.049542E-01
|
||||
4.235354E+00
|
||||
5.638989E+00
|
||||
2.034494E+00
|
||||
2.034493E+00
|
||||
1.162774E+00
|
||||
1.533605E+00
|
||||
8.644494E-01
|
||||
8.644495E-01
|
||||
4.663027E+00
|
||||
5.641430E+00
|
||||
1.261505E+00
|
||||
7.705207E-01
|
||||
7.705206E-01
|
||||
1.954689E+00
|
||||
9.874394E-01
|
||||
1.449729E-01
|
||||
|
|
@ -364,7 +364,7 @@ tally 1:
|
|||
0.000000E+00
|
||||
0.000000E+00
|
||||
1.398153E-01
|
||||
1.954831E-02
|
||||
1.954832E-02
|
||||
5.089636E-01
|
||||
8.836228E-02
|
||||
1.422521E+00
|
||||
|
|
@ -380,7 +380,7 @@ tally 1:
|
|||
3.267703E-01
|
||||
4.763836E-02
|
||||
1.252153E+00
|
||||
4.563947E-01
|
||||
4.563949E-01
|
||||
1.962807E-01
|
||||
2.410165E-02
|
||||
1.357567E+00
|
||||
|
|
@ -419,7 +419,7 @@ tally 1:
|
|||
0.000000E+00
|
||||
0.000000E+00
|
||||
0.000000E+00
|
||||
3.679763E-01
|
||||
3.679762E-01
|
||||
1.354065E-01
|
||||
5.043842E-02
|
||||
2.544034E-03
|
||||
|
|
@ -502,11 +502,11 @@ tally 1:
|
|||
0.000000E+00
|
||||
0.000000E+00
|
||||
5.208007E-01
|
||||
2.057625E-01
|
||||
2.057626E-01
|
||||
1.050464E+00
|
||||
5.524605E-01
|
||||
7.171592E-02
|
||||
5.143173E-03
|
||||
7.171591E-02
|
||||
5.143172E-03
|
||||
0.000000E+00
|
||||
0.000000E+00
|
||||
0.000000E+00
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -1 +1 @@
|
|||
e0409e0660d58857a6a96ff5cb539ccc41c82f0e443e8081ee00bbee7b6c81b0ad43c870950ae37d4a18c329067b09479a27aa171c3a3f5771f53b384496fe61
|
||||
85faac9b8c725ec9242ebc3793b70dcd1c8e58aeb4296345aefd8031304263bd66eaad0c6f1c61a1c644b73f397699856ab3d76d2b397295176650b4069acc9e
|
||||
|
|
@ -1,2 +1,2 @@
|
|||
k-combined:
|
||||
9.638451E-01 1.237712E-02
|
||||
9.638450E-01 1.237705E-02
|
||||
|
|
|
|||
|
|
@ -1,2 +1,2 @@
|
|||
k-combined:
|
||||
9.581523E-01 4.261823E-02
|
||||
9.581522E-01 4.261830E-02
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
04b4a5099f0097bbe02983c67dea691d0d0d4ece7fb7c264b9b2c29955baa9e870b6fa999480da08ead1e5a0c078ae33ce1b0a5c8594ad465aedf9bf3933e104
|
||||
2fdba76bad058eec6e43657692ef759de79c934076067d4ec5c9f2bdb131877e001f67e16b16bb14889e5e0a1ba84c780979b9d6772573aa6f82d979774c2af8
|
||||
|
|
@ -1 +1 @@
|
|||
322483933c38fe6ecfa41d632c7214b5cd35af4a56415872585914d9c775dc99171e918eebf3221ab6292689c37269b8c3ce5ff85b3633b5c05ee481bf1b212a
|
||||
60a35864ad71646309d7f1687ba0826d4d53a5b2e8babf73614362645205484bad3c0e7bf605ec0b11cadf58474b2e3d0a97bf2d9297f9118682c37ff0269afd
|
||||
|
|
@ -27,7 +27,7 @@ class MGNuclideInputSet(MGInputSet):
|
|||
|
||||
# Define the materials file.
|
||||
self.materials.default_xs = '71c'
|
||||
self.materials.add_materials((uo2, clad, water))
|
||||
self.materials += (uo2, clad, water)
|
||||
|
||||
# Define surfaces.
|
||||
|
||||
|
|
@ -68,7 +68,7 @@ class MGNuclideInputSet(MGInputSet):
|
|||
geometry = openmc.Geometry()
|
||||
geometry.root_universe = root
|
||||
|
||||
self.geometry.geometry = geometry
|
||||
self.geometry = geometry
|
||||
|
||||
class MGMaxOrderTestHarness(PyAPITestHarness):
|
||||
def __init__(self, statepoint_name, tallies_present, mg=False):
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
c9f9e7211bfb2af58130bedfd64592d093b7bfa424953eba433ecf08940595a96b8de7a892f12d1ab465cebd8e5dd784114c1b1299b534ed329df92752c9ed1f
|
||||
0efba3dd7882fdd38756d0a8f01ff00d7a1abdaab6430b3f090f3339e552448453bbb733852b6bd6ff09608d923c282f168320f942fc2eb3a45610873c588734
|
||||
|
|
@ -1,2 +1,2 @@
|
|||
k-combined:
|
||||
1.317412E-01 5.926047E-03
|
||||
1.033731E+00 4.974463E-02
|
||||
|
|
|
|||
|
|
@ -12,21 +12,21 @@ class MGNuclideInputSet(MGInputSet):
|
|||
# Define materials needed for 1D/1G slab problem
|
||||
# This time do using nuclide, not macroscopic
|
||||
uo2 = openmc.Material(name='UO2', material_id=1)
|
||||
uo2.set_density('g/cm3', 1.0)
|
||||
uo2.set_density('sum', 1.0)
|
||||
uo2.add_nuclide("uo2_iso", 1.0)
|
||||
|
||||
clad = openmc.Material(name='Clad', material_id=2)
|
||||
clad.set_density('g/cm3', 1.0)
|
||||
clad.set_density('sum', 1.0)
|
||||
clad.add_nuclide("clad_ang_mu", 1.0)
|
||||
|
||||
water_data = openmc.Nuclide('lwtr_iso_mu', '71c')
|
||||
# water_data = openmc.Nuclide('lwtr_iso_mu', '71c')
|
||||
water = openmc.Material(name='LWTR', material_id=3)
|
||||
water.set_density('g/cm3', 1.0)
|
||||
water.set_density('sum', 1.0)
|
||||
water.add_nuclide("lwtr_iso_mu", 1.0)
|
||||
|
||||
# Define the materials file.
|
||||
self.materials.default_xs = '71c'
|
||||
self.materials.add_materials((uo2, clad, water))
|
||||
self.materials += (uo2, clad, water)
|
||||
|
||||
# Define surfaces.
|
||||
|
||||
|
|
@ -67,7 +67,7 @@ class MGNuclideInputSet(MGInputSet):
|
|||
geometry = openmc.Geometry()
|
||||
geometry.root_universe = root
|
||||
|
||||
self.geometry.geometry = geometry
|
||||
self.geometry = geometry
|
||||
|
||||
class MGNuclideTestHarness(PyAPITestHarness):
|
||||
def __init__(self, statepoint_name, tallies_present, mg=False):
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
ca8490e0e4549fed727ddc75b6d92cfe5162e11b905218a0afaa3ce2ee0763e2ff38074de27aaa678818624f49c5823650475dfa8f66f502a98fc03145399c0d
|
||||
6c437c3f9281c52a80a9b166971aa0f5db7ff8b6cf65c79b6d7bf294fad30cc7044f6a665cd9059f8580441bcbb581f7152ff5bccbc21fbcc407847ea6fe3306
|
||||
|
|
@ -27,24 +27,15 @@ class MGTalliesTestHarness(PyAPITestHarness):
|
|||
mat_filter = openmc.Filter(type='material', bins=[1,2,3])
|
||||
|
||||
tally1 = openmc.Tally(tally_id=1)
|
||||
tally1.add_filter(mesh_filter)
|
||||
tally1.add_score('total')
|
||||
tally1.add_score('absorption')
|
||||
tally1.add_score('flux')
|
||||
tally1.add_score('fission')
|
||||
tally1.add_score('nu-fission')
|
||||
tally1.filters = [mesh_filter]
|
||||
tally1.scores = ['total', 'absorption', 'flux',
|
||||
'fission', 'nu-fission']
|
||||
|
||||
tally2 = openmc.Tally(tally_id=2)
|
||||
tally2.add_filter(mat_filter)
|
||||
tally2.add_filter(energy_filter)
|
||||
tally2.add_filter(energyout_filter)
|
||||
tally2.add_score('scatter')
|
||||
tally2.add_score('nu-scatter')
|
||||
tally2.filters = [mat_filter, energy_filter, energyout_filter]
|
||||
tally2.scores = ['scatter', 'nu-scatter']
|
||||
|
||||
self._input_set.tallies = openmc.TalliesFile()
|
||||
self._input_set.tallies.add_mesh(mesh)
|
||||
self._input_set.tallies.add_tally(tally1)
|
||||
self._input_set.tallies.add_tally(tally2)
|
||||
self._input_set.tallies = openmc.Tallies([tally1, tally2])
|
||||
|
||||
super(MGTalliesTestHarness, self)._build_inputs()
|
||||
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
53b1740921b71e4ead909ab9e4c25f7d43990fe7d7051fde6f66c39c0a6082177385640244010e1b9dbeaf5f34adf1627e9603088af729fadd6b589c19102edc
|
||||
3e7b4ee62e0a53b92d4241f33493786532934f20ebcf47d92825bb1ee2f67c52aa8e7832cf28a9911221f802da205fba2b23c7228899780089da69e21042743c
|
||||
|
|
@ -23,7 +23,7 @@ class MGXSTestHarness(PyAPITestHarness):
|
|||
energy_groups = openmc.mgxs.EnergyGroups(group_edges=[0, 0.625e-6, 20.])
|
||||
|
||||
# Initialize MGXS Library for a few cross section types
|
||||
self.mgxs_lib = openmc.mgxs.Library(self._input_set.geometry.geometry)
|
||||
self.mgxs_lib = openmc.mgxs.Library(self._input_set.geometry)
|
||||
self.mgxs_lib.by_nuclide = False
|
||||
self.mgxs_lib.mgxs_types = ['transport', 'nu-fission',
|
||||
'nu-scatter matrix', 'chi']
|
||||
|
|
@ -32,7 +32,7 @@ class MGXSTestHarness(PyAPITestHarness):
|
|||
self.mgxs_lib.build_library()
|
||||
|
||||
# Initialize a tallies file
|
||||
self._input_set.tallies = openmc.TalliesFile()
|
||||
self._input_set.tallies = openmc.Tallies()
|
||||
self.mgxs_lib.add_to_tallies_file(self._input_set.tallies, merge=False)
|
||||
self._input_set.tallies.export_to_xml()
|
||||
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
224a9e84e87c8a21385326d34ef27c046107d4a2ace6ee85d7a36142a3726e12532e2fc1a318ab707437e0b306a81c6d2b80c531d4c3210d4162242e6265ba70
|
||||
2c078f650fed5fc241f42b2d7404fb7fae59d782102fad66b4cd2c8a4b1f266d64e8ce1ec0556117c2a2b1fe49aa583f340dc43df3ddc9320557aa97bb554c05
|
||||
|
|
@ -24,7 +24,7 @@ class MGXSTestHarness(PyAPITestHarness):
|
|||
|
||||
# Initialize MGXS Library for a few cross section types
|
||||
# for one material-filled cell in the geometry
|
||||
self.mgxs_lib = openmc.mgxs.Library(self._input_set.geometry.geometry)
|
||||
self.mgxs_lib = openmc.mgxs.Library(self._input_set.geometry)
|
||||
self.mgxs_lib.by_nuclide = False
|
||||
self.mgxs_lib.mgxs_types = ['transport', 'nu-fission',
|
||||
'nu-scatter matrix', 'chi']
|
||||
|
|
@ -35,7 +35,7 @@ class MGXSTestHarness(PyAPITestHarness):
|
|||
self.mgxs_lib.build_library()
|
||||
|
||||
# Initialize a tallies file
|
||||
self._input_set.tallies = openmc.TalliesFile()
|
||||
self._input_set.tallies = openmc.Tallies()
|
||||
self.mgxs_lib.add_to_tallies_file(self._input_set.tallies, merge=False)
|
||||
self._input_set.tallies.export_to_xml()
|
||||
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
53b1740921b71e4ead909ab9e4c25f7d43990fe7d7051fde6f66c39c0a6082177385640244010e1b9dbeaf5f34adf1627e9603088af729fadd6b589c19102edc
|
||||
3e7b4ee62e0a53b92d4241f33493786532934f20ebcf47d92825bb1ee2f67c52aa8e7832cf28a9911221f802da205fba2b23c7228899780089da69e21042743c
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue