Merge remote-tracking branch 'upstream/develop' into bc_update

This commit is contained in:
Sterling Harper 2020-12-18 23:30:37 -07:00
commit 8879414824
160 changed files with 4720 additions and 3186 deletions

View file

@ -20,26 +20,15 @@ on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
# ImportErrors when building documentation
from unittest.mock import MagicMock
MOCK_MODULES = [
'numpy', 'numpy.polynomial', 'numpy.polynomial.polynomial',
'numpy.ctypeslib', 'scipy', 'scipy.sparse', 'scipy.sparse.linalg',
'scipy.interpolate', 'scipy.integrate', 'scipy.optimize', 'scipy.special',
'scipy.stats', 'scipy.spatial', 'h5py', 'pandas', 'uncertainties',
'matplotlib', 'matplotlib.pyplot', 'openmoc',
'openmc.data.reconstruct', 'openmc.checkvalue'
'openmoc', 'openmc.data.reconstruct',
]
sys.modules.update((mod_name, MagicMock()) for mod_name in MOCK_MODULES)
import numpy as np
np.ndarray = MagicMock
np.polynomial.Polynomial = MagicMock
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
sys.path.insert(0, os.path.abspath('../sphinxext'))
sys.path.insert(0, os.path.abspath('../..'))
@ -47,14 +36,16 @@ sys.path.insert(0, os.path.abspath('../..'))
# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = ['sphinx.ext.autodoc',
'sphinx.ext.napoleon',
'sphinx.ext.autosummary',
'sphinx.ext.intersphinx',
'sphinx.ext.viewcode',
'sphinxcontrib.katex',
'sphinx_numfig',
'notebook_sphinxext']
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.napoleon',
'sphinx.ext.autosummary',
'sphinx.ext.intersphinx',
'sphinx.ext.viewcode',
'sphinxcontrib.katex',
'sphinx_numfig',
'nbsphinx'
]
if not on_rtd:
extensions.append('sphinxcontrib.rsvgconverter')

View file

@ -0,0 +1 @@
../../../examples/jupyter/cad-based-geometry.ipynb

View file

@ -1,13 +0,0 @@
.. _notebook_cad-geom:
==========================
Using CAD-Based Geometries
==========================
.. only:: html
.. notebook:: ../../../examples/jupyter/cad-based-geometry.ipynb
.. only:: latex
IPython notebooks must be viewed in the online HTML documentation.

View file

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

View file

@ -1,13 +0,0 @@
.. _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.

View file

@ -0,0 +1 @@
../../../examples/jupyter/expansion-filters.ipynb

View file

@ -1,13 +0,0 @@
.. _notebook_expansion:
=====================
Functional Expansions
=====================
.. only:: html
.. notebook:: ../../../examples/jupyter/expansion-filters.ipynb
.. only:: latex
IPython notebooks must be viewed in the online HTML documentation.

View file

@ -0,0 +1 @@
../../../examples/jupyter/hexagonal-lattice.ipynb

View file

@ -1,13 +0,0 @@
.. _notebook_hexagonal:
===========================
Modeling Hexagonal Lattices
===========================
.. only:: html
.. notebook:: ../../../examples/jupyter/hexagonal-lattice.ipynb
.. only:: latex
IPython notebooks must be viewed in the online HTML documentation.

View file

@ -23,7 +23,7 @@ General Usage
search
nuclear-data
nuclear-data-resonance-covariance
pincell-depletion
pincell_depletion
--------
Geometry
@ -32,14 +32,14 @@ Geometry
.. toctree::
:maxdepth: 1
hexagonal
hexagonal-lattice
triso
candu
cad-geom
cad-based-geometry
------------------------------------
Multi-Group Cross Section Generation
------------------------------------
-----------------------------------
Multigroup Cross Section Generation
-----------------------------------
.. toctree::
:maxdepth: 1
@ -50,9 +50,9 @@ Multi-Group Cross Section Generation
mdgxs-part-i
mdgxs-part-ii
----------------
Multi-Group Mode
----------------
---------------
Multigroup Mode
---------------
.. toctree::
:maxdepth: 1

View file

@ -0,0 +1 @@
../../../examples/jupyter/mdgxs-part-i.ipynb

View file

@ -1,13 +0,0 @@
.. _notebook_mdgxs_part_i:
===================================================================
Multi-Group (Delayed) Cross Section Generation Part I: Introduction
===================================================================
.. only:: html
.. notebook:: ../../../examples/jupyter/mdgxs-part-i.ipynb
.. only:: latex
IPython notebooks must be viewed in the online HTML documentation.

View file

@ -0,0 +1 @@
../../../examples/jupyter/mdgxs-part-ii.ipynb

View file

@ -1,13 +0,0 @@
.. _notebook_mdgxs_part_ii:
=========================================================================
Multi-Group (Delayed) Cross Section Generation Part II: Advanced Features
=========================================================================
.. only:: html
.. notebook:: ../../../examples/jupyter/mdgxs-part-ii.ipynb
.. only:: latex
IPython notebooks must be viewed in the online HTML documentation.

View file

@ -0,0 +1 @@
../../../examples/jupyter/mg-mode-part-i.ipynb

View file

@ -1,13 +0,0 @@
.. _notebook_mg_mode_part_i:
=====================================
Multi-Group Mode Part I: Introduction
=====================================
.. only:: html
.. notebook:: ../../../examples/jupyter/mg-mode-part-i.ipynb
.. only:: latex
IPython notebooks must be viewed in the online HTML documentation.

View file

@ -0,0 +1 @@
../../../examples/jupyter/mg-mode-part-ii.ipynb

View file

@ -1,13 +0,0 @@
.. _notebook_mg_mode_part_ii:
=============================================================
Multi-Group Mode Part II: MGXS Library Generation With OpenMC
=============================================================
.. only:: html
.. notebook:: ../../../examples/jupyter/mg-mode-part-ii.ipynb
.. only:: latex
IPython notebooks must be viewed in the online HTML documentation.

View file

@ -0,0 +1 @@
../../../examples/jupyter/mg-mode-part-iii.ipynb

View file

@ -1,13 +0,0 @@
.. _notebook_mg_mode_part_iii:
====================================================
Multi-Group Mode Part III: Advanced Feature Showcase
====================================================
.. only:: html
.. notebook:: ../../../examples/jupyter/mg-mode-part-iii.ipynb
.. only:: latex
IPython notebooks must be viewed in the online HTML documentation.

View file

@ -0,0 +1 @@
../../../examples/jupyter/mgxs-part-i.ipynb

View file

@ -1,13 +0,0 @@
.. _notebook_mgxs_part_i:
=========================
MGXS Part I: Introduction
=========================
.. only:: html
.. notebook:: ../../../examples/jupyter/mgxs-part-i.ipynb
.. only:: latex
IPython notebooks must be viewed in the online HTML documentation.

View file

@ -0,0 +1 @@
../../../examples/jupyter/mgxs-part-ii.ipynb

View file

@ -1,13 +0,0 @@
.. _notebook_mgxs_part_ii:
===============================
MGXS Part II: Advanced Features
===============================
.. only:: html
.. notebook:: ../../../examples/jupyter/mgxs-part-ii.ipynb
.. only:: latex
IPython notebooks must be viewed in the online HTML documentation.

View file

@ -0,0 +1 @@
../../../examples/jupyter/mgxs-part-iii.ipynb

View file

@ -1,13 +0,0 @@
.. _notebook_mgxs_part_iii:
========================
MGXS Part III: Libraries
========================
.. only:: html
.. notebook:: ../../../examples/jupyter/mgxs-part-iii.ipynb
.. only:: latex
IPython notebooks must be viewed in the online HTML documentation.

View file

@ -0,0 +1 @@
../../../examples/jupyter/nuclear-data-resonance-covariance.ipynb

View file

@ -1,13 +0,0 @@
.. _notebook_nuclear_data_resonance_covariance:
==================================
Nuclear Data: Resonance Covariance
==================================
.. only:: html
.. notebook:: ../../../examples/jupyter/nuclear-data-resonance-covariance.ipynb
.. only:: latex
IPython notebooks must be viewed in the online HTML documentation.

View file

@ -0,0 +1 @@
../../../examples/jupyter/nuclear-data.ipynb

View file

@ -1,13 +0,0 @@
.. _notebook_nuclear_data:
============
Nuclear Data
============
.. only:: html
.. notebook:: ../../../examples/jupyter/nuclear-data.ipynb
.. only:: latex
IPython notebooks must be viewed in the online HTML documentation.

View file

@ -0,0 +1 @@
../../../examples/jupyter/pandas-dataframes.ipynb

View file

@ -1,13 +0,0 @@
.. _examples_pandas:
=================
Pandas Dataframes
=================
.. only:: html
.. notebook:: ../../../examples/jupyter/pandas-dataframes.ipynb
.. only:: latex
IPython notebooks must be viewed in the online HTML documentation.

View file

@ -1,14 +0,0 @@
.. _notebook_depletion:
=================
Pincell Depletion
=================
.. only:: html
.. notebook:: ../../../examples/jupyter/pincell_depletion.ipynb
.. only:: latex
IPython notebooks must be viewed in the online HTML documentation.

View file

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

View file

@ -1,13 +0,0 @@
.. _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.

View file

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

View file

@ -0,0 +1 @@
../../../examples/jupyter/post-processing.ipynb

View file

@ -1,13 +0,0 @@
.. _notebook_post_processing:
===============
Post Processing
===============
.. only:: html
.. notebook:: ../../../examples/jupyter/post-processing.ipynb
.. only:: latex
IPython notebooks must be viewed in the online HTML documentation.

View file

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

View file

@ -1,13 +0,0 @@
.. _notebook_search:
==================
Criticality Search
==================
.. only:: html
.. notebook:: ../../../examples/jupyter/search.ipynb
.. only:: latex
IPython notebooks must be viewed in the online HTML documentation.

View file

@ -0,0 +1 @@
../../../examples/jupyter/tally-arithmetic.ipynb

View file

@ -1,11 +0,0 @@
================
Tally Arithmetic
================
.. only:: html
.. notebook:: ../../../examples/jupyter/tally-arithmetic.ipynb
.. only:: latex
IPython notebooks must be viewed in the online HTML documentation.

View file

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

View file

@ -1,13 +0,0 @@
.. _notebook_triso:
========================
Modeling TRISO Particles
========================
.. only:: html
.. notebook:: ../../../examples/jupyter/triso.ipynb
.. only:: latex
IPython notebooks must be viewed in the online HTML documentation.

View file

@ -0,0 +1 @@
../../../examples/jupyter/unstructured-mesh-part-i.ipynb

View file

@ -1,13 +0,0 @@
.. _notebook_unstructured_mesh_part_i:
===============================
Unstructured Mesh: Introduction
===============================
.. only:: html
.. notebook:: ../../../examples/jupyter/unstructured-mesh-part-i.ipynb
.. only:: latex
IPython notebooks must be viewed in the online HTML documentation.

View file

@ -0,0 +1 @@
../../../examples/jupyter/unstructured-mesh-part-ii.ipynb

View file

@ -1,13 +0,0 @@
.. _notebook_unstructured_mesh_part_ii:
===================================================================================
Unstructured Mesh: Unstructured Mesh Tallies with CAD and Point Cloud Visualization
===================================================================================
.. only:: html
.. notebook:: ../../../examples/jupyter/unstructured-mesh-part-ii.ipynb
.. only:: latex
IPython notebooks must be viewed in the online HTML documentation.

View file

@ -465,7 +465,7 @@ attributes/sub-elements:
as complex as is required to define the source for your problem. The library
has a few basic requirements:
* It must contain a class that inherits from ``openmc::CustomSource``;
* It must contain a class that inherits from ``openmc::Source``;
* The class must implement a function called ``sample()``;
* There must be an ``openmc_create_source()`` function that creates the source
as a unique pointer. This function can be used to pass parameters through to

View file

@ -15,7 +15,7 @@ is that documented here.
:Datasets:
- **source_bank** (Compound type) -- Source bank information for each
particle. The compound type has fields ``wgt``, ``xyz``, ``uvw``,
``E``, ``delayed_group``, and ``particle``, which represent the
weight, position, direction, energy, energy group, delayed group,
and type of the source particle, respectively.
particle. The compound type has fields ``r``, ``u``, ``E``,
``wgt``, ``delayed_group``, and ``particle``, which represent the
position, direction, energy, weight, delayed group, and particle
type (0=neutron, 1=photon, 2=electron, 3=positron), respectively.

View file

@ -51,11 +51,11 @@ The current version of the statepoint file format is 17.0.
- **global_tallies** (*double[][2]*) -- Accumulated sum and
sum-of-squares for each global tally.
- **source_bank** (Compound type) -- Source bank information for each
particle. The compound type has fields ``wgt``, ``xyz``, ``uvw``,
``E``, ``g``, and ``delayed_group``, which represent the weight,
position, direction, energy, energy group, and delayed_group of the
source particle, respectively. Only present when `run_mode` is
'eigenvalue'.
particle. The compound type has fields ``r``, ``u``, ``E``,
``wgt``, ``delayed_group``, and ``particle``, which represent the
position, direction, energy, weight, delayed group, and particle
type (0=neutron, 1=photon, 2=electron, 3=positron), respectively.
Only present when `run_mode` is 'eigenvalue'.
**/tallies/**

View file

@ -22,9 +22,19 @@ Simulation Settings
:template: myclass.rst
openmc.Source
openmc.SourceParticle
openmc.VolumeCalculation
openmc.Settings
The following function can be used for generating a source file:
.. autosummary::
:toctree: generated
:nosignatures:
:template: myfunction.rst
openmc.write_source_file
Material Specification
----------------------

View file

@ -30,6 +30,7 @@ Multi-group Cross Sections
:template: myclassinherit.rst
openmc.mgxs.MGXS
openmc.mgxs.MatrixMGXS
openmc.mgxs.AbsorptionXS
openmc.mgxs.CaptureXS
openmc.mgxs.Chi
@ -45,6 +46,9 @@ Multi-group Cross Sections
openmc.mgxs.ScatterProbabilityMatrix
openmc.mgxs.TotalXS
openmc.mgxs.TransportXS
openmc.mgxs.ArbitraryXS
openmc.mgxs.ArbitraryMatrixXS
openmc.mgxs.MeshSurfaceMGXS
Multi-delayed-group Cross Sections
----------------------------------
@ -55,6 +59,7 @@ Multi-delayed-group Cross Sections
:template: myclassinherit.rst
openmc.mgxs.MDGXS
openmc.mgxs.MatrixMDGXS
openmc.mgxs.ChiDelayed
openmc.mgxs.DelayedNuFissionXS
openmc.mgxs.DelayedNuFissionMatrixXS

View file

@ -194,9 +194,9 @@ below.
#include "openmc/source.h"
#include "openmc/particle.h"
class Source : public openmc::CustomSource
class CustomSource : public openmc::Source
{
openmc::Particle::Bank sample(uint64_t* seed)
openmc::Particle::Bank sample(uint64_t* seed) const
{
openmc::Particle::Bank particle;
// weight
@ -216,16 +216,16 @@ below.
}
};
extern "C" std::unique_ptr<Source> openmc_create_source(std::string parameters)
extern "C" std::unique_ptr<CustomSource> openmc_create_source(std::string parameters)
{
return std::make_unique<Source>();
return std::make_unique<CustomSource>();
}
The above source creates monodirectional 14.08 MeV neutrons that are distributed
in a ring with a 3 cm radius. This routine is not particularly complex, but
should serve as an example upon which to build more complicated sources.
.. note:: The source class must inherit from ``openmc::CustomSource`` and
.. note:: The source class must inherit from ``openmc::Source`` and
implement a ``sample()`` function.
.. note:: The ``openmc_create_source()`` function signature must be declared
@ -266,12 +266,12 @@ the source class when it is created:
#include "openmc/source.h"
#include "openmc/particle.h"
class Source : public openmc::CustomSource {
class CustomSource : public openmc::Source {
public:
Source(double energy) : energy_{energy} { }
CustomSource(double energy) : energy_{energy} { }
// Samples from an instance of this class.
openmc::Particle::Bank sample(uint64_t* seed)
openmc::Particle::Bank sample(uint64_t* seed) const
{
openmc::Particle::Bank particle;
// weight
@ -293,9 +293,9 @@ the source class when it is created:
double energy_;
};
extern "C" std::unique_ptr<Source> openmc_create_source(std::string parameter) {
extern "C" std::unique_ptr<CustomSource> openmc_create_source(std::string parameter) {
double energy = std::stod(parameter);
return std::make_unique<Source>(energy);
return std::make_unique<CustomSource>(energy);
}
As with the basic custom source functionality, the custom source library