mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-26 04:55:40 -04:00
Merge branch 'develop' into separate_filters
* develop: (91 commits) Update resonance scattering test result removed additional unnecessary modifications removed unnecessary modifications updated to only modify the _swap_filters method Check for elastic scattering with isotropic mu. changed == to is fixed issue in tallies.py in making sure static copy of other filter gets updated and updated tests fixed bug for misaligned energy and energyout filters When 1 temp is available, revert to nearest temp on all processes added other_old to _swap_filter method fixed tally alignment method in tallies.py Make sure get_pandas_dataframe() works with 1D mesh filter Fix bug with SurfaceFilter bin ordering Check for void materials in tracklength tallies Make sure source is in geometry before fiss. check Make parent class for filters with IDed objects Allow objects in addition to ids in Filters Cleaned up rxn_rate_tally property for consistent scattering matrices Simplified code for xs_tally property for consistent scattering matrices Update inputs for test_diff_tally ... Conflicts: openmc/filter.py src/output.F90
This commit is contained in:
commit
375125c603
230 changed files with 16397 additions and 11457 deletions
39
.gitignore
vendored
39
.gitignore
vendored
|
|
@ -59,16 +59,17 @@ src/cmake_install.cmake
|
|||
src/install_manifest.txt
|
||||
|
||||
# Nuclear data
|
||||
data/nndc
|
||||
data/nndc_hdf5
|
||||
data/wmp
|
||||
data/multipole_lib.tar.gz
|
||||
data/ENDF-B-VII.1-*.tar.gz
|
||||
data/JEFF32-ACE-*.tar.gz
|
||||
data/JEFF32-ACE-*.zip
|
||||
data/TSLs.tar.gz
|
||||
data/jeff-3.2
|
||||
data/jeff-3.2-hdf5
|
||||
scripts/nndc
|
||||
scripts/nndc_hdf5
|
||||
scripts/wmp
|
||||
scripts/multipole_lib.tar.gz
|
||||
scripts/ENDF-B-VII.1-*.tar.gz
|
||||
scripts/JEFF32-ACE-*.tar.gz
|
||||
scripts/JEFF32-ACE-*.zip
|
||||
scripts/TSLs.tar.gz
|
||||
scripts/jeff-3.2
|
||||
scripts/jeff-3.2-hdf5
|
||||
scripts/*.tar.xz
|
||||
|
||||
# Images
|
||||
*.ppm
|
||||
|
|
@ -81,14 +82,16 @@ data/jeff-3.2-hdf5
|
|||
# IPython notebook checkpoints
|
||||
.ipynb_checkpoints
|
||||
|
||||
# Multi-group cross section IPython Notebook
|
||||
docs/source/pythonapi/examples/*.xml
|
||||
docs/source/pythonapi/examples/*.png
|
||||
docs/source/pythonapi/examples/*.xls
|
||||
docs/source/pythonapi/examples/mgxs
|
||||
docs/source/pythonapi/examples/tracks
|
||||
docs/source/pythonapi/examples/fission-rates
|
||||
docs/source/pythonapi/examples/plots
|
||||
# Jupyter notebooks
|
||||
examples/jupyter/*.xml
|
||||
examples/jupyter/*.png
|
||||
examples/jupyter/*.xls
|
||||
examples/jupyter/*.ace
|
||||
examples/jupyter/*.endf
|
||||
examples/jupyter/mgxs
|
||||
examples/jupyter/tracks
|
||||
examples/jupyter/fission-rates
|
||||
examples/jupyter/plots
|
||||
|
||||
# Cython files
|
||||
*.c
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ install: true
|
|||
|
||||
before_script:
|
||||
- if [[ ! -e $HOME/nndc_hdf5/cross_sections.xml ]]; then
|
||||
wget https://anl.box.com/shared/static/oy85y1i3gboho82ifdtjlu1q4ozhd7el.xz -O - | tar -C $HOME -xvJ;
|
||||
wget https://anl.box.com/shared/static/a6sw2cep34wlz6b9i9jwiotaqoayxcxt.xz -O - | tar -C $HOME -xvJ;
|
||||
fi
|
||||
- export OPENMC_CROSS_SECTIONS=$HOME/nndc_hdf5/cross_sections.xml
|
||||
|
||||
|
|
|
|||
|
|
@ -25,14 +25,13 @@ endif()
|
|||
# Command line options
|
||||
#===============================================================================
|
||||
|
||||
option(openmp "Enable shared-memory parallelism with OpenMP" OFF)
|
||||
option(openmp "Enable shared-memory parallelism with OpenMP" ON)
|
||||
option(profile "Compile with profiling flags" OFF)
|
||||
option(debug "Compile with debug flags" OFF)
|
||||
option(optimize "Turn on all compiler optimization flags" OFF)
|
||||
option(coverage "Compile with coverage analysis flags" OFF)
|
||||
option(mpif08 "Use Fortran 2008 MPI interface" OFF)
|
||||
|
||||
|
||||
# Maximum number of nested coordinates levels
|
||||
set(maxcoord 10 CACHE STRING "Maximum number of nested coordinate levels")
|
||||
add_definitions(-DMAX_COORD=${maxcoord})
|
||||
|
|
@ -108,9 +107,11 @@ if(CMAKE_Fortran_COMPILER_ID STREQUAL GNU)
|
|||
endif()
|
||||
|
||||
# GCC compiler options
|
||||
list(APPEND f90flags -cpp -std=f2008 -fbacktrace)
|
||||
list(APPEND cflags -cpp -std=c99)
|
||||
list(APPEND f90flags -cpp -std=f2008 -fbacktrace -O2)
|
||||
list(APPEND cflags -cpp -std=c99 -O2)
|
||||
if(debug)
|
||||
list(REMOVE_ITEM f90flags -O2)
|
||||
list(REMOVE_ITEM cflags -O2)
|
||||
list(APPEND f90flags -g -Wall -pedantic -fbounds-check
|
||||
-ffpe-trap=invalid,overflow,underflow)
|
||||
list(APPEND cflags -g -Wall -pedantic -fbounds-check)
|
||||
|
|
@ -122,6 +123,8 @@ if(CMAKE_Fortran_COMPILER_ID STREQUAL GNU)
|
|||
list(APPEND ldflags -pg)
|
||||
endif()
|
||||
if(optimize)
|
||||
list(REMOVE_ITEM f90flags -O2)
|
||||
list(REMOVE_ITEM cflags -O2)
|
||||
list(APPEND f90flags -O3)
|
||||
list(APPEND cflags -O3)
|
||||
endif()
|
||||
|
|
@ -142,8 +145,8 @@ elseif(CMAKE_Fortran_COMPILER_ID STREQUAL Intel)
|
|||
list(APPEND cflags -std=c99)
|
||||
if(debug)
|
||||
list(APPEND f90flags -g -warn -ftrapuv -fp-stack-check
|
||||
"-check all" -fpe0)
|
||||
list(APPEND cflags -g -w3 -ftrapuv -fp-stack-check)
|
||||
"-check all" -fpe0 -O0)
|
||||
list(APPEND cflags -g -w3 -ftrapuv -fp-stack-check -O0)
|
||||
list(APPEND ldflags -g)
|
||||
endif()
|
||||
if(profile)
|
||||
|
|
@ -182,7 +185,8 @@ elseif(CMAKE_Fortran_COMPILER_ID STREQUAL XL)
|
|||
list(APPEND f90flags -O2)
|
||||
add_definitions(-DNO_F2008)
|
||||
if(debug)
|
||||
list(APPEND f90flags -g -C -qflag=i:i -u)
|
||||
list(REMOVE_ITEM f90flags -O2)
|
||||
list(APPEND f90flags -g -C -qflag=i:i -u -O0)
|
||||
list(APPEND ldflags -g)
|
||||
endif()
|
||||
if(profile)
|
||||
|
|
@ -190,6 +194,7 @@ elseif(CMAKE_Fortran_COMPILER_ID STREQUAL XL)
|
|||
list(APPEND ldflags -p)
|
||||
endif()
|
||||
if(optimize)
|
||||
list(REMOVE_ITEM f90flags -O2)
|
||||
list(APPEND f90flags -O3)
|
||||
endif()
|
||||
if(openmp)
|
||||
|
|
@ -207,6 +212,11 @@ elseif(CMAKE_Fortran_COMPILER_ID STREQUAL Cray)
|
|||
|
||||
endif()
|
||||
|
||||
# Show flags being used
|
||||
message(STATUS "Fortran flags: ${f90flags}")
|
||||
message(STATUS "C flags: ${cflags}")
|
||||
message(STATUS "Linker flags: ${ldflags}")
|
||||
|
||||
#===============================================================================
|
||||
# git SHA1 hash
|
||||
#===============================================================================
|
||||
|
|
@ -225,12 +235,6 @@ endif()
|
|||
#===============================================================================
|
||||
|
||||
add_library(pugixml src/pugixml/pugixml_c.cpp src/pugixml/pugixml.cpp)
|
||||
if(CMAKE_VERSION VERSION_LESS 3.1)
|
||||
target_compile_options(pugixml PRIVATE -std=c++11)
|
||||
else()
|
||||
set_property(TARGET pugixml PROPERTY CXX_STANDARD 11)
|
||||
endif()
|
||||
|
||||
add_library(pugixml_fortran src/pugixml/pugixml_f.F90)
|
||||
target_link_libraries(pugixml_fortran pugixml)
|
||||
|
||||
|
|
|
|||
|
|
@ -25,7 +25,8 @@ except ImportError:
|
|||
|
||||
|
||||
MOCK_MODULES = ['numpy', 'numpy.polynomial', 'numpy.polynomial.polynomial',
|
||||
'h5py', 'pandas', 'uncertainties', 'openmoc']
|
||||
'h5py', 'pandas', 'uncertainties', 'openmoc',
|
||||
'openmc.data.reconstruct']
|
||||
sys.modules.update((mod_name, MagicMock()) for mod_name in MOCK_MODULES)
|
||||
|
||||
import numpy as np
|
||||
|
|
|
|||
|
|
@ -105,15 +105,20 @@ in the tests directory. We recommend to developers to test their branches
|
|||
before submitting a formal pull request using gfortran and Intel compilers
|
||||
if available.
|
||||
|
||||
The test suite is designed to integrate with cmake using ctest_.
|
||||
It is configured to run with cross sections from NNDC_. To
|
||||
download these cross sections please do the following:
|
||||
The test suite is designed to integrate with cmake using ctest_. It is
|
||||
configured to run with cross sections from NNDC_ augmented with 0 K elastic
|
||||
scattering data for select nuclides as well as multipole data. To download the
|
||||
proper data, run the following commands:
|
||||
|
||||
.. code-block:: sh
|
||||
|
||||
cd ../scripts
|
||||
./openmc-get-nndc-data
|
||||
export OPENMC_CROSS_SECTIONS=<path_to_data_folder>/nndc_hdf5/cross_sections.xml
|
||||
wget -O nndc_hdf5.tar.xz $(cat <openmc_root>/.travis.yml | grep anl.box | awk '{print $2}')
|
||||
tar xJvf nndc_hdf5.tar.xz
|
||||
export OPENMC_CROSS_SECTIONS=$(pwd)/nndc_hdf5/cross_sections.xml
|
||||
|
||||
git clone --branch=master git://github.com/smharper/windowed_multipole_library.git wmp_lib
|
||||
tar xzvf wmp_lib/multipole_lib.tar.gz
|
||||
export OPENMC_MULTIPOLE_LIBRARY=$(pwd)/multipole_lib
|
||||
|
||||
The test suite can be run on an already existing build using:
|
||||
|
||||
|
|
|
|||
13
docs/source/examples/candu.rst
Normal file
13
docs/source/examples/candu.rst
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
.. _notebook_candu:
|
||||
|
||||
=======================
|
||||
Modeling a CANDU Bundle
|
||||
=======================
|
||||
|
||||
.. only:: html
|
||||
|
||||
.. notebook:: ../../../examples/jupyter/candu.ipynb
|
||||
|
||||
.. only:: latex
|
||||
|
||||
IPython notebooks must be viewed in the online HTML documentation.
|
||||
|
|
@ -9,19 +9,42 @@ features via the :ref:`pythonapi`.
|
|||
|
||||
.. _Jupyter: https://jupyter.org/
|
||||
|
||||
-----------
|
||||
Basic Usage
|
||||
-----------
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
|
||||
pincell
|
||||
post-processing
|
||||
pandas-dataframes
|
||||
tally-arithmetic
|
||||
search
|
||||
triso
|
||||
candu
|
||||
nuclear-data
|
||||
|
||||
------------------------------------
|
||||
Multi-Group Cross Section Generation
|
||||
------------------------------------
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
|
||||
mgxs-part-i
|
||||
mgxs-part-ii
|
||||
mgxs-part-iii
|
||||
mdgxs-part-i
|
||||
mdgxs-part-ii
|
||||
|
||||
----------------
|
||||
Multi-Group Mode
|
||||
----------------
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
|
||||
mg-mode-part-i
|
||||
mg-mode-part-ii
|
||||
mg-mode-part-iii
|
||||
mdgxs-part-i
|
||||
mdgxs-part-ii
|
||||
search
|
||||
nuclear-data
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ Multi-Group (Delayed) Cross Section Generation Part I: Introduction
|
|||
|
||||
.. only:: html
|
||||
|
||||
.. notebook:: mdgxs-part-i.ipynb
|
||||
.. notebook:: ../../../examples/jupyter/mdgxs-part-i.ipynb
|
||||
|
||||
.. only:: latex
|
||||
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -6,7 +6,7 @@ Multi-Group (Delayed) Cross Section Generation Part II: Advanced Features
|
|||
|
||||
.. only:: html
|
||||
|
||||
.. notebook:: mdgxs-part-ii.ipynb
|
||||
.. notebook:: ../../../examples/jupyter/mdgxs-part-ii.ipynb
|
||||
|
||||
.. only:: latex
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ Multi-Group Mode Part I: Introduction
|
|||
|
||||
.. only:: html
|
||||
|
||||
.. notebook:: mg-mode-part-i.ipynb
|
||||
.. notebook:: ../../../examples/jupyter/mg-mode-part-i.ipynb
|
||||
|
||||
.. only:: latex
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ Multi-Group Mode Part II: MGXS Library Generation With OpenMC
|
|||
|
||||
.. only:: html
|
||||
|
||||
.. notebook:: mg-mode-part-ii.ipynb
|
||||
.. notebook:: ../../../examples/jupyter/mg-mode-part-ii.ipynb
|
||||
|
||||
.. only:: latex
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ Multi-Group Mode Part III: Advanced Feature Showcase
|
|||
|
||||
.. only:: html
|
||||
|
||||
.. notebook:: mg-mode-part-iii.ipynb
|
||||
.. notebook:: ../../../examples/jupyter/mg-mode-part-iii.ipynb
|
||||
|
||||
.. only:: latex
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ MGXS Part I: Introduction
|
|||
|
||||
.. only:: html
|
||||
|
||||
.. notebook:: mgxs-part-i.ipynb
|
||||
.. notebook:: ../../../examples/jupyter/mgxs-part-i.ipynb
|
||||
|
||||
.. only:: latex
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ MGXS Part II: Advanced Features
|
|||
|
||||
.. only:: html
|
||||
|
||||
.. notebook:: mgxs-part-ii.ipynb
|
||||
.. notebook:: ../../../examples/jupyter/mgxs-part-ii.ipynb
|
||||
|
||||
.. only:: latex
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ MGXS Part III: Libraries
|
|||
|
||||
.. only:: html
|
||||
|
||||
.. notebook:: mgxs-part-iii.ipynb
|
||||
.. notebook:: ../../../examples/jupyter/mgxs-part-iii.ipynb
|
||||
|
||||
.. only:: latex
|
||||
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -6,7 +6,7 @@ Nuclear Data
|
|||
|
||||
.. only:: html
|
||||
|
||||
.. notebook:: nuclear-data.ipynb
|
||||
.. notebook:: ../../../examples/jupyter/nuclear-data.ipynb
|
||||
|
||||
.. only:: latex
|
||||
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -1,10 +1,12 @@
|
|||
.. _examples_pandas:
|
||||
|
||||
=================
|
||||
Pandas Dataframes
|
||||
=================
|
||||
|
||||
.. only:: html
|
||||
|
||||
.. notebook:: pandas-dataframes.ipynb
|
||||
.. notebook:: ../../../examples/jupyter/pandas-dataframes.ipynb
|
||||
|
||||
.. only:: latex
|
||||
|
||||
|
|
|
|||
13
docs/source/examples/pincell.rst
Normal file
13
docs/source/examples/pincell.rst
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
.. _notebook_pincell:
|
||||
|
||||
===================
|
||||
Modeling a Pin-Cell
|
||||
===================
|
||||
|
||||
.. only:: html
|
||||
|
||||
.. notebook:: ../../../examples/jupyter/pincell.ipynb
|
||||
|
||||
.. only:: latex
|
||||
|
||||
IPython notebooks must be viewed in the online HTML documentation.
|
||||
|
|
@ -6,7 +6,7 @@ Post Processing
|
|||
|
||||
.. only:: html
|
||||
|
||||
.. notebook:: post-processing.ipynb
|
||||
.. notebook:: ../../../examples/jupyter/post-processing.ipynb
|
||||
|
||||
.. only:: latex
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ Criticality Search
|
|||
|
||||
.. only:: html
|
||||
|
||||
.. notebook:: search.ipynb
|
||||
.. notebook:: ../../../examples/jupyter/search.ipynb
|
||||
|
||||
.. only:: latex
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ Tally Arithmetic
|
|||
|
||||
.. only:: html
|
||||
|
||||
.. notebook:: tally-arithmetic.ipynb
|
||||
.. notebook:: ../../../examples/jupyter/tally-arithmetic.ipynb
|
||||
|
||||
.. only:: latex
|
||||
|
||||
|
|
|
|||
13
docs/source/examples/triso.rst
Normal file
13
docs/source/examples/triso.rst
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
.. _notebook_triso:
|
||||
|
||||
========================
|
||||
Modeling TRISO Particles
|
||||
========================
|
||||
|
||||
.. only:: html
|
||||
|
||||
.. notebook:: ../../../examples/jupyter/triso.ipynb
|
||||
|
||||
.. only:: latex
|
||||
|
||||
IPython notebooks must be viewed in the online HTML documentation.
|
||||
|
|
@ -13,9 +13,7 @@ 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`_. Documentation for
|
||||
the latest developmental version of the develop branch can be found on
|
||||
`Read the Docs`_.
|
||||
free to send a message to the User's Group `mailing list`_.
|
||||
|
||||
.. _Computational Reactor Physics Group: http://crpg.mit.edu
|
||||
.. _Massachusetts Institute of Technology: http://web.mit.edu
|
||||
|
|
|
|||
221
docs/source/io_formats/cmfd.rst
Normal file
221
docs/source/io_formats/cmfd.rst
Normal file
|
|
@ -0,0 +1,221 @@
|
|||
.. _io_cmfd:
|
||||
|
||||
==============================
|
||||
CMFD Specification -- cmfd.xml
|
||||
==============================
|
||||
|
||||
Coarse mesh finite difference acceleration method has been implemented in
|
||||
OpenMC. Currently, it allows users to accelerate fission source convergence
|
||||
during inactive neutron batches. To run CMFD, the ``<run_cmfd>`` element in
|
||||
``settings.xml`` should be set to "true".
|
||||
|
||||
-------------------
|
||||
``<begin>`` Element
|
||||
-------------------
|
||||
|
||||
The ``<begin>`` element controls what batch CMFD calculations should begin.
|
||||
|
||||
*Default*: 1
|
||||
|
||||
------------------------
|
||||
``<dhat_reset>`` Element
|
||||
------------------------
|
||||
|
||||
The ``<dhat_reset>`` element controls whether :math:`\widehat{D}` nonlinear
|
||||
CMFD parameters should be reset to zero before solving CMFD eigenproblem.
|
||||
It can be turned on with "true" and off with "false".
|
||||
|
||||
*Default*: false
|
||||
|
||||
---------------------
|
||||
``<display>`` Element
|
||||
---------------------
|
||||
|
||||
The ``<display>`` element sets one additional CMFD output column. Options are:
|
||||
|
||||
* "balance" - prints the RMS [%] of the resdiual from the neutron balance
|
||||
equation on CMFD tallies.
|
||||
* "dominance" - prints the estimated dominance ratio from the CMFD iterations.
|
||||
**This will only work for power iteration eigensolver**.
|
||||
* "entropy" - prints the *entropy* of the CMFD predicted fission source.
|
||||
**Can only be used if OpenMC entropy is active as well**.
|
||||
* "source" - prints the RMS [%] between the OpenMC fission source and CMFD
|
||||
fission source.
|
||||
|
||||
*Default*: balance
|
||||
|
||||
-------------------------
|
||||
``<downscatter>`` Element
|
||||
-------------------------
|
||||
|
||||
The ``<downscatter>`` element controls whether an effective downscatter cross
|
||||
section should be used when using 2-group CMFD. It can be turned on with "true"
|
||||
and off with "false".
|
||||
|
||||
*Default*: false
|
||||
|
||||
----------------------
|
||||
``<feedback>`` Element
|
||||
----------------------
|
||||
|
||||
The ``<feedback>`` element controls whether or not the CMFD diffusion result is
|
||||
used to adjust the weight of fission source neutrons on the next OpenMC batch.
|
||||
It can be turned on with "true" and off with "false".
|
||||
|
||||
*Default*: false
|
||||
|
||||
------------------------------------
|
||||
``<gauss_seidel_tolerance>`` Element
|
||||
------------------------------------
|
||||
|
||||
The ``<gauss_seidel_tolerance>`` element specifies two parameters. The first is
|
||||
the absolute inner tolerance for Gauss-Seidel iterations when performing CMFD
|
||||
and the second is the relative inner tolerance for Gauss-Seidel iterations
|
||||
for CMFD calculations.
|
||||
|
||||
*Default*: 1.e-10 1.e-5
|
||||
|
||||
--------------------
|
||||
``<ktol>`` Element
|
||||
--------------------
|
||||
|
||||
The ``<ktol>`` element specifies the tolerance on the eigenvalue when performing
|
||||
CMFD power iteration.
|
||||
|
||||
*Default*: 1.e-8
|
||||
|
||||
------------------
|
||||
``<mesh>`` Element
|
||||
------------------
|
||||
|
||||
The CMFD mesh is a structured Cartesian mesh. This element has the following
|
||||
attributes/sub-elements:
|
||||
|
||||
:lower_left:
|
||||
The lower-left corner of the structured mesh. If only two coordinates are
|
||||
given, it is assumed that the mesh is an x-y mesh.
|
||||
|
||||
:upper_right:
|
||||
The upper-right corner of the structrued mesh. If only two coordinates are
|
||||
given, it is assumed that the mesh is an x-y mesh.
|
||||
|
||||
:dimension:
|
||||
The number of mesh cells in each direction.
|
||||
|
||||
:width:
|
||||
The width of mesh cells in each direction.
|
||||
|
||||
:energy:
|
||||
Energy bins [in eV], listed in ascending order (e.g. 0.0 0.625 20.0e6)
|
||||
for CMFD tallies and acceleration. If no energy bins are listed, OpenMC
|
||||
automatically assumes a one energy group calculation over the entire
|
||||
energy range.
|
||||
|
||||
:albedo:
|
||||
Surface ratio of incoming to outgoing partial currents on global boundary
|
||||
conditions. They are listed in the following order: -x +x -y +y -z +z.
|
||||
|
||||
*Default*: 1.0 1.0 1.0 1.0 1.0 1.0
|
||||
|
||||
:map:
|
||||
An optional acceleration map can be specified to overlay on the coarse
|
||||
mesh spatial grid. If this option is used, a ``1`` is used for a
|
||||
non-accelerated region and a ``2`` is used for an accelerated region.
|
||||
For a simple 4x4 coarse mesh with a 2x2 fuel lattice surrounded by
|
||||
reflector, the map is:
|
||||
|
||||
``1 1 1 1``
|
||||
|
||||
``1 2 2 1``
|
||||
|
||||
``1 2 2 1``
|
||||
|
||||
``1 1 1 1``
|
||||
|
||||
Therefore a 2x2 system of equations is solved rather than a 4x4. This
|
||||
is extremely important to use in reflectors as neutrons will not
|
||||
contribute to any tallies far away from fission source neutron regions.
|
||||
A ``2`` must be used to identify any fission source region.
|
||||
|
||||
.. note:: Only two of the following three sub-elements are needed:
|
||||
``lower_left``, ``upper_right`` and ``width``. Any combination
|
||||
of two of these will yield the third.
|
||||
|
||||
------------------
|
||||
``<norm>`` Element
|
||||
------------------
|
||||
|
||||
The ``<norm>`` element is used to normalize the CMFD fission source distribution
|
||||
to a particular value. For example, if a fission source is calculated for a
|
||||
17 x 17 lattice of pins, the fission source may be normalized to the number of
|
||||
fission source regions, in this case 289. This is useful when visualizing this
|
||||
distribution as the average peaking factor will be unity. This parameter will
|
||||
not impact the calculation.
|
||||
|
||||
*Default*: 1.0
|
||||
|
||||
---------------------------
|
||||
``<power_monitor>`` Element
|
||||
---------------------------
|
||||
|
||||
The ``<power_monitor>`` element is used to view the convergence of power
|
||||
iteration. This option can be turned on with "true" and turned off with "false".
|
||||
|
||||
*Default*: false
|
||||
|
||||
-------------------------
|
||||
``<run_adjoint>`` Element
|
||||
-------------------------
|
||||
|
||||
The ``<run_adjoint>`` element can be turned on with "true" to have an adjoint
|
||||
calculation be performed on the last batch when CMFD is active.
|
||||
|
||||
*Default*: false
|
||||
|
||||
--------------------
|
||||
``<shift>`` Element
|
||||
--------------------
|
||||
|
||||
The ``<shift>`` element specifies an optional Wielandt shift parameter for
|
||||
accelerating power iterations. It is by default very large so the impact of the
|
||||
shift is effectively zero.
|
||||
|
||||
*Default*: 1e6
|
||||
|
||||
----------------------
|
||||
``<spectral>`` Element
|
||||
----------------------
|
||||
|
||||
The ``<spectral>`` element specifies an optional spectral radius that can be set to
|
||||
accelerate the convergence of Gauss-Seidel iterations during CMFD power iteration
|
||||
solve.
|
||||
|
||||
*Default*: 0.0
|
||||
|
||||
------------------
|
||||
``<stol>`` Element
|
||||
------------------
|
||||
|
||||
The ``<stol>`` element specifies the tolerance on the fission source when performing
|
||||
CMFD power iteration.
|
||||
|
||||
*Default*: 1.e-8
|
||||
|
||||
-------------------------
|
||||
``<tally_reset>`` Element
|
||||
-------------------------
|
||||
|
||||
The ``<tally_reset>`` element contains a list of batch numbers in which CMFD tallies
|
||||
should be reset.
|
||||
|
||||
*Default*: None
|
||||
|
||||
----------------------------
|
||||
``<write_matrices>`` Element
|
||||
----------------------------
|
||||
|
||||
The ``<write_matrices>`` element is used to write the sparse matrices created
|
||||
when solving CMFD equations. This option can be turned on with "true" and off
|
||||
with "false".
|
||||
|
||||
*Default*: false
|
||||
51
docs/source/io_formats/cross_sections.rst
Normal file
51
docs/source/io_formats/cross_sections.rst
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
.. _io_cross_sections:
|
||||
|
||||
============================================
|
||||
Cross Sections Listing -- cross_sections.xml
|
||||
============================================
|
||||
|
||||
.. _directory_element:
|
||||
|
||||
-----------------------
|
||||
``<directory>`` Element
|
||||
-----------------------
|
||||
|
||||
The ``<directory>`` element specifies a root directory to which the path for all
|
||||
files listed in a :ref:`library_element` are given relative to. This element has
|
||||
no attributes or sub-elements; the directory should be given within the text
|
||||
node. For example,
|
||||
|
||||
.. code-block:: xml
|
||||
|
||||
<directory>/opt/data/cross_sections/</directory>
|
||||
|
||||
.. _library_element:
|
||||
|
||||
---------------------
|
||||
``<library>`` Element
|
||||
---------------------
|
||||
|
||||
The ``<library>`` element indicates where an HDF5 cross section file is located,
|
||||
whether it contains incident neutron or thermal scattering data, and what
|
||||
materials are listed within. It has the following attributes:
|
||||
|
||||
:materials:
|
||||
|
||||
A space-separated list of nuclides or thermal scattering tables. For
|
||||
example,
|
||||
|
||||
.. code-block:: xml
|
||||
|
||||
<library materials="U234 U235 U238" />
|
||||
<library materials="c_H_in_H2O c_D_in_G2O" />
|
||||
|
||||
Often, just a single nuclide or thermal scattering table is contained in a
|
||||
given file.
|
||||
|
||||
:path:
|
||||
Path to the HDF5 file. If the :ref:`directory_element` is specified, the
|
||||
path is relative to the directory given. Otherwise, it is relative to the
|
||||
directory containing the ``cross_sections.xml`` file.
|
||||
|
||||
:type:
|
||||
The type of data contained in the file, either 'neutron' or 'thermal'.
|
||||
365
docs/source/io_formats/geometry.rst
Normal file
365
docs/source/io_formats/geometry.rst
Normal file
|
|
@ -0,0 +1,365 @@
|
|||
.. _io_geometry:
|
||||
|
||||
======================================
|
||||
Geometry Specification -- geometry.xml
|
||||
======================================
|
||||
|
||||
.. _surface_element:
|
||||
|
||||
---------------------
|
||||
``<surface>`` Element
|
||||
---------------------
|
||||
|
||||
Each ``<surface>`` element can have the following attributes or sub-elements:
|
||||
|
||||
:id:
|
||||
A unique integer that can be used to identify the surface.
|
||||
|
||||
*Default*: None
|
||||
|
||||
:name:
|
||||
An optional string name to identify the surface in summary output
|
||||
files. This string is limited to 52 characters for formatting purposes.
|
||||
|
||||
*Default*: ""
|
||||
|
||||
:type:
|
||||
The type of the surfaces. This can be "x-plane", "y-plane", "z-plane",
|
||||
"plane", "x-cylinder", "y-cylinder", "z-cylinder", "sphere", "x-cone",
|
||||
"y-cone", "z-cone", or "quadric".
|
||||
|
||||
*Default*: None
|
||||
|
||||
:coeffs:
|
||||
The corresponding coefficients for the given type of surface. See below for
|
||||
a list a what coefficients to specify for a given surface
|
||||
|
||||
*Default*: None
|
||||
|
||||
:boundary:
|
||||
The boundary condition for the surface. This can be "transmission",
|
||||
"vacuum", "reflective", or "periodic". Periodic boundary conditions can
|
||||
only be applied to x-, y-, and z-planes. Only axis-aligned periodicity is
|
||||
supported, i.e., x-planes can only be paired with x-planes. Specify which
|
||||
planes are periodic and the code will automatically identify which planes
|
||||
are paired together.
|
||||
|
||||
*Default*: "transmission"
|
||||
|
||||
:periodic_surface_id:
|
||||
If a periodic boundary condition is applied, this attribute identifies the
|
||||
``id`` of the corresponding periodic sufrace.
|
||||
|
||||
The following quadratic surfaces can be modeled:
|
||||
|
||||
:x-plane:
|
||||
A plane perpendicular to the x axis, i.e. a surface of the form :math:`x -
|
||||
x_0 = 0`. The coefficients specified are ":math:`x_0`".
|
||||
|
||||
:y-plane:
|
||||
A plane perpendicular to the y axis, i.e. a surface of the form :math:`y -
|
||||
y_0 = 0`. The coefficients specified are ":math:`y_0`".
|
||||
|
||||
:z-plane:
|
||||
A plane perpendicular to the z axis, i.e. a surface of the form :math:`z -
|
||||
z_0 = 0`. The coefficients specified are ":math:`z_0`".
|
||||
|
||||
:plane:
|
||||
An arbitrary plane of the form :math:`Ax + By + Cz = D`. The coefficients
|
||||
specified are ":math:`A \: B \: C \: D`".
|
||||
|
||||
:x-cylinder:
|
||||
An infinite cylinder whose length is parallel to the x-axis. This is a
|
||||
quadratic surface of the form :math:`(y - y_0)^2 + (z - z_0)^2 = R^2`. The
|
||||
coefficients specified are ":math:`y_0 \: z_0 \: R`".
|
||||
|
||||
:y-cylinder:
|
||||
An infinite cylinder whose length is parallel to the y-axis. This is a
|
||||
quadratic surface of the form :math:`(x - x_0)^2 + (z - z_0)^2 = R^2`. The
|
||||
coefficients specified are ":math:`x_0 \: z_0 \: R`".
|
||||
|
||||
:z-cylinder:
|
||||
An infinite cylinder whose length is parallel to the z-axis. This is a
|
||||
quadratic surface of the form :math:`(x - x_0)^2 + (y - y_0)^2 = R^2`. The
|
||||
coefficients specified are ":math:`x_0 \: y_0 \: R`".
|
||||
|
||||
:sphere:
|
||||
A sphere of the form :math:`(x - x_0)^2 + (y - y_0)^2 + (z - z_0)^2 =
|
||||
R^2`. The coefficients specified are ":math:`x_0 \: y_0 \: z_0 \: R`".
|
||||
|
||||
:x-cone:
|
||||
A cone parallel to the x-axis of the form :math:`(y - y_0)^2 + (z - z_0)^2 =
|
||||
R^2 (x - x_0)^2`. The coefficients specified are ":math:`x_0 \: y_0 \: z_0
|
||||
\: R^2`".
|
||||
|
||||
:y-cone:
|
||||
A cone parallel to the y-axis of the form :math:`(x - x_0)^2 + (z - z_0)^2 =
|
||||
R^2 (y - y_0)^2`. The coefficients specified are ":math:`x_0 \: y_0 \: z_0
|
||||
\: R^2`".
|
||||
|
||||
:z-cone:
|
||||
A cone parallel to the x-axis of the form :math:`(x - x_0)^2 + (y - y_0)^2 =
|
||||
R^2 (z - z_0)^2`. The coefficients specified are ":math:`x_0 \: y_0 \: z_0
|
||||
\: R^2`".
|
||||
|
||||
:quadric:
|
||||
A general quadric surface of the form :math:`Ax^2 + By^2 + Cz^2 + Dxy +
|
||||
Eyz + Fxz + Gx + Hy + Jz + K = 0` The coefficients specified are ":math:`A
|
||||
\: B \: C \: D \: E \: F \: G \: H \: J \: K`".
|
||||
|
||||
.. _cell_element:
|
||||
|
||||
------------------
|
||||
``<cell>`` Element
|
||||
------------------
|
||||
|
||||
Each ``<cell>`` element can have the following attributes or sub-elements:
|
||||
|
||||
:id:
|
||||
A unique integer that can be used to identify the cell.
|
||||
|
||||
*Default*: None
|
||||
|
||||
:name:
|
||||
An optional string name to identify the cell in summary output files.
|
||||
This string is limmited to 52 characters for formatting purposes.
|
||||
|
||||
*Default*: ""
|
||||
|
||||
:universe:
|
||||
The ``id`` of the universe that this cell is contained in.
|
||||
|
||||
*Default*: 0
|
||||
|
||||
:fill:
|
||||
The ``id`` of the universe that fills this cell.
|
||||
|
||||
.. note:: If a fill is specified, no material should be given.
|
||||
|
||||
*Default*: None
|
||||
|
||||
:material:
|
||||
The ``id`` of the material that this cell contains. If the cell should
|
||||
contain no material, this can also be set to "void". A list of materials
|
||||
can be specified for the "distributed material" feature. This will give each
|
||||
unique instance of the cell its own material.
|
||||
|
||||
.. note:: If a material is specified, no fill should be given.
|
||||
|
||||
*Default*: None
|
||||
|
||||
:region:
|
||||
A Boolean expression of half-spaces that defines the spatial region which
|
||||
the cell occupies. Each half-space is identified by the unique ID of the
|
||||
surface prefixed by `-` or `+` to indicate that it is the negative or
|
||||
positive half-space, respectively. The `+` sign for a positive half-space
|
||||
can be omitted. Valid Boolean operators are parentheses, union `|`,
|
||||
complement `~`, and intersection. Intersection is implicit and indicated by
|
||||
the presence of whitespace. The order of operator precedence is parentheses,
|
||||
complement, intersection, and then union.
|
||||
|
||||
As an example, the following code gives a cell that is the union of the
|
||||
negative half-space of surface 3 and the complement of the intersection of
|
||||
the positive half-space of surface 5 and the negative half-space of surface
|
||||
2:
|
||||
|
||||
.. code-block:: xml
|
||||
|
||||
<cell id="1" material="1" region="-3 | ~(5 -2)" />
|
||||
|
||||
.. note:: The ``region`` attribute/element can be omitted to make a cell
|
||||
fill its entire universe.
|
||||
|
||||
*Default*: A region filling all space.
|
||||
|
||||
:temperature:
|
||||
The temperature of the cell in Kelvin. If windowed-multipole data is
|
||||
avalable, this temperature will be used to Doppler broaden some cross
|
||||
sections in the resolved resonance region. A list of temperatures can be
|
||||
specified for the "distributed temperature" feature. This will give each
|
||||
unique instance of the cell its own temperature.
|
||||
|
||||
*Default*: If a material default temperature is supplied, it is used. In the
|
||||
absence of a material default temperature, the :ref:`global default
|
||||
temperature <temperature_default>` is used.
|
||||
|
||||
:rotation:
|
||||
If the cell is filled with a universe, this element specifies the angles in
|
||||
degrees about the x, y, and z axes that the filled universe should be
|
||||
rotated. Should be given as three real numbers. For example, if you wanted
|
||||
to rotate the filled universe by 90 degrees about the z-axis, the cell
|
||||
element would look something like:
|
||||
|
||||
.. code-block:: xml
|
||||
|
||||
<cell fill="..." rotation="0 0 90" />
|
||||
|
||||
The rotation applied is an intrinsic rotation whose Tait-Bryan angles are
|
||||
given as those specified about the x, y, and z axes respectively. That is to
|
||||
say, if the angles are :math:`(\phi, \theta, \psi)`, then the rotation
|
||||
matrix applied is :math:`R_z(\psi) R_y(\theta) R_x(\phi)` or
|
||||
|
||||
.. math::
|
||||
|
||||
\left [ \begin{array}{ccc} \cos\theta \cos\psi & -\cos\theta \sin\psi +
|
||||
\sin\phi \sin\theta \cos\psi & \sin\phi \sin\psi + \cos\phi \sin\theta
|
||||
\cos\psi \\ \cos\theta \sin\psi & \cos\phi \cos\psi + \sin\phi \sin\theta
|
||||
\sin\psi & -\sin\phi \cos\psi + \cos\phi \sin\theta \sin\psi \\
|
||||
-\sin\theta & \sin\phi \cos\theta & \cos\phi \cos\theta \end{array}
|
||||
\right ]
|
||||
|
||||
*Default*: None
|
||||
|
||||
:translation:
|
||||
If the cell is filled with a universe, this element specifies a vector that
|
||||
is used to translate (shift) the universe. Should be given as three real
|
||||
numbers.
|
||||
|
||||
.. note:: Any translation operation is applied after a rotation, if also
|
||||
specified.
|
||||
|
||||
*Default*: None
|
||||
|
||||
|
||||
---------------------
|
||||
``<lattice>`` Element
|
||||
---------------------
|
||||
|
||||
The ``<lattice>`` can be used to represent repeating structures (e.g. fuel pins
|
||||
in an assembly) or other geometry which fits onto a rectilinear grid. Each cell
|
||||
within the lattice is filled with a specified universe. A ``<lattice>`` accepts
|
||||
the following attributes or sub-elements:
|
||||
|
||||
:id:
|
||||
A unique integer that can be used to identify the lattice.
|
||||
|
||||
:name:
|
||||
An optional string name to identify the lattice in summary output
|
||||
files. This string is limited to 52 characters for formatting purposes.
|
||||
|
||||
*Default*: ""
|
||||
|
||||
:dimension:
|
||||
Two or three integers representing the number of lattice cells in the x- and
|
||||
y- (and z-) directions, respectively.
|
||||
|
||||
*Default*: None
|
||||
|
||||
:lower_left:
|
||||
The coordinates of the lower-left corner of the lattice. If the lattice is
|
||||
two-dimensional, only the x- and y-coordinates are specified.
|
||||
|
||||
*Default*: None
|
||||
|
||||
:pitch:
|
||||
If the lattice is 3D, then three real numbers that express the distance
|
||||
between the centers of lattice cells in the x-, y-, and z- directions. If
|
||||
the lattice is 2D, then omit the third value.
|
||||
|
||||
*Default*: None
|
||||
|
||||
:outer:
|
||||
The unique integer identifier of a universe that will be used to fill all
|
||||
space outside of the lattice. The universe will be tiled repeatedly as if
|
||||
it were placed in a lattice of infinite size. This element is optional.
|
||||
|
||||
*Default*: An error will be raised if a particle leaves a lattice with no
|
||||
outer universe.
|
||||
|
||||
:universes:
|
||||
A list of the universe numbers that fill each cell of the lattice.
|
||||
|
||||
*Default*: None
|
||||
|
||||
Here is an example of a properly defined 2d rectangular lattice:
|
||||
|
||||
.. code-block:: xml
|
||||
|
||||
<lattice id="10" dimension="3 3" outer="1">
|
||||
<lower_left> -1.5 -1.5 </lower_left>
|
||||
<pitch> 1.0 1.0 </pitch>
|
||||
<universes>
|
||||
2 2 2
|
||||
2 1 2
|
||||
2 2 2
|
||||
</universes>
|
||||
</lattice>
|
||||
|
||||
-------------------------
|
||||
``<hex_lattice>`` Element
|
||||
-------------------------
|
||||
|
||||
The ``<hex_lattice>`` can be used to represent repeating structures (e.g. fuel
|
||||
pins in an assembly) or other geometry which naturally fits onto a hexagonal
|
||||
grid or hexagonal prism grid. Each cell within the lattice is filled with a
|
||||
specified universe. This lattice uses the "flat-topped hexagon" scheme where two
|
||||
of the six edges are perpendicular to the y-axis. A ``<hex_lattice>`` accepts
|
||||
the following attributes or sub-elements:
|
||||
|
||||
:id:
|
||||
A unique integer that can be used to identify the lattice.
|
||||
|
||||
:name:
|
||||
An optional string name to identify the hex_lattice in summary output
|
||||
files. This string is limited to 52 characters for formatting purposes.
|
||||
|
||||
*Default*: ""
|
||||
|
||||
:n_rings:
|
||||
An integer representing the number of radial ring positions in the xy-plane.
|
||||
Note that this number includes the degenerate center ring which only has one
|
||||
element.
|
||||
|
||||
*Default*: None
|
||||
|
||||
:n_axial:
|
||||
An integer representing the number of positions along the z-axis. This
|
||||
element is optional.
|
||||
|
||||
*Default*: None
|
||||
|
||||
:center:
|
||||
The coordinates of the center of the lattice. If the lattice does not have
|
||||
axial sections then only the x- and y-coordinates are specified.
|
||||
|
||||
*Default*: None
|
||||
|
||||
:pitch:
|
||||
If the lattice is 3D, then two real numbers that express the distance
|
||||
between the centers of lattice cells in the xy-plane and along the z-axis,
|
||||
respectively. If the lattice is 2D, then omit the second value.
|
||||
|
||||
*Default*: None
|
||||
|
||||
:outer:
|
||||
The unique integer identifier of a universe that will be used to fill all
|
||||
space outside of the lattice. The universe will be tiled repeatedly as if
|
||||
it were placed in a lattice of infinite size. This element is optional.
|
||||
|
||||
*Default*: An error will be raised if a particle leaves a lattice with no
|
||||
outer universe.
|
||||
|
||||
:universes:
|
||||
A list of the universe numbers that fill each cell of the lattice.
|
||||
|
||||
*Default*: None
|
||||
|
||||
Here is an example of a properly defined 2d hexagonal lattice:
|
||||
|
||||
.. code-block:: xml
|
||||
|
||||
<hex_lattice id="10" n_rings="3" outer="1">
|
||||
<center> 0.0 0.0 </center>
|
||||
<pitch> 1.0 </pitch>
|
||||
<universes>
|
||||
202
|
||||
202 202
|
||||
202 202 202
|
||||
202 202
|
||||
202 101 202
|
||||
202 202
|
||||
202 202 202
|
||||
202 202
|
||||
202
|
||||
</universes>
|
||||
</hex_lattice>
|
||||
|
|
@ -4,6 +4,23 @@
|
|||
File Format Specifications
|
||||
==========================
|
||||
|
||||
.. _io_file_formats_input:
|
||||
|
||||
-----------
|
||||
Input Files
|
||||
-----------
|
||||
|
||||
.. toctree::
|
||||
:numbered:
|
||||
:maxdepth: 2
|
||||
|
||||
geometry
|
||||
materials
|
||||
settings
|
||||
tallies
|
||||
plots
|
||||
cmfd
|
||||
|
||||
----------
|
||||
Data Files
|
||||
----------
|
||||
|
|
@ -12,6 +29,7 @@ Data Files
|
|||
:numbered:
|
||||
:maxdepth: 2
|
||||
|
||||
cross_sections
|
||||
nuclear_data
|
||||
mgxs_library
|
||||
data_wmp
|
||||
|
|
|
|||
133
docs/source/io_formats/materials.rst
Normal file
133
docs/source/io_formats/materials.rst
Normal file
|
|
@ -0,0 +1,133 @@
|
|||
.. _io_materials:
|
||||
|
||||
========================================
|
||||
Materials Specification -- materials.xml
|
||||
========================================
|
||||
|
||||
.. _cross_sections:
|
||||
|
||||
----------------------------
|
||||
``<cross_sections>`` Element
|
||||
----------------------------
|
||||
|
||||
The ``<cross_sections>`` element has no attributes and simply indicates the path
|
||||
to an XML cross section listing file (usually named cross_sections.xml). If this
|
||||
element is absent from the settings.xml file, the
|
||||
:envvar:`OPENMC_CROSS_SECTIONS` environment variable will be used to find the
|
||||
path to the XML cross section listing when in continuous-energy mode, and the
|
||||
:envvar:`OPENMC_MG_CROSS_SECTIONS` environment variable will be used in
|
||||
multi-group mode.
|
||||
|
||||
.. _multipole_library:
|
||||
|
||||
-------------------------------
|
||||
``<multipole_library>`` Element
|
||||
-------------------------------
|
||||
|
||||
The ``<multipole_library>`` element indicates the directory containing a
|
||||
windowed multipole library. If a windowed multipole library is available,
|
||||
OpenMC can use it for on-the-fly Doppler-broadening of resolved resonance range
|
||||
cross sections. If this element is absent from the settings.xml file, the
|
||||
:envvar:`OPENMC_MULTIPOLE_LIBRARY` environment variable will be used.
|
||||
|
||||
.. note:: The <temperature_multipole> element must also be set to "true" for
|
||||
windowed multipole functionality.
|
||||
|
||||
.. _material:
|
||||
|
||||
----------------------
|
||||
``<material>`` Element
|
||||
----------------------
|
||||
|
||||
Each ``material`` element can have the following attributes or sub-elements:
|
||||
|
||||
:id:
|
||||
A unique integer that can be used to identify the material.
|
||||
|
||||
:name:
|
||||
An optional string name to identify the material in summary output
|
||||
files. This string is limited to 52 characters for formatting purposes.
|
||||
|
||||
*Default*: ""
|
||||
|
||||
:temperature:
|
||||
An element with no attributes which is used to set the default temperature
|
||||
of the material in Kelvin.
|
||||
|
||||
*Default*: If a material default temperature is not given and a cell
|
||||
temperature is not specified, the :ref:`global default temperature
|
||||
<temperature_default>` is used.
|
||||
|
||||
:density:
|
||||
An element with attributes/sub-elements called ``value`` and ``units``. The
|
||||
``value`` attribute is the numeric value of the density while the ``units``
|
||||
can be "g/cm3", "kg/m3", "atom/b-cm", "atom/cm3", or "sum". The "sum" unit
|
||||
indicates that values appearing in ``ao`` or ``wo`` attributes for ``<nuclide>``
|
||||
and ``<element>`` sub-elements are to be interpreted as absolute nuclide/element
|
||||
densities in atom/b-cm or g/cm3, and the total density of the material is
|
||||
taken as the sum of all nuclides/elements. The "macro" unit is used with
|
||||
a ``macroscopic`` quantity to indicate that the density is already included
|
||||
in the library and thus not needed here. However, if a value is provided
|
||||
for the ``value``, then this is treated as a number density multiplier on
|
||||
the macroscopic cross sections in the multi-group data. This can be used,
|
||||
for example, when perturbing the density slightly.
|
||||
|
||||
*Default*: None
|
||||
|
||||
.. note:: A ``macroscopic`` quantity can not be used in conjunction with a
|
||||
``nuclide``, ``element``, or ``sab`` quantity.
|
||||
|
||||
:nuclide:
|
||||
An element with attributes/sub-elements called ``name``, and ``ao``
|
||||
or ``wo``. The ``name`` attribute is the name of the cross-section for a
|
||||
desired nuclide. Finally, the ``ao`` and ``wo`` attributes specify the atom or
|
||||
weight percent of that nuclide within the material, respectively. One
|
||||
example would be as follows:
|
||||
|
||||
.. code-block:: xml
|
||||
|
||||
<nuclide name="H1" ao="2.0" />
|
||||
<nuclide name="O16" ao="1.0" />
|
||||
|
||||
.. note:: If one nuclide is specified in atom percent, all others must also
|
||||
be given in atom percent. The same applies for weight percentages.
|
||||
|
||||
An optional attribute/sub-element for each nuclide is ``scattering``. This
|
||||
attribute may be set to "data" to use the scattering laws specified by the
|
||||
cross section library (default). Alternatively, when set to "iso-in-lab",
|
||||
the scattering laws are used to sample the outgoing energy but an
|
||||
isotropic-in-lab distribution is used to sample the outgoing angle at each
|
||||
scattering interaction. The ``scattering`` attribute may be most useful
|
||||
when using OpenMC to compute multi-group cross-sections for deterministic
|
||||
transport codes and to quantify the effects of anisotropic scattering.
|
||||
|
||||
*Default*: None
|
||||
|
||||
.. note:: The ``scattering`` attribute/sub-element is not used in the
|
||||
multi-group :ref:`energy_mode`.
|
||||
|
||||
:sab:
|
||||
Associates an S(a,b) table with the material. This element has one
|
||||
attribute/sub-element called ``name``. The ``name`` attribute
|
||||
is the name of the S(a,b) table that should be associated with the material.
|
||||
|
||||
*Default*: None
|
||||
|
||||
.. note:: This element is not used in the multi-group :ref:`energy_mode`.
|
||||
|
||||
:macroscopic:
|
||||
The ``macroscopic`` element is similar to the ``nuclide`` element, but,
|
||||
recognizes that some multi-group libraries may be providing material
|
||||
specific macroscopic cross sections instead of always providing nuclide
|
||||
specific data like in the continuous-energy case. To that end, the
|
||||
macroscopic element has one attribute/sub-element called ``name``.
|
||||
The ``name`` attribute is the name of the cross-section for a
|
||||
desired nuclide. One example would be as follows:
|
||||
|
||||
.. code-block:: xml
|
||||
|
||||
<macroscopic name="UO2" />
|
||||
|
||||
.. note:: This element is only used in the multi-group :ref:`energy_mode`.
|
||||
|
||||
*Default*: None
|
||||
192
docs/source/io_formats/plots.rst
Normal file
192
docs/source/io_formats/plots.rst
Normal file
|
|
@ -0,0 +1,192 @@
|
|||
.. _io_plots:
|
||||
|
||||
============================================
|
||||
Geometry Plotting Specification -- plots.xml
|
||||
============================================
|
||||
|
||||
Basic plotting capabilities are available in OpenMC by creating a plots.xml file
|
||||
and subsequently running with the ``--plot`` command-line flag. The root element
|
||||
of the plots.xml is simply ``<plots>`` and any number output plots can be
|
||||
defined with ``<plot>`` sub-elements. Two plot types are currently implemented
|
||||
in openMC:
|
||||
|
||||
* ``slice`` 2D pixel plot along one of the major axes. Produces a PPM image
|
||||
file.
|
||||
* ``voxel`` 3D voxel data dump. Produces a binary file containing voxel xyz
|
||||
position and cell or material id.
|
||||
|
||||
|
||||
------------------
|
||||
``<plot>`` Element
|
||||
------------------
|
||||
|
||||
Each plot is specified by a combination of the following attributes or
|
||||
sub-elements:
|
||||
|
||||
:id:
|
||||
The unique ``id`` of the plot.
|
||||
|
||||
*Default*: None - Required entry
|
||||
|
||||
:filename:
|
||||
Filename for the output plot file.
|
||||
|
||||
*Default*: "plot"
|
||||
|
||||
:color_by:
|
||||
Keyword for plot coloring. This can be either "cell" or "material", which
|
||||
colors regions by cells and materials, respectively. For voxel plots, this
|
||||
determines which id (cell or material) is associated with each position.
|
||||
|
||||
*Default*: "cell"
|
||||
|
||||
:level:
|
||||
Universe depth to plot at (optional). This parameter controls how many
|
||||
universe levels deep to pull cell and material ids from when setting plot
|
||||
colors. If a given location does not have as many levels as specified,
|
||||
colors will be taken from the lowest level at that location. For example, if
|
||||
``level`` is set to zero colors will be taken from top-level (universe zero)
|
||||
cells only. However, if ``level`` is set to 1 colors will be taken from
|
||||
cells in universes that fill top-level fill-cells, and from top-level cells
|
||||
that contain materials.
|
||||
|
||||
*Default*: Whatever the deepest universe is in the model
|
||||
|
||||
:origin:
|
||||
Specifies the (x,y,z) coordinate of the center of the plot. Should be three
|
||||
floats separated by spaces.
|
||||
|
||||
*Default*: None - Required entry
|
||||
|
||||
:width:
|
||||
Specifies the width of the plot along each of the basis directions. Should
|
||||
be two or three floats separated by spaces for 2D plots and 3D plots,
|
||||
respectively.
|
||||
|
||||
*Default*: None - Required entry
|
||||
|
||||
:type:
|
||||
Keyword for type of plot to be produced. Currently only "slice" and "voxel"
|
||||
plots are implemented. The "slice" plot type creates 2D pixel maps saved in
|
||||
the PPM file format. PPM files can be displayed in most viewers (e.g. the
|
||||
default Gnome viewer, IrfanView, etc.). The "voxel" plot type produces a
|
||||
binary datafile containing voxel grid positioning and the cell or material
|
||||
(specified by the ``color`` tag) at the center of each voxel. These
|
||||
datafiles can be processed into 3D SILO files using the :ref:`scripts_voxel`
|
||||
script provided with OpenMC, and subsequently viewed with a 3D viewer such
|
||||
as VISIT or Paraview. See the :ref:`io_voxel` for information about the
|
||||
datafile structure.
|
||||
|
||||
.. note:: Since the PPM format is saved without any kind of compression,
|
||||
the resulting file sizes can be quite large. Saving the image in
|
||||
the PNG format can often times reduce the file size by orders of
|
||||
magnitude without any loss of image quality. Likewise,
|
||||
high-resolution voxel files produced by OpenMC can be quite large,
|
||||
but the equivalent SILO files will be significantly smaller.
|
||||
|
||||
*Default*: "slice"
|
||||
|
||||
``<plot>`` elements of ``type`` "slice" and "voxel" must contain the ``pixels``
|
||||
attribute or sub-element:
|
||||
|
||||
:pixels:
|
||||
Specifies the number of pixels or voxels to be used along each of the basis
|
||||
directions for "slice" and "voxel" plots, respectively. Should be two or
|
||||
three integers separated by spaces.
|
||||
|
||||
.. warning:: The ``pixels`` input determines the output file size. For the
|
||||
PPM format, 10 million pixels will result in a file just under
|
||||
30 MB in size. A 10 million voxel binary file will be around
|
||||
40 MB.
|
||||
|
||||
.. warning:: If the aspect ratio defined in ``pixels`` does not match the
|
||||
aspect ratio defined in ``width`` the plot may appear stretched
|
||||
or squeezed.
|
||||
|
||||
.. warning:: Geometry features along a basis direction smaller than
|
||||
``width``/``pixels`` along that basis direction may not appear
|
||||
in the plot.
|
||||
|
||||
*Default*: None - Required entry for "slice" and "voxel" plots
|
||||
|
||||
``<plot>`` elements of ``type`` "slice" can also contain the following
|
||||
attributes or sub-elements. These are not used in "voxel" plots:
|
||||
|
||||
:basis:
|
||||
Keyword specifying the plane of the plot for "slice" type plots. Can be
|
||||
one of: "xy", "xz", "yz".
|
||||
|
||||
*Default*: "xy"
|
||||
|
||||
:background:
|
||||
Specifies the RGB color of the regions where no OpenMC cell can be found.
|
||||
Should be three integers separated by spaces.
|
||||
|
||||
*Default*: 0 0 0 (black)
|
||||
|
||||
:color:
|
||||
Any number of this optional tag may be included in each ``<plot>`` element,
|
||||
which can override the default random colors for cells or materials. Each
|
||||
``color`` element must contain ``id`` and ``rgb`` sub-elements.
|
||||
|
||||
:id:
|
||||
Specifies the cell or material unique id for the color specification.
|
||||
|
||||
:rgb:
|
||||
Specifies the custom color for the cell or material. Should be 3 integers
|
||||
separated by spaces.
|
||||
|
||||
As an example, if your plot is colored by material and you want material 23
|
||||
to be blue, the corresponding ``color`` element would look like:
|
||||
|
||||
.. code-block:: xml
|
||||
|
||||
<color id="23" rgb="0 0 255" />
|
||||
|
||||
*Default*: None
|
||||
|
||||
:mask:
|
||||
The special ``mask`` sub-element allows for the selective plotting of *only*
|
||||
user-specified cells or materials. Only one ``mask`` element is allowed per
|
||||
``plot`` element, and it must contain as attributes or sub-elements a
|
||||
background masking color and a list of cells or materials to plot:
|
||||
|
||||
:components:
|
||||
List of unique ``id`` numbers of the cells or materials to plot. Should be
|
||||
any number of integers separated by spaces.
|
||||
|
||||
:background:
|
||||
Color to apply to all cells or materials not in the ``components`` list of
|
||||
cells or materials to plot. This overrides any ``color`` color
|
||||
specifications.
|
||||
|
||||
*Default*: 255 255 255 (white)
|
||||
|
||||
:meshlines:
|
||||
The ``meshlines`` sub-element allows for plotting the boundaries of a
|
||||
regular mesh on top of a plot. Only one ``meshlines`` element is allowed per
|
||||
``plot`` element, and it must contain as attributes or sub-elements a mesh
|
||||
type and a linewidth. Optionally, a color may be specified for the overlay:
|
||||
|
||||
:meshtype:
|
||||
The type of the mesh to be plotted. Valid options are "tally", "entropy",
|
||||
"ufs", and "cmfd". If plotting "tally" meshes, the id of the mesh to plot
|
||||
must be specified with the ``id`` sub-element.
|
||||
|
||||
:id:
|
||||
A single integer id number for the mesh specified on ``tallies.xml`` that
|
||||
should be plotted. This element is only required for ``meshtype="tally"``.
|
||||
|
||||
:linewidth:
|
||||
A single integer number of pixels of linewidth to specify for the mesh
|
||||
boundaries. Specifying this as 0 indicates that lines will be 1 pixel
|
||||
thick, specifying 1 indicates 3 pixels thick, specifying 2 indicates
|
||||
5 pixels thick, etc.
|
||||
|
||||
:color:
|
||||
Specifies the custom color for the meshlines boundaries. Should be 3
|
||||
integers separated by whitespace. This element is optional.
|
||||
|
||||
*Default*: 0 0 0 (black)
|
||||
|
||||
*Default*: None
|
||||
847
docs/source/io_formats/settings.rst
Normal file
847
docs/source/io_formats/settings.rst
Normal file
|
|
@ -0,0 +1,847 @@
|
|||
.. _io_settings:
|
||||
|
||||
======================================
|
||||
Settings Specification -- settings.xml
|
||||
======================================
|
||||
|
||||
All simulation parameters and miscellaneous options are specified in the
|
||||
settings.xml file.
|
||||
|
||||
---------------------
|
||||
``<batches>`` Element
|
||||
---------------------
|
||||
|
||||
The ``<batches>`` element indicates the total number of batches to execute,
|
||||
where each batch corresponds to a tally realization. In a fixed source
|
||||
calculation, each batch consists of a number of source particles. In an
|
||||
eigenvalue calculation, each batch consists of one or many fission source
|
||||
iterations (generations), where each generation itself consists of a number of
|
||||
source neutrons.
|
||||
|
||||
*Default*: None
|
||||
|
||||
----------------------------------
|
||||
``<confidence_intervals>`` Element
|
||||
----------------------------------
|
||||
|
||||
The ``<confidence_intervals>`` element has no attributes and has an accepted
|
||||
value of "true" or "false". If set to "true", uncertainties on tally results
|
||||
will be reported as the half-width of the 95% two-sided confidence interval. If
|
||||
set to "false", uncertainties on tally results will be reported as the sample
|
||||
standard deviation.
|
||||
|
||||
*Default*: false
|
||||
|
||||
--------------------
|
||||
``<cutoff>`` Element
|
||||
--------------------
|
||||
|
||||
The ``<cutoff>`` element indicates two kinds of cutoffs. The first is the weight
|
||||
cutoff used below which particles undergo Russian roulette. Surviving particles
|
||||
are assigned a user-determined weight. Note that weight cutoffs and Russian
|
||||
rouletting are not turned on by default. The second is the energy cutoff which
|
||||
is used to kill particles under certain energy. The energy cutoff should not be
|
||||
used unless you know particles under the energy are of no importance to results
|
||||
you care. This element has the following attributes/sub-elements:
|
||||
|
||||
:weight:
|
||||
The weight below which particles undergo Russian roulette.
|
||||
|
||||
*Default*: 0.25
|
||||
|
||||
:weight_avg:
|
||||
The weight that is assigned to particles that are not killed after Russian
|
||||
roulette.
|
||||
|
||||
*Default*: 1.0
|
||||
|
||||
:energy:
|
||||
The energy under which particles will be killed.
|
||||
|
||||
*Default*: 0.0
|
||||
|
||||
-------------------------
|
||||
``<energy_grid>`` Element
|
||||
-------------------------
|
||||
|
||||
The ``<energy_grid>`` element determines the treatment of the energy grid during
|
||||
a simulation. The valid options are "nuclide", "logarithm", and
|
||||
"material-union". Setting this element to "nuclide" will cause OpenMC to use a
|
||||
nuclide's energy grid when determining what points to interpolate between for
|
||||
determining cross sections (i.e. non-unionized energy grid). Setting this
|
||||
element to "logarithm" causes OpenMC to use a logarithmic mapping technique
|
||||
described in LA-UR-14-24530_. Setting this element to "material-union" will
|
||||
cause OpenMC to create energy grids that are unionized material-by-material and
|
||||
use these grids when determining the energy-cross section pairs to interpolate
|
||||
cross section values between.
|
||||
|
||||
*Default*: logarithm
|
||||
|
||||
.. note:: This element is not used in the multi-group :ref:`energy_mode`.
|
||||
|
||||
.. _LA-UR-14-24530: https://laws.lanl.gov/vhosts/mcnp.lanl.gov/pdf_files/la-ur-14-24530.pdf
|
||||
|
||||
.. _energy_mode:
|
||||
|
||||
-------------------------
|
||||
``<energy_mode>`` Element
|
||||
-------------------------
|
||||
|
||||
The ``<energy_mode>`` element tells OpenMC if the run-mode should be
|
||||
continuous-energy or multi-group. Options for entry are: ``continuous-energy``
|
||||
or ``multi-group``.
|
||||
|
||||
*Default*: continuous-energy
|
||||
|
||||
---------------------
|
||||
``<entropy>`` Element
|
||||
---------------------
|
||||
|
||||
The ``<entropy>`` element describes a mesh that is used for calculating Shannon
|
||||
entropy. This mesh should cover all possible fissionable materials in the
|
||||
problem. It has the following attributes/sub-elements:
|
||||
|
||||
:dimension:
|
||||
The number of mesh cells in the x, y, and z directions, respectively.
|
||||
|
||||
*Default*: If this tag is not present, the number of mesh cells is
|
||||
automatically determined by the code.
|
||||
|
||||
:lower_left:
|
||||
The Cartesian coordinates of the lower-left corner of the mesh.
|
||||
|
||||
*Default*: None
|
||||
|
||||
:upper_right:
|
||||
The Cartesian coordinates of the upper-right corner of the mesh.
|
||||
|
||||
*Default*: None
|
||||
|
||||
-----------------------------------
|
||||
``<generations_per_batch>`` Element
|
||||
-----------------------------------
|
||||
|
||||
The ``<generations_per_batch>`` element indicates the number of total fission
|
||||
source iterations per batch for an eigenvalue calculation. This element is
|
||||
ignored for all run modes other than "eigenvalue".
|
||||
|
||||
*Default*: 1
|
||||
|
||||
----------------------
|
||||
``<inactive>`` Element
|
||||
----------------------
|
||||
|
||||
The ``<inactive>`` element indicates the number of inactive batches used in a
|
||||
k-eigenvalue calculation. In general, the starting fission source iterations in
|
||||
an eigenvalue calculation can not be used to contribute to tallies since the
|
||||
fission source distribution and eigenvalue are generally not converged
|
||||
immediately. This element is ignored for all run modes other than "eigenvalue".
|
||||
|
||||
*Default*: 0
|
||||
|
||||
--------------------------
|
||||
``<keff_trigger>`` Element
|
||||
--------------------------
|
||||
|
||||
The ``<keff_trigger>`` element (ignored for all run modes other than
|
||||
"eigenvalue".) specifies a precision trigger on the combined
|
||||
:math:`k_{eff}`. The trigger is a convergence criterion on the uncertainty of
|
||||
the estimated eigenvalue. It has the following attributes/sub-elements:
|
||||
|
||||
:type:
|
||||
The type of precision trigger. Accepted options are "variance", "std_dev",
|
||||
and "rel_err".
|
||||
|
||||
:variance:
|
||||
Variance of the batch mean :math:`\sigma^2`
|
||||
|
||||
:std_dev:
|
||||
Standard deviation of the batch mean :math:`\sigma`
|
||||
|
||||
:rel_err:
|
||||
Relative error of the batch mean :math:`\frac{\sigma}{\mu}`
|
||||
|
||||
*Default*: None
|
||||
|
||||
:threshold:
|
||||
The precision trigger's convergence criterion for the
|
||||
combined :math:`k_{eff}`.
|
||||
|
||||
*Default*: None
|
||||
|
||||
.. note:: See section on the :ref:`trigger` for more information.
|
||||
|
||||
|
||||
---------------------------
|
||||
``<log_grid_bins>`` Element
|
||||
---------------------------
|
||||
|
||||
The ``<log_grid_bins>`` element indicates the number of bins to use for the
|
||||
logarithmic-mapped energy grid. Using more bins will result in energy grid
|
||||
searches over a smaller range at the expense of more memory. The default is
|
||||
based on the recommended value in LA-UR-14-24530_.
|
||||
|
||||
*Default*: 8000
|
||||
|
||||
.. note:: This element is not used in the multi-group :ref:`energy_mode`.
|
||||
|
||||
---------------------------
|
||||
``<max_order>`` Element
|
||||
---------------------------
|
||||
|
||||
The ``<max_order>`` element allows the user to set a maximum scattering order
|
||||
to apply to every nuclide/material in the problem. That is, if the data
|
||||
library has :math:`P_3` data available, but ``<max_order>`` was set to ``1``,
|
||||
then, OpenMC will only use up to the :math:`P_1` data.
|
||||
|
||||
*Default*: Use the maximum order in the data library
|
||||
|
||||
.. note:: This element is not used in the continuous-energy
|
||||
:ref:`energy_mode`.
|
||||
|
||||
-----------------------
|
||||
``<no_reduce>`` Element
|
||||
-----------------------
|
||||
|
||||
The ``<no_reduce>`` element has no attributes and has an accepted value of
|
||||
"true" or "false". If set to "true", all user-defined tallies and global tallies
|
||||
will not be reduced across processors in a parallel calculation. This means that
|
||||
the accumulate score in one batch on a single processor is considered as an
|
||||
independent realization for the tally random variable. For a problem with large
|
||||
tally data, this option can significantly improve the parallel efficiency.
|
||||
|
||||
*Default*: false
|
||||
|
||||
--------------------
|
||||
``<output>`` Element
|
||||
--------------------
|
||||
|
||||
The ``<output>`` element determines what output files should be written to disk
|
||||
during the run. The sub-elements are described below, where "true" will write
|
||||
out the file and "false" will not.
|
||||
|
||||
:summary:
|
||||
Writes out an HDF5 summary file describing all of the user input files that
|
||||
were read in.
|
||||
|
||||
*Default*: true
|
||||
|
||||
:tallies:
|
||||
Write out an ASCII file of tally results.
|
||||
|
||||
*Default*: true
|
||||
|
||||
.. note:: The tally results will always be written to a binary/HDF5 state
|
||||
point file.
|
||||
|
||||
:path:
|
||||
Absolute or relative path where all output files should be written to. The
|
||||
specified path must exist or else OpenMC will abort.
|
||||
|
||||
*Default*: Current working directory
|
||||
|
||||
-----------------------
|
||||
``<particles>`` Element
|
||||
-----------------------
|
||||
|
||||
This element indicates the number of neutrons to simulate per fission source
|
||||
iteration when a k-eigenvalue calculation is performed or the number of neutrons
|
||||
per batch for a fixed source simulation.
|
||||
|
||||
*Default*: None
|
||||
|
||||
---------------------
|
||||
``<ptables>`` Element
|
||||
---------------------
|
||||
|
||||
The ``<ptables>`` element determines whether probability tables should be used
|
||||
in the unresolved resonance range if available. This element has no attributes
|
||||
or sub-elements and can be set to either "false" or "true".
|
||||
|
||||
*Default*: true
|
||||
|
||||
.. note:: This element is not used in the multi-group :ref:`energy_mode`.
|
||||
|
||||
----------------------------------
|
||||
``<resonance_scattering>`` Element
|
||||
----------------------------------
|
||||
|
||||
The ``resonance_scattering`` element indicates to OpenMC that a method be used
|
||||
to properly account for resonance elastic scattering (typically for nuclides
|
||||
with Z > 40). This element can contain one or more of the following attributes
|
||||
or sub-elements:
|
||||
|
||||
:enable:
|
||||
Indicates whether a resonance elastic scattering method should be turned
|
||||
on. Accepts values of "true" or "false".
|
||||
|
||||
*Default*: If the ``<resonance_scattering>`` element is present, "true".
|
||||
|
||||
:method:
|
||||
|
||||
Which resonance elastic scattering method is to be applied: "ares"
|
||||
(accelerated resonance elastic scattering), "dbrc" (Doppler broadening
|
||||
rejection correction), or "wcm" (weight correction method). Descriptions of
|
||||
each of these methods are documented here_.
|
||||
|
||||
.. _here: http://dx.doi.org/10.1016/j.anucene.2014.01.017
|
||||
|
||||
*Default*: "ares"
|
||||
|
||||
:energy_min:
|
||||
The energy in eV above which the resonance elastic scattering method should
|
||||
be applied.
|
||||
|
||||
*Default*: 0.01 eV
|
||||
|
||||
:energy_max:
|
||||
The energy in eV below which the resonance elastic scattering method should
|
||||
be applied.
|
||||
|
||||
*Default*: 1000.0 eV
|
||||
|
||||
:nuclides:
|
||||
|
||||
A list of nuclides to which the resonance elastic scattering method should
|
||||
be applied.
|
||||
|
||||
*Default*: If ``<resonance_scattering>`` is present but the ``<nuclides>``
|
||||
sub-element is not given, the method is applied to all nuclides with 0 K
|
||||
elastic scattering data present.
|
||||
|
||||
.. note:: If the ``resonance_scattering`` element is not given, the free gas,
|
||||
constant cross section scattering model, which has historically been
|
||||
used by Monte Carlo codes to sample target velocities, is used to
|
||||
treat the target motion of all nuclides. If
|
||||
``resonance_scattering`` is present, the constant cross section
|
||||
method is applied below ``energy_min`` and the target-at-rest
|
||||
(asymptotic) kernel is used above ``energy_max``.
|
||||
|
||||
.. note:: This element is not used in the multi-group :ref:`energy_mode`.
|
||||
|
||||
----------------------
|
||||
``<run_cmfd>`` Element
|
||||
----------------------
|
||||
|
||||
The ``<run_cmfd>`` element indicates whether or not CMFD acceleration should be
|
||||
turned on or off. This element has no attributes or sub-elements and can be set
|
||||
to either "false" or "true".
|
||||
|
||||
*Default*: false
|
||||
|
||||
----------------------
|
||||
``<run_mode>`` Element
|
||||
----------------------
|
||||
|
||||
The ``<run_mode>`` element indicates which run mode should be used when OpenMC
|
||||
is executed. This element has no attributes or sub-elements and can be set to
|
||||
"eigenvalue", "fixed source", "plot", "volume", or "particle restart".
|
||||
|
||||
*Default*: None
|
||||
|
||||
------------------
|
||||
``<seed>`` Element
|
||||
------------------
|
||||
|
||||
The ``seed`` element is used to set the seed used for the linear congruential
|
||||
pseudo-random number generator.
|
||||
|
||||
*Default*: 1
|
||||
|
||||
--------------------
|
||||
``<source>`` Element
|
||||
--------------------
|
||||
|
||||
The ``source`` element gives information on an external source distribution to
|
||||
be used either as the source for a fixed source calculation or the initial
|
||||
source guess for criticality calculations. Multiple ``<source>`` elements may be
|
||||
specified to define different source distributions. Each one takes the following
|
||||
attributes/sub-elements:
|
||||
|
||||
:strength:
|
||||
The strength of the source. If multiple sources are present, the source
|
||||
strength indicates the relative probability of choosing one source over the
|
||||
other.
|
||||
|
||||
*Default*: 1.0
|
||||
|
||||
:file:
|
||||
If this attribute is given, it indicates that the source is to be read from
|
||||
a binary source file whose path is given by the value of this element. Note,
|
||||
the number of source sites needs to be the same as the number of particles
|
||||
simulated in a fission source generation.
|
||||
|
||||
*Default*: None
|
||||
|
||||
:space:
|
||||
An element specifying the spatial distribution of source sites. This element
|
||||
has the following attributes:
|
||||
|
||||
:type:
|
||||
The type of spatial distribution. Valid options are "box", "fission",
|
||||
"point", and "cartesian". A "box" spatial distribution has coordinates
|
||||
sampled uniformly in a parallelepiped. A "fission" spatial distribution
|
||||
samples locations from a "box" distribution but only locations in
|
||||
fissionable materials are accepted. A "point" spatial distribution has
|
||||
coordinates specified by a triplet. An "cartesian" spatial distribution
|
||||
specifies independent distributions of x-, y-, and z-coordinates.
|
||||
|
||||
*Default*: None
|
||||
|
||||
:parameters:
|
||||
For a "box" or "fission" spatial distribution, ``parameters`` should be
|
||||
given as six real numbers, the first three of which specify the lower-left
|
||||
corner of a parallelepiped and the last three of which specify the
|
||||
upper-right corner. Source sites are sampled uniformly through that
|
||||
parallelepiped.
|
||||
|
||||
For a "point" spatial distribution, ``parameters`` should be given as
|
||||
three real numbers which specify the (x,y,z) location of an isotropic
|
||||
point source.
|
||||
|
||||
For an "cartesian" distribution, no parameters are specified. Instead,
|
||||
the ``x``, ``y``, and ``z`` elements must be specified.
|
||||
|
||||
*Default*: None
|
||||
|
||||
:x:
|
||||
For an "cartesian" distribution, this element specifies the distribution
|
||||
of x-coordinates. The necessary sub-elements/attributes are those of a
|
||||
univariate probability distribution (see the description in
|
||||
:ref:`univariate`).
|
||||
|
||||
:y:
|
||||
For an "cartesian" distribution, this element specifies the distribution
|
||||
of y-coordinates. The necessary sub-elements/attributes are those of a
|
||||
univariate probability distribution (see the description in
|
||||
:ref:`univariate`).
|
||||
|
||||
:z:
|
||||
For an "cartesian" distribution, this element specifies the distribution
|
||||
of z-coordinates. The necessary sub-elements/attributes are those of a
|
||||
univariate probability distribution (see the description in
|
||||
:ref:`univariate`).
|
||||
|
||||
:angle:
|
||||
An element specifying the angular distribution of source sites. This element
|
||||
has the following attributes:
|
||||
|
||||
:type:
|
||||
The type of angular distribution. Valid options are "isotropic",
|
||||
"monodirectional", and "mu-phi". The angle of the particle emitted from a
|
||||
source site is isotropic if the "isotropic" option is given. The angle of
|
||||
the particle emitted from a source site is the direction specified in the
|
||||
``reference_uvw`` element/attribute if "monodirectional" option is
|
||||
given. The "mu-phi" option produces directions with the cosine of the
|
||||
polar angle and the azimuthal angle explicitly specified.
|
||||
|
||||
*Default*: isotropic
|
||||
|
||||
:reference_uvw:
|
||||
The direction from which the polar angle is measured. Represented by the
|
||||
x-, y-, and z-components of a unit vector. For a monodirectional
|
||||
distribution, this defines the direction of all sampled particles.
|
||||
|
||||
:mu:
|
||||
An element specifying the distribution of the cosine of the polar
|
||||
angle. Only relevant when the type is "mu-phi". The necessary
|
||||
sub-elements/attributes are those of a univariate probability distribution
|
||||
(see the description in :ref:`univariate`).
|
||||
|
||||
:phi:
|
||||
An element specifying the distribution of the azimuthal angle. Only
|
||||
relevant when the type is "mu-phi". The necessary sub-elements/attributes
|
||||
are those of a univariate probability distribution (see the description in
|
||||
:ref:`univariate`).
|
||||
|
||||
:energy:
|
||||
An element specifying the energy distribution of source sites. The necessary
|
||||
sub-elements/attributes are those of a univariate probability distribution
|
||||
(see the description in :ref:`univariate`).
|
||||
|
||||
*Default*: Watt spectrum with :math:`a` = 0.988 MeV and :math:`b` =
|
||||
2.249 MeV :sup:`-1`
|
||||
|
||||
:write_initial:
|
||||
An element specifying whether to write out the initial source bank used at
|
||||
the beginning of the first batch. The output file is named
|
||||
"initial_source.h5"
|
||||
|
||||
*Default*: false
|
||||
|
||||
.. _univariate:
|
||||
|
||||
Univariate Probability Distributions
|
||||
++++++++++++++++++++++++++++++++++++
|
||||
|
||||
Various components of a source distribution involve probability distributions of
|
||||
a single random variable, e.g. the distribution of the energy, the distribution
|
||||
of the polar angle, and the distribution of x-coordinates. Each of these
|
||||
components supports the same syntax with an element whose tag signifies the
|
||||
variable and whose sub-elements/attributes are as follows:
|
||||
|
||||
:type:
|
||||
The type of the distribution. Valid options are "uniform", "discrete",
|
||||
"tabular", "maxwell", and "watt". The "uniform" option produces variates
|
||||
sampled from a uniform distribution over a finite interval. The "discrete"
|
||||
option produces random variates that can assume a finite number of values
|
||||
(i.e., a distribution characterized by a probability mass function). The
|
||||
"tabular" option produces random variates sampled from a tabulated
|
||||
distribution where the density function is either a histogram or
|
||||
linearly-interpolated between tabulated points. The "watt" option produces
|
||||
random variates is sampled from a Watt fission spectrum (only used for
|
||||
energies). The "maxwell" option produce variates sampled from a Maxwell
|
||||
fission spectrum (only used for energies).
|
||||
|
||||
*Default*: None
|
||||
|
||||
:parameters:
|
||||
For a "uniform" distribution, ``parameters`` should be given as two real
|
||||
numbers :math:`a` and :math:`b` that define the interval :math:`[a,b]` over
|
||||
which random variates are sampled.
|
||||
|
||||
For a "discrete" or "tabular" distribution, ``parameters`` provides the
|
||||
:math:`(x,p)` pairs defining the discrete/tabular distribution. All :math:`x`
|
||||
points are given first followed by corresponding :math:`p` points.
|
||||
|
||||
For a "watt" distribution, ``parameters`` should be given as two real numbers
|
||||
:math:`a` and :math:`b` that parameterize the distribution :math:`p(x) dx = c
|
||||
e^{-x/a} \sinh \sqrt{b \, x} dx`.
|
||||
|
||||
For a "maxwell" distribution, ``parameters`` should be given as one real
|
||||
number :math:`a` that parameterizes the distribution :math:`p(x) dx = c x
|
||||
e^{-x/a} dx`.
|
||||
|
||||
.. note:: The above format should be used even when using the multi-group
|
||||
:ref:`energy_mode`.
|
||||
:interpolation:
|
||||
For a "tabular" distribution, ``interpolation`` can be set to "histogram" or
|
||||
"linear-linear" thereby specifying how tabular points are to be interpolated.
|
||||
|
||||
*Default*: histogram
|
||||
|
||||
-------------------------
|
||||
``<state_point>`` Element
|
||||
-------------------------
|
||||
|
||||
The ``<state_point>`` element indicates at what batches a state point file
|
||||
should be written. A state point file can be used to restart a run or to get
|
||||
tally results at any batch. The default behavior when using this tag is to
|
||||
write out the source bank in the state_point file. This behavior can be
|
||||
customized by using the ``<source_point>`` element. This element has the
|
||||
following attributes/sub-elements:
|
||||
|
||||
:batches:
|
||||
A list of integers separated by spaces indicating at what batches a state
|
||||
point file should be written.
|
||||
|
||||
*Default*: Last batch only
|
||||
|
||||
--------------------------
|
||||
``<source_point>`` Element
|
||||
--------------------------
|
||||
|
||||
The ``<source_point>`` element indicates at what batches the source bank
|
||||
should be written. The source bank can be either written out within a state
|
||||
point file or separately in a source point file. This element has the following
|
||||
attributes/sub-elements:
|
||||
|
||||
:batches:
|
||||
A list of integers separated by spaces indicating at what batches a state
|
||||
point file should be written. It should be noted that if the ``separate``
|
||||
attribute is not set to "true", this list must be a subset of state point
|
||||
batches.
|
||||
|
||||
*Default*: Last batch only
|
||||
|
||||
:separate:
|
||||
If this element is set to "true", a separate binary source point file will
|
||||
be written. Otherwise, the source sites will be written in the state point
|
||||
directly.
|
||||
|
||||
*Default*: false
|
||||
|
||||
:write:
|
||||
If this element is set to "false", source sites are not written
|
||||
to the state point or source point file. This can substantially reduce the
|
||||
size of state points if large numbers of particles per batch are used.
|
||||
|
||||
*Default*: true
|
||||
|
||||
:overwrite_latest:
|
||||
If this element is set to "true", a source point file containing
|
||||
the source bank will be written out to a separate file named
|
||||
``source.binary`` or ``source.h5`` depending on if HDF5 is enabled.
|
||||
This file will be overwritten at every single batch so that the latest
|
||||
source bank will be available. It should be noted that a user can set both
|
||||
this element to "true" and specify batches to write a permanent source bank.
|
||||
|
||||
*Default*: false
|
||||
|
||||
------------------------------
|
||||
``<survival_biasing>`` Element
|
||||
------------------------------
|
||||
|
||||
The ``<survival_biasing>`` element has no attributes and has an accepted value
|
||||
of "true" or "false". If set to "true", this option will enable the use of
|
||||
survival biasing, otherwise known as implicit capture or absorption.
|
||||
|
||||
*Default*: false
|
||||
|
||||
.. _tabular_legendre:
|
||||
|
||||
---------------------------------
|
||||
``<tabular_legendre>`` Element
|
||||
---------------------------------
|
||||
|
||||
The optional ``<tabular_legendre>`` element specifies how the multi-group
|
||||
Legendre scattering kernel is represented if encountered in a multi-group
|
||||
problem. Specifically, the options are to either convert the Legendre
|
||||
expansion to a tabular representation or leave it as a set of Legendre
|
||||
coefficients. Converting to a tabular representation will cost memory but can
|
||||
allow for a decrease in runtime compared to leaving as a set of Legendre
|
||||
coefficients. This element has the following attributes/sub-elements:
|
||||
|
||||
:enable:
|
||||
This attribute/sub-element denotes whether or not the conversion of a
|
||||
Legendre scattering expansion to the tabular format should be performed or
|
||||
not. A value of “true” means the conversion should be performed, “false”
|
||||
means it will not.
|
||||
|
||||
*Default*: true
|
||||
|
||||
:num_points:
|
||||
If the conversion is to take place the number of tabular points is
|
||||
required. This attribute/sub-element allows the user to set the desired
|
||||
number of points.
|
||||
|
||||
*Default*: 33
|
||||
|
||||
.. note:: This element is only used in the multi-group :ref:`energy_mode`.
|
||||
|
||||
.. _temperature_default:
|
||||
|
||||
---------------------------------
|
||||
``<temperature_default>`` Element
|
||||
---------------------------------
|
||||
|
||||
The ``<temperature_default>`` element specifies a default temperature in Kelvin
|
||||
that is to be applied to cells in the absence of an explicit cell temperature or
|
||||
a material default temperature.
|
||||
|
||||
*Default*: 293.6 K
|
||||
|
||||
.. _temperature_method:
|
||||
|
||||
--------------------------------
|
||||
``<temperature_method>`` Element
|
||||
--------------------------------
|
||||
|
||||
The ``<temperature_method>`` element has an accepted value of "nearest" or
|
||||
"interpolation". A value of "nearest" indicates that for each
|
||||
cell, the nearest temperature at which cross sections are given is to be
|
||||
applied, within a given tolerance (see :ref:`temperature_tolerance`). A value of
|
||||
"interpolation" indicates that cross sections are to be linear-linear
|
||||
interpolated between temperatures at which nuclear data are present (see
|
||||
:ref:`temperature_treatment`).
|
||||
|
||||
*Default*: "nearest"
|
||||
|
||||
.. _temperature_multipole:
|
||||
|
||||
-----------------------------------
|
||||
``<temperature_multipole>`` Element
|
||||
-----------------------------------
|
||||
|
||||
The ``<temperature_multipole>`` element toggles the windowed multipole
|
||||
capability on or off. If this element is set to "True" and the relevant data is
|
||||
available, OpenMC will use the windowed multipole method to evaluate and Doppler
|
||||
broaden cross sections in the resolved resonance range. This override other
|
||||
methods like "nearest" and "interpolation" in the resolved resonance range.
|
||||
|
||||
*Default*: False
|
||||
|
||||
.. _temperature_tolerance:
|
||||
|
||||
-----------------------------------
|
||||
``<temperature_tolerance>`` Element
|
||||
-----------------------------------
|
||||
|
||||
The ``<temperature_tolerance>`` element specifies a tolerance in Kelvin that is
|
||||
to be applied when the "nearest" temperature method is used. For example, if a
|
||||
cell temperature is 340 K and the tolerance is 15 K, then the closest
|
||||
temperature in the range of 325 K to 355 K will be used to evaluate cross
|
||||
sections.
|
||||
|
||||
*Default*: 10 K
|
||||
|
||||
---------------------
|
||||
``<threads>`` Element
|
||||
---------------------
|
||||
|
||||
The ``<threads>`` element indicates the number of OpenMP threads to be used for
|
||||
a simulation. It has no attributes and accepts a positive integer value.
|
||||
|
||||
*Default*: None (Determined by environment variable :envvar:`OMP_NUM_THREADS`)
|
||||
|
||||
.. _trace:
|
||||
|
||||
-------------------
|
||||
``<trace>`` Element
|
||||
-------------------
|
||||
|
||||
The ``<trace>`` element can be used to print out detailed information about a
|
||||
single particle during a simulation. This element should be followed by three
|
||||
integers: the batch number, generation number, and particle number.
|
||||
|
||||
*Default*: None
|
||||
|
||||
.. _track:
|
||||
|
||||
-------------------
|
||||
``<track>`` Element
|
||||
-------------------
|
||||
|
||||
The ``<track>`` element specifies particles for which OpenMC will output binary
|
||||
files describing particle position at every step of its transport. This element
|
||||
should be followed by triplets of integers. Each triplet describes one
|
||||
particle. The integers in each triplet specify the batch number, generation
|
||||
number, and particle number, respectively.
|
||||
|
||||
*Default*: None
|
||||
|
||||
.. _trigger:
|
||||
|
||||
-------------------------
|
||||
``<trigger>`` Element
|
||||
-------------------------
|
||||
|
||||
OpenMC includes tally precision triggers which allow the user to define
|
||||
uncertainty thresholds on :math:`k_{eff}` in the ``<keff_trigger>`` subelement
|
||||
of ``settings.xml``, and/or tallies in ``tallies.xml``. When using triggers,
|
||||
OpenMC will run until it completes as many batches as defined by ``<batches>``.
|
||||
At this point, the uncertainties on all tallied values are computed and compared
|
||||
with their corresponding trigger thresholds. If any triggers have not been met,
|
||||
OpenMC will continue until either all trigger thresholds have been satisfied or
|
||||
``<max_batches>`` has been reached.
|
||||
|
||||
The ``<trigger>`` element provides an active "toggle switch" for tally
|
||||
precision trigger(s), the maximum number of batches and the batch interval. It
|
||||
has the following attributes/sub-elements:
|
||||
|
||||
:active:
|
||||
This determines whether or not to use trigger(s). Trigger(s) are used when
|
||||
this tag is set to "true".
|
||||
|
||||
:max_batches:
|
||||
This describes the maximum number of batches allowed when using trigger(s).
|
||||
|
||||
.. note:: When max_batches is set, the number of ``batches`` shown in the
|
||||
``<batches>`` element represents minimum number of batches to
|
||||
simulate when using the trigger(s).
|
||||
|
||||
:batch_interval:
|
||||
This tag describes the number of batches in between convergence checks.
|
||||
OpenMC will check if the trigger has been reached at each batch defined
|
||||
by ``batch_interval`` after the minimum number of batches is reached.
|
||||
|
||||
.. note:: If this tag is not present, the ``batch_interval`` is predicted
|
||||
dynamically by OpenMC for each convergence check. The predictive
|
||||
model assumes no correlation between fission sources
|
||||
distributions from batch-to-batch. This assumption is reasonable
|
||||
for fixed source and small criticality calculations, but is very
|
||||
optimistic for highly coupled full-core reactor problems.
|
||||
|
||||
|
||||
------------------------
|
||||
``<uniform_fs>`` Element
|
||||
------------------------
|
||||
|
||||
The ``<uniform_fs>`` element describes a mesh that is used for re-weighting
|
||||
source sites at every generation based on the uniform fission site methodology
|
||||
described in Kelly et al., "MC21 Analysis of the Nuclear Energy Agency Monte
|
||||
Carlo Performance Benchmark Problem," Proceedings of *Physor 2012*, Knoxville,
|
||||
TN (2012). This mesh should cover all possible fissionable materials in the
|
||||
problem. It has the following attributes/sub-elements:
|
||||
|
||||
:dimension:
|
||||
The number of mesh cells in the x, y, and z directions, respectively.
|
||||
|
||||
*Default*: None
|
||||
|
||||
:lower_left:
|
||||
The Cartesian coordinates of the lower-left corner of the mesh.
|
||||
|
||||
*Default*: None
|
||||
|
||||
:upper_right:
|
||||
The Cartesian coordinates of the upper-right corner of the mesh.
|
||||
|
||||
*Default*: None
|
||||
|
||||
.. _verbosity:
|
||||
|
||||
-----------------------
|
||||
``<verbosity>`` Element
|
||||
-----------------------
|
||||
|
||||
The ``<verbosity>`` element tells the code how much information to display to
|
||||
the standard output. A higher verbosity corresponds to more information being
|
||||
displayed. The text of this element should be an integer between between 1
|
||||
and 10. The verbosity levels are defined as follows:
|
||||
|
||||
:1: don't display any output
|
||||
:2: only show OpenMC logo
|
||||
:3: all of the above + headers
|
||||
:4: all of the above + results
|
||||
:5: all of the above + file I/O
|
||||
:6: all of the above + timing statistics and initialization messages
|
||||
:7: all of the above + :math:`k` by generation
|
||||
:9: all of the above + indicate when each particle starts
|
||||
:10: all of the above + event information
|
||||
|
||||
*Default*: 7
|
||||
|
||||
-------------------------------------
|
||||
``<create_fission_neutrons>`` Element
|
||||
-------------------------------------
|
||||
|
||||
The ``<create_fission_neutrons>`` element indicates whether fission neutrons
|
||||
should be created or not. If this element is set to "true", fission neutrons
|
||||
will be created; otherwise the fission is treated as capture and no fission
|
||||
neutron will be created. Note that this option is only applied to fixed source
|
||||
calculation. For eigenvalue calculation, fission will always be treated as real
|
||||
fission.
|
||||
|
||||
*Default*: true
|
||||
|
||||
|
||||
-------------------------
|
||||
``<volume_calc>`` Element
|
||||
-------------------------
|
||||
|
||||
The ``<volume_calc>`` element indicates that a stochastic volume calculation
|
||||
should be run at the beginning of the simulation. This element has the following
|
||||
sub-elements/attributes:
|
||||
|
||||
:cells:
|
||||
The unique IDs of cells for which the volume should be estimated.
|
||||
|
||||
*Default*: None
|
||||
|
||||
:samples:
|
||||
The number of samples used to estimate volumes.
|
||||
|
||||
*Default*: None
|
||||
|
||||
:lower_left:
|
||||
The lower-left Cartesian coordinates of a bounding box that is used to
|
||||
sample points within.
|
||||
|
||||
*Default*: None
|
||||
|
||||
:upper_right:
|
||||
The upper-right Cartesian coordinates of a bounding box that is used to
|
||||
sample points within.
|
||||
|
||||
*Default*: None
|
||||
361
docs/source/io_formats/tallies.rst
Normal file
361
docs/source/io_formats/tallies.rst
Normal file
|
|
@ -0,0 +1,361 @@
|
|||
.. _io_tallies:
|
||||
|
||||
====================================
|
||||
Tallies Specification -- tallies.xml
|
||||
====================================
|
||||
|
||||
The tallies.xml file allows the user to tell the code what results he/she is
|
||||
interested in, e.g. the fission rate in a given cell or the current across a
|
||||
given surface. There are two pieces of information that determine what
|
||||
quantities should be scored. First, one needs to specify what region of phase
|
||||
space should count towards the tally and secondly, the actual quantity to be
|
||||
scored also needs to be specified. The first set of parameters we call *filters*
|
||||
since they effectively serve to filter events, allowing some to score and
|
||||
preventing others from scoring to the tally.
|
||||
|
||||
The structure of tallies in OpenMC is flexible in that any combination of
|
||||
filters can be used for a tally. The following types of filter are available:
|
||||
cell, universe, material, surface, birth region, pre-collision energy,
|
||||
post-collision energy, and an arbitrary structured mesh.
|
||||
|
||||
The three valid elements in the tallies.xml file are ``<tally>``, ``<mesh>``,
|
||||
and ``<assume_separate>``.
|
||||
|
||||
.. _tally:
|
||||
|
||||
-------------------
|
||||
``<tally>`` Element
|
||||
-------------------
|
||||
|
||||
The ``<tally>`` element accepts the following sub-elements:
|
||||
|
||||
:name:
|
||||
An optional string name to identify the tally in summary output
|
||||
files. This string is limited to 52 characters for formatting purposes.
|
||||
|
||||
*Default*: ""
|
||||
|
||||
:filter:
|
||||
Specify a filter that modifies tally behavior. Most tallies (e.g. ``cell``,
|
||||
``energy``, and ``material``) restrict the tally so that only particles
|
||||
within certain regions of phase space contribute to the tally. Others
|
||||
(e.g. ``delayedgroup`` and ``energyfunction``) can apply some other function
|
||||
to the scored values. This element and its attributes/sub-elements are
|
||||
described below.
|
||||
|
||||
.. note::
|
||||
You may specify zero, one, or multiple filters to apply to the tally. To
|
||||
specify multiple filters, you must use multiple ``<filter>`` elements.
|
||||
|
||||
The ``filter`` element has the following attributes/sub-elements:
|
||||
|
||||
:type:
|
||||
The type of the filter. Accepted options are "cell", "cellborn",
|
||||
"material", "universe", "energy", "energyout", "mu", "polar",
|
||||
"azimuthal", "mesh", "distribcell", "delayedgroup", and
|
||||
"energyfunction".
|
||||
|
||||
:bins:
|
||||
A description of the bins for each type of filter can be found in
|
||||
:ref:`filter_types`.
|
||||
|
||||
:energy:
|
||||
``energyfunction`` filters multiply tally scores by an arbitrary
|
||||
function. The function is described by a piecewise linear-linear set of
|
||||
(energy, y) values. This entry specifies the energy values. The function
|
||||
will be evaluated as zero outside of the bounds of this energy grid.
|
||||
(Only used for ``energyfunction`` filters)
|
||||
|
||||
:y:
|
||||
``energyfunction`` filters multiply tally scores by an arbitrary
|
||||
function. The function is described by a piecewise linear-linear set of
|
||||
(energy, y) values. This entry specifies the y values. (Only used
|
||||
for ``energyfunction`` filters)
|
||||
|
||||
:nuclides:
|
||||
If specified, the scores listed will be for particular nuclides, not the
|
||||
summation of reactions from all nuclides. The format for nuclides should be
|
||||
[Atomic symbol]-[Mass number], e.g. "U-235". The reaction rate for all
|
||||
nuclides can be obtained with "total". For example, to obtain the reaction
|
||||
rates for U-235, Pu-239, and all nuclides in a material, this element should
|
||||
be:
|
||||
|
||||
.. code-block:: xml
|
||||
|
||||
<nuclides>U-235 Pu-239 total</nuclides>
|
||||
|
||||
*Default*: total
|
||||
|
||||
:estimator:
|
||||
The estimator element is used to force the use of either ``analog``,
|
||||
``collision``, or ``tracklength`` tally estimation. ``analog`` is generally
|
||||
the least efficient though it can be used with every score type.
|
||||
``tracklength`` is generally the most efficient, but neither ``tracklength``
|
||||
nor ``collision`` can be used to score a tally that requires post-collision
|
||||
information. For example, a scattering tally with outgoing energy filters
|
||||
cannot be used with ``tracklength`` or ``collision`` because the code will
|
||||
not know the outgoing energy distribution.
|
||||
|
||||
*Default*: ``tracklength`` but will revert to ``analog`` if necessary.
|
||||
|
||||
:scores:
|
||||
A space-separated list of the desired responses to be accumulated. A full
|
||||
list of valid scores can be found in the :ref:`user's guide
|
||||
<usersguide_scores>`.
|
||||
|
||||
:trigger:
|
||||
Precision trigger applied to all filter bins and nuclides for this tally.
|
||||
It must specify the trigger's type, threshold and scores to which it will
|
||||
be applied. It has the following attributes/sub-elements:
|
||||
|
||||
:type:
|
||||
The type of the trigger. Accepted options are "variance", "std_dev",
|
||||
and "rel_err".
|
||||
|
||||
:variance:
|
||||
Variance of the batch mean :math:`\sigma^2`
|
||||
|
||||
:std_dev:
|
||||
Standard deviation of the batch mean :math:`\sigma`
|
||||
|
||||
:rel_err:
|
||||
Relative error of the batch mean :math:`\frac{\sigma}{\mu}`
|
||||
|
||||
*Default*: None
|
||||
|
||||
:threshold:
|
||||
The precision trigger's convergence criterion for tallied values.
|
||||
|
||||
*Default*: None
|
||||
|
||||
:scores:
|
||||
The score(s) in this tally to which the trigger should be applied.
|
||||
|
||||
.. note:: The ``scores`` in ``trigger`` must have been defined in
|
||||
``scores`` in ``tally``. An optional "all" may be used to
|
||||
select all scores in this tally.
|
||||
|
||||
*Default*: "all"
|
||||
|
||||
:derivative:
|
||||
The id of a ``derivative`` element. This derivative will be applied to all
|
||||
scores in the tally. Differential tallies are currently only implemented
|
||||
for collision and analog estimators.
|
||||
|
||||
*Default*: None
|
||||
|
||||
.. _filter_types:
|
||||
|
||||
Filter Types
|
||||
++++++++++++
|
||||
|
||||
For each filter type, the following table describes what the ``bins`` attribute
|
||||
should be set to:
|
||||
|
||||
:cell:
|
||||
A list of unique IDs for cells in which the tally should be accumulated.
|
||||
|
||||
:cellborn:
|
||||
This filter allows the tally to be scored to only when particles were
|
||||
originally born in a specified cell. A list of cell IDs should be given.
|
||||
|
||||
:material:
|
||||
A list of unique IDs for matreials in which the tally should be accumulated.
|
||||
|
||||
:universe:
|
||||
A list of unique IDs for universes in which the tally should be accumulated.
|
||||
|
||||
:energy:
|
||||
In continuous-energy mode, this filter should be provided as a
|
||||
monotonically increasing list of bounding **pre-collision** energies
|
||||
for a number of groups. For example, if this filter is specified as
|
||||
|
||||
.. code-block:: xml
|
||||
|
||||
<filter type="energy" bins="0.0 1.0e6 20.0e6" />
|
||||
|
||||
then two energy bins will be created, one with energies between 0 and
|
||||
1 MeV and the other with energies between 1 and 20 MeV.
|
||||
|
||||
In multi-group mode the bins provided must match group edges
|
||||
defined in the multi-group library.
|
||||
|
||||
:energyout:
|
||||
In continuous-energy mode, this filter should be provided as a
|
||||
monotonically increasing list of bounding **post-collision** energies
|
||||
for a number of groups. For example, if this filter is specified as
|
||||
|
||||
.. code-block:: xml
|
||||
|
||||
<filter type="energyout" bins="0.0 1.0e6 20.0e6" />
|
||||
|
||||
then two post-collision energy bins will be created, one with
|
||||
energies between 0 and 1 MeV and the other with energies between
|
||||
1 and 20 MeV.
|
||||
|
||||
In multi-group mode the bins provided must match group edges
|
||||
defined in the multi-group library.
|
||||
|
||||
:mu:
|
||||
A monotonically increasing list of bounding **post-collision** cosines
|
||||
of the change in a particle's angle (i.e., :math:`\mu = \hat{\Omega}
|
||||
\cdot \hat{\Omega}'`), which represents a portion of the possible
|
||||
values of :math:`[-1,1]`. For example, spanning all of :math:`[-1,1]`
|
||||
with five equi-width bins can be specified as:
|
||||
|
||||
.. code-block:: xml
|
||||
|
||||
<filter type="mu" bins="-1.0 -0.6 -0.2 0.2 0.6 1.0" />
|
||||
|
||||
Alternatively, if only one value is provided as a bin, OpenMC will
|
||||
interpret this to mean the complete range of :math:`[-1,1]` should
|
||||
be automatically subdivided in to the provided value for the bin.
|
||||
That is, the above example of five equi-width bins spanning
|
||||
:math:`[-1,1]` can be instead written as:
|
||||
|
||||
.. code-block:: xml
|
||||
|
||||
<filter type="mu" bins="5" />
|
||||
|
||||
:polar:
|
||||
A monotonically increasing list of bounding particle polar angles
|
||||
which represents a portion of the possible values of :math:`[0,\pi]`.
|
||||
For example, spanning all of :math:`[0,\pi]` with five equi-width
|
||||
bins can be specified as:
|
||||
|
||||
.. code-block:: xml
|
||||
|
||||
<filter type="polar" bins="0.0 0.6283 1.2566 1.8850 2.5132 3.1416"/>
|
||||
|
||||
Alternatively, if only one value is provided as a bin, OpenMC will
|
||||
interpret this to mean the complete range of :math:`[0,\pi]` should
|
||||
be automatically subdivided in to the provided value for the bin.
|
||||
That is, the above example of five equi-width bins spanning
|
||||
:math:`[0,\pi]` can be instead written as:
|
||||
|
||||
.. code-block:: xml
|
||||
|
||||
<filter type="polar" bins="5" />
|
||||
|
||||
:azimuthal:
|
||||
A monotonically increasing list of bounding particle azimuthal angles
|
||||
which represents a portion of the possible values of :math:`[-\pi,\pi)`.
|
||||
For example, spanning all of :math:`[-\pi,\pi)` with two equi-width
|
||||
bins can be specified as:
|
||||
|
||||
.. code-block:: xml
|
||||
|
||||
<filter type="azimuthal" bins="0.0 3.1416 6.2832" />
|
||||
|
||||
Alternatively, if only one value is provided as a bin, OpenMC will
|
||||
interpret this to mean the complete range of :math:`[-\pi,\pi)` should
|
||||
be automatically subdivided in to the provided value for the bin.
|
||||
That is, the above example of five equi-width bins spanning
|
||||
:math:`[-\pi,\pi)` can be instead written as:
|
||||
|
||||
.. code-block:: xml
|
||||
|
||||
<filter type="azimuthal" bins="2" />
|
||||
|
||||
:mesh:
|
||||
The unique ID of a structured mesh to be tallied over.
|
||||
|
||||
:distribcell:
|
||||
The single cell which should be tallied uniquely for all instances.
|
||||
|
||||
.. note:: The distribcell filter will take a single cell ID and will tally
|
||||
each unique occurrence of that cell separately. This filter will not
|
||||
accept more than one cell ID. It is not recommended to combine this
|
||||
filter with a cell or mesh filter.
|
||||
|
||||
:delayedgroup:
|
||||
A list of delayed neutron precursor groups for which the tally should
|
||||
be accumulated. For instance, to tally to all 6 delayed groups in the
|
||||
ENDF/B-VII.1 library the filter is specified as:
|
||||
|
||||
.. code-block:: xml
|
||||
|
||||
<filter type="delayedgroup" bins="1 2 3 4 5 6" />
|
||||
|
||||
:energyfunction:
|
||||
``energyfunction`` filters do not use the ``bins`` entry. Instead
|
||||
they use ``energy`` and ``y``.
|
||||
|
||||
|
||||
------------------
|
||||
``<mesh>`` Element
|
||||
------------------
|
||||
|
||||
If a structured mesh is desired as a filter for a tally, it must be specified in
|
||||
a separate element with the tag name ``<mesh>``. This element has the following
|
||||
attributes/sub-elements:
|
||||
|
||||
:type:
|
||||
The type of structured mesh. The only valid option is "regular".
|
||||
|
||||
:dimension:
|
||||
The number of mesh cells in each direction.
|
||||
|
||||
:lower_left:
|
||||
The lower-left corner of the structured mesh. If only two coordinates are
|
||||
given, it is assumed that the mesh is an x-y mesh.
|
||||
|
||||
:upper_right:
|
||||
The upper-right corner of the structured mesh. If only two coordinates are
|
||||
given, it is assumed that the mesh is an x-y mesh.
|
||||
|
||||
:width:
|
||||
The width of mesh cells in each direction.
|
||||
|
||||
.. note::
|
||||
One of ``<upper_right>`` or ``<width>`` must be specified, but not both
|
||||
(even if they are consistent with one another).
|
||||
|
||||
------------------------
|
||||
``<derivative>`` Element
|
||||
------------------------
|
||||
|
||||
OpenMC can take the first-order derivative of many tallies with respect to
|
||||
material perturbations. It works by propagating a derivative through the
|
||||
transport equation. Essentially, OpenMC keeps track of how each particle's
|
||||
weight would change as materials are perturbed, and then accounts for that
|
||||
weight change in the tallies. Note that this assumes material perturbations are
|
||||
small enough not to change the distribution of fission sites. This element has
|
||||
the following attributes/sub-elements:
|
||||
|
||||
:id:
|
||||
A unique integer that can be used to identify the derivative.
|
||||
|
||||
:variable:
|
||||
The independent variable of the derivative. Accepted options are "density",
|
||||
"nuclide_density", and "temperature". A "density" derivative will give the
|
||||
derivative with respect to the density of the material in [g / cm^3]. A
|
||||
"nuclide_density" derivative will give the derivative with respect to the
|
||||
density of a particular nuclide in units of [atom / b / cm]. A
|
||||
"temperature" derivative is with respect to a material temperature in units
|
||||
of [K]. The temperature derivative requires windowed multipole to be
|
||||
turned on. Note also that the temperature derivative only accounts for
|
||||
resolved resonance Doppler broadening. It does not account for thermal
|
||||
expansion, S(a, b) scattering, resonance scattering, or unresolved Doppler
|
||||
broadening.
|
||||
|
||||
:material:
|
||||
The perturbed material. (Necessary for all derivative types)
|
||||
|
||||
:nuclide:
|
||||
The perturbed nuclide. (Necessary only for "nuclide_density")
|
||||
|
||||
-----------------------------
|
||||
``<assume_separate>`` Element
|
||||
-----------------------------
|
||||
|
||||
In cases where the user needs to specify many different tallies each of which
|
||||
are spatially separate, this tag can be used to cut down on some of the tally
|
||||
overhead. The effect of assuming all tallies are spatially separate is that once
|
||||
one tally is scored to, the same event is assumed not to score to any other
|
||||
tallies. This element should be followed by "true" or "false".
|
||||
|
||||
.. warning:: If used incorrectly, the assumption that all tallies are
|
||||
spatially separate can lead to incorrect results.
|
||||
|
||||
*Default*: false
|
||||
|
|
@ -402,7 +402,7 @@ information:
|
|||
It should be noted that for more difficult simulations (e.g., light water
|
||||
reactors), there are other options available to users such as tally resetting
|
||||
parameters, effective down-scatter usage, tally estimator, etc. For more
|
||||
information please see :ref:`usersguide_cmfd`.
|
||||
information please see :ref:`io_cmfd`.
|
||||
|
||||
Of the options described above, the optional acceleration subset region is an
|
||||
uncommon feature. Because OpenMC only has a structured Cartesian mesh, mesh
|
||||
|
|
|
|||
|
|
@ -1657,7 +1657,7 @@ another.
|
|||
|
||||
.. _OECD: http://www.oecd-nea.org/dbprog/MMRW-BOOKS.html
|
||||
|
||||
.. _NJOY: http://t2.lanl.gov/codes.shtml
|
||||
.. _NJOY: https://njoy.github.io/NJOY2016/
|
||||
|
||||
.. _PREPRO: http://www-nds.iaea.org/ndspub/endf/prepro/
|
||||
|
||||
|
|
|
|||
197
docs/source/pythonapi/base.rst
Normal file
197
docs/source/pythonapi/base.rst
Normal file
|
|
@ -0,0 +1,197 @@
|
|||
------------------------------------
|
||||
:mod:`openmc` -- Basic Functionality
|
||||
------------------------------------
|
||||
|
||||
Handling nuclear data
|
||||
---------------------
|
||||
|
||||
.. autosummary::
|
||||
:toctree: generated
|
||||
:nosignatures:
|
||||
:template: myclass.rst
|
||||
|
||||
openmc.XSdata
|
||||
openmc.MGXSLibrary
|
||||
|
||||
Simulation Settings
|
||||
-------------------
|
||||
|
||||
.. autosummary::
|
||||
:toctree: generated
|
||||
:nosignatures:
|
||||
:template: myclass.rst
|
||||
|
||||
openmc.Source
|
||||
openmc.VolumeCalculation
|
||||
openmc.Settings
|
||||
|
||||
Material Specification
|
||||
----------------------
|
||||
|
||||
.. autosummary::
|
||||
:toctree: generated
|
||||
:nosignatures:
|
||||
:template: myclass.rst
|
||||
|
||||
openmc.Nuclide
|
||||
openmc.Element
|
||||
openmc.Macroscopic
|
||||
openmc.Material
|
||||
openmc.Materials
|
||||
|
||||
Cross sections for nuclides, elements, and materials can be plotted using the
|
||||
following function:
|
||||
|
||||
.. autosummary::
|
||||
:toctree: generated
|
||||
:nosignatures:
|
||||
:template: myfunction.rst
|
||||
|
||||
openmc.plot_xs
|
||||
|
||||
Building geometry
|
||||
-----------------
|
||||
|
||||
.. autosummary::
|
||||
:toctree: generated
|
||||
:nosignatures:
|
||||
:template: myclass.rst
|
||||
|
||||
openmc.Plane
|
||||
openmc.XPlane
|
||||
openmc.YPlane
|
||||
openmc.ZPlane
|
||||
openmc.XCylinder
|
||||
openmc.YCylinder
|
||||
openmc.ZCylinder
|
||||
openmc.Sphere
|
||||
openmc.Cone
|
||||
openmc.XCone
|
||||
openmc.YCone
|
||||
openmc.ZCone
|
||||
openmc.Quadric
|
||||
openmc.Halfspace
|
||||
openmc.Intersection
|
||||
openmc.Union
|
||||
openmc.Complement
|
||||
openmc.Cell
|
||||
openmc.Universe
|
||||
openmc.RectLattice
|
||||
openmc.HexLattice
|
||||
openmc.Geometry
|
||||
|
||||
Many of the above classes are derived from several abstract classes:
|
||||
|
||||
.. autosummary::
|
||||
:toctree: generated
|
||||
:nosignatures:
|
||||
:template: myclass.rst
|
||||
|
||||
openmc.Surface
|
||||
openmc.Region
|
||||
openmc.Lattice
|
||||
|
||||
Two helper function are also available to create rectangular and hexagonal
|
||||
prisms defined by the intersection of four and six surface half-spaces,
|
||||
respectively.
|
||||
|
||||
.. autosummary::
|
||||
:toctree: generated
|
||||
:nosignatures:
|
||||
:template: myfunction.rst
|
||||
|
||||
openmc.get_hexagonal_prism
|
||||
openmc.get_rectangular_prism
|
||||
|
||||
.. _pythonapi_tallies:
|
||||
|
||||
Constructing Tallies
|
||||
--------------------
|
||||
|
||||
.. autosummary::
|
||||
:toctree: generated
|
||||
:nosignatures:
|
||||
:template: myclass.rst
|
||||
|
||||
openmc.Filter
|
||||
openmc.UniverseFilter
|
||||
openmc.MaterialFilter
|
||||
openmc.CellFilter
|
||||
openmc.CellbornFilter
|
||||
openmc.SurfaceFilter
|
||||
openmc.MeshFilter
|
||||
openmc.EnergyFilter
|
||||
openmc.EnergyoutFilter
|
||||
openmc.MuFilter
|
||||
openmc.PolarFilter
|
||||
openmc.AzimuthalFilter
|
||||
openmc.DistribcellFilter
|
||||
openmc.DelayedGroupFilter
|
||||
openmc.EnergyFunctionFilter
|
||||
openmc.Mesh
|
||||
openmc.Trigger
|
||||
openmc.TallyDerivative
|
||||
openmc.Tally
|
||||
openmc.Tallies
|
||||
|
||||
Coarse Mesh Finite Difference Acceleration
|
||||
------------------------------------------
|
||||
|
||||
.. autosummary::
|
||||
:toctree: generated
|
||||
:nosignatures:
|
||||
:template: myclass.rst
|
||||
|
||||
openmc.CMFDMesh
|
||||
openmc.CMFD
|
||||
|
||||
Geometry Plotting
|
||||
-----------------
|
||||
|
||||
.. autosummary::
|
||||
:toctree: generated
|
||||
:nosignatures:
|
||||
:template: myclass.rst
|
||||
|
||||
openmc.Plot
|
||||
openmc.Plots
|
||||
|
||||
Running OpenMC
|
||||
--------------
|
||||
|
||||
.. autosummary::
|
||||
:toctree: generated
|
||||
:nosignatures:
|
||||
:template: myfunction.rst
|
||||
|
||||
openmc.run
|
||||
openmc.calculate_volumes
|
||||
openmc.plot_geometry
|
||||
openmc.plot_inline
|
||||
openmc.search_for_keff
|
||||
|
||||
Post-processing
|
||||
---------------
|
||||
|
||||
.. autosummary::
|
||||
:toctree: generated
|
||||
:nosignatures:
|
||||
:template: myclass.rst
|
||||
|
||||
openmc.Particle
|
||||
openmc.StatePoint
|
||||
openmc.Summary
|
||||
|
||||
Various classes may be created when performing tally slicing and/or arithmetic:
|
||||
|
||||
.. autosummary::
|
||||
:toctree: generated
|
||||
:nosignatures:
|
||||
:template: myclass.rst
|
||||
|
||||
openmc.arithmetic.CrossScore
|
||||
openmc.arithmetic.CrossNuclide
|
||||
openmc.arithmetic.CrossFilter
|
||||
openmc.arithmetic.AggregateScore
|
||||
openmc.arithmetic.AggregateNuclide
|
||||
openmc.arithmetic.AggregateFilter
|
||||
134
docs/source/pythonapi/data.rst
Normal file
134
docs/source/pythonapi/data.rst
Normal file
|
|
@ -0,0 +1,134 @@
|
|||
--------------------------------------------
|
||||
:mod:`openmc.data` -- Nuclear Data Interface
|
||||
--------------------------------------------
|
||||
|
||||
Core Classes
|
||||
------------
|
||||
|
||||
.. autosummary::
|
||||
:toctree: generated
|
||||
:nosignatures:
|
||||
:template: myclass.rst
|
||||
|
||||
openmc.data.IncidentNeutron
|
||||
openmc.data.Reaction
|
||||
openmc.data.Product
|
||||
openmc.data.Tabulated1D
|
||||
openmc.data.FissionEnergyRelease
|
||||
openmc.data.ThermalScattering
|
||||
openmc.data.CoherentElastic
|
||||
openmc.data.FissionEnergyRelease
|
||||
openmc.data.DataLibrary
|
||||
openmc.data.Decay
|
||||
openmc.data.FissionProductYields
|
||||
openmc.data.WindowedMultipole
|
||||
|
||||
Core Functions
|
||||
--------------
|
||||
|
||||
.. autosummary::
|
||||
:toctree: generated
|
||||
:nosignatures:
|
||||
:template: myfunction.rst
|
||||
|
||||
openmc.data.atomic_mass
|
||||
openmc.data.linearize
|
||||
openmc.data.thin
|
||||
openmc.data.write_compact_458_library
|
||||
|
||||
Angle-Energy Distributions
|
||||
--------------------------
|
||||
|
||||
.. autosummary::
|
||||
:toctree: generated
|
||||
:nosignatures:
|
||||
:template: myclass.rst
|
||||
|
||||
openmc.data.AngleEnergy
|
||||
openmc.data.KalbachMann
|
||||
openmc.data.CorrelatedAngleEnergy
|
||||
openmc.data.UncorrelatedAngleEnergy
|
||||
openmc.data.NBodyPhaseSpace
|
||||
openmc.data.LaboratoryAngleEnergy
|
||||
openmc.data.AngleDistribution
|
||||
openmc.data.EnergyDistribution
|
||||
openmc.data.ArbitraryTabulated
|
||||
openmc.data.GeneralEvaporation
|
||||
openmc.data.MaxwellEnergy
|
||||
openmc.data.Evaporation
|
||||
openmc.data.WattEnergy
|
||||
openmc.data.MadlandNix
|
||||
openmc.data.DiscretePhoton
|
||||
openmc.data.LevelInelastic
|
||||
openmc.data.ContinuousTabular
|
||||
|
||||
Resonance Data
|
||||
--------------
|
||||
|
||||
.. autosummary::
|
||||
:toctree: generated
|
||||
:nosignatures:
|
||||
:template: myclass.rst
|
||||
|
||||
openmc.data.Resonances
|
||||
openmc.data.ResonanceRange
|
||||
openmc.data.SingleLevelBreitWigner
|
||||
openmc.data.MultiLevelBreitWigner
|
||||
openmc.data.ReichMoore
|
||||
openmc.data.RMatrixLimited
|
||||
openmc.data.ParticlePair
|
||||
openmc.data.SpinGroup
|
||||
openmc.data.Unresolved
|
||||
|
||||
ACE Format
|
||||
----------
|
||||
|
||||
Classes
|
||||
+++++++
|
||||
|
||||
.. autosummary::
|
||||
:toctree: generated
|
||||
:nosignatures:
|
||||
:template: myclass.rst
|
||||
|
||||
openmc.data.ace.Library
|
||||
openmc.data.ace.Table
|
||||
|
||||
Functions
|
||||
+++++++++
|
||||
|
||||
.. autosummary::
|
||||
:toctree: generated
|
||||
:nosignatures:
|
||||
:template: myfunction.rst
|
||||
|
||||
openmc.data.ace.ascii_to_binary
|
||||
|
||||
ENDF Format
|
||||
-----------
|
||||
|
||||
Classes
|
||||
+++++++
|
||||
|
||||
.. autosummary::
|
||||
:toctree: generated
|
||||
:nosignatures:
|
||||
:template: myclass.rst
|
||||
|
||||
openmc.data.endf.Evaluation
|
||||
|
||||
Functions
|
||||
+++++++++
|
||||
|
||||
.. autosummary::
|
||||
:toctree: generated
|
||||
:nosignatures:
|
||||
:template: myfunction.rst
|
||||
|
||||
openmc.data.endf.float_endf
|
||||
openmc.data.endf.get_cont_record
|
||||
openmc.data.endf.get_evaluations
|
||||
openmc.data.endf.get_head_record
|
||||
openmc.data.endf.get_tab1_record
|
||||
openmc.data.endf.get_tab2_record
|
||||
openmc.data.endf.get_text_record
|
||||
25
docs/source/pythonapi/examples.rst
Normal file
25
docs/source/pythonapi/examples.rst
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
----------------------------------------
|
||||
:mod:`openmc.examples` -- Example Models
|
||||
----------------------------------------
|
||||
|
||||
Simple Models
|
||||
-------------
|
||||
|
||||
.. autosummary::
|
||||
:toctree: generated
|
||||
:nosignatures:
|
||||
:template: myfunction.rst
|
||||
|
||||
openmc.examples.slab_mg
|
||||
|
||||
Reactor Models
|
||||
--------------
|
||||
|
||||
.. autosummary::
|
||||
:toctree: generated
|
||||
:nosignatures:
|
||||
:template: myfunction.rst
|
||||
|
||||
openmc.examples.pwr_pin_cell
|
||||
openmc.examples.pwr_assembly
|
||||
openmc.examples.pwr_core
|
||||
|
|
@ -6,507 +6,46 @@ Python API
|
|||
|
||||
OpenMC includes a rich Python API that enables programmatic pre- and
|
||||
post-processing. The easiest way to begin using the API is to take a look at the
|
||||
example Jupyter_ notebooks provided in the :ref:`examples` section of the
|
||||
documentation. However, this assumes that you are already familiar with Python
|
||||
and common third-party packages such as NumPy_. If you have never programmed in
|
||||
Python before, there are many good tutorials available online. We recommend
|
||||
going through the modules from Codecademy_ and/or the `Scipy lectures`_. The
|
||||
full API documentation serves to provide more information on a given module or
|
||||
class.
|
||||
|
||||
------------------------------------
|
||||
:mod:`openmc` -- Basic Functionality
|
||||
------------------------------------
|
||||
|
||||
Handling nuclear data
|
||||
---------------------
|
||||
|
||||
.. autosummary::
|
||||
:toctree: generated
|
||||
:nosignatures:
|
||||
:template: myclass.rst
|
||||
|
||||
openmc.XSdata
|
||||
openmc.MGXSLibrary
|
||||
|
||||
|
||||
Simulation Settings
|
||||
-------------------
|
||||
|
||||
.. autosummary::
|
||||
:toctree: generated
|
||||
:nosignatures:
|
||||
:template: myclass.rst
|
||||
|
||||
openmc.Source
|
||||
openmc.ResonanceScattering
|
||||
openmc.VolumeCalculation
|
||||
openmc.Settings
|
||||
|
||||
Material Specification
|
||||
----------------------
|
||||
|
||||
.. autosummary::
|
||||
:toctree: generated
|
||||
:nosignatures:
|
||||
:template: myclass.rst
|
||||
|
||||
openmc.Nuclide
|
||||
openmc.Element
|
||||
openmc.Macroscopic
|
||||
openmc.Material
|
||||
openmc.Materials
|
||||
|
||||
Building geometry
|
||||
-----------------
|
||||
|
||||
.. autosummary::
|
||||
:toctree: generated
|
||||
:nosignatures:
|
||||
:template: myclass.rst
|
||||
|
||||
openmc.Plane
|
||||
openmc.XPlane
|
||||
openmc.YPlane
|
||||
openmc.ZPlane
|
||||
openmc.XCylinder
|
||||
openmc.YCylinder
|
||||
openmc.ZCylinder
|
||||
openmc.Sphere
|
||||
openmc.Cone
|
||||
openmc.XCone
|
||||
openmc.YCone
|
||||
openmc.ZCone
|
||||
openmc.Quadric
|
||||
openmc.Halfspace
|
||||
openmc.Intersection
|
||||
openmc.Union
|
||||
openmc.Complement
|
||||
openmc.Cell
|
||||
openmc.Universe
|
||||
openmc.RectLattice
|
||||
openmc.HexLattice
|
||||
openmc.Geometry
|
||||
|
||||
Many of the above classes are derived from several abstract classes:
|
||||
|
||||
.. autosummary::
|
||||
:toctree: generated
|
||||
:nosignatures:
|
||||
:template: myclass.rst
|
||||
|
||||
openmc.Surface
|
||||
openmc.Region
|
||||
openmc.Lattice
|
||||
|
||||
Two helper function are also available to create rectangular and hexagonal
|
||||
prisms defined by the intersection of four and six surface half-spaces,
|
||||
respectively.
|
||||
|
||||
.. autosummary::
|
||||
:toctree: generated
|
||||
:nosignatures:
|
||||
:template: myfunction.rst
|
||||
|
||||
openmc.get_hexagonal_prism
|
||||
openmc.get_rectangular_prism
|
||||
|
||||
Constructing Tallies
|
||||
--------------------
|
||||
|
||||
.. autosummary::
|
||||
:toctree: generated
|
||||
:nosignatures:
|
||||
:template: myclass.rst
|
||||
|
||||
openmc.UniverseFilter
|
||||
openmc.MaterialFilter
|
||||
openmc.CellFilter
|
||||
openmc.CellbornFilter
|
||||
openmc.SurfaceFilter
|
||||
openmc.MeshFilter
|
||||
openmc.EnergyFilter
|
||||
openmc.EnergyoutFilter
|
||||
openmc.MuFilter
|
||||
openmc.PolarFilter
|
||||
openmc.AzimuthalFilter
|
||||
openmc.DistribcellFilter
|
||||
openmc.DelayedGroupFilter
|
||||
openmc.EnergyFunctionFilter
|
||||
openmc.Mesh
|
||||
openmc.Trigger
|
||||
openmc.TallyDerivative
|
||||
openmc.Tally
|
||||
openmc.Tallies
|
||||
|
||||
Coarse Mesh Finite Difference Acceleration
|
||||
------------------------------------------
|
||||
|
||||
.. autosummary::
|
||||
:toctree: generated
|
||||
:nosignatures:
|
||||
:template: myclass.rst
|
||||
|
||||
openmc.CMFDMesh
|
||||
openmc.CMFD
|
||||
|
||||
Plotting
|
||||
--------
|
||||
|
||||
.. autosummary::
|
||||
:toctree: generated
|
||||
:nosignatures:
|
||||
:template: myclass.rst
|
||||
|
||||
openmc.Plot
|
||||
openmc.Plots
|
||||
|
||||
Running OpenMC
|
||||
--------------
|
||||
|
||||
.. autosummary::
|
||||
:toctree: generated
|
||||
:nosignatures:
|
||||
:template: myfunction.rst
|
||||
|
||||
openmc.run
|
||||
openmc.calculate_volumes
|
||||
openmc.plot_geometry
|
||||
openmc.plot_inline
|
||||
openmc.search_for_keff
|
||||
|
||||
Post-processing
|
||||
---------------
|
||||
|
||||
.. autosummary::
|
||||
:toctree: generated
|
||||
:nosignatures:
|
||||
:template: myclass.rst
|
||||
|
||||
openmc.Particle
|
||||
openmc.StatePoint
|
||||
openmc.Summary
|
||||
|
||||
Various classes may be created when performing tally slicing and/or arithmetic:
|
||||
|
||||
.. autosummary::
|
||||
:toctree: generated
|
||||
:nosignatures:
|
||||
:template: myclass.rst
|
||||
|
||||
openmc.arithmetic.CrossScore
|
||||
openmc.arithmetic.CrossNuclide
|
||||
openmc.arithmetic.CrossFilter
|
||||
openmc.arithmetic.AggregateScore
|
||||
openmc.arithmetic.AggregateNuclide
|
||||
openmc.arithmetic.AggregateFilter
|
||||
|
||||
---------------------------------
|
||||
:mod:`openmc.stats` -- Statistics
|
||||
---------------------------------
|
||||
|
||||
Univariate Probability Distributions
|
||||
------------------------------------
|
||||
|
||||
.. autosummary::
|
||||
:toctree: generated
|
||||
:nosignatures:
|
||||
:template: myclass.rst
|
||||
|
||||
openmc.stats.Univariate
|
||||
openmc.stats.Discrete
|
||||
openmc.stats.Uniform
|
||||
openmc.stats.Maxwell
|
||||
openmc.stats.Watt
|
||||
openmc.stats.Tabular
|
||||
openmc.stats.Legendre
|
||||
openmc.stats.Mixture
|
||||
|
||||
Angular Distributions
|
||||
---------------------
|
||||
|
||||
.. autosummary::
|
||||
:toctree: generated
|
||||
:nosignatures:
|
||||
:template: myclass.rst
|
||||
|
||||
openmc.stats.UnitSphere
|
||||
openmc.stats.PolarAzimuthal
|
||||
openmc.stats.Isotropic
|
||||
openmc.stats.Monodirectional
|
||||
|
||||
Spatial Distributions
|
||||
---------------------
|
||||
|
||||
.. autosummary::
|
||||
:toctree: generated
|
||||
:nosignatures:
|
||||
:template: myclass.rst
|
||||
|
||||
openmc.stats.Spatial
|
||||
openmc.stats.CartesianIndependent
|
||||
openmc.stats.Box
|
||||
openmc.stats.Point
|
||||
|
||||
----------------------------------------------------------
|
||||
:mod:`openmc.mgxs` -- Multi-Group Cross Section Generation
|
||||
----------------------------------------------------------
|
||||
|
||||
Energy Groups
|
||||
-------------
|
||||
|
||||
.. autosummary::
|
||||
:toctree: generated
|
||||
:nosignatures:
|
||||
:template: myclass.rst
|
||||
|
||||
openmc.mgxs.EnergyGroups
|
||||
|
||||
Multi-group Cross Sections
|
||||
--------------------------
|
||||
|
||||
.. autosummary::
|
||||
:toctree: generated
|
||||
:nosignatures:
|
||||
:template: myclassinherit.rst
|
||||
|
||||
openmc.mgxs.MGXS
|
||||
openmc.mgxs.AbsorptionXS
|
||||
openmc.mgxs.CaptureXS
|
||||
openmc.mgxs.Chi
|
||||
openmc.mgxs.FissionXS
|
||||
openmc.mgxs.InverseVelocity
|
||||
openmc.mgxs.KappaFissionXS
|
||||
openmc.mgxs.MultiplicityMatrixXS
|
||||
openmc.mgxs.NuFissionMatrixXS
|
||||
openmc.mgxs.ScatterXS
|
||||
openmc.mgxs.ScatterMatrixXS
|
||||
openmc.mgxs.ScatterProbabilityMatrix
|
||||
openmc.mgxs.TotalXS
|
||||
openmc.mgxs.TransportXS
|
||||
|
||||
Multi-delayed-group Cross Sections
|
||||
----------------------------------
|
||||
|
||||
.. autosummary::
|
||||
:toctree: generated
|
||||
:nosignatures:
|
||||
:template: myclassinherit.rst
|
||||
|
||||
openmc.mgxs.MDGXS
|
||||
openmc.mgxs.ChiDelayed
|
||||
openmc.mgxs.DelayedNuFissionXS
|
||||
openmc.mgxs.DelayedNuFissionMatrixXS
|
||||
openmc.mgxs.Beta
|
||||
openmc.mgxs.DecayRate
|
||||
|
||||
Multi-group Cross Section Libraries
|
||||
-----------------------------------
|
||||
|
||||
.. autosummary::
|
||||
:toctree: generated
|
||||
:nosignatures:
|
||||
:template: myclass.rst
|
||||
|
||||
openmc.mgxs.Library
|
||||
|
||||
-------------------------------------
|
||||
:mod:`openmc.model` -- Model Building
|
||||
-------------------------------------
|
||||
|
||||
TRISO Fuel Modeling
|
||||
-------------------
|
||||
|
||||
Classes
|
||||
+++++++
|
||||
|
||||
.. autosummary::
|
||||
:toctree: generated
|
||||
:nosignatures:
|
||||
:template: myclass.rst
|
||||
|
||||
openmc.model.TRISO
|
||||
|
||||
Functions
|
||||
+++++++++
|
||||
|
||||
.. autosummary::
|
||||
:toctree: generated
|
||||
:nosignatures:
|
||||
:template: myfunction.rst
|
||||
|
||||
openmc.model.create_triso_lattice
|
||||
openmc.model.pack_trisos
|
||||
|
||||
Model Container
|
||||
---------------
|
||||
|
||||
Classes
|
||||
+++++++
|
||||
|
||||
.. autosummary::
|
||||
:toctree: generated
|
||||
:nosignatures:
|
||||
:template: myclass.rst
|
||||
|
||||
openmc.model.Model
|
||||
|
||||
--------------------------------------------
|
||||
:mod:`openmc.data` -- Nuclear Data Interface
|
||||
--------------------------------------------
|
||||
|
||||
Core Classes
|
||||
------------
|
||||
|
||||
.. autosummary::
|
||||
:toctree: generated
|
||||
:nosignatures:
|
||||
:template: myclass.rst
|
||||
|
||||
openmc.data.IncidentNeutron
|
||||
openmc.data.Reaction
|
||||
openmc.data.Product
|
||||
openmc.data.Tabulated1D
|
||||
openmc.data.FissionEnergyRelease
|
||||
openmc.data.ThermalScattering
|
||||
openmc.data.CoherentElastic
|
||||
openmc.data.FissionEnergyRelease
|
||||
openmc.data.DataLibrary
|
||||
openmc.data.Decay
|
||||
openmc.data.FissionProductYields
|
||||
openmc.data.WindowedMultipole
|
||||
|
||||
Core Functions
|
||||
--------------
|
||||
|
||||
.. autosummary::
|
||||
:toctree: generated
|
||||
:nosignatures:
|
||||
:template: myfunction.rst
|
||||
|
||||
openmc.data.atomic_mass
|
||||
openmc.data.write_compact_458_library
|
||||
|
||||
Angle-Energy Distributions
|
||||
--------------------------
|
||||
|
||||
.. autosummary::
|
||||
:toctree: generated
|
||||
:nosignatures:
|
||||
:template: myclass.rst
|
||||
|
||||
openmc.data.AngleEnergy
|
||||
openmc.data.KalbachMann
|
||||
openmc.data.CorrelatedAngleEnergy
|
||||
openmc.data.UncorrelatedAngleEnergy
|
||||
openmc.data.NBodyPhaseSpace
|
||||
openmc.data.LaboratoryAngleEnergy
|
||||
openmc.data.AngleDistribution
|
||||
openmc.data.EnergyDistribution
|
||||
openmc.data.ArbitraryTabulated
|
||||
openmc.data.GeneralEvaporation
|
||||
openmc.data.MaxwellEnergy
|
||||
openmc.data.Evaporation
|
||||
openmc.data.WattEnergy
|
||||
openmc.data.MadlandNix
|
||||
openmc.data.DiscretePhoton
|
||||
openmc.data.LevelInelastic
|
||||
openmc.data.ContinuousTabular
|
||||
|
||||
Resonance Data
|
||||
--------------
|
||||
|
||||
.. autosummary::
|
||||
:toctree: generated
|
||||
:nosignatures:
|
||||
:template: myclass.rst
|
||||
|
||||
openmc.data.Resonances
|
||||
openmc.data.ResonanceRange
|
||||
openmc.data.SingleLevelBreitWigner
|
||||
openmc.data.MultiLevelBreitWigner
|
||||
openmc.data.ReichMoore
|
||||
openmc.data.RMatrixLimited
|
||||
openmc.data.ParticlePair
|
||||
openmc.data.SpinGroup
|
||||
openmc.data.Unresolved
|
||||
|
||||
ACE Format
|
||||
----------
|
||||
|
||||
Classes
|
||||
+++++++
|
||||
|
||||
.. autosummary::
|
||||
:toctree: generated
|
||||
:nosignatures:
|
||||
:template: myclass.rst
|
||||
|
||||
openmc.data.ace.Library
|
||||
openmc.data.ace.Table
|
||||
|
||||
Functions
|
||||
+++++++++
|
||||
|
||||
.. autosummary::
|
||||
:toctree: generated
|
||||
:nosignatures:
|
||||
:template: myfunction.rst
|
||||
|
||||
openmc.data.ace.ascii_to_binary
|
||||
|
||||
ENDF Format
|
||||
-----------
|
||||
|
||||
Classes
|
||||
+++++++
|
||||
|
||||
.. autosummary::
|
||||
:toctree: generated
|
||||
:nosignatures:
|
||||
:template: myclass.rst
|
||||
|
||||
openmc.data.endf.Evaluation
|
||||
|
||||
Functions
|
||||
+++++++++
|
||||
|
||||
.. autosummary::
|
||||
:toctree: generated
|
||||
:nosignatures:
|
||||
:template: myfunction.rst
|
||||
|
||||
openmc.data.endf.float_endf
|
||||
openmc.data.endf.get_cont_record
|
||||
openmc.data.endf.get_evaluations
|
||||
openmc.data.endf.get_head_record
|
||||
openmc.data.endf.get_tab1_record
|
||||
openmc.data.endf.get_tab2_record
|
||||
openmc.data.endf.get_text_record
|
||||
|
||||
---------------------------------------------------------
|
||||
:mod:`openmc.openmoc_compatible` -- OpenMOC Compatibility
|
||||
---------------------------------------------------------
|
||||
|
||||
.. autosummary::
|
||||
:toctree: generated
|
||||
:nosignatures:
|
||||
:template: myfunction.rst
|
||||
|
||||
openmc.openmoc_compatible.get_openmoc_material
|
||||
openmc.openmoc_compatible.get_openmc_material
|
||||
openmc.openmoc_compatible.get_openmoc_surface
|
||||
openmc.openmoc_compatible.get_openmc_surface
|
||||
openmc.openmoc_compatible.get_openmoc_cell
|
||||
openmc.openmoc_compatible.get_openmc_cell
|
||||
openmc.openmoc_compatible.get_openmoc_universe
|
||||
openmc.openmoc_compatible.get_openmc_universe
|
||||
openmc.openmoc_compatible.get_openmoc_lattice
|
||||
openmc.openmoc_compatible.get_openmc_lattice
|
||||
openmc.openmoc_compatible.get_openmoc_geometry
|
||||
openmc.openmoc_compatible.get_openmc_geometry
|
||||
|
||||
.. _Jupyter: https://jupyter.org/
|
||||
.. _NumPy: http://www.numpy.org/
|
||||
.. _Codecademy: https://www.codecademy.com/tracks/python
|
||||
.. _Scipy lectures: https://scipy-lectures.github.io/
|
||||
:ref:`examples`. This assumes that you are already familiar with Python and
|
||||
common third-party packages such as `NumPy <http://www.numpy.org/>`_. If you
|
||||
have never used Python before, the prospect of learning a new code *and* a
|
||||
programming language might sound daunting. However, you should keep in mind that
|
||||
there are many substantial benefits to using the Python API, including:
|
||||
|
||||
- The ability to define dimensions using variables.
|
||||
- Availability of standard-library modules for working with files.
|
||||
- An entire ecosystem of third-party packages for scientific computing.
|
||||
- Ability to create materials based on natural elements or uranium enrichment
|
||||
- Automated multi-group cross section generation (:mod:`openmc.mgxs`)
|
||||
- Convenience functions (e.g., a function returning a hexagonal region)
|
||||
- Ability to plot individual universes as geometry is being created
|
||||
- A :math:`k_\text{eff}` search function (:func:`openmc.search_for_keff`)
|
||||
- Random sphere packing for generating TRISO particle locations
|
||||
(:func:`openmc.model.pack_trisos`)
|
||||
- A fully-featured nuclear data interface (:mod:`openmc.data`)
|
||||
|
||||
For those new to Python, there are many good tutorials available online. We
|
||||
recommend going through the modules from `Codecademy
|
||||
<https://www.codecademy.com/tracks/python>`_ and/or the `Scipy lectures
|
||||
<https://scipy-lectures.github.io/>`_.
|
||||
|
||||
The full API documentation serves to provide more information on a given module
|
||||
or class.
|
||||
|
||||
.. tip:: Users are strongly encouraged to use the Python API to generate input
|
||||
files and analyze results.
|
||||
|
||||
-------
|
||||
Modules
|
||||
-------
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
|
||||
base
|
||||
stats
|
||||
mgxs
|
||||
model
|
||||
data
|
||||
examples
|
||||
openmoc
|
||||
|
|
|
|||
61
docs/source/pythonapi/mgxs.rst
Normal file
61
docs/source/pythonapi/mgxs.rst
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
----------------------------------------------------------
|
||||
:mod:`openmc.mgxs` -- Multi-Group Cross Section Generation
|
||||
----------------------------------------------------------
|
||||
|
||||
Energy Groups
|
||||
-------------
|
||||
|
||||
.. autosummary::
|
||||
:toctree: generated
|
||||
:nosignatures:
|
||||
:template: myclass.rst
|
||||
|
||||
openmc.mgxs.EnergyGroups
|
||||
|
||||
Multi-group Cross Sections
|
||||
--------------------------
|
||||
|
||||
.. autosummary::
|
||||
:toctree: generated
|
||||
:nosignatures:
|
||||
:template: myclassinherit.rst
|
||||
|
||||
openmc.mgxs.MGXS
|
||||
openmc.mgxs.AbsorptionXS
|
||||
openmc.mgxs.CaptureXS
|
||||
openmc.mgxs.Chi
|
||||
openmc.mgxs.FissionXS
|
||||
openmc.mgxs.InverseVelocity
|
||||
openmc.mgxs.KappaFissionXS
|
||||
openmc.mgxs.MultiplicityMatrixXS
|
||||
openmc.mgxs.NuFissionMatrixXS
|
||||
openmc.mgxs.ScatterXS
|
||||
openmc.mgxs.ScatterMatrixXS
|
||||
openmc.mgxs.ScatterProbabilityMatrix
|
||||
openmc.mgxs.TotalXS
|
||||
openmc.mgxs.TransportXS
|
||||
|
||||
Multi-delayed-group Cross Sections
|
||||
----------------------------------
|
||||
|
||||
.. autosummary::
|
||||
:toctree: generated
|
||||
:nosignatures:
|
||||
:template: myclassinherit.rst
|
||||
|
||||
openmc.mgxs.MDGXS
|
||||
openmc.mgxs.ChiDelayed
|
||||
openmc.mgxs.DelayedNuFissionXS
|
||||
openmc.mgxs.DelayedNuFissionMatrixXS
|
||||
openmc.mgxs.Beta
|
||||
openmc.mgxs.DecayRate
|
||||
|
||||
Multi-group Cross Section Libraries
|
||||
-----------------------------------
|
||||
|
||||
.. autosummary::
|
||||
:toctree: generated
|
||||
:nosignatures:
|
||||
:template: myclass.rst
|
||||
|
||||
openmc.mgxs.Library
|
||||
40
docs/source/pythonapi/model.rst
Normal file
40
docs/source/pythonapi/model.rst
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
-------------------------------------
|
||||
:mod:`openmc.model` -- Model Building
|
||||
-------------------------------------
|
||||
|
||||
TRISO Fuel Modeling
|
||||
-------------------
|
||||
|
||||
Classes
|
||||
+++++++
|
||||
|
||||
.. autosummary::
|
||||
:toctree: generated
|
||||
:nosignatures:
|
||||
:template: myclass.rst
|
||||
|
||||
openmc.model.TRISO
|
||||
|
||||
Functions
|
||||
+++++++++
|
||||
|
||||
.. autosummary::
|
||||
:toctree: generated
|
||||
:nosignatures:
|
||||
:template: myfunction.rst
|
||||
|
||||
openmc.model.create_triso_lattice
|
||||
openmc.model.pack_trisos
|
||||
|
||||
Model Container
|
||||
---------------
|
||||
|
||||
Classes
|
||||
+++++++
|
||||
|
||||
.. autosummary::
|
||||
:toctree: generated
|
||||
:nosignatures:
|
||||
:template: myclass.rst
|
||||
|
||||
openmc.model.Model
|
||||
24
docs/source/pythonapi/openmoc.rst
Normal file
24
docs/source/pythonapi/openmoc.rst
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
---------------------------------------------------------
|
||||
:mod:`openmc.openmoc_compatible` -- OpenMOC Compatibility
|
||||
---------------------------------------------------------
|
||||
|
||||
Core Classes
|
||||
------------
|
||||
|
||||
.. autosummary::
|
||||
:toctree: generated
|
||||
:nosignatures:
|
||||
:template: myfunction.rst
|
||||
|
||||
openmc.openmoc_compatible.get_openmoc_material
|
||||
openmc.openmoc_compatible.get_openmc_material
|
||||
openmc.openmoc_compatible.get_openmoc_surface
|
||||
openmc.openmoc_compatible.get_openmc_surface
|
||||
openmc.openmoc_compatible.get_openmoc_cell
|
||||
openmc.openmoc_compatible.get_openmc_cell
|
||||
openmc.openmoc_compatible.get_openmoc_universe
|
||||
openmc.openmoc_compatible.get_openmc_universe
|
||||
openmc.openmoc_compatible.get_openmoc_lattice
|
||||
openmc.openmoc_compatible.get_openmc_lattice
|
||||
openmc.openmoc_compatible.get_openmoc_geometry
|
||||
openmc.openmoc_compatible.get_openmc_geometry
|
||||
48
docs/source/pythonapi/stats.rst
Normal file
48
docs/source/pythonapi/stats.rst
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
.. _pythonapi_stats:
|
||||
|
||||
---------------------------------
|
||||
:mod:`openmc.stats` -- Statistics
|
||||
---------------------------------
|
||||
|
||||
Univariate Probability Distributions
|
||||
------------------------------------
|
||||
|
||||
.. autosummary::
|
||||
:toctree: generated
|
||||
:nosignatures:
|
||||
:template: myclass.rst
|
||||
|
||||
openmc.stats.Univariate
|
||||
openmc.stats.Discrete
|
||||
openmc.stats.Uniform
|
||||
openmc.stats.Maxwell
|
||||
openmc.stats.Watt
|
||||
openmc.stats.Tabular
|
||||
openmc.stats.Legendre
|
||||
openmc.stats.Mixture
|
||||
|
||||
Angular Distributions
|
||||
---------------------
|
||||
|
||||
.. autosummary::
|
||||
:toctree: generated
|
||||
:nosignatures:
|
||||
:template: myclass.rst
|
||||
|
||||
openmc.stats.UnitSphere
|
||||
openmc.stats.PolarAzimuthal
|
||||
openmc.stats.Isotropic
|
||||
openmc.stats.Monodirectional
|
||||
|
||||
Spatial Distributions
|
||||
---------------------
|
||||
|
||||
.. autosummary::
|
||||
:toctree: generated
|
||||
:nosignatures:
|
||||
:template: myclass.rst
|
||||
|
||||
openmc.stats.Spatial
|
||||
openmc.stats.CartesianIndependent
|
||||
openmc.stats.Box
|
||||
openmc.stats.Point
|
||||
|
|
@ -106,6 +106,10 @@ should specify an installation directory where you have write access, e.g.
|
|||
|
||||
cmake -DCMAKE_INSTALL_PREFIX=$HOME/.local ..
|
||||
|
||||
If you want to build a parallel version of OpenMC (using OpenMP or MPI),
|
||||
directions can be found in the :ref:`detailed installation instructions
|
||||
<usersguide_build>`.
|
||||
|
||||
.. _GitHub: https://github.com/mit-crpg/openmc
|
||||
.. _git: http://git-scm.com
|
||||
.. _gfortran: http://gcc.gnu.org/wiki/GFortran
|
||||
|
|
|
|||
194
docs/source/usersguide/basics.rst
Normal file
194
docs/source/usersguide/basics.rst
Normal file
|
|
@ -0,0 +1,194 @@
|
|||
.. _usersguide_basics:
|
||||
|
||||
======================
|
||||
Basics of Using OpenMC
|
||||
======================
|
||||
|
||||
----------------
|
||||
Creating a Model
|
||||
----------------
|
||||
|
||||
When you build and install OpenMC, you will have an :ref:`scripts_openmc`
|
||||
executable on your system. When you run ``openmc``, the first thing it will do
|
||||
is look for a set of XML_ files that describe the model you want to
|
||||
simulation. Three of these files are required and another three are optional, as
|
||||
described below.
|
||||
|
||||
.. admonition:: Required
|
||||
:class: error
|
||||
|
||||
:ref:`io_materials`
|
||||
This file describes what materials are present in the problem and what they
|
||||
are composed of. Additionally, it indicates where OpenMC should look for a
|
||||
cross section library.
|
||||
|
||||
:ref:`io_geometry`
|
||||
This file describes how the materials defined in ``materials.xml`` occupy
|
||||
regions of space. Physical volumes are defined using constructive solid
|
||||
geometry, described in detail in :ref:`usersguide_geometry`.
|
||||
|
||||
:ref:`io_settings`
|
||||
This file indicates what mode OpenMC should be run in, how many particles
|
||||
to simulate, the source definition, and a whole host of miscellaneous
|
||||
options.
|
||||
|
||||
.. admonition:: Optional
|
||||
:class: note
|
||||
|
||||
:ref:`io_tallies`
|
||||
This file describes what physical quantities should be tallied during the
|
||||
simulation (fluxes, reaction rates, currents, etc.).
|
||||
|
||||
:ref:`io_plots`
|
||||
This file gives specifications for producing slice or voxel plots of the
|
||||
geometry.
|
||||
|
||||
:ref:`io_cmfd`
|
||||
This file specifies execution parameters for coarse mesh finite difference
|
||||
(CMFD) acceleration.
|
||||
|
||||
eXtensible Markup Language (XML)
|
||||
--------------------------------
|
||||
|
||||
Unlike many other Monte Carlo codes which use an arbitrary-format ASCII file
|
||||
with "cards" to specify a particular geometry, materials, and associated run
|
||||
settings, the input files for OpenMC are structured in a set of `XML
|
||||
<http://www.w3.org/XML/>`_ files. XML, which stands for eXtensible Markup
|
||||
Language, is a simple format that allows data to be exchanged efficiently
|
||||
between different programs and interfaces.
|
||||
|
||||
Anyone who has ever seen webpages written in HTML will be familiar with the
|
||||
structure of XML whereby "tags" enclosed in angle brackets denote that a
|
||||
particular piece of data will follow. Let us examine the follow example:
|
||||
|
||||
.. code-block:: xml
|
||||
|
||||
<person>
|
||||
<firstname>John</firstname>
|
||||
<lastname>Smith</lastname>
|
||||
<age>27</age>
|
||||
<occupation>Health Physicist</occupation>
|
||||
</person>
|
||||
|
||||
Here we see that the first tag indicates that the following data will describe a
|
||||
person. The nested tags *firstname*, *lastname*, *age*, and *occupation*
|
||||
indicate characteristics about the person being described.
|
||||
|
||||
In much the same way, OpenMC input uses XML tags to describe the geometry, the
|
||||
materials, and settings for a Monte Carlo simulation. Note that because the XML
|
||||
files have a well-defined structure, they can be validated using the
|
||||
:ref:`scripts_validate` script or using :ref:`Emacs nXML mode
|
||||
<usersguide_nxml>`.
|
||||
|
||||
Creating Input Files
|
||||
--------------------
|
||||
|
||||
.. currentmodule:: openmc
|
||||
|
||||
The most rudimentary option for creating input files is to simply write them
|
||||
from scratch using the :ref:`XML format specifications
|
||||
<io_file_formats_input>`. This approach will feel familiar to users of other
|
||||
Monte Carlo codes such as MCNP and Serpent, with the added bonus that the XML
|
||||
formats feel much more "readable". Alternatively, input files can be generated
|
||||
using OpenMC's :ref:`Python API <pythonapi>`, which is introduced in the
|
||||
following section.
|
||||
|
||||
----------
|
||||
Python API
|
||||
----------
|
||||
|
||||
OpenMC's :ref:`Python API <pythonapi>` defines a set of functions and classes
|
||||
that roughly correspond to elements in the XML files. For example, the
|
||||
:class:`openmc.Cell` Python class directly corresponds to the
|
||||
:ref:`cell_element` in XML. Each XML file itself also has a corresponding class:
|
||||
:class:`openmc.Geometry` for ``geometry.xml``, :class:`openmc.Materials` for
|
||||
``materials.xml``, :class:`openmc.Settings` for ``settings.xml``, and so on. To
|
||||
create a model then, one creates instances of these classes and then uses the
|
||||
``export_to_xml()`` method, e.g. :meth:`Geometry.export_to_xml`. Most scripts
|
||||
that generate a full model will look something like the following:
|
||||
|
||||
.. code-block:: Python
|
||||
|
||||
# Create materials
|
||||
materials = openmc.Materials()
|
||||
...
|
||||
materials.export_to_xml()
|
||||
|
||||
# Create geometry
|
||||
geometry = openmc.Geometry()
|
||||
...
|
||||
geometry.export_to_xml()
|
||||
|
||||
# Assign simulation settings
|
||||
settings = openmc.Settings()
|
||||
...
|
||||
settings.export_to_xml()
|
||||
|
||||
One a model has been created and exported to XML, a simulation can be run either
|
||||
by calling :ref:`scripts_openmc` directly from a shell or by using the
|
||||
:func:`openmc.run()` function from Python.
|
||||
|
||||
Identifying Objects
|
||||
-------------------
|
||||
|
||||
In the XML user input files, each object (cell, surface, tally, etc.) has to be
|
||||
uniquely identified by a positive integer (ID) in the same manner as MCNP and
|
||||
Serpent. In the Python API, integer IDs can be assigned but it is not strictly
|
||||
required. When IDs are not explicitly assigned to instances of the OpenMC Python
|
||||
classes, they will be automatically assigned.
|
||||
|
||||
.. _result_files:
|
||||
|
||||
-----------------------------
|
||||
Viewing and Analyzing Results
|
||||
-----------------------------
|
||||
|
||||
After a simulation has been completed by running :ref:`scripts_openmc`, you will
|
||||
have several output files that were created:
|
||||
|
||||
``tallies.out``
|
||||
An ASCII file showing the mean and standard deviation of the mean for any
|
||||
user-defined tallies.
|
||||
|
||||
``summary.h5``
|
||||
An HDF5 file with a complete description of the geometry and materials used in
|
||||
the simulation.
|
||||
|
||||
``statepoint.#.h5``
|
||||
An HDF5 file with the complete results of the simulation, including tallies as
|
||||
well as the final source distribution. This file can be used both to
|
||||
view/analyze results as well as restart a simulation if desired.
|
||||
|
||||
For a simple simulation with few tallies, looking at the ``tallies.out`` file
|
||||
might be sufficient. For anything more complicated (plotting results, finding a
|
||||
subset of results, etc.), you will likely find it easier to work with the
|
||||
statepoint file directly using the :class:`openmc.StatePoint` class. For more
|
||||
details on working with statepoints, see :ref:`usersguide_statepoint`.
|
||||
|
||||
--------------
|
||||
Physical Units
|
||||
--------------
|
||||
|
||||
Unless specified otherwise, all length quantities are assumed to be in units of
|
||||
centimeters, all energy quantities are assumed to be in electronvolts, and all
|
||||
time quantities are assumed to be in seconds.
|
||||
|
||||
======= ============ ======
|
||||
Measure Default unit Symbol
|
||||
======= ============ ======
|
||||
length centimeter cm
|
||||
energy electronvolt eV
|
||||
time second s
|
||||
======= ============ ======
|
||||
|
||||
------------------------------------
|
||||
ERSN-OpenMC Graphical User Interface
|
||||
------------------------------------
|
||||
|
||||
A third-party Java-based user-friendly graphical user interface for creating XML
|
||||
input files called ERSN-OpenMC_ is developed and maintained by members of the
|
||||
Radiation and Nuclear Systems Group at the Faculty of Sciences Tetouan, Morocco.
|
||||
The GUI also allows one to automatically download prerequisites for installing and
|
||||
running OpenMC.
|
||||
|
||||
.. _ERSN-OpenMC: https://github.com/EL-Bakkali-Jaafar/ERSN-OpenMC
|
||||
|
|
@ -8,33 +8,35 @@ A Beginner's Guide to OpenMC
|
|||
What does OpenMC do?
|
||||
--------------------
|
||||
|
||||
In a nutshell, OpenMC simulates neutrons moving around randomly in a `nuclear
|
||||
reactor`_ (or other fissile system). This is what's known as `Monte Carlo`_
|
||||
simulation. Neutrons are important in nuclear reactors because they are the
|
||||
particles that induce `fission`_ in uranium and other nuclides. Knowing the
|
||||
behavior of neutrons allows you to determine how often and where fission
|
||||
occurs. The amount of energy released is then directly proportional to the
|
||||
fission reaction rate since most heat is produced by fission. By simulating many
|
||||
neutrons (millions or billions), it is possible to determine the average
|
||||
behavior of these neutrons (or the behavior of the energy produced or any other
|
||||
quantity one is interested in) very accurately.
|
||||
In a nutshell, OpenMC simulates neutral particles (presently only neutrons)
|
||||
moving stochastically through an arbitrarily defined model that represents an
|
||||
real-world experimental setup. The experiment could be as simple as a sphere of
|
||||
metal or as complicated as a full-scale `nuclear reactor`_. This is what's known
|
||||
as `Monte Carlo`_ simulation. In the case of a nuclear reactor model, neutrons
|
||||
are especially important because they are the particles that induce `fission`_
|
||||
in isotopes of uranium and other elements. Knowing the behavior of neutrons
|
||||
allows one to determine how often and where fission occurs. The amount of energy
|
||||
released is then directly proportional to the fission reaction rate since most
|
||||
heat is produced by fission. By simulating many neutrons (millions or billions),
|
||||
it is possible to determine the average behavior of these neutrons (or the
|
||||
behavior of the energy produced, or any other quantity one is interested in)
|
||||
very accurately.
|
||||
|
||||
Using Monte Carlo methods to determine the average behavior of various physical
|
||||
quantities in a nuclear reactor is quite different from other means of solving
|
||||
the same problem. The other class of methods for determining the behavior of
|
||||
neutrons and reactions rates in a reactor is so-called `deterministic`_
|
||||
methods. In these methods, the starting point is not randomly simulating
|
||||
particles but rather writing an equation that describes the average behavior of
|
||||
the particles. The equation that describes the average behavior of neutrons is
|
||||
called the `neutron transport`_ equation. This equation is a seven-dimensional
|
||||
equation (three for space, three for velocity, and one for time) and is very
|
||||
difficult to solve directly. For all but the simplest problems, it is necessary
|
||||
to make some sort of `discretization`_. As an example, we can divide up all
|
||||
space into small sections which are homogeneous and then solve the equation on
|
||||
those small sections. After these discretizations and various approximations,
|
||||
one can arrive at forms that are suitable for solution on a computer. Among
|
||||
these are discrete ordinates, method of characteristics, finite-difference
|
||||
diffusion, and nodal methods.
|
||||
quantities in a system is quite different from other means of solving the same
|
||||
problem. The other class of methods for determining the behavior of neutrons and
|
||||
reactions rates is so-called `deterministic`_ methods. In these methods, the
|
||||
starting point is not randomly simulating particles but rather writing an
|
||||
equation that describes the average behavior of the particles. The equation that
|
||||
describes the average behavior of neutrons is called the `neutron transport`_
|
||||
equation. This equation is a seven-dimensional equation (three for space, three
|
||||
for velocity, and one for time) and is very difficult to solve directly. For all
|
||||
but the simplest problems, it is necessary to make some sort of
|
||||
`discretization`_. As an example, we can divide up all space into small sections
|
||||
which are homogeneous and then solve the equation on those small sections. After
|
||||
these discretizations and various approximations, one can arrive at forms that
|
||||
are suitable for solution on a computer. Among these are discrete ordinates,
|
||||
method of characteristics, finite-difference diffusion, and nodal methods.
|
||||
|
||||
So why choose Monte Carlo over deterministic methods? Each method has its pros
|
||||
and cons. Let us first take a look at few of the salient pros and cons of
|
||||
|
|
@ -88,30 +90,32 @@ interest. This could be a nuclear reactor or any other physical system with
|
|||
fissioning material. You, as the code user, will need to describe the model so
|
||||
that the code can do something with it. A basic model consists of a few things:
|
||||
|
||||
- A description of the geometry -- the problem should be split up into regions
|
||||
of homogeneous material.
|
||||
- A description of the geometry -- the problem must be split up into regions of
|
||||
homogeneous material composition.
|
||||
- For each different material in the problem, a description of what nuclides are
|
||||
in the material and at what density.
|
||||
- Various parameters telling the code how many particles to simulate and what
|
||||
options to use.
|
||||
- A list of different physical quantities that the code should return at the end
|
||||
of the simulation. Remember, in a Monte Carlo simulation, if you don't ask for
|
||||
anything, it will not give you any answers (other than a few default
|
||||
quantities).
|
||||
of the simulation. In a Monte Carlo simulation, if you don't ask for anything,
|
||||
it will not give you any answers (other than a few default quantities).
|
||||
|
||||
-----------------------
|
||||
What do I need to know?
|
||||
-----------------------
|
||||
|
||||
If you are starting to work with OpenMC, there are a few things you should be
|
||||
familiar with. Whether you plan on working in Linux, Mac OS X, or Windows, you
|
||||
familiar with. Whether you plan on working in Linux, macOS, or Windows, you
|
||||
should be comfortable working in a command line environment. There are many
|
||||
resources online for learning command line environments. If you are using Linux
|
||||
or Mac OS X (also Unix-derived), `this tutorial
|
||||
<http://www.ee.surrey.ac.uk/Teaching/Unix/>`_ will help you get acquainted with
|
||||
commonly-used commands. It is also helpful to be familiar with `Python
|
||||
<http://www.python.org/>`_, as most of the post-processing utilities provided
|
||||
with OpenMC rely on it for data manipulation and results visualization.
|
||||
commonly-used commands.
|
||||
|
||||
To reap the full benefits of OpenMC, you should also have basic proficiency in
|
||||
the use of `Python <http://www.python.org/>`_, as OpenMC includes a rich Python
|
||||
API that offers many usability improvements over dealing with raw XML input
|
||||
files.
|
||||
|
||||
OpenMC uses a version control software called `git`_ to keep track of changes to
|
||||
the code, document bugs and issues, and other development tasks. While you don't
|
||||
|
|
@ -122,7 +126,7 @@ at the git documentation website. The `OpenMC source code`_ and documentation
|
|||
are hosted at `GitHub`_. In order to receive updates to the code directly,
|
||||
submit `bug reports`_, and perform other development tasks, you may want to sign
|
||||
up for a free account on GitHub. Once you have an account, you can follow `these
|
||||
instructions <http://help.github.com/set-up-git-redirect>`_ on how to set up
|
||||
instructions <https://help.github.com/articles/set-up-git/>`_ on how to set up
|
||||
your computer for using GitHub.
|
||||
|
||||
If you are new to nuclear engineering, you may want to review the NRC's `Reactor
|
||||
|
|
@ -153,5 +157,5 @@ and `Volume II`_. You may also find it helpful to review the following terms:
|
|||
.. _GitHub: https://github.com/
|
||||
.. _bug reports: https://github.com/mit-crpg/openmc/issues
|
||||
.. _Neutron cross section: http://en.wikipedia.org/wiki/Neutron_cross_section
|
||||
.. _Effective multiplication factor: http://en.wikipedia.org/wiki/Effective_multiplication_factor
|
||||
.. _Effective multiplication factor: https://en.wikipedia.org/wiki/Nuclear_chain_reaction#Effective_neutron_multiplication_factor
|
||||
.. _Flux: http://en.wikipedia.org/wiki/Neutron_flux
|
||||
|
|
|
|||
258
docs/source/usersguide/cross_sections.rst
Normal file
258
docs/source/usersguide/cross_sections.rst
Normal file
|
|
@ -0,0 +1,258 @@
|
|||
.. _usersguide_cross_sections:
|
||||
|
||||
===========================
|
||||
Cross Section Configuration
|
||||
===========================
|
||||
|
||||
In order to run a simulation with OpenMC, you will need cross section data for
|
||||
each nuclide or material in your problem. OpenMC can be run in continuous-energy
|
||||
or multi-group mode.
|
||||
|
||||
In continuous-energy mode, OpenMC uses a native `HDF5
|
||||
<https://support.hdfgroup.org/HDF5/>`_ format (see :ref:`io_nuclear_data`) to
|
||||
store all nuclear data. If you have ACE format data that was produced with
|
||||
NJOY_, such as that distributed with MCNP_ or Serpent_, it can be converted to
|
||||
the HDF5 format using the :ref:`scripts_ace` script (or :ref:`using the Python
|
||||
API <create_xs_library>`). Several sources provide openly available ACE data as
|
||||
described below and can be easily converted using the provided scripts. The
|
||||
TALYS-based evaluated nuclear data library, TENDL_, is also available in ACE
|
||||
format. In addition to tabulated cross sections in the HDF5 files, OpenMC relies
|
||||
on :ref:`windowed multipole <windowed_multipole>` data to perform on-the-fly
|
||||
Doppler broadening.
|
||||
|
||||
In multi-group mode, OpenMC utilizes an HDF5-based library format which can be
|
||||
used to describe nuclide- or material-specific quantities.
|
||||
|
||||
---------------------
|
||||
Environment Variables
|
||||
---------------------
|
||||
|
||||
When :ref:`scripts_openmc` is run, it will look for several environment
|
||||
variables that indicate where cross sections can be found. While the location of
|
||||
cross sections can also be indicated through the :class:`openmc.Materials` class
|
||||
(or in the :ref:`materials.xml <io_materials>` file), if you always use the same
|
||||
set of cross section data, it is often easier to just set an environment
|
||||
variable that will be picked up by default every time OpenMC is run. The
|
||||
following environment variables are used:
|
||||
|
||||
:envvar:`OPENMC_CROSS_SECTIONS`
|
||||
Indicates the path to the :ref:`cross_sections.xml <io_cross_sections>`
|
||||
summary file that is used to locate HDF5 format cross section libraries if the
|
||||
user has not specified :attr:`Materials.cross_sections` (equivalently, the
|
||||
:ref:`cross_sections` in :ref:`materials.xml <io_materials>`).
|
||||
|
||||
:envvar:`OPENMC_MULTIPOLE_LIBRARY`
|
||||
Indicates the path to a directory containing windowed multipole data if the
|
||||
user has not specified :attr:`Materials.multipole_library` (equivalently, the
|
||||
:ref:`multipole_library` in :ref:`materials.xml <io_materials>`)
|
||||
|
||||
:envvar:`OPENMC_MG_CROSS_SECTIONS`
|
||||
Indicates the path to the an :ref:`HDF5 file <io_mgxs_library>` that contains
|
||||
multi-group cross sections if the user has not specified
|
||||
:attr:`Materials.cross_sections` (equivalently, the :ref:`cross_sections` in
|
||||
:ref:`materials.xml <io_materials>`).
|
||||
|
||||
To set these environment variables persistently, export them from your shell
|
||||
profile (``.profile`` or ``.bashrc`` in bash_).
|
||||
|
||||
.. _bash: http://www.linuxfromscratch.org/blfs/view/6.3/postlfs/profile.html
|
||||
|
||||
--------------------------------
|
||||
Continuous-Energy Cross Sections
|
||||
--------------------------------
|
||||
|
||||
Using ENDF/B-VII.1 Cross Sections from NNDC
|
||||
-------------------------------------------
|
||||
|
||||
The NNDC_ provides ACE data from the ENDF/B-VII.1 neutron and thermal scattering
|
||||
sublibraries at room temperature processed using NJOY_. To use this data with
|
||||
OpenMC, the :ref:`scripts_nndc` script can be used to automatically download and
|
||||
extract the ACE data, fix any deficiencies, and create an HDF5 library:
|
||||
|
||||
.. code-block:: sh
|
||||
|
||||
openmc-get-nndc-data
|
||||
|
||||
At this point, you should set the :envvar:`OPENMC_CROSS_SECTIONS` environment
|
||||
variable to the absolute path of the file ``nndc_hdf5/cross_sections.xml``. This
|
||||
cross section set is used by the test suite.
|
||||
|
||||
Using JEFF Cross Sections from OECD/NEA
|
||||
---------------------------------------
|
||||
|
||||
The NEA_ provides processed ACE data from the JEFF_ library. To use this data
|
||||
with OpenMC, the :ref:`scripts_jeff` script can be used to automatically
|
||||
download and extract the ACE data, fix any deficiencies, and create an HDF5
|
||||
library.
|
||||
|
||||
.. code-block:: sh
|
||||
|
||||
openmc-get-jeff-data
|
||||
|
||||
At this point, you should set the :envvar:`OPENMC_CROSS_SECTIONS` environment
|
||||
variable to the absolute path of the file ``jeff-3.2-hdf5/cross_sections.xml``.
|
||||
|
||||
Using Cross Sections from MCNP
|
||||
------------------------------
|
||||
|
||||
OpenMC provides two scripts (:ref:`scripts_mcnp70` and :ref:`scripts_mcnp71`)
|
||||
that will automatically convert ENDF/B-VII.0 and ENDF/B-VII.1 ACE data that is
|
||||
provided with MCNP5 or MCNP6. To convert the ENDF/B-VII.0 ACE files
|
||||
(``endf70[a-k]`` and ``endf70sab``) into the native HDF5 format, run the
|
||||
following:
|
||||
|
||||
.. code-block:: sh
|
||||
|
||||
openmc-convert-mcnp70-data /path/to/mcnpdata/
|
||||
|
||||
where ``/path/to/mcnpdata`` is the directory containing the ``endf70[a-k]``
|
||||
files.
|
||||
|
||||
To convert the ENDF/B-VII.1 ACE files (the endf71x and ENDF71SaB libraries), use
|
||||
the following script:
|
||||
|
||||
.. code-block:: sh
|
||||
|
||||
openmc-convert-mcnp71-data /path/to/mcnpdata
|
||||
|
||||
where ``/path/to/mcnpdata`` is the directory containing the ``endf71x`` and
|
||||
``ENDF71SaB`` directories.
|
||||
|
||||
.. _other_cross_sections:
|
||||
|
||||
Using Other Cross Sections
|
||||
--------------------------
|
||||
|
||||
If you have a library of ACE format cross sections other than those listed above
|
||||
that you need to convert to OpenMC's HDF5 format, the :ref:`scripts_ace` script
|
||||
can be used. There are four different ways you can specify ACE libraries that
|
||||
are to be converted:
|
||||
|
||||
1. List each ACE library as a positional argument. This is very useful in
|
||||
conjunction with the usual shell utilities (ls, find, etc.).
|
||||
2. Use the ``--xml`` option to specify a pre-v0.9 cross_sections.xml file.
|
||||
3. Use the ``--xsdir`` option to specify a MCNP xsdir file.
|
||||
4. Use the ``--xsdata`` option to specify a Serpent xsdata file.
|
||||
|
||||
The script does not use any extra information from cross_sections.xml/ xsdir/
|
||||
xsdata files to determine whether the nuclide is metastable. Instead, the
|
||||
``--metastable`` argument can be used to specify whether the ZAID naming
|
||||
convention follows the NNDC data convention (1000*Z + A + 300 + 100*m), or the
|
||||
MCNP data convention (essentially the same as NNDC, except that the first
|
||||
metastable state of Am242 is 95242 and the ground state is 95642).
|
||||
|
||||
.. _create_xs_library:
|
||||
|
||||
Manually Creating a Library
|
||||
---------------------------
|
||||
|
||||
.. currentmodule:: openmc.data
|
||||
|
||||
The scripts described above use the :mod:`openmc.data` module in the Python API
|
||||
to convert ACE data and create a :ref:`cross_sections.xml <io_cross_sections>`
|
||||
file. For those who prefer to use the API directly, the
|
||||
:class:`openmc.data.IncidentNeutron` and :class:`openmc.data.ThermalScattering`
|
||||
classes can be used to read ACE data and convert it to HDF5. For
|
||||
continuous-energy incident neutron data, use the
|
||||
:meth:`IncidentNeutron.from_ace` class method to read in an existing ACE file
|
||||
and the :meth:`IncidentNeutron.export_to_hdf5` method to write the data to an
|
||||
HDF5 file.
|
||||
|
||||
::
|
||||
|
||||
u235 = openmc.data.IncidentNeutron.from_ace('92235.710nc')
|
||||
u235.export_to_hdf5('U235.h5')
|
||||
|
||||
If you have multiple ACE files for the same nuclide at different temperatures,
|
||||
you can use the :meth:`IncidentNeutron.add_temperature_from_ace` method to
|
||||
append cross sections to an existing :class:`IncidentNeutron` instance::
|
||||
|
||||
u235 = openmc.data.IncidentNeutron.from_ace('92235.710nc')
|
||||
for suffix in [711, 712, 713, 714, 715, 716]:
|
||||
u235.add_temperature_from_ace('92235.{}nc'.format(suffix))
|
||||
u235.export_to_hdf5('U235.h5')
|
||||
|
||||
Similar methods exist for thermal scattering data:
|
||||
|
||||
::
|
||||
|
||||
light_water = openmc.data.ThermalScattering.from_ace('lwtr.20t')
|
||||
for suffix in range(21, 28):
|
||||
light_water.add_temperature_from_ace('lwtr.{}t'.format(suffix))
|
||||
light_water.export_to_hdf5('lwtr.h5')
|
||||
|
||||
Once you have created corresponding HDF5 files for each of your ACE files, you
|
||||
can create a library and export it to XML using the
|
||||
:class:`openmc.data.DataLibrary` class::
|
||||
|
||||
library = openmc.data.DataLibrary()
|
||||
library.register_file('U235.h5')
|
||||
library.register_file('lwtr.h5')
|
||||
...
|
||||
library.export_to_xml()
|
||||
|
||||
At this point, you will have a ``cross_sections.xml`` file that you can use in
|
||||
OpenMC.
|
||||
|
||||
.. hint:: The :class:`IncidentNeutron` class allows you to view/modify cross
|
||||
sections, secondary angle/energy distributions, probability tables,
|
||||
etc. For a more thorough overview of the capabilities of this class,
|
||||
see the :ref:`notebook_nuclear_data` example notebook.
|
||||
|
||||
Enabling Resonance Scattering Treatments
|
||||
----------------------------------------
|
||||
|
||||
In order for OpenMC to correctly treat elastic scattering in heavy nuclides
|
||||
where low-lying resonances might be present (see
|
||||
:ref:`energy_dependent_xs_model`), the elastic scattering cross section at 0 K
|
||||
must be present. To add the 0 K elastic scattering cross section to existing
|
||||
:class:`IncidentNeutron` instance, you can use the
|
||||
:meth:`IncidentNeutron.add_elastic_0K_from_endf` method which requires an ENDF
|
||||
file for the nuclide you are modifying::
|
||||
|
||||
u238 = openmc.data.IncidentNeutron.from_hdf5('U238.h5')
|
||||
u238.add_elastic_0K_from_endf('n-092_U_238.endf')
|
||||
u238.export_to_hdf5('U238_with_0K.h5')
|
||||
|
||||
With 0 K elastic scattering data present, you can turn on a resonance scattering
|
||||
method using :attr:`Settings.resonance_scattering`.
|
||||
|
||||
.. note:: The process of reconstructing resonances and generating tabulated 0 K
|
||||
cross sections can be computationally expensive, especially for
|
||||
nuclides like U-238 where thousands of resonances are present. Thus,
|
||||
running the :meth:`IncidentNeutron.add_elastic_0K_from_endf` method
|
||||
may take several minutes to complete.
|
||||
|
||||
-----------------------
|
||||
Windowed Multipole Data
|
||||
-----------------------
|
||||
|
||||
OpenMC is capable of using windowed multipole data for on-the-fly Doppler
|
||||
broadening. While such data is not yet available for all nuclides, an
|
||||
experimental multipole library is available that contains data for 70
|
||||
nuclides. To obtain this library, you can run :ref:`scripts_multipole` which
|
||||
will download and extract it into a ``wmp`` directory. Once the library has been
|
||||
downloaded, set the :envvar:`OPENMC_MULTIPOLE_LIBRARY` environment variable (or
|
||||
the :attr:`Materials.multipole_library` attribute) to the ``wmp`` directory.
|
||||
|
||||
--------------------------
|
||||
Multi-Group Cross Sections
|
||||
--------------------------
|
||||
|
||||
Multi-group cross section libraries are generally tailored to the specific
|
||||
calculation to be performed. Therefore, at this point in time, OpenMC is not
|
||||
distributed with any pre-existing multi-group cross section libraries.
|
||||
However, if obtained or generated their own library, the user
|
||||
should set the :envvar:`OPENMC_MG_CROSS_SECTIONS` environment variable
|
||||
to the absolute path of the file library expected to used most frequently.
|
||||
|
||||
For an example of how to create a multi-group library, see
|
||||
:ref:`notebook_mg_mode_part_i`.
|
||||
|
||||
.. _NJOY: https://njoy.github.io/NJOY2016/
|
||||
.. _NNDC: http://www.nndc.bnl.gov/endf/b7.1/acefiles.html
|
||||
.. _NEA: http://www.oecd-nea.org
|
||||
.. _JEFF: https://www.oecd-nea.org/dbforms/data/eva/evatapes/jeff_32/
|
||||
.. _MCNP: http://mcnp.lanl.gov
|
||||
.. _Serpent: http://montecarlo.vtt.fi
|
||||
.. _TENDL: https://tendl.web.psi.ch/tendl_2015/tendl2015.html
|
||||
385
docs/source/usersguide/geometry.rst
Normal file
385
docs/source/usersguide/geometry.rst
Normal file
|
|
@ -0,0 +1,385 @@
|
|||
.. _usersguide_geometry:
|
||||
|
||||
=================
|
||||
Defining Geometry
|
||||
=================
|
||||
|
||||
.. currentmodule:: openmc
|
||||
|
||||
--------------------
|
||||
Surfaces and Regions
|
||||
--------------------
|
||||
|
||||
The geometry of a model in OpenMC is defined using `constructive solid
|
||||
geometry`_ (CSG), also sometimes referred to as combinatorial geometry. CSG
|
||||
allows a user to create complex regions using Boolean operators (intersection,
|
||||
union, and complement) on simpler regions. In order to define a region that we
|
||||
can assign to a cell, we must first define surfaces which bound the region. A
|
||||
surface is a locus of zeros of a function of Cartesian coordinates
|
||||
:math:`x,y,z`, e.g.
|
||||
|
||||
- A plane perpendicular to the :math:`x` axis: :math:`x - x_0 = 0`
|
||||
- A cylinder perpendicular to the :math:`z` axis: :math:`(x - x_0)^2 + (y -
|
||||
y_0)^2 - R^2 = 0`
|
||||
- A sphere: :math:`(x - x_0)^2 + (y - y_0)^2 + (z - z_0)^2 - R^2 = 0`
|
||||
|
||||
Defining a surface alone is not sufficient to specify a volume -- in order to
|
||||
define an actual volume, one must reference the *half-space* of a surface. A
|
||||
surface half-space is the region whose points satisfy a positive of negative
|
||||
inequality of the surface equation. For example, for a sphere of radius one
|
||||
centered at the origin, the surface equation is :math:`f(x,y,z) = x^2 + y^2 +
|
||||
z^2 - 1 = 0`. Thus, we say that the negative half-space of the sphere, is
|
||||
defined as the collection of points satisfying :math:`f(x,y,z) < 0`, which one
|
||||
can reason is the inside of the sphere. Conversely, the positive half-space of
|
||||
the sphere would correspond to all points outside of the sphere, satisfying
|
||||
:math:`f(x,y,z) > 0`.
|
||||
|
||||
In the Python API, surfaces are created via subclasses of
|
||||
:class:`openmc.Surface`. The available surface types and their corresponding
|
||||
classes are listed in the following table.
|
||||
|
||||
.. table:: Surface types available in OpenMC.
|
||||
|
||||
+----------------------+------------------------------+---------------------------+
|
||||
| Surface | Equation | Class |
|
||||
+======================+==============================+===========================+
|
||||
| Plane perpendicular | :math:`x - x_0 = 0` | :class:`openmc.XPlane` |
|
||||
| to :math:`x`-axis | | |
|
||||
+----------------------+------------------------------+---------------------------+
|
||||
| Plane perpendicular | :math:`y - y_0 = 0` | :class:`openmc.YPlane` |
|
||||
| to :math:`y`-axis | | |
|
||||
+----------------------+------------------------------+---------------------------+
|
||||
| Plane perpendicular | :math:`z - z_0 = 0` | :class:`openmc.ZPlane` |
|
||||
| to :math:`z`-axis | | |
|
||||
+----------------------+------------------------------+---------------------------+
|
||||
| Arbitrary plane | :math:`Ax + By + Cz = D` | :class:`openmc.Plane` |
|
||||
+----------------------+------------------------------+---------------------------+
|
||||
| Infinite cylinder | :math:`(y-y_0)^2 + (z-z_0)^2 | :class:`openmc.XCylinder` |
|
||||
| parallel to | - R^2 = 0` | |
|
||||
| :math:`x`-axis | | |
|
||||
+----------------------+------------------------------+---------------------------+
|
||||
| Infinite cylinder | :math:`(x-x_0)^2 + (z-z_0)^2 | :class:`openmc.YCylinder` |
|
||||
| parallel to | - R^2 = 0` | |
|
||||
| :math:`y`-axis | | |
|
||||
+----------------------+------------------------------+---------------------------+
|
||||
| Infinite cylinder | :math:`(x-x_0)^2 + (y-y_0)^2 | :class:`openmc.ZCylinder` |
|
||||
| parallel to | - R^2 = 0` | |
|
||||
| :math:`z`-axis | | |
|
||||
+----------------------+------------------------------+---------------------------+
|
||||
| Sphere | :math:`(x-x_0)^2 + (y-y_0)^2 | :class:`openmc.Sphere` |
|
||||
| | + (z-z_0)^2 - R^2 = 0` | |
|
||||
+----------------------+------------------------------+---------------------------+
|
||||
| Cone parallel to the | :math:`(y-y_0)^2 + (z-z_0)^2 | :class:`openmc.XCone` |
|
||||
| :math:`x`-axis | - R^2(x-x_0)^2 = 0` | |
|
||||
+----------------------+------------------------------+---------------------------+
|
||||
| Cone parallel to the | :math:`(x-x_0)^2 + (z-z_0)^2 | :class:`openmc.YCone` |
|
||||
| :math:`y`-axis | - R^2(y-y_0)^2 = 0` | |
|
||||
+----------------------+------------------------------+---------------------------+
|
||||
| Cone parallel to the | :math:`(x-x_0)^2 + (y-y_0)^2 | :class:`openmc.ZCone` |
|
||||
| :math:`z`-axis | - R^2(z-z_0)^2 = 0` | |
|
||||
+----------------------+------------------------------+---------------------------+
|
||||
| General quadric | :math:`Ax^2 + By^2 + Cz^2 + | :class:`openmc.Quadric` |
|
||||
| surface | Dxy + Eyz + Fxz + Gx + Hy + | |
|
||||
| | Jz + K = 0` | |
|
||||
+----------------------+------------------------------+---------------------------+
|
||||
|
||||
Each surface is characterized by several parameters. As one example, the
|
||||
parameters for a sphere are the :math:`x,y,z` coordinates of the center of the
|
||||
sphere and the radius of the sphere. All of these parameters can be set either
|
||||
as optional keyword arguments to the class constructor or via attributes::
|
||||
|
||||
sphere = openmc.Sphere(R=10.0)
|
||||
|
||||
# This is equivalent
|
||||
sphere = openmc.Sphere()
|
||||
sphere.r = 10.0
|
||||
|
||||
Once a surface has been created, half-spaces can be obtained by applying the
|
||||
unary ``-`` or ``+`` operators, corresponding to the negative and positive
|
||||
half-spaces, respectively. For example::
|
||||
|
||||
>>> sphere = openmc.Sphere(R=10.0)
|
||||
>>> inside_sphere = -sphere
|
||||
>>> outside_sphere = +sphere
|
||||
>>> type(inside_sphere)
|
||||
<class 'openmc.surface.Halfspace'>
|
||||
|
||||
Instances of :class:`openmc.Halfspace` can be combined together using the
|
||||
Boolean operators ``&`` (intersection), ``|`` (union), and ``~`` (complement)::
|
||||
|
||||
>>> inside_sphere = -openmc.Sphere()
|
||||
>>> above_plane = +openmc.ZPlane()
|
||||
>>> northern_hemisphere = inside_sphere & above_plane
|
||||
>>> type(northern_hemisphere)
|
||||
<class 'openmc.region.Intersection'>
|
||||
|
||||
For many regions, a bounding-box can be determined automatically::
|
||||
|
||||
>>> northern_hemisphere.bounding_box
|
||||
(array([-1., -1., 0.]), array([1., 1., 1.]))
|
||||
|
||||
While a bounding box can be determined for regions involving half-spaces of
|
||||
spheres, cylinders, and axis-aligned planes, it generally cannot be determined
|
||||
if the region involves cones, non-axis-aligned planes, or other exotic
|
||||
second-order surfaces. For example, the :func:`openmc.get_hexagonal_prism`
|
||||
function returns the interior region of a hexagonal prism; because it is bounded
|
||||
by a :class:`openmc.Plane`, trying to get its bounding box won't work::
|
||||
|
||||
>>> hex = openmc.get_hexagonal_prism()
|
||||
>>> hex.bounding_box
|
||||
(array([-0.8660254, -inf, -inf]),
|
||||
array([ 0.8660254, inf, inf]))
|
||||
|
||||
Boundary Conditions
|
||||
-------------------
|
||||
|
||||
When a surface is created, by default particles that pass through the surface
|
||||
will consider it to be transmissive, i.e., they pass through the surface
|
||||
freely. If your model does not extend to infinity in all spatial dimensions, you
|
||||
may want to specify different behavior for particles passing through a
|
||||
surface. To specify a vacuum boundary condition, simply change the
|
||||
:attr:`Surface.boundary_type` attribute to 'vacuum'::
|
||||
|
||||
outer_surface = openmc.Sphere(R=100.0, boundary_type='vacuum')
|
||||
|
||||
# This is equivalent
|
||||
outer_surface = openmc.Sphere(R=100.0)
|
||||
outer_surface.boundary_type = 'vacuum'
|
||||
|
||||
Reflective and periodic boundary conditions can be set with the strings
|
||||
'reflective' and 'periodic'. Vacuum and reflective boundary conditions can be
|
||||
applied to any type of surface. Periodic boundary conditions can only be applied
|
||||
to pairs of axis-aligned planar surfaces.
|
||||
|
||||
.. _usersguide_cells:
|
||||
|
||||
-----
|
||||
Cells
|
||||
-----
|
||||
|
||||
Once you have a material created and a region of space defined, you need to
|
||||
define a *cell* that assigns the material to the region. Cells are created using
|
||||
the :class:`openmc.Cell` class::
|
||||
|
||||
fuel = openmc.Cell(fill=uo2, region=pellet)
|
||||
|
||||
# This is equivalent
|
||||
fuel = openmc.Cell()
|
||||
fuel.fill = uo2
|
||||
fuel.region = pellet
|
||||
|
||||
In this example, an instance of :class:`openmc.Material` is assigned to the
|
||||
:attr:`Cell.fill` attribute. One can also fill a cell with a :ref:`universe
|
||||
<usersguide_universes>` or :ref:`lattice <usersguide_lattices>`.
|
||||
|
||||
The classes :class:`Halfspace`, :class:`Intersection`, :class:`Union`, and
|
||||
:class:`Complement` and all instances of :class:`openmc.Region` and can be
|
||||
assigned to the :attr:`Cell.region` attribute.
|
||||
|
||||
.. _usersguide_universes:
|
||||
|
||||
---------
|
||||
Universes
|
||||
---------
|
||||
|
||||
Similar to MCNP and Serpent, OpenMC is capable of using *universes*, collections
|
||||
of cells that can be used as repeatable units of geometry. At a minimum, there
|
||||
must be one "root" universe present in the model. To define a universe, an
|
||||
instance of :class:`openmc.Universe` is created and then cells can be added
|
||||
using the :meth:`Universe.add_cells` or :meth:`Universe.add_cell`
|
||||
methods. Alternatively, a list of cells can be specified in the constructor::
|
||||
|
||||
universe = openmc.Universe(cells=[cell1, cell2, cell3])
|
||||
|
||||
# This is equivalent
|
||||
universe = openmc.Universe()
|
||||
universe.add_cells([cell1, cell2])
|
||||
universe.add_cell(cell3)
|
||||
|
||||
Universes are generally used in three ways:
|
||||
|
||||
1. To be assigned to a :class:`Geometry` object (see
|
||||
:ref:`usersguide_geom_export`),
|
||||
2. To be assigned as the fill for a cell via the :attr:`Cell.fill` attribute,
|
||||
and
|
||||
3. To be used in a regular arrangement of universes in a :ref:`lattice
|
||||
<usersguide_lattices>`.
|
||||
|
||||
Once a universe is constructed, it can actually be used to determine what cell
|
||||
or material is found at a given location by using the :meth:`Universe.find`
|
||||
method, which returns a list of universes, cells, and lattices which are
|
||||
traversed to find a given point. The last element of that list would contain the
|
||||
lowest-level cell at that location::
|
||||
|
||||
>>> universe.find((0., 0., 0.))[-1]
|
||||
Cell
|
||||
ID = 10000
|
||||
Name = cell 1
|
||||
Fill = Material 10000
|
||||
Region = -10000
|
||||
Rotation = None
|
||||
Temperature = None
|
||||
Translation = None
|
||||
|
||||
As you are building a geometry, it is also possible to display a plot of single
|
||||
universe using the :meth:`Universe.plot` method. This method requires that you
|
||||
have `matplotlib <http://matplotlib.org/>`_ installed.
|
||||
|
||||
.. _usersguide_lattices:
|
||||
|
||||
--------
|
||||
Lattices
|
||||
--------
|
||||
|
||||
Many particle transport models involve repeated structures that occur in a
|
||||
regular pattern such as a rectangular or hexagonal lattice. In such a case, it
|
||||
would be cumbersome to have to define the boundaries of each of the cells to be
|
||||
filled with a universe. OpenMC provides a means to define lattice structures
|
||||
through the :class:`openmc.RectLattice` and :class:`openmc.HexLattice` classes.
|
||||
|
||||
Rectangular Lattices
|
||||
--------------------
|
||||
|
||||
A rectangular lattice defines a two-dimensional or three-dimensional array of
|
||||
universes that are filled into rectangular prisms (lattice elements) each of
|
||||
which has the same width, length, and height. To completely define a rectangular
|
||||
lattice, one needs to specify
|
||||
|
||||
- The coordinates of the lower-left corner of the lattice
|
||||
(:attr:`RectLattice.lower_left`),
|
||||
- The pitch of the lattice, i.e., the distance between the center of adjacent
|
||||
lattice elements (:attr:`RectLattice.pitch`),
|
||||
- What universes should fill each lattice element
|
||||
(:attr:`RectLattice.universes`), and
|
||||
- A universe that is used to fill any lattice position outside the well-defined
|
||||
portion of the lattice (:attr:`RectLattice.outer`).
|
||||
|
||||
For example, to create a 3x3 lattice centered at the origin in which each
|
||||
lattice element is 5cm by 5cm and is filled by a universe ``u``, one could run::
|
||||
|
||||
lattice = openmc.RectLattice()
|
||||
lattice.lower_left = (-7.5, -7.5)
|
||||
lattice.pitch = (5.0, 5.0)
|
||||
lattice.universes = [[u, u, u],
|
||||
[u, u, u],
|
||||
[u, u, u]]
|
||||
|
||||
Note that because this is a two-dimensional lattice, the lower-left coordinates
|
||||
and pitch only need to specify the :math:`x,y` values. The order that the
|
||||
universes appear is such that the first row corresponds to lattice elements with
|
||||
the highest :math:`y` -value. Note that the :attr:`RectLattice.universes`
|
||||
attribute expects a doubly-nested iterable of type :class:`openmc.Universe` ---
|
||||
this can be normal Python lists, as shown above, or a NumPy array can be used as
|
||||
well::
|
||||
|
||||
lattice.universes = np.tile(u, (3, 3))
|
||||
|
||||
For a three-dimensional lattice, the :math:`x,y,z` coordinates of the lower-left
|
||||
coordinate need to be given and the pitch should also give dimensions for all
|
||||
three axes. For example, to make a 3x3x3 lattice where the bottom layer is
|
||||
universe ``u``, the middle layer is universe ``q`` and the top layer is universe
|
||||
``z`` would look like::
|
||||
|
||||
lat3d = openmc.RectLattice()
|
||||
lat3d.lower_left = (-7.5, -7.5, -7.5)
|
||||
lat3d.pitch = (5.0, 5.0, 5.0)
|
||||
lat3d.universes = [
|
||||
[[u, u, u],
|
||||
[u, u, u],
|
||||
[u, u, u]],
|
||||
[[q, q, q],
|
||||
[q, q, q],
|
||||
[q, q, q]],
|
||||
[[z, z, z],
|
||||
[z, z, z]
|
||||
[z, z, z]]]
|
||||
|
||||
Again, using NumPy can make things easier::
|
||||
|
||||
lat3d.universes = np.empty((3, 3, 3), dtype=openmc.Universe)
|
||||
lat3d.universes[0, ...] = u
|
||||
lat3d.universes[1, ...] = q
|
||||
lat3d.universes[2, ...] = z
|
||||
|
||||
Finally, it's possible to specify that lattice positions that aren't normally
|
||||
without the bounds of the lattice be filled with an "outer" universe. This
|
||||
allows one to create a truly infinite lattice if desired. An outer universe is
|
||||
set with the :attr:`RectLattice.outer` attribute.
|
||||
|
||||
Hexagonal Lattices
|
||||
------------------
|
||||
|
||||
OpenMC also allows creation of 2D and 3D hexagonal lattices. Creating a
|
||||
hexagonal lattice is similar to creating a rectangular lattice with a few
|
||||
differences:
|
||||
|
||||
- The center of the lattice must be specified (:attr:`HexLattice.center`).
|
||||
- For a 2D hexagonal lattice, a single value for the pitch should be specified,
|
||||
although it still needs to appear in a list. For a 3D hexagonal lattice, the
|
||||
pitch in the radial and axial directions should be given.
|
||||
- For a hexagonal lattice, the :attr:`HexLattice.universes` attribute cannot be
|
||||
given as a NumPy array for reasons explained below.
|
||||
- As with rectangular lattices, the :attr:`HexLattice.outer` attribute will
|
||||
specify an outer universe.
|
||||
|
||||
For a 2D hexagonal lattice, the :attr:`HexLattice.universes` attribute should be
|
||||
set to a two-dimensional list of universes filling each lattice element. Each
|
||||
sub-list corresponds to one ring of universes and is ordered from the outermost
|
||||
ring to the innermost ring. The universes within each sub-list are ordered from
|
||||
the "top" (position with greatest y value) and proceed in a clockwise fashion
|
||||
around the ring. The :meth:`HexLattice.show_indices` static method can be used
|
||||
to help figure out how to place universes::
|
||||
|
||||
>>> print(openmc.HexLattice.show_indices(3))
|
||||
(0, 0)
|
||||
(0,11) (0, 1)
|
||||
(0,10) (1, 0) (0, 2)
|
||||
(1, 5) (1, 1)
|
||||
(0, 9) (2, 0) (0, 3)
|
||||
(1, 4) (1, 2)
|
||||
(0, 8) (1, 3) (0, 4)
|
||||
(0, 7) (0, 5)
|
||||
(0, 6)
|
||||
|
||||
|
||||
Note that by default, hexagonal lattices are positioned such that each lattice
|
||||
element has two faces that are parallel to the :math:`y` axis. As one example,
|
||||
to create a three-ring lattice centered at the origin with a pitch of 10 cm
|
||||
where all the lattice elements centered along the :math:`y` axis are filled with
|
||||
universe ``u`` and the remainder are filled with universe ``q``, the following
|
||||
code would work::
|
||||
|
||||
hexlat = openmc.HexLattice()
|
||||
hexlat.center = (0, 0)
|
||||
hexlat.pitch = [10]
|
||||
|
||||
outer_ring = [u, q, q, q, q, q, u, q, q, q, q, q]
|
||||
middle_ring = [u, q, q, u, q, q]
|
||||
inner_ring = [u]
|
||||
hexlat.universes = [outer_ring, middle_ring, inner_ring]
|
||||
|
||||
If you need to create a hexagonal boundary (composed of six planar surfaces) for
|
||||
a hexagonal lattice, :func:`openmc.get_hexagonal_prism` can be used.
|
||||
|
||||
.. _usersguide_geom_export:
|
||||
|
||||
--------------------------
|
||||
Exporting a Geometry Model
|
||||
--------------------------
|
||||
|
||||
Once you have finished building your geometry by creating surfaces, cell, and,
|
||||
if needed, lattices, the last step is to create an instance of
|
||||
:class:`openmc.Geometry` and export it to an XML file that the
|
||||
:ref:`scripts_openmc` executable can read using the
|
||||
:meth:`Geometry.export_to_xml` method. This can be done as follows::
|
||||
|
||||
geom = openmc.Geometry(root_univ)
|
||||
geom.export_to_xml()
|
||||
|
||||
# This is equivalent
|
||||
geom = openmc.Geometry()
|
||||
geom.root_universe = root_univ
|
||||
geom.export_to_xml()
|
||||
|
||||
.. _constructive solid geometry: http://en.wikipedia.org/wiki/Constructive_solid_geometry
|
||||
.. _quadratic surfaces: http://en.wikipedia.org/wiki/Quadric
|
||||
|
|
@ -9,10 +9,19 @@ essential aspects of using OpenMC to perform simulations.
|
|||
|
||||
.. toctree::
|
||||
:numbered:
|
||||
:maxdepth: 2
|
||||
:maxdepth: 1
|
||||
|
||||
beginners
|
||||
install
|
||||
input
|
||||
cross_sections
|
||||
basics
|
||||
materials
|
||||
geometry
|
||||
settings
|
||||
tallies
|
||||
plots
|
||||
scripts
|
||||
processing
|
||||
parallel
|
||||
volume
|
||||
troubleshoot
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -4,6 +4,8 @@
|
|||
Installation and Configuration
|
||||
==============================
|
||||
|
||||
.. currentmodule:: openmc
|
||||
|
||||
----------------------------------------
|
||||
Installing on Linux/Mac with conda-forge
|
||||
----------------------------------------
|
||||
|
|
@ -52,7 +54,7 @@ Next, resynchronize the package index files:
|
|||
|
||||
.. code-block:: sh
|
||||
|
||||
sudo apt-get update
|
||||
sudo apt update
|
||||
|
||||
Now OpenMC should be recognized within the repository and can be installed:
|
||||
|
||||
|
|
@ -76,6 +78,7 @@ Prerequisites
|
|||
-------------
|
||||
|
||||
.. admonition:: Required
|
||||
:class: error
|
||||
|
||||
* A Fortran compiler such as gfortran_
|
||||
|
||||
|
|
@ -140,6 +143,7 @@ Prerequisites
|
|||
distribution and version.
|
||||
|
||||
.. admonition:: Optional
|
||||
:class: note
|
||||
|
||||
* An MPI implementation for distributed-memory parallel runs
|
||||
|
||||
|
|
@ -186,6 +190,8 @@ switch to the source of the latest stable release, run the following commands::
|
|||
.. _git: http://git-scm.com
|
||||
.. _ssh: http://en.wikipedia.org/wiki/Secure_Shell
|
||||
|
||||
.. _usersguide_build:
|
||||
|
||||
Build Configuration
|
||||
-------------------
|
||||
|
||||
|
|
@ -225,7 +231,7 @@ optimize
|
|||
|
||||
openmp
|
||||
Enables shared-memory parallelism using the OpenMP API. The Fortran compiler
|
||||
being used must support OpenMP.
|
||||
being used must support OpenMP. (Default: on)
|
||||
|
||||
coverage
|
||||
Compile and link code instrumented for coverage analysis. This is typically
|
||||
|
|
@ -243,6 +249,8 @@ should be used:
|
|||
|
||||
.. _gcov: https://gcc.gnu.org/onlinedocs/gcc/Gcov.html
|
||||
|
||||
.. _usersguide_compile_mpi:
|
||||
|
||||
Compiling with MPI
|
||||
++++++++++++++++++
|
||||
|
||||
|
|
@ -318,7 +326,7 @@ Recent versions of Windows 10 include a subsystem for Linux that allows one to
|
|||
run Bash within Ubuntu running in Windows. First, follow the installation guide
|
||||
`here <https://msdn.microsoft.com/en-us/commandline/wsl/install_guide>`_ to get
|
||||
Bash on Ubuntu on Windows setup. Once you are within bash, obtain the necessary
|
||||
:ref:`prerequisites <prerequisites>` via ``apt-get``. Finally, follow the
|
||||
:ref:`prerequisites <prerequisites>` via ``apt``. Finally, follow the
|
||||
:ref:`instructions for compiling on linux <compile_linux>`.
|
||||
|
||||
Compiling for the Intel Xeon Phi
|
||||
|
|
@ -371,184 +379,68 @@ if we wanted to run only the plot tests with 4 processors, we run:
|
|||
If you want to run the full test suite with different build options please
|
||||
refer to our :ref:`test suite` documentation.
|
||||
|
||||
---------------------------
|
||||
Cross Section Configuration
|
||||
---------------------------
|
||||
--------------------
|
||||
Python Prerequisites
|
||||
--------------------
|
||||
|
||||
In order to run a simulation with OpenMC, you will need cross section data for
|
||||
each nuclide or material in your problem. OpenMC can be run in continuous-energy
|
||||
or multi-group mode.
|
||||
OpenMC's :ref:`Python API <pythonapi>` works with either Python 2.7 or Python
|
||||
3.2+. In addition to Python itself, the API relies on a number of third-party
|
||||
packages. All prerequisites can be installed using `conda
|
||||
<http://conda.pydata.org/docs/>`_ (recommended), `pip
|
||||
<https://pip.pypa.io/en/stable/>`_, or through the package manager in most Linux
|
||||
distributions.
|
||||
|
||||
In continuous-energy mode, OpenMC uses a native HDF5 format to store all nuclear
|
||||
data. If you have ACE format data that was produced with NJOY_, such as that
|
||||
distributed with MCNP_ or Serpent_, it can be converted to the HDF5 format using
|
||||
the :ref:`openmc-ace-to-hdf5 <other_cross_sections>` script distributed with
|
||||
OpenMC. Several sources provide openly available ACE data as described
|
||||
below. The TALYS-based evaluated nuclear data library, TENDL_, is also available
|
||||
in ACE format.
|
||||
.. admonition:: Required
|
||||
:class: error
|
||||
|
||||
In multi-group mode, OpenMC utilizes an XML-based library format which can be
|
||||
used to describe nuclide- or material-specific quantities.
|
||||
`six <https://pythonhosted.org/six/>`_
|
||||
The Python API works with both Python 2.7+ and 3.2+. To do so, the six
|
||||
compatibility library is used.
|
||||
|
||||
Using ENDF/B-VII.1 Cross Sections from NNDC
|
||||
-------------------------------------------
|
||||
`NumPy <http://www.numpy.org/>`_
|
||||
NumPy is used extensively within the Python API for its powerful
|
||||
N-dimensional array.
|
||||
|
||||
The NNDC_ provides ACE data from the ENDF/B-VII.1 neutron and thermal scattering
|
||||
sublibraries at four temperatures processed using NJOY_. To use this data with
|
||||
OpenMC, a script is provided with OpenMC that will automatically download and
|
||||
extract the ACE data, fix any deficiencies, and create an HDF5 library:
|
||||
`h5py <http://www.h5py.org/>`_
|
||||
h5py provides Python bindings to the HDF5 library. Since OpenMC outputs
|
||||
various HDF5 files, h5py is needed to provide access to data within these
|
||||
files from Python.
|
||||
|
||||
.. code-block:: sh
|
||||
.. admonition:: Optional
|
||||
:class: note
|
||||
|
||||
openmc-get-nndc-data
|
||||
`SciPy <https://www.scipy.org/>`_
|
||||
SciPy's special functions, sparse matrices, and spatial data structures
|
||||
are used for several optional features in the API.
|
||||
|
||||
At this point, you should set the :envvar:`OPENMC_CROSS_SECTIONS` environment
|
||||
variable to the absolute path of the file ``nndc_hdf5/cross_sections.xml``. This
|
||||
cross section set is used by the test suite.
|
||||
`pandas <http://pandas.pydata.org/>`_
|
||||
Pandas is used to generate tally DataFrames as demonstrated in
|
||||
:ref:`examples_pandas` example notebook.
|
||||
|
||||
Using JEFF Cross Sections from OECD/NEA
|
||||
---------------------------------------
|
||||
`Matplotlib <http://matplotlib.org/>`_
|
||||
Matplotlib is used to providing plotting functionality in the API like the
|
||||
:meth:`Universe.plot` method and the :func:`openmc.plot_xs` function.
|
||||
|
||||
The NEA_ provides processed ACE data from the JEFF_ library. To use this data
|
||||
with OpenMC, a script is provided with OpenMC that will automatically download
|
||||
and extract the ACE data, fix any deficiencies, and create an HDF5 library.
|
||||
`uncertainties <https://pythonhosted.org/uncertainties/>`_
|
||||
Uncertainties are optionally used for decay data in the :mod:`openmc.data`
|
||||
module.
|
||||
|
||||
.. code-block:: sh
|
||||
`Cython <http://cython.org/>`_
|
||||
Cython is used for resonance reconstruction for ENDF data converted to
|
||||
:class:`openmc.data.IncidentNeutron`.
|
||||
|
||||
openmc-get-jeff-data
|
||||
`vtk <http://www.vtk.org/>`_
|
||||
The Python VTK bindings are needed to convert voxel and track files to VTK
|
||||
format.
|
||||
|
||||
At this point, you should set the :envvar:`OPENMC_CROSS_SECTIONS` environment
|
||||
variable to the absolute path of the file ``jeff-3.2-hdf5/cross_sections.xml``.
|
||||
`silomesh <https://github.com/nhorelik/silomesh>`_
|
||||
The silomesh package is needed to convert voxel and track files to SILO
|
||||
format.
|
||||
|
||||
Using Cross Sections from MCNP
|
||||
------------------------------
|
||||
`lxml <http://lxml.de/>`_
|
||||
lxml is used for the :ref:`scripts_validate` script.
|
||||
|
||||
OpenMC is provided with a script that will automatically convert ENDF/B-VII.0
|
||||
and ENDF/B-VII.1 ACE data that is provided with MCNP5 or MCNP6. To convert the
|
||||
ENDF/B-VII.0 ACE files (``endf70[a-k]`` and ``endf70sab``) into the native HDF5
|
||||
format, run the following:
|
||||
|
||||
.. code-block:: sh
|
||||
|
||||
openmc-convert-mcnp70-data /path/to/mcnpdata/
|
||||
|
||||
where ``/path/to/mcnpdata`` is the directory containing the ``endf70[a-k]``
|
||||
files.
|
||||
|
||||
To convert the ENDF/B-VII.1 ACE files (the endf71x and ENDF71SaB libraries), use
|
||||
the following script:
|
||||
|
||||
.. code-block:: sh
|
||||
|
||||
openmc-convert-mcnp71-data /path/to/mcnpdata
|
||||
|
||||
where ``/path/to/mcnpdata`` is the directory containing the ``endf71x`` and
|
||||
``ENDF71SaB`` directories.
|
||||
|
||||
.. _other_cross_sections:
|
||||
|
||||
Using Other Cross Sections
|
||||
--------------------------
|
||||
|
||||
If you have a library of ACE format cross sections other than those listed above
|
||||
that you need to convert to OpenMC's HDF5 format, the ``openmc-ace-to-hdf5``
|
||||
script can be used. There are four different ways you can specify ACE libraries
|
||||
that are to be converted:
|
||||
|
||||
1. List each ACE library as a positional argument. This is very useful in
|
||||
conjunction with the usual shell utilities (ls, find, etc.).
|
||||
2. Use the ``--xml`` option to specify a pre-v0.9 cross_sections.xml file.
|
||||
3. Use the ``--xsdir`` option to specify a MCNP xsdir file.
|
||||
4. Use the ``--xsdata`` option to specify a Serpent xsdata file.
|
||||
|
||||
The script does not use any extra information from cross_sections.xml/ xsdir/
|
||||
xsdata files to determine whether the nuclide is metastable. Instead, the
|
||||
``--metastable`` argument can be used to specify whether the ZAID naming
|
||||
convention follows the NNDC data convention (1000*Z + A + 300 + 100*m), or the
|
||||
MCNP data convention (essentially the same as NNDC, except that the first
|
||||
metastable state of Am242 is 95242 and the ground state is 95642).
|
||||
|
||||
The ``openmc-ace-to-hdf5`` script has the following command-line flags:
|
||||
|
||||
-h, --help show this help message and exit
|
||||
|
||||
-d DESTINATION, --destination DESTINATION
|
||||
Directory to create new library in (default: .)
|
||||
|
||||
-m META, --metastable META
|
||||
How to interpret ZAIDs for metastable nuclides. META
|
||||
can be either 'nndc' or 'mcnp'. (default: nndc)
|
||||
|
||||
--xml XML Old-style cross_sections.xml that lists ACE libraries
|
||||
(default: None)
|
||||
|
||||
--xsdir XSDIR MCNP xsdir file that lists ACE libraries (default:
|
||||
None)
|
||||
|
||||
--xsdata XSDATA Serpent xsdata file that lists ACE libraries (default:
|
||||
None)
|
||||
|
||||
--fission_energy_release FISSION_ENERGY_RELEASE
|
||||
HDF5 file containing fission energy release data
|
||||
(default: None)
|
||||
|
||||
|
||||
Using Multi-Group Cross Sections
|
||||
--------------------------------
|
||||
|
||||
Multi-group cross section libraries are generally tailored to the specific
|
||||
calculation to be performed. Therefore, at this point in time, OpenMC is not
|
||||
distributed with any pre-existing multi-group cross section libraries.
|
||||
However, if the user has obtained or generated their own library, the user
|
||||
should set the :envvar:`OPENMC_MG_CROSS_SECTIONS` environment variable
|
||||
to the absolute path of the file library expected to used most frequently.
|
||||
|
||||
.. _NJOY: http://t2.lanl.gov/nis/codes/NJOY12/
|
||||
.. _NNDC: http://www.nndc.bnl.gov/endf/b7.1/acefiles.html
|
||||
.. _NEA: http://www.oecd-nea.org
|
||||
.. _JEFF: https://www.oecd-nea.org/dbforms/data/eva/evatapes/jeff_32/
|
||||
.. _MCNP: http://mcnp.lanl.gov
|
||||
.. _Serpent: http://montecarlo.vtt.fi
|
||||
.. _TENDL: https://tendl.web.psi.ch/tendl_2015/tendl2015.html
|
||||
|
||||
--------------
|
||||
Running OpenMC
|
||||
--------------
|
||||
|
||||
Once you have a model built (see :ref:`usersguide_input`), you can either run
|
||||
the openmc executable directly from the directory containing your XML input
|
||||
files, or you can specify as a command-line argument the directory containing
|
||||
the XML input files. For example, if your XML input files are in the directory
|
||||
``/home/username/somemodel/``, one way to run the simulation would be:
|
||||
|
||||
.. code-block:: sh
|
||||
|
||||
cd /home/username/somemodel
|
||||
openmc
|
||||
|
||||
Alternatively, you could run from any directory:
|
||||
|
||||
.. code-block:: sh
|
||||
|
||||
openmc /home/username/somemodel
|
||||
|
||||
Note that in the latter case, any output files will be placed in the present
|
||||
working directory which may be different from ``/home/username/somemodel``.
|
||||
|
||||
Command-Line Flags
|
||||
------------------
|
||||
|
||||
OpenMC accepts the following command line flags:
|
||||
|
||||
-g, --geometry-debug Run in geometry debugging mode, where cell overlaps are
|
||||
checked for after each move of a particle
|
||||
-n, --particles N Use *N* particles per generation or batch
|
||||
-p, --plot Run in plotting mode
|
||||
-r, --restart file Restart a previous run from a state point or a particle
|
||||
restart file
|
||||
-s, --threads N Run with *N* OpenMP threads
|
||||
-t, --track Write tracks for all particles
|
||||
-v, --version Show version information
|
||||
.. _usersguide_nxml:
|
||||
|
||||
-----------------------------------------------------
|
||||
Configuring Input Validation with GNU Emacs nXML mode
|
||||
|
|
@ -573,4 +465,5 @@ schemas.xml file in your own OpenMC source directory.
|
|||
.. _GNU Emacs: http://www.gnu.org/software/emacs/
|
||||
.. _validation: http://en.wikipedia.org/wiki/XML_validation
|
||||
.. _RELAX NG: http://relaxng.org/
|
||||
.. _NNDC: http://www.nndc.bnl.gov/endf/b7.1/acefiles.html
|
||||
.. _ctest: http://www.cmake.org/cmake/help/v2.8.12/ctest.html
|
||||
|
|
|
|||
169
docs/source/usersguide/materials.rst
Normal file
169
docs/source/usersguide/materials.rst
Normal file
|
|
@ -0,0 +1,169 @@
|
|||
.. _usersguide_materials:
|
||||
|
||||
.. currentmodule:: openmc
|
||||
|
||||
=====================
|
||||
Material Compositions
|
||||
=====================
|
||||
|
||||
Materials in OpenMC are defined as a set of nuclides/elements at specified
|
||||
densities and are created using the :class:`openmc.Material` class. Once a
|
||||
material has been instantiated, nuclides can be added with
|
||||
:meth:`Material.add_nuclide` and elements can be added with
|
||||
:meth:`Material.add_element`. Densities can be specified using atom fractions or
|
||||
weight fractions. For example, to create a material and add Gd152 at 0.5 atom
|
||||
percent, you'd run::
|
||||
|
||||
mat = openmc.Material()
|
||||
mat.add_nuclide('Gd152', 0.5, 'ao')
|
||||
|
||||
The third argument to :meth:`Material.add_nuclide` can also be 'wo' for weight
|
||||
percent. The densities specified for each nuclide/element are relative and are
|
||||
renormalized based on the total density of the material. The total density is
|
||||
set using the :meth:`Material.set_density` method. The density can be specified
|
||||
in gram per cubic centimeter ('g/cm3'), atom per barn-cm ('atom/b-cm'), or
|
||||
kilogram per cubic meter ('kg/m3'), e.g.,
|
||||
|
||||
::
|
||||
|
||||
mat.set_density('g/cm3', 4.5)
|
||||
|
||||
----------------
|
||||
Natural Elements
|
||||
----------------
|
||||
|
||||
The :meth:`Material.add_element` method works exactly the same as
|
||||
:meth:`Material.add_nuclide`, except that instead of specifying a single isotope
|
||||
of an element, you specify the element itself. For example,
|
||||
|
||||
::
|
||||
|
||||
mat.add_element('C', 1.0)
|
||||
|
||||
Internally, OpenMC stores data on the atomic masses and natural abundances of
|
||||
all known isotopes and then uses this data to determine what isotopes should be
|
||||
added to the material. When the material is later exported to XML for use by the
|
||||
:ref:`scripts_openmc` executable, you'll see that any natural elements are
|
||||
expanded to the naturally-occurring isotopes.
|
||||
|
||||
Often, cross section libraries don't actually have all naturally-occurring
|
||||
isotopes for a given element. For example, in ENDF/B-VII.1, cross section
|
||||
evaluations are given for O16 and O17 but not for O18. If OpenMC is aware of
|
||||
what cross sections you will be using (either through the
|
||||
:attr:`Materials.cross_sections` attribute or the
|
||||
:envvar:`OPENMC_CROSS_SECTIONS` environment variable), it will attempt to only
|
||||
put isotopes in your model for which you have cross section data. In the case of
|
||||
oxygen in ENDF/B-VII.1, the abundance of O18 would end up being lumped with O16.
|
||||
|
||||
-----------------------
|
||||
Thermal Scattering Data
|
||||
-----------------------
|
||||
|
||||
If you have a moderating material in your model like water or graphite, you
|
||||
should assign thermal scattering data (so-called :math:`S(\alpha,\beta)`) using
|
||||
the :meth:`Material.add_s_alpha_beta` method. For example, to model light water,
|
||||
you would need to add hydrogen and oxygen to a material and then assign the
|
||||
``c_H_in_H2O`` thermal scattering data::
|
||||
|
||||
water = openmc.Material()
|
||||
water.add_nuclide('H1', 2.0)
|
||||
water.add_nuclide('O16', 1.0)
|
||||
water.add_s_alpha_beta('c_H_in_H2O')
|
||||
water.set_density('g/cm3', 1.0)
|
||||
|
||||
.. _usersguide_naming:
|
||||
|
||||
------------------
|
||||
Naming Conventions
|
||||
------------------
|
||||
|
||||
OpenMC uses the GND_ naming convention for nuclides, metastable states, and
|
||||
compounds:
|
||||
|
||||
:Nuclides: ``SymA`` where "A" is the mass number (e.g., ``Fe56``)
|
||||
:Elements: ``Sym0`` (e.g., ``Fe0`` or ``C0``)
|
||||
:Excited states: ``SymA_eN`` (e.g., ``V51_e1`` for the first excited state of
|
||||
Vanadium-51.) This is only used in decay data.
|
||||
:Metastable states: ``SymA_mN`` (e.g., ``Am242_m1`` for the first excited state
|
||||
of Americium-242).
|
||||
:Compounds: ``c_String_Describing_Material`` (e.g., ``c_H_in_H2O``). Used for
|
||||
thermal scattering data.
|
||||
|
||||
.. important:: The element syntax, e.g., ``C0``, is only used when the cross
|
||||
section evaluation is an elemental evaluation, like carbon in
|
||||
ENDF/B-VII.1! If you are adding an element via
|
||||
:meth:`Material.add_element`, just use ``Sym``.
|
||||
|
||||
.. _GND: https://www.oecd-nea.org/science/wpec/sg38/Meetings/2016_May/tlh4gnd-main.pdf
|
||||
|
||||
-----------
|
||||
Temperature
|
||||
-----------
|
||||
|
||||
Some Monte Carlo codes define temperature implicitly through the cross section
|
||||
data, which is itself given only at a particular temperature. In OpenMC, the
|
||||
material definition is decoupled from the specification of temperature. Instead,
|
||||
temperatures are assigned to :ref:`cells <usersguide_cells>`
|
||||
directly. Alternatively, a default temperature can be assigned to a material
|
||||
that is to be applied to any cell where the material is used. In the absence of
|
||||
any cell or material temperature specification, a global default temperature can
|
||||
be set that is applied to all cells and materials. Anytime a material
|
||||
temperature is specified, it will override the global default
|
||||
temperature. Similarly, anytime a cell temperatures is specified, it will
|
||||
override the material or global default temperature. All temperatures should be
|
||||
given in units of Kelvin.
|
||||
|
||||
To assign a default material temperature, one should use the ``temperature``
|
||||
attribute, e.g.,
|
||||
|
||||
::
|
||||
|
||||
hot_fuel = openmc.Material()
|
||||
hot_fuel.temperature = 1200.0 # temperature in Kelvin
|
||||
|
||||
.. warning:: MCNP_ users should be aware that OpenMC does not use the concept of
|
||||
cross section suffixes like "71c" or "80c". Temperatures in Kelvin
|
||||
should be assigned directly per material or per cell using the
|
||||
:attr:`Material.temperature` or :attr:`Cell.temperature`
|
||||
attributes, respectively.
|
||||
|
||||
--------------------
|
||||
Material Collections
|
||||
--------------------
|
||||
|
||||
The :ref:`scripts_openmc` executable expects to find a ``materials.xml`` file
|
||||
when it is run. To create this file, one needs to instantiate the
|
||||
:class:`openmc.Materials` class and add materials to it. The :class:`Materials`
|
||||
class acts like a list (in fact, it is a subclass of Python's built-in
|
||||
:class:`list` class), so materials can be added by passing a list to the
|
||||
constructor, using methods like ``append()``, or through the operator
|
||||
``+=``. Once materials have been added to the collection, it can be exported
|
||||
using the :meth:`Materials.export_to_xml` method.
|
||||
|
||||
::
|
||||
|
||||
materials = openmc.Materials()
|
||||
materials.append(water)
|
||||
materials += [uo2, zircaloy]
|
||||
materials.export_to_xml()
|
||||
|
||||
# This is equivalent
|
||||
materials = openmc.Materials([water, uo2, zircaloy])
|
||||
materials.export_to_xml()
|
||||
|
||||
Cross Sections
|
||||
--------------
|
||||
|
||||
OpenMC uses a file called :ref:`cross_sections.xml <io_cross_sections>` to
|
||||
indicate where cross section data can be found on the filesystem. This file
|
||||
serves the same role that ``xsdir`` does for MCNP_ or ``xsdata`` does for
|
||||
Serpent. Information on how to generate a cross section listing file can be
|
||||
found in :ref:`create_xs_library`. Once you have a cross sections file that has
|
||||
been generated, you can tell OpenMC to use this file either by setting
|
||||
:attr:`Materials.cross_sections` or by setting the
|
||||
:envvar:`OPENMC_CROSS_SECTIONS` environment variable to the path of the
|
||||
``cross_sections.xml`` file. The former approach would look like::
|
||||
|
||||
materials.cross_sections = '/path/to/cross_sections.xml'
|
||||
|
||||
.. _MCNP: https://mcnp.lanl.gov/
|
||||
112
docs/source/usersguide/parallel.rst
Normal file
112
docs/source/usersguide/parallel.rst
Normal file
|
|
@ -0,0 +1,112 @@
|
|||
.. _usersguide_parallel:
|
||||
|
||||
===================
|
||||
Running in Parallel
|
||||
===================
|
||||
|
||||
If you are running a simulation on a computer with multiple cores, multiple
|
||||
sockets, or multiple nodes (i.e., a cluster), you can benefit from the fact that
|
||||
OpenMC is able to use all available hardware resources if configured
|
||||
correctly. OpenMC is capable of using both distributed-memory (`MPI
|
||||
<http://mpi-forum.org/>`_) and shared-memory (`OpenMP
|
||||
<http://www.openmp.org/>`_) parallelism. If you are on a single-socket
|
||||
workstation or a laptop, using shared-memory parallelism is likely
|
||||
sufficient. On a multi-socket node, cluster, or supercomputer, chances are you
|
||||
will need to use both distributed-memory (across nodes) and shared-memory
|
||||
(within a single node) parallelism.
|
||||
|
||||
----------------------------------
|
||||
Shared-Memory Parallelism (OpenMP)
|
||||
----------------------------------
|
||||
|
||||
When using OpenMP, multiple threads will be launched and each is capable of
|
||||
simulating a particle independently of all other threads. The primary benefit of
|
||||
using OpenMP within a node is that it requires very little extra memory per
|
||||
thread. To use OpenMP, you need to pass the ``-Dopenmp=on`` flag when running
|
||||
``CMake``:
|
||||
|
||||
.. code-block:: sh
|
||||
|
||||
cmake -Dopenmp=on /path/to/openmc/root
|
||||
make
|
||||
|
||||
The only requirement is that the Fortran compiler you use must support the
|
||||
OpenMP 3.1 or higher standard. Most recent compilers do support the use of
|
||||
OpenMP.
|
||||
|
||||
To specify the number of threads at run-time, you can use the ``threads``
|
||||
argument to :func:`openmc.run`::
|
||||
|
||||
openmc.run(threads=8)
|
||||
|
||||
If you're running :ref:`scripts_openmc` directly from the command line, you can
|
||||
use the ``-s`` or ``--threads`` command-line argument. Alternatively, you can
|
||||
use the :envvar:`OMP_NUM_THREADS` environment variable. If you do not specify
|
||||
the number of threads, the OpenMP library will try to determine how many
|
||||
hardware threads are available on your system and use that many threads.
|
||||
|
||||
In general, it is recommended to use as many OpenMP threads as you have hardware
|
||||
threads on your system. Notably, on a system with Intel hyperthreading, the
|
||||
hyperthreads should be used and can be expected to provide a 10--30% performance
|
||||
improvement over not using hyperthreads.
|
||||
|
||||
------------------------------------
|
||||
Distributed-Memory Parallelism (MPI)
|
||||
------------------------------------
|
||||
|
||||
MPI defines a library specification for message-passing between processes. There
|
||||
are two major implementations of MPI, `OpenMPI <https://www.open-mpi.org/>`_ and
|
||||
`MPICH <http://www.mpich.org/>`_. Both implementations are known to work with
|
||||
OpenMC; there is no obvious reason to prefer one over the other. Building OpenMC
|
||||
with support for MPI requires that you have one of these implementations
|
||||
installed on your system. For instructions on obtaining MPI, see
|
||||
:ref:`prerequisites`. Once you have an MPI implementation installed, compile
|
||||
OpenMC following :ref:`usersguide_compile_mpi`.
|
||||
|
||||
To run a simulation using MPI, :ref:`scripts_openmc` needs to be called using
|
||||
the `mpiexec <https://www.mpich.org/static/docs/v3.1/www1/mpiexec.html>`_
|
||||
wrapper. For example, to run OpenMC using 32 processes:
|
||||
|
||||
.. code-block:: sh
|
||||
|
||||
mpiexec -n 32 openmc
|
||||
|
||||
The same thing can be achieved from the Python API by supplying the ``mpi_args``
|
||||
argument to :func:`openmc.run`::
|
||||
|
||||
openmc.run(mpi_args=['mpiexec', '-n', '32'])
|
||||
|
||||
----------------------
|
||||
Maximizing Performance
|
||||
----------------------
|
||||
|
||||
There are a number of things you can do to ensure that you obtain optimal
|
||||
performance on a machine when running in parallel:
|
||||
|
||||
- **Use OpenMP within each NUMA node**. Some large server processors have so
|
||||
many cores that the last level cache is split to reduce memory latency. For
|
||||
example, the Intel Xeon Haswell-EP_ architecture uses a snoop mode called
|
||||
*cluster on die* where the L3 cache is split in half. Thus, in general, you
|
||||
should use one MPI process per socket (and OpenMP within each socket), but for
|
||||
these large processors, you will want to go one step further and use one
|
||||
process per NUMA node. The Xeon Phi Knights Landing architecture uses a
|
||||
similar concept called `sub NUMA clustering
|
||||
<https://colfaxresearch.com/knl-numa/>`_.
|
||||
- **Use a sufficiently large number of particles per generation**. Between
|
||||
fission generations, a number of synchronization tasks take place. If the
|
||||
number of particles per generation is too low and you are using many
|
||||
processes/threads, the synchronization time may become non-negligible.
|
||||
- **Use hardware threading if available**.
|
||||
- **Use process binding**. When running with MPI, you should ensure that
|
||||
processes are bound_ to a specific hardware region. This can be set using the
|
||||
``-bind-to`` (MPICH) or ``--bind-to`` (OpenMPI) option to ``mpiexec``.
|
||||
- **Turn off generation of tallies.out**. For large simulations with millions of
|
||||
tally bins or more, generating this ASCII file might consume considerable
|
||||
time. You can turn off generation of ``tallies.out`` via the
|
||||
:attr:`Settings.output` attribute::
|
||||
|
||||
settings = openmc.Settings()
|
||||
settings.output = {'tallies': False}
|
||||
|
||||
.. _Haswell-EP: http://www.anandtech.com/show/8423/intel-xeon-e5-version-3-up-to-18-haswell-ep-cores-/4
|
||||
.. _bound: https://wiki.mpich.org/mpich/index.php/Using_the_Hydra_Process_Manager#Process-core_Binding
|
||||
136
docs/source/usersguide/plots.rst
Normal file
136
docs/source/usersguide/plots.rst
Normal file
|
|
@ -0,0 +1,136 @@
|
|||
.. _usersguide_plots:
|
||||
|
||||
======================
|
||||
Geometry Visualization
|
||||
======================
|
||||
|
||||
.. currentmodule:: openmc
|
||||
|
||||
OpenMC is capable of producing two-dimensional slice plots of a geometry as well
|
||||
as three-dimensional voxel plots using the geometry plotting :ref:`run mode
|
||||
<usersguide_run_modes>`. The geometry plotting mode relies on the presence of a
|
||||
:ref:`plots.xml <io_plots>` file that indicates what plots should be created. To
|
||||
create this file, one needs to create one or more :class:`openmc.Plot`
|
||||
instances, add them to a :class:`openmc.Plots` collection, and then use the
|
||||
:class:`Plots.export_to_xml` method to write the ``plots.xml`` file.
|
||||
|
||||
-----------
|
||||
Slice Plots
|
||||
-----------
|
||||
|
||||
.. image:: ../_images/atr.png
|
||||
:width: 300px
|
||||
|
||||
By default, when an instance of :class:`openmc.Plot` is created, it indicates
|
||||
that a 2D slice plot should be made. You can specify the origin of the plot
|
||||
(:attr:`Plot.origin`), the width of the plot in each direction
|
||||
(:attr:`Plot.width`), the number of pixels to use in each direction
|
||||
(:attr:`Plot.pixels`), and the basis directions for the plot. For example, to
|
||||
create a :math:`x` - :math:`z` plot centered at (5.0, 2.0, 3.0) with a width of
|
||||
(50., 50.) and 400x400 pixels::
|
||||
|
||||
plot = openmc.Plot()
|
||||
plot.basis = 'xz'
|
||||
plot.origin = (5.0, 2.0, 3.0)
|
||||
plot.width = (50., 50.)
|
||||
plot.pixels = (400, 400)
|
||||
|
||||
The color of each pixel is determined by placing a particle at the center of
|
||||
that pixel and using OpenMC's internal ``find_cell`` routine (the same one used
|
||||
for particle tracking during simulation) to determine the cell and material at
|
||||
that location.
|
||||
|
||||
.. note:: In this example, pixels are 50/400=0.125 cm wide. Thus, this plot may
|
||||
miss any features smaller than 0.125 cm, since they could exist
|
||||
between pixel centers. More pixels can be used to resolve finer
|
||||
features but will result in larger files.
|
||||
|
||||
By default, a unique color will be assigned to each cell in the geometry. If you
|
||||
want your plot to be colored by material instead, change the
|
||||
:attr:`Plot.color_by` attribute::
|
||||
|
||||
plot.color_by = 'material'
|
||||
|
||||
If you don't like the random colors assigned, you can also indicate that
|
||||
particular cells/materials should be given colors of your choosing::
|
||||
|
||||
plot.colors = {
|
||||
water: 'blue',
|
||||
clad: 'black'
|
||||
}
|
||||
|
||||
# This is equivalent
|
||||
plot.colors = {
|
||||
water: (0, 0, 255),
|
||||
clad: (0, 0, 0)
|
||||
}
|
||||
|
||||
Note that colors can be given as RGB tuples or by a string indicating a valid
|
||||
`SVG color <https://www.w3.org/TR/SVG/types.html#ColorKeywords>`_.
|
||||
|
||||
When you're done creating your :class:`openmc.Plot` instances, you need to then
|
||||
assign them to a :class:`openmc.Plots` collection and export it to XML::
|
||||
|
||||
plots = openmc.Plots([plot1, plot2, plot3])
|
||||
plots.export_to_xml()
|
||||
|
||||
# This is equivalent
|
||||
plots = openmc.Plots()
|
||||
plots.append(plot1)
|
||||
plots += [plot2, plot3]
|
||||
plots.export_to_xml()
|
||||
|
||||
To actually generate the plots, run the :func:`openmc.plot_geometry`
|
||||
function. Alternatively, run the :ref:`scripts_openmc` executable with the
|
||||
``--plot`` command-line flag. When that has finished, you will have one or more
|
||||
``.ppm`` files, i.e., `portable pixmap
|
||||
<http://netpbm.sourceforge.net/doc/ppm.html>`_ files. On some Linux
|
||||
distributions, these ``.ppm`` files are natively viewable. If you find that
|
||||
you're unable to open them on your system (or you don't like the fact that they
|
||||
are not compressed), you may want to consider converting them to another format.
|
||||
This is easily accomplished with the ``convert`` command available on most Linux
|
||||
distributions as part of the `ImageMagick
|
||||
<http://www.imagemagick.org/script/convert.php>`_ package. (On Debian
|
||||
derivatives: ``sudo apt install imagemagick``). Images are then converted like:
|
||||
|
||||
.. code-block:: sh
|
||||
|
||||
convert myplot.ppm myplot.png
|
||||
|
||||
Alternatively, if you're working within a `Jupyter <http://jupyter.org/>`_
|
||||
Notebook or QtConsole, you can use the :func:`openmc.plot_inline` to run OpenMC
|
||||
in plotting mode and display the resulting plot within the notebook.
|
||||
|
||||
.. _usersguide_voxel:
|
||||
|
||||
-----------
|
||||
Voxel Plots
|
||||
-----------
|
||||
|
||||
.. image:: ../_images/3dba.png
|
||||
:width: 200px
|
||||
|
||||
The :class:`openmc.Plot` class can also be told to generate a 3D voxel plot
|
||||
instead of a 2D slice plot. Simply change the :attr:`Plot.type` attribute to
|
||||
'voxel'. In this case, the :attr:`Plot.width` and :attr:`Plot.pixels` attributes
|
||||
should be three items long, e.g.::
|
||||
|
||||
vox_plot = openmc.Plot()
|
||||
vox_plot.type = 'voxel'
|
||||
vox_plot.width = (100., 100., 50.)
|
||||
vox_plot.pixels = (400, 400, 200)
|
||||
|
||||
The voxel plot data is written to an :ref:`HDF5 file <io_voxel>`. The voxel file
|
||||
can subsequently be converted into a standard mesh format that can be viewed in
|
||||
`ParaView <http://www.paraview.org/>`_, `VisIt
|
||||
<https://wci.llnl.gov/simulation/computer-codes/visit>`_, etc. This typically
|
||||
will compress the size of the file significantly. The provided
|
||||
:ref:`scripts_voxel` script can convert the HDF5 voxel file to VTK or SILO
|
||||
formats. Once processed into a standard 3D file format, colors and masks can be
|
||||
defined using the stored ID numbers to better explore the geometry. The process
|
||||
for doing this will depend on the 3D viewer, but should be straightforward.
|
||||
|
||||
.. note:: 3D voxel plotting can be very computer intensive for the viewing
|
||||
program (Visit, ParaView, etc.) if the number of voxels is large (>10
|
||||
million or so). Thus if you want an accurate picture that renders
|
||||
smoothly, consider using only one voxel in a certain direction.
|
||||
|
|
@ -4,185 +4,18 @@
|
|||
Data Processing and Visualization
|
||||
=================================
|
||||
|
||||
This section is intended to explain in detail the recommended procedures for
|
||||
carrying out common post-processing tasks with OpenMC. While several utilities
|
||||
of varying complexity are provided to help automate the process, the most
|
||||
powerful capabilities for post-processing derive from use of the :ref:`Python
|
||||
API <pythonapi>`. Both the provided scripts and the Python API rely on a number
|
||||
third-party Python packages, including:
|
||||
.. currentmodule:: openmc
|
||||
|
||||
* [1]_ `NumPy <http://www.numpy.org/>`_
|
||||
* [2]_ `h5py <http://www.h5py.org>`_
|
||||
* [3]_ `pandas <http://pandas.pydata.org>`_
|
||||
* [4]_ `matplotlib <http://matplotlib.org/>`_
|
||||
* [4]_ `Silomesh <https://github.com/nhorelik/silomesh>`_
|
||||
* [4]_ `VTK <http://www.vtk.org/>`_
|
||||
* [4]_ `lxml <http://lxml.de>`_
|
||||
This section is intended to explain procedures for carrying out common
|
||||
post-processing tasks with OpenMC. While several utilities of varying complexity
|
||||
are provided to help automate the process, the most powerful capabilities for
|
||||
post-processing derive from use of the :ref:`Python API <pythonapi>`.
|
||||
|
||||
Most of these are can easily be installed with `pip <https://pip.pypa.io>`_
|
||||
or alternatively obtaining through a package manager.
|
||||
.. _usersguide_statepoint:
|
||||
|
||||
.. [1] Required for most post-processing tasks
|
||||
.. [2] Required for reading HDF5 output files
|
||||
.. [3] Optional dependency for advanced features in Python API
|
||||
.. [4] Not used directly by the Python API, but are optional dependencies for a
|
||||
number of scripts.
|
||||
|
||||
----------------------
|
||||
Geometry Visualization
|
||||
----------------------
|
||||
|
||||
Geometry plotting is carried out by creating a plots.xml, specifying plots, and
|
||||
running OpenMC with the --plot or -p command-line option (See
|
||||
:ref:`usersguide_plotting`).
|
||||
|
||||
Plotting in 2D
|
||||
--------------
|
||||
|
||||
.. image:: ../_images/atr.png
|
||||
:height: 200px
|
||||
|
||||
See below for a simple example of a plots xml file that demonstrates the
|
||||
capabilities of 2D slice plots. Here we assume that there is a ``geometry.xml``
|
||||
file containing 7 cells.
|
||||
|
||||
.. code-block:: xml
|
||||
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<plots>
|
||||
|
||||
<plot id="1" type="slice" color="cell" basis="xy">
|
||||
<filename> myplot </filename>
|
||||
<origin> 0 0 </origin>
|
||||
<width> 10 10 </width>
|
||||
<pixels> 2000 2000 </pixels>
|
||||
<background> 0 0 0 </background>
|
||||
<col_spec id="1" rgb="198 226 255"/>
|
||||
<col_spec id="2" rgb="255 218 185"/>
|
||||
<col_spec id="3" rgb="255 255 255"/>
|
||||
<col_spec id="4" rgb="101 101 101"/>
|
||||
<col_spec id="7" rgb="123 123 231"/>
|
||||
<mask background="255 255 255">
|
||||
<components> 1 3 4 5 6 </components>
|
||||
</mask>
|
||||
</plot>
|
||||
|
||||
</plots>
|
||||
|
||||
|
||||
In this example, OpenMC will produce a plot named ``myplot.ppm`` when run in
|
||||
plotting mode. The picture will be on the xy-plane, depicting the rectangle
|
||||
between points (-5,-5) and (5,5) with 2000 pixels along each dimension. The
|
||||
color of each pixel is determined by placing a particle at the center of that
|
||||
pixel and using OpenMC's internal ``find_cell`` routine (the same one used for
|
||||
particle tracking during simulation) to determine the cell and material at that
|
||||
location. In this example, pixels are 10/2000=0.005 cm wide, so points will be
|
||||
at (-4.9975,-4.9975), (-4.9950,-4.9975), (-4.9925,-4.9975), etc. This is pointed
|
||||
out to demonstrate that this plot may miss any features smaller than 0.005 cm,
|
||||
since they could exist between pixel centers. More pixels can be used to resolve
|
||||
finer features, but could result in larger files.
|
||||
|
||||
The ``background``, ``col_spec``, and ``mask`` elements define how to set pixel
|
||||
colors based on the cell ids at each pixel center. In this example, RGB colors
|
||||
are specified for cells 1,2,3,4, and 7, a random color will be assigned to cells
|
||||
5 and 6, and a black background color (``rgb="0 0 0"``) will be applied to
|
||||
locations where no cell is defined. However, the ``mask`` element here says that
|
||||
only cells 1,3,4,5, and 6 should be displayed, with other cells taking a white
|
||||
color (``rgb="255 255 255"``), which overrides the ``col_spec`` for cell 2 and
|
||||
the random color assigned to cell 7.
|
||||
|
||||
After running OpenMC to obtain PPM files, images should be saved to another
|
||||
format before using them elsewhere. This cuts down the size of the file by
|
||||
orders of magnitude. Most image viewers and editors that can view PPM images
|
||||
can also save to other formats (e.g. `Gimp <http://www.gimp.org/>`_, `IrfanView
|
||||
<http://www.irfanview.com/>`_, etc.). However, more likely the user will want to
|
||||
convert to another format on the command line. This is easily accomplished with
|
||||
the ``convert`` command available on most Linux distributions as part of the
|
||||
`ImageMagick <http://www.imagemagick.org/script/convert.php>`_ package. (On
|
||||
Ubuntu: ``sudo apt-get install imagemagick``). Images are then converted like:
|
||||
|
||||
.. code-block:: sh
|
||||
|
||||
convert myplot.ppm myplot.png
|
||||
|
||||
Plotting in 3D
|
||||
--------------
|
||||
|
||||
.. image:: ../_images/3dgeomplot.png
|
||||
:height: 200px
|
||||
|
||||
See below for a simple example of a plots xml file that demonstrates the
|
||||
capabilities of 3D voxel plots.
|
||||
|
||||
.. code-block:: xml
|
||||
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<plots>
|
||||
|
||||
<plot id="1" type="voxel" color="mat">
|
||||
<filename> myplot </filename>
|
||||
<origin> 0 0 0 </origin>
|
||||
<width> 10 10 10 </width>
|
||||
<pixels> 500 500 500 </pixels>
|
||||
</plot>
|
||||
|
||||
</plots>
|
||||
|
||||
Voxel plots are built the same way 2D slice plots are, by determining the cell
|
||||
or material id of a particle at the center of each voxel. In this example, the
|
||||
space covered is the cube between the points (-5,-5,-5) and (5,5,5), with voxel
|
||||
centers 10/500 = 0.02 cm apart. The HDF5 voxel files that are produced do not
|
||||
specify any color - instead containing only material or cell ids (material id
|
||||
in this example) - and thus the ``background``, ``col_spec``, and ``mask``
|
||||
elements are not used. If no cell is found at a voxel center, an id of -1 is
|
||||
stored.
|
||||
|
||||
The voxel plot data is written to an HDF5 file. The voxel file can subsequently
|
||||
be converted into a standard mesh format that can be viewed in ParaView, Visit,
|
||||
etc. This typically will compress the size of the file significantly. The
|
||||
provided utility openmc-voxel-to-silovtk accomplishes this for SILO:
|
||||
|
||||
.. code-block:: sh
|
||||
|
||||
openmc-voxel-to-silovtk myplot.voxel -o output.silo
|
||||
|
||||
and VTK file formats:
|
||||
|
||||
.. code-block:: sh
|
||||
|
||||
openmc-voxel-to-silovtk myplot.voxel --vtk -o output.vti
|
||||
|
||||
To use this utility you need either
|
||||
|
||||
* `Silomesh <https://github.com/nhorelik/silomesh>`_
|
||||
|
||||
or
|
||||
|
||||
* `VTK <http://www.vtk.org/>`_ with python bindings. On debian derivatives,
|
||||
these are easily obtained with ``sudo apt-get install python-vtk``
|
||||
|
||||
For the HDF5 file structure, see :ref:`io_voxel`.
|
||||
|
||||
Once processed into a standard 3D file format, colors and masks can be defined
|
||||
using the stored id numbers to better explore the geometry. The process for
|
||||
doing this will depend on the 3D viewer, but should be straightforward.
|
||||
|
||||
.. image:: ../_images/3dba.png
|
||||
:height: 200px
|
||||
|
||||
.. note:: 3D voxel plotting can be very computer intensive for the viewing
|
||||
program (Visit, ParaView, etc.) if the number of voxels is large (>10
|
||||
million or so). Thus if you want an accurate picture that renders
|
||||
smoothly, consider using only one voxel in a certain direction. For
|
||||
instance, the 3D pin lattice figure at the beginning of this section
|
||||
was generated with a 500x500x1 voxel mesh, which allows for resolution
|
||||
of the cylinders without wasting too many voxels on the axial
|
||||
dimension.
|
||||
|
||||
|
||||
-------------------
|
||||
Tally Visualization
|
||||
-------------------
|
||||
-------------------------
|
||||
Working with State Points
|
||||
-------------------------
|
||||
|
||||
Tally results are saved in both a text file (tallies.out) as well as an HDF5
|
||||
statepoint file. While the tallies.out file may be fine for simple tallies, in
|
||||
|
|
@ -208,109 +41,12 @@ Plotting in 2D
|
|||
--------------
|
||||
|
||||
The :ref:`IPython notebook example <notebook_post_processing>` also demonstrates
|
||||
how to plot a mesh tally in two dimensions using the Python API. Note, however,
|
||||
that there is also a script distributed with OpenMC, ``openmc-plot-mesh-tally``,
|
||||
that provides an interactive GUI to explore and plot mesh tallies for any scores
|
||||
and filter bins.
|
||||
how to plot a mesh tally in two dimensions using the Python API. One can also
|
||||
use the :ref:`scripts_plot` script which provides an interactive GUI to explore
|
||||
and plot mesh tallies for any scores and filter bins.
|
||||
|
||||
.. image:: ../_images/plotmeshtally.png
|
||||
:height: 200px
|
||||
|
||||
Plotting in 3D
|
||||
--------------
|
||||
|
||||
.. image:: ../_images/3dcore.png
|
||||
:height: 200px
|
||||
|
||||
As with 3D plots of the geometry, meshtally data needs to be put into a standard
|
||||
format for viewing. The utility ``openmc-statepoint-3d`` is provided to
|
||||
accomplish this for both VTK and SILO. By default ``openmc-statepoint-3d``
|
||||
processes a statepoint into a 3D file with all mesh tallies and filter/score
|
||||
combinations,
|
||||
|
||||
.. code-block:: sh
|
||||
|
||||
openmc-statepoint-3d <statepoint_file> -o output.silo
|
||||
openmc-statepoint-3d <statepoint_file> --vtk -o output.vtm
|
||||
|
||||
but it also provides several command-line options to selectively process only
|
||||
certain data arrays in order to keep file sizes down.
|
||||
|
||||
.. code-block:: sh
|
||||
|
||||
openmc-statepoint-3d <statepoint_file> --tallies 2,4 --scores 4.1,4.3 -o output.silo
|
||||
openmc-statepoint-3d <statepoint_file> --filters 2.energyin.1 --vtk -o output.vtm
|
||||
|
||||
All available options for specifying a subset of tallies, scores, and filters
|
||||
can be listed with the ``--list`` or ``-l`` command line options.
|
||||
|
||||
.. note:: Note that while SILO files can contain multiple meshes in one file,
|
||||
VTK needs to use a multi-block dataset, which stores each mesh piece
|
||||
in a different file in a subfolder. All meshes can be loaded at once
|
||||
with the main VTM file, or each VTI file in the subfolder can be
|
||||
loaded individually.
|
||||
|
||||
Alternatively, the user can write their own Python script to manipulate the data
|
||||
appropriately before insertion into a SILO or VTK file. For instance, if the
|
||||
data has been extracted as was done in the 2D plotting example script above, a
|
||||
SILO file can be created with:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
import silomesh as sm
|
||||
sm.init_silo("fluxtally.silo")
|
||||
sm.init_mesh('tally_mesh', *mesh.dimension, *mesh.lower_left, *mesh.upper_right)
|
||||
sm.init_var('flux_tally_thermal')
|
||||
for x in range(1,nx+1):
|
||||
for y in range(1,ny+1):
|
||||
for z in range(1,nz+1):
|
||||
sm.set_value(float(thermal[(x,y,z)]),x,y,z)
|
||||
sm.finalize_var()
|
||||
sm.init_var('flux_tally_fast')
|
||||
for x in range(1,nx+1):
|
||||
for y in range(1,ny+1):
|
||||
for z in range(1,nz+1):
|
||||
sm.set_value(float(fast[(x,y,z)]),x,y,z)
|
||||
sm.finalize_var()
|
||||
sm.finalize_mesh()
|
||||
sm.finalize_silo()
|
||||
|
||||
and the equivalent VTK file with:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
import vtk
|
||||
|
||||
grid = vtk.vtkImageData()
|
||||
grid.SetDimensions(nx+1,ny+1,nz+1)
|
||||
grid.SetOrigin(*mesh.lower_left)
|
||||
grid.SetSpacing(*mesh.width)
|
||||
|
||||
# vtk cell arrays have x on the inners, so we need to reorder the data
|
||||
idata = {}
|
||||
for x in range(nx):
|
||||
for y in range(ny):
|
||||
for z in range(nz):
|
||||
i = z*nx*ny + y*nx + x
|
||||
idata[i] = (x,y,z)
|
||||
|
||||
vtkfastdata = vtk.vtkDoubleArray()
|
||||
vtkfastdata.SetName("fast")
|
||||
for i in range(nx*ny*nz):
|
||||
vtkfastdata.InsertNextValue(fast[idata[i]])
|
||||
|
||||
vtkthermaldata = vtk.vtkDoubleArray()
|
||||
vtkthermaldata.SetName("thermal")
|
||||
for i in range(nx*ny*nz):
|
||||
vtkthermaldata.InsertNextValue(thermal[idata[i]])
|
||||
|
||||
grid.GetCellData().AddArray(vtkfastdata)
|
||||
grid.GetCellData().AddArray(vtkthermaldata)
|
||||
|
||||
writer = vtk.vtkXMLImageDataWriter()
|
||||
writer.SetInput(grid)
|
||||
writer.SetFileName('tally.vti')
|
||||
writer.Write()
|
||||
:width: 400px
|
||||
|
||||
Getting Data into MATLAB
|
||||
------------------------
|
||||
|
|
@ -322,44 +58,40 @@ the process is straightforward. First extract the data using the Python API via
|
|||
file. Note that all arrays that are accessible in a statepoint are already in
|
||||
NumPy arrays that can be reshaped and dumped to MATLAB in one step.
|
||||
|
||||
.. _usersguide_track:
|
||||
|
||||
----------------------------
|
||||
Particle Track Visualization
|
||||
----------------------------
|
||||
|
||||
.. image:: ../_images/Tracks.png
|
||||
:height: 200px
|
||||
:width: 400px
|
||||
|
||||
OpenMC can dump particle tracks—the position of particles as they are
|
||||
transported through the geometry. There are two ways to make OpenMC output
|
||||
transported through the geometry. There are two ways to make OpenMC output
|
||||
tracks: all particle tracks through a command line argument or specific particle
|
||||
tracks through settings.xml.
|
||||
|
||||
Running OpenMC with the argument "-t", "-track", or "--track" will cause a track
|
||||
file to be created for every particle transported in the code.
|
||||
Running :ref:`scripts_openmc` with the argument ``-t`` or ``--track`` will cause
|
||||
a track file to be created for every particle transported in the code. Be
|
||||
careful as this will produce as many files as there are source particles in your
|
||||
simulation. To identify a specific particle for which a track should be created,
|
||||
set the :attr:`Settings.track` attribute to a tuple containing the batch,
|
||||
generation, and particle number of the desired particle. For example, to create
|
||||
a track file for particle 4 of batch 1 and generation 2::
|
||||
|
||||
The settings.xml file can dictate that specific particle tracks are output.
|
||||
These particles are specified within a ''track'' element. The ''track'' element
|
||||
should contain triplets of integers specifying the batch, generation, and
|
||||
particle numbers, respectively. For example, to output the tracks for particles
|
||||
3 and 4 of batch 1 and generation 2 the settings.xml file should contain:
|
||||
settings = openmc.Settings()
|
||||
settings.track = (1, 2, 4)
|
||||
|
||||
.. code-block:: xml
|
||||
To specify multiple particles, the length of the iterable should be a multiple
|
||||
of three, e.g., if we wanted particles 3 and 4 from batch 1 and generation 2::
|
||||
|
||||
<track>
|
||||
1 2 3
|
||||
1 2 4
|
||||
</track>
|
||||
settings.track = (1, 2, 3, 1, 2, 4)
|
||||
|
||||
After running OpenMC, the directory should contain a file of the form
|
||||
After running OpenMC, the working directory will contain a file of the form
|
||||
"track_(batch #)_(generation #)_(particle #).h5" for each particle tracked.
|
||||
These track files can be converted into VTK poly data files with the
|
||||
``openmc-track-to-vtk`` utility. The usage of ``openmc-track-to-vtk`` is of the
|
||||
form "openmc-track-to-vtk [-o OUT] IN" where OUT is the optional output filename
|
||||
and IN is one or more filenames describing track files. The default output name
|
||||
is "track.pvtp". A common usage of track.py is "openmc-track-to-vtk track*.h5"
|
||||
which will use the data from all binary track files in the directory to write a
|
||||
"track.pvtp" VTK output file. The .pvtp file can then be read and plotted by 3d
|
||||
visualization programs such as ParaView.
|
||||
:ref:`scripts_track` script.
|
||||
|
||||
----------------------
|
||||
Source Site Processing
|
||||
|
|
|
|||
283
docs/source/usersguide/scripts.rst
Normal file
283
docs/source/usersguide/scripts.rst
Normal file
|
|
@ -0,0 +1,283 @@
|
|||
.. _usersguide_scripts:
|
||||
|
||||
=======================
|
||||
Executables and Scripts
|
||||
=======================
|
||||
|
||||
.. _scripts_openmc:
|
||||
|
||||
----------
|
||||
``openmc``
|
||||
----------
|
||||
|
||||
Once you have a model built (see :ref:`usersguide_basics`), you can either run
|
||||
the openmc executable directly from the directory containing your XML input
|
||||
files, or you can specify as a command-line argument the directory containing
|
||||
the XML input files. For example, if your XML input files are in the directory
|
||||
``/home/username/somemodel/``, one way to run the simulation would be:
|
||||
|
||||
.. code-block:: sh
|
||||
|
||||
cd /home/username/somemodel
|
||||
openmc
|
||||
|
||||
Alternatively, you could run from any directory:
|
||||
|
||||
.. code-block:: sh
|
||||
|
||||
openmc /home/username/somemodel
|
||||
|
||||
Note that in the latter case, any output files will be placed in the present
|
||||
working directory which may be different from
|
||||
``/home/username/somemodel``. ``openmc`` accepts the following command line
|
||||
flags:
|
||||
|
||||
-c, --volume Run in stochastic volume calculation mode
|
||||
-g, --geometry-debug Run in geometry debugging mode, where cell overlaps are
|
||||
checked for after each move of a particle
|
||||
-n, --particles N Use *N* particles per generation or batch
|
||||
-p, --plot Run in plotting mode
|
||||
-r, --restart file Restart a previous run from a state point or a particle
|
||||
restart file
|
||||
-s, --threads N Run with *N* OpenMP threads
|
||||
-t, --track Write tracks for all particles
|
||||
-v, --version Show version information
|
||||
-h, --help Show help message
|
||||
|
||||
.. note:: If you're using the Python API, :func:`openmc.run` is equivalent to
|
||||
running ``openmc`` from the command line.
|
||||
|
||||
.. _scripts_ace:
|
||||
|
||||
----------------------
|
||||
``openmc-ace-to-hdf5``
|
||||
----------------------
|
||||
|
||||
This script can be used to create HDF5 nuclear data libraries used by OpenMC if
|
||||
you have existing ACE files. There are four different ways you can specify ACE
|
||||
libraries that are to be converted:
|
||||
|
||||
1. List each ACE library as a positional argument. This is very useful in
|
||||
conjunction with the usual shell utilities (``ls``, ``find``, etc.).
|
||||
2. Use the ``--xml`` option to specify a pre-v0.9 cross_sections.xml file.
|
||||
3. Use the ``--xsdir`` option to specify a MCNP xsdir file.
|
||||
4. Use the ``--xsdata`` option to specify a Serpent xsdata file.
|
||||
|
||||
The script does not use any extra information from cross_sections.xml/ xsdir/
|
||||
xsdata files to determine whether the nuclide is metastable. Instead, the
|
||||
``--metastable`` argument can be used to specify whether the ZAID naming convention
|
||||
follows the NNDC data convention (1000*Z + A + 300 + 100*m), or the MCNP data
|
||||
convention (essentially the same as NNDC, except that the first metastable state
|
||||
of Am242 is 95242 and the ground state is 95642).
|
||||
|
||||
The optional ``--fission_energy_release`` argument will accept an HDF5 file
|
||||
containing a library of fission energy release (ENDF MF=1 MT=458) data. A
|
||||
library built from ENDF/B-VII.1 data is released with OpenMC and can be found at
|
||||
openmc/data/fission_Q_data_endb71.h5. This data is necessary for
|
||||
'fission-q-prompt' and 'fission-q-recoverable' tallies, but is not needed
|
||||
otherwise.
|
||||
|
||||
-h, --help show help message and exit
|
||||
|
||||
-d DESTINATION, --destination DESTINATION
|
||||
Directory to create new library in
|
||||
|
||||
-m META, --metastable META
|
||||
How to interpret ZAIDs for metastable nuclides. META
|
||||
can be either 'nndc' or 'mcnp'. (default: nndc)
|
||||
|
||||
--xml XML Old-style cross_sections.xml that lists ACE libraries
|
||||
|
||||
--xsdir XSDIR MCNP xsdir file that lists ACE libraries
|
||||
|
||||
--xsdata XSDATA Serpent xsdata file that lists ACE libraries
|
||||
|
||||
--fission_energy_release FISSION_ENERGY_RELEASE
|
||||
HDF5 file containing fission energy release data
|
||||
|
||||
.. _scripts_mcnp70:
|
||||
|
||||
------------------------------
|
||||
``openmc-convert-mcnp70-data``
|
||||
------------------------------
|
||||
|
||||
This script converts ENDF/B-VII.0 ACE data from the MCNP5/6 distribution into an
|
||||
HDF5 library that can be used by OpenMC. This assumes that you have a directory
|
||||
containing files named endf70a, endf70b, ..., endf70k, and endf70sab. The path
|
||||
to the directory containing these files should be given as a positional
|
||||
argument. The following optional arguments are available:
|
||||
|
||||
-d DESTINATION, --destination DESTINATION
|
||||
Directory to create new library in (Default: mcnp_endfb70)
|
||||
|
||||
.. _scripts_mcnp71:
|
||||
|
||||
------------------------------
|
||||
``openmc-convert-mcnp71-data``
|
||||
------------------------------
|
||||
|
||||
This script converts ENDF/B-VII.1 ACE data from the MCNP6 distribution into an
|
||||
HDF5 library that can be used by OpenMC. This assumes that you have a directory
|
||||
containing subdirectories 'endf71x' and 'ENDF71SaB'. The path to the directory
|
||||
containing these subdirectories should be given as a positional argument. The
|
||||
following optional arguments are available:
|
||||
|
||||
-d DESTINATION, --destination DESTINATION
|
||||
Directory to create new library in (Default: mcnp_endfb71)
|
||||
|
||||
-f FER, --fission_energy_release FER
|
||||
HDF5 file containing fission energy release data
|
||||
|
||||
.. _scripts_jeff:
|
||||
|
||||
------------------------
|
||||
``openmc-get-jeff-data``
|
||||
------------------------
|
||||
|
||||
This script downloads `JEFF 3.2 ACE data
|
||||
<https://www.oecd-nea.org/dbforms/data/eva/evatapes/jeff_32/>`_ from OECD/NEA
|
||||
and converts it to a multi-temperature HDF5 library for use with OpenMC. It has
|
||||
the following optional arguments:
|
||||
|
||||
-b, --batch
|
||||
Suppress standard in
|
||||
|
||||
-d DESTINATION, --destination DESTINATION
|
||||
Directory to create new library in (default: jeff-3.2-hdf5)
|
||||
|
||||
.. warning:: This script will download approximately 9 GB of data. Extracting
|
||||
and processing the data may require as much as 40 GB of additional
|
||||
free disk space.
|
||||
|
||||
.. _scripts_multipole:
|
||||
|
||||
-----------------------------
|
||||
``openmc-get-multipole-data``
|
||||
-----------------------------
|
||||
|
||||
This script downloads and extracts windowed multipole data based on
|
||||
ENDF/B-VII.1. It has the following optional arguments:
|
||||
|
||||
-b, --batch Suppress standard in
|
||||
|
||||
.. _scripts_nndc:
|
||||
|
||||
------------------------
|
||||
``openmc-get-nndc-data``
|
||||
------------------------
|
||||
|
||||
This script downloads `ENDF/B-VII.1 ACE data
|
||||
<http://www.nndc.bnl.gov/endf/b7.1/acefiles.html>`_ from NNDC and converts it to
|
||||
an HDF5 library for use with OpenMC. This data is used for OpenMC's regression
|
||||
test suite. This script has the following optional arguments:
|
||||
|
||||
-b, --batch Suppress standard in
|
||||
|
||||
.. _scripts_plot:
|
||||
|
||||
--------------------------
|
||||
``openmc-plot-mesh-tally``
|
||||
--------------------------
|
||||
|
||||
``openmc-plot-mesh-tally`` provides a graphical user interface for plotting mesh
|
||||
tallies. The path to the statepoint file can be provided as an optional arugment
|
||||
(if omitted, a file dialog will be presented).
|
||||
|
||||
.. _scripts_track:
|
||||
|
||||
-----------------------
|
||||
``openmc-track-to-vtk``
|
||||
-----------------------
|
||||
|
||||
This script converts HDF5 :ref:`particle track files <usersguide_track>` to VTK
|
||||
poly data that can be viewed with ParaView or VisIt. The filenames of the
|
||||
particle track files should be given as posititional arguments. The output
|
||||
filename can also be changed with the ``-o`` flag:
|
||||
|
||||
-o OUT, --out OUT Output VTK poly filename
|
||||
|
||||
------------------------
|
||||
``openmc-update-inputs``
|
||||
------------------------
|
||||
|
||||
If you have existing XML files that worked in a previous version of OpenMC that
|
||||
no longer work with the current version, you can try to update these files using
|
||||
``openmc-update-inputs``. If any of the given files do not match the most
|
||||
up-to-date formatting, then they will be automatically rewritten. The old
|
||||
out-of-date files will not be deleted; they will be moved to a new file with
|
||||
'.original' appended to their name.
|
||||
|
||||
Formatting changes that will be made:
|
||||
|
||||
geometry.xml
|
||||
Lattices containing 'outside' attributes/tags will be replaced with lattices
|
||||
containing 'outer' attributes, and the appropriate cells/universes will be
|
||||
added. Any 'surfaces' attributes/elements on a cell will be renamed 'region'.
|
||||
|
||||
materials.xml
|
||||
Nuclide names will be changed from ACE aliases (e.g., Am-242m) to HDF5/GND
|
||||
names (e.g., Am242_m1). Thermal scattering table names will be changed from
|
||||
ACE aliases (e.g., HH2O) to HDF5/GND names (e.g., c_H_in_H2O).
|
||||
|
||||
----------------------
|
||||
``openmc-update-mgxs``
|
||||
----------------------
|
||||
|
||||
This script updates OpenMC's deprecated multi-group cross section XML files to
|
||||
the latest HDF5-based format.
|
||||
|
||||
-i IN, --input IN Input XML file
|
||||
-o OUT, --output OUT Output file in HDF5 format
|
||||
|
||||
.. _scripts_validate:
|
||||
|
||||
-----------------------
|
||||
``openmc-validate-xml``
|
||||
-----------------------
|
||||
|
||||
Input files can be checked before executing OpenMC using the
|
||||
``openmc-validate-xml`` script which is installed alongside the Python API. Two
|
||||
command line arguments can be set when running ``openmc-validate-xml``:
|
||||
|
||||
-i, --input-path Location of OpenMC input files.
|
||||
-r, --relaxng-path Location of OpenMC RelaxNG files
|
||||
|
||||
If the RelaxNG path is not set, the script will search for these files because
|
||||
it expects that the user is either running the script located in the install
|
||||
directory ``bin`` folder or in ``src/utils``. Once executed, it will match
|
||||
OpenMC XML files with their RelaxNG schema and check if they are valid. Below
|
||||
is a table of the messages that will be printed after each file is checked.
|
||||
|
||||
======================== ===================================
|
||||
Message Description
|
||||
======================== ===================================
|
||||
[XML ERROR] Cannot parse XML file.
|
||||
[NO RELAXNG FOUND] No RelaxNG file found for XML file.
|
||||
[NOT VALID] XML file does not match RelaxNG.
|
||||
[VALID] XML file matches RelaxNG.
|
||||
======================== ===================================
|
||||
|
||||
.. _scripts_voxel:
|
||||
|
||||
---------------------------
|
||||
``openmc-voxel-to-silovtk``
|
||||
---------------------------
|
||||
|
||||
When OpenMC generates :ref:`voxel plots <usersguide_voxel>`, they are in an
|
||||
:ref:`HDF5 format <io_voxel>` that is not terribly useful by itself. The
|
||||
``openmc-voxel-to-silovtk`` script converts a voxel HDF5 file to `VTK
|
||||
<http://www.vtk.org/>`_ or `SILO
|
||||
<https://wci.llnl.gov/simulation/computer-codes/silo>`_ file. For VTK, you need
|
||||
to have the VTK Python bindings installed. For SILO, you need to have `silomesh
|
||||
<https://github.com/nhorelik/silomesh>`_ installed. To convert a voxel file,
|
||||
simply provide the path to the file:
|
||||
|
||||
.. code-block:: sh
|
||||
|
||||
openmc-voxel-to-silovtk voxel_1.h5
|
||||
|
||||
The ``openmc-voxel-to-silovtk`` script also takes the following optional
|
||||
command-line arguments:
|
||||
|
||||
-o, --output Path to output VTK or SILO file
|
||||
-s, --silo Flag to convert to SILO instead of VTK
|
||||
226
docs/source/usersguide/settings.rst
Normal file
226
docs/source/usersguide/settings.rst
Normal file
|
|
@ -0,0 +1,226 @@
|
|||
.. _usersguide_settings:
|
||||
|
||||
==================
|
||||
Execution Settings
|
||||
==================
|
||||
|
||||
.. currentmodule:: openmc
|
||||
|
||||
Once you have created the materials and geometry for your simulation, the last
|
||||
step to have a complete model is to specify execution settings through the
|
||||
:class:`openmc.Settings` class. At a minimum, you need to specify a :ref:`source
|
||||
distribution <usersguide_source>` and :ref:`how many particles to run
|
||||
<usersguide_particles>`. Many other execution settings can be set using the
|
||||
:class:`openmc.Settings` object, but they are generally optional.
|
||||
|
||||
.. _usersguide_run_modes:
|
||||
|
||||
---------
|
||||
Run Modes
|
||||
---------
|
||||
|
||||
The :attr:`Settings.run_mode` attribute controls what run mode is used when
|
||||
:ref:`scripts_openmc` is executed. There are five different run modes that can
|
||||
be specified:
|
||||
|
||||
'eigenvalue'
|
||||
Runs a :math:`k` eigenvalue simulation. See :ref:`methods_eigenvalue` for a
|
||||
full description of eigenvalue calculations. In this mode, the
|
||||
:attr:`Settings.source` specifies a starting source that is only used for the
|
||||
first fission generation.
|
||||
|
||||
'fixed source'
|
||||
Runs a fixed-source calculation with a specified external source, specified in
|
||||
the :attr:`Settings.source` attribute.
|
||||
|
||||
'volume'
|
||||
Runs a stochastic volume calculation.
|
||||
|
||||
'plot'
|
||||
Generates slice or voxel plots (see :ref:`usersguide_plots`).
|
||||
|
||||
'particle_restart'
|
||||
Simulate a single source particle using a particle restart file.
|
||||
|
||||
|
||||
So, for example, to specify that OpenMC should be run in fixed source mode, you
|
||||
would need to instantiate a :class:`openmc.Settings` object and assign the
|
||||
:attr:`Settings.run_mode` attribute::
|
||||
|
||||
settings = openmc.Settings()
|
||||
settings.run_mode = 'fixed source'
|
||||
|
||||
If you don't specify a run mode, the default run mode is 'eigenvalue'.
|
||||
|
||||
.. _usersguide_particles:
|
||||
|
||||
-------------------
|
||||
Number of Particles
|
||||
-------------------
|
||||
|
||||
For a fixed source simulation, the total number of source particle histories
|
||||
simulated is broken up into a number of *batches*, each corresponding to a
|
||||
:ref:`realization <methods_tallies>` of the tally random variables. Thus, you
|
||||
need to specify both the number of batches (:attr:`Settings.batches`) as well as
|
||||
the number of particles per batch (:attr:`Settings.particles`).
|
||||
|
||||
For a :math:`k` eigenvalue simulation, particles are grouped into *fission
|
||||
generations*, as described in :ref:`methods_eigenvalue`. Successive fission
|
||||
generations can be combined into a batch for statistical purposes. By default, a
|
||||
batch will consist of only a single fission generation, but this can be changed
|
||||
with the :attr:`Settings.generations_per_batch` attribute. For problems with a
|
||||
high dominance ratio, using multiple generations per batch can help reduce
|
||||
underprediction of variance, thereby leading to more accurate confidence
|
||||
intervals. Tallies should not be scored to until the source distribution
|
||||
converges, as described in :ref:`method-successive-generations`, which may take
|
||||
many generations. To specify the number of batches that should be discarded
|
||||
before tallies begin to accumulate, use the :attr:`Settings.inactive` attribute.
|
||||
|
||||
The following example shows how one would simulate 10000 particles per
|
||||
generation, using 10 generations per batch, 150 total batches, and discarding 5
|
||||
batches. Thus, a total of 145 active batches (or 1450 generations) will be used
|
||||
for accumulating tallies.
|
||||
|
||||
::
|
||||
|
||||
settings.particles = 10000
|
||||
settings.generations_per_batch = 10
|
||||
settings.batches = 150
|
||||
settings.inactive = 5
|
||||
|
||||
.. _usersguide_source:
|
||||
|
||||
-----------------------------
|
||||
External Source Distributions
|
||||
-----------------------------
|
||||
|
||||
External source distributions can be specified through the
|
||||
:attr:`Settings.source` attribute. If you have a single external source, you can
|
||||
create an instance of :class:`openmc.Source` and use it to set the
|
||||
:attr:`Settings.source` attribute. If you have multiple external sources with
|
||||
varying source strengths, :attr:`Settings.source` should be set to a list of
|
||||
:class:`openmc.Source` objects.
|
||||
|
||||
The :class:`openmc.Source` class has three main attributes that one can set:
|
||||
:attr:`Source.space`, which defines the spatial distribution,
|
||||
:attr:`Source.angle`, which defines the angular distribution, and
|
||||
:attr:`Source.energy`, which defines the energy distribution.
|
||||
|
||||
The spatial distribution can be set equal to a sub-class of
|
||||
:class:`openmc.stats.Spatial`; common choices are :class:`openmc.stats.Point` or
|
||||
:class:`openmc.stats.Box`. To independently specify distributions in the
|
||||
:math:`x`, :math:`y`, and :math:`z` coordinates, you can use
|
||||
:class:`openmc.stats.CartesianIndependent`.
|
||||
|
||||
The angular distribution can be set equal to a sub-class of
|
||||
:class:`openmc.stats.UnitSphere` such as :class:`openmc.stats.Isotropic`,
|
||||
:class:`openmc.stats.Monodirectional`, or
|
||||
:class:`openmc.stats.PolarAzimuthal`. By default, if no angular distribution is
|
||||
specified, an isotropic angular distribution is used.
|
||||
|
||||
The energy distribution can be set equal to any univariate probability
|
||||
distribution. This could be a probability mass function
|
||||
(:class:`openmc.stats.Discrete`), a Watt fission spectrum
|
||||
(:class:`openmc.stats.Watt`), or a tabular distribution
|
||||
(:class:`openmc.stats.Tabular`). By default, if no energy distribution is
|
||||
specified, a Watt fission spectrum with :math:`a` = 0.988 MeV and :math:`b` =
|
||||
2.249 MeV :sup:`-1` is used.
|
||||
|
||||
As an example, to create an isotropic, 10 MeV monoenergetic source uniformly
|
||||
distributed over a cube centered at the origin with an edge length of 10 cm, one
|
||||
would run::
|
||||
|
||||
source = openmc.Source()
|
||||
source.space = openmc.stats.Box((-5, -5, -5), (5, 5, 5))
|
||||
source.angle = openmc.stats.Isotropic()
|
||||
source.energy = openmc.stats.Discrete([10.0e6], [1.0])
|
||||
settings.source = source
|
||||
|
||||
The :class:`openmc.Source` class also has a :attr:`Source.strength` attribute
|
||||
that indicates the relative strength of a source distribution if multiple are
|
||||
used. For example, to create two sources, one that should be sampled 70% of the
|
||||
time and another that should be sampled 30% of the time::
|
||||
|
||||
src1 = openmc.Source()
|
||||
src1.strength = 0.7
|
||||
...
|
||||
|
||||
src2 = openmc.Source()
|
||||
src2.strength = 0.3
|
||||
...
|
||||
|
||||
settings.source = [src1, src2]
|
||||
|
||||
For a full list of all classes related to statistical distributions, see
|
||||
:ref:`pythonapi_stats`.
|
||||
|
||||
|
||||
---------------
|
||||
Shannon Entropy
|
||||
---------------
|
||||
|
||||
To assess convergence of the source distribution, the scalar Shannon entropy
|
||||
metric is often used in Monte Carlo codes. OpenMC also allows you to calculate
|
||||
Shannon entropy at each generation over a specified mesh, created using the
|
||||
:class:`openmc.Mesh` class. After instantiating a :class:`Mesh`, you need to
|
||||
specify the lower-left coordinates of the mesh (:attr:`Mesh.lower_left`), the
|
||||
number of mesh cells in each direction (:attr:`Mesh.dimension`) and either the
|
||||
upper-right coordinates of the mesh (:attr:`Mesh.upper_right`) or the width of
|
||||
each mesh cell (:attr:`Mesh.width`). Once you have a mesh, simply assign it to
|
||||
the :attr:`Settings.entropy_mesh` attribute.
|
||||
|
||||
::
|
||||
|
||||
entropy_mesh = openmc.Mesh()
|
||||
entropy_mesh.lower_left = (-50, -50, -25)
|
||||
entropy_mesh.upper_right = (50, 50, 25)
|
||||
entropy_mesh.dimension = (8, 8, 8)
|
||||
|
||||
settings.entropy_mesh = entropy_mesh
|
||||
|
||||
If you're unsure of what bounds to use for the entropy mesh, you can try getting
|
||||
a bounding box for the entire geometry using the :attr:`Geometry.bounding_box`
|
||||
property::
|
||||
|
||||
geom = openmc.Geometry()
|
||||
...
|
||||
m = openmc.Mesh()
|
||||
m.lower_left, m.upper_right = geom.bounding_box
|
||||
m.dimension = (8, 8, 8)
|
||||
|
||||
settings.entropy_mesh = m
|
||||
|
||||
--------------------------
|
||||
Generation of Output Files
|
||||
--------------------------
|
||||
|
||||
A number of attributes of the :class:`openmc.Settings` class can be used to
|
||||
control what files are output and how often. First, there is the
|
||||
:attr:`Settings.output` attribute which takes a dictionary having keys
|
||||
'summary', 'tallies', and 'path'. The first two keys controls whether a
|
||||
``summary.h5`` and ``tallies.out`` file are written, respectively (see
|
||||
:ref:`result_files` for a description of those files). By default, output files
|
||||
are written to the current working directory; this can be changed by setting the
|
||||
'path' key. For example, if you want to disable the ``tallies.out`` file and
|
||||
write the ``summary.h5`` to a directory called 'results', you'd specify the
|
||||
:attr:`Settings.output` dictionary as::
|
||||
|
||||
settings.output = {
|
||||
'tallies': False,
|
||||
'path': 'results'
|
||||
}
|
||||
|
||||
Generation of statepoint and source files is handled separately through the
|
||||
:attr:`Settings.statepoint` and :attr:`Settings.sourcepoint` attributes. Both of
|
||||
those attributes expect dictionaries and have a 'batches' key which indicates at
|
||||
which batches statepoints and source files should be written. Note that by
|
||||
default, the source is written as part of the statepoint file; this behavior can
|
||||
be changed by the 'separate' and 'write' keys of the
|
||||
:attr:`Settings.sourcepoint` dictionary, the first of which indicates whether
|
||||
the source should be written to a separate file and the second of which
|
||||
indicates whether the source should be written at all.
|
||||
|
||||
As an example, to write a statepoint file every five batches::
|
||||
|
||||
settings.batches = n
|
||||
settings.statepoint = {'batches': range(5, n + 5, 5)}
|
||||
311
docs/source/usersguide/tallies.rst
Normal file
311
docs/source/usersguide/tallies.rst
Normal file
|
|
@ -0,0 +1,311 @@
|
|||
.. _usersguide_tallies:
|
||||
|
||||
==================
|
||||
Specifying Tallies
|
||||
==================
|
||||
|
||||
.. currentmodule:: openmc
|
||||
|
||||
In order to obtain estimates of physical quantities in your simulation, you need
|
||||
to create one or more tallies using the :class:`openmc.Tally` class. As
|
||||
explained in detail in the :ref:`theory manual <methods_tallies>`, tallies
|
||||
provide estimates of a scoring function times the flux integrated over some
|
||||
region of phase space, as in:
|
||||
|
||||
.. math::
|
||||
|
||||
X = \underbrace{\int d\mathbf{r} \int d\mathbf{\Omega} \int
|
||||
dE}_{\text{filters}} \underbrace{f(\mathbf{r}, \mathbf{\Omega},
|
||||
E)}_{\text{scores}} \psi (\mathbf{r}, \mathbf{\Omega}, E)
|
||||
|
||||
Thus, to specify a tally, we need to specify what regions of phase space should
|
||||
be included when deciding whether to score an event as well as what the scoring
|
||||
function (:math:`f` in the above equation) should be used. The regions of phase
|
||||
space are called *filters* and the scoring functions are simply called *scores*.
|
||||
|
||||
-------
|
||||
Filters
|
||||
-------
|
||||
|
||||
To specify the regions of phase space, one must create a
|
||||
:class:`openmc.Filter`. Since :class:`openmc.Filter` is an abstract class, you
|
||||
actually need to instantiate one of its sub-classes (for a full listing, see
|
||||
:ref:`pythonapi_tallies`). For example, to indicate that events that occur in a
|
||||
given cell should score to the tally, we would create a
|
||||
:class:`openmc.CellFilter`::
|
||||
|
||||
cell_filter = openmc.CellFilter([fuel.id, moderator.id, reflector.id])
|
||||
|
||||
Another commonly used filter is :class:`openmc.EnergyFilter`, which specifies
|
||||
multiple energy bins over which events should be scored. Thus, if we wanted to
|
||||
tally events where the incident particle has an energy in the ranges [0 eV, 4
|
||||
eV] and [4 eV, 1 MeV], we would do the following::
|
||||
|
||||
energy_filter = openmc.EnergyFilter([0.0, 4.0, 1.0e6])
|
||||
|
||||
Energies are specified in eV and need to be monotonically increasing.
|
||||
|
||||
.. caution:: An energy bin between zero and the lowest energy specified is not
|
||||
included by default as it is in MCNP.
|
||||
|
||||
Once you have created a filter, it should be assigned to a :class:`openmc.Tally`
|
||||
instance through the :attr:`Tally.filters` attribute::
|
||||
|
||||
tally.filters.append(cell_filter)
|
||||
tally.filters.append(energy_filter)
|
||||
|
||||
# This is equivalent
|
||||
tally.filters = [cell_filter, energy_filter]
|
||||
|
||||
.. note:: You are actually not required to assign any filters to a tally. If you
|
||||
create a tally with no filters, all events will score to the
|
||||
tally. This can be useful if you want to know, for example, a reaction
|
||||
rate over your entire model.
|
||||
|
||||
.. _usersguide_scores:
|
||||
|
||||
------
|
||||
Scores
|
||||
------
|
||||
|
||||
To specify the scoring functions, a list of strings needs to be given to the
|
||||
:attr:`Tally.scores` attribute. You can score the flux ('flux'), a reaction rate
|
||||
('total', 'fission', etc.), or even scattering moments (e.g., 'scatter-P3'). For
|
||||
example, to tally the elastic scattering rate and the fission neutron
|
||||
production, you'd assign::
|
||||
|
||||
tally.scores = ['elastic', 'nu-fission']
|
||||
|
||||
With no further specification, you will get the total elastic scattering rate
|
||||
and the total fission neutron production. If you want reaction rates for a
|
||||
particular nuclide or set of nuclides, you can set the :attr:`Tally.nuclides`
|
||||
attribute to a list of strings indicating which nuclides. The nuclide names
|
||||
should follow the same :ref:`naming convention <usersguide_naming>` as that used
|
||||
for material specification. If we wanted the reaction rates only for U235 and
|
||||
U238 (separately), we'd set::
|
||||
|
||||
tally.nuclides = ['U235', 'U238']
|
||||
|
||||
You can also list 'all' as a nuclide which will give you a separate reaction
|
||||
rate for every nuclide in the model.
|
||||
|
||||
The following tables show all valid scores:
|
||||
|
||||
.. table:: **Flux scores: units are particle-cm per source particle.**
|
||||
|
||||
+----------------------+---------------------------------------------------+
|
||||
|Score | Description |
|
||||
+======================+===================================================+
|
||||
|flux |Total flux. |
|
||||
+----------------------+---------------------------------------------------+
|
||||
|flux-YN |Spherical harmonic expansion of the direction of |
|
||||
| |motion :math:`\left(\Omega\right)` of the total |
|
||||
| |flux. This score will tally all of the harmonic |
|
||||
| |moments of order 0 to N. N must be between 0 and |
|
||||
| |10. |
|
||||
+----------------------+---------------------------------------------------+
|
||||
|
||||
.. table:: **Reaction scores: units are reactions per source particle.**
|
||||
|
||||
+----------------------+---------------------------------------------------+
|
||||
|Score | Description |
|
||||
+======================+===================================================+
|
||||
|absorption |Total absorption rate. This accounts for all |
|
||||
| |reactions which do not produce secondary neutrons |
|
||||
| |as well as fission. |
|
||||
+----------------------+---------------------------------------------------+
|
||||
|elastic |Elastic scattering reaction rate. |
|
||||
+----------------------+---------------------------------------------------+
|
||||
|fission |Total fission reaction rate. |
|
||||
+----------------------+---------------------------------------------------+
|
||||
|scatter |Total scattering rate. Can also be identified with |
|
||||
| |the "scatter-0" response type. |
|
||||
+----------------------+---------------------------------------------------+
|
||||
|scatter-N |Tally the N\ :sup:`th` \ scattering moment, where N|
|
||||
| |is the Legendre expansion order of the change in |
|
||||
| |particle angle :math:`\left(\mu\right)`. N must be |
|
||||
| |between 0 and 10. As an example, tallying the 2\ |
|
||||
| |:sup:`nd` \ scattering moment would be specified as|
|
||||
| |``<scores>scatter-2</scores>``. |
|
||||
+----------------------+---------------------------------------------------+
|
||||
|scatter-PN |Tally all of the scattering moments from order 0 to|
|
||||
| |N, where N is the Legendre expansion order of the |
|
||||
| |change in particle angle |
|
||||
| |:math:`\left(\mu\right)`. That is, "scatter-P1" is |
|
||||
| |equivalent to requesting tallies of "scatter-0" and|
|
||||
| |"scatter-1". Like for "scatter-N", N must be |
|
||||
| |between 0 and 10. As an example, tallying up to the|
|
||||
| |2\ :sup:`nd` \ scattering moment would be specified|
|
||||
| |as ``<scores> scatter-P2 </scores>``. |
|
||||
+----------------------+---------------------------------------------------+
|
||||
|scatter-YN |"scatter-YN" is similar to "scatter-PN" except an |
|
||||
| |additional expansion is performed for the incoming |
|
||||
| |particle direction :math:`\left(\Omega\right)` |
|
||||
| |using the real spherical harmonics. This is useful|
|
||||
| |for performing angular flux moment weighting of the|
|
||||
| |scattering moments. Like "scatter-PN", "scatter-YN"|
|
||||
| |will tally all of the moments from order 0 to N; N |
|
||||
| |again must be between 0 and 10. |
|
||||
+----------------------+---------------------------------------------------+
|
||||
|total |Total reaction rate. |
|
||||
+----------------------+---------------------------------------------------+
|
||||
|total-YN |The total reaction rate expanded via spherical |
|
||||
| |harmonics about the direction of motion of the |
|
||||
| |neutron, :math:`\Omega`. This score will tally all |
|
||||
| |of the harmonic moments of order 0 to N. N must be|
|
||||
| |between 0 and 10. |
|
||||
+----------------------+---------------------------------------------------+
|
||||
|(n,2nd) |(n,2nd) reaction rate. |
|
||||
+----------------------+---------------------------------------------------+
|
||||
|(n,2n) |(n,2n) reaction rate. |
|
||||
+----------------------+---------------------------------------------------+
|
||||
|(n,3n) |(n,3n) reaction rate. |
|
||||
+----------------------+---------------------------------------------------+
|
||||
|(n,na) |(n,n\ :math:`\alpha`\ ) reaction rate. |
|
||||
+----------------------+---------------------------------------------------+
|
||||
|(n,n3a) |(n,n3\ :math:`\alpha`\ ) reaction rate. |
|
||||
+----------------------+---------------------------------------------------+
|
||||
|(n,2na) |(n,2n\ :math:`\alpha`\ ) reaction rate. |
|
||||
+----------------------+---------------------------------------------------+
|
||||
|(n,3na) |(n,3n\ :math:`\alpha`\ ) reaction rate. |
|
||||
+----------------------+---------------------------------------------------+
|
||||
|(n,np) |(n,np) reaction rate. |
|
||||
+----------------------+---------------------------------------------------+
|
||||
|(n,n2a) |(n,n2\ :math:`\alpha`\ ) reaction rate. |
|
||||
+----------------------+---------------------------------------------------+
|
||||
|(n,2n2a) |(n,2n2\ :math:`\alpha`\ ) reaction rate. |
|
||||
+----------------------+---------------------------------------------------+
|
||||
|(n,nd) |(n,nd) reaction rate. |
|
||||
+----------------------+---------------------------------------------------+
|
||||
|(n,nt) |(n,nt) reaction rate. |
|
||||
+----------------------+---------------------------------------------------+
|
||||
|(n,nHe-3) |(n,n\ :sup:`3`\ He) reaction rate. |
|
||||
+----------------------+---------------------------------------------------+
|
||||
|(n,nd2a) |(n,nd2\ :math:`\alpha`\ ) reaction rate. |
|
||||
+----------------------+---------------------------------------------------+
|
||||
|(n,nt2a) |(n,nt2\ :math:`\alpha`\ ) reaction rate. |
|
||||
+----------------------+---------------------------------------------------+
|
||||
|(n,4n) |(n,4n) reaction rate. |
|
||||
+----------------------+---------------------------------------------------+
|
||||
|(n,2np) |(n,2np) reaction rate. |
|
||||
+----------------------+---------------------------------------------------+
|
||||
|(n,3np) |(n,3np) reaction rate. |
|
||||
+----------------------+---------------------------------------------------+
|
||||
|(n,n2p) |(n,n2p) reaction rate. |
|
||||
+----------------------+---------------------------------------------------+
|
||||
|(n,n*X*) |Level inelastic scattering reaction rate. The *X* |
|
||||
| |indicates what which inelastic level, e.g., (n,n3) |
|
||||
| |is third-level inelastic scattering. |
|
||||
+----------------------+---------------------------------------------------+
|
||||
|(n,nc) |Continuum level inelastic scattering reaction rate.|
|
||||
+----------------------+---------------------------------------------------+
|
||||
|(n,gamma) |Radiative capture reaction rate. |
|
||||
+----------------------+---------------------------------------------------+
|
||||
|(n,p) |(n,p) reaction rate. |
|
||||
+----------------------+---------------------------------------------------+
|
||||
|(n,d) |(n,d) reaction rate. |
|
||||
+----------------------+---------------------------------------------------+
|
||||
|(n,t) |(n,t) reaction rate. |
|
||||
+----------------------+---------------------------------------------------+
|
||||
|(n,3He) |(n,\ :sup:`3`\ He) reaction rate. |
|
||||
+----------------------+---------------------------------------------------+
|
||||
|(n,a) |(n,\ :math:`\alpha`\ ) reaction rate. |
|
||||
+----------------------+---------------------------------------------------+
|
||||
|(n,2a) |(n,2\ :math:`\alpha`\ ) reaction rate. |
|
||||
+----------------------+---------------------------------------------------+
|
||||
|(n,3a) |(n,3\ :math:`\alpha`\ ) reaction rate. |
|
||||
+----------------------+---------------------------------------------------+
|
||||
|(n,2p) |(n,2p) reaction rate. |
|
||||
+----------------------+---------------------------------------------------+
|
||||
|(n,pa) |(n,p\ :math:`\alpha`\ ) reaction rate. |
|
||||
+----------------------+---------------------------------------------------+
|
||||
|(n,t2a) |(n,t2\ :math:`\alpha`\ ) reaction rate. |
|
||||
+----------------------+---------------------------------------------------+
|
||||
|(n,d2a) |(n,d2\ :math:`\alpha`\ ) reaction rate. |
|
||||
+----------------------+---------------------------------------------------+
|
||||
|(n,pd) |(n,pd) reaction rate. |
|
||||
+----------------------+---------------------------------------------------+
|
||||
|(n,pt) |(n,pt) reaction rate. |
|
||||
+----------------------+---------------------------------------------------+
|
||||
|(n,da) |(n,d\ :math:`\alpha`\ ) reaction rate. |
|
||||
+----------------------+---------------------------------------------------+
|
||||
|*Arbitrary integer* |An arbitrary integer is interpreted to mean the |
|
||||
| |reaction rate for a reaction with a given ENDF MT |
|
||||
| |number. |
|
||||
+----------------------+---------------------------------------------------+
|
||||
|
||||
.. table:: **Particle production scores: units are particles produced per
|
||||
source particles.**
|
||||
|
||||
+----------------------+---------------------------------------------------+
|
||||
|Score | Description |
|
||||
+======================+===================================================+
|
||||
|delayed-nu-fission |Total production of delayed neutrons due to |
|
||||
| |fission. |
|
||||
+----------------------+---------------------------------------------------+
|
||||
|prompt-nu-fission |Total production of prompt neutrons due to |
|
||||
| |fission. |
|
||||
+----------------------+---------------------------------------------------+
|
||||
|nu-fission |Total production of neutrons due to fission. |
|
||||
+----------------------+---------------------------------------------------+
|
||||
|nu-scatter, |These scores are similar in functionality to their |
|
||||
|nu-scatter-N, |``scatter*`` equivalents except the total |
|
||||
|nu-scatter-PN, |production of neutrons due to scattering is scored |
|
||||
|nu-scatter-YN |vice simply the scattering rate. This accounts for |
|
||||
| |multiplicity from (n,2n), (n,3n), and (n,4n) |
|
||||
| |reactions. |
|
||||
+----------------------+---------------------------------------------------+
|
||||
|
||||
.. table:: **Miscellaneous scores: units are indicated for each.**
|
||||
|
||||
+----------------------+---------------------------------------------------+
|
||||
|Score | Description |
|
||||
+======================+===================================================+
|
||||
|current |Partial currents on the boundaries of each cell in |
|
||||
| |a mesh. Units are particles per source |
|
||||
| |particle. Note that this score can only be used if |
|
||||
| |a mesh filter has been specified. Furthermore, it |
|
||||
| |may not be used in conjunction with any other |
|
||||
| |score. |
|
||||
+----------------------+---------------------------------------------------+
|
||||
|events |Number of scoring events. Units are events per |
|
||||
| |source particle. |
|
||||
+----------------------+---------------------------------------------------+
|
||||
|inverse-velocity |The flux-weighted inverse velocity where the |
|
||||
| |velocity is in units of centimeters per second. |
|
||||
+----------------------+---------------------------------------------------+
|
||||
|kappa-fission |The recoverable energy production rate due to |
|
||||
| |fission. The recoverable energy is defined as the |
|
||||
| |fission product kinetic energy, prompt and delayed |
|
||||
| |neutron kinetic energies, prompt and delayed |
|
||||
| |:math:`\gamma`-ray total energies, and the total |
|
||||
| |energy released by the delayed :math:`\beta` |
|
||||
| |particles. The neutrino energy does not contribute |
|
||||
| |to this response. The prompt and delayed |
|
||||
| |:math:`\gamma`-rays are assumed to deposit their |
|
||||
| |energy locally. Units are eV per source particle. |
|
||||
+----------------------+---------------------------------------------------+
|
||||
|fission-q-prompt |The prompt fission energy production rate. This |
|
||||
| |energy comes in the form of fission fragment |
|
||||
| |nuclei, prompt neutrons, and prompt |
|
||||
| |:math:`\gamma`-rays. This value depends on the |
|
||||
| |incident energy and it requires that the nuclear |
|
||||
| |data library contains the optional fission energy |
|
||||
| |release data. Energy is assumed to be deposited |
|
||||
| |locally. Units are eV per source particle. |
|
||||
+----------------------+---------------------------------------------------+
|
||||
|fission-q-recoverable |The recoverable fission energy production rate. |
|
||||
| |This energy comes in the form of fission fragment |
|
||||
| |nuclei, prompt and delayed neutrons, prompt and |
|
||||
| |delayed :math:`\gamma`-rays, and delayed |
|
||||
| |:math:`\beta`-rays. This tally differs from the |
|
||||
| |kappa-fission tally in that it is dependent on |
|
||||
| |incident neutron energy and it requires that the |
|
||||
| |nuclear data library contains the optional fission |
|
||||
| |energy release data. Energy is assumed to be |
|
||||
| |deposited locally. Units are eV per source |
|
||||
| |paticle. |
|
||||
+----------------------+---------------------------------------------------+
|
||||
|decay-rate |The delayed-nu-fission-weighted decay rate where |
|
||||
| |the decay rate is in units of inverse seconds. |
|
||||
+----------------------+---------------------------------------------------+
|
||||
69
docs/source/usersguide/volume.rst
Normal file
69
docs/source/usersguide/volume.rst
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
.. _usersguide_volume:
|
||||
|
||||
==============================
|
||||
Stochastic Volume Calculations
|
||||
==============================
|
||||
|
||||
.. currentmodule:: openmc
|
||||
|
||||
OpenMC has a capability to stochastically determine volumes of cells, materials,
|
||||
and universes. The method works by overlaying a bounding box, sampling points
|
||||
from within the box, and seeing what fraction of points were found in a desired
|
||||
domain. The benefit of doing this stochastically (as opposed to equally-spaced
|
||||
points), is that it is possible to give reliable error estimates on each
|
||||
stochastic quantity.
|
||||
|
||||
To specify that a volume calculation be run, you first need to create an
|
||||
instance of :class:`openmc.VolumeCalculation`. The constructor takes a list of
|
||||
cells, materials, or universes; the number of samples to be used; and the
|
||||
lower-left and upper-right Cartesian coordinates of a bounding box that encloses
|
||||
the specified domains::
|
||||
|
||||
lower_left = (-0.62, -0.62, -50.)
|
||||
upper_right = (0.62, 0.62, 50.)
|
||||
vol_calc = openmc.VolumeCalculation([fuel, clad, moderator], 1000000,
|
||||
lower_left, upper_right)
|
||||
|
||||
For domains contained within regions that have simple definitions, OpenMC can
|
||||
sometimes automatically determine a bounding box. In this case, the last two
|
||||
arguments are not necessary. For example,
|
||||
|
||||
::
|
||||
|
||||
sphere = openmc.Sphere(R=10.0)
|
||||
cell = openm.Cell(region=-sphere)
|
||||
vol_calc = openmc.VolumeCalculation([cell], 1000000)
|
||||
|
||||
Of course, the volumes that you *need* this capability for are often the ones
|
||||
with complex definitions.
|
||||
|
||||
Once you have one or more :class:`openmc.VolumeCalculation` objects created, you
|
||||
can then assign then to :attr:`Settings.volume_calculations`::
|
||||
|
||||
settings = openmc.Settings()
|
||||
settings.volume_calculations = [cell_vol_calc, mat_vol_calc]
|
||||
|
||||
To execute the volume calculations, one can either set :attr:`Settings.run_mode`
|
||||
to 'volume' and run :func:`openmc.run`, or alternatively run
|
||||
:func:`openmc.calculate_volumes` which doesn't require that
|
||||
:attr:`Settings.run_mode` be set.
|
||||
|
||||
When your volume calculations have finished, you can load the results using the
|
||||
:meth:`VolumeCalculation.load_results` method on an existing object. If you
|
||||
don't have an existing :class:`VolumeCalculation` object, you can create one and
|
||||
load results simultaneously using the :meth:`VolumeCalculation.from_hdf5` class
|
||||
method::
|
||||
|
||||
vol_calc = openmc.VolumeCalculation(...)
|
||||
...
|
||||
openmc.calculate_volumes()
|
||||
vol_calc.load_results('volume_1.h5')
|
||||
|
||||
# ..or we can create a new object
|
||||
vol_calc = openmc.VolumeCalculation.from_hdf5('volume_1.h5')
|
||||
|
||||
After the results are loaded, volume estimates will be stored in
|
||||
:attr:`VolumeCalculation.volumes`. There is also a
|
||||
:attr:`VolumeCalculation.atoms_dataframe` attribute that shows stochastic
|
||||
estimates of the number of atoms of each type of nuclide within the specified
|
||||
domains along with their uncertainties.
|
||||
1110
examples/jupyter/candu.ipynb
Normal file
1110
examples/jupyter/candu.ipynb
Normal file
File diff suppressed because one or more lines are too long
1211
examples/jupyter/mdgxs-part-ii.ipynb
Normal file
1211
examples/jupyter/mdgxs-part-ii.ipynb
Normal file
File diff suppressed because one or more lines are too long
1375
examples/jupyter/nuclear-data.ipynb
Normal file
1375
examples/jupyter/nuclear-data.ipynb
Normal file
File diff suppressed because one or more lines are too long
2151
examples/jupyter/pandas-dataframes.ipynb
Normal file
2151
examples/jupyter/pandas-dataframes.ipynb
Normal file
File diff suppressed because one or more lines are too long
1668
examples/jupyter/pincell.ipynb
Normal file
1668
examples/jupyter/pincell.ipynb
Normal file
File diff suppressed because one or more lines are too long
|
|
@ -339,7 +339,7 @@
|
|||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAPoAAAD6AgMAAAD1grKuAAAABGdBTUEAALGPC/xhBQAAACBjSFJN\nAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAADFBMVEX///9yEhLpgJFNv8Tq\nQYT7AAAAAWJLR0QAiAUdSAAAAAd0SU1FB+AKHxE2I67FxwoAAALKSURBVGje7dpLcqQwDAbgHHE2\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/4vzcvgeY10sY0AAAAldEVYdGRhdGU6Y3JlYXRlADIwMTYtMTAtMzFUMTI6NTQ6\nMzUtMDU6MDAowpdyAAAAJXRFWHRkYXRlOm1vZGlmeQAyMDE2LTEwLTMxVDEyOjU0OjM1LTA1OjAw\nWZ8vzgAAAABJRU5ErkJggg==\n",
|
||||
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAPoAAAD6AgMAAAD1grKuAAAABGdBTUEAALGPC/xhBQAAACBjSFJN\nAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAADFBMVEX////pgJFyEhJNv8RV\nUZDeAAAAAWJLR0QAiAUdSAAAAAd0SU1FB+EEDRUZLksd2dYAAALKSURBVGje7dpLcqQwDAbgHHE2\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/4vzcvgeY10sY0AAAAldEVYdGRhdGU6Y3JlYXRlADIwMTctMDQtMTNUMTc6MjU6\nNDUtMDQ6MDCJ1tNgAAAAJXRFWHRkYXRlOm1vZGlmeQAyMDE3LTA0LTEzVDE3OjI1OjQ1LTA0OjAw\n+Itr3AAAAABJRU5ErkJggg==\n",
|
||||
"text/plain": [
|
||||
"<IPython.core.display.Image object>"
|
||||
]
|
||||
|
|
@ -391,14 +391,14 @@
|
|||
"\n",
|
||||
"# Instantiate flux Tally in moderator and fuel\n",
|
||||
"tally = openmc.Tally(name='flux')\n",
|
||||
"tally.filters = [openmc.CellFilter([fuel_cell.id, moderator_cell.id])]\n",
|
||||
"tally.filters = [openmc.CellFilter([fuel_cell, moderator_cell])]\n",
|
||||
"tally.filters.append(energy_filter)\n",
|
||||
"tally.scores = ['flux']\n",
|
||||
"tallies_file.append(tally)\n",
|
||||
"\n",
|
||||
"# Instantiate reaction rate Tally in fuel\n",
|
||||
"tally = openmc.Tally(name='fuel rxn rates')\n",
|
||||
"tally.filters = [openmc.CellFilter([fuel_cell.id])]\n",
|
||||
"tally.filters = [openmc.CellFilter(fuel_cell)]\n",
|
||||
"tally.filters.append(energy_filter)\n",
|
||||
"tally.scores = ['nu-fission', 'scatter']\n",
|
||||
"tally.nuclides = [u238, u235]\n",
|
||||
|
|
@ -406,7 +406,7 @@
|
|||
"\n",
|
||||
"# Instantiate reaction rate Tally in moderator\n",
|
||||
"tally = openmc.Tally(name='moderator rxn rates')\n",
|
||||
"tally.filters = [openmc.CellFilter([moderator_cell.id])]\n",
|
||||
"tally.filters = [openmc.CellFilter(moderator_cell)]\n",
|
||||
"tally.filters.append(energy_filter)\n",
|
||||
"tally.scores = ['absorption', 'total']\n",
|
||||
"tally.nuclides = [o16, h1]\n",
|
||||
|
|
@ -480,7 +480,7 @@
|
|||
"fuel_therm_abs_rate = openmc.Tally(name='fuel therm. abs. rate')\n",
|
||||
"fuel_therm_abs_rate.scores = ['absorption']\n",
|
||||
"fuel_therm_abs_rate.filters = [openmc.EnergyFilter([0., 0.625]),\n",
|
||||
" openmc.CellFilter([fuel_cell.id])]\n",
|
||||
" openmc.CellFilter([fuel_cell])]\n",
|
||||
"tallies_file.append(fuel_therm_abs_rate)"
|
||||
]
|
||||
},
|
||||
|
|
@ -512,7 +512,7 @@
|
|||
"\n",
|
||||
"# Instantiate flux Tally in moderator and fuel\n",
|
||||
"tally = openmc.Tally(name='need-to-slice')\n",
|
||||
"tally.filters = [openmc.CellFilter(bins=[fuel_cell.id, moderator_cell.id])]\n",
|
||||
"tally.filters = [openmc.CellFilter([fuel_cell, moderator_cell])]\n",
|
||||
"tally.filters.append(fine_energy_filter)\n",
|
||||
"tally.scores = ['nu-fission', 'scatter']\n",
|
||||
"tally.nuclides = [h1, u238]\n",
|
||||
|
|
@ -576,35 +576,30 @@
|
|||
" %%%%%%%%%%%\n",
|
||||
"\n",
|
||||
" | The OpenMC Monte Carlo Code\n",
|
||||
" Copyright | 2011-2016 Massachusetts Institute of Technology\n",
|
||||
" Copyright | 2011-2017 Massachusetts Institute of Technology\n",
|
||||
" License | http://openmc.readthedocs.io/en/latest/license.html\n",
|
||||
" Version | 0.8.0\n",
|
||||
" Git SHA1 | da5563eddb5f2c2d6b2c9839d518de40962b78f2\n",
|
||||
" Date/Time | 2016-10-31 12:54:36\n",
|
||||
" OpenMP Threads | 4\n",
|
||||
"\n",
|
||||
" ===========================================================================\n",
|
||||
" ========================> INITIALIZATION <=========================\n",
|
||||
" ===========================================================================\n",
|
||||
" Git SHA1 | bc4683be1c853fe6d0e31bccad416ef219e3efaf\n",
|
||||
" Date/Time | 2017-04-13 17:26:05\n",
|
||||
" MPI Processes | 1\n",
|
||||
" OpenMP Threads | 1\n",
|
||||
"\n",
|
||||
" Reading settings XML file...\n",
|
||||
" Reading geometry XML file...\n",
|
||||
" Reading materials XML file...\n",
|
||||
" Reading cross sections XML file...\n",
|
||||
" Reading U235 from /home/romano/openmc/scripts/nndc_hdf5/U235.h5\n",
|
||||
" Reading U238 from /home/romano/openmc/scripts/nndc_hdf5/U238.h5\n",
|
||||
" Reading O16 from /home/romano/openmc/scripts/nndc_hdf5/O16.h5\n",
|
||||
" Reading H1 from /home/romano/openmc/scripts/nndc_hdf5/H1.h5\n",
|
||||
" Reading B10 from /home/romano/openmc/scripts/nndc_hdf5/B10.h5\n",
|
||||
" Reading Zr90 from /home/romano/openmc/scripts/nndc_hdf5/Zr90.h5\n",
|
||||
" Reading U235 from /home/smharper/openmc/data/nndc_hdf5/U235.h5\n",
|
||||
" Reading U238 from /home/smharper/openmc/data/nndc_hdf5/U238.h5\n",
|
||||
" Reading O16 from /home/smharper/openmc/data/nndc_hdf5/O16.h5\n",
|
||||
" Reading H1 from /home/smharper/openmc/data/nndc_hdf5/H1.h5\n",
|
||||
" Reading B10 from /home/smharper/openmc/data/nndc_hdf5/B10.h5\n",
|
||||
" Reading Zr90 from /home/smharper/openmc/data/nndc_hdf5/Zr90.h5\n",
|
||||
" Maximum neutron transport energy: 2.00000E+07 eV for U235\n",
|
||||
" Reading tallies XML file...\n",
|
||||
" Building neighboring cells lists for each surface...\n",
|
||||
" Initializing source particles...\n",
|
||||
"\n",
|
||||
" ===========================================================================\n",
|
||||
" ====================> K EIGENVALUE SIMULATION <====================\n",
|
||||
" ===========================================================================\n",
|
||||
"\n",
|
||||
" Bat./Gen. k Average k \n",
|
||||
" ========= ======== ==================== \n",
|
||||
|
|
@ -617,48 +612,43 @@
|
|||
" 7/1 0.99859 1.01409 +/- 0.01550\n",
|
||||
" 8/1 1.03441 1.02086 +/- 0.01123\n",
|
||||
" 9/1 1.06097 1.03089 +/- 0.01279\n",
|
||||
" 10/1 1.06094 1.03690 +/- 0.01159\n",
|
||||
" 11/1 1.04687 1.03856 +/- 0.00961\n",
|
||||
" 12/1 1.02982 1.03731 +/- 0.00821\n",
|
||||
" 13/1 1.03520 1.03705 +/- 0.00712\n",
|
||||
" 14/1 0.99508 1.03239 +/- 0.00782\n",
|
||||
" 15/1 1.03973 1.03312 +/- 0.00703\n",
|
||||
" 16/1 1.03807 1.03357 +/- 0.00638\n",
|
||||
" 17/1 1.03091 1.03335 +/- 0.00583\n",
|
||||
" 18/1 1.01421 1.03188 +/- 0.00556\n",
|
||||
" 19/1 0.99339 1.02913 +/- 0.00583\n",
|
||||
" 20/1 1.04827 1.03040 +/- 0.00558\n",
|
||||
" 10/1 1.06132 1.03698 +/- 0.01163\n",
|
||||
" 11/1 1.04687 1.03863 +/- 0.00964\n",
|
||||
" 12/1 1.02982 1.03737 +/- 0.00824\n",
|
||||
" 13/1 1.03520 1.03710 +/- 0.00714\n",
|
||||
" 14/1 0.99508 1.03243 +/- 0.00784\n",
|
||||
" 15/1 1.03987 1.03317 +/- 0.00705\n",
|
||||
" 16/1 1.02743 1.03265 +/- 0.00640\n",
|
||||
" 17/1 1.02975 1.03241 +/- 0.00585\n",
|
||||
" 18/1 0.99671 1.02966 +/- 0.00604\n",
|
||||
" 19/1 1.02040 1.02900 +/- 0.00563\n",
|
||||
" 20/1 1.02024 1.02842 +/- 0.00527\n",
|
||||
" Creating state point statepoint.20.h5...\n",
|
||||
"\n",
|
||||
" ===========================================================================\n",
|
||||
" ======================> SIMULATION FINISHED <======================\n",
|
||||
" ===========================================================================\n",
|
||||
"\n",
|
||||
"\n",
|
||||
" =======================> TIMING STATISTICS <=======================\n",
|
||||
"\n",
|
||||
" Total time for initialization = 5.0418E-01 seconds\n",
|
||||
" Reading cross sections = 3.6765E-01 seconds\n",
|
||||
" Total time in simulation = 8.8388E+00 seconds\n",
|
||||
" Time in transport only = 8.7431E+00 seconds\n",
|
||||
" Time in inactive batches = 1.4676E+00 seconds\n",
|
||||
" Time in active batches = 7.3713E+00 seconds\n",
|
||||
" Time synchronizing fission bank = 2.2671E-03 seconds\n",
|
||||
" Sampling source sites = 1.6677E-03 seconds\n",
|
||||
" SEND/RECV source sites = 5.5964E-04 seconds\n",
|
||||
" Time accumulating tallies = 9.0487E-05 seconds\n",
|
||||
" Total time for finalization = 2.7160E-03 seconds\n",
|
||||
" Total time elapsed = 9.3633E+00 seconds\n",
|
||||
" Calculation Rate (inactive) = 8517.40 neutrons/second\n",
|
||||
" Calculation Rate (active) = 5087.33 neutrons/second\n",
|
||||
" Total time for initialization = 2.2576E-01 seconds\n",
|
||||
" Reading cross sections = 1.8005E-01 seconds\n",
|
||||
" Total time in simulation = 9.6105E+00 seconds\n",
|
||||
" Time in transport only = 9.5952E+00 seconds\n",
|
||||
" Time in inactive batches = 1.4678E+00 seconds\n",
|
||||
" Time in active batches = 8.1427E+00 seconds\n",
|
||||
" Time synchronizing fission bank = 2.6325E-03 seconds\n",
|
||||
" Sampling source sites = 1.5038E-03 seconds\n",
|
||||
" SEND/RECV source sites = 8.8069E-04 seconds\n",
|
||||
" Time accumulating tallies = 2.0568E-04 seconds\n",
|
||||
" Total time for finalization = 1.5435E-03 seconds\n",
|
||||
" Total time elapsed = 9.8506E+00 seconds\n",
|
||||
" Calculation Rate (inactive) = 8516.30 neutrons/second\n",
|
||||
" Calculation Rate (active) = 4605.35 neutrons/second\n",
|
||||
"\n",
|
||||
" ============================> RESULTS <============================\n",
|
||||
"\n",
|
||||
" k-effective (Collision) = 1.02791 +/- 0.00553\n",
|
||||
" k-effective (Track-length) = 1.03040 +/- 0.00558\n",
|
||||
" k-effective (Absorption) = 1.02011 +/- 0.00491\n",
|
||||
" Combined k-effective = 1.02461 +/- 0.00398\n",
|
||||
" Leakage Fraction = 0.01677 +/- 0.00109\n",
|
||||
" k-effective (Collision) = 1.02889 +/- 0.00492\n",
|
||||
" k-effective (Track-length) = 1.02842 +/- 0.00527\n",
|
||||
" k-effective (Absorption) = 1.02637 +/- 0.00349\n",
|
||||
" Combined k-effective = 1.02700 +/- 0.00291\n",
|
||||
" Leakage Fraction = 0.01717 +/- 0.00107\n",
|
||||
"\n"
|
||||
]
|
||||
},
|
||||
|
|
@ -743,8 +733,8 @@
|
|||
" <th>0</th>\n",
|
||||
" <td>total</td>\n",
|
||||
" <td>(nu-fission / (absorption + current))</td>\n",
|
||||
" <td>1.02431</td>\n",
|
||||
" <td>0.00704</td>\n",
|
||||
" <td>1.023002</td>\n",
|
||||
" <td>0.006647</td>\n",
|
||||
" </tr>\n",
|
||||
" </tbody>\n",
|
||||
"</table>\n",
|
||||
|
|
@ -752,7 +742,7 @@
|
|||
],
|
||||
"text/plain": [
|
||||
" nuclide score mean std. dev.\n",
|
||||
"0 total (nu-fission / (absorption + current)) 1.02e+00 7.04e-03"
|
||||
"0 total (nu-fission / (absorption + current)) 1.02e+00 6.65e-03"
|
||||
]
|
||||
},
|
||||
"execution_count": 24,
|
||||
|
|
@ -814,8 +804,8 @@
|
|||
" <td>0.625</td>\n",
|
||||
" <td>total</td>\n",
|
||||
" <td>(absorption + current)</td>\n",
|
||||
" <td>0.695303</td>\n",
|
||||
" <td>0.005091</td>\n",
|
||||
" <td>0.694368</td>\n",
|
||||
" <td>0.004606</td>\n",
|
||||
" </tr>\n",
|
||||
" </tbody>\n",
|
||||
"</table>\n",
|
||||
|
|
@ -823,10 +813,10 @@
|
|||
],
|
||||
"text/plain": [
|
||||
" energy low [eV] energy high [eV] nuclide score mean \\\n",
|
||||
"0 0.00e+00 6.25e-01 total (absorption + current) 6.95e-01 \n",
|
||||
"0 0.00e+00 6.25e-01 total (absorption + current) 6.94e-01 \n",
|
||||
"\n",
|
||||
" std. dev. \n",
|
||||
"0 5.09e-03 "
|
||||
"0 4.61e-03 "
|
||||
]
|
||||
},
|
||||
"execution_count": 25,
|
||||
|
|
@ -882,8 +872,8 @@
|
|||
" <td>0.625</td>\n",
|
||||
" <td>total</td>\n",
|
||||
" <td>nu-fission</td>\n",
|
||||
" <td>1.202639</td>\n",
|
||||
" <td>0.010348</td>\n",
|
||||
" <td>1.203099</td>\n",
|
||||
" <td>0.009615</td>\n",
|
||||
" </tr>\n",
|
||||
" </tbody>\n",
|
||||
"</table>\n",
|
||||
|
|
@ -891,7 +881,7 @@
|
|||
],
|
||||
"text/plain": [
|
||||
" energy low [eV] energy high [eV] nuclide score mean std. dev.\n",
|
||||
"0 0.00e+00 6.25e-01 total nu-fission 1.20e+00 1.03e-02"
|
||||
"0 0.00e+00 6.25e-01 total nu-fission 1.20e+00 9.61e-03"
|
||||
]
|
||||
},
|
||||
"execution_count": 26,
|
||||
|
|
@ -947,8 +937,8 @@
|
|||
" <td>10000</td>\n",
|
||||
" <td>total</td>\n",
|
||||
" <td>absorption</td>\n",
|
||||
" <td>0.749349</td>\n",
|
||||
" <td>0.006731</td>\n",
|
||||
" <td>0.749423</td>\n",
|
||||
" <td>0.006089</td>\n",
|
||||
" </tr>\n",
|
||||
" </tbody>\n",
|
||||
"</table>\n",
|
||||
|
|
@ -959,7 +949,7 @@
|
|||
"0 0.00e+00 6.25e-01 10000 total absorption 7.49e-01 \n",
|
||||
"\n",
|
||||
" std. dev. \n",
|
||||
"0 6.73e-03 "
|
||||
"0 6.09e-03 "
|
||||
]
|
||||
},
|
||||
"execution_count": 27,
|
||||
|
|
@ -1013,8 +1003,8 @@
|
|||
" <td>10000</td>\n",
|
||||
" <td>total</td>\n",
|
||||
" <td>(nu-fission / absorption)</td>\n",
|
||||
" <td>1.663736</td>\n",
|
||||
" <td>0.015707</td>\n",
|
||||
" <td>1.663727</td>\n",
|
||||
" <td>0.014403</td>\n",
|
||||
" </tr>\n",
|
||||
" </tbody>\n",
|
||||
"</table>\n",
|
||||
|
|
@ -1025,7 +1015,7 @@
|
|||
"0 0.00e+00 6.25e-01 10000 total \n",
|
||||
"\n",
|
||||
" score mean std. dev. \n",
|
||||
"0 (nu-fission / absorption) 1.66e+00 1.57e-02 "
|
||||
"0 (nu-fission / absorption) 1.66e+00 1.44e-02 "
|
||||
]
|
||||
},
|
||||
"execution_count": 28,
|
||||
|
|
@ -1076,8 +1066,8 @@
|
|||
" <td>0.625</td>\n",
|
||||
" <td>total</td>\n",
|
||||
" <td>(absorption + current)</td>\n",
|
||||
" <td>0.985102</td>\n",
|
||||
" <td>0.005855</td>\n",
|
||||
" <td>0.984668</td>\n",
|
||||
" <td>0.005509</td>\n",
|
||||
" </tr>\n",
|
||||
" </tbody>\n",
|
||||
"</table>\n",
|
||||
|
|
@ -1088,7 +1078,7 @@
|
|||
"0 0.00e+00 6.25e-01 total (absorption + current) 9.85e-01 \n",
|
||||
"\n",
|
||||
" std. dev. \n",
|
||||
"0 5.86e-03 "
|
||||
"0 5.51e-03 "
|
||||
]
|
||||
},
|
||||
"execution_count": 29,
|
||||
|
|
@ -1138,8 +1128,8 @@
|
|||
" <td>0.625</td>\n",
|
||||
" <td>total</td>\n",
|
||||
" <td>(absorption / (absorption + current))</td>\n",
|
||||
" <td>0.997407</td>\n",
|
||||
" <td>0.008492</td>\n",
|
||||
" <td>0.997439</td>\n",
|
||||
" <td>0.007548</td>\n",
|
||||
" </tr>\n",
|
||||
" </tbody>\n",
|
||||
"</table>\n",
|
||||
|
|
@ -1150,7 +1140,7 @@
|
|||
"0 0.00e+00 6.25e-01 total \n",
|
||||
"\n",
|
||||
" score mean std. dev. \n",
|
||||
"0 (absorption / (absorption + current)) 9.97e-01 8.49e-03 "
|
||||
"0 (absorption / (absorption + current)) 9.97e-01 7.55e-03 "
|
||||
]
|
||||
},
|
||||
"execution_count": 30,
|
||||
|
|
@ -1202,8 +1192,8 @@
|
|||
" <td>10000</td>\n",
|
||||
" <td>total</td>\n",
|
||||
" <td>((((((absorption + current) * nu-fission) * ab...</td>\n",
|
||||
" <td>1.02431</td>\n",
|
||||
" <td>0.02062</td>\n",
|
||||
" <td>1.023002</td>\n",
|
||||
" <td>0.018791</td>\n",
|
||||
" </tr>\n",
|
||||
" </tbody>\n",
|
||||
"</table>\n",
|
||||
|
|
@ -1214,7 +1204,7 @@
|
|||
"0 0.00e+00 6.25e-01 10000 total \n",
|
||||
"\n",
|
||||
" score mean std. dev. \n",
|
||||
"0 ((((((absorption + current) * nu-fission) * ab... 1.02e+00 2.06e-02 "
|
||||
"0 ((((((absorption + current) * nu-fission) * ab... 1.02e+00 1.88e-02 "
|
||||
]
|
||||
},
|
||||
"execution_count": 31,
|
||||
|
|
@ -1284,8 +1274,8 @@
|
|||
" <td>6.250000e-01</td>\n",
|
||||
" <td>(U238 / total)</td>\n",
|
||||
" <td>(nu-fission / flux)</td>\n",
|
||||
" <td>6.662479e-07</td>\n",
|
||||
" <td>6.039323e-09</td>\n",
|
||||
" <td>6.659486e-07</td>\n",
|
||||
" <td>5.627975e-09</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>1</th>\n",
|
||||
|
|
@ -1294,8 +1284,8 @@
|
|||
" <td>6.250000e-01</td>\n",
|
||||
" <td>(U238 / total)</td>\n",
|
||||
" <td>(scatter / flux)</td>\n",
|
||||
" <td>2.099897e-01</td>\n",
|
||||
" <td>1.843251e-03</td>\n",
|
||||
" <td>2.099901e-01</td>\n",
|
||||
" <td>1.748379e-03</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>2</th>\n",
|
||||
|
|
@ -1304,8 +1294,8 @@
|
|||
" <td>6.250000e-01</td>\n",
|
||||
" <td>(U235 / total)</td>\n",
|
||||
" <td>(nu-fission / flux)</td>\n",
|
||||
" <td>3.568130e-01</td>\n",
|
||||
" <td>3.255144e-03</td>\n",
|
||||
" <td>3.566329e-01</td>\n",
|
||||
" <td>3.030782e-03</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>3</th>\n",
|
||||
|
|
@ -1314,8 +1304,8 @@
|
|||
" <td>6.250000e-01</td>\n",
|
||||
" <td>(U235 / total)</td>\n",
|
||||
" <td>(scatter / flux)</td>\n",
|
||||
" <td>5.555326e-03</td>\n",
|
||||
" <td>4.893022e-05</td>\n",
|
||||
" <td>5.555466e-03</td>\n",
|
||||
" <td>4.635318e-05</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>4</th>\n",
|
||||
|
|
@ -1324,8 +1314,8 @@
|
|||
" <td>2.000000e+07</td>\n",
|
||||
" <td>(U238 / total)</td>\n",
|
||||
" <td>(nu-fission / flux)</td>\n",
|
||||
" <td>7.215044e-03</td>\n",
|
||||
" <td>4.968448e-05</td>\n",
|
||||
" <td>7.251304e-03</td>\n",
|
||||
" <td>5.161998e-05</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>5</th>\n",
|
||||
|
|
@ -1334,8 +1324,8 @@
|
|||
" <td>2.000000e+07</td>\n",
|
||||
" <td>(U238 / total)</td>\n",
|
||||
" <td>(scatter / flux)</td>\n",
|
||||
" <td>2.273966e-01</td>\n",
|
||||
" <td>8.969811e-04</td>\n",
|
||||
" <td>2.272661e-01</td>\n",
|
||||
" <td>9.576939e-04</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>6</th>\n",
|
||||
|
|
@ -1344,8 +1334,8 @@
|
|||
" <td>2.000000e+07</td>\n",
|
||||
" <td>(U235 / total)</td>\n",
|
||||
" <td>(nu-fission / flux)</td>\n",
|
||||
" <td>7.969615e-03</td>\n",
|
||||
" <td>5.374119e-05</td>\n",
|
||||
" <td>7.920169e-03</td>\n",
|
||||
" <td>5.751231e-05</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>7</th>\n",
|
||||
|
|
@ -1354,8 +1344,8 @@
|
|||
" <td>2.000000e+07</td>\n",
|
||||
" <td>(U235 / total)</td>\n",
|
||||
" <td>(scatter / flux)</td>\n",
|
||||
" <td>3.362798e-03</td>\n",
|
||||
" <td>1.286767e-05</td>\n",
|
||||
" <td>3.358280e-03</td>\n",
|
||||
" <td>1.341281e-05</td>\n",
|
||||
" </tr>\n",
|
||||
" </tbody>\n",
|
||||
"</table>\n",
|
||||
|
|
@ -1373,14 +1363,14 @@
|
|||
"7 10000 6.25e-01 2.00e+07 (U235 / total) \n",
|
||||
"\n",
|
||||
" score mean std. dev. \n",
|
||||
"0 (nu-fission / flux) 6.66e-07 6.04e-09 \n",
|
||||
"1 (scatter / flux) 2.10e-01 1.84e-03 \n",
|
||||
"2 (nu-fission / flux) 3.57e-01 3.26e-03 \n",
|
||||
"3 (scatter / flux) 5.56e-03 4.89e-05 \n",
|
||||
"4 (nu-fission / flux) 7.22e-03 4.97e-05 \n",
|
||||
"5 (scatter / flux) 2.27e-01 8.97e-04 \n",
|
||||
"6 (nu-fission / flux) 7.97e-03 5.37e-05 \n",
|
||||
"7 (scatter / flux) 3.36e-03 1.29e-05 "
|
||||
"0 (nu-fission / flux) 6.66e-07 5.63e-09 \n",
|
||||
"1 (scatter / flux) 2.10e-01 1.75e-03 \n",
|
||||
"2 (nu-fission / flux) 3.57e-01 3.03e-03 \n",
|
||||
"3 (scatter / flux) 5.56e-03 4.64e-05 \n",
|
||||
"4 (nu-fission / flux) 7.25e-03 5.16e-05 \n",
|
||||
"5 (scatter / flux) 2.27e-01 9.58e-04 \n",
|
||||
"6 (nu-fission / flux) 7.92e-03 5.75e-05 \n",
|
||||
"7 (scatter / flux) 3.36e-03 1.34e-05 "
|
||||
]
|
||||
},
|
||||
"execution_count": 33,
|
||||
|
|
@ -1411,11 +1401,11 @@
|
|||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"[[[ 6.66247898e-07]\n",
|
||||
" [ 3.56812954e-01]]\n",
|
||||
"[[[ 6.65948580e-07]\n",
|
||||
" [ 3.56632881e-01]]\n",
|
||||
"\n",
|
||||
" [[ 7.21504433e-03]\n",
|
||||
" [ 7.96961502e-03]]]\n"
|
||||
" [[ 7.25130446e-03]\n",
|
||||
" [ 7.92016892e-03]]]\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
|
|
@ -1443,9 +1433,9 @@
|
|||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"[[[ 0.00555533]]\n",
|
||||
"[[[ 0.00555547]]\n",
|
||||
"\n",
|
||||
" [[ 0.0033628 ]]]\n"
|
||||
" [[ 0.00335828]]]\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
|
|
@ -1467,8 +1457,8 @@
|
|||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"[[[ 0.22739657]\n",
|
||||
" [ 0.0033628 ]]]\n"
|
||||
"[[[ 0.22726611]\n",
|
||||
" [ 0.00335828]]]\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
|
|
@ -1520,7 +1510,7 @@
|
|||
" <td>U238</td>\n",
|
||||
" <td>nu-fission</td>\n",
|
||||
" <td>0.000002</td>\n",
|
||||
" <td>1.057199e-08</td>\n",
|
||||
" <td>9.679304e-09</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>1</th>\n",
|
||||
|
|
@ -1529,8 +1519,8 @@
|
|||
" <td>6.250000e-01</td>\n",
|
||||
" <td>U235</td>\n",
|
||||
" <td>nu-fission</td>\n",
|
||||
" <td>0.856784</td>\n",
|
||||
" <td>5.730044e-03</td>\n",
|
||||
" <td>0.854805</td>\n",
|
||||
" <td>5.239673e-03</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>2</th>\n",
|
||||
|
|
@ -1539,8 +1529,8 @@
|
|||
" <td>2.000000e+07</td>\n",
|
||||
" <td>U238</td>\n",
|
||||
" <td>nu-fission</td>\n",
|
||||
" <td>0.082495</td>\n",
|
||||
" <td>5.176027e-04</td>\n",
|
||||
" <td>0.082978</td>\n",
|
||||
" <td>5.346135e-04</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>3</th>\n",
|
||||
|
|
@ -1549,8 +1539,8 @@
|
|||
" <td>2.000000e+07</td>\n",
|
||||
" <td>U235</td>\n",
|
||||
" <td>nu-fission</td>\n",
|
||||
" <td>0.091123</td>\n",
|
||||
" <td>5.574052e-04</td>\n",
|
||||
" <td>0.090632</td>\n",
|
||||
" <td>5.981942e-04</td>\n",
|
||||
" </tr>\n",
|
||||
" </tbody>\n",
|
||||
"</table>\n",
|
||||
|
|
@ -1559,15 +1549,15 @@
|
|||
"text/plain": [
|
||||
" cell energy low [eV] energy high [eV] nuclide score mean \\\n",
|
||||
"0 10000 0.00e+00 6.25e-01 U238 nu-fission 1.60e-06 \n",
|
||||
"1 10000 0.00e+00 6.25e-01 U235 nu-fission 8.57e-01 \n",
|
||||
"2 10000 6.25e-01 2.00e+07 U238 nu-fission 8.25e-02 \n",
|
||||
"3 10000 6.25e-01 2.00e+07 U235 nu-fission 9.11e-02 \n",
|
||||
"1 10000 0.00e+00 6.25e-01 U235 nu-fission 8.55e-01 \n",
|
||||
"2 10000 6.25e-01 2.00e+07 U238 nu-fission 8.30e-02 \n",
|
||||
"3 10000 6.25e-01 2.00e+07 U235 nu-fission 9.06e-02 \n",
|
||||
"\n",
|
||||
" std. dev. \n",
|
||||
"0 1.06e-08 \n",
|
||||
"1 5.73e-03 \n",
|
||||
"2 5.18e-04 \n",
|
||||
"3 5.57e-04 "
|
||||
"0 9.68e-09 \n",
|
||||
"1 5.24e-03 \n",
|
||||
"2 5.35e-04 \n",
|
||||
"3 5.98e-04 "
|
||||
]
|
||||
},
|
||||
"execution_count": 37,
|
||||
|
|
@ -1613,8 +1603,8 @@
|
|||
" <td>1.080060e-01</td>\n",
|
||||
" <td>H1</td>\n",
|
||||
" <td>scatter</td>\n",
|
||||
" <td>4.547947</td>\n",
|
||||
" <td>0.028000</td>\n",
|
||||
" <td>4.541188</td>\n",
|
||||
" <td>0.025230</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>1</th>\n",
|
||||
|
|
@ -1623,8 +1613,8 @@
|
|||
" <td>1.166529e+00</td>\n",
|
||||
" <td>H1</td>\n",
|
||||
" <td>scatter</td>\n",
|
||||
" <td>2.003068</td>\n",
|
||||
" <td>0.008587</td>\n",
|
||||
" <td>2.001332</td>\n",
|
||||
" <td>0.006754</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>2</th>\n",
|
||||
|
|
@ -1633,8 +1623,8 @@
|
|||
" <td>1.259921e+01</td>\n",
|
||||
" <td>H1</td>\n",
|
||||
" <td>scatter</td>\n",
|
||||
" <td>1.647225</td>\n",
|
||||
" <td>0.011136</td>\n",
|
||||
" <td>1.639292</td>\n",
|
||||
" <td>0.011374</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>3</th>\n",
|
||||
|
|
@ -1643,8 +1633,8 @@
|
|||
" <td>1.360790e+02</td>\n",
|
||||
" <td>H1</td>\n",
|
||||
" <td>scatter</td>\n",
|
||||
" <td>1.831367</td>\n",
|
||||
" <td>0.010196</td>\n",
|
||||
" <td>1.821633</td>\n",
|
||||
" <td>0.009590</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>4</th>\n",
|
||||
|
|
@ -1653,8 +1643,8 @@
|
|||
" <td>1.469734e+03</td>\n",
|
||||
" <td>H1</td>\n",
|
||||
" <td>scatter</td>\n",
|
||||
" <td>2.039613</td>\n",
|
||||
" <td>0.008059</td>\n",
|
||||
" <td>2.032395</td>\n",
|
||||
" <td>0.009953</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>5</th>\n",
|
||||
|
|
@ -1663,8 +1653,8 @@
|
|||
" <td>1.587401e+04</td>\n",
|
||||
" <td>H1</td>\n",
|
||||
" <td>scatter</td>\n",
|
||||
" <td>2.137523</td>\n",
|
||||
" <td>0.012885</td>\n",
|
||||
" <td>2.120745</td>\n",
|
||||
" <td>0.011090</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>6</th>\n",
|
||||
|
|
@ -1673,8 +1663,8 @@
|
|||
" <td>1.714488e+05</td>\n",
|
||||
" <td>H1</td>\n",
|
||||
" <td>scatter</td>\n",
|
||||
" <td>2.170725</td>\n",
|
||||
" <td>0.012669</td>\n",
|
||||
" <td>2.181709</td>\n",
|
||||
" <td>0.013602</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>7</th>\n",
|
||||
|
|
@ -1683,8 +1673,8 @@
|
|||
" <td>1.851749e+06</td>\n",
|
||||
" <td>H1</td>\n",
|
||||
" <td>scatter</td>\n",
|
||||
" <td>2.002724</td>\n",
|
||||
" <td>0.010768</td>\n",
|
||||
" <td>2.013644</td>\n",
|
||||
" <td>0.009219</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>8</th>\n",
|
||||
|
|
@ -1693,8 +1683,8 @@
|
|||
" <td>2.000000e+07</td>\n",
|
||||
" <td>H1</td>\n",
|
||||
" <td>scatter</td>\n",
|
||||
" <td>0.371624</td>\n",
|
||||
" <td>0.002959</td>\n",
|
||||
" <td>0.372640</td>\n",
|
||||
" <td>0.002903</td>\n",
|
||||
" </tr>\n",
|
||||
" </tbody>\n",
|
||||
"</table>\n",
|
||||
|
|
@ -1702,26 +1692,26 @@
|
|||
],
|
||||
"text/plain": [
|
||||
" cell energy low [eV] energy high [eV] nuclide score mean \\\n",
|
||||
"0 10002 1.00e-02 1.08e-01 H1 scatter 4.55e+00 \n",
|
||||
"0 10002 1.00e-02 1.08e-01 H1 scatter 4.54e+00 \n",
|
||||
"1 10002 1.08e-01 1.17e+00 H1 scatter 2.00e+00 \n",
|
||||
"2 10002 1.17e+00 1.26e+01 H1 scatter 1.65e+00 \n",
|
||||
"3 10002 1.26e+01 1.36e+02 H1 scatter 1.83e+00 \n",
|
||||
"4 10002 1.36e+02 1.47e+03 H1 scatter 2.04e+00 \n",
|
||||
"5 10002 1.47e+03 1.59e+04 H1 scatter 2.14e+00 \n",
|
||||
"6 10002 1.59e+04 1.71e+05 H1 scatter 2.17e+00 \n",
|
||||
"7 10002 1.71e+05 1.85e+06 H1 scatter 2.00e+00 \n",
|
||||
"8 10002 1.85e+06 2.00e+07 H1 scatter 3.72e-01 \n",
|
||||
"2 10002 1.17e+00 1.26e+01 H1 scatter 1.64e+00 \n",
|
||||
"3 10002 1.26e+01 1.36e+02 H1 scatter 1.82e+00 \n",
|
||||
"4 10002 1.36e+02 1.47e+03 H1 scatter 2.03e+00 \n",
|
||||
"5 10002 1.47e+03 1.59e+04 H1 scatter 2.12e+00 \n",
|
||||
"6 10002 1.59e+04 1.71e+05 H1 scatter 2.18e+00 \n",
|
||||
"7 10002 1.71e+05 1.85e+06 H1 scatter 2.01e+00 \n",
|
||||
"8 10002 1.85e+06 2.00e+07 H1 scatter 3.73e-01 \n",
|
||||
"\n",
|
||||
" std. dev. \n",
|
||||
"0 2.80e-02 \n",
|
||||
"1 8.59e-03 \n",
|
||||
"2 1.11e-02 \n",
|
||||
"3 1.02e-02 \n",
|
||||
"4 8.06e-03 \n",
|
||||
"5 1.29e-02 \n",
|
||||
"6 1.27e-02 \n",
|
||||
"7 1.08e-02 \n",
|
||||
"8 2.96e-03 "
|
||||
"0 2.52e-02 \n",
|
||||
"1 6.75e-03 \n",
|
||||
"2 1.14e-02 \n",
|
||||
"3 9.59e-03 \n",
|
||||
"4 9.95e-03 \n",
|
||||
"5 1.11e-02 \n",
|
||||
"6 1.36e-02 \n",
|
||||
"7 9.22e-03 \n",
|
||||
"8 2.90e-03 "
|
||||
]
|
||||
},
|
||||
"execution_count": 38,
|
||||
378
examples/jupyter/triso.ipynb
Normal file
378
examples/jupyter/triso.ipynb
Normal file
File diff suppressed because one or more lines are too long
|
|
@ -95,7 +95,7 @@ settings_file.export_to_xml()
|
|||
###############################################################################
|
||||
|
||||
# Instantiate some tally Filters
|
||||
cell_filter = openmc.CellFilter(100)
|
||||
cell_filter = openmc.CellFilter(cell2)
|
||||
energy_filter = openmc.EnergyFilter([0., 20.e6])
|
||||
energyout_filter = openmc.EnergyoutFilter([0., 20.e6])
|
||||
|
||||
|
|
|
|||
|
|
@ -153,7 +153,7 @@ plot_file.export_to_xml()
|
|||
|
||||
# Instantiate a distribcell Tally
|
||||
tally = openmc.Tally(tally_id=1)
|
||||
tally.filters = [openmc.DistribcellFilter(cell2.id)]
|
||||
tally.filters = [openmc.DistribcellFilter(cell2)]
|
||||
tally.scores = ['total']
|
||||
|
||||
# Instantiate a Tallies collection and export to XML
|
||||
|
|
|
|||
|
|
@ -47,17 +47,17 @@ is affected by the following environment variables.
|
|||
Indicates the default path to the cross_sections.xml summary file that is used
|
||||
to locate HDF5 format cross section libraries if the user has not specified the
|
||||
<cross_sections> tag in
|
||||
.I settings.xml\fP.
|
||||
.I materials.xml\fP.
|
||||
.TP
|
||||
.B OPENMC_MG_CROSS_SECTIONS
|
||||
Indicates the default path to the mgxs.xml file that contains multi-group cross
|
||||
Indicates the default path to an HDF5 file that contains multi-group cross
|
||||
section libraries if the user has not specified the <cross_sections> tag in
|
||||
.I settings.xml\fP.
|
||||
.I materials.xml\fP.
|
||||
.TP
|
||||
.B OPENMC_MULTIPOLE_LIBRARY
|
||||
Indicates the default path to a directory containing windowed multipole data if
|
||||
the user has not specified the <multipole_library> tag in
|
||||
.I settings.xml\fP.
|
||||
.I materials.xml\fP.
|
||||
.SH LICENSE
|
||||
Copyright \(co 2011-2017 Massachusetts Institute of Technology.
|
||||
.PP
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
from collections import OrderedDict, Iterable
|
||||
from copy import deepcopy
|
||||
from math import cos, sin, pi
|
||||
from numbers import Real, Integral
|
||||
from xml.etree import ElementTree as ET
|
||||
|
|
@ -504,6 +505,44 @@ class Cell(object):
|
|||
|
||||
return universes
|
||||
|
||||
def clone(self, memo=None):
|
||||
"""Create a copy of this cell with a new unique ID, and clones
|
||||
the cell's region and fill.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
memo : dict or None
|
||||
A nested dictionary of previously cloned objects. This parameter
|
||||
is used internally and should not be specified by the user.
|
||||
|
||||
Returns
|
||||
-------
|
||||
clone : openmc.Cell
|
||||
The clone of this cell
|
||||
|
||||
"""
|
||||
|
||||
if memo is None:
|
||||
memo = {}
|
||||
|
||||
# If no nemoize'd clone exists, instantiate one
|
||||
if self not in memo:
|
||||
clone = deepcopy(self)
|
||||
clone.id = None
|
||||
if self.region is not None:
|
||||
clone.region = self.region.clone(memo)
|
||||
if self.fill is not None:
|
||||
if self.fill_type == 'distribmat':
|
||||
clone.fill = [fill.clone(memo) if fill is not None else None
|
||||
for fill in self.fill]
|
||||
else:
|
||||
clone.fill = self.fill.clone(memo)
|
||||
|
||||
# Memoize the clone
|
||||
memo[self] = clone
|
||||
|
||||
return memo[self]
|
||||
|
||||
def create_xml_subelement(self, xml_element):
|
||||
element = ET.Element("cell")
|
||||
element.set("id", str(self.id))
|
||||
|
|
|
|||
|
|
@ -28,3 +28,4 @@ from .library import *
|
|||
from .fission_energy import *
|
||||
from .resonance import *
|
||||
from .multipole import *
|
||||
from .grid import *
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ from six import string_types
|
|||
import numpy as np
|
||||
|
||||
from openmc.mixin import EqualityMixin
|
||||
|
||||
from openmc.data.endf import ENDF_FLOAT_RE
|
||||
|
||||
def ascii_to_binary(ascii_file, binary_file):
|
||||
"""Convert an ACE file in ASCII format (type 1) to binary format (type 2).
|
||||
|
|
@ -344,6 +344,17 @@ class Library(EqualityMixin):
|
|||
datastr = '0.0 ' + ''.join(lines[12:12+n_lines])
|
||||
xss = np.fromstring(datastr, sep=' ')
|
||||
|
||||
# When NJOY writes an ACE file, any values less than 1e-100 actually
|
||||
# get written without the 'e'. Thus, what we do here is check
|
||||
# whether the xss array is of the right size (if a number like
|
||||
# 1.0-120 is encountered, np.fromstring won't capture any numbers
|
||||
# after it). If it's too short, then we apply the ENDF float regular
|
||||
# expression. We don't do this by default because it's expensive!
|
||||
if xss.size != nxs[1] + 1:
|
||||
datastr = ENDF_FLOAT_RE.sub(r'\1e\2', datastr)
|
||||
xss = np.fromstring(datastr, sep=' ')
|
||||
assert xss.size == nxs[1] + 1
|
||||
|
||||
table = Table(name, atomic_weight_ratio, temperature, pairs,
|
||||
nxs, jxs, xss)
|
||||
self.tables.append(table)
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ SUM_RULES = {1: [2, 3],
|
|||
106: list(range(750, 800)),
|
||||
107: list(range(800, 850))}
|
||||
|
||||
_ENDF_FLOAT_RE = re.compile(r'([\s\-\+]?\d*\.\d+)([\+\-]\d+)')
|
||||
ENDF_FLOAT_RE = re.compile(r'([\s\-\+]?\d*\.\d+)([\+\-]\d+)')
|
||||
|
||||
|
||||
def float_endf(s):
|
||||
|
|
@ -69,7 +69,7 @@ def float_endf(s):
|
|||
The number
|
||||
|
||||
"""
|
||||
return float(_ENDF_FLOAT_RE.sub(r'\1e\2', s))
|
||||
return float(ENDF_FLOAT_RE.sub(r'\1e\2', s))
|
||||
|
||||
|
||||
def get_text_record(file_obj):
|
||||
|
|
|
|||
111
openmc/data/grid.py
Normal file
111
openmc/data/grid.py
Normal file
|
|
@ -0,0 +1,111 @@
|
|||
import numpy as np
|
||||
|
||||
|
||||
def linearize(x, f, tolerance=0.001):
|
||||
"""Return a tabulated representation of a function of one variable.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
x : Iterable of float
|
||||
Initial x values at which the function should be evaluated
|
||||
f : Callable
|
||||
Function of a single variable
|
||||
tolerance : float
|
||||
Tolerance on the interpolation error
|
||||
|
||||
Returns
|
||||
-------
|
||||
numpy.ndarray
|
||||
Tabulated values of the independent variable
|
||||
numpy.ndarray
|
||||
Tabulated values of the dependent variable
|
||||
|
||||
"""
|
||||
# Initialize output arrays
|
||||
x_out = []
|
||||
y_out = []
|
||||
|
||||
# Initialize stack
|
||||
x_stack = [x[0]]
|
||||
y_stack = [f(x[0])]
|
||||
|
||||
for i in range(x.shape[0] - 1):
|
||||
x_stack.insert(0, x[i + 1])
|
||||
y_stack.insert(0, f(x[i + 1]))
|
||||
|
||||
while True:
|
||||
x_high, x_low = x_stack[-2:]
|
||||
y_high, y_low = y_stack[-2:]
|
||||
x_mid = 0.5*(x_low + x_high)
|
||||
y_mid = f(x_mid)
|
||||
|
||||
y_interp = y_low + (y_high - y_low)/(x_high - x_low)*(x_mid - x_low)
|
||||
error = abs((y_interp - y_mid)/y_mid)
|
||||
if error > tolerance:
|
||||
x_stack.insert(-1, x_mid)
|
||||
y_stack.insert(-1, y_mid)
|
||||
else:
|
||||
x_out.append(x_stack.pop())
|
||||
y_out.append(y_stack.pop())
|
||||
if len(x_stack) == 1:
|
||||
break
|
||||
|
||||
x_out.append(x_stack.pop())
|
||||
y_out.append(y_stack.pop())
|
||||
|
||||
return np.array(x_out), np.array(y_out)
|
||||
|
||||
def thin(x, y, tolerance=0.001):
|
||||
"""Check for (x,y) points that can be removed.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
x : numpy.ndarray
|
||||
Independent variable
|
||||
y : numpy.ndarray
|
||||
Dependent variable
|
||||
tolerance : float
|
||||
Tolerance on interpolation error
|
||||
|
||||
Returns
|
||||
-------
|
||||
numpy.ndarray
|
||||
Tabulated values of the independent variable
|
||||
numpy.ndarray
|
||||
Tabulated values of the dependent variable
|
||||
|
||||
"""
|
||||
# Initialize output arrays
|
||||
x_out = x.copy()
|
||||
y_out = y.copy()
|
||||
|
||||
N = x.shape[0]
|
||||
i_left = 0
|
||||
i_right = 2
|
||||
|
||||
while i_left < N - 2 and i_right < N:
|
||||
m = (y[i_right] - y[i_left])/(x[i_right] - x[i_left])
|
||||
|
||||
for i in range(i_left + 1, i_right):
|
||||
# Determine error in interpolated point
|
||||
y_interp = y[i_left] + m*(x[i] - x[i_left])
|
||||
if abs(y[i]) > 0.:
|
||||
error = abs((y_interp - y[i])/y[i])
|
||||
else:
|
||||
error = 2*tolerance
|
||||
|
||||
if error > tolerance:
|
||||
for i_remove in range(i_left + 1, i_right - 1):
|
||||
x_out[i_remove] = np.nan
|
||||
y_out[i_remove] = np.nan
|
||||
i_left = i_right - 1
|
||||
i_right = i_left + 1
|
||||
break
|
||||
|
||||
i_right += 1
|
||||
|
||||
for i_remove in range(i_left + 1, i_right - 1):
|
||||
x_out[i_remove] = np.nan
|
||||
y_out[i_remove] = np.nan
|
||||
|
||||
return x_out[np.isfinite(x_out)], y_out[np.isfinite(y_out)]
|
||||
|
|
@ -2,6 +2,7 @@ from __future__ import division, unicode_literals
|
|||
import sys
|
||||
from collections import OrderedDict, Iterable, Mapping, MutableMapping
|
||||
from itertools import chain
|
||||
from math import log10
|
||||
from numbers import Integral, Real
|
||||
from warnings import warn
|
||||
|
||||
|
|
@ -12,17 +13,22 @@ import h5py
|
|||
from . import HDF5_VERSION, HDF5_VERSION_MAJOR
|
||||
from .ace import Table, get_table
|
||||
from .data import ATOMIC_SYMBOL, K_BOLTZMANN, EV_PER_MEV
|
||||
from .endf import Evaluation, SUM_RULES
|
||||
from .fission_energy import FissionEnergyRelease
|
||||
from .function import Tabulated1D, Sum, ResonancesWithBackground
|
||||
from .endf import Evaluation, SUM_RULES
|
||||
from .grid import linearize, thin
|
||||
from .product import Product
|
||||
from .reaction import Reaction, _get_photon_products_ace
|
||||
from .resonance import Resonances, _RESOLVED
|
||||
from . import resonance as res
|
||||
from .urr import ProbabilityTables
|
||||
import openmc.checkvalue as cv
|
||||
from openmc.mixin import EqualityMixin
|
||||
|
||||
|
||||
# Fractions of resonance widths used for reconstructing resonances
|
||||
_RESONANCE_ENERGY_GRID = np.logspace(-3, 3, 61)
|
||||
|
||||
|
||||
def _get_metadata(zaid, metastable_scheme='nndc'):
|
||||
"""Return basic identifying data for a nuclide with a given ZAID.
|
||||
|
||||
|
|
@ -278,7 +284,7 @@ class IncidentNeutron(EqualityMixin):
|
|||
|
||||
@resonances.setter
|
||||
def resonances(self, resonances):
|
||||
cv.check_type('resonances', resonances, Resonances)
|
||||
cv.check_type('resonances', resonances, res.Resonances)
|
||||
self._resonances = resonances
|
||||
|
||||
@summed_reactions.setter
|
||||
|
|
@ -343,6 +349,98 @@ class IncidentNeutron(EqualityMixin):
|
|||
if strT in data.urr:
|
||||
self.urr[strT] = data.urr[strT]
|
||||
|
||||
def add_elastic_0K_from_endf(self, filename, overwrite=False):
|
||||
"""Append 0K elastic scattering cross section from an ENDF file.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
filename : str
|
||||
Path to ENDF file
|
||||
overwrite : bool
|
||||
If existing 0 K data is present, this flag can be used to indicate
|
||||
that it should be overwritten. Otherwise, an exception will be
|
||||
thrown.
|
||||
|
||||
Raises
|
||||
------
|
||||
ValueError
|
||||
If 0 K data is already present and the `overwrite` parameter is
|
||||
False.
|
||||
|
||||
"""
|
||||
# Check for existing data
|
||||
if '0K' in self.energy and not overwrite:
|
||||
raise ValueError('0 K data already exists for this nuclide.')
|
||||
|
||||
data = type(self).from_endf(filename)
|
||||
if data.resonances is not None:
|
||||
x = []
|
||||
y = []
|
||||
for rr in data.resonances:
|
||||
if isinstance(rr, res.RMatrixLimited):
|
||||
raise TypeError('R-Matrix Limited not supported.')
|
||||
elif isinstance(rr, res.Unresolved):
|
||||
continue
|
||||
|
||||
# Get energies/widths for resonances
|
||||
e_peak = rr.parameters['energy'].values
|
||||
if isinstance(rr, res.MultiLevelBreitWigner):
|
||||
gamma = rr.parameters['totalWidth'].values
|
||||
elif isinstance(rr, res.ReichMoore):
|
||||
df = rr.parameters
|
||||
gamma = (df['neutronWidth'] +
|
||||
df['captureWidth'] +
|
||||
abs(df['fissionWidthA']) +
|
||||
abs(df['fissionWidthB'])).values
|
||||
|
||||
# Determine peak energies and widths
|
||||
e_min, e_max = rr.energy_min, rr.energy_max
|
||||
in_range = (e_peak > e_min) & (e_peak < e_max)
|
||||
e_peak = e_peak[in_range]
|
||||
gamma = gamma[in_range]
|
||||
|
||||
# Get midpoints between resonances (use min/max energy of
|
||||
# resolved region as absolute lower/upper bound)
|
||||
e_mid = np.concatenate(
|
||||
([e_min], (e_peak[1:] + e_peak[:-1])/2, [e_max]))
|
||||
|
||||
# Add grid around each resonance that includes the peak +/- the
|
||||
# width times each value in _RESONANCE_ENERGY_GRID. Values are
|
||||
# constrained so that points around one resonance don't overlap
|
||||
# with points around another. This algorithm is from Fudge.
|
||||
energies = []
|
||||
for e, g, e_lower, e_upper in zip(e_peak, gamma, e_mid[:-1],
|
||||
e_mid[1:]):
|
||||
e_left = e - g*_RESONANCE_ENERGY_GRID
|
||||
energies.append(e_left[e_left > e_lower][::-1])
|
||||
e_right = e + g*_RESONANCE_ENERGY_GRID[1:]
|
||||
energies.append(e_right[e_right < e_upper])
|
||||
|
||||
# Concatenate all points
|
||||
energies = np.concatenate(energies)
|
||||
|
||||
# Create 1000 equal log-spaced energies over RRR, combine with
|
||||
# resonance peaks and half-height energies
|
||||
e_log = np.logspace(log10(e_min), log10(e_max), 1000)
|
||||
energies = np.union1d(e_log, energies)
|
||||
|
||||
# Linearize and thin cross section
|
||||
xi, yi = linearize(energies, data[2].xs['0K'])
|
||||
xi, yi = thin(xi, yi)
|
||||
|
||||
# If there are multiple resolved resonance ranges (e.g. Pu239 in
|
||||
# ENDF/B-VII.1), combine them
|
||||
x = np.concatenate((x, xi))
|
||||
y = np.concatenate((y, yi))
|
||||
else:
|
||||
energies = data[2].xs['0K'].x
|
||||
x, y = linearize(energies, data[2].xs['0K'])
|
||||
x, y = thin(x, y)
|
||||
|
||||
# Set 0K energy grid and elastic scattering cross section
|
||||
self.energy['0K'] = x
|
||||
self[2].xs['0K'] = Tabulated1D(x, y)
|
||||
|
||||
def get_reaction_components(self, mt):
|
||||
"""Determine what reactions make up summed reaction.
|
||||
|
||||
|
|
@ -411,12 +509,22 @@ class IncidentNeutron(EqualityMixin):
|
|||
for temperature in self.temperatures:
|
||||
eg.create_dataset(temperature, data=self.energy[temperature])
|
||||
|
||||
# Write 0K energy grid if needed
|
||||
if '0K' in self.energy and '0K' not in eg:
|
||||
eg.create_dataset('0K', data=self.energy['0K'])
|
||||
|
||||
# Write reaction data
|
||||
rxs_group = g.create_group('reactions')
|
||||
for rx in self.reactions.values():
|
||||
rx_group = rxs_group.create_group('reaction_{:03}'.format(rx.mt))
|
||||
rx.to_hdf5(rx_group)
|
||||
|
||||
# Write 0K elastic scattering if needed
|
||||
if '0K' in rx.xs and '0K' not in rx_group:
|
||||
group = rx_group.create_group('0K')
|
||||
dset = group.create_dataset('xs', data=rx.xs['0K'].y)
|
||||
dset.attrs['threshold_idx'] = 1
|
||||
|
||||
# Write total nu data if available
|
||||
if len(rx.derived_products) > 0 and 'total_nu' not in g:
|
||||
tgroup = g.create_group('total_nu')
|
||||
|
|
@ -673,7 +781,7 @@ class IncidentNeutron(EqualityMixin):
|
|||
atomic_weight_ratio, temperature)
|
||||
|
||||
if (2, 151) in ev.section:
|
||||
data.resonances = Resonances.from_endf(ev)
|
||||
data.resonances = res.Resonances.from_endf(ev)
|
||||
|
||||
# Read each reaction
|
||||
for mf, mt, nc, mod in ev.reaction_list:
|
||||
|
|
@ -682,7 +790,7 @@ class IncidentNeutron(EqualityMixin):
|
|||
|
||||
# Replace cross sections for elastic, capture, fission
|
||||
try:
|
||||
if any(isinstance(r, _RESOLVED) for r in data.resonances):
|
||||
if any(isinstance(r, res._RESOLVED) for r in data.resonances):
|
||||
for mt in (2, 102, 18):
|
||||
if mt in data.reactions:
|
||||
rx = data.reactions[mt]
|
||||
|
|
|
|||
629
openmc/examples.py
Normal file
629
openmc/examples.py
Normal file
|
|
@ -0,0 +1,629 @@
|
|||
import numpy as np
|
||||
|
||||
import openmc
|
||||
import openmc.model
|
||||
|
||||
|
||||
def pwr_pin_cell():
|
||||
"""Create a PWR pin-cell model.
|
||||
|
||||
This model is a single fuel pin with 2.4 w/o enriched UO2 corresponding to a
|
||||
beginning-of-cycle condition and borated water. The specifications are from
|
||||
the `BEAVRS <http://crpg.mit.edu/research/beavrs>`_ benchmark. Note that the
|
||||
number of particles/batches is initially set very low for testing purposes.
|
||||
|
||||
Returns
|
||||
-------
|
||||
model : openmc.model.Model
|
||||
A PWR pin-cell model
|
||||
|
||||
"""
|
||||
model = openmc.model.Model()
|
||||
|
||||
# Define materials.
|
||||
fuel = openmc.Material(name='UO2 (2.4%)')
|
||||
fuel.set_density('g/cm3', 10.29769)
|
||||
fuel.add_nuclide("U234", 4.4843e-6)
|
||||
fuel.add_nuclide("U235", 5.5815e-4)
|
||||
fuel.add_nuclide("U238", 2.2408e-2)
|
||||
fuel.add_nuclide("O16", 4.5829e-2)
|
||||
|
||||
clad = openmc.Material(name='Zircaloy')
|
||||
clad.set_density('g/cm3', 6.55)
|
||||
clad.add_nuclide("Zr90", 2.1827e-2)
|
||||
clad.add_nuclide("Zr91", 4.7600e-3)
|
||||
clad.add_nuclide("Zr92", 7.2758e-3)
|
||||
clad.add_nuclide("Zr94", 7.3734e-3)
|
||||
clad.add_nuclide("Zr96", 1.1879e-3)
|
||||
|
||||
hot_water = openmc.Material(name='Hot borated water')
|
||||
hot_water.set_density('g/cm3', 0.740582)
|
||||
hot_water.add_nuclide("H1", 4.9457e-2)
|
||||
hot_water.add_nuclide("O16", 2.4672e-2)
|
||||
hot_water.add_nuclide("B10", 8.0042e-6)
|
||||
hot_water.add_nuclide("B11", 3.2218e-5)
|
||||
hot_water.add_s_alpha_beta('c_H_in_H2O')
|
||||
|
||||
# Define the materials file.
|
||||
model.materials = (fuel, clad, hot_water)
|
||||
|
||||
# Instantiate ZCylinder surfaces
|
||||
pitch = 1.26
|
||||
fuel_or = openmc.ZCylinder(x0=0, y0=0, R=0.39218, name='Fuel OR')
|
||||
clad_or = openmc.ZCylinder(x0=0, y0=0, R=0.45720, name='Clad OR')
|
||||
left = openmc.XPlane(x0=-pitch/2, name='left', boundary_type='reflective')
|
||||
right = openmc.XPlane(x0=pitch/2, name='right', boundary_type='reflective')
|
||||
bottom = openmc.YPlane(y0=-pitch/2, name='bottom',
|
||||
boundary_type='reflective')
|
||||
top = openmc.YPlane(y0=pitch/2, name='top', boundary_type='reflective')
|
||||
|
||||
# Instantiate Cells
|
||||
fuel_pin = openmc.Cell(name='Fuel', fill=fuel)
|
||||
cladding = openmc.Cell(name='Cladding', fill=clad)
|
||||
water = openmc.Cell(name='Water', fill=hot_water)
|
||||
|
||||
# Use surface half-spaces to define regions
|
||||
fuel_pin.region = -fuel_or
|
||||
cladding.region = +fuel_or & -clad_or
|
||||
water.region = +clad_or & +left & -right & +bottom & -top
|
||||
|
||||
# Create root universe
|
||||
model.geometry.root_universe = openmc.Universe(0, name='root universe')
|
||||
model.geometry.root_universe.add_cells([fuel_pin, cladding, water])
|
||||
|
||||
model.settings.batches = 10
|
||||
model.settings.inactive = 5
|
||||
model.settings.particles = 100
|
||||
model.settings.source = openmc.Source(space=openmc.stats.Box(
|
||||
[-pitch/2, -pitch/2, -1], [pitch/2, pitch/2, 1], only_fissionable=True))
|
||||
|
||||
plot = openmc.Plot.from_geometry(model.geometry)
|
||||
plot.pixels = (300, 300)
|
||||
plot.color_by = 'material'
|
||||
model.plots.append(plot)
|
||||
|
||||
return model
|
||||
|
||||
|
||||
def pwr_core():
|
||||
"""Create a PWR full-core model.
|
||||
|
||||
This model is the OECD/NEA Monte Carlo Performance benchmark which is a
|
||||
grossly simplified pressurized water reactor (PWR) with 241 fuel
|
||||
assemblies. Note that the number of particles/batches is initially set very
|
||||
low for testing purposes.
|
||||
|
||||
Returns
|
||||
-------
|
||||
model : openmc.model.Model
|
||||
Full-core PWR model
|
||||
|
||||
"""
|
||||
model = openmc.model.Model()
|
||||
|
||||
# Define materials.
|
||||
fuel = openmc.Material(1, name='UOX fuel')
|
||||
fuel.set_density('g/cm3', 10.062)
|
||||
fuel.add_nuclide("U234", 4.9476e-6)
|
||||
fuel.add_nuclide("U235", 4.8218e-4)
|
||||
fuel.add_nuclide("U238", 2.1504e-2)
|
||||
fuel.add_nuclide("Xe135", 1.0801e-8)
|
||||
fuel.add_nuclide("O16", 4.5737e-2)
|
||||
|
||||
clad = openmc.Material(2, name='Zircaloy')
|
||||
clad.set_density('g/cm3', 5.77)
|
||||
clad.add_nuclide("Zr90", 0.5145)
|
||||
clad.add_nuclide("Zr91", 0.1122)
|
||||
clad.add_nuclide("Zr92", 0.1715)
|
||||
clad.add_nuclide("Zr94", 0.1738)
|
||||
clad.add_nuclide("Zr96", 0.0280)
|
||||
|
||||
cold_water = openmc.Material(3, name='Cold borated water')
|
||||
cold_water.set_density('atom/b-cm', 0.07416)
|
||||
cold_water.add_nuclide("H1", 2.0)
|
||||
cold_water.add_nuclide("O16", 1.0)
|
||||
cold_water.add_nuclide("B10", 6.490e-4)
|
||||
cold_water.add_nuclide("B11", 2.689e-3)
|
||||
cold_water.add_s_alpha_beta('c_H_in_H2O')
|
||||
|
||||
hot_water = openmc.Material(4, name='Hot borated water')
|
||||
hot_water.set_density('atom/b-cm', 0.06614)
|
||||
hot_water.add_nuclide("H1", 2.0)
|
||||
hot_water.add_nuclide("O16", 1.0)
|
||||
hot_water.add_nuclide("B10", 6.490e-4)
|
||||
hot_water.add_nuclide("B11", 2.689e-3)
|
||||
hot_water.add_s_alpha_beta('c_H_in_H2O')
|
||||
|
||||
rpv_steel = openmc.Material(5, name='Reactor pressure vessel steel')
|
||||
rpv_steel.set_density('g/cm3', 7.9)
|
||||
rpv_steel.add_nuclide("Fe54", 0.05437098, 'wo')
|
||||
rpv_steel.add_nuclide("Fe56", 0.88500663, 'wo')
|
||||
rpv_steel.add_nuclide("Fe57", 0.0208008, 'wo')
|
||||
rpv_steel.add_nuclide("Fe58", 0.00282159, 'wo')
|
||||
rpv_steel.add_nuclide("Ni58", 0.0067198, 'wo')
|
||||
rpv_steel.add_nuclide("Ni60", 0.0026776, 'wo')
|
||||
rpv_steel.add_nuclide("Mn55", 0.01, 'wo')
|
||||
rpv_steel.add_nuclide("Cr52", 0.002092475, 'wo')
|
||||
rpv_steel.add_nuclide("C0", 0.0025, 'wo')
|
||||
rpv_steel.add_nuclide("Cu63", 0.0013696, 'wo')
|
||||
|
||||
lower_rad_ref = openmc.Material(6, name='Lower radial reflector')
|
||||
lower_rad_ref.set_density('g/cm3', 4.32)
|
||||
lower_rad_ref.add_nuclide("H1", 0.0095661, 'wo')
|
||||
lower_rad_ref.add_nuclide("O16", 0.0759107, 'wo')
|
||||
lower_rad_ref.add_nuclide("B10", 3.08409e-5, 'wo')
|
||||
lower_rad_ref.add_nuclide("B11", 1.40499e-4, 'wo')
|
||||
lower_rad_ref.add_nuclide("Fe54", 0.035620772088, 'wo')
|
||||
lower_rad_ref.add_nuclide("Fe56", 0.579805982228, 'wo')
|
||||
lower_rad_ref.add_nuclide("Fe57", 0.01362750048, 'wo')
|
||||
lower_rad_ref.add_nuclide("Fe58", 0.001848545204, 'wo')
|
||||
lower_rad_ref.add_nuclide("Ni58", 0.055298376566, 'wo')
|
||||
lower_rad_ref.add_nuclide("Mn55", 0.0182870, 'wo')
|
||||
lower_rad_ref.add_nuclide("Cr52", 0.145407678031, 'wo')
|
||||
lower_rad_ref.add_s_alpha_beta('c_H_in_H2O')
|
||||
|
||||
upper_rad_ref = openmc.Material(7, name='Upper radial reflector / Top plate region')
|
||||
upper_rad_ref.set_density('g/cm3', 4.28)
|
||||
upper_rad_ref.add_nuclide("H1", 0.0086117, 'wo')
|
||||
upper_rad_ref.add_nuclide("O16", 0.0683369, 'wo')
|
||||
upper_rad_ref.add_nuclide("B10", 2.77638e-5, 'wo')
|
||||
upper_rad_ref.add_nuclide("B11", 1.26481e-4, 'wo')
|
||||
upper_rad_ref.add_nuclide("Fe54", 0.035953677186, 'wo')
|
||||
upper_rad_ref.add_nuclide("Fe56", 0.585224740891, 'wo')
|
||||
upper_rad_ref.add_nuclide("Fe57", 0.01375486056, 'wo')
|
||||
upper_rad_ref.add_nuclide("Fe58", 0.001865821363, 'wo')
|
||||
upper_rad_ref.add_nuclide("Ni58", 0.055815129186, 'wo')
|
||||
upper_rad_ref.add_nuclide("Mn55", 0.0184579, 'wo')
|
||||
upper_rad_ref.add_nuclide("Cr52", 0.146766614995, 'wo')
|
||||
upper_rad_ref.add_s_alpha_beta('c_H_in_H2O')
|
||||
|
||||
bot_plate = openmc.Material(8, name='Bottom plate region')
|
||||
bot_plate.set_density('g/cm3', 7.184)
|
||||
bot_plate.add_nuclide("H1", 0.0011505, 'wo')
|
||||
bot_plate.add_nuclide("O16", 0.0091296, 'wo')
|
||||
bot_plate.add_nuclide("B10", 3.70915e-6, 'wo')
|
||||
bot_plate.add_nuclide("B11", 1.68974e-5, 'wo')
|
||||
bot_plate.add_nuclide("Fe54", 0.03855611055, 'wo')
|
||||
bot_plate.add_nuclide("Fe56", 0.627585036425, 'wo')
|
||||
bot_plate.add_nuclide("Fe57", 0.014750478, 'wo')
|
||||
bot_plate.add_nuclide("Fe58", 0.002000875025, 'wo')
|
||||
bot_plate.add_nuclide("Ni58", 0.059855207342, 'wo')
|
||||
bot_plate.add_nuclide("Mn55", 0.0197940, 'wo')
|
||||
bot_plate.add_nuclide("Cr52", 0.157390026871, 'wo')
|
||||
bot_plate.add_s_alpha_beta('c_H_in_H2O')
|
||||
|
||||
bot_nozzle = openmc.Material(9, name='Bottom nozzle region')
|
||||
bot_nozzle.set_density('g/cm3', 2.53)
|
||||
bot_nozzle.add_nuclide("H1", 0.0245014, 'wo')
|
||||
bot_nozzle.add_nuclide("O16", 0.1944274, 'wo')
|
||||
bot_nozzle.add_nuclide("B10", 7.89917e-5, 'wo')
|
||||
bot_nozzle.add_nuclide("B11", 3.59854e-4, 'wo')
|
||||
bot_nozzle.add_nuclide("Fe54", 0.030411411144, 'wo')
|
||||
bot_nozzle.add_nuclide("Fe56", 0.495012237964, 'wo')
|
||||
bot_nozzle.add_nuclide("Fe57", 0.01163454624, 'wo')
|
||||
bot_nozzle.add_nuclide("Fe58", 0.001578204652, 'wo')
|
||||
bot_nozzle.add_nuclide("Ni58", 0.047211231662, 'wo')
|
||||
bot_nozzle.add_nuclide("Mn55", 0.0156126, 'wo')
|
||||
bot_nozzle.add_nuclide("Cr52", 0.124142524198, 'wo')
|
||||
bot_nozzle.add_s_alpha_beta('c_H_in_H2O')
|
||||
|
||||
top_nozzle = openmc.Material(10, name='Top nozzle region')
|
||||
top_nozzle.set_density('g/cm3', 1.746)
|
||||
top_nozzle.add_nuclide("H1", 0.0358870, 'wo')
|
||||
top_nozzle.add_nuclide("O16", 0.2847761, 'wo')
|
||||
top_nozzle.add_nuclide("B10", 1.15699e-4, 'wo')
|
||||
top_nozzle.add_nuclide("B11", 5.27075e-4, 'wo')
|
||||
top_nozzle.add_nuclide("Fe54", 0.02644016154, 'wo')
|
||||
top_nozzle.add_nuclide("Fe56", 0.43037146399, 'wo')
|
||||
top_nozzle.add_nuclide("Fe57", 0.0101152584, 'wo')
|
||||
top_nozzle.add_nuclide("Fe58", 0.00137211607, 'wo')
|
||||
top_nozzle.add_nuclide("Ni58", 0.04104621835, 'wo')
|
||||
top_nozzle.add_nuclide("Mn55", 0.0135739, 'wo')
|
||||
top_nozzle.add_nuclide("Cr52", 0.107931450781, 'wo')
|
||||
top_nozzle.add_s_alpha_beta('c_H_in_H2O')
|
||||
|
||||
top_fa = openmc.Material(11, name='Top of fuel assemblies')
|
||||
top_fa.set_density('g/cm3', 3.044)
|
||||
top_fa.add_nuclide("H1", 0.0162913, 'wo')
|
||||
top_fa.add_nuclide("O16", 0.1292776, 'wo')
|
||||
top_fa.add_nuclide("B10", 5.25228e-5, 'wo')
|
||||
top_fa.add_nuclide("B11", 2.39272e-4, 'wo')
|
||||
top_fa.add_nuclide("Zr90", 0.43313403903, 'wo')
|
||||
top_fa.add_nuclide("Zr91", 0.09549277374, 'wo')
|
||||
top_fa.add_nuclide("Zr92", 0.14759527104, 'wo')
|
||||
top_fa.add_nuclide("Zr94", 0.15280552077, 'wo')
|
||||
top_fa.add_nuclide("Zr96", 0.02511169542, 'wo')
|
||||
top_fa.add_s_alpha_beta('c_H_in_H2O')
|
||||
|
||||
bot_fa = openmc.Material(12, name='Bottom of fuel assemblies')
|
||||
bot_fa.set_density('g/cm3', 1.762)
|
||||
bot_fa.add_nuclide("H1", 0.0292856, 'wo')
|
||||
bot_fa.add_nuclide("O16", 0.2323919, 'wo')
|
||||
bot_fa.add_nuclide("B10", 9.44159e-5, 'wo')
|
||||
bot_fa.add_nuclide("B11", 4.30120e-4, 'wo')
|
||||
bot_fa.add_nuclide("Zr90", 0.3741373658, 'wo')
|
||||
bot_fa.add_nuclide("Zr91", 0.0824858164, 'wo')
|
||||
bot_fa.add_nuclide("Zr92", 0.1274914944, 'wo')
|
||||
bot_fa.add_nuclide("Zr94", 0.1319920622, 'wo')
|
||||
bot_fa.add_nuclide("Zr96", 0.0216912612, 'wo')
|
||||
bot_fa.add_s_alpha_beta('c_H_in_H2O')
|
||||
|
||||
# Define the materials file.
|
||||
model.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)
|
||||
s2 = openmc.ZCylinder(R=0.475, surface_id=2)
|
||||
s3 = openmc.ZCylinder(R=0.56, surface_id=3)
|
||||
s4 = openmc.ZCylinder(R=0.62, surface_id=4)
|
||||
s5 = openmc.ZCylinder(R=187.6, surface_id=5)
|
||||
s6 = openmc.ZCylinder(R=209.0, surface_id=6)
|
||||
s7 = openmc.ZCylinder(R=229.0, surface_id=7)
|
||||
s8 = openmc.ZCylinder(R=249.0, surface_id=8, boundary_type='vacuum')
|
||||
|
||||
s31 = openmc.ZPlane(z0=-229.0, surface_id=31, boundary_type='vacuum')
|
||||
s32 = openmc.ZPlane(z0=-199.0, surface_id=32)
|
||||
s33 = openmc.ZPlane(z0=-193.0, surface_id=33)
|
||||
s34 = openmc.ZPlane(z0=-183.0, surface_id=34)
|
||||
s35 = openmc.ZPlane(z0=0.0, surface_id=35)
|
||||
s36 = openmc.ZPlane(z0=183.0, surface_id=36)
|
||||
s37 = openmc.ZPlane(z0=203.0, surface_id=37)
|
||||
s38 = openmc.ZPlane(z0=215.0, surface_id=38)
|
||||
s39 = openmc.ZPlane(z0=223.0, surface_id=39, boundary_type='vacuum')
|
||||
|
||||
# Define pin cells.
|
||||
fuel_cold = openmc.Universe(name='Fuel pin, cladding, cold water',
|
||||
universe_id=1)
|
||||
c21 = openmc.Cell(cell_id=21, fill=fuel, region=-s1)
|
||||
c22 = openmc.Cell(cell_id=22, fill=clad, region=+s1 & -s2)
|
||||
c23 = openmc.Cell(cell_id=23, fill=cold_water, region=+s2)
|
||||
fuel_cold.add_cells((c21, c22, c23))
|
||||
|
||||
tube_cold = openmc.Universe(name='Instrumentation guide tube, '
|
||||
'cold water', universe_id=2)
|
||||
c24 = openmc.Cell(cell_id=24, fill=cold_water, region=-s3)
|
||||
c25 = openmc.Cell(cell_id=25, fill=clad, region=+s3 & -s4)
|
||||
c26 = openmc.Cell(cell_id=26, fill=cold_water, region=+s4)
|
||||
tube_cold.add_cells((c24, c25, c26))
|
||||
|
||||
fuel_hot = openmc.Universe(name='Fuel pin, cladding, hot water',
|
||||
universe_id=3)
|
||||
c27 = openmc.Cell(cell_id=27, fill=fuel, region=-s1)
|
||||
c28 = openmc.Cell(cell_id=28, fill=clad, region=+s1 & -s2)
|
||||
c29 = openmc.Cell(cell_id=29, fill=hot_water, region=+s2)
|
||||
fuel_hot.add_cells((c27, c28, c29))
|
||||
|
||||
tube_hot = openmc.Universe(name='Instrumentation guide tube, hot water',
|
||||
universe_id=4)
|
||||
c30 = openmc.Cell(cell_id=30, fill=hot_water, region=-s3)
|
||||
c31 = openmc.Cell(cell_id=31, fill=clad, region=+s3 & -s4)
|
||||
c32 = openmc.Cell(cell_id=32, fill=hot_water, region=+s4)
|
||||
tube_hot.add_cells((c30, c31, c32))
|
||||
|
||||
# Set positions occupied by guide tubes
|
||||
tube_x = np.array([5, 8, 11, 3, 13, 2, 5, 8, 11, 14, 2, 5, 8, 11, 14,
|
||||
2, 5, 8, 11, 14, 3, 13, 5, 8, 11])
|
||||
tube_y = np.array([2, 2, 2, 3, 3, 5, 5, 5, 5, 5, 8, 8, 8, 8, 8,
|
||||
11, 11, 11, 11, 11, 13, 13, 14, 14, 14])
|
||||
|
||||
# Define fuel lattices.
|
||||
l100 = openmc.RectLattice(name='Fuel assembly (lower half)', lattice_id=100)
|
||||
l100.lower_left = (-10.71, -10.71)
|
||||
l100.pitch = (1.26, 1.26)
|
||||
l100.universes = np.tile(fuel_cold, (17, 17))
|
||||
l100.universes[tube_x, tube_y] = tube_cold
|
||||
|
||||
l101 = openmc.RectLattice(name='Fuel assembly (upper half)', lattice_id=101)
|
||||
l101.lower_left = (-10.71, -10.71)
|
||||
l101.pitch = (1.26, 1.26)
|
||||
l101.universes = np.tile(fuel_hot, (17, 17))
|
||||
l101.universes[tube_x, tube_y] = tube_hot
|
||||
|
||||
# Define assemblies.
|
||||
fa_cw = openmc.Universe(name='Water assembly (cold)', universe_id=5)
|
||||
c50 = openmc.Cell(cell_id=50, fill=cold_water, region=+s34 & -s35)
|
||||
fa_cw.add_cell(c50)
|
||||
|
||||
fa_hw = openmc.Universe(name='Water assembly (hot)', universe_id=7)
|
||||
c70 = openmc.Cell(cell_id=70, fill=hot_water, region=+s35 & -s36)
|
||||
fa_hw.add_cell(c70)
|
||||
|
||||
fa_cold = openmc.Universe(name='Fuel assembly (cold)', universe_id=6)
|
||||
c60 = openmc.Cell(cell_id=60, fill=l100, region=+s34 & -s35)
|
||||
fa_cold.add_cell(c60)
|
||||
|
||||
fa_hot = openmc.Universe(name='Fuel assembly (hot)', universe_id=8)
|
||||
c80 = openmc.Cell(cell_id=80, fill=l101, region=+s35 & -s36)
|
||||
fa_hot.add_cell(c80)
|
||||
|
||||
# Define core lattices
|
||||
l200 = openmc.RectLattice(name='Core lattice (lower half)', lattice_id=200)
|
||||
l200.lower_left = (-224.91, -224.91)
|
||||
l200.pitch = (21.42, 21.42)
|
||||
l200.universes = [
|
||||
[fa_cw]*21,
|
||||
[fa_cw]*21,
|
||||
[fa_cw]*7 + [fa_cold]*7 + [fa_cw]*7,
|
||||
[fa_cw]*5 + [fa_cold]*11 + [fa_cw]*5,
|
||||
[fa_cw]*4 + [fa_cold]*13 + [fa_cw]*4,
|
||||
[fa_cw]*3 + [fa_cold]*15 + [fa_cw]*3,
|
||||
[fa_cw]*3 + [fa_cold]*15 + [fa_cw]*3,
|
||||
[fa_cw]*2 + [fa_cold]*17 + [fa_cw]*2,
|
||||
[fa_cw]*2 + [fa_cold]*17 + [fa_cw]*2,
|
||||
[fa_cw]*2 + [fa_cold]*17 + [fa_cw]*2,
|
||||
[fa_cw]*2 + [fa_cold]*17 + [fa_cw]*2,
|
||||
[fa_cw]*2 + [fa_cold]*17 + [fa_cw]*2,
|
||||
[fa_cw]*2 + [fa_cold]*17 + [fa_cw]*2,
|
||||
[fa_cw]*2 + [fa_cold]*17 + [fa_cw]*2,
|
||||
[fa_cw]*3 + [fa_cold]*15 + [fa_cw]*3,
|
||||
[fa_cw]*3 + [fa_cold]*15 + [fa_cw]*3,
|
||||
[fa_cw]*4 + [fa_cold]*13 + [fa_cw]*4,
|
||||
[fa_cw]*5 + [fa_cold]*11 + [fa_cw]*5,
|
||||
[fa_cw]*7 + [fa_cold]*7 + [fa_cw]*7,
|
||||
[fa_cw]*21,
|
||||
[fa_cw]*21]
|
||||
|
||||
l201 = openmc.RectLattice(name='Core lattice (lower half)', lattice_id=201)
|
||||
l201.lower_left = (-224.91, -224.91)
|
||||
l201.pitch = (21.42, 21.42)
|
||||
l201.universes = [
|
||||
[fa_hw]*21,
|
||||
[fa_hw]*21,
|
||||
[fa_hw]*7 + [fa_hot]*7 + [fa_hw]*7,
|
||||
[fa_hw]*5 + [fa_hot]*11 + [fa_hw]*5,
|
||||
[fa_hw]*4 + [fa_hot]*13 + [fa_hw]*4,
|
||||
[fa_hw]*3 + [fa_hot]*15 + [fa_hw]*3,
|
||||
[fa_hw]*3 + [fa_hot]*15 + [fa_hw]*3,
|
||||
[fa_hw]*2 + [fa_hot]*17 + [fa_hw]*2,
|
||||
[fa_hw]*2 + [fa_hot]*17 + [fa_hw]*2,
|
||||
[fa_hw]*2 + [fa_hot]*17 + [fa_hw]*2,
|
||||
[fa_hw]*2 + [fa_hot]*17 + [fa_hw]*2,
|
||||
[fa_hw]*2 + [fa_hot]*17 + [fa_hw]*2,
|
||||
[fa_hw]*2 + [fa_hot]*17 + [fa_hw]*2,
|
||||
[fa_hw]*2 + [fa_hot]*17 + [fa_hw]*2,
|
||||
[fa_hw]*3 + [fa_hot]*15 + [fa_hw]*3,
|
||||
[fa_hw]*3 + [fa_hot]*15 + [fa_hw]*3,
|
||||
[fa_hw]*4 + [fa_hot]*13 + [fa_hw]*4,
|
||||
[fa_hw]*5 + [fa_hot]*11 + [fa_hw]*5,
|
||||
[fa_hw]*7 + [fa_hot]*7 + [fa_hw]*7,
|
||||
[fa_hw]*21,
|
||||
[fa_hw]*21]
|
||||
|
||||
# Define root universe.
|
||||
root = openmc.Universe(universe_id=0, name='root universe')
|
||||
c1 = openmc.Cell(cell_id=1, fill=l200, region=-s6 & +s34 & -s35)
|
||||
c2 = openmc.Cell(cell_id=2, fill=l201, region=-s6 & +s35 & -s36)
|
||||
c3 = openmc.Cell(cell_id=3, fill=bot_plate, region=-s7 & +s31 & -s32)
|
||||
c4 = openmc.Cell(cell_id=4, fill=bot_nozzle, region=-s5 & +s32 & -s33)
|
||||
c5 = openmc.Cell(cell_id=5, fill=bot_fa, region=-s5 & +s33 & -s34)
|
||||
c6 = openmc.Cell(cell_id=6, fill=top_fa, region=-s5 & +s36 & -s37)
|
||||
c7 = openmc.Cell(cell_id=7, fill=top_nozzle, region=-s5 & +s37 & -s38)
|
||||
c8 = openmc.Cell(cell_id=8, fill=upper_rad_ref, region=-s7 & +s38 & -s39)
|
||||
c9 = openmc.Cell(cell_id=9, fill=bot_nozzle, region=+s6 & -s7 & +s32 & -s38)
|
||||
c10 = openmc.Cell(cell_id=10, fill=rpv_steel, region=+s7 & -s8 & +s31 & -s39)
|
||||
c11 = openmc.Cell(cell_id=11, fill=lower_rad_ref, region=+s5 & -s6 & +s32 & -s34)
|
||||
c12 = openmc.Cell(cell_id=12, fill=upper_rad_ref, region=+s5 & -s6 & +s36 & -s38)
|
||||
root.add_cells((c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12))
|
||||
|
||||
# Assign root universe to geometry
|
||||
model.geometry.root_universe = root
|
||||
|
||||
model.settings.batches = 10
|
||||
model.settings.inactive = 5
|
||||
model.settings.particles = 100
|
||||
model.settings.source = openmc.Source(space=openmc.stats.Box(
|
||||
[-160, -160, -183], [160, 160, 183]))
|
||||
|
||||
plot = openmc.Plot()
|
||||
plot.origin = (125, 125, 0)
|
||||
plot.width = (250, 250)
|
||||
plot.pixels = (3000, 3000)
|
||||
plot.color_by = 'material'
|
||||
model.plots.append(plot)
|
||||
|
||||
return model
|
||||
|
||||
|
||||
def pwr_assembly():
|
||||
"""Create a PWR assembly model.
|
||||
|
||||
This model is a reflected 17x17 fuel assembly from the the `BEAVRS
|
||||
<http://crpg.mit.edu/research/beavrs>`_ benchmark. The fuel is 2.4 w/o
|
||||
enriched UO2 corresponding to a beginning-of-cycle condition. Note that the
|
||||
number of particles/batches is initially set very low for testing purposes.
|
||||
|
||||
Returns
|
||||
-------
|
||||
model : openmc.model.Model
|
||||
A PWR assembly model
|
||||
|
||||
"""
|
||||
|
||||
model = openmc.model.Model()
|
||||
|
||||
# Define materials.
|
||||
fuel = openmc.Material(name='Fuel')
|
||||
fuel.set_density('g/cm3', 10.29769)
|
||||
fuel.add_nuclide("U234", 4.4843e-6)
|
||||
fuel.add_nuclide("U235", 5.5815e-4)
|
||||
fuel.add_nuclide("U238", 2.2408e-2)
|
||||
fuel.add_nuclide("O16", 4.5829e-2)
|
||||
|
||||
clad = openmc.Material(name='Cladding')
|
||||
clad.set_density('g/cm3', 6.55)
|
||||
clad.add_nuclide("Zr90", 2.1827e-2)
|
||||
clad.add_nuclide("Zr91", 4.7600e-3)
|
||||
clad.add_nuclide("Zr92", 7.2758e-3)
|
||||
clad.add_nuclide("Zr94", 7.3734e-3)
|
||||
clad.add_nuclide("Zr96", 1.1879e-3)
|
||||
|
||||
hot_water = openmc.Material(name='Hot borated water')
|
||||
hot_water.set_density('g/cm3', 0.740582)
|
||||
hot_water.add_nuclide("H1", 4.9457e-2)
|
||||
hot_water.add_nuclide("O16", 2.4672e-2)
|
||||
hot_water.add_nuclide("B10", 8.0042e-6)
|
||||
hot_water.add_nuclide("B11", 3.2218e-5)
|
||||
hot_water.add_s_alpha_beta('c_H_in_H2O')
|
||||
|
||||
# Define the materials file.
|
||||
model.materials = (fuel, clad, hot_water)
|
||||
|
||||
# Instantiate ZCylinder surfaces
|
||||
fuel_or = openmc.ZCylinder(x0=0, y0=0, R=0.39218, name='Fuel OR')
|
||||
clad_or = openmc.ZCylinder(x0=0, y0=0, R=0.45720, name='Clad OR')
|
||||
|
||||
# Create boundary planes to surround the geometry
|
||||
pitch = 21.42
|
||||
min_x = openmc.XPlane(x0=-pitch/2, boundary_type='reflective')
|
||||
max_x = openmc.XPlane(x0=+pitch/2, boundary_type='reflective')
|
||||
min_y = openmc.YPlane(y0=-pitch/2, boundary_type='reflective')
|
||||
max_y = openmc.YPlane(y0=+pitch/2, boundary_type='reflective')
|
||||
|
||||
# Create a fuel pin universe
|
||||
fuel_pin_universe = openmc.Universe(name='Fuel Pin')
|
||||
fuel_cell = openmc.Cell(name='fuel', fill=fuel, region=-fuel_or)
|
||||
clad_cell = openmc.Cell(name='clad', fill=clad, region=+fuel_or & -clad_or)
|
||||
hot_water_cell = openmc.Cell(name='hot water', fill=hot_water, region=+clad_or)
|
||||
fuel_pin_universe.add_cells([fuel_cell, clad_cell, hot_water_cell])
|
||||
|
||||
|
||||
# Create a control rod guide tube universe
|
||||
guide_tube_universe = openmc.Universe(name='Guide Tube')
|
||||
gt_inner_cell = openmc.Cell(name='guide tube inner water', fill=hot_water,
|
||||
region=-fuel_or)
|
||||
gt_clad_cell = openmc.Cell(name='guide tube clad', fill=clad,
|
||||
region=+fuel_or & -clad_or)
|
||||
gt_outer_cell = openmc.Cell(name='guide tube outer water', fill=hot_water,
|
||||
region=+clad_or)
|
||||
guide_tube_universe.add_cells([gt_inner_cell, gt_clad_cell, gt_outer_cell])
|
||||
|
||||
# Create fuel assembly Lattice
|
||||
assembly = openmc.RectLattice(name='Fuel Assembly')
|
||||
assembly.pitch = (pitch/17, pitch/17)
|
||||
assembly.lower_left = (-pitch/2, -pitch/2)
|
||||
|
||||
# Create array indices for guide tube locations in lattice
|
||||
template_x = np.array([5, 8, 11, 3, 13, 2, 5, 8, 11, 14, 2, 5, 8,
|
||||
11, 14, 2, 5, 8, 11, 14, 3, 13, 5, 8, 11])
|
||||
template_y = np.array([2, 2, 2, 3, 3, 5, 5, 5, 5, 5, 8, 8, 8, 8,
|
||||
8, 11, 11, 11, 11, 11, 13, 13, 14, 14, 14])
|
||||
|
||||
# Create 17x17 array of universes
|
||||
assembly.universes = np.tile(fuel_pin_universe, (17, 17))
|
||||
assembly.universes[template_x, template_y] = guide_tube_universe
|
||||
|
||||
# Create root Cell
|
||||
root_cell = openmc.Cell(name='root cell', fill=assembly)
|
||||
root_cell.region = +min_x & -max_x & +min_y & -max_y
|
||||
|
||||
# Create root Universe
|
||||
model.geometry.root_universe = openmc.Universe(name='root universe')
|
||||
model.geometry.root_universe.add_cell(root_cell)
|
||||
|
||||
model.settings.batches = 10
|
||||
model.settings.inactive = 5
|
||||
model.settings.particles = 100
|
||||
model.settings.source = openmc.Source(space=openmc.stats.Box(
|
||||
[-pitch/2, -pitch/2, -1], [pitch/2, pitch/2, 1], only_fissionable=True))
|
||||
|
||||
plot = openmc.Plot()
|
||||
plot.origin = (0.0, 0.0, 0)
|
||||
plot.width = (21.42, 21.42)
|
||||
plot.pixels = (300, 300)
|
||||
plot.color_by = 'material'
|
||||
model.plots.append(plot)
|
||||
|
||||
return model
|
||||
|
||||
|
||||
def slab_mg(reps=None, as_macro=True):
|
||||
"""Create a one-group, 1D slab model.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
reps : list, optional
|
||||
List of angular representations. Each item corresponds to materials and
|
||||
dictates the angular representation of the multi-group cross
|
||||
sections---isotropic ('iso') or angle-dependent ('ang'), and if Legendre
|
||||
scattering or tabular scattering ('mu') is used. Thus, items can be
|
||||
'ang', 'ang_mu', 'iso', or 'iso_mu'.
|
||||
|
||||
as_macro : bool, optional
|
||||
Whether :class:`openmc.Macroscopic` is used
|
||||
|
||||
Returns
|
||||
-------
|
||||
model : openmc.model.Model
|
||||
One-group, 1D slab model
|
||||
|
||||
"""
|
||||
model = openmc.model.Model()
|
||||
|
||||
# Define materials needed for 1D/1G slab problem
|
||||
mat_names = ['uo2', 'clad', 'lwtr']
|
||||
mgxs_reps = ['ang', 'ang_mu', 'iso', 'iso_mu']
|
||||
|
||||
if reps is None:
|
||||
reps = mgxs_reps
|
||||
|
||||
xs = []
|
||||
i = 0
|
||||
for mat in mat_names:
|
||||
for rep in reps:
|
||||
i += 1
|
||||
if as_macro:
|
||||
xs.append(openmc.Macroscopic(mat + '_' + rep))
|
||||
m = openmc.Material(name=str(i))
|
||||
m.set_density('macro', 1.)
|
||||
m.add_macroscopic(xs[-1])
|
||||
else:
|
||||
xs.append(openmc.Nuclide(mat + '_' + rep))
|
||||
m = openmc.Material(name=str(i))
|
||||
m.set_density('atom/b-cm', 1.)
|
||||
m.add_nuclide(xs[-1].name, 1.0, 'ao')
|
||||
model.materials.append(m)
|
||||
|
||||
# Define the materials file
|
||||
model.xs_data = xs
|
||||
model.materials.cross_sections = "../1d_mgxs.h5"
|
||||
|
||||
# Define surfaces.
|
||||
# Assembly/Problem Boundary
|
||||
left = openmc.XPlane(x0=0.0, boundary_type='reflective')
|
||||
right = openmc.XPlane(x0=10.0, boundary_type='reflective')
|
||||
bottom = openmc.YPlane(y0=0.0, boundary_type='reflective')
|
||||
top = openmc.YPlane(y0=10.0, boundary_type='reflective')
|
||||
|
||||
# for each material add a plane
|
||||
planes = [openmc.ZPlane(z0=0.0, boundary_type='reflective')]
|
||||
dz = round(5. / float(len(model.materials)), 4)
|
||||
for i in range(len(model.materials) - 1):
|
||||
planes.append(openmc.ZPlane(z0=dz * float(i + 1)))
|
||||
planes.append(openmc.ZPlane(z0=5.0, boundary_type='reflective'))
|
||||
|
||||
# Define cells for each material
|
||||
model.geometry.root_universe = openmc.Universe(name='root universe')
|
||||
xy = +left & -right & +bottom & -top
|
||||
for i, mat in enumerate(model.materials):
|
||||
c = openmc.Cell(fill=mat, region=xy & +planes[i] & -planes[i + 1])
|
||||
model.geometry.root_universe.add_cell(c)
|
||||
|
||||
model.settings.batches = 10
|
||||
model.settings.inactive = 5
|
||||
model.settings.particles = 100
|
||||
model.settings.source = openmc.Source(space=openmc.stats.Box(
|
||||
[0.0, 0.0, 0.0], [10.0, 10.0, 5.]))
|
||||
model.settings.energy_mode = "multi-group"
|
||||
|
||||
plot = openmc.Plot()
|
||||
plot.filename = 'mat'
|
||||
plot.origin = (5.0, 5.0, 2.5)
|
||||
plot.width = (2.5, 2.5)
|
||||
plot.basis = 'xz'
|
||||
plot.pixels = (3000, 3000)
|
||||
plot.color_by = 'material'
|
||||
model.plots.append(plot)
|
||||
|
||||
return model
|
||||
246
openmc/filter.py
246
openmc/filter.py
|
|
@ -136,7 +136,7 @@ class Filter(object):
|
|||
def __hash__(self):
|
||||
string = type(self).__name__ + '\n'
|
||||
string += '{: <16}=\t{}\n'.format('\tBins', self.bins)
|
||||
return hash(repr(string))
|
||||
return hash(string)
|
||||
|
||||
def __repr__(self):
|
||||
string = type(self).__name__ + '\n'
|
||||
|
|
@ -265,6 +265,7 @@ class Filter(object):
|
|||
|
||||
"""
|
||||
|
||||
|
||||
element = ET.Element('filter')
|
||||
element.set('id', str(self.id))
|
||||
element.set('type', self.short_name.lower())
|
||||
|
|
@ -473,22 +474,51 @@ class Filter(object):
|
|||
return df
|
||||
|
||||
|
||||
class IntegralFilter(Filter):
|
||||
"""Tally modifier that describes phase-space and other characteristics.
|
||||
class WithIDFilter(Filter):
|
||||
"""Abstract parent for filters of types with ids (Cell, Material, etc.)."""
|
||||
@property
|
||||
def num_bins(self):
|
||||
return len(self.bins)
|
||||
|
||||
# Since num_bins property is declared, also need a num_bins.setter, but
|
||||
# we don't want it to do anything since num_bins is completely determined
|
||||
# by len(self.bins). We also don't want to raise an error because that
|
||||
# makes importing from HDF5 more complicated.
|
||||
@num_bins.setter
|
||||
def num_bins(self, num_bins): pass
|
||||
|
||||
def _smart_set_bins(self, bins, bin_type):
|
||||
# Format the bins as a 1D numpy array.
|
||||
bins = np.atleast_1d(bins)
|
||||
|
||||
# Check the bin values.
|
||||
cv.check_iterable_type('filter bins', bins, (Integral, bin_type))
|
||||
for edge in bins:
|
||||
if isinstance(edge, Integral):
|
||||
cv.check_greater_than('filter bin', edge, 0, equality=True)
|
||||
|
||||
# Extract id values.
|
||||
bins = np.atleast_1d([b if isinstance(b, Integral) else b.id
|
||||
for b in bins])
|
||||
|
||||
self._bins = bins
|
||||
|
||||
|
||||
class UniverseFilter(WithIDFilter):
|
||||
"""Bins tally event locations based on the Universe they occured in.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
bins : Integral or Iterable of Integral
|
||||
The bins for the filter. This takes on different meaning for different
|
||||
filters. See the docstrings for sublcasses of this filter or the online
|
||||
documentation for more details.
|
||||
bins : openmc.Universe, Integral, or iterable thereof
|
||||
The Universes to tally. Either openmc.Universe objects or their
|
||||
Integral ID numbers can be used.
|
||||
filter_id : int
|
||||
Unique identifier for the filter
|
||||
|
||||
Attributes
|
||||
----------
|
||||
bins : Integral or Iterable of Integral
|
||||
The bins for the filter
|
||||
bins : Iterable of Integral
|
||||
openmc.Universe IDs.
|
||||
id : int
|
||||
Unique identifier for the filter
|
||||
num_bins : Integral
|
||||
|
|
@ -499,59 +529,28 @@ class IntegralFilter(Filter):
|
|||
|
||||
"""
|
||||
@property
|
||||
def num_bins(self):
|
||||
return len(self.bins)
|
||||
def bins(self):
|
||||
return self._bins
|
||||
|
||||
@num_bins.setter
|
||||
def num_bins(self, num_bins):
|
||||
cv.check_type('filter num_bins', num_bins, Integral)
|
||||
cv.check_greater_than('filter num_bins', num_bins, 0, equality=True)
|
||||
self._num_bins = num_bins
|
||||
|
||||
def check_bins(self, bins):
|
||||
cv.check_iterable_type('filter bins', bins, Integral)
|
||||
for edge in bins:
|
||||
cv.check_greater_than('filter bin', edge, 0, equality=True)
|
||||
@bins.setter
|
||||
def bins(self, bins):
|
||||
self._smart_set_bins(bins, openmc.Universe)
|
||||
|
||||
|
||||
class UniverseFilter(IntegralFilter):
|
||||
"""Bins tally event locations based on the universe they occured in.
|
||||
class MaterialFilter(WithIDFilter):
|
||||
"""Bins tally event locations based on the Material they occured in.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
bins : Integral or Iterable of Integral
|
||||
openmc.Universe IDs.
|
||||
bins : openmc.Material, Integral, or iterable thereof
|
||||
The Materials to tally. Either openmc.Material objects or their
|
||||
Integral ID numbers can be used.
|
||||
filter_id : int
|
||||
Unique identifier for the filter
|
||||
|
||||
Attributes
|
||||
----------
|
||||
bins : Integral or Iterable of Integral
|
||||
openmc.Universe IDs.
|
||||
id : int
|
||||
Unique identifier for the filter
|
||||
num_bins : Integral
|
||||
The number of filter bins
|
||||
stride : Integral
|
||||
The number of filter, nuclide and score bins within each of this
|
||||
filter's bins.
|
||||
|
||||
"""
|
||||
|
||||
|
||||
class MaterialFilter(IntegralFilter):
|
||||
"""Bins tally events based on which material they occured in.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
bins : Integral or Iterable of Integral
|
||||
openmc.Material IDs.
|
||||
filter_id : int
|
||||
Unique identifier for the filter
|
||||
|
||||
Attributes
|
||||
----------
|
||||
bins : Integral or Iterable of Integral
|
||||
bins : Iterable of Integral
|
||||
openmc.Material IDs.
|
||||
id : int
|
||||
Unique identifier for the filter
|
||||
|
|
@ -562,21 +561,29 @@ class MaterialFilter(IntegralFilter):
|
|||
filter's bins.
|
||||
|
||||
"""
|
||||
@property
|
||||
def bins(self):
|
||||
return self._bins
|
||||
|
||||
@bins.setter
|
||||
def bins(self, bins):
|
||||
self._smart_set_bins(bins, openmc.Material)
|
||||
|
||||
|
||||
class CellFilter(IntegralFilter):
|
||||
"""Bins tally event locations based on which cell they occured in.
|
||||
class CellFilter(WithIDFilter):
|
||||
"""Bins tally event locations based on the Cell they occured in.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
bins : Integral or Iterable of Integral
|
||||
openmc.Cell IDs.
|
||||
bins : openmc.Cell, Integral, or iterable thereof
|
||||
The Cells to tally. Either openmc.Cell objects or their
|
||||
Integral ID numbers can be used.
|
||||
filter_id : int
|
||||
Unique identifier for the filter
|
||||
|
||||
Attributes
|
||||
----------
|
||||
bins : Integral or Iterable of Integral
|
||||
bins : Iterable of Integral
|
||||
openmc.Cell IDs.
|
||||
id : int
|
||||
Unique identifier for the filter
|
||||
|
|
@ -587,21 +594,29 @@ class CellFilter(IntegralFilter):
|
|||
filter's bins.
|
||||
|
||||
"""
|
||||
@property
|
||||
def bins(self):
|
||||
return self._bins
|
||||
|
||||
@bins.setter
|
||||
def bins(self, bins):
|
||||
self._smart_set_bins(bins, openmc.Cell)
|
||||
|
||||
|
||||
class CellbornFilter(IntegralFilter):
|
||||
"""Bins tally events based on the cell that the particle was born in.
|
||||
class CellbornFilter(WithIDFilter):
|
||||
"""Bins tally events based on which Cell the neutron was born in.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
bins : Integral or Iterable of Integral
|
||||
openmc.Cell IDs.
|
||||
bins : openmc.Cell, Integral, or iterable thereof
|
||||
The birth Cells to tally. Either openmc.Cell objects or their
|
||||
Integral ID numbers can be used.
|
||||
filter_id : int
|
||||
Unique identifier for the filter
|
||||
|
||||
Attributes
|
||||
----------
|
||||
bins : Integral or Iterable of Integral
|
||||
bins : Iterable of Integral
|
||||
openmc.Cell IDs.
|
||||
id : int
|
||||
Unique identifier for the filter
|
||||
|
|
@ -612,9 +627,16 @@ class CellbornFilter(IntegralFilter):
|
|||
filter's bins.
|
||||
|
||||
"""
|
||||
@property
|
||||
def bins(self):
|
||||
return self._bins
|
||||
|
||||
@bins.setter
|
||||
def bins(self, bins):
|
||||
self._smart_set_bins(bins, openmc.Cell)
|
||||
|
||||
|
||||
class SurfaceFilter(IntegralFilter):
|
||||
class SurfaceFilter(Filter):
|
||||
"""Bins particle currents on Mesh surfaces.
|
||||
|
||||
Parameters
|
||||
|
|
@ -639,6 +661,28 @@ class SurfaceFilter(IntegralFilter):
|
|||
filter's bins.
|
||||
|
||||
"""
|
||||
@property
|
||||
def bins(self):
|
||||
return self._bins
|
||||
|
||||
@property
|
||||
def num_bins(self):
|
||||
return len(self.bins)
|
||||
|
||||
@bins.setter
|
||||
def bins(self, bins):
|
||||
# Format the bins as a 1D numpy array.
|
||||
bins = np.atleast_1d(bins)
|
||||
|
||||
# Check the bin values.
|
||||
cv.check_iterable_type('filter bins', bins, Integral)
|
||||
for edge in bins:
|
||||
cv.check_greater_than('filter bin', edge, 0, equality=True)
|
||||
|
||||
self._bins = bins
|
||||
|
||||
@num_bins.setter
|
||||
def num_bins(self, num_bins): pass
|
||||
|
||||
def get_pandas_dataframe(self, data_size, **kwargs):
|
||||
"""Builds a Pandas DataFrame for the Filter's bins.
|
||||
|
|
@ -845,9 +889,12 @@ class MeshFilter(Filter):
|
|||
# Find mesh dimensions - use 3D indices for simplicity
|
||||
if len(self.mesh.dimension) == 3:
|
||||
nx, ny, nz = self.mesh.dimension
|
||||
else:
|
||||
elif len(self.mesh.dimension) == 2:
|
||||
nx, ny = self.mesh.dimension
|
||||
nz = 1
|
||||
else:
|
||||
nx = self.mesh.dimension
|
||||
ny = nz = 1
|
||||
|
||||
# Generate multi-index sub-column for x-axis
|
||||
filter_bins = np.arange(1, nx + 1)
|
||||
|
|
@ -1162,16 +1209,16 @@ class DistribcellFilter(Filter):
|
|||
|
||||
Parameters
|
||||
----------
|
||||
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.
|
||||
cell : openmc.Cell or Integral
|
||||
The distributed cell to tally. Either an openmc.Cell or an Integral
|
||||
cell ID number can be used.
|
||||
filter_id : int
|
||||
Unique identifier for the filter
|
||||
|
||||
Attributes
|
||||
----------
|
||||
bins : Integral or Iterable of Integral or Iterable of Real
|
||||
The bins for the filter
|
||||
bins : Iterable of Integral
|
||||
An iterable with one element---the ID of the distributed Cell.
|
||||
id : int
|
||||
Unique identifier for the filter
|
||||
num_bins : Integral
|
||||
|
|
@ -1185,9 +1232,9 @@ class DistribcellFilter(Filter):
|
|||
|
||||
"""
|
||||
|
||||
def __init__(self, bins, filter_id=None):
|
||||
def __init__(self, cell, filter_id=None):
|
||||
self._paths = None
|
||||
super(DistribcellFilter, self).__init__(bins, filter_id)
|
||||
super(DistribcellFilter, self).__init__(cell, filter_id)
|
||||
|
||||
@classmethod
|
||||
def from_hdf5(cls, group, **kwargs):
|
||||
|
|
@ -1203,24 +1250,36 @@ class DistribcellFilter(Filter):
|
|||
|
||||
return out
|
||||
|
||||
@property
|
||||
def bins(self):
|
||||
return self._bins
|
||||
|
||||
@property
|
||||
def paths(self):
|
||||
return self._paths
|
||||
|
||||
@paths.setter
|
||||
def paths(self, paths):
|
||||
cv.check_iterable_type('paths', paths, str)
|
||||
self._paths = paths
|
||||
@bins.setter
|
||||
def bins(self, bins):
|
||||
# Format the bins as a 1D numpy array.
|
||||
bins = np.atleast_1d(bins)
|
||||
|
||||
def check_bins(self, bins):
|
||||
# Make sure there is only 1 bin.
|
||||
if not len(bins) == 1:
|
||||
msg = 'Unable to add bins "{0}" to a DistribcellFilter since ' \
|
||||
'only a single distribcell can be used per tally'.format(bins)
|
||||
raise ValueError(msg)
|
||||
|
||||
cv.check_iterable_type('filter bins', bins, Integral)
|
||||
for edge in bins:
|
||||
cv.check_greater_than('filter bin', edge, 0, equality=True)
|
||||
# Check the type and extract the id, if necessary.
|
||||
cv.check_type('distribcell bin', bins[0], (Integral, openmc.Cell))
|
||||
if isinstance(bins[0], openmc.Cell):
|
||||
bins = np.atleast_1d(bins[0].id)
|
||||
|
||||
self._bins = bins
|
||||
|
||||
@paths.setter
|
||||
def paths(self, paths):
|
||||
cv.check_iterable_type('paths', paths, str)
|
||||
self._paths = paths
|
||||
|
||||
def can_merge(self, other):
|
||||
# Distribcell filters cannot have more than one bin
|
||||
|
|
@ -1706,7 +1765,7 @@ class AzimuthalFilter(RealFilter):
|
|||
return df
|
||||
|
||||
|
||||
class DelayedGroupFilter(IntegralFilter):
|
||||
class DelayedGroupFilter(Filter):
|
||||
"""Bins fission events based on the produced neutron precursor groups.
|
||||
|
||||
Parameters
|
||||
|
|
@ -1733,6 +1792,28 @@ class DelayedGroupFilter(IntegralFilter):
|
|||
filter's bins.
|
||||
|
||||
"""
|
||||
@property
|
||||
def bins(self):
|
||||
return self._bins
|
||||
|
||||
@property
|
||||
def num_bins(self):
|
||||
return len(self.bins)
|
||||
|
||||
@bins.setter
|
||||
def bins(self, bins):
|
||||
# Format the bins as a 1D numpy array.
|
||||
bins = np.atleast_1d(bins)
|
||||
|
||||
# Check the bin values.
|
||||
cv.check_iterable_type('filter bins', bins, Integral)
|
||||
for edge in bins:
|
||||
cv.check_greater_than('filter bin', edge, 0, equality=True)
|
||||
|
||||
self._bins = bins
|
||||
|
||||
@num_bins.setter
|
||||
def num_bins(self, num_bins): pass
|
||||
|
||||
|
||||
class EnergyFunctionFilter(Filter):
|
||||
|
|
@ -1808,9 +1889,10 @@ class EnergyFunctionFilter(Filter):
|
|||
return False
|
||||
|
||||
def __hash__(self):
|
||||
# For some reason, it seems the __hash__ method is not inherited when we
|
||||
# overwrite __repr__.
|
||||
return hash(repr(self))
|
||||
string = type(self).__name__ + '\n'
|
||||
string += '{: <16}=\t{}\n'.format('\tEnergy', self.energy)
|
||||
string += '{: <16}=\t{}\n'.format('\tInterpolant', self.y)
|
||||
return hash(string)
|
||||
|
||||
def __repr__(self):
|
||||
string = type(self).__name__ + '\n'
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
from collections import OrderedDict, Iterable
|
||||
from copy import deepcopy
|
||||
from xml.etree import ElementTree as ET
|
||||
|
||||
from six import string_types
|
||||
|
|
@ -257,7 +258,23 @@ class Geometry(object):
|
|||
lattices[cell.fill.id] = cell.fill
|
||||
|
||||
return lattices
|
||||
|
||||
def get_all_surfaces(self):
|
||||
"""
|
||||
Return all surfaces used in the geometry
|
||||
|
||||
Returns
|
||||
-------
|
||||
collections.OrderedDict
|
||||
Dictionary mapping surface IDs to :class:`openmc.Surface` instances
|
||||
|
||||
"""
|
||||
surfaces = OrderedDict()
|
||||
|
||||
for cell in self.get_all_cells().values():
|
||||
surfaces = cell.region.get_surfaces(surfaces)
|
||||
return surfaces
|
||||
|
||||
def get_materials_by_name(self, name, case_sensitive=False, matching=False):
|
||||
"""Return a list of materials with matching names.
|
||||
|
||||
|
|
@ -481,3 +498,11 @@ class Geometry(object):
|
|||
|
||||
# Recursively traverse the CSG tree to count all cell instances
|
||||
self.root_universe._determine_paths()
|
||||
|
||||
def clone(self):
|
||||
"""Create a copy of this geometry with new unique IDs for all of its
|
||||
enclosed materials, surfaces, cells, universes and lattices."""
|
||||
|
||||
clone = deepcopy(self)
|
||||
clone.root_universe = self.root_universe.clone()
|
||||
return clone
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ from __future__ import division
|
|||
|
||||
from abc import ABCMeta
|
||||
from collections import OrderedDict, Iterable
|
||||
from copy import deepcopy
|
||||
from math import sqrt, floor
|
||||
from numbers import Real, Integral
|
||||
from xml.etree import ElementTree as ET
|
||||
|
|
@ -367,7 +368,7 @@ class Lattice(object):
|
|||
return all_universes
|
||||
|
||||
def get_universe(self, idx):
|
||||
"""Return universe corresponding to a lattice element index
|
||||
r"""Return universe corresponding to a lattice element index
|
||||
|
||||
Parameters
|
||||
----------
|
||||
|
|
@ -414,6 +415,51 @@ class Lattice(object):
|
|||
return []
|
||||
return [(self, idx)] + u.find(p)
|
||||
|
||||
def clone(self, memo=None):
|
||||
"""Create a copy of this lattice with a new unique ID, and clones
|
||||
all universes within this lattice.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
memo : dict or None
|
||||
A nested dictionary of previously cloned objects. This parameter
|
||||
is used internally and should not be specified by the user.
|
||||
|
||||
Returns
|
||||
-------
|
||||
clone : openmc.Lattice
|
||||
The clone of this lattice
|
||||
|
||||
"""
|
||||
|
||||
if memo is None:
|
||||
memo = {}
|
||||
|
||||
# If no nemoize'd clone exists, instantiate one
|
||||
if self not in memo:
|
||||
clone = deepcopy(self)
|
||||
clone.id = None
|
||||
|
||||
if self.outer is not None:
|
||||
clone.outer = self.outer.clone(memo)
|
||||
|
||||
# Assign universe clones to the lattice clone
|
||||
for i in self.indices:
|
||||
if isinstance(self, RectLattice):
|
||||
clone.universes[i] = self.universes[i].clone(memo)
|
||||
else:
|
||||
if self.ndim == 2:
|
||||
clone.universes[i[0]][i[1]] = \
|
||||
self.universes[i[0]][i[1]].clone(memo)
|
||||
else:
|
||||
clone.universes[i[0]][i[1]][i[2]] = \
|
||||
self.universes[i[0]][i[1]][i[2]].clone(memo)
|
||||
|
||||
# Memoize the clone
|
||||
memo[self] = clone
|
||||
|
||||
return memo[self]
|
||||
|
||||
|
||||
class RectLattice(Lattice):
|
||||
"""A lattice consisting of rectangular prisms.
|
||||
|
|
|
|||
|
|
@ -29,8 +29,13 @@ DENSITY_UNITS = ['g/cm3', 'g/cc', 'kg/cm3', 'atom/b-cm', 'atom/cm3', 'sum',
|
|||
|
||||
|
||||
class Material(object):
|
||||
"""A material composed of a collection of nuclides/elements that can be
|
||||
assigned to a region of space.
|
||||
"""A material composed of a collection of nuclides/elements.
|
||||
|
||||
To create a material, one should create an instance of this class, add
|
||||
nuclides or elements with :meth:`Material.add_nuclide` or
|
||||
`Material.add_element`, respectively, and set the total material density
|
||||
with `Material.export_to_xml()`. The material can then be assigned to a cell
|
||||
using the :attr:`Cell.fill` attribute.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
|
|
@ -794,6 +799,35 @@ class Material(object):
|
|||
|
||||
return nuclides
|
||||
|
||||
def clone(self, memo=None):
|
||||
"""Create a copy of this material with a new unique ID.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
memo : dict or None
|
||||
A nested dictionary of previously cloned objects. This parameter
|
||||
is used internally and should not be specified by the user.
|
||||
|
||||
Returns
|
||||
-------
|
||||
clone : openmc.Material
|
||||
The clone of this material
|
||||
|
||||
"""
|
||||
|
||||
if memo is None:
|
||||
memo = {}
|
||||
|
||||
# If no nemoize'd clone exists, instantiate one
|
||||
if self not in memo:
|
||||
clone = deepcopy(self)
|
||||
clone.id = None
|
||||
|
||||
# Memoize the clone
|
||||
memo[self] = clone
|
||||
|
||||
return memo[self]
|
||||
|
||||
def _get_nuclide_xml(self, nuclide, distrib=False):
|
||||
xml_element = ET.Element("nuclide")
|
||||
xml_element.set("name", nuclide[0].name)
|
||||
|
|
|
|||
|
|
@ -3917,6 +3917,9 @@ class ScatterMatrixXS(MatrixMGXS):
|
|||
scatter_p0 = self.tallies['{}-0'.format(self.rxn_type)]
|
||||
scatter_p1 = self.tallies['{}-1'.format(self.rxn_type)]
|
||||
energy_filter = scatter_p0.find_filter(openmc.EnergyFilter)
|
||||
|
||||
# Transform scatter-p1 tally into an energyin/out matrix
|
||||
# to match scattering matrix shape for tally arithmetic
|
||||
energy_filter = copy.deepcopy(energy_filter)
|
||||
scatter_p1 = scatter_p1.diagonalize_filter(energy_filter)
|
||||
self._rxn_rate_tally = scatter_p0 - scatter_p1
|
||||
|
|
@ -3956,10 +3959,6 @@ class ScatterMatrixXS(MatrixMGXS):
|
|||
self._xs_tally = MGXS.xs_tally.fget(self)
|
||||
|
||||
else:
|
||||
# Compute groupwise scattering cross section
|
||||
self._xs_tally = self.tallies['scatter'] / \
|
||||
self.tallies['flux (tracklength)']
|
||||
|
||||
# Compute scattering probability matrix
|
||||
energyout_bins = [self.energy_groups.get_group_bounds(i)
|
||||
for i in range(self.num_groups, 0, -1)]
|
||||
|
|
@ -3990,8 +3989,13 @@ class ScatterMatrixXS(MatrixMGXS):
|
|||
# Remove the AggregateFilter summed across mu bins
|
||||
norm._filters = norm._filters[:2]
|
||||
|
||||
# Multiply by the group-to-group probability matrix
|
||||
self._xs_tally *= (self.tallies[tally_key] / norm)
|
||||
# Compute groupwise scattering cross section
|
||||
self._xs_tally = self.tallies['scatter'] * \
|
||||
self.tallies[tally_key] / norm / \
|
||||
self.tallies['flux (tracklength)']
|
||||
|
||||
# Override the nuclides for tally arithmetic
|
||||
self._xs_tally.nuclides = self.tallies['scatter'].nuclides
|
||||
|
||||
# Multiply by the multiplicity matrix
|
||||
if self.nu:
|
||||
|
|
@ -4001,14 +4005,22 @@ class ScatterMatrixXS(MatrixMGXS):
|
|||
|
||||
# If using P0 correction subtract scatter-1 from the diagonal
|
||||
if self.correction == 'P0' and self.legendre_order == 0:
|
||||
flux = self.tallies['flux (analog)']
|
||||
scatter_p1 = self.tallies['{}-1'.format(self.rxn_type)]
|
||||
flux = self.tallies['flux (analog)']
|
||||
|
||||
# Transform scatter-p1 tally into an energyin/out matrix
|
||||
# to match scattering matrix shape for tally arithmetic
|
||||
energy_filter = flux.find_filter(openmc.EnergyFilter)
|
||||
energy_filter = copy.deepcopy(energy_filter)
|
||||
scatter_p1 = scatter_p1.diagonalize_filter(energy_filter)
|
||||
self._xs_tally -= (scatter_p1 / flux)
|
||||
|
||||
# Compute the trasnport correction term
|
||||
correction = scatter_p1 / flux
|
||||
|
||||
# Override the nuclides for tally arithmetic
|
||||
correction.nuclides = scatter_p1.nuclides
|
||||
self._xs_tally -= correction
|
||||
|
||||
self._compute_xs()
|
||||
|
||||
return self._xs_tally
|
||||
|
|
|
|||
|
|
@ -1,26 +1,34 @@
|
|||
from collections import Iterable
|
||||
|
||||
import openmc
|
||||
from openmc.checkvalue import check_type
|
||||
|
||||
|
||||
class Model(object):
|
||||
"""OpenMC model container for the openmc.Geometry, openmc.Materials,
|
||||
openmc.Settings, openmc.Tallies, openmc.CMFD objects, and openmc.Plot
|
||||
objects
|
||||
"""Model container.
|
||||
|
||||
This class can be used to store instances of :class:`openmc.Geometry`,
|
||||
:class:`openmc.Materials`, :class:`openmc.Settings`,
|
||||
:class:`openmc.Tallies`, :class:`openmc.Plots`, and :class:`openmc.CMFD`,
|
||||
thus making a complete model. The :meth:`Model.export_to_xml` method will
|
||||
export XML files for all attributes that have been set. If the
|
||||
:meth:`Model.materials` attribute is not set, it will attempt to create a
|
||||
``materials.xml`` file based on all materials appearing in the geometry.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
geometry : openmc.Geometry
|
||||
geometry : openmc.Geometry, optional
|
||||
Geometry information
|
||||
materials : openmc.Materials
|
||||
materials : openmc.Materials, optional
|
||||
Materials information
|
||||
settings : openmc.Settings
|
||||
settings : openmc.Settings, optional
|
||||
Settings information
|
||||
tallies : openmc.Tallies
|
||||
Tallies information, optional
|
||||
cmfd : openmc.CMFD
|
||||
CMFD information, optional
|
||||
plots : openmc.Plots
|
||||
Plot information, optional
|
||||
tallies : openmc.Tallies, optional
|
||||
Tallies information
|
||||
cmfd : openmc.CMFD, optional
|
||||
CMFD information
|
||||
plots : openmc.Plots, optional
|
||||
Plot information
|
||||
|
||||
Attributes
|
||||
----------
|
||||
|
|
@ -39,25 +47,25 @@ class Model(object):
|
|||
|
||||
"""
|
||||
|
||||
def __init__(self, geometry, materials, settings, tallies=None, cmfd=None,
|
||||
plots=None):
|
||||
self.geometry = geometry
|
||||
self.materials = materials
|
||||
self.settings = settings
|
||||
if tallies:
|
||||
self.tallies = tallies
|
||||
else:
|
||||
self._tallies = openmc.Tallies()
|
||||
if cmfd:
|
||||
self.cmfd = cmfd
|
||||
else:
|
||||
self._cmfd = None
|
||||
if plots:
|
||||
self.plots = plots
|
||||
else:
|
||||
self.plots = openmc.Plots()
|
||||
def __init__(self, geometry=None, materials=None, settings=None,
|
||||
tallies=None, cmfd=None, plots=None):
|
||||
self.geometry = openmc.Geometry()
|
||||
self.materials = openmc.Materials()
|
||||
self.settings = openmc.Settings()
|
||||
self.cmfd = cmfd
|
||||
self.tallies = openmc.Tallies()
|
||||
self.plots = openmc.Plots()
|
||||
|
||||
self.sp = None
|
||||
if geometry is not None:
|
||||
self.geometry = geometry
|
||||
if materials is not None:
|
||||
self.materials = materials
|
||||
if settings is not None:
|
||||
self.settings = settings
|
||||
if tallies is not None:
|
||||
self.tallies = tallies
|
||||
if plots is not None:
|
||||
self.plots = plots
|
||||
|
||||
@property
|
||||
def geometry(self):
|
||||
|
|
@ -90,8 +98,13 @@ class Model(object):
|
|||
|
||||
@materials.setter
|
||||
def materials(self, materials):
|
||||
check_type('materials', materials, openmc.Materials)
|
||||
self._materials = materials
|
||||
check_type('materials', materials, Iterable, openmc.Material)
|
||||
if isinstance(materials, openmc.Materials):
|
||||
self._materials = materials
|
||||
else:
|
||||
del self._materials[:]
|
||||
for mat in materials:
|
||||
self._materials.append(mat)
|
||||
|
||||
@settings.setter
|
||||
def settings(self, settings):
|
||||
|
|
@ -100,33 +113,55 @@ class Model(object):
|
|||
|
||||
@tallies.setter
|
||||
def tallies(self, tallies):
|
||||
check_type('tallies', tallies, openmc.Tallies)
|
||||
self._tallies = tallies
|
||||
check_type('tallies', tallies, Iterable, openmc.Tally)
|
||||
if isinstance(tallies, openmc.Tallies):
|
||||
self._tallies = tallies
|
||||
else:
|
||||
del self._tallies[:]
|
||||
for tally in tallies:
|
||||
self._tallies.append(tally)
|
||||
|
||||
@cmfd.setter
|
||||
def cmfd(self, cmfd):
|
||||
check_type('cmfd', cmfd, openmc.CMFD)
|
||||
check_type('cmfd', cmfd, (openmc.CMFD, type(None)))
|
||||
self._cmfd = cmfd
|
||||
|
||||
@plots.setter
|
||||
def plots(self, plots):
|
||||
check_type('plots', plots, openmc.Plots)
|
||||
self._plots = plots
|
||||
check_type('plots', plots, Iterable, openmc.Plot)
|
||||
if isinstance(plots, openmc.Plots):
|
||||
self._plots = plots
|
||||
else:
|
||||
del self._plots[:]
|
||||
for plot in plots:
|
||||
self._plots.append(plot)
|
||||
|
||||
def export_to_xml(self):
|
||||
"""Export model settings to XML files.
|
||||
"""Export model to XML files.
|
||||
"""
|
||||
|
||||
self.geometry.export_to_xml()
|
||||
self.materials.export_to_xml()
|
||||
self.settings.export_to_xml()
|
||||
self.tallies.export_to_xml()
|
||||
self.geometry.export_to_xml()
|
||||
|
||||
# If a materials collection was specified, export it. Otherwise, look
|
||||
# for all materials in the geometry and use that to automatically build
|
||||
# a collection.
|
||||
if self.materials:
|
||||
self.materials.export_to_xml()
|
||||
else:
|
||||
materials = openmc.Materials(self.geometry.get_all_materials()
|
||||
.values())
|
||||
materials.export_to_xml()
|
||||
|
||||
if self.tallies:
|
||||
self.tallies.export_to_xml()
|
||||
if self.cmfd is not None:
|
||||
self.cmfd.export_to_xml()
|
||||
self.plots.export_to_xml()
|
||||
if self.plots:
|
||||
self.plots.export_to_xml()
|
||||
|
||||
def run(self, **kwargs):
|
||||
"""Creates the XML files, runs OpenMC, and loads the statepoint.
|
||||
"""Creates the XML files, runs OpenMC, and returns k-effective
|
||||
|
||||
Parameters
|
||||
----------
|
||||
|
|
@ -136,29 +171,19 @@ class Model(object):
|
|||
Returns
|
||||
-------
|
||||
2-tuple of float
|
||||
k_combined from the statepoint
|
||||
Combined estimator of k-effective from the statepoint
|
||||
|
||||
"""
|
||||
|
||||
self.export_to_xml()
|
||||
|
||||
return_code = openmc.run(**kwargs)
|
||||
|
||||
assert (return_code == 0), "OpenMC did not execute successfully"
|
||||
|
||||
statepoint_batches = self.settings.batches
|
||||
n = self.settings.batches
|
||||
if self.settings.statepoint is not None:
|
||||
if 'batches' in self.settings.statepoint:
|
||||
statepoint_batches = self.settings.statepoint['batches'][-1]
|
||||
self.sp = \
|
||||
openmc.StatePoint('statepoint.{}.h5'.format(statepoint_batches))
|
||||
n = self.settings.statepoint['batches'][-1]
|
||||
|
||||
return self.sp.k_combined
|
||||
|
||||
def close(self):
|
||||
"""Close the statepoint and summary files
|
||||
"""
|
||||
|
||||
if self.sp is not None:
|
||||
self.sp._f.close()
|
||||
self.sp.summary._f.close()
|
||||
with openmc.StatePoint('statepoint.{}.h5'.format(n)) as sp:
|
||||
return sp.k_combined
|
||||
|
|
|
|||
142
openmc/region.py
142
openmc/region.py
|
|
@ -1,5 +1,6 @@
|
|||
from abc import ABCMeta, abstractmethod
|
||||
from collections import Iterable
|
||||
from collections import Iterable, OrderedDict
|
||||
from copy import deepcopy
|
||||
|
||||
from six import add_metaclass
|
||||
import numpy as np
|
||||
|
|
@ -46,6 +47,27 @@ class Region(object):
|
|||
def __ne__(self, other):
|
||||
return not self == other
|
||||
|
||||
def get_surfaces(self, surfaces=None):
|
||||
"""
|
||||
Recursively find all the surfaces referenced by a region and return them
|
||||
|
||||
Parameters
|
||||
----------
|
||||
surfaces: collections.OrderedDict, optional
|
||||
Dictionary mapping surface IDs to :class:`openmc.Surface` instances
|
||||
|
||||
Returns
|
||||
-------
|
||||
surfaces: collections.OrderedDict
|
||||
Dictionary mapping surface IDs to :class:`openmc.Surface` instances
|
||||
|
||||
"""
|
||||
if surfaces is None:
|
||||
surfaces = OrderedDict()
|
||||
for region in self:
|
||||
surfaces = region.get_surfaces(surfaces)
|
||||
return surfaces
|
||||
|
||||
@staticmethod
|
||||
def from_expression(expression, surfaces):
|
||||
"""Generate a region given an infix expression.
|
||||
|
|
@ -200,6 +222,31 @@ class Region(object):
|
|||
# at the end
|
||||
return output[0]
|
||||
|
||||
@abstractmethod
|
||||
def clone(self, memo=None):
|
||||
"""Create a copy of this region - each of the surfaces in the
|
||||
region's nodes will be cloned and will have new unique IDs.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
memo : dict or None
|
||||
A nested dictionary of previously cloned objects. This parameter
|
||||
is used internally and should not be specified by the user.
|
||||
|
||||
Returns
|
||||
-------
|
||||
clone : openmc.Region
|
||||
The clone of this region
|
||||
|
||||
Raises
|
||||
------
|
||||
NotImplementedError
|
||||
This method is not implemented for the abstract region class.
|
||||
|
||||
"""
|
||||
raise NotImplementedError('The clone method is not implemented for '
|
||||
'the abstract region class.')
|
||||
|
||||
|
||||
class Intersection(Region):
|
||||
r"""Intersection of two or more regions.
|
||||
|
|
@ -279,6 +326,30 @@ class Intersection(Region):
|
|||
check_type('nodes', nodes, Iterable, Region)
|
||||
self._nodes = nodes
|
||||
|
||||
def clone(self, memo=None):
|
||||
"""Create a copy of this region - each of the surfaces in the
|
||||
intersection's nodes will be cloned and will have new unique IDs.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
memo : dict or None
|
||||
A nested dictionary of previously cloned objects. This parameter
|
||||
is used internally and should not be specified by the user.
|
||||
|
||||
Returns
|
||||
-------
|
||||
clone : openmc.Intersection
|
||||
The clone of this intersection
|
||||
|
||||
"""
|
||||
|
||||
if memo is None:
|
||||
memo = {}
|
||||
|
||||
clone = deepcopy(self)
|
||||
clone.nodes = [n.clone(memo) for n in self.nodes]
|
||||
return clone
|
||||
|
||||
|
||||
class Union(Region):
|
||||
r"""Union of two or more regions.
|
||||
|
|
@ -356,6 +427,30 @@ class Union(Region):
|
|||
check_type('nodes', nodes, Iterable, Region)
|
||||
self._nodes = nodes
|
||||
|
||||
def clone(self, memo=None):
|
||||
"""Create a copy of this region - each of the surfaces in the
|
||||
union's nodes will be cloned and will have new unique IDs.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
memo : dict or None
|
||||
A nested dictionary of previously cloned objects. This parameter
|
||||
is used internally and should not be specified by the user.
|
||||
|
||||
Returns
|
||||
-------
|
||||
clone : openmc.Union
|
||||
The clone of this union
|
||||
|
||||
"""
|
||||
|
||||
if memo is None:
|
||||
memo = {}
|
||||
|
||||
clone = copy.deepcopy(self)
|
||||
clone.nodes = [n.clone(memo) for n in self.nodes]
|
||||
return clone
|
||||
|
||||
|
||||
class Complement(Region):
|
||||
"""Complement of a region.
|
||||
|
|
@ -431,3 +526,48 @@ class Complement(Region):
|
|||
else:
|
||||
temp_region = ~self.node
|
||||
return temp_region.bounding_box
|
||||
|
||||
def get_surfaces(self, surfaces=None):
|
||||
"""
|
||||
Recursively find and return all the surfaces referenced by the node
|
||||
|
||||
Parameters
|
||||
----------
|
||||
surfaces: collections.OrderedDict, optional
|
||||
Dictionary mapping surface IDs to :class:`openmc.Surface` instances
|
||||
|
||||
Returns
|
||||
-------
|
||||
surfaces: collections.OrderedDict
|
||||
Dictionary mapping surface IDs to :class:`openmc.Surface` instances
|
||||
|
||||
"""
|
||||
if surfaces is None:
|
||||
surfaces = OrderedDict()
|
||||
for region in self.node:
|
||||
surfaces = region.get_surfaces(surfaces)
|
||||
return surfaces
|
||||
|
||||
def clone(self, memo=None):
|
||||
"""Create a copy of this region - each of the surfaces in the
|
||||
complement's node will be cloned and will have new unique IDs.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
memo : dict or None
|
||||
A nested dictionary of previously cloned objects. This parameter
|
||||
is used internally and should not be specified by the user.
|
||||
|
||||
Returns
|
||||
-------
|
||||
clone : openmc.Complement
|
||||
The clone of this complement
|
||||
|
||||
"""
|
||||
|
||||
if memo is None:
|
||||
memo = {}
|
||||
|
||||
clone = copy.deepcopy(self)
|
||||
clone.node = self.node.clone(memo)
|
||||
return clone
|
||||
|
|
|
|||
|
|
@ -51,10 +51,6 @@ def _search_keff(guess, target, model_builder, model_args, print_iterations,
|
|||
# Run the model and obtain keff
|
||||
keff = model.run(output=print_output)
|
||||
|
||||
# Close the model to ensure HDF5 will allow access during the next
|
||||
# OpenMC execution
|
||||
model.close()
|
||||
|
||||
# Record the history
|
||||
guesses.append(guess)
|
||||
results.append(keff)
|
||||
|
|
|
|||
|
|
@ -11,8 +11,8 @@ from openmc.clean_xml import clean_xml_indentation
|
|||
import openmc.checkvalue as cv
|
||||
from openmc import Nuclide, VolumeCalculation, Source, Mesh
|
||||
|
||||
_RUN_MODES = ['eigenvalue', 'fixed source', 'plot', 'volume',
|
||||
'particle restart']
|
||||
_RUN_MODES = ['eigenvalue', 'fixed source', 'plot', 'volume', 'particle restart']
|
||||
_RES_SCAT_METHODS = ['dbrc', 'wcm', 'ares']
|
||||
|
||||
|
||||
class Settings(object):
|
||||
|
|
@ -71,17 +71,28 @@ class Settings(object):
|
|||
Indicate that all user-defined and global tallies should not be reduced
|
||||
across processes in a parallel calculation.
|
||||
output : dict
|
||||
Dictionary indicating what files to output. Valid keys are 'summary',
|
||||
'cross_sections', 'tallies', and 'distribmats'. Values corresponding to
|
||||
each key should be given as a boolean value.
|
||||
output_path : str
|
||||
Path to write output to
|
||||
Dictionary indicating what files to output. Acceptable keys are:
|
||||
|
||||
:path: String indicating a directory where output files should be
|
||||
written
|
||||
:summary: Whether the 'summary.h5' file should be written (bool)
|
||||
:tallies: Whether the 'tallies.out' file should be written (bool)
|
||||
particles : int
|
||||
Number of particles per generation
|
||||
ptables : bool
|
||||
Determine whether probability tables are used.
|
||||
resonance_scattering : ResonanceScattering or iterable of ResonanceScattering
|
||||
The elastic scattering model to use for resonant isotopes
|
||||
resonance_scattering : dict
|
||||
Settings for resonance elastic scattering. Accepted keys are 'enable'
|
||||
(bool), 'method' (str), 'energy_min' (float), 'energy_max' (float), and
|
||||
'nuclides' (list). The 'method' can be set to 'dbrc' (Doppler broadening
|
||||
rejection correction), 'wcm' (weight correction method), and 'ares'
|
||||
(accelerated resonance elastic scattering). If not specified, 'ares' is
|
||||
the default method. The 'energy_min' and 'energy_max' values indicate
|
||||
the minimum and maximum energies above and below which the resonance
|
||||
elastic scattering method is to be applied. The 'nuclides' list
|
||||
indicates what nuclides the method should be applied to. In its absence,
|
||||
the method will be applied to all nuclides with 0 K elastic scattering
|
||||
data present.
|
||||
run_cmfd : bool
|
||||
Indicate if coarse mesh finite difference acceleration is to be used
|
||||
run_mode : {'eigenvalue', 'fixed source', 'plot', 'volume', 'particle restart'}
|
||||
|
|
@ -183,7 +194,6 @@ class Settings(object):
|
|||
self._trigger_batch_interval = None
|
||||
|
||||
self._output = None
|
||||
self._output_path = None
|
||||
|
||||
# Output options
|
||||
self._statepoint = {}
|
||||
|
|
@ -215,8 +225,7 @@ class Settings(object):
|
|||
self._dd_allow_leakage = False
|
||||
self._dd_count_interactions = False
|
||||
|
||||
self._resonance_scattering = cv.CheckedList(
|
||||
ResonanceScattering, 'resonance scattering models')
|
||||
self._resonance_scattering = {}
|
||||
self._volume_calculations = cv.CheckedList(
|
||||
VolumeCalculation, 'volume calculations')
|
||||
|
||||
|
|
@ -306,10 +315,6 @@ class Settings(object):
|
|||
def output(self):
|
||||
return self._output
|
||||
|
||||
@property
|
||||
def output_path(self):
|
||||
return self._output_path
|
||||
|
||||
@property
|
||||
def sourcepoint(self):
|
||||
return self._sourcepoint
|
||||
|
|
@ -470,30 +475,15 @@ class Settings(object):
|
|||
|
||||
@output.setter
|
||||
def output(self, output):
|
||||
if not isinstance(output, dict):
|
||||
msg = 'Unable to set output to "{0}" which is not a Python ' \
|
||||
'dictionary of string keys and boolean values'.format(output)
|
||||
raise ValueError(msg)
|
||||
|
||||
for element in output:
|
||||
keys = ['summary', 'cross_sections', 'tallies', 'distribmats']
|
||||
if element not in keys:
|
||||
msg = 'Unable to set output to "{0}" which is unsupported by ' \
|
||||
'OpenMC'.format(element)
|
||||
raise ValueError(msg)
|
||||
|
||||
if not isinstance(output[element], (bool, np.bool)):
|
||||
msg = 'Unable to set output for "{0}" to a non-boolean ' \
|
||||
'value "{1}"'.format(element, output[element])
|
||||
raise ValueError(msg)
|
||||
|
||||
cv.check_type('output', output, Mapping)
|
||||
for key, value in output.items():
|
||||
cv.check_value('output key', key, ('summary', 'tallies', 'path'))
|
||||
if key in ('summary', 'tallies'):
|
||||
cv.check_type("output['{}']".format(key), value, bool)
|
||||
else:
|
||||
cv.check_type("output['path']", value, string_types)
|
||||
self._output = output
|
||||
|
||||
@output_path.setter
|
||||
def output_path(self, output_path):
|
||||
cv.check_type('output path', output_path, string_types)
|
||||
self._output_path = output_path
|
||||
|
||||
@verbosity.setter
|
||||
def verbosity(self, verbosity):
|
||||
cv.check_type('verbosity', verbosity, Integral)
|
||||
|
|
@ -778,10 +768,27 @@ class Settings(object):
|
|||
|
||||
@resonance_scattering.setter
|
||||
def resonance_scattering(self, res):
|
||||
if not isinstance(res, MutableSequence):
|
||||
res = [res]
|
||||
self._resonance_scattering = cv.CheckedList(
|
||||
ResonanceScattering, 'resonance scattering models', res)
|
||||
cv.check_type('resonance scattering settings', res, Mapping)
|
||||
keys = ('enable', 'method', 'energy_min', 'energy_max', 'nuclides')
|
||||
for key, value in res.items():
|
||||
cv.check_value('resonance scattering dictionary key', key, keys)
|
||||
if key == 'enable':
|
||||
cv.check_type('resonance scattering enable', value, bool)
|
||||
elif key == 'method':
|
||||
cv.check_value('resonance scattering method', value,
|
||||
_RES_SCAT_METHODS)
|
||||
elif key == 'energy_min':
|
||||
name = 'resonance scattering minimum energy'
|
||||
cv.check_type(name, value, Real)
|
||||
cv.check_greater_than(name, value, 0)
|
||||
elif key == 'energy_max':
|
||||
name = 'resonance scattering minimum energy'
|
||||
cv.check_type(name, value, Real)
|
||||
cv.check_greater_than(name, value, 0)
|
||||
elif key == 'nuclides':
|
||||
cv.check_type('resonance scattering nuclides', value,
|
||||
Iterable, string_types)
|
||||
self._resonance_scattering = res
|
||||
|
||||
@volume_calculations.setter
|
||||
def volume_calculations(self, vol_calcs):
|
||||
|
|
@ -850,13 +857,12 @@ class Settings(object):
|
|||
if self._output is not None:
|
||||
element = ET.SubElement(root, "output")
|
||||
|
||||
for key in self._output:
|
||||
for key, value in self._output.items():
|
||||
subelement = ET.SubElement(element, key)
|
||||
subelement.text = str(self._output[key]).lower()
|
||||
|
||||
if self._output_path is not None:
|
||||
element = ET.SubElement(root, "output_path")
|
||||
element.text = self._output_path
|
||||
if key in ('summary', 'tallies'):
|
||||
subelement.text = str(value).lower()
|
||||
else:
|
||||
subelement.text = value
|
||||
|
||||
def _create_verbosity_subelement(self, root):
|
||||
if self._verbosity is not None:
|
||||
|
|
@ -991,7 +997,10 @@ class Settings(object):
|
|||
for key, value in sorted(self.temperature.items()):
|
||||
element = ET.SubElement(root,
|
||||
"temperature_{}".format(key))
|
||||
element.text = str(value)
|
||||
if isinstance(value, bool):
|
||||
element.text = str(value).lower()
|
||||
else:
|
||||
element.text = str(value)
|
||||
|
||||
def _create_threads_subelement(self, root):
|
||||
if self._threads is not None:
|
||||
|
|
@ -1049,10 +1058,24 @@ class Settings(object):
|
|||
subelement.text = str(self._dd_count_interactions).lower()
|
||||
|
||||
def _create_resonance_scattering_subelement(self, root):
|
||||
if len(self.resonance_scattering) > 0:
|
||||
res = self.resonance_scattering
|
||||
if res:
|
||||
elem = ET.SubElement(root, 'resonance_scattering')
|
||||
for r in self.resonance_scattering:
|
||||
elem.append(r.to_xml_element())
|
||||
if 'enable' in res:
|
||||
subelem = ET.SubElement(elem, 'enable')
|
||||
subelem.text = str(res['enable']).lower()
|
||||
if 'method' in res:
|
||||
subelem = ET.SubElement(elem, 'method')
|
||||
subelem.text = res['method']
|
||||
if 'energy_min' in res:
|
||||
subelem = ET.SubElement(elem, 'energy_min')
|
||||
subelem.text = str(res['energy_min'])
|
||||
if 'energy_max' in res:
|
||||
subelem = ET.SubElement(elem, 'energy_max')
|
||||
subelem.text = str(res['energy_max'])
|
||||
if 'nuclides' in res:
|
||||
subelem = ET.SubElement(elem, 'nuclides')
|
||||
subelem.text = ' '.join(res['nuclides'])
|
||||
|
||||
def _create_create_fission_neutrons_subelement(self, root):
|
||||
if self._create_fission_neutrons is not None:
|
||||
|
|
@ -1113,110 +1136,3 @@ class Settings(object):
|
|||
# Write the XML Tree to the settings.xml file
|
||||
tree = ET.ElementTree(root_element)
|
||||
tree.write(path, xml_declaration=True, encoding='utf-8', method="xml")
|
||||
|
||||
|
||||
class ResonanceScattering(object):
|
||||
"""Specification of the elastic scattering model for resonant isotopes
|
||||
|
||||
Parameters
|
||||
----------
|
||||
nuclide : openmc.Nuclide
|
||||
The nuclide affected by this resonance scattering treatment.
|
||||
method : {'ARES', 'CXS', 'DBRC', 'WCM'}
|
||||
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 : float
|
||||
The minimum energy above which the specified method is applied. By
|
||||
default, CXS will be used below E_min.
|
||||
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.
|
||||
|
||||
Attributes
|
||||
----------
|
||||
nuclide : openmc.Nuclide
|
||||
The nuclide affected by this resonance scattering treatment.
|
||||
method : {'ARES', 'CXS', 'DBRC', 'WCM'}
|
||||
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 : float
|
||||
The minimum energy above which the specified method is applied. By
|
||||
default, CXS will be used below E_min.
|
||||
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.
|
||||
|
||||
"""
|
||||
|
||||
def __init__(self, nuclide, method='CXS', E_min=None, E_max=None):
|
||||
self._E_min = None
|
||||
self._E_max = None
|
||||
self.nuclide = nuclide
|
||||
self.method = method
|
||||
if E_min is not None:
|
||||
self.E_min = E_min
|
||||
if E_max is not None:
|
||||
self.E_max = E_max
|
||||
|
||||
@property
|
||||
def nuclide(self):
|
||||
return self._nuclide
|
||||
|
||||
@property
|
||||
def method(self):
|
||||
return self._method
|
||||
|
||||
@property
|
||||
def E_min(self):
|
||||
return self._E_min
|
||||
|
||||
@property
|
||||
def E_max(self):
|
||||
return self._E_max
|
||||
|
||||
@nuclide.setter
|
||||
def nuclide(self, nuc):
|
||||
cv.check_type('nuclide', nuc, Nuclide)
|
||||
self._nuclide = nuc
|
||||
|
||||
@method.setter
|
||||
def method(self, m):
|
||||
cv.check_value('method', m, ('ARES', 'CXS', 'DBRC', 'WCM'))
|
||||
self._method = m
|
||||
|
||||
@E_min.setter
|
||||
def E_min(self, E):
|
||||
cv.check_type('E_min', E, Real)
|
||||
cv.check_greater_than('E_min', E, 0, True)
|
||||
self._E_min = E
|
||||
|
||||
@E_max.setter
|
||||
def E_max(self, E):
|
||||
cv.check_type('E_max', E, Real)
|
||||
cv.check_greater_than('E_max', E, 0, True)
|
||||
self._E_max = E
|
||||
|
||||
def to_xml_element(self):
|
||||
"""Return XML representation of the resonance scattering model
|
||||
|
||||
Returns
|
||||
-------
|
||||
element : xml.etree.ElementTree.Element
|
||||
XML element containing resonance scattering model
|
||||
|
||||
"""
|
||||
scatterer = ET.Element("scatterer")
|
||||
subelement = ET.SubElement(scatterer, 'nuclide')
|
||||
subelement.text = self.nuclide.name
|
||||
if self.method is not None:
|
||||
subelement = ET.SubElement(scatterer, 'method')
|
||||
subelement.text = self.method
|
||||
if self.E_min is not None:
|
||||
subelement = ET.SubElement(scatterer, 'E_min')
|
||||
subelement.text = str(self.E_min)
|
||||
if self.E_max is not None:
|
||||
subelement = ET.SubElement(scatterer, 'E_max')
|
||||
subelement.text = str(self.E_max)
|
||||
return scatterer
|
||||
|
|
|
|||
|
|
@ -143,6 +143,12 @@ class StatePoint(object):
|
|||
vol = openmc.VolumeCalculation.from_hdf5(path_i)
|
||||
self.add_volume_information(vol)
|
||||
|
||||
def __enter__(self):
|
||||
return self
|
||||
|
||||
def __exit__(self, *exc):
|
||||
self._f.close()
|
||||
|
||||
@property
|
||||
def cmfd_on(self):
|
||||
return self._f.attrs['cmfd_on'] > 0
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
from abc import ABCMeta
|
||||
from collections import Iterable
|
||||
from collections import Iterable, OrderedDict
|
||||
from copy import deepcopy
|
||||
from numbers import Real, Integral
|
||||
from xml.etree import ElementTree as ET
|
||||
from math import sqrt
|
||||
|
|
@ -82,6 +83,9 @@ class Surface(object):
|
|||
def __pos__(self):
|
||||
return Halfspace(self, '+')
|
||||
|
||||
def __hash__(self):
|
||||
return hash(repr(self))
|
||||
|
||||
def __repr__(self):
|
||||
string = 'Surface\n'
|
||||
string += '{0: <16}{1}{2}\n'.format('\tID', '=\t', self._id)
|
||||
|
|
@ -171,6 +175,35 @@ class Surface(object):
|
|||
return (np.array([-np.inf, -np.inf, -np.inf]),
|
||||
np.array([np.inf, np.inf, np.inf]))
|
||||
|
||||
def clone(self, memo=None):
|
||||
"""Create a copy of this surface with a new unique ID.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
memo : dict or None
|
||||
A nested dictionary of previously cloned objects. This parameter
|
||||
is used internally and should not be specified by the user.
|
||||
|
||||
Returns
|
||||
-------
|
||||
clone : openmc.Surface
|
||||
The clone of this surface
|
||||
|
||||
"""
|
||||
|
||||
if memo is None:
|
||||
memo = {}
|
||||
|
||||
# If no nemoize'd clone exists, instantiate one
|
||||
if self not in memo:
|
||||
clone = deepcopy(self)
|
||||
clone.id = None
|
||||
|
||||
# Memoize the clone
|
||||
memo[self] = clone
|
||||
|
||||
return memo[self]
|
||||
|
||||
def to_xml_element(self):
|
||||
"""Return XML representation of the surface
|
||||
|
||||
|
|
@ -1177,7 +1210,7 @@ class Sphere(Surface):
|
|||
y-coordinate of the center of the sphere
|
||||
z0 : float
|
||||
z-coordinate of the center of the sphere
|
||||
R : float
|
||||
r : float
|
||||
Radius of the sphere
|
||||
boundary_type : {'transmission, 'vacuum', 'reflective'}
|
||||
Boundary condition that defines the behavior for particles hitting the
|
||||
|
|
@ -1325,7 +1358,7 @@ class Cone(Surface):
|
|||
y-coordinate of the apex
|
||||
z0 : float
|
||||
z-coordinate of the apex
|
||||
R2 : float
|
||||
r2 : float
|
||||
Parameter related to the aperature
|
||||
boundary_type : {'transmission, 'vacuum', 'reflective'}
|
||||
Boundary condition that defines the behavior for particles hitting the
|
||||
|
|
@ -1821,7 +1854,7 @@ class Halfspace(Region):
|
|||
def __init__(self, surface, side):
|
||||
self.surface = surface
|
||||
self.side = side
|
||||
|
||||
|
||||
def __and__(self, other):
|
||||
if isinstance(other, Intersection):
|
||||
return Intersection(self, *other.nodes)
|
||||
|
|
@ -1880,6 +1913,51 @@ class Halfspace(Region):
|
|||
def __str__(self):
|
||||
return '-' + str(self.surface.id) if self.side == '-' \
|
||||
else str(self.surface.id)
|
||||
|
||||
def get_surfaces(self, surfaces=None):
|
||||
"""
|
||||
Returns the surface that this is a halfspace of.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
surfaces: collections.OrderedDict, optional
|
||||
Dictionary mapping surface IDs to :class:`openmc.Surface` instances
|
||||
|
||||
Returns
|
||||
-------
|
||||
surfaces: collections.OrderedDict
|
||||
Dictionary mapping surface IDs to :class:`openmc.Surface` instances
|
||||
|
||||
"""
|
||||
if surfaces is None:
|
||||
surfaces = OrderedDict()
|
||||
|
||||
surfaces[self.surface.id] = self.surface
|
||||
return surfaces
|
||||
|
||||
def clone(self, memo=None):
|
||||
"""Create a copy of this halfspace, with a cloned surface with a
|
||||
unique ID.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
memo : dict or None
|
||||
A nested dictionary of previously cloned objects. This parameter
|
||||
is used internally and should not be specified by the user.
|
||||
|
||||
Returns
|
||||
-------
|
||||
clone : openmc.Halfspace
|
||||
The clone of this halfspace
|
||||
|
||||
"""
|
||||
|
||||
if memo is None:
|
||||
memo = dict
|
||||
|
||||
clone = deepcopy(self)
|
||||
clone.surface = self.surface.clone(memo)
|
||||
return clone
|
||||
|
||||
|
||||
def get_rectangular_prism(width, height, axis='z', origin=(0., 0.),
|
||||
|
|
@ -2012,4 +2090,4 @@ def get_hexagonal_prism(edge_length=1., orientation='y',
|
|||
# y = sqrt(3)*(x + a)
|
||||
upper_left = Plane(A=-c, B=1., D=c*l, boundary_type=boundary_type)
|
||||
return Intersection(-top, +bottom, -upper_right, +lower_right,
|
||||
+lower_left, -upper_left)
|
||||
+lower_left, -upper_left)
|
||||
|
|
|
|||
|
|
@ -1348,7 +1348,7 @@ class Tally(object):
|
|||
|
||||
# If a user-requested Filter, get the user-requested bins
|
||||
for j, test_filter in enumerate(filters):
|
||||
if isinstance(self_filter, test_filter):
|
||||
if type(self_filter) is test_filter:
|
||||
bins = filter_bins[j]
|
||||
user_filter = True
|
||||
break
|
||||
|
|
@ -2126,7 +2126,6 @@ class Tally(object):
|
|||
----------
|
||||
filter1 : Filter
|
||||
The filter to swap with filter2
|
||||
|
||||
filter2 : Filter
|
||||
The filter to swap with filter1
|
||||
|
||||
|
|
@ -2153,15 +2152,6 @@ class Tally(object):
|
|||
'does not contain such a filter'.format(filter2.type, self.id)
|
||||
raise ValueError(msg)
|
||||
|
||||
# Swap the filters in the copied version of this Tally
|
||||
filter1_index = self.filters.index(filter1)
|
||||
filter2_index = self.filters.index(filter2)
|
||||
self.filters[filter1_index] = filter2
|
||||
self.filters[filter2_index] = filter1
|
||||
|
||||
# Update the tally's filter strides
|
||||
self._update_filter_strides()
|
||||
|
||||
# Construct lists of tuples for the bins in each of the two filters
|
||||
filters = [type(filter1), type(filter2)]
|
||||
if isinstance(filter1, openmc.DistribcellFilter):
|
||||
|
|
@ -2178,23 +2168,41 @@ class Tally(object):
|
|||
else:
|
||||
filter2_bins = [filter2.get_bin(i) for i in range(filter2.num_bins)]
|
||||
|
||||
# Adjust the mean data array to relect the new filter order
|
||||
if self.mean is not None:
|
||||
for bin1, bin2 in itertools.product(filter1_bins, filter2_bins):
|
||||
filter_bins = [(bin1,), (bin2,)]
|
||||
data = self.get_values(
|
||||
filters=filters, filter_bins=filter_bins, value='mean')
|
||||
indices = self.get_filter_indices(filters, filter_bins)
|
||||
self.mean[indices, :, :] = data
|
||||
# Create variables to store views of data in the misaligned structure
|
||||
mean = {}
|
||||
std_dev = {}
|
||||
|
||||
# Adjust the std_dev data array to relect the new filter order
|
||||
if self.std_dev is not None:
|
||||
for bin1, bin2 in itertools.product(filter1_bins, filter2_bins):
|
||||
filter_bins = [(bin1,), (bin2,)]
|
||||
data = self.get_values(
|
||||
# Store the data from the misaligned structure
|
||||
for i, (bin1, bin2) in enumerate(itertools.product(filter1_bins, filter2_bins)):
|
||||
filter_bins = [(bin1,), (bin2,)]
|
||||
|
||||
if self.mean is not None:
|
||||
mean[i] = self.get_values(
|
||||
filters=filters, filter_bins=filter_bins, value='mean')
|
||||
|
||||
if self.std_dev is not None:
|
||||
std_dev[i] = self.get_values(
|
||||
filters=filters, filter_bins=filter_bins, value='std_dev')
|
||||
indices = self.get_filter_indices(filters, filter_bins)
|
||||
self.std_dev[indices, :, :] = data
|
||||
|
||||
# Swap the filters in the copied version of this Tally
|
||||
filter1_index = self.filters.index(filter1)
|
||||
filter2_index = self.filters.index(filter2)
|
||||
self.filters[filter1_index] = filter2
|
||||
self.filters[filter2_index] = filter1
|
||||
|
||||
# Update the tally's filter strides
|
||||
self._update_filter_strides()
|
||||
|
||||
# Realign the data
|
||||
for i, (bin1, bin2) in enumerate(itertools.product(filter1_bins, filter2_bins)):
|
||||
filter_bins = [(bin1,), (bin2,)]
|
||||
indices = self.get_filter_indices(filters, filter_bins)
|
||||
|
||||
if self.mean is not None:
|
||||
self.mean[indices, :, :] = mean[i]
|
||||
|
||||
if self.std_dev is not None:
|
||||
self.std_dev[indices, :, :] = std_dev[i]
|
||||
|
||||
def _swap_nuclides(self, nuclide1, nuclide2):
|
||||
"""Reverse the ordering of two nuclides in this tally
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
from __future__ import division
|
||||
from copy import copy
|
||||
from collections import OrderedDict, Iterable
|
||||
from copy import copy, deepcopy
|
||||
from numbers import Integral, Real
|
||||
import random
|
||||
import sys
|
||||
|
|
@ -517,6 +517,41 @@ class Universe(object):
|
|||
|
||||
return universes
|
||||
|
||||
def clone(self, memo=None):
|
||||
"""Create a copy of this universe with a new unique ID, and clones
|
||||
all cells within this universe.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
memo : dict or None
|
||||
A nested dictionary of previously cloned objects. This parameter
|
||||
is used internally and should not be specified by the user.
|
||||
|
||||
Returns
|
||||
-------
|
||||
clone : openmc.Universe
|
||||
The clone of this universe
|
||||
|
||||
"""
|
||||
|
||||
if memo is None:
|
||||
memo = {}
|
||||
|
||||
# If no nemoize'd clone exists, instantiate one
|
||||
if self not in memo:
|
||||
clone = deepcopy(self)
|
||||
clone.id = None
|
||||
|
||||
# Clone all cells for the universe clone
|
||||
clone._cells = OrderedDict()
|
||||
for cell in self._cells.values():
|
||||
clone.add_cell(cell.clone(memo))
|
||||
|
||||
# Memoize the clone
|
||||
memo[self] = clone
|
||||
|
||||
return memo[self]
|
||||
|
||||
def create_xml_subelement(self, xml_element):
|
||||
# Iterate over all Cells
|
||||
for cell_id, cell in self._cells.items():
|
||||
|
|
|
|||
16
readme.rst
16
readme.rst
|
|
@ -10,10 +10,10 @@ transport code based on modern methods. It is a constructive solid geometry,
|
|||
continuous-energy transport code that uses HDF5 format cross sections. The
|
||||
project started under the Computational Reactor Physics Group at MIT.
|
||||
|
||||
Complete documentation on the usage of OpenMC is hosted on Read the Docs at
|
||||
http://openmc.readthedocs.io. If you are interested in the project or would like
|
||||
to help and contribute, please send a message to the OpenMC User's Group
|
||||
`mailing list`_.
|
||||
Complete documentation on the usage of OpenMC is hosted on Read the Docs (both
|
||||
for the `latest release`_ and developmental_ version). If you are interested in
|
||||
the project or would like to help and contribute, please send a message to the
|
||||
OpenMC User's Group `mailing list`_.
|
||||
|
||||
------------
|
||||
Installation
|
||||
|
|
@ -48,8 +48,10 @@ License
|
|||
|
||||
OpenMC is distributed under the MIT/X license_.
|
||||
|
||||
.. _latest release: http://openmc.readthedocs.io/en/stable/
|
||||
.. _developmental: http://openmc.readthedocs.io/en/latest/
|
||||
.. _mailing list: https://groups.google.com/forum/?fromgroups=#!forum/openmc-users
|
||||
.. _installation instructions: http://openmc.readthedocs.io/en/latest/usersguide/install.html
|
||||
.. _Troubleshooting section: http://openmc.readthedocs.io/en/latest/usersguide/troubleshoot.html
|
||||
.. _installation instructions: http://openmc.readthedocs.io/en/stable/usersguide/install.html
|
||||
.. _Troubleshooting section: http://openmc.readthedocs.io/en/stable/usersguide/troubleshoot.html
|
||||
.. _Issues: https://github.com/mit-crpg/openmc/issues
|
||||
.. _license: http://openmc.readthedocs.io/en/latest/license.html
|
||||
.. _license: http://openmc.readthedocs.io/en/stable/license.html
|
||||
|
|
|
|||
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