mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 06:05:58 -04:00
Merge pull request #946 from paulromano/eq-hash
Ensure mutable objects are not hashable
This commit is contained in:
commit
a149ef42a0
36 changed files with 1961 additions and 2835 deletions
|
|
@ -27,8 +27,8 @@ except ImportError:
|
|||
MOCK_MODULES = ['numpy', 'numpy.polynomial', 'numpy.polynomial.polynomial',
|
||||
'numpy.ctypeslib', 'scipy', 'scipy.sparse', 'scipy.interpolate',
|
||||
'scipy.integrate', 'scipy.optimize', 'scipy.special',
|
||||
'scipy.stats','h5py', 'pandas', 'uncertainties', 'openmoc',
|
||||
'openmc.data.reconstruct']
|
||||
'scipy.stats', 'h5py', 'pandas', 'uncertainties',
|
||||
'matplotlib.pyplot','openmoc', 'openmc.data.reconstruct']
|
||||
sys.modules.update((mod_name, MagicMock()) for mod_name in MOCK_MODULES)
|
||||
|
||||
import numpy as np
|
||||
|
|
|
|||
|
|
@ -92,20 +92,8 @@ Each ``material`` element can have the following attributes or sub-elements:
|
|||
.. 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 an
|
||||
attribute/sub-element called ``name``. The ``name`` attribute
|
||||
|
|
@ -119,6 +107,17 @@ Each ``material`` element can have the following attributes or sub-elements:
|
|||
|
||||
.. note:: This element is not used in the multi-group :ref:`energy_mode`.
|
||||
|
||||
:isotropic:
|
||||
The ``isotropic`` element indicates a list of nuclides for which elastic
|
||||
scattering should be treated as though it were isotropic in the laboratory
|
||||
system. This element 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*: No nuclides are treated as have isotropic elastic scattering.
|
||||
|
||||
.. 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
|
||||
|
|
|
|||
|
|
@ -148,11 +148,9 @@
|
|||
"source": [
|
||||
"To build the actual 2-D model, we will first begin by creating the `materials.xml` file.\n",
|
||||
"\n",
|
||||
"First we need to define materials that will be used in the problem. In other notebooks, either `openmc.Nuclide`s or `openmc.Element`s were created at the equivalent stage. We can do that in multi-group mode as well. However, multi-group cross-sections are sometimes provided as macroscopic cross-sections; the C5G7 benchmark data are macroscopic. In this case, we can instead use `openmc.Macroscopic` objects to in-place of `openmc.Nuclide` or `openmc.Element` objects.\n",
|
||||
"First we need to define materials that will be used in the problem. In other notebooks, either nuclides or elements were added to materials at the equivalent stage. We can do that in multi-group mode as well. However, multi-group cross-sections are sometimes provided as macroscopic cross-sections; the C5G7 benchmark data are macroscopic. In this case, we can instead use the `Material.add_macroscopic` method to specific a macroscopic object. Unlike for nuclides and elements, we do not need provide information on atom/weight percents as no number densities are needed.\n",
|
||||
"\n",
|
||||
"`openmc.Macroscopic`, unlike `openmc.Nuclide` and `openmc.Element` objects, do not need to be provided enough information to calculate number densities, as no number densities are needed.\n",
|
||||
"\n",
|
||||
"When assigning `openmc.Macroscopic` objects to `openmc.Material` objects, the density can still be scaled by setting the density to a value that is not 1.0. This would be useful, for example, when slightly perturbing the density of water due to a small change in temperature (while of course ignoring any resultant spectral shift). The density of a macroscopic dataset is set to 1.0 in the `openmc.Material` object by default when an `openmc.Macroscopic` dataset is used; so we will show its use the first time and then afterwards it will not be required.\n",
|
||||
"When assigning macroscopic objects to a material, the density can still be scaled by setting the density to a value that is not 1.0. This would be useful, for example, when slightly perturbing the density of water due to a small change in temperature (while of course ignoring any resultant spectral shift). The density of a macroscopic dataset is set to 1.0 in the `openmc.Material` object by default when a macroscopic dataset is used; so we will show its use the first time and then afterwards it will not be required.\n",
|
||||
"\n",
|
||||
"Aside from these differences, the following code is very similar to similar code in other OpenMC example Notebooks."
|
||||
]
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -151,7 +151,7 @@
|
|||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"First we need to define materials that will be used in the problem. Before defining a material, we must create nuclides that are used in the material."
|
||||
"We being by creating a material for the homogeneous medium."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
|
@ -161,38 +161,15 @@
|
|||
"collapsed": true
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# Instantiate some Nuclides\n",
|
||||
"h1 = openmc.Nuclide('H1')\n",
|
||||
"o16 = openmc.Nuclide('O16')\n",
|
||||
"u235 = openmc.Nuclide('U235')\n",
|
||||
"u238 = openmc.Nuclide('U238')\n",
|
||||
"zr90 = openmc.Nuclide('Zr90')"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"With the nuclides we defined, we will now create a material for the homogeneous medium."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 4,
|
||||
"metadata": {
|
||||
"collapsed": true
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# Instantiate a Material and register the Nuclides\n",
|
||||
"inf_medium = openmc.Material(name='moderator')\n",
|
||||
"inf_medium.set_density('g/cc', 5.)\n",
|
||||
"inf_medium.add_nuclide(h1, 0.028999667)\n",
|
||||
"inf_medium.add_nuclide(o16, 0.01450188)\n",
|
||||
"inf_medium.add_nuclide(u235, 0.000114142)\n",
|
||||
"inf_medium.add_nuclide(u238, 0.006886019)\n",
|
||||
"inf_medium.add_nuclide(zr90, 0.002116053)"
|
||||
"inf_medium.add_nuclide('H1', 0.028999667)\n",
|
||||
"inf_medium.add_nuclide('O16', 0.01450188)\n",
|
||||
"inf_medium.add_nuclide('U235', 0.000114142)\n",
|
||||
"inf_medium.add_nuclide('U238', 0.006886019)\n",
|
||||
"inf_medium.add_nuclide('Zr90', 0.002116053)"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
|
@ -204,7 +181,7 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 5,
|
||||
"execution_count": 4,
|
||||
"metadata": {
|
||||
"collapsed": true
|
||||
},
|
||||
|
|
@ -224,7 +201,7 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 6,
|
||||
"execution_count": 5,
|
||||
"metadata": {
|
||||
"collapsed": true
|
||||
},
|
||||
|
|
@ -246,7 +223,7 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 7,
|
||||
"execution_count": 6,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
|
|
@ -271,15 +248,14 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 8,
|
||||
"execution_count": 7,
|
||||
"metadata": {
|
||||
"collapsed": true
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# Instantiate Universe\n",
|
||||
"root_universe = openmc.Universe(universe_id=0, name='root universe')\n",
|
||||
"root_universe.add_cell(cell)"
|
||||
"# Create root universe\n",
|
||||
"root_universe = openmc.Universe(name='root universe', cells=[cell])"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
|
@ -291,15 +267,14 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 9,
|
||||
"execution_count": 8,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# Create Geometry and set root Universe\n",
|
||||
"openmc_geometry = openmc.Geometry()\n",
|
||||
"openmc_geometry.root_universe = root_universe\n",
|
||||
"openmc_geometry = openmc.Geometry(root_universe)\n",
|
||||
"\n",
|
||||
"# Export to \"geometry.xml\"\n",
|
||||
"openmc_geometry.export_to_xml()"
|
||||
|
|
@ -314,7 +289,7 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 10,
|
||||
"execution_count": 9,
|
||||
"metadata": {
|
||||
"collapsed": true
|
||||
},
|
||||
|
|
@ -350,7 +325,7 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 11,
|
||||
"execution_count": 10,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
|
|
@ -389,7 +364,7 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 12,
|
||||
"execution_count": 11,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
|
|
@ -414,7 +389,7 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 13,
|
||||
"execution_count": 12,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
|
|
@ -423,13 +398,13 @@
|
|||
"data": {
|
||||
"text/plain": [
|
||||
"OrderedDict([('flux', Tally\n",
|
||||
" \tID =\t10000\n",
|
||||
" \tID =\t1\n",
|
||||
" \tName =\t\n",
|
||||
" \tFilters =\tCellFilter, EnergyFilter\n",
|
||||
" \tNuclides =\ttotal \n",
|
||||
" \tScores =\t['flux']\n",
|
||||
" \tEstimator =\ttracklength), ('absorption', Tally\n",
|
||||
" \tID =\t10001\n",
|
||||
" \tID =\t2\n",
|
||||
" \tName =\t\n",
|
||||
" \tFilters =\tCellFilter, EnergyFilter\n",
|
||||
" \tNuclides =\ttotal \n",
|
||||
|
|
@ -437,7 +412,7 @@
|
|||
" \tEstimator =\ttracklength)])"
|
||||
]
|
||||
},
|
||||
"execution_count": 13,
|
||||
"execution_count": 12,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
|
|
@ -455,11 +430,22 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 14,
|
||||
"execution_count": 13,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"outputs": [],
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stderr",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"/home/romano/openmc/openmc/mixin.py:61: IDWarning: Another CellFilter instance already exists with id=3.\n",
|
||||
" warn(msg, IDWarning)\n",
|
||||
"/home/romano/openmc/openmc/mixin.py:61: IDWarning: Another EnergyFilter instance already exists with id=4.\n",
|
||||
" warn(msg, IDWarning)\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"# Instantiate an empty Tallies object\n",
|
||||
"tallies_file = openmc.Tallies()\n",
|
||||
|
|
@ -486,7 +472,7 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 15,
|
||||
"execution_count": 14,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
|
|
@ -523,37 +509,27 @@
|
|||
" | The OpenMC Monte Carlo Code\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 | 43b141e9ba542da8b28c078cf2df8a6777cfb2ad\n",
|
||||
" Date/Time | 2017-02-28 11:52:00\n",
|
||||
" Version | 0.9.0\n",
|
||||
" Git SHA1 | 9b7cebf7bc34d60e0f1750c3d6cb103df11e8dc4\n",
|
||||
" Date/Time | 2017-12-04 20:56:46\n",
|
||||
" OpenMP Threads | 4\n",
|
||||
"\n",
|
||||
" ===========================================================================\n",
|
||||
" ========================> INITIALIZATION <=========================\n",
|
||||
" ===========================================================================\n",
|
||||
"\n",
|
||||
" Reading settings XML file...\n",
|
||||
" Reading geometry XML file...\n",
|
||||
" Reading materials XML file...\n",
|
||||
" Reading cross sections XML file...\n",
|
||||
" Reading H1 from\n",
|
||||
" /home/wbinventor/Documents/NSE-CRPG-Codes/openmc/data/nndc_hdf5/H1.h5\n",
|
||||
" Reading O16 from\n",
|
||||
" /home/wbinventor/Documents/NSE-CRPG-Codes/openmc/data/nndc_hdf5/O16.h5\n",
|
||||
" Reading U235 from\n",
|
||||
" /home/wbinventor/Documents/NSE-CRPG-Codes/openmc/data/nndc_hdf5/U235.h5\n",
|
||||
" Reading U238 from\n",
|
||||
" /home/wbinventor/Documents/NSE-CRPG-Codes/openmc/data/nndc_hdf5/U238.h5\n",
|
||||
" Reading Zr90 from\n",
|
||||
" /home/wbinventor/Documents/NSE-CRPG-Codes/openmc/data/nndc_hdf5/Zr90.h5\n",
|
||||
" Reading materials XML file...\n",
|
||||
" Reading geometry XML file...\n",
|
||||
" Building neighboring cells lists for each surface...\n",
|
||||
" Reading H1 from /home/romano/openmc/scripts/nndc_hdf5/H1.h5\n",
|
||||
" Reading O16 from /home/romano/openmc/scripts/nndc_hdf5/O16.h5\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 Zr90 from /home/romano/openmc/scripts/nndc_hdf5/Zr90.h5\n",
|
||||
" Maximum neutron transport energy: 2.00000E+07 eV for H1\n",
|
||||
" Reading tallies XML file...\n",
|
||||
" Building neighboring cells lists for each surface...\n",
|
||||
" Writing summary.h5 file...\n",
|
||||
" Initializing source particles...\n",
|
||||
"\n",
|
||||
" ===========================================================================\n",
|
||||
" ====================> K EIGENVALUE SIMULATION <====================\n",
|
||||
" ===========================================================================\n",
|
||||
"\n",
|
||||
" Bat./Gen. k Average k \n",
|
||||
" ========= ======== ==================== \n",
|
||||
|
|
@ -609,27 +585,22 @@
|
|||
" 50/1 1.15798 1.16146 +/- 0.00457\n",
|
||||
" Creating state point statepoint.50.h5...\n",
|
||||
"\n",
|
||||
" ===========================================================================\n",
|
||||
" ======================> SIMULATION FINISHED <======================\n",
|
||||
" ===========================================================================\n",
|
||||
"\n",
|
||||
"\n",
|
||||
" =======================> TIMING STATISTICS <=======================\n",
|
||||
"\n",
|
||||
" Total time for initialization = 3.0114E-01 seconds\n",
|
||||
" Reading cross sections = 1.8743E-01 seconds\n",
|
||||
" Total time in simulation = 9.7641E+00 seconds\n",
|
||||
" Time in transport only = 9.5168E+00 seconds\n",
|
||||
" Time in inactive batches = 1.2602E+00 seconds\n",
|
||||
" Time in active batches = 8.5039E+00 seconds\n",
|
||||
" Time synchronizing fission bank = 5.4293E-03 seconds\n",
|
||||
" Sampling source sites = 4.3508E-03 seconds\n",
|
||||
" SEND/RECV source sites = 9.9399E-04 seconds\n",
|
||||
" Time accumulating tallies = 1.2758E-04 seconds\n",
|
||||
" Total time for finalization = 3.6982E-04 seconds\n",
|
||||
" Total time elapsed = 1.0075E+01 seconds\n",
|
||||
" Calculation Rate (inactive) = 19838.7 neutrons/second\n",
|
||||
" Calculation Rate (active) = 11759.3 neutrons/second\n",
|
||||
" Total time for initialization = 4.0504E-01 seconds\n",
|
||||
" Reading cross sections = 3.6457E-01 seconds\n",
|
||||
" Total time in simulation = 6.3478E+00 seconds\n",
|
||||
" Time in transport only = 6.0079E+00 seconds\n",
|
||||
" Time in inactive batches = 8.1713E-01 seconds\n",
|
||||
" Time in active batches = 5.5307E+00 seconds\n",
|
||||
" Time synchronizing fission bank = 5.4640E-03 seconds\n",
|
||||
" Sampling source sites = 4.0981E-03 seconds\n",
|
||||
" SEND/RECV source sites = 1.2606E-03 seconds\n",
|
||||
" Time accumulating tallies = 1.2030E-04 seconds\n",
|
||||
" Total time for finalization = 9.6554E-04 seconds\n",
|
||||
" Total time elapsed = 6.7713E+00 seconds\n",
|
||||
" Calculation Rate (inactive) = 30594.8 neutrons/second\n",
|
||||
" Calculation Rate (active) = 18080.8 neutrons/second\n",
|
||||
"\n",
|
||||
" ============================> RESULTS <============================\n",
|
||||
"\n",
|
||||
|
|
@ -647,7 +618,7 @@
|
|||
"0"
|
||||
]
|
||||
},
|
||||
"execution_count": 15,
|
||||
"execution_count": 14,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
|
|
@ -673,7 +644,7 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 16,
|
||||
"execution_count": 15,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
|
|
@ -699,7 +670,7 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 17,
|
||||
"execution_count": 16,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
|
|
@ -734,7 +705,7 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 18,
|
||||
"execution_count": 17,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
|
|
@ -769,7 +740,7 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 19,
|
||||
"execution_count": 18,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
|
|
@ -816,7 +787,7 @@
|
|||
"0 1 2 total 1.292013 0.007642"
|
||||
]
|
||||
},
|
||||
"execution_count": 19,
|
||||
"execution_count": 18,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
|
|
@ -835,7 +806,7 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 20,
|
||||
"execution_count": 19,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
|
|
@ -853,7 +824,7 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 21,
|
||||
"execution_count": 20,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
|
|
@ -880,7 +851,7 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 22,
|
||||
"execution_count": 21,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
|
|
@ -920,7 +891,7 @@
|
|||
" <td>2.000000e+07</td>\n",
|
||||
" <td>total</td>\n",
|
||||
" <td>(((total / flux) - (absorption / flux)) - (sca...</td>\n",
|
||||
" <td>1.776357e-15</td>\n",
|
||||
" <td>7.771561e-16</td>\n",
|
||||
" <td>0.002570</td>\n",
|
||||
" </tr>\n",
|
||||
" </tbody>\n",
|
||||
|
|
@ -934,10 +905,10 @@
|
|||
"\n",
|
||||
" score mean std. dev. \n",
|
||||
"0 (((total / flux) - (absorption / flux)) - (sca... -1.11e-15 1.13e-02 \n",
|
||||
"1 (((total / flux) - (absorption / flux)) - (sca... 1.78e-15 2.57e-03 "
|
||||
"1 (((total / flux) - (absorption / flux)) - (sca... 7.77e-16 2.57e-03 "
|
||||
]
|
||||
},
|
||||
"execution_count": 22,
|
||||
"execution_count": 21,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
|
|
@ -959,7 +930,7 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 23,
|
||||
"execution_count": 22,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
|
|
@ -1016,7 +987,7 @@
|
|||
"1 ((absorption / flux) / (total / flux)) 1.93e-02 9.46e-05 "
|
||||
]
|
||||
},
|
||||
"execution_count": 23,
|
||||
"execution_count": 22,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
|
|
@ -1031,7 +1002,7 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 24,
|
||||
"execution_count": 23,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
|
|
@ -1088,7 +1059,7 @@
|
|||
"1 ((scatter / flux) / (total / flux)) 9.81e-01 3.74e-03 "
|
||||
]
|
||||
},
|
||||
"execution_count": 24,
|
||||
"execution_count": 23,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
|
|
@ -1110,7 +1081,7 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 25,
|
||||
"execution_count": 24,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
|
|
@ -1167,7 +1138,7 @@
|
|||
"1 (((absorption / flux) / (total / flux)) + ((sc... 1.00e+00 3.74e-03 "
|
||||
]
|
||||
},
|
||||
"execution_count": 25,
|
||||
"execution_count": 24,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
|
|
@ -1197,7 +1168,7 @@
|
|||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.5.2"
|
||||
"version": "3.6.0"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -63,31 +63,7 @@
|
|||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"First we need to define materials that will be used in the problem. Before defining a material, we must create nuclides that are used in the material."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# Instantiate some Nuclides\n",
|
||||
"h1 = openmc.Nuclide('H1')\n",
|
||||
"b10 = openmc.Nuclide('B10')\n",
|
||||
"o16 = openmc.Nuclide('O16')\n",
|
||||
"u235 = openmc.Nuclide('U235')\n",
|
||||
"u238 = openmc.Nuclide('U238')\n",
|
||||
"zr90 = openmc.Nuclide('Zr90')"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"With the nuclides we defined, we will now create three materials for the fuel, water, and cladding of the fuel pins."
|
||||
"First we need to define materials that will be used in the problem. We'll create three materials for the fuel, water, and cladding of the fuel pins."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
|
@ -101,21 +77,21 @@
|
|||
"# 1.6 enriched fuel\n",
|
||||
"fuel = openmc.Material(name='1.6% Fuel')\n",
|
||||
"fuel.set_density('g/cm3', 10.31341)\n",
|
||||
"fuel.add_nuclide(u235, 3.7503e-4)\n",
|
||||
"fuel.add_nuclide(u238, 2.2625e-2)\n",
|
||||
"fuel.add_nuclide(o16, 4.6007e-2)\n",
|
||||
"fuel.add_nuclide('U235', 3.7503e-4)\n",
|
||||
"fuel.add_nuclide('U238', 2.2625e-2)\n",
|
||||
"fuel.add_nuclide('O16', 4.6007e-2)\n",
|
||||
"\n",
|
||||
"# borated water\n",
|
||||
"water = openmc.Material(name='Borated Water')\n",
|
||||
"water.set_density('g/cm3', 0.740582)\n",
|
||||
"water.add_nuclide(h1, 4.9457e-2)\n",
|
||||
"water.add_nuclide(o16, 2.4732e-2)\n",
|
||||
"water.add_nuclide(b10, 8.0042e-6)\n",
|
||||
"water.add_nuclide('H1', 4.9457e-2)\n",
|
||||
"water.add_nuclide('O16', 2.4732e-2)\n",
|
||||
"water.add_nuclide('B10', 8.0042e-6)\n",
|
||||
"\n",
|
||||
"# zircaloy\n",
|
||||
"zircaloy = openmc.Material(name='Zircaloy')\n",
|
||||
"zircaloy.set_density('g/cm3', 6.55)\n",
|
||||
"zircaloy.add_nuclide(zr90, 7.2758e-3)"
|
||||
"zircaloy.add_nuclide('Zr90', 7.2758e-3)"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
|
@ -338,8 +314,7 @@
|
|||
"outputs": [],
|
||||
"source": [
|
||||
"# Create Geometry and set root Universe\n",
|
||||
"geometry = openmc.Geometry()\n",
|
||||
"geometry.root_universe = root_universe"
|
||||
"geometry = openmc.Geometry(root_universe)"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
|
@ -1679,7 +1654,7 @@
|
|||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.5.2"
|
||||
"version": "3.6.0"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -33,7 +33,7 @@
|
|||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"First we need to define materials that will be used in the problem. Before defining a material, we must create nuclides that are used in the material."
|
||||
"First we need to define materials that will be used in the problem. We'll create three materials for the fuel, water, and cladding of the fuel pin."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
|
@ -43,49 +43,25 @@
|
|||
"collapsed": true
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# Instantiate some Nuclides\n",
|
||||
"h1 = openmc.Nuclide('H1')\n",
|
||||
"b10 = openmc.Nuclide('B10')\n",
|
||||
"o16 = openmc.Nuclide('O16')\n",
|
||||
"u235 = openmc.Nuclide('U235')\n",
|
||||
"u238 = openmc.Nuclide('U238')\n",
|
||||
"zr90 = openmc.Nuclide('Zr90')"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"With the nuclides we defined, we will now create three materials for the fuel, water, and cladding of the fuel pin."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 3,
|
||||
"metadata": {
|
||||
"collapsed": true
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# 1.6 enriched fuel\n",
|
||||
"fuel = openmc.Material(name='1.6% Fuel')\n",
|
||||
"fuel.set_density('g/cm3', 10.31341)\n",
|
||||
"fuel.add_nuclide(u235, 3.7503e-4)\n",
|
||||
"fuel.add_nuclide(u238, 2.2625e-2)\n",
|
||||
"fuel.add_nuclide(o16, 4.6007e-2)\n",
|
||||
"fuel.add_nuclide('U235', 3.7503e-4)\n",
|
||||
"fuel.add_nuclide('U238', 2.2625e-2)\n",
|
||||
"fuel.add_nuclide('O16', 4.6007e-2)\n",
|
||||
"\n",
|
||||
"# borated water\n",
|
||||
"water = openmc.Material(name='Borated Water')\n",
|
||||
"water.set_density('g/cm3', 0.740582)\n",
|
||||
"water.add_nuclide(h1, 4.9457e-2)\n",
|
||||
"water.add_nuclide(o16, 2.4732e-2)\n",
|
||||
"water.add_nuclide(b10, 8.0042e-6)\n",
|
||||
"water.add_nuclide('H1', 4.9457e-2)\n",
|
||||
"water.add_nuclide('O16', 2.4732e-2)\n",
|
||||
"water.add_nuclide('B10', 8.0042e-6)\n",
|
||||
"\n",
|
||||
"# zircaloy\n",
|
||||
"zircaloy = openmc.Material(name='Zircaloy')\n",
|
||||
"zircaloy.set_density('g/cm3', 6.55)\n",
|
||||
"zircaloy.add_nuclide(zr90, 7.2758e-3)"
|
||||
"zircaloy.add_nuclide('Zr90', 7.2758e-3)"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
|
@ -97,7 +73,7 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 4,
|
||||
"execution_count": 3,
|
||||
"metadata": {
|
||||
"collapsed": true
|
||||
},
|
||||
|
|
@ -119,7 +95,7 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 5,
|
||||
"execution_count": 4,
|
||||
"metadata": {
|
||||
"collapsed": true
|
||||
},
|
||||
|
|
@ -148,7 +124,7 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 6,
|
||||
"execution_count": 5,
|
||||
"metadata": {
|
||||
"collapsed": true
|
||||
},
|
||||
|
|
@ -185,7 +161,7 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 7,
|
||||
"execution_count": 6,
|
||||
"metadata": {
|
||||
"collapsed": true
|
||||
},
|
||||
|
|
@ -212,20 +188,19 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 8,
|
||||
"execution_count": 7,
|
||||
"metadata": {
|
||||
"collapsed": true
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# Create Geometry and set root Universe\n",
|
||||
"geometry = openmc.Geometry()\n",
|
||||
"geometry.root_universe = root_universe"
|
||||
"geometry = openmc.Geometry(root_universe)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 9,
|
||||
"execution_count": 8,
|
||||
"metadata": {
|
||||
"collapsed": true
|
||||
},
|
||||
|
|
@ -244,7 +219,7 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 10,
|
||||
"execution_count": 9,
|
||||
"metadata": {
|
||||
"collapsed": true
|
||||
},
|
||||
|
|
@ -280,7 +255,7 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 11,
|
||||
"execution_count": 10,
|
||||
"metadata": {
|
||||
"collapsed": true
|
||||
},
|
||||
|
|
@ -308,8 +283,10 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 12,
|
||||
"metadata": {},
|
||||
"execution_count": 11,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
|
|
@ -317,7 +294,7 @@
|
|||
"0"
|
||||
]
|
||||
},
|
||||
"execution_count": 12,
|
||||
"execution_count": 11,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
|
|
@ -329,17 +306,19 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 13,
|
||||
"metadata": {},
|
||||
"execution_count": 12,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAPoAAAD6AgMAAAD1grKuAAAABGdBTUEAALGPC/xhBQAAACBjSFJN\nAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAADFBMVEX///9yEhLpgJFNv8Tq\nQYT7AAAAAWJLR0QAiAUdSAAAAAd0SU1FB+EKGA0jE/weoLoAAALKSURBVGje7dpLcqQwDAbgHHE2\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/4vzcvgeY10sY0AAAAldEVYdGRhdGU6Y3JlYXRlADIwMTctMTAtMjRUMTM6MzU6\nMTktMDU6MDCdcfAWAAAAJXRFWHRkYXRlOm1vZGlmeQAyMDE3LTEwLTI0VDEzOjM1OjE5LTA1OjAw\n7CxIqgAAAABJRU5ErkJggg==\n",
|
||||
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAPoAAAD6AgMAAAD1grKuAAAABGdBTUEAALGPC/xhBQAAACBjSFJN\nAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAADFBMVEX///9yEhLpgJFNv8Tq\nQYT7AAAAAWJLR0QAiAUdSAAAAAd0SU1FB+EMBQIrDwapSyIAAALKSURBVGje7dpLcqQwDAbgHHE2\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/4vzcvgeY10sY0AAAAldEVYdGRhdGU6Y3JlYXRlADIwMTctMTItMDRUMjA6NDM6\nMTQtMDY6MDCrFYTfAAAAJXRFWHRkYXRlOm1vZGlmeQAyMDE3LTEyLTA0VDIwOjQzOjE0LTA2OjAw\n2kg8YwAAAABJRU5ErkJggg==\n",
|
||||
"text/plain": [
|
||||
"<IPython.core.display.Image object>"
|
||||
]
|
||||
},
|
||||
"execution_count": 13,
|
||||
"execution_count": 12,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
|
|
@ -361,7 +340,7 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 14,
|
||||
"execution_count": 13,
|
||||
"metadata": {
|
||||
"collapsed": true
|
||||
},
|
||||
|
|
@ -373,7 +352,7 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 15,
|
||||
"execution_count": 14,
|
||||
"metadata": {
|
||||
"collapsed": true
|
||||
},
|
||||
|
|
@ -396,7 +375,7 @@
|
|||
"tally.filters = [openmc.CellFilter(fuel_cell)]\n",
|
||||
"tally.filters.append(energy_filter)\n",
|
||||
"tally.scores = ['nu-fission', 'scatter']\n",
|
||||
"tally.nuclides = [u238, u235]\n",
|
||||
"tally.nuclides = ['U238', 'U235']\n",
|
||||
"tallies_file.append(tally)\n",
|
||||
"\n",
|
||||
"# Instantiate reaction rate Tally in moderator\n",
|
||||
|
|
@ -404,7 +383,7 @@
|
|||
"tally.filters = [openmc.CellFilter(moderator_cell)]\n",
|
||||
"tally.filters.append(energy_filter)\n",
|
||||
"tally.scores = ['absorption', 'total']\n",
|
||||
"tally.nuclides = [o16, h1]\n",
|
||||
"tally.nuclides = ['O16', 'H1']\n",
|
||||
"tallies_file.append(tally)\n",
|
||||
"\n",
|
||||
"# Instantiate a tally mesh\n",
|
||||
|
|
@ -434,7 +413,7 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 16,
|
||||
"execution_count": 15,
|
||||
"metadata": {
|
||||
"collapsed": true
|
||||
},
|
||||
|
|
@ -450,7 +429,7 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 17,
|
||||
"execution_count": 16,
|
||||
"metadata": {
|
||||
"collapsed": true
|
||||
},
|
||||
|
|
@ -465,7 +444,7 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 18,
|
||||
"execution_count": 17,
|
||||
"metadata": {
|
||||
"collapsed": true
|
||||
},
|
||||
|
|
@ -481,7 +460,7 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 19,
|
||||
"execution_count": 18,
|
||||
"metadata": {
|
||||
"collapsed": true
|
||||
},
|
||||
|
|
@ -496,7 +475,7 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 20,
|
||||
"execution_count": 19,
|
||||
"metadata": {
|
||||
"collapsed": true
|
||||
},
|
||||
|
|
@ -510,23 +489,21 @@
|
|||
"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",
|
||||
"tally.nuclides = ['H1', 'U238']\n",
|
||||
"tallies_file.append(tally)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 21,
|
||||
"metadata": {},
|
||||
"execution_count": 20,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stderr",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"/home/romano/openmc/openmc/mixin.py:61: IDWarning: Another EnergyFilter instance already exists with id=1.\n",
|
||||
" warn(msg, IDWarning)\n",
|
||||
"/home/romano/openmc/openmc/mixin.py:61: IDWarning: Another MeshFilter instance already exists with id=5.\n",
|
||||
" warn(msg, IDWarning)\n",
|
||||
"/home/romano/openmc/openmc/mixin.py:61: IDWarning: Another EnergyFilter instance already exists with id=6.\n",
|
||||
" warn(msg, IDWarning)\n",
|
||||
"/home/romano/openmc/openmc/mixin.py:61: IDWarning: Another CellFilter instance already exists with id=3.\n",
|
||||
|
|
@ -550,8 +527,9 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 22,
|
||||
"execution_count": 21,
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"scrolled": true
|
||||
},
|
||||
"outputs": [
|
||||
|
|
@ -588,13 +566,13 @@
|
|||
" Copyright | 2011-2017 Massachusetts Institute of Technology\n",
|
||||
" License | http://openmc.readthedocs.io/en/latest/license.html\n",
|
||||
" Version | 0.9.0\n",
|
||||
" Git SHA1 | 5ca1d06b0c6ac3b56060ef289b7e5215210e7332\n",
|
||||
" Date/Time | 2017-10-24 13:35:19\n",
|
||||
" Git SHA1 | 9b7cebf7bc34d60e0f1750c3d6cb103df11e8dc4\n",
|
||||
" Date/Time | 2017-12-04 20:43:15\n",
|
||||
" OpenMP Threads | 4\n",
|
||||
"\n",
|
||||
" Reading settings XML file...\n",
|
||||
" Reading materials XML file...\n",
|
||||
" Reading cross sections XML file...\n",
|
||||
" Reading materials XML file...\n",
|
||||
" Reading geometry XML file...\n",
|
||||
" Building neighboring cells lists for each surface...\n",
|
||||
" Reading U235 from /home/romano/openmc/scripts/nndc_hdf5/U235.h5\n",
|
||||
|
|
@ -605,6 +583,7 @@
|
|||
" Reading Zr90 from /home/romano/openmc/scripts/nndc_hdf5/Zr90.h5\n",
|
||||
" Maximum neutron transport energy: 2.00000E+07 eV for U235\n",
|
||||
" Reading tallies XML file...\n",
|
||||
" Writing summary.h5 file...\n",
|
||||
" Initializing source particles...\n",
|
||||
"\n",
|
||||
" ====================> K EIGENVALUE SIMULATION <====================\n",
|
||||
|
|
@ -635,20 +614,20 @@
|
|||
"\n",
|
||||
" =======================> TIMING STATISTICS <=======================\n",
|
||||
"\n",
|
||||
" Total time for initialization = 4.1497E-01 seconds\n",
|
||||
" Reading cross sections = 3.6232E-01 seconds\n",
|
||||
" Total time in simulation = 3.6447E+00 seconds\n",
|
||||
" Time in transport only = 3.5939E+00 seconds\n",
|
||||
" Time in inactive batches = 4.4241E-01 seconds\n",
|
||||
" Time in active batches = 3.2022E+00 seconds\n",
|
||||
" Time synchronizing fission bank = 2.7734E-03 seconds\n",
|
||||
" Sampling source sites = 1.1981E-03 seconds\n",
|
||||
" SEND/RECV source sites = 1.5506E-03 seconds\n",
|
||||
" Time accumulating tallies = 1.2237E-04 seconds\n",
|
||||
" Total time for finalization = 1.4924E-03 seconds\n",
|
||||
" Total time elapsed = 4.0823E+00 seconds\n",
|
||||
" Calculation Rate (inactive) = 28254.0 neutrons/second\n",
|
||||
" Calculation Rate (active) = 11710.5 neutrons/second\n",
|
||||
" Total time for initialization = 5.6782E-01 seconds\n",
|
||||
" Reading cross sections = 5.3276E-01 seconds\n",
|
||||
" Total time in simulation = 6.4149E+00 seconds\n",
|
||||
" Time in transport only = 6.2767E+00 seconds\n",
|
||||
" Time in inactive batches = 6.8747E-01 seconds\n",
|
||||
" Time in active batches = 5.7274E+00 seconds\n",
|
||||
" Time synchronizing fission bank = 2.7492E-03 seconds\n",
|
||||
" Sampling source sites = 1.9584E-03 seconds\n",
|
||||
" SEND/RECV source sites = 7.4113E-04 seconds\n",
|
||||
" Time accumulating tallies = 1.0576E-04 seconds\n",
|
||||
" Total time for finalization = 2.2075E-03 seconds\n",
|
||||
" Total time elapsed = 7.0056E+00 seconds\n",
|
||||
" Calculation Rate (inactive) = 18182.5 neutrons/second\n",
|
||||
" Calculation Rate (active) = 6547.45 neutrons/second\n",
|
||||
"\n",
|
||||
" ============================> RESULTS <============================\n",
|
||||
"\n",
|
||||
|
|
@ -666,15 +645,12 @@
|
|||
"0"
|
||||
]
|
||||
},
|
||||
"execution_count": 22,
|
||||
"execution_count": 21,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"# Remove old HDF5 (summary, statepoint) files\n",
|
||||
"!rm statepoint.*\n",
|
||||
"\n",
|
||||
"# Run OpenMC!\n",
|
||||
"openmc.run()"
|
||||
]
|
||||
|
|
@ -695,7 +671,7 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 23,
|
||||
"execution_count": 22,
|
||||
"metadata": {
|
||||
"collapsed": true,
|
||||
"scrolled": true
|
||||
|
|
@ -717,26 +693,15 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 24,
|
||||
"metadata": {},
|
||||
"execution_count": 23,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/html": [
|
||||
"<div>\n",
|
||||
"<style>\n",
|
||||
" .dataframe thead tr:only-child th {\n",
|
||||
" text-align: right;\n",
|
||||
" }\n",
|
||||
"\n",
|
||||
" .dataframe thead th {\n",
|
||||
" text-align: left;\n",
|
||||
" }\n",
|
||||
"\n",
|
||||
" .dataframe tbody tr th {\n",
|
||||
" vertical-align: top;\n",
|
||||
" }\n",
|
||||
"</style>\n",
|
||||
"<table border=\"1\" class=\"dataframe\">\n",
|
||||
" <thead>\n",
|
||||
" <tr style=\"text-align: right;\">\n",
|
||||
|
|
@ -764,7 +729,7 @@
|
|||
"0 total (nu-fission / (absorption + current)) 1.02e+00 6.65e-03"
|
||||
]
|
||||
},
|
||||
"execution_count": 24,
|
||||
"execution_count": 23,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
|
|
@ -795,26 +760,15 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 25,
|
||||
"metadata": {},
|
||||
"execution_count": 24,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/html": [
|
||||
"<div>\n",
|
||||
"<style>\n",
|
||||
" .dataframe thead tr:only-child th {\n",
|
||||
" text-align: right;\n",
|
||||
" }\n",
|
||||
"\n",
|
||||
" .dataframe thead th {\n",
|
||||
" text-align: left;\n",
|
||||
" }\n",
|
||||
"\n",
|
||||
" .dataframe tbody tr th {\n",
|
||||
" vertical-align: top;\n",
|
||||
" }\n",
|
||||
"</style>\n",
|
||||
"<table border=\"1\" class=\"dataframe\">\n",
|
||||
" <thead>\n",
|
||||
" <tr style=\"text-align: right;\">\n",
|
||||
|
|
@ -849,7 +803,7 @@
|
|||
"0 ((absorption + current) / (absorption + current)) 6.94e-01 4.61e-03 "
|
||||
]
|
||||
},
|
||||
"execution_count": 25,
|
||||
"execution_count": 24,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
|
|
@ -874,26 +828,15 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 26,
|
||||
"metadata": {},
|
||||
"execution_count": 25,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/html": [
|
||||
"<div>\n",
|
||||
"<style>\n",
|
||||
" .dataframe thead tr:only-child th {\n",
|
||||
" text-align: right;\n",
|
||||
" }\n",
|
||||
"\n",
|
||||
" .dataframe thead th {\n",
|
||||
" text-align: left;\n",
|
||||
" }\n",
|
||||
"\n",
|
||||
" .dataframe tbody tr th {\n",
|
||||
" vertical-align: top;\n",
|
||||
" }\n",
|
||||
"</style>\n",
|
||||
"<table border=\"1\" class=\"dataframe\">\n",
|
||||
" <thead>\n",
|
||||
" <tr style=\"text-align: right;\">\n",
|
||||
|
|
@ -928,7 +871,7 @@
|
|||
"0 1.20e+00 9.61e-03 "
|
||||
]
|
||||
},
|
||||
"execution_count": 26,
|
||||
"execution_count": 25,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
|
|
@ -951,26 +894,15 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 27,
|
||||
"metadata": {},
|
||||
"execution_count": 26,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/html": [
|
||||
"<div>\n",
|
||||
"<style>\n",
|
||||
" .dataframe thead tr:only-child th {\n",
|
||||
" text-align: right;\n",
|
||||
" }\n",
|
||||
"\n",
|
||||
" .dataframe thead th {\n",
|
||||
" text-align: left;\n",
|
||||
" }\n",
|
||||
"\n",
|
||||
" .dataframe tbody tr th {\n",
|
||||
" vertical-align: top;\n",
|
||||
" }\n",
|
||||
"</style>\n",
|
||||
"<table border=\"1\" class=\"dataframe\">\n",
|
||||
" <thead>\n",
|
||||
" <tr style=\"text-align: right;\">\n",
|
||||
|
|
@ -1007,7 +939,7 @@
|
|||
"0 7.49e-01 6.09e-03 "
|
||||
]
|
||||
},
|
||||
"execution_count": 27,
|
||||
"execution_count": 26,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
|
|
@ -1028,26 +960,15 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 28,
|
||||
"metadata": {},
|
||||
"execution_count": 27,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/html": [
|
||||
"<div>\n",
|
||||
"<style>\n",
|
||||
" .dataframe thead tr:only-child th {\n",
|
||||
" text-align: right;\n",
|
||||
" }\n",
|
||||
"\n",
|
||||
" .dataframe thead th {\n",
|
||||
" text-align: left;\n",
|
||||
" }\n",
|
||||
"\n",
|
||||
" .dataframe tbody tr th {\n",
|
||||
" vertical-align: top;\n",
|
||||
" }\n",
|
||||
"</style>\n",
|
||||
"<table border=\"1\" class=\"dataframe\">\n",
|
||||
" <thead>\n",
|
||||
" <tr style=\"text-align: right;\">\n",
|
||||
|
|
@ -1084,7 +1005,7 @@
|
|||
"0 1.66e+00 1.44e-02 "
|
||||
]
|
||||
},
|
||||
"execution_count": 28,
|
||||
"execution_count": 27,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
|
|
@ -1104,26 +1025,15 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 29,
|
||||
"metadata": {},
|
||||
"execution_count": 28,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/html": [
|
||||
"<div>\n",
|
||||
"<style>\n",
|
||||
" .dataframe thead tr:only-child th {\n",
|
||||
" text-align: right;\n",
|
||||
" }\n",
|
||||
"\n",
|
||||
" .dataframe thead th {\n",
|
||||
" text-align: left;\n",
|
||||
" }\n",
|
||||
"\n",
|
||||
" .dataframe tbody tr th {\n",
|
||||
" vertical-align: top;\n",
|
||||
" }\n",
|
||||
"</style>\n",
|
||||
"<table border=\"1\" class=\"dataframe\">\n",
|
||||
" <thead>\n",
|
||||
" <tr style=\"text-align: right;\">\n",
|
||||
|
|
@ -1158,7 +1068,7 @@
|
|||
"0 ((absorption + current) / (absorption + current)) 9.85e-01 5.51e-03 "
|
||||
]
|
||||
},
|
||||
"execution_count": 29,
|
||||
"execution_count": 28,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
|
|
@ -1177,26 +1087,15 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 30,
|
||||
"metadata": {},
|
||||
"execution_count": 29,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/html": [
|
||||
"<div>\n",
|
||||
"<style>\n",
|
||||
" .dataframe thead tr:only-child th {\n",
|
||||
" text-align: right;\n",
|
||||
" }\n",
|
||||
"\n",
|
||||
" .dataframe thead th {\n",
|
||||
" text-align: left;\n",
|
||||
" }\n",
|
||||
"\n",
|
||||
" .dataframe tbody tr th {\n",
|
||||
" vertical-align: top;\n",
|
||||
" }\n",
|
||||
"</style>\n",
|
||||
"<table border=\"1\" class=\"dataframe\">\n",
|
||||
" <thead>\n",
|
||||
" <tr style=\"text-align: right;\">\n",
|
||||
|
|
@ -1231,7 +1130,7 @@
|
|||
"0 (absorption / (absorption + current)) 9.97e-01 7.55e-03 "
|
||||
]
|
||||
},
|
||||
"execution_count": 30,
|
||||
"execution_count": 29,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
|
|
@ -1250,26 +1149,15 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 31,
|
||||
"metadata": {},
|
||||
"execution_count": 30,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/html": [
|
||||
"<div>\n",
|
||||
"<style>\n",
|
||||
" .dataframe thead tr:only-child th {\n",
|
||||
" text-align: right;\n",
|
||||
" }\n",
|
||||
"\n",
|
||||
" .dataframe thead th {\n",
|
||||
" text-align: left;\n",
|
||||
" }\n",
|
||||
"\n",
|
||||
" .dataframe tbody tr th {\n",
|
||||
" vertical-align: top;\n",
|
||||
" }\n",
|
||||
"</style>\n",
|
||||
"<table border=\"1\" class=\"dataframe\">\n",
|
||||
" <thead>\n",
|
||||
" <tr style=\"text-align: right;\">\n",
|
||||
|
|
@ -1306,7 +1194,7 @@
|
|||
"0 (((((((absorption + current) / (absorption + c... 1.02e+00 1.88e-02 "
|
||||
]
|
||||
},
|
||||
"execution_count": 31,
|
||||
"execution_count": 30,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
|
|
@ -1327,7 +1215,7 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 32,
|
||||
"execution_count": 31,
|
||||
"metadata": {
|
||||
"collapsed": true,
|
||||
"scrolled": true
|
||||
|
|
@ -1343,26 +1231,15 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 33,
|
||||
"metadata": {},
|
||||
"execution_count": 32,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/html": [
|
||||
"<div>\n",
|
||||
"<style>\n",
|
||||
" .dataframe thead tr:only-child th {\n",
|
||||
" text-align: right;\n",
|
||||
" }\n",
|
||||
"\n",
|
||||
" .dataframe thead th {\n",
|
||||
" text-align: left;\n",
|
||||
" }\n",
|
||||
"\n",
|
||||
" .dataframe tbody tr th {\n",
|
||||
" vertical-align: top;\n",
|
||||
" }\n",
|
||||
"</style>\n",
|
||||
"<table border=\"1\" class=\"dataframe\">\n",
|
||||
" <thead>\n",
|
||||
" <tr style=\"text-align: right;\">\n",
|
||||
|
|
@ -1483,7 +1360,7 @@
|
|||
"7 (scatter / flux) 3.36e-03 1.34e-05 "
|
||||
]
|
||||
},
|
||||
"execution_count": 33,
|
||||
"execution_count": 32,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
|
|
@ -1502,8 +1379,10 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 34,
|
||||
"metadata": {},
|
||||
"execution_count": 33,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
|
|
@ -1532,8 +1411,10 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 35,
|
||||
"metadata": {},
|
||||
"execution_count": 34,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
|
|
@ -1554,8 +1435,10 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 36,
|
||||
"metadata": {},
|
||||
"execution_count": 35,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
|
|
@ -1583,26 +1466,15 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 37,
|
||||
"metadata": {},
|
||||
"execution_count": 36,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/html": [
|
||||
"<div>\n",
|
||||
"<style>\n",
|
||||
" .dataframe thead tr:only-child th {\n",
|
||||
" text-align: right;\n",
|
||||
" }\n",
|
||||
"\n",
|
||||
" .dataframe thead th {\n",
|
||||
" text-align: left;\n",
|
||||
" }\n",
|
||||
"\n",
|
||||
" .dataframe tbody tr th {\n",
|
||||
" vertical-align: top;\n",
|
||||
" }\n",
|
||||
"</style>\n",
|
||||
"<table border=\"1\" class=\"dataframe\">\n",
|
||||
" <thead>\n",
|
||||
" <tr style=\"text-align: right;\">\n",
|
||||
|
|
@ -1675,7 +1547,7 @@
|
|||
"3 5.98e-04 "
|
||||
]
|
||||
},
|
||||
"execution_count": 37,
|
||||
"execution_count": 36,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
|
|
@ -1688,26 +1560,15 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 38,
|
||||
"metadata": {},
|
||||
"execution_count": 37,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/html": [
|
||||
"<div>\n",
|
||||
"<style>\n",
|
||||
" .dataframe thead tr:only-child th {\n",
|
||||
" text-align: right;\n",
|
||||
" }\n",
|
||||
"\n",
|
||||
" .dataframe thead th {\n",
|
||||
" text-align: left;\n",
|
||||
" }\n",
|
||||
"\n",
|
||||
" .dataframe tbody tr th {\n",
|
||||
" vertical-align: top;\n",
|
||||
" }\n",
|
||||
"</style>\n",
|
||||
"<table border=\"1\" class=\"dataframe\">\n",
|
||||
" <thead>\n",
|
||||
" <tr style=\"text-align: right;\">\n",
|
||||
|
|
@ -1840,7 +1701,7 @@
|
|||
"8 2.90e-03 "
|
||||
]
|
||||
},
|
||||
"execution_count": 38,
|
||||
"execution_count": 37,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
|
|
@ -1870,7 +1731,7 @@
|
|||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.6.1"
|
||||
"version": "3.6.0"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
|
|
|
|||
|
|
@ -237,9 +237,6 @@ class CrossFilter(object):
|
|||
left / right filters
|
||||
num_bins : Integral
|
||||
The number of filter bins (always 1 if aggregate_filter is defined)
|
||||
stride : Integral
|
||||
The number of filter, nuclide and score bins within each of this
|
||||
crossfilter's bins.
|
||||
|
||||
"""
|
||||
|
||||
|
|
@ -250,7 +247,6 @@ class CrossFilter(object):
|
|||
self._type = '({0} {1} {2})'.format(left_type, binary_op, right_type)
|
||||
|
||||
self._bins = {}
|
||||
self._stride = None
|
||||
|
||||
self._left_filter = None
|
||||
self._right_filter = None
|
||||
|
|
@ -314,10 +310,6 @@ class CrossFilter(object):
|
|||
else:
|
||||
return 0
|
||||
|
||||
@property
|
||||
def stride(self):
|
||||
return self._stride
|
||||
|
||||
@type.setter
|
||||
def type(self, filter_type):
|
||||
if filter_type not in _FILTER_TYPES:
|
||||
|
|
@ -347,10 +339,6 @@ class CrossFilter(object):
|
|||
cv.check_value('binary_op', binary_op, _TALLY_ARITHMETIC_OPS)
|
||||
self._binary_op = binary_op
|
||||
|
||||
@stride.setter
|
||||
def stride(self, stride):
|
||||
self._stride = stride
|
||||
|
||||
def get_bin_index(self, filter_bin):
|
||||
"""Returns the index in the CrossFilter for some bin.
|
||||
|
||||
|
|
@ -611,9 +599,6 @@ class AggregateFilter(object):
|
|||
The filter bins included in the aggregation
|
||||
num_bins : Integral
|
||||
The number of filter bins (always 1 if aggregate_filter is defined)
|
||||
stride : Integral
|
||||
The number of filter, nuclide and score bins within each of this
|
||||
aggregatefilter's bins.
|
||||
|
||||
"""
|
||||
|
||||
|
|
@ -622,7 +607,6 @@ class AggregateFilter(object):
|
|||
self._type = '{0}({1})'.format(aggregate_op,
|
||||
aggregate_filter.short_name.lower())
|
||||
self._bins = None
|
||||
self._stride = None
|
||||
|
||||
self._aggregate_filter = None
|
||||
self._aggregate_op = None
|
||||
|
|
@ -684,10 +668,6 @@ class AggregateFilter(object):
|
|||
def num_bins(self):
|
||||
return len(self.bins) if self.aggregate_filter else 0
|
||||
|
||||
@property
|
||||
def stride(self):
|
||||
return self._stride
|
||||
|
||||
@type.setter
|
||||
def type(self, filter_type):
|
||||
if filter_type not in _FILTER_TYPES:
|
||||
|
|
@ -714,10 +694,6 @@ class AggregateFilter(object):
|
|||
cv.check_value('aggregate_op', aggregate_op, _TALLY_AGGREGATE_OPS)
|
||||
self._aggregate_op = aggregate_op
|
||||
|
||||
@stride.setter
|
||||
def stride(self, stride):
|
||||
self._stride = stride
|
||||
|
||||
def get_bin_index(self, filter_bin):
|
||||
"""Returns the index in the AggregateFilter for some bin.
|
||||
|
||||
|
|
@ -753,7 +729,7 @@ class AggregateFilter(object):
|
|||
else:
|
||||
return self.bins.index(filter_bin)
|
||||
|
||||
def get_pandas_dataframe(self, data_size, summary=None, **kwargs):
|
||||
def get_pandas_dataframe(self, data_size, stride, summary=None, **kwargs):
|
||||
"""Builds a Pandas DataFrame for the AggregateFilter's bins.
|
||||
|
||||
This method constructs a Pandas DataFrame object for the AggregateFilter
|
||||
|
|
@ -762,8 +738,10 @@ class AggregateFilter(object):
|
|||
|
||||
Parameters
|
||||
----------
|
||||
data_size : Integral
|
||||
data_size : int
|
||||
The total number of bins in the tally corresponding to this filter
|
||||
stride : int
|
||||
Stride in memory for the filter
|
||||
summary : None or Summary
|
||||
An optional Summary object to be used to construct columns for
|
||||
distribcell tally filters (default is None). NOTE: This parameter
|
||||
|
|
@ -793,7 +771,7 @@ class AggregateFilter(object):
|
|||
filter_bins[i] = bin
|
||||
|
||||
# Repeat and tile bins as needed for DataFrame
|
||||
filter_bins = np.repeat(filter_bins, self.stride)
|
||||
filter_bins = np.repeat(filter_bins, stride)
|
||||
tile_factor = data_size / len(filter_bins)
|
||||
filter_bins = np.tile(filter_bins, tile_factor)
|
||||
|
||||
|
|
|
|||
|
|
@ -108,32 +108,6 @@ class Cell(IDManagerMixin):
|
|||
else:
|
||||
return point in self.region
|
||||
|
||||
def __eq__(self, other):
|
||||
if not isinstance(other, Cell):
|
||||
return False
|
||||
elif self.id != other.id:
|
||||
return False
|
||||
elif self.name != other.name:
|
||||
return False
|
||||
elif self.fill != other.fill:
|
||||
return False
|
||||
elif self.region != other.region:
|
||||
return False
|
||||
elif self.rotation != other.rotation:
|
||||
return False
|
||||
elif self.temperature != other.temperature:
|
||||
return False
|
||||
elif self.translation != other.translation:
|
||||
return False
|
||||
else:
|
||||
return True
|
||||
|
||||
def __ne__(self, other):
|
||||
return not self == other
|
||||
|
||||
def __hash__(self):
|
||||
return hash(repr(self))
|
||||
|
||||
def __repr__(self):
|
||||
string = 'Cell\n'
|
||||
string += '{: <16}=\t{}\n'.format('\tID', self.id)
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import openmc.checkvalue as cv
|
|||
from openmc.data import NATURAL_ABUNDANCE, atomic_mass
|
||||
|
||||
|
||||
class Element(object):
|
||||
class Element(str):
|
||||
"""A natural element that auto-expands to add the isotopes of an element to
|
||||
a material in their natural abundance. Internally, the OpenMC Python API
|
||||
expands the natural element into isotopes only when the materials.xml file
|
||||
|
|
@ -25,73 +25,17 @@ class Element(object):
|
|||
----------
|
||||
name : str
|
||||
Chemical symbol of the element, e.g. Pu
|
||||
scattering : {'data', 'iso-in-lab', None}
|
||||
The type of angular scattering distribution to use
|
||||
|
||||
"""
|
||||
|
||||
def __init__(self, name=''):
|
||||
# Initialize class attributes
|
||||
self._name = ''
|
||||
self._scattering = None
|
||||
|
||||
# Set class attributes
|
||||
self.name = name
|
||||
|
||||
def __eq__(self, other):
|
||||
if isinstance(other, Element):
|
||||
if self.name != other.name:
|
||||
return False
|
||||
else:
|
||||
return True
|
||||
elif isinstance(other, string_types) and other == self.name:
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
def __ne__(self, other):
|
||||
return not self == other
|
||||
|
||||
def __gt__(self, other):
|
||||
return repr(self) > repr(other)
|
||||
|
||||
def __lt__(self, other):
|
||||
return not self > other
|
||||
|
||||
def __hash__(self):
|
||||
return hash(repr(self))
|
||||
|
||||
def __repr__(self):
|
||||
string = 'Element - {0}\n'.format(self._name)
|
||||
if self.scattering is not None:
|
||||
string += '{0: <16}{1}{2}\n'.format('\tscattering', '=\t',
|
||||
self.scattering)
|
||||
|
||||
return string
|
||||
def __new__(cls, name):
|
||||
cv.check_type('element name', name, string_types)
|
||||
cv.check_length('element name', name, 1, 2)
|
||||
return super(Element, cls).__new__(cls, name)
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
return self._name
|
||||
|
||||
@property
|
||||
def scattering(self):
|
||||
return self._scattering
|
||||
|
||||
@name.setter
|
||||
def name(self, name):
|
||||
cv.check_type('element name', name, string_types)
|
||||
cv.check_length('element name', name, 1, 2)
|
||||
self._name = name
|
||||
|
||||
@scattering.setter
|
||||
def scattering(self, scattering):
|
||||
|
||||
if not scattering in ['data', 'iso-in-lab', None]:
|
||||
msg = 'Unable to set scattering for Element to {0} which ' \
|
||||
'is not "data", "iso-in-lab", or None'.format(scattering)
|
||||
raise ValueError(msg)
|
||||
|
||||
self._scattering = scattering
|
||||
return self
|
||||
|
||||
def expand(self, percent, percent_type, enrichment=None,
|
||||
cross_sections=None):
|
||||
|
|
@ -121,8 +65,8 @@ class Element(object):
|
|||
-------
|
||||
isotopes : list
|
||||
Naturally-occurring isotopes of the element. Each item of the list
|
||||
is a tuple consisting of an openmc.Nuclide instance and the natural
|
||||
abundance of the isotope.
|
||||
is a tuple consisting of a nuclide string, the atom/weight percent,
|
||||
and the string 'ao' or 'wo'.
|
||||
|
||||
Notes
|
||||
-----
|
||||
|
|
@ -138,7 +82,7 @@ class Element(object):
|
|||
# Get the nuclides present in nature
|
||||
natural_nuclides = set()
|
||||
for nuclide in sorted(NATURAL_ABUNDANCE.keys()):
|
||||
if re.match(r'{}\d+'.format(self.name), nuclide):
|
||||
if re.match(r'{}\d+'.format(self), nuclide):
|
||||
natural_nuclides.add(nuclide)
|
||||
|
||||
# Create dict to store the expanded nuclides and abundances
|
||||
|
|
@ -158,7 +102,7 @@ class Element(object):
|
|||
root = tree.getroot()
|
||||
for child in root:
|
||||
nuclide = child.attrib['materials']
|
||||
if re.match(r'{}\d+'.format(self.name), nuclide) and \
|
||||
if re.match(r'{}\d+'.format(self), nuclide) and \
|
||||
'_m' not in nuclide:
|
||||
library_nuclides.add(nuclide)
|
||||
|
||||
|
|
@ -179,14 +123,14 @@ class Element(object):
|
|||
# 0 nuclide is present. If so, set the abundance to 1 for this
|
||||
# nuclide. Else, raise an error.
|
||||
elif len(mutual_nuclides) == 0:
|
||||
nuclide_0 = self.name + '0'
|
||||
nuclide_0 = self + '0'
|
||||
if nuclide_0 in library_nuclides:
|
||||
abundances[nuclide_0] = 1.0
|
||||
else:
|
||||
msg = 'Unable to expand element {0} because the cross '\
|
||||
'section library provided does not contain any of '\
|
||||
'the natural isotopes for that element.'\
|
||||
.format(self.name)
|
||||
.format(self)
|
||||
raise ValueError(msg)
|
||||
|
||||
# If some, but not all, natural nuclides are in the library, add
|
||||
|
|
@ -261,8 +205,6 @@ class Element(object):
|
|||
# Create a list of the isotopes in this element
|
||||
isotopes = []
|
||||
for nuclide, abundance in abundances.items():
|
||||
nuc = openmc.Nuclide(nuclide)
|
||||
nuc.scattering = self.scattering
|
||||
isotopes.append((nuc, percent * abundance, percent_type))
|
||||
isotopes.append((nuclide, percent * abundance, percent_type))
|
||||
|
||||
return isotopes
|
||||
|
|
|
|||
|
|
@ -573,16 +573,16 @@ def slab_mg(reps=None, as_macro=True):
|
|||
for mat in mat_names:
|
||||
for rep in reps:
|
||||
i += 1
|
||||
name = mat + '_' + rep
|
||||
xs.append(name)
|
||||
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])
|
||||
m.add_macroscopic(name)
|
||||
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')
|
||||
m.add_nuclide(name, 1.0, 'ao')
|
||||
model.materials.append(m)
|
||||
|
||||
# Define the materials file
|
||||
|
|
|
|||
352
openmc/filter.py
352
openmc/filter.py
|
|
@ -2,8 +2,10 @@ from __future__ import division
|
|||
from abc import ABCMeta
|
||||
from collections import Iterable, OrderedDict
|
||||
import copy
|
||||
from functools import reduce
|
||||
import hashlib
|
||||
from numbers import Real, Integral
|
||||
import operator
|
||||
from xml.etree import ElementTree as ET
|
||||
|
||||
from six import add_metaclass
|
||||
|
|
@ -12,7 +14,10 @@ import pandas as pd
|
|||
|
||||
import openmc
|
||||
import openmc.checkvalue as cv
|
||||
from .cell import Cell
|
||||
from .material import Material
|
||||
from .mixin import IDManagerMixin
|
||||
from .universe import Universe
|
||||
|
||||
|
||||
_FILTER_TYPES = ['universe', 'material', 'cell', 'cellborn', 'surface',
|
||||
|
|
@ -86,9 +91,6 @@ class Filter(IDManagerMixin):
|
|||
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.
|
||||
|
||||
"""
|
||||
|
||||
|
|
@ -98,8 +100,6 @@ class Filter(IDManagerMixin):
|
|||
def __init__(self, bins, filter_id=None):
|
||||
self.bins = bins
|
||||
self.id = filter_id
|
||||
self._num_bins = 0
|
||||
self._stride = None
|
||||
|
||||
def __eq__(self, other):
|
||||
if type(self) is not type(other):
|
||||
|
|
@ -173,8 +173,8 @@ class Filter(IDManagerMixin):
|
|||
# If the HDF5 'type' variable matches this class's short_name, then
|
||||
# there is no overriden from_hdf5 method. Pass the bins to __init__.
|
||||
if group['type'].value.decode() == cls.short_name.lower():
|
||||
out = cls(group['bins'].value, filter_id)
|
||||
out.num_bins = group['n_bins'].value
|
||||
out = cls(group['bins'].value, filter_id=filter_id)
|
||||
out._num_bins = group['n_bins'].value
|
||||
return out
|
||||
|
||||
# Search through all subclasses and find the one matching the HDF5
|
||||
|
|
@ -192,11 +192,7 @@ class Filter(IDManagerMixin):
|
|||
|
||||
@property
|
||||
def num_bins(self):
|
||||
return self._num_bins
|
||||
|
||||
@property
|
||||
def stride(self):
|
||||
return self._stride
|
||||
return len(self.bins)
|
||||
|
||||
@bins.setter
|
||||
def bins(self, bins):
|
||||
|
|
@ -208,22 +204,6 @@ class Filter(IDManagerMixin):
|
|||
|
||||
self._bins = 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
|
||||
|
||||
@stride.setter
|
||||
def stride(self, stride):
|
||||
cv.check_type('filter stride', stride, Integral)
|
||||
if stride < 0:
|
||||
msg = 'Unable to set stride "{0}" for a "{1}" since it ' \
|
||||
'is a negative value'.format(stride, type(self))
|
||||
raise ValueError(msg)
|
||||
|
||||
self._stride = stride
|
||||
|
||||
def check_bins(self, bins):
|
||||
"""Make sure given bins are valid for this filter.
|
||||
|
||||
|
|
@ -270,11 +250,7 @@ class Filter(IDManagerMixin):
|
|||
Whether the filter can be merged
|
||||
|
||||
"""
|
||||
|
||||
if type(self) is not type(other):
|
||||
return False
|
||||
|
||||
return True
|
||||
return type(self) is type(other)
|
||||
|
||||
def merge(self, other):
|
||||
"""Merge this filter with another.
|
||||
|
|
@ -402,7 +378,7 @@ class Filter(IDManagerMixin):
|
|||
# Return a 1-tuple of the bin.
|
||||
return (self.bins[bin_index],)
|
||||
|
||||
def get_pandas_dataframe(self, data_size, **kwargs):
|
||||
def get_pandas_dataframe(self, data_size, stride, **kwargs):
|
||||
"""Builds a Pandas DataFrame for the Filter's bins.
|
||||
|
||||
This method constructs a Pandas DataFrame object for the filter with
|
||||
|
|
@ -411,13 +387,15 @@ class Filter(IDManagerMixin):
|
|||
|
||||
Parameters
|
||||
----------
|
||||
data_size : Integral
|
||||
data_size : int
|
||||
The total number of bins in the tally corresponding to this filter
|
||||
stride : int
|
||||
Stride in memory for the filter
|
||||
|
||||
Keyword arguments
|
||||
-----------------
|
||||
paths : bool
|
||||
Only used for DistirbcellFilter. If True (default), expand
|
||||
Only used for DistribcellFilter. If True (default), expand
|
||||
distribcell indices into multi-index columns describing the path
|
||||
to that distribcell through the CSG tree. NOTE: This option assumes
|
||||
that all distribcell paths are of the same length and do not have
|
||||
|
|
@ -431,11 +409,6 @@ class Filter(IDManagerMixin):
|
|||
the total number of bins in the corresponding tally, with the filter
|
||||
bin appropriately tiled to map to the corresponding tally bins.
|
||||
|
||||
Raises
|
||||
------
|
||||
ImportError
|
||||
When Pandas is not installed
|
||||
|
||||
See also
|
||||
--------
|
||||
Tally.get_pandas_dataframe(), CrossFilter.get_pandas_dataframe()
|
||||
|
|
@ -444,7 +417,7 @@ class Filter(IDManagerMixin):
|
|||
# Initialize Pandas DataFrame
|
||||
df = pd.DataFrame()
|
||||
|
||||
filter_bins = np.repeat(self.bins, self.stride)
|
||||
filter_bins = np.repeat(self.bins, stride)
|
||||
tile_factor = data_size // len(filter_bins)
|
||||
filter_bins = np.tile(filter_bins, tile_factor)
|
||||
df = pd.concat([df, pd.DataFrame(
|
||||
|
|
@ -455,23 +428,15 @@ class Filter(IDManagerMixin):
|
|||
|
||||
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):
|
||||
@Filter.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, bin_type))
|
||||
cv.check_iterable_type('filter bins', bins,
|
||||
(Integral, self.expected_type))
|
||||
for edge in bins:
|
||||
if isinstance(edge, Integral):
|
||||
cv.check_greater_than('filter bin', edge, 0, equality=True)
|
||||
|
|
@ -502,18 +467,9 @@ class UniverseFilter(WithIDFilter):
|
|||
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.
|
||||
|
||||
"""
|
||||
@property
|
||||
def bins(self):
|
||||
return self._bins
|
||||
|
||||
@bins.setter
|
||||
def bins(self, bins):
|
||||
self._smart_set_bins(bins, openmc.Universe)
|
||||
expected_type = Universe
|
||||
|
||||
|
||||
class MaterialFilter(WithIDFilter):
|
||||
|
|
@ -535,18 +491,9 @@ class MaterialFilter(WithIDFilter):
|
|||
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.
|
||||
|
||||
"""
|
||||
@property
|
||||
def bins(self):
|
||||
return self._bins
|
||||
|
||||
@bins.setter
|
||||
def bins(self, bins):
|
||||
self._smart_set_bins(bins, openmc.Material)
|
||||
expected_type = Material
|
||||
|
||||
|
||||
class CellFilter(WithIDFilter):
|
||||
|
|
@ -568,18 +515,9 @@ class CellFilter(WithIDFilter):
|
|||
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.
|
||||
|
||||
"""
|
||||
@property
|
||||
def bins(self):
|
||||
return self._bins
|
||||
|
||||
@bins.setter
|
||||
def bins(self, bins):
|
||||
self._smart_set_bins(bins, openmc.Cell)
|
||||
expected_type = Cell
|
||||
|
||||
|
||||
class CellFromFilter(WithIDFilter):
|
||||
|
|
@ -601,18 +539,9 @@ class CellFromFilter(WithIDFilter):
|
|||
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.
|
||||
|
||||
"""
|
||||
@property
|
||||
def bins(self):
|
||||
return self._bins
|
||||
|
||||
@bins.setter
|
||||
def bins(self, bins):
|
||||
self._smart_set_bins(bins, openmc.Cell)
|
||||
expected_type = Cell
|
||||
|
||||
|
||||
class CellbornFilter(WithIDFilter):
|
||||
|
|
@ -634,18 +563,9 @@ class CellbornFilter(WithIDFilter):
|
|||
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.
|
||||
|
||||
"""
|
||||
@property
|
||||
def bins(self):
|
||||
return self._bins
|
||||
|
||||
@bins.setter
|
||||
def bins(self, bins):
|
||||
self._smart_set_bins(bins, openmc.Cell)
|
||||
expected_type = Cell
|
||||
|
||||
|
||||
class SurfaceFilter(Filter):
|
||||
|
|
@ -668,20 +588,9 @@ class SurfaceFilter(Filter):
|
|||
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.
|
||||
|
||||
"""
|
||||
@property
|
||||
def bins(self):
|
||||
return self._bins
|
||||
|
||||
@property
|
||||
def num_bins(self):
|
||||
return len(self.bins)
|
||||
|
||||
@bins.setter
|
||||
@Filter.bins.setter
|
||||
def bins(self, bins):
|
||||
# Format the bins as a 1D numpy array.
|
||||
bins = np.atleast_1d(bins)
|
||||
|
|
@ -693,10 +602,14 @@ class SurfaceFilter(Filter):
|
|||
|
||||
self._bins = bins
|
||||
|
||||
@num_bins.setter
|
||||
def num_bins(self, num_bins): pass
|
||||
@property
|
||||
def num_bins(self):
|
||||
# Need to handle number of bins carefully -- for surface current
|
||||
# tallies, the number of bins depends on the mesh, which we don't have a
|
||||
# reference to in this filter
|
||||
return self._num_bins
|
||||
|
||||
def get_pandas_dataframe(self, data_size, **kwargs):
|
||||
def get_pandas_dataframe(self, data_size, stride, **kwargs):
|
||||
"""Builds a Pandas DataFrame for the Filter's bins.
|
||||
|
||||
This method constructs a Pandas DataFrame object for the filter with
|
||||
|
|
@ -705,8 +618,10 @@ class SurfaceFilter(Filter):
|
|||
|
||||
Parameters
|
||||
----------
|
||||
data_size : Integral
|
||||
data_size : int
|
||||
The total number of bins in the tally corresponding to this filter
|
||||
stride : int
|
||||
Stride in memory for the filter
|
||||
|
||||
Returns
|
||||
-------
|
||||
|
|
@ -717,11 +632,6 @@ class SurfaceFilter(Filter):
|
|||
the corresponding tally, with the filter bin appropriately tiled to
|
||||
map to the corresponding tally bins.
|
||||
|
||||
Raises
|
||||
------
|
||||
ImportError
|
||||
When Pandas is not installed
|
||||
|
||||
See also
|
||||
--------
|
||||
Tally.get_pandas_dataframe(), CrossFilter.get_pandas_dataframe()
|
||||
|
|
@ -730,7 +640,7 @@ class SurfaceFilter(Filter):
|
|||
# Initialize Pandas DataFrame
|
||||
df = pd.DataFrame()
|
||||
|
||||
filter_bins = np.repeat(self.bins, self.stride)
|
||||
filter_bins = np.repeat(self.bins, stride)
|
||||
tile_factor = data_size // len(filter_bins)
|
||||
filter_bins = np.tile(filter_bins, tile_factor)
|
||||
filter_bins = [_CURRENT_NAMES[x] for x in filter_bins]
|
||||
|
|
@ -760,9 +670,6 @@ class MeshFilter(Filter):
|
|||
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.
|
||||
|
||||
"""
|
||||
|
||||
|
|
@ -785,8 +692,8 @@ class MeshFilter(Filter):
|
|||
mesh_obj = kwargs['meshes'][mesh_id]
|
||||
filter_id = int(group.name.split('/')[-1].lstrip('filter '))
|
||||
|
||||
out = cls(mesh_obj, filter_id)
|
||||
out.num_bins = group['n_bins'].value
|
||||
out = cls(mesh_obj, filter_id=filter_id)
|
||||
out._num_bins = group['n_bins'].value
|
||||
|
||||
return out
|
||||
|
||||
|
|
@ -800,6 +707,13 @@ class MeshFilter(Filter):
|
|||
self._mesh = mesh
|
||||
self.bins = mesh.id
|
||||
|
||||
@property
|
||||
def num_bins(self):
|
||||
try:
|
||||
return self._num_bins
|
||||
except AttributeError:
|
||||
return reduce(operator.mul, self.mesh.dimension)
|
||||
|
||||
def check_bins(self, bins):
|
||||
if not len(bins) == 1:
|
||||
msg = 'Unable to add bins "{0}" to a MeshFilter since ' \
|
||||
|
|
@ -854,7 +768,7 @@ class MeshFilter(Filter):
|
|||
y = bin_index - (x * ny)
|
||||
return (x, y)
|
||||
|
||||
def get_pandas_dataframe(self, data_size, **kwargs):
|
||||
def get_pandas_dataframe(self, data_size, stride, **kwargs):
|
||||
"""Builds a Pandas DataFrame for the Filter's bins.
|
||||
|
||||
This method constructs a Pandas DataFrame object for the filter with
|
||||
|
|
@ -863,8 +777,10 @@ class MeshFilter(Filter):
|
|||
|
||||
Parameters
|
||||
----------
|
||||
data_size : Integral
|
||||
data_size : int
|
||||
The total number of bins in the tally corresponding to this filter
|
||||
stride : int
|
||||
Stride in memory for the filter
|
||||
|
||||
Returns
|
||||
-------
|
||||
|
|
@ -875,11 +791,6 @@ class MeshFilter(Filter):
|
|||
corresponding tally, with the filter bin appropriately tiled to map
|
||||
to the corresponding tally bins.
|
||||
|
||||
Raises
|
||||
------
|
||||
ImportError
|
||||
When Pandas is not installed
|
||||
|
||||
See also
|
||||
--------
|
||||
Tally.get_pandas_dataframe(), CrossFilter.get_pandas_dataframe()
|
||||
|
|
@ -906,7 +817,7 @@ class MeshFilter(Filter):
|
|||
|
||||
# Generate multi-index sub-column for x-axis
|
||||
filter_bins = np.arange(1, nx + 1)
|
||||
repeat_factor = ny * nz * self.stride
|
||||
repeat_factor = ny * nz * stride
|
||||
filter_bins = np.repeat(filter_bins, repeat_factor)
|
||||
tile_factor = data_size // len(filter_bins)
|
||||
filter_bins = np.tile(filter_bins, tile_factor)
|
||||
|
|
@ -914,7 +825,7 @@ class MeshFilter(Filter):
|
|||
|
||||
# Generate multi-index sub-column for y-axis
|
||||
filter_bins = np.arange(1, ny + 1)
|
||||
repeat_factor = nz * self.stride
|
||||
repeat_factor = nz * stride
|
||||
filter_bins = np.repeat(filter_bins, repeat_factor)
|
||||
tile_factor = data_size // len(filter_bins)
|
||||
filter_bins = np.tile(filter_bins, tile_factor)
|
||||
|
|
@ -922,7 +833,7 @@ class MeshFilter(Filter):
|
|||
|
||||
# Generate multi-index sub-column for z-axis
|
||||
filter_bins = np.arange(1, nz + 1)
|
||||
repeat_factor = self.stride
|
||||
repeat_factor = stride
|
||||
filter_bins = np.repeat(filter_bins, repeat_factor)
|
||||
tile_factor = data_size // len(filter_bins)
|
||||
filter_bins = np.tile(filter_bins, tile_factor)
|
||||
|
|
@ -950,11 +861,8 @@ class RealFilter(Filter):
|
|||
A grid of bin values.
|
||||
id : int
|
||||
Unique identifier for the filter
|
||||
num_bins : Integral
|
||||
num_bins : int
|
||||
The number of filter bins
|
||||
stride : Integral
|
||||
The number of filter, nuclide and score bins within each of this
|
||||
filter's bins.
|
||||
|
||||
"""
|
||||
|
||||
|
|
@ -970,12 +878,6 @@ class RealFilter(Filter):
|
|||
def num_bins(self):
|
||||
return len(self.bins) - 1
|
||||
|
||||
@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 can_merge(self, other):
|
||||
if type(self) is not type(other):
|
||||
return False
|
||||
|
|
@ -1061,11 +963,8 @@ class EnergyFilter(RealFilter):
|
|||
A grid of energy values in eV.
|
||||
id : int
|
||||
Unique identifier for the filter
|
||||
num_bins : Integral
|
||||
num_bins : int
|
||||
The number of filter bins
|
||||
stride : Integral
|
||||
The number of filter, nuclide and score bins within each of this
|
||||
filter's bins.
|
||||
|
||||
"""
|
||||
|
||||
|
|
@ -1100,7 +999,7 @@ class EnergyFilter(RealFilter):
|
|||
'increasing'.format(bins, type(self))
|
||||
raise ValueError(msg)
|
||||
|
||||
def get_pandas_dataframe(self, data_size, **kwargs):
|
||||
def get_pandas_dataframe(self, data_size, stride, **kwargs):
|
||||
"""Builds a Pandas DataFrame for the Filter's bins.
|
||||
|
||||
This method constructs a Pandas DataFrame object for the filter with
|
||||
|
|
@ -1109,8 +1008,10 @@ class EnergyFilter(RealFilter):
|
|||
|
||||
Parameters
|
||||
----------
|
||||
data_size : Integral
|
||||
data_size : int
|
||||
The total number of bins in the tally corresponding to this filter
|
||||
stride : int
|
||||
Stride in memory for the filter
|
||||
|
||||
Returns
|
||||
-------
|
||||
|
|
@ -1121,11 +1022,6 @@ class EnergyFilter(RealFilter):
|
|||
corresponding tally, with the filter bin appropriately tiled to map
|
||||
to the corresponding tally bins.
|
||||
|
||||
Raises
|
||||
------
|
||||
ImportError
|
||||
When Pandas is not installed
|
||||
|
||||
See also
|
||||
--------
|
||||
Tally.get_pandas_dataframe(), CrossFilter.get_pandas_dataframe()
|
||||
|
|
@ -1136,8 +1032,8 @@ class EnergyFilter(RealFilter):
|
|||
|
||||
# Extract the lower and upper energy bounds, then repeat and tile
|
||||
# them as necessary to account for other filters.
|
||||
lo_bins = np.repeat(self.bins[:-1], self.stride)
|
||||
hi_bins = np.repeat(self.bins[1:], self.stride)
|
||||
lo_bins = np.repeat(self.bins[:-1], stride)
|
||||
hi_bins = np.repeat(self.bins[1:], stride)
|
||||
tile_factor = data_size // len(lo_bins)
|
||||
lo_bins = np.tile(lo_bins, tile_factor)
|
||||
hi_bins = np.tile(hi_bins, tile_factor)
|
||||
|
|
@ -1165,11 +1061,8 @@ class EnergyoutFilter(EnergyFilter):
|
|||
A grid of energy values in eV.
|
||||
id : int
|
||||
Unique identifier for the filter
|
||||
num_bins : Integral
|
||||
num_bins : int
|
||||
The number of filter bins
|
||||
stride : Integral
|
||||
The number of filter, nuclide and score bins within each of this
|
||||
filter's bins.
|
||||
|
||||
"""
|
||||
|
||||
|
|
@ -1227,11 +1120,8 @@ class DistribcellFilter(Filter):
|
|||
An iterable with one element---the ID of the distributed Cell.
|
||||
id : int
|
||||
Unique identifier for the filter
|
||||
num_bins : Integral
|
||||
num_bins : int
|
||||
The number of filter bins
|
||||
stride : Integral
|
||||
The number of filter, nuclide and score bins within each of this
|
||||
filter's bins.
|
||||
paths : list of str
|
||||
The paths traversed through the CSG tree to reach each distribcell
|
||||
instance (for 'distribcell' filters only)
|
||||
|
|
@ -1251,20 +1141,22 @@ class DistribcellFilter(Filter):
|
|||
|
||||
filter_id = int(group.name.split('/')[-1].lstrip('filter '))
|
||||
|
||||
out = cls(group['bins'].value, filter_id)
|
||||
out.num_bins = group['n_bins'].value
|
||||
out = cls(group['bins'].value, filter_id=filter_id)
|
||||
out._num_bins = group['n_bins'].value
|
||||
|
||||
return out
|
||||
|
||||
@property
|
||||
def bins(self):
|
||||
return self._bins
|
||||
def num_bins(self):
|
||||
# Need to handle number of bins carefully -- for distribcell tallies, we
|
||||
# need to know how many instances of the cell there are
|
||||
return self._num_bins
|
||||
|
||||
@property
|
||||
def paths(self):
|
||||
return self._paths
|
||||
|
||||
@bins.setter
|
||||
@Filter.bins.setter
|
||||
def bins(self, bins):
|
||||
# Format the bins as a 1D numpy array.
|
||||
bins = np.atleast_1d(bins)
|
||||
|
|
@ -1296,7 +1188,7 @@ class DistribcellFilter(Filter):
|
|||
# the Cell in the Geometry (consecutive integers starting at 0).
|
||||
return filter_bin
|
||||
|
||||
def get_pandas_dataframe(self, data_size, **kwargs):
|
||||
def get_pandas_dataframe(self, data_size, stride, **kwargs):
|
||||
"""Builds a Pandas DataFrame for the Filter's bins.
|
||||
|
||||
This method constructs a Pandas DataFrame object for the filter with
|
||||
|
|
@ -1305,8 +1197,10 @@ class DistribcellFilter(Filter):
|
|||
|
||||
Parameters
|
||||
----------
|
||||
data_size : Integral
|
||||
data_size : int
|
||||
The total number of bins in the tally corresponding to this filter
|
||||
stride : int
|
||||
Stride in memory for the filter
|
||||
|
||||
Keyword arguments
|
||||
-----------------
|
||||
|
|
@ -1331,11 +1225,6 @@ class DistribcellFilter(Filter):
|
|||
of bins in the corresponding tally, with the filter bin
|
||||
appropriately tiled to map to the corresponding tally bins.
|
||||
|
||||
Raises
|
||||
------
|
||||
ImportError
|
||||
When Pandas is not installed
|
||||
|
||||
See also
|
||||
--------
|
||||
Tally.get_pandas_dataframe(), CrossFilter.get_pandas_dataframe()
|
||||
|
|
@ -1418,7 +1307,7 @@ class DistribcellFilter(Filter):
|
|||
|
||||
# Tile the Multi-index columns
|
||||
for level_key, level_bins in level_dict.items():
|
||||
level_bins = np.repeat(level_bins, self.stride)
|
||||
level_bins = np.repeat(level_bins, stride)
|
||||
tile_factor = data_size // len(level_bins)
|
||||
level_bins = np.tile(level_bins, tile_factor)
|
||||
level_dict[level_key] = level_bins
|
||||
|
|
@ -1434,7 +1323,7 @@ class DistribcellFilter(Filter):
|
|||
# NOTE: This is performed regardless of whether the user
|
||||
# requests Summary geometric information
|
||||
filter_bins = np.arange(self.num_bins)
|
||||
filter_bins = np.repeat(filter_bins, self.stride)
|
||||
filter_bins = np.repeat(filter_bins, stride)
|
||||
tile_factor = data_size // len(filter_bins)
|
||||
filter_bins = np.tile(filter_bins, tile_factor)
|
||||
df = pd.DataFrame({self.short_name.lower() : filter_bins})
|
||||
|
|
@ -1474,9 +1363,6 @@ class MuFilter(RealFilter):
|
|||
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.
|
||||
|
||||
"""
|
||||
|
||||
|
|
@ -1504,7 +1390,7 @@ class MuFilter(RealFilter):
|
|||
'increasing'.format(bins, type(self))
|
||||
raise ValueError(msg)
|
||||
|
||||
def get_pandas_dataframe(self, data_size, **kwargs):
|
||||
def get_pandas_dataframe(self, data_size, stride, **kwargs):
|
||||
"""Builds a Pandas DataFrame for the Filter's bins.
|
||||
|
||||
This method constructs a Pandas DataFrame object for the filter with
|
||||
|
|
@ -1513,8 +1399,10 @@ class MuFilter(RealFilter):
|
|||
|
||||
Parameters
|
||||
----------
|
||||
data_size : Integral
|
||||
data_size : int
|
||||
The total number of bins in the tally corresponding to this filter
|
||||
stride : int
|
||||
Stride in memory for the filter
|
||||
|
||||
Returns
|
||||
-------
|
||||
|
|
@ -1525,11 +1413,6 @@ class MuFilter(RealFilter):
|
|||
corresponding tally, with the filter bin appropriately tiled to map
|
||||
to the corresponding tally bins.
|
||||
|
||||
Raises
|
||||
------
|
||||
ImportError
|
||||
When Pandas is not installed
|
||||
|
||||
See also
|
||||
--------
|
||||
Tally.get_pandas_dataframe(), CrossFilter.get_pandas_dataframe()
|
||||
|
|
@ -1540,8 +1423,8 @@ class MuFilter(RealFilter):
|
|||
|
||||
# Extract the lower and upper energy bounds, then repeat and tile
|
||||
# them as necessary to account for other filters.
|
||||
lo_bins = np.repeat(self.bins[:-1], self.stride)
|
||||
hi_bins = np.repeat(self.bins[1:], self.stride)
|
||||
lo_bins = np.repeat(self.bins[:-1], stride)
|
||||
hi_bins = np.repeat(self.bins[1:], stride)
|
||||
tile_factor = data_size // len(lo_bins)
|
||||
lo_bins = np.tile(lo_bins, tile_factor)
|
||||
hi_bins = np.tile(hi_bins, tile_factor)
|
||||
|
|
@ -1579,9 +1462,6 @@ class PolarFilter(RealFilter):
|
|||
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.
|
||||
|
||||
"""
|
||||
|
||||
|
|
@ -1609,7 +1489,7 @@ class PolarFilter(RealFilter):
|
|||
'increasing'.format(bins, type(self))
|
||||
raise ValueError(msg)
|
||||
|
||||
def get_pandas_dataframe(self, data_size, **kwargs):
|
||||
def get_pandas_dataframe(self, data_size, stride, **kwargs):
|
||||
"""Builds a Pandas DataFrame for the Filter's bins.
|
||||
|
||||
This method constructs a Pandas DataFrame object for the filter with
|
||||
|
|
@ -1618,8 +1498,10 @@ class PolarFilter(RealFilter):
|
|||
|
||||
Parameters
|
||||
----------
|
||||
data_size : Integral
|
||||
data_size : int
|
||||
The total number of bins in the tally corresponding to this filter
|
||||
stride : int
|
||||
Stride in memory for the filter
|
||||
|
||||
Returns
|
||||
-------
|
||||
|
|
@ -1630,11 +1512,6 @@ class PolarFilter(RealFilter):
|
|||
corresponding tally, with the filter bin appropriately tiled to map
|
||||
to the corresponding tally bins.
|
||||
|
||||
Raises
|
||||
------
|
||||
ImportError
|
||||
When Pandas is not installed
|
||||
|
||||
See also
|
||||
--------
|
||||
Tally.get_pandas_dataframe(), CrossFilter.get_pandas_dataframe()
|
||||
|
|
@ -1645,8 +1522,8 @@ class PolarFilter(RealFilter):
|
|||
|
||||
# Extract the lower and upper angle bounds, then repeat and tile
|
||||
# them as necessary to account for other filters.
|
||||
lo_bins = np.repeat(self.bins[:-1], self.stride)
|
||||
hi_bins = np.repeat(self.bins[1:], self.stride)
|
||||
lo_bins = np.repeat(self.bins[:-1], stride)
|
||||
hi_bins = np.repeat(self.bins[1:], stride)
|
||||
tile_factor = data_size // len(lo_bins)
|
||||
lo_bins = np.tile(lo_bins, tile_factor)
|
||||
hi_bins = np.tile(hi_bins, tile_factor)
|
||||
|
|
@ -1684,9 +1561,6 @@ class AzimuthalFilter(RealFilter):
|
|||
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.
|
||||
|
||||
"""
|
||||
|
||||
|
|
@ -1714,7 +1588,7 @@ class AzimuthalFilter(RealFilter):
|
|||
'increasing'.format(bins, type(self))
|
||||
raise ValueError(msg)
|
||||
|
||||
def get_pandas_dataframe(self, data_size, paths=True):
|
||||
def get_pandas_dataframe(self, data_size, stride, paths=True):
|
||||
"""Builds a Pandas DataFrame for the Filter's bins.
|
||||
|
||||
This method constructs a Pandas DataFrame object for the filter with
|
||||
|
|
@ -1723,8 +1597,10 @@ class AzimuthalFilter(RealFilter):
|
|||
|
||||
Parameters
|
||||
----------
|
||||
data_size : Integral
|
||||
data_size : int
|
||||
The total number of bins in the tally corresponding to this filter
|
||||
stride : int
|
||||
Stride in memory for the filter
|
||||
|
||||
Returns
|
||||
-------
|
||||
|
|
@ -1735,11 +1611,6 @@ class AzimuthalFilter(RealFilter):
|
|||
corresponding tally, with the filter bin appropriately tiled to map
|
||||
to the corresponding tally bins.
|
||||
|
||||
Raises
|
||||
------
|
||||
ImportError
|
||||
When Pandas is not installed
|
||||
|
||||
See also
|
||||
--------
|
||||
Tally.get_pandas_dataframe(), CrossFilter.get_pandas_dataframe()
|
||||
|
|
@ -1750,8 +1621,8 @@ class AzimuthalFilter(RealFilter):
|
|||
|
||||
# Extract the lower and upper angle bounds, then repeat and tile
|
||||
# them as necessary to account for other filters.
|
||||
lo_bins = np.repeat(self.bins[:-1], self.stride)
|
||||
hi_bins = np.repeat(self.bins[1:], self.stride)
|
||||
lo_bins = np.repeat(self.bins[:-1], stride)
|
||||
hi_bins = np.repeat(self.bins[1:], stride)
|
||||
tile_factor = data_size // len(lo_bins)
|
||||
lo_bins = np.tile(lo_bins, tile_factor)
|
||||
hi_bins = np.tile(hi_bins, tile_factor)
|
||||
|
|
@ -1785,20 +1656,9 @@ class DelayedGroupFilter(Filter):
|
|||
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.
|
||||
|
||||
"""
|
||||
@property
|
||||
def bins(self):
|
||||
return self._bins
|
||||
|
||||
@property
|
||||
def num_bins(self):
|
||||
return len(self.bins)
|
||||
|
||||
@bins.setter
|
||||
@Filter.bins.setter
|
||||
def bins(self, bins):
|
||||
# Format the bins as a 1D numpy array.
|
||||
bins = np.atleast_1d(bins)
|
||||
|
|
@ -1810,9 +1670,6 @@ class DelayedGroupFilter(Filter):
|
|||
|
||||
self._bins = bins
|
||||
|
||||
@num_bins.setter
|
||||
def num_bins(self, num_bins): pass
|
||||
|
||||
|
||||
class EnergyFunctionFilter(Filter):
|
||||
"""Multiplies tally scores by an arbitrary function of incident energy.
|
||||
|
|
@ -1840,9 +1697,6 @@ class EnergyFunctionFilter(Filter):
|
|||
Unique identifier for the filter
|
||||
num_bins : Integral
|
||||
The number of filter bins (always 1 for this filter)
|
||||
stride : Integral
|
||||
The number of filter, nuclide and score bins within each of this
|
||||
filter's bins.
|
||||
|
||||
"""
|
||||
|
||||
|
|
@ -1850,7 +1704,6 @@ class EnergyFunctionFilter(Filter):
|
|||
self.energy = energy
|
||||
self.y = y
|
||||
self.id = filter_id
|
||||
self._stride = None
|
||||
|
||||
def __eq__(self, other):
|
||||
if type(self) is not type(other):
|
||||
|
|
@ -1910,7 +1763,7 @@ class EnergyFunctionFilter(Filter):
|
|||
y = group['y'].value
|
||||
filter_id = int(group.name.split('/')[-1].lstrip('filter '))
|
||||
|
||||
return cls(energy, y, filter_id)
|
||||
return cls(energy, y, filter_id=filter_id)
|
||||
|
||||
@classmethod
|
||||
def from_tabulated1d(cls, tab1d):
|
||||
|
|
@ -1947,7 +1800,7 @@ class EnergyFunctionFilter(Filter):
|
|||
|
||||
@property
|
||||
def bins(self):
|
||||
raise RuntimeError('EnergyFunctionFilters have no bins.')
|
||||
raise AttributeError('EnergyFunctionFilters have no bins.')
|
||||
|
||||
@property
|
||||
def num_bins(self):
|
||||
|
|
@ -2006,7 +1859,7 @@ class EnergyFunctionFilter(Filter):
|
|||
"""This function is invalid for EnergyFunctionFilters."""
|
||||
raise RuntimeError('EnergyFunctionFilters have no get_bin() method')
|
||||
|
||||
def get_pandas_dataframe(self, data_size, **kwargs):
|
||||
def get_pandas_dataframe(self, data_size, stride, **kwargs):
|
||||
"""Builds a Pandas DataFrame for the Filter's bins.
|
||||
|
||||
This method constructs a Pandas DataFrame object for the filter with
|
||||
|
|
@ -2015,8 +1868,10 @@ class EnergyFunctionFilter(Filter):
|
|||
|
||||
Parameters
|
||||
----------
|
||||
data_size : Integral
|
||||
data_size : int
|
||||
The total number of bins in the tally corresponding to this filter
|
||||
stride : int
|
||||
Stride in memory for the filter
|
||||
|
||||
Returns
|
||||
-------
|
||||
|
|
@ -2027,11 +1882,6 @@ class EnergyFunctionFilter(Filter):
|
|||
EnergyFunctionFilters. The number of rows in the DataFrame is the
|
||||
same as the total number of bins in the corresponding tally.
|
||||
|
||||
Raises
|
||||
------
|
||||
ImportError
|
||||
When Pandas is not installed
|
||||
|
||||
See also
|
||||
--------
|
||||
Tally.get_pandas_dataframe(), CrossFilter.get_pandas_dataframe()
|
||||
|
|
@ -2052,7 +1902,7 @@ class EnergyFunctionFilter(Filter):
|
|||
# hex characters) of the digest are probably sufficient.
|
||||
out = out[:14]
|
||||
|
||||
filter_bins = np.repeat(out, self.stride)
|
||||
filter_bins = np.repeat(out, stride)
|
||||
tile_factor = data_size // len(filter_bins)
|
||||
filter_bins = np.tile(filter_bins, tile_factor)
|
||||
df = pd.concat([df, pd.DataFrame(
|
||||
|
|
|
|||
|
|
@ -517,24 +517,6 @@ class RectLattice(Lattice):
|
|||
# Initialize Lattice class attributes
|
||||
self._lower_left = None
|
||||
|
||||
def __eq__(self, other):
|
||||
if not isinstance(other, RectLattice):
|
||||
return False
|
||||
elif not super(RectLattice, self).__eq__(other):
|
||||
return False
|
||||
elif self.shape != other.shape:
|
||||
return False
|
||||
elif np.any(self.lower_left != other.lower_left):
|
||||
return False
|
||||
else:
|
||||
return True
|
||||
|
||||
def __ne__(self, other):
|
||||
return not self == other
|
||||
|
||||
def __hash__(self):
|
||||
return hash(repr(self))
|
||||
|
||||
def __repr__(self):
|
||||
string = 'RectLattice\n'
|
||||
string += '{0: <16}{1}{2}\n'.format('\tID', '=\t', self._id)
|
||||
|
|
@ -864,26 +846,6 @@ class HexLattice(Lattice):
|
|||
self._num_axial = None
|
||||
self._center = None
|
||||
|
||||
def __eq__(self, other):
|
||||
if not isinstance(other, HexLattice):
|
||||
return False
|
||||
elif not super(HexLattice, self).__eq__(other):
|
||||
return False
|
||||
elif self.num_rings != other.num_rings:
|
||||
return False
|
||||
elif self.num_axial != other.num_axial:
|
||||
return False
|
||||
elif self.center != other.center:
|
||||
return False
|
||||
else:
|
||||
return True
|
||||
|
||||
def __ne__(self, other):
|
||||
return not self == other
|
||||
|
||||
def __hash__(self):
|
||||
return hash(repr(self))
|
||||
|
||||
def __repr__(self):
|
||||
string = 'HexLattice\n'
|
||||
string += '{0: <16}{1}{2}\n'.format('\tID', '=\t', self._id)
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ from six import string_types
|
|||
from openmc.checkvalue import check_type
|
||||
|
||||
|
||||
class Macroscopic(object):
|
||||
class Macroscopic(str):
|
||||
"""A Macroscopic object that can be used in a material.
|
||||
|
||||
Parameters
|
||||
|
|
@ -18,39 +18,10 @@ class Macroscopic(object):
|
|||
|
||||
"""
|
||||
|
||||
def __init__(self, name=''):
|
||||
# Initialize class attributes
|
||||
self._name = ''
|
||||
|
||||
# Set the Macroscopic class attributes
|
||||
self.name = name
|
||||
|
||||
def __eq__(self, other):
|
||||
if isinstance(other, Macroscopic):
|
||||
if self.name != other.name:
|
||||
return False
|
||||
else:
|
||||
return True
|
||||
elif isinstance(other, string_types) and other == self.name:
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
def __ne__(self, other):
|
||||
return not self == other
|
||||
|
||||
def __hash__(self):
|
||||
return hash((self._name))
|
||||
|
||||
def __repr__(self):
|
||||
string = 'Macroscopic - {0}\n'.format(self._name)
|
||||
return string
|
||||
def __new__(cls, name):
|
||||
check_type('name', name, string_types)
|
||||
return super(Macroscopic, cls).__new__(cls, name)
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
return self._name
|
||||
|
||||
@name.setter
|
||||
def name(self, name):
|
||||
check_type('name', name, string_types)
|
||||
self._name = name
|
||||
return self
|
||||
|
|
|
|||
|
|
@ -55,14 +55,12 @@ class Material(IDManagerMixin):
|
|||
depletable : bool
|
||||
Indicate whether the material is depletable. This attribute can be used
|
||||
by downstream depletion applications.
|
||||
elements : list of tuple
|
||||
List in which each item is a 4-tuple consisting of an
|
||||
:class:`openmc.Element` instance, the percent density, the percent
|
||||
type ('ao' or 'wo'), and enrichment.
|
||||
nuclides : list of tuple
|
||||
List in which each item is a 3-tuple consisting of an
|
||||
:class:`openmc.Nuclide` instance, the percent density, and the percent
|
||||
type ('ao' or 'wo').
|
||||
List in which each item is a 3-tuple consisting of a nuclide string, the
|
||||
percent density, and the percent type ('ao' or 'wo').
|
||||
isotropic : list of str
|
||||
Nuclides for which elastic scattering should be treated as though it
|
||||
were isotropic in the laboratory system.
|
||||
average_molar_mass : float
|
||||
The average molar mass of nuclides in the material in units of grams per
|
||||
mol. For example, UO2 with 3 nuclides will have an average molar mass
|
||||
|
|
@ -95,6 +93,7 @@ class Material(IDManagerMixin):
|
|||
self._num_instances = None
|
||||
self._volume = None
|
||||
self._atoms = {}
|
||||
self._isotropic = []
|
||||
|
||||
# A list of tuples (nuclide, percent, percent type)
|
||||
self._nuclides = []
|
||||
|
|
@ -103,9 +102,6 @@ class Material(IDManagerMixin):
|
|||
# (only one is allowed, hence this is different than _nuclides, etc)
|
||||
self._macroscopic = None
|
||||
|
||||
# A list of tuples (element, percent, percent type, enrichment)
|
||||
self._elements = []
|
||||
|
||||
# If specified, a list of table names
|
||||
self._sab = []
|
||||
|
||||
|
|
@ -115,33 +111,6 @@ class Material(IDManagerMixin):
|
|||
# If specified, this file will be used instead of composition values
|
||||
self._distrib_otf_file = None
|
||||
|
||||
def __eq__(self, other):
|
||||
if not isinstance(other, Material):
|
||||
return False
|
||||
elif self.id != other.id:
|
||||
return False
|
||||
elif self.name != other.name:
|
||||
return False
|
||||
# FIXME: We cannot compare densities since OpenMC outputs densities
|
||||
# in atom/b-cm in summary.h5 irregardless of input units, and we
|
||||
# cannot compute the sum percent in Python since we lack AWR
|
||||
#elif self.density != other.density:
|
||||
# return False
|
||||
#elif self._nuclides != other._nuclides:
|
||||
# return False
|
||||
#elif self._elements != other._elements:
|
||||
# return False
|
||||
elif self._sab != other._sab:
|
||||
return False
|
||||
else:
|
||||
return True
|
||||
|
||||
def __ne__(self, other):
|
||||
return not self == other
|
||||
|
||||
def __hash__(self):
|
||||
return hash(repr(self))
|
||||
|
||||
def __repr__(self):
|
||||
string = 'Material\n'
|
||||
string += '{: <16}=\t{}\n'.format('\tID', self._id)
|
||||
|
|
@ -159,23 +128,13 @@ class Material(IDManagerMixin):
|
|||
string += '{: <16}\n'.format('\tNuclides')
|
||||
|
||||
for nuclide, percent, percent_type in self._nuclides:
|
||||
string += '{0: <16}'.format('\t{0.name}'.format(nuclide))
|
||||
string += '{: <16}'.format('\t{}'.format(nuclide))
|
||||
string += '=\t{: <12} [{}]\n'.format(percent, percent_type)
|
||||
|
||||
if self._macroscopic is not None:
|
||||
string += '{: <16}\n'.format('\tMacroscopic Data')
|
||||
string += '{: <16}'.format('\t{}'.format(self._macroscopic))
|
||||
|
||||
string += '{: <16}\n'.format('\tElements')
|
||||
|
||||
for element, percent, percent_type, enr in self._elements:
|
||||
string += '{0: <16}'.format('\t{0.name}'.format(element))
|
||||
if enr is None:
|
||||
string += '=\t{: <12} [{}]\n'.format(percent, percent_type)
|
||||
else:
|
||||
string += '=\t{: <12} [{}] @ {} w/o enrichment\n'\
|
||||
.format(percent, percent_type, enr)
|
||||
|
||||
return string
|
||||
|
||||
@property
|
||||
|
|
@ -213,14 +172,14 @@ class Material(IDManagerMixin):
|
|||
'the Geometry.determine_paths() method.')
|
||||
return self._num_instances
|
||||
|
||||
@property
|
||||
def elements(self):
|
||||
return self._elements
|
||||
|
||||
@property
|
||||
def nuclides(self):
|
||||
return self._nuclides
|
||||
|
||||
@property
|
||||
def isotropic(self):
|
||||
return self._isotropic
|
||||
|
||||
@property
|
||||
def convert_to_distrib_comps(self):
|
||||
return self._convert_to_distrib_comps
|
||||
|
|
@ -281,6 +240,12 @@ class Material(IDManagerMixin):
|
|||
cv.check_type('material volume', volume, Real)
|
||||
self._volume = volume
|
||||
|
||||
@isotropic.setter
|
||||
def isotropic(self, isotropic):
|
||||
cv.check_iterable_type('Isotropic scattering nuclides', isotropic,
|
||||
string_types)
|
||||
self._isotropic = list(isotropic)
|
||||
|
||||
@classmethod
|
||||
def from_hdf5(cls, group):
|
||||
"""Create material from HDF5 group
|
||||
|
|
@ -400,7 +365,7 @@ class Material(IDManagerMixin):
|
|||
|
||||
Parameters
|
||||
----------
|
||||
nuclide : str or openmc.Nuclide
|
||||
nuclide : str
|
||||
Nuclide to add
|
||||
percent : float
|
||||
Atom or weight percent
|
||||
|
|
@ -414,9 +379,9 @@ class Material(IDManagerMixin):
|
|||
'macroscopic data-set has already been added'.format(self._id)
|
||||
raise ValueError(msg)
|
||||
|
||||
if not isinstance(nuclide, string_types + (openmc.Nuclide,)):
|
||||
if not isinstance(nuclide, string_types):
|
||||
msg = 'Unable to add a Nuclide to Material ID="{}" with a ' \
|
||||
'non-Nuclide value "{}"'.format(self._id, nuclide)
|
||||
'non-string value "{}"'.format(self._id, nuclide)
|
||||
raise ValueError(msg)
|
||||
|
||||
elif not isinstance(percent, Real):
|
||||
|
|
@ -424,18 +389,11 @@ class Material(IDManagerMixin):
|
|||
'non-floating point value "{}"'.format(self._id, percent)
|
||||
raise ValueError(msg)
|
||||
|
||||
elif percent_type not in ['ao', 'wo', 'at/g-cm']:
|
||||
elif percent_type not in ('ao', 'wo'):
|
||||
msg = 'Unable to add a Nuclide to Material ID="{}" with a ' \
|
||||
'percent type "{}"'.format(self._id, percent_type)
|
||||
raise ValueError(msg)
|
||||
|
||||
if isinstance(nuclide, openmc.Nuclide):
|
||||
# Copy this Nuclide to separate it from the Nuclide in
|
||||
# other Materials
|
||||
nuclide = deepcopy(nuclide)
|
||||
else:
|
||||
nuclide = openmc.Nuclide(nuclide)
|
||||
|
||||
self._nuclides.append((nuclide, percent, percent_type))
|
||||
|
||||
def remove_nuclide(self, nuclide):
|
||||
|
|
@ -443,14 +401,11 @@ class Material(IDManagerMixin):
|
|||
|
||||
Parameters
|
||||
----------
|
||||
nuclide : openmc.Nuclide
|
||||
nuclide : str
|
||||
Nuclide to remove
|
||||
|
||||
"""
|
||||
cv.check_type('nuclide', nuclide, string_types + (openmc.Nuclide,))
|
||||
|
||||
if isinstance(nuclide, string_types):
|
||||
nuclide = openmc.Nuclide(nuclide)
|
||||
cv.check_type('nuclide', nuclide, string_types)
|
||||
|
||||
# If the Material contains the Nuclide, delete it
|
||||
for nuc in self._nuclides:
|
||||
|
|
@ -465,32 +420,25 @@ class Material(IDManagerMixin):
|
|||
|
||||
Parameters
|
||||
----------
|
||||
macroscopic : str or openmc.Macroscopic
|
||||
macroscopic : str
|
||||
Macroscopic to add
|
||||
|
||||
"""
|
||||
|
||||
# Ensure no nuclides, elements, or sab are added since these would be
|
||||
# incompatible with macroscopics
|
||||
if self._nuclides or self._elements or self._sab:
|
||||
if self._nuclides or self._sab:
|
||||
msg = 'Unable to add a Macroscopic data set to Material ID="{}" ' \
|
||||
'with a macroscopic value "{}" as an incompatible data ' \
|
||||
'member (i.e., nuclide, element, or S(a,b) table) ' \
|
||||
'member (i.e., nuclide or S(a,b) table) ' \
|
||||
'has already been added'.format(self._id, macroscopic)
|
||||
raise ValueError(msg)
|
||||
|
||||
if not isinstance(macroscopic, string_types + (openmc.Macroscopic,)):
|
||||
if not isinstance(macroscopic, string_types):
|
||||
msg = 'Unable to add a Macroscopic to Material ID="{}" with a ' \
|
||||
'non-Macroscopic value "{}"'.format(self._id, macroscopic)
|
||||
'non-string value "{}"'.format(self._id, macroscopic)
|
||||
raise ValueError(msg)
|
||||
|
||||
if isinstance(macroscopic, openmc.Macroscopic):
|
||||
# Copy this Macroscopic to separate it from the Macroscopic in
|
||||
# other Materials
|
||||
macroscopic = deepcopy(macroscopic)
|
||||
else:
|
||||
macroscopic = openmc.Macroscopic(macroscopic)
|
||||
|
||||
if self._macroscopic is None:
|
||||
self._macroscopic = macroscopic
|
||||
else:
|
||||
|
|
@ -512,18 +460,18 @@ class Material(IDManagerMixin):
|
|||
|
||||
Parameters
|
||||
----------
|
||||
macroscopic : openmc.Macroscopic
|
||||
macroscopic : str
|
||||
Macroscopic to remove
|
||||
|
||||
"""
|
||||
|
||||
if not isinstance(macroscopic, openmc.Macroscopic):
|
||||
if not isinstance(macroscopic, string_types):
|
||||
msg = 'Unable to remove a Macroscopic "{}" in Material ID="{}" ' \
|
||||
'since it is not a Macroscopic'.format(self._id, macroscopic)
|
||||
'since it is not a string'.format(self._id, macroscopic)
|
||||
raise ValueError(msg)
|
||||
|
||||
# If the Material contains the Macroscopic, delete it
|
||||
if macroscopic.name == self._macroscopic.name:
|
||||
if macroscopic == self._macroscopic:
|
||||
self._macroscopic = None
|
||||
|
||||
def add_element(self, element, percent, percent_type='ao', enrichment=None):
|
||||
|
|
@ -531,7 +479,7 @@ class Material(IDManagerMixin):
|
|||
|
||||
Parameters
|
||||
----------
|
||||
element : openmc.Element or str
|
||||
element : str
|
||||
Element to add
|
||||
percent : float
|
||||
Atom or weight percent
|
||||
|
|
@ -550,9 +498,9 @@ class Material(IDManagerMixin):
|
|||
'macroscopic data-set has already been added'.format(self._id)
|
||||
raise ValueError(msg)
|
||||
|
||||
if not isinstance(element, string_types + (openmc.Element,)):
|
||||
if not isinstance(element, string_types):
|
||||
msg = 'Unable to add an Element to Material ID="{}" with a ' \
|
||||
'non-Element value "{}"'.format(self._id, element)
|
||||
'non-string value "{}"'.format(self._id, element)
|
||||
raise ValueError(msg)
|
||||
|
||||
if not isinstance(percent, Real):
|
||||
|
|
@ -565,12 +513,6 @@ class Material(IDManagerMixin):
|
|||
'percent type "{}"'.format(self._id, percent_type)
|
||||
raise ValueError(msg)
|
||||
|
||||
# Copy this Element to separate it from same Element in other Materials
|
||||
if isinstance(element, openmc.Element):
|
||||
element = deepcopy(element)
|
||||
else:
|
||||
element = openmc.Element(element)
|
||||
|
||||
if enrichment is not None:
|
||||
if not isinstance(enrichment, Real):
|
||||
msg = 'Unable to add an Element to Material ID="{}" with a ' \
|
||||
|
|
@ -578,10 +520,9 @@ class Material(IDManagerMixin):
|
|||
.format(self._id, enrichment)
|
||||
raise ValueError(msg)
|
||||
|
||||
elif element.name != 'U':
|
||||
elif element != 'U':
|
||||
msg = 'Unable to use enrichment for element {} which is not ' \
|
||||
'uranium for Material ID="{}"'.format(element.name,
|
||||
self._id)
|
||||
'uranium for Material ID="{}"'.format(element, self._id)
|
||||
raise ValueError(msg)
|
||||
|
||||
# Check that the enrichment is in the valid range
|
||||
|
|
@ -597,26 +538,10 @@ class Material(IDManagerMixin):
|
|||
format(enrichment, self._id)
|
||||
warnings.warn(msg)
|
||||
|
||||
self._elements.append((element, percent, percent_type, enrichment))
|
||||
|
||||
def remove_element(self, element):
|
||||
"""Remove a natural element from the material
|
||||
|
||||
Parameters
|
||||
----------
|
||||
element : openmc.Element
|
||||
Element to remove
|
||||
|
||||
"""
|
||||
cv.check_type('element', element, string_types + (openmc.Element,))
|
||||
|
||||
if isinstance(element, string_types):
|
||||
element = openmc.Element(element)
|
||||
|
||||
# If the Material contains the Element, delete it
|
||||
for elm in self._elements:
|
||||
if element == elm[0]:
|
||||
self._elements.remove(elm)
|
||||
# Add naturally-occuring isotopes
|
||||
element = openmc.Element(element)
|
||||
for nuclide in element.expand(percent, percent_type, enrichment):
|
||||
self._nuclides.append(nuclide)
|
||||
|
||||
def add_s_alpha_beta(self, name, fraction=1.0):
|
||||
r"""Add an :math:`S(\alpha,\beta)` table to the material
|
||||
|
|
@ -656,10 +581,7 @@ class Material(IDManagerMixin):
|
|||
self._sab.append((new_name, fraction))
|
||||
|
||||
def make_isotropic_in_lab(self):
|
||||
for nuclide, percent, percent_type in self._nuclides:
|
||||
nuclide.scattering = 'iso-in-lab'
|
||||
for element, percent, percent_type, enrichment in self._elements:
|
||||
element.scattering = 'iso-in-lab'
|
||||
self.isotropic = [x[0] for x in self._nuclides]
|
||||
|
||||
def get_nuclides(self):
|
||||
"""Returns all nuclides in the material
|
||||
|
|
@ -670,20 +592,7 @@ class Material(IDManagerMixin):
|
|||
List of nuclide names
|
||||
|
||||
"""
|
||||
|
||||
nuclides = []
|
||||
|
||||
for nuclide, percent, percent_type in self._nuclides:
|
||||
nuclides.append(nuclide.name)
|
||||
|
||||
for ele, ele_pct, ele_pct_type, enr in self._elements:
|
||||
|
||||
# Expand natural element into isotopes
|
||||
isotopes = ele.expand(ele_pct, ele_pct_type, enr)
|
||||
for iso, iso_pct, iso_pct_type in isotopes:
|
||||
nuclides.append(iso.name)
|
||||
|
||||
return nuclides
|
||||
return [x[0] for x in self._nuclides]
|
||||
|
||||
def get_nuclide_densities(self):
|
||||
"""Returns all nuclides in the material and their densities
|
||||
|
|
@ -699,14 +608,7 @@ class Material(IDManagerMixin):
|
|||
nuclides = OrderedDict()
|
||||
|
||||
for nuclide, density, density_type in self._nuclides:
|
||||
nuclides[nuclide.name] = (nuclide, density, density_type)
|
||||
|
||||
for ele, ele_pct, ele_pct_type, enr in self._elements:
|
||||
|
||||
# Expand natural element into isotopes
|
||||
isotopes = ele.expand(ele_pct, ele_pct_type, enr)
|
||||
for iso, iso_pct, iso_pct_type in isotopes:
|
||||
nuclides[iso.name] = (iso, iso_pct, iso_pct_type)
|
||||
nuclides[nuclide] = (nuclide, density, density_type)
|
||||
|
||||
return nuclides
|
||||
|
||||
|
|
@ -767,7 +669,7 @@ class Material(IDManagerMixin):
|
|||
if not percent_in_atom:
|
||||
for n, nuc in enumerate(nucs):
|
||||
nuc_densities[n] *= self.average_molar_mass / \
|
||||
openmc.data.atomic_mass(nuc.name)
|
||||
openmc.data.atomic_mass(nuc)
|
||||
|
||||
# Now that we have the atomic amounts, lets finish calculating densities
|
||||
sum_percent = np.sum(nuc_densities)
|
||||
|
|
@ -827,7 +729,7 @@ class Material(IDManagerMixin):
|
|||
|
||||
def _get_nuclide_xml(self, nuclide, distrib=False):
|
||||
xml_element = ET.Element("nuclide")
|
||||
xml_element.set("name", nuclide[0].name)
|
||||
xml_element.set("name", nuclide[0])
|
||||
|
||||
if not distrib:
|
||||
if nuclide[2] == 'ao':
|
||||
|
|
@ -835,48 +737,18 @@ class Material(IDManagerMixin):
|
|||
else:
|
||||
xml_element.set("wo", str(nuclide[1]))
|
||||
|
||||
if not nuclide[0].scattering is None:
|
||||
xml_element.set("scattering", nuclide[0].scattering)
|
||||
|
||||
return xml_element
|
||||
|
||||
def _get_macroscopic_xml(self, macroscopic):
|
||||
xml_element = ET.Element("macroscopic")
|
||||
xml_element.set("name", macroscopic.name)
|
||||
xml_element.set("name", macroscopic)
|
||||
|
||||
return xml_element
|
||||
|
||||
def _get_element_xml(self, element, cross_sections, distrib=False):
|
||||
|
||||
# Get the nuclides in this element
|
||||
nuclides = element[0].expand(element[1], element[2], element[3],
|
||||
cross_sections)
|
||||
|
||||
xml_elements = []
|
||||
for nuclide in nuclides:
|
||||
xml_elements.append(self._get_nuclide_xml(nuclide, distrib))
|
||||
|
||||
return xml_elements
|
||||
|
||||
def _get_nuclides_xml(self, nuclides, distrib=False):
|
||||
|
||||
xml_elements = []
|
||||
|
||||
for nuclide in nuclides:
|
||||
xml_elements.append(self._get_nuclide_xml(nuclide, distrib))
|
||||
|
||||
return xml_elements
|
||||
|
||||
def _get_elements_xml(self, elements, cross_sections, distrib=False):
|
||||
|
||||
xml_elements = []
|
||||
|
||||
for element in elements:
|
||||
nuclide_elements = self._get_element_xml(element, cross_sections,
|
||||
distrib)
|
||||
for nuclide_element in nuclide_elements:
|
||||
xml_elements.append(nuclide_element)
|
||||
|
||||
return xml_elements
|
||||
|
||||
def to_xml_element(self, cross_sections=None):
|
||||
|
|
@ -925,12 +797,6 @@ class Material(IDManagerMixin):
|
|||
subelements = self._get_nuclides_xml(self._nuclides)
|
||||
for subelement in subelements:
|
||||
element.append(subelement)
|
||||
|
||||
# Create element XML subelements
|
||||
subelements = self._get_elements_xml(self._elements,
|
||||
cross_sections)
|
||||
for subelement in subelements:
|
||||
element.append(subelement)
|
||||
else:
|
||||
# Create macroscopic XML subelements
|
||||
subelement = self._get_macroscopic_xml(self._macroscopic)
|
||||
|
|
@ -940,7 +806,7 @@ class Material(IDManagerMixin):
|
|||
subelement = ET.SubElement(element, "compositions")
|
||||
|
||||
comps = []
|
||||
allnucs = self._nuclides + self._elements
|
||||
allnucs = self._nuclides
|
||||
dist_per_type = allnucs[0][2]
|
||||
for nuc in allnucs:
|
||||
if nuc[2] != dist_per_type:
|
||||
|
|
@ -966,25 +832,22 @@ class Material(IDManagerMixin):
|
|||
distrib=True)
|
||||
for subelement_nuc in subelements:
|
||||
subelement.append(subelement_nuc)
|
||||
|
||||
# Create element XML subelements
|
||||
subelements = self._get_elements_xml(self._elements,
|
||||
cross_sections,
|
||||
distrib=True)
|
||||
for subsubelement in subelements:
|
||||
subelement.append(subsubelement)
|
||||
else:
|
||||
# Create macroscopic XML subelements
|
||||
subsubelement = self._get_macroscopic_xml(self._macroscopic)
|
||||
subelement.append(subsubelement)
|
||||
|
||||
if len(self._sab) > 0:
|
||||
if self._sab:
|
||||
for sab in self._sab:
|
||||
subelement = ET.SubElement(element, "sab")
|
||||
subelement.set("name", sab[0])
|
||||
if sab[1] != 1.0:
|
||||
subelement.set("fraction", str(sab[1]))
|
||||
|
||||
if self._isotropic:
|
||||
subelement = ET.SubElement(element, "isotropic")
|
||||
subelement.text = ' '.join(self._isotropic)
|
||||
|
||||
return element
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ import openmc
|
|||
from openmc.mixin import EqualityMixin, IDManagerMixin
|
||||
|
||||
|
||||
class Mesh(EqualityMixin, IDManagerMixin):
|
||||
class Mesh(IDManagerMixin):
|
||||
"""A structured Cartesian mesh in one, two, or three dimensions
|
||||
|
||||
Parameters
|
||||
|
|
@ -124,9 +124,6 @@ class Mesh(EqualityMixin, IDManagerMixin):
|
|||
cv.check_length('mesh width', width, 1, 3)
|
||||
self._width = width
|
||||
|
||||
def __hash__(self):
|
||||
return hash(repr(self))
|
||||
|
||||
def __repr__(self):
|
||||
string = 'Mesh\n'
|
||||
string += '{0: <16}{1}{2}\n'.format('\tID', '=\t', self._id)
|
||||
|
|
|
|||
|
|
@ -2755,7 +2755,6 @@ class TransportXS(MGXS):
|
|||
# Switch EnergyoutFilter to EnergyFilter.
|
||||
old_filt = self.tallies['scatter-1'].filters[-1]
|
||||
new_filt = openmc.EnergyFilter(old_filt.bins)
|
||||
new_filt.stride = old_filt.stride
|
||||
self.tallies['scatter-1'].filters[-1] = new_filt
|
||||
|
||||
self._rxn_rate_tally = \
|
||||
|
|
@ -2775,7 +2774,6 @@ class TransportXS(MGXS):
|
|||
# Switch EnergyoutFilter to EnergyFilter.
|
||||
old_filt = self.tallies['scatter-1'].filters[-1]
|
||||
new_filt = openmc.EnergyFilter(old_filt.bins)
|
||||
new_filt.stride = old_filt.stride
|
||||
self.tallies['scatter-1'].filters[-1] = new_filt
|
||||
|
||||
# Compute total cross section
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ from six import string_types
|
|||
import openmc.checkvalue as cv
|
||||
|
||||
|
||||
class Nuclide(object):
|
||||
class Nuclide(str):
|
||||
"""A nuclide that can be used in a material.
|
||||
|
||||
Parameters
|
||||
|
|
@ -17,77 +17,25 @@ class Nuclide(object):
|
|||
----------
|
||||
name : str
|
||||
Name of the nuclide, e.g. 'U235'
|
||||
scattering : 'data' or 'iso-in-lab' or None
|
||||
The type of angular scattering distribution to use
|
||||
|
||||
"""
|
||||
|
||||
def __init__(self, name=''):
|
||||
def __new__(cls, name):
|
||||
# Initialize class attributes
|
||||
self._name = ''
|
||||
self._scattering = None
|
||||
orig_name = name
|
||||
|
||||
# Set the Material class attributes
|
||||
self.name = name
|
||||
if '-' in name:
|
||||
name = name.replace('-', '')
|
||||
name = name.replace('Nat', '0')
|
||||
if name.endswith('m'):
|
||||
name = name[:-1] + '_m1'
|
||||
|
||||
def __eq__(self, other):
|
||||
if isinstance(other, Nuclide):
|
||||
if self.name != other.name:
|
||||
return False
|
||||
else:
|
||||
return True
|
||||
elif isinstance(other, string_types) and other == self.name:
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
msg = 'OpenMC nuclides follow the GND naming convention. Nuclide ' \
|
||||
'"{}" is being renamed as "{}".'.format(orig_name, name)
|
||||
warnings.warn(msg)
|
||||
|
||||
def __ne__(self, other):
|
||||
return not self == other
|
||||
|
||||
def __gt__(self, other):
|
||||
return repr(self) > repr(other)
|
||||
|
||||
def __lt__(self, other):
|
||||
return not self > other
|
||||
|
||||
def __hash__(self):
|
||||
return hash(repr(self))
|
||||
|
||||
def __repr__(self):
|
||||
string = 'Nuclide - {0}\n'.format(self._name)
|
||||
if self.scattering is not None:
|
||||
string += '{0: <16}{1}{2}\n'.format('\tscattering', '=\t',
|
||||
self.scattering)
|
||||
return string
|
||||
return super(Nuclide, cls).__new__(cls, name)
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
return self._name
|
||||
|
||||
@property
|
||||
def scattering(self):
|
||||
return self._scattering
|
||||
|
||||
@name.setter
|
||||
def name(self, name):
|
||||
cv.check_type('name', name, string_types)
|
||||
self._name = name
|
||||
|
||||
if '-' in name:
|
||||
self._name = name.replace('-', '')
|
||||
self._name = self._name.replace('Nat', '0')
|
||||
if self._name.endswith('m'):
|
||||
self._name = self._name[:-1] + '_m1'
|
||||
|
||||
msg = 'OpenMC nuclides follow the GND naming convention. Nuclide ' \
|
||||
'"{}" is being renamed as "{}".'.format(name, self._name)
|
||||
warnings.warn(msg)
|
||||
|
||||
@scattering.setter
|
||||
def scattering(self, scattering):
|
||||
if not scattering in ['data', 'iso-in-lab', None]:
|
||||
msg = 'Unable to set scattering for Nuclide to {0} which ' \
|
||||
'is not "data", "iso-in-lab", or None'.format(scattering)
|
||||
raise ValueError(msg)
|
||||
|
||||
self._scattering = scattering
|
||||
return self
|
||||
|
|
|
|||
|
|
@ -1,7 +1,9 @@
|
|||
from numbers import Integral, Real
|
||||
from six import string_types
|
||||
from itertools import chain
|
||||
import string
|
||||
|
||||
from six import string_types
|
||||
import matplotlib.pyplot as plt
|
||||
import numpy as np
|
||||
|
||||
import openmc.checkvalue as cv
|
||||
|
|
@ -63,15 +65,15 @@ _MIN_E = 1.e-5
|
|||
_MAX_E = 20.e6
|
||||
|
||||
|
||||
def plot_xs(this, types, divisor_types=None, temperature=294., axis=None,
|
||||
sab_name=None, ce_cross_sections=None, mg_cross_sections=None,
|
||||
enrichment=None, plot_CE=True, orders=None, divisor_orders=None,
|
||||
**kwargs):
|
||||
def plot_xs(this, types, divisor_types=None, temperature=294., data_type=None,
|
||||
axis=None, sab_name=None, ce_cross_sections=None,
|
||||
mg_cross_sections=None, enrichment=None, plot_CE=True, orders=None,
|
||||
divisor_orders=None, **kwargs):
|
||||
"""Creates a figure of continuous-energy cross sections for this item.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
this : openmc.Element, openmc.Nuclide, or openmc.Material
|
||||
this : str or openmc.Material
|
||||
Object to source data from
|
||||
types : Iterable of values of PLOT_TYPES
|
||||
The type of cross sections to include in the plot.
|
||||
|
|
@ -84,6 +86,9 @@ def plot_xs(this, types, divisor_types=None, temperature=294., axis=None,
|
|||
temperature of 294K will be plotted. Note that the nearest
|
||||
temperature in the library for each nuclide will be used as opposed
|
||||
to using any interpolation.
|
||||
data_type : {'nuclide', 'element', 'material', 'macroscopic'}, optional
|
||||
Type of object to plot. If not specified, a guess is made based on the
|
||||
`this` argument.
|
||||
axis : matplotlib.axes, optional
|
||||
A previously generated axis to use for plotting. If not specified,
|
||||
a new axis and figure will be generated.
|
||||
|
|
@ -121,25 +126,28 @@ def plot_xs(this, types, divisor_types=None, temperature=294., axis=None,
|
|||
generated.
|
||||
|
||||
"""
|
||||
|
||||
from matplotlib import pyplot as plt
|
||||
|
||||
cv.check_type("plot_CE", plot_CE, bool)
|
||||
|
||||
if isinstance(this, openmc.Nuclide):
|
||||
data_type = 'nuclide'
|
||||
elif isinstance(this, openmc.Element):
|
||||
data_type = 'element'
|
||||
elif isinstance(this, openmc.Material):
|
||||
data_type = 'material'
|
||||
elif isinstance(this, openmc.Macroscopic):
|
||||
data_type = 'macroscopic'
|
||||
else:
|
||||
raise TypeError("Invalid type for plotting")
|
||||
if data_type is None:
|
||||
if isinstance(this, openmc.Nuclide):
|
||||
data_type = 'nuclide'
|
||||
elif isinstance(this, openmc.Element):
|
||||
data_type = 'element'
|
||||
elif isinstance(this, openmc.Material):
|
||||
data_type = 'material'
|
||||
elif isinstance(this, openmc.Macroscopic):
|
||||
data_type = 'macroscopic'
|
||||
elif isinstance(this, string_types):
|
||||
if this[-1] in string.digits:
|
||||
data_type = 'nuclide'
|
||||
else:
|
||||
data_type = 'element'
|
||||
else:
|
||||
raise TypeError("Invalid type for plotting")
|
||||
|
||||
if plot_CE:
|
||||
# Calculate for the CE cross sections
|
||||
E, data = calculate_cexs(this, types, temperature, sab_name,
|
||||
E, data = calculate_cexs(this, data_type, types, temperature, sab_name,
|
||||
ce_cross_sections, enrichment)
|
||||
if divisor_types:
|
||||
cv.check_length('divisor types', divisor_types, len(types))
|
||||
|
|
@ -220,23 +228,25 @@ def plot_xs(this, types, divisor_types=None, temperature=294., axis=None,
|
|||
ylabel = 'Macroscopic Cross Section [1/cm]'
|
||||
ax.set_ylabel(ylabel)
|
||||
ax.legend(loc='best')
|
||||
if this.name is not None and this.name != '':
|
||||
if len(types) > 1:
|
||||
ax.set_title('Cross Sections for ' + this.name)
|
||||
else:
|
||||
ax.set_title('Cross Section for ' + this.name)
|
||||
name = this.name if data_type == 'material' else this
|
||||
if len(types) > 1:
|
||||
ax.set_title('Cross Sections for ' + name)
|
||||
else:
|
||||
ax.set_title('Cross Section for ' + name)
|
||||
|
||||
return fig
|
||||
|
||||
|
||||
def calculate_cexs(this, types, temperature=294., sab_name=None,
|
||||
def calculate_cexs(this, data_type, types, temperature=294., sab_name=None,
|
||||
cross_sections=None, enrichment=None):
|
||||
"""Calculates continuous-energy cross sections of a requested type.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
this : openmc.Element, openmc.Nuclide, or openmc.Material
|
||||
this : str or openmc.Material
|
||||
Object to source data from
|
||||
data_type : {'nuclide', 'element', material'}
|
||||
Type of object to plot
|
||||
types : Iterable of values of PLOT_TYPES
|
||||
The type of cross sections to calculate
|
||||
temperature : float, optional
|
||||
|
|
@ -269,7 +279,7 @@ def calculate_cexs(this, types, temperature=294., sab_name=None,
|
|||
if enrichment:
|
||||
cv.check_type('enrichment', enrichment, Real)
|
||||
|
||||
if isinstance(this, openmc.Nuclide):
|
||||
if data_type == 'nuclide':
|
||||
energy_grid, xs = _calculate_cexs_nuclide(this, types, temperature,
|
||||
sab_name, cross_sections)
|
||||
# Convert xs (Iterable of Callable) to a grid of cross section values
|
||||
|
|
@ -278,11 +288,11 @@ def calculate_cexs(this, types, temperature=294., sab_name=None,
|
|||
data = np.zeros((len(types), len(energy_grid)))
|
||||
for line in range(len(types)):
|
||||
data[line, :] = xs[line](energy_grid)
|
||||
elif isinstance(this, openmc.Element):
|
||||
elif data_type == 'element':
|
||||
energy_grid, data = _calculate_cexs_elem_mat(this, types, temperature,
|
||||
cross_sections, sab_name,
|
||||
enrichment)
|
||||
elif isinstance(this, openmc.Material):
|
||||
elif data_type == 'material':
|
||||
energy_grid, data = _calculate_cexs_elem_mat(this, types, temperature,
|
||||
cross_sections)
|
||||
else:
|
||||
|
|
@ -352,7 +362,7 @@ def _calculate_cexs_nuclide(this, types, temperature=294., sab_name=None,
|
|||
# Now we can create the data sets to be plotted
|
||||
energy_grid = []
|
||||
xs = []
|
||||
lib = library.get_by_material(this.name)
|
||||
lib = library.get_by_material(this)
|
||||
if lib is not None:
|
||||
nuc = openmc.data.IncidentNeutron.from_hdf5(lib['path'])
|
||||
# Obtain the nearest temperature
|
||||
|
|
@ -464,7 +474,7 @@ def _calculate_cexs_nuclide(this, types, temperature=294., sab_name=None,
|
|||
funcs.append(lambda x: 0.)
|
||||
xs.append(openmc.data.Combination(funcs, op))
|
||||
else:
|
||||
raise ValueError(this.name + " not in library")
|
||||
raise ValueError(this + " not in library")
|
||||
|
||||
return energy_grid, xs
|
||||
|
||||
|
|
@ -476,7 +486,7 @@ def _calculate_cexs_elem_mat(this, types, temperature=294.,
|
|||
|
||||
Parameters
|
||||
----------
|
||||
this : {openmc.Material, openmc.Element}
|
||||
this : openmc.Material or openmc.Element
|
||||
Object to source data from
|
||||
types : Iterable of values of PLOT_TYPES
|
||||
The type of cross sections to calculate
|
||||
|
|
@ -508,8 +518,10 @@ def _calculate_cexs_elem_mat(this, types, temperature=294.,
|
|||
T = this.temperature
|
||||
else:
|
||||
T = temperature
|
||||
data_type = 'material'
|
||||
else:
|
||||
T = temperature
|
||||
data_type = 'element'
|
||||
|
||||
# Load the library
|
||||
library = openmc.data.DataLibrary.from_xml(cross_sections)
|
||||
|
|
@ -518,23 +530,23 @@ def _calculate_cexs_elem_mat(this, types, temperature=294.,
|
|||
# Expand elements in to nuclides with atomic densities
|
||||
nuclides = this.get_nuclide_atom_densities()
|
||||
# For ease of processing split out the nuclide and its fraction
|
||||
nuc_fractions = {nuclide[1][0].name: nuclide[1][1]
|
||||
nuc_fractions = {nuclide[1][0]: nuclide[1][1]
|
||||
for nuclide in nuclides.items()}
|
||||
# Create a dict of [nuclide name] = nuclide object to carry forward
|
||||
# with a common nuclides format between openmc.Material and
|
||||
# openmc.Element objects
|
||||
nuclides = {nuclide[1][0].name: nuclide[1][0]
|
||||
nuclides = {nuclide[1][0]: nuclide[1][0]
|
||||
for nuclide in nuclides.items()}
|
||||
else:
|
||||
# Expand elements in to nuclides with atomic densities
|
||||
nuclides = this.expand(1., 'ao', enrichment=enrichment,
|
||||
cross_sections=cross_sections)
|
||||
# For ease of processing split out the nuclide and its fraction
|
||||
nuc_fractions = {nuclide[0].name: nuclide[1] for nuclide in nuclides}
|
||||
nuc_fractions = {nuclide[0]: nuclide[1] for nuclide in nuclides}
|
||||
# Create a dict of [nuclide name] = nuclide object to carry forward
|
||||
# with a common nuclides format between openmc.Material and
|
||||
# openmc.Element objects
|
||||
nuclides = {nuclide[0].name: nuclide[0] for nuclide in nuclides}
|
||||
nuclides = {nuclide[0]: nuclide[0] for nuclide in nuclides}
|
||||
|
||||
# Identify the nuclides which have S(a,b) data
|
||||
sabs = {}
|
||||
|
|
@ -559,7 +571,7 @@ def _calculate_cexs_elem_mat(this, types, temperature=294.,
|
|||
name = nuclide[0]
|
||||
nuc = nuclide[1]
|
||||
sab_tab = sabs[name]
|
||||
temp_E, temp_xs = calculate_cexs(nuc, types, T, sab_tab,
|
||||
temp_E, temp_xs = calculate_cexs(nuc, data_type, types, T, sab_tab,
|
||||
cross_sections)
|
||||
E.append(temp_E)
|
||||
# Since the energy grids are different, store the cross sections as
|
||||
|
|
@ -587,10 +599,10 @@ def _calculate_cexs_elem_mat(this, types, temperature=294.,
|
|||
return energy_grid, data
|
||||
|
||||
|
||||
def calculate_mgxs(this, types, orders=None, temperature=294.,
|
||||
def calculate_mgxs(this, data_type, types, orders=None, temperature=294.,
|
||||
cross_sections=None, ce_cross_sections=None,
|
||||
enrichment=None):
|
||||
"""Calculates continuous-energy cross sections of a requested type.
|
||||
"""Calculates multi-group cross sections of a requested type.
|
||||
|
||||
If the data for the nuclide or macroscopic object in the library is
|
||||
represented as angle-dependent data then this method will return the
|
||||
|
|
@ -598,8 +610,10 @@ def calculate_mgxs(this, types, orders=None, temperature=294.,
|
|||
|
||||
Parameters
|
||||
----------
|
||||
this : openmc.Element, openmc.Nuclide, openmc.Material, or openmc.Macroscopic
|
||||
this : str or openmc.Material
|
||||
Object to source data from
|
||||
data_type : {'nuclide', 'element', material', 'macroscopic'}
|
||||
Type of object to plot
|
||||
types : Iterable of values of PLOT_TYPES_MGXS
|
||||
The type of cross sections to calculate
|
||||
orders : Iterable of Integral, optional
|
||||
|
|
@ -639,10 +653,10 @@ def calculate_mgxs(this, types, orders=None, temperature=294.,
|
|||
cv.check_type("cross_sections", cross_sections, str)
|
||||
library = openmc.MGXSLibrary.from_hdf5(cross_sections)
|
||||
|
||||
if isinstance(this, (openmc.Nuclide, openmc.Macroscopic)):
|
||||
if data_type in ('nuclide', 'macroscopic'):
|
||||
mgxs = _calculate_mgxs_nuc_macro(this, types, library, orders,
|
||||
temperature)
|
||||
elif isinstance(this, (openmc.Element, openmc.Material)):
|
||||
elif data_type in ('element', 'material'):
|
||||
mgxs = _calculate_mgxs_elem_mat(this, types, library, orders,
|
||||
temperature, ce_cross_sections,
|
||||
enrichment)
|
||||
|
|
@ -713,7 +727,7 @@ def _calculate_mgxs_nuc_macro(this, types, library, orders=None,
|
|||
if orders[i]:
|
||||
cv.check_greater_than("order value", orders[i], 0, equality=True)
|
||||
|
||||
xsdata = library.get_by_name(this.name)
|
||||
xsdata = library.get_by_name(this)
|
||||
|
||||
if xsdata is not None:
|
||||
# Obtain the nearest temperature
|
||||
|
|
@ -799,7 +813,7 @@ def _calculate_mgxs_nuc_macro(this, types, library, orders=None,
|
|||
data[i, :] = temp_data[:, order]
|
||||
else:
|
||||
raise ValueError("{} not present in provided MGXS "
|
||||
"library".format(this.name))
|
||||
"library".format(this))
|
||||
|
||||
return data
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import numpy as np
|
|||
|
||||
from openmc.clean_xml import clean_xml_indentation
|
||||
import openmc.checkvalue as cv
|
||||
from openmc import Nuclide, VolumeCalculation, Source, Mesh
|
||||
from openmc import VolumeCalculation, Source, Mesh
|
||||
|
||||
_RUN_MODES = ['eigenvalue', 'fixed source', 'plot', 'volume', 'particle restart']
|
||||
_RES_SCAT_METHODS = ['dbrc', 'wcm', 'ares']
|
||||
|
|
|
|||
|
|
@ -415,9 +415,6 @@ class StatePoint(object):
|
|||
|
||||
tally.scores.append(score)
|
||||
|
||||
# Compute and set the filter strides
|
||||
tally._update_filter_strides()
|
||||
|
||||
# Add Tally to the global dictionary of all Tallies
|
||||
tally.sparse = self.sparse
|
||||
self._tallies[tally_id] = tally
|
||||
|
|
|
|||
|
|
@ -79,9 +79,6 @@ class Surface(IDManagerMixin):
|
|||
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)
|
||||
|
|
|
|||
|
|
@ -3,9 +3,10 @@ from __future__ import division
|
|||
from collections import Iterable, MutableSequence
|
||||
import copy
|
||||
import re
|
||||
from functools import partial
|
||||
from functools import partial, reduce
|
||||
from itertools import product
|
||||
from numbers import Integral, Real
|
||||
import operator
|
||||
import warnings
|
||||
from xml.etree import ElementTree as ET
|
||||
|
||||
|
|
@ -78,6 +79,8 @@ class Tally(IDManagerMixin):
|
|||
shape : 3-tuple of int
|
||||
The shape of the tally data array ordered as the number of filter bins,
|
||||
nuclide bins and score bins
|
||||
filter_strides : list of int
|
||||
Stride in memory for each filter
|
||||
num_realizations : int
|
||||
Total number of realizations
|
||||
with_summary : bool
|
||||
|
|
@ -129,49 +132,6 @@ class Tally(IDManagerMixin):
|
|||
self._sp_filename = None
|
||||
self._results_read = False
|
||||
|
||||
def __eq__(self, other):
|
||||
if not isinstance(other, Tally):
|
||||
return False
|
||||
|
||||
# Check all filters
|
||||
if len(self.filters) != len(other.filters):
|
||||
return False
|
||||
|
||||
for self_filter in self.filters:
|
||||
if self_filter not in other.filters:
|
||||
return False
|
||||
|
||||
# Check all nuclides
|
||||
if len(self.nuclides) != len(other.nuclides):
|
||||
return False
|
||||
|
||||
for nuclide in self.nuclides:
|
||||
if nuclide not in other.nuclides:
|
||||
return False
|
||||
|
||||
# Check derivatives
|
||||
if self.derivative != other.derivative:
|
||||
return False
|
||||
|
||||
# Check all scores
|
||||
if len(self.scores) != len(other.scores):
|
||||
return False
|
||||
|
||||
for score in self.scores:
|
||||
if score not in other.scores:
|
||||
return False
|
||||
|
||||
if self.estimator != other.estimator:
|
||||
return False
|
||||
|
||||
return True
|
||||
|
||||
def __ne__(self, other):
|
||||
return not self == other
|
||||
|
||||
def __hash__(self):
|
||||
return hash(repr(self))
|
||||
|
||||
def __repr__(self):
|
||||
string = 'Tally\n'
|
||||
string += '{: <16}=\t{}\n'.format('\tID', self.id)
|
||||
|
|
@ -187,10 +147,7 @@ class Tally(IDManagerMixin):
|
|||
string += '{: <16}=\t'.format('\tNuclides')
|
||||
|
||||
for nuclide in self.nuclides:
|
||||
if isinstance(nuclide, openmc.Nuclide):
|
||||
string += nuclide.name + ' '
|
||||
else:
|
||||
string += str(nuclide) + ' '
|
||||
string += str(nuclide) + ' '
|
||||
|
||||
string += '\n'
|
||||
|
||||
|
|
@ -229,19 +186,11 @@ class Tally(IDManagerMixin):
|
|||
|
||||
@property
|
||||
def num_filter_bins(self):
|
||||
num_bins = 1
|
||||
|
||||
for self_filter in self.filters:
|
||||
num_bins *= self_filter.num_bins
|
||||
|
||||
return num_bins
|
||||
return reduce(operator.mul, (f.num_bins for f in self.filters), 1)
|
||||
|
||||
@property
|
||||
def num_bins(self):
|
||||
num_bins = self.num_filter_bins
|
||||
num_bins *= self.num_nuclides
|
||||
num_bins *= self.num_scores
|
||||
return num_bins
|
||||
return self.num_filter_bins * self.num_nuclides * self.num_scores
|
||||
|
||||
@property
|
||||
def shape(self):
|
||||
|
|
@ -288,10 +237,10 @@ class Tally(IDManagerMixin):
|
|||
|
||||
# Convert NumPy arrays to SciPy sparse LIL matrices
|
||||
if self.sparse:
|
||||
self._sum = \
|
||||
sps.lil_matrix(self._sum.flatten(), self._sum.shape)
|
||||
self._sum_sq = \
|
||||
sps.lil_matrix(self._sum_sq.flatten(), self._sum_sq.shape)
|
||||
self._sum = sps.lil_matrix(self._sum.flatten(),
|
||||
self._sum.shape)
|
||||
self._sum_sq = sps.lil_matrix(self._sum_sq.flatten(),
|
||||
self._sum_sq.shape)
|
||||
|
||||
# Indicate that Tally results have been read
|
||||
self._results_read = True
|
||||
|
|
@ -864,10 +813,6 @@ class Tally(IDManagerMixin):
|
|||
# Differentiate Tally with a new auto-generated Tally ID
|
||||
merged_tally.id = None
|
||||
|
||||
# If the two tallies are equal, simply return copy
|
||||
if self == other:
|
||||
return merged_tally
|
||||
|
||||
# Create deep copy of other tally to use for array concatenation
|
||||
other_copy = copy.deepcopy(other)
|
||||
|
||||
|
|
@ -923,9 +868,6 @@ class Tally(IDManagerMixin):
|
|||
else:
|
||||
self._derived = True
|
||||
|
||||
# Update filter strides in merged tally
|
||||
merged_tally._update_filter_strides()
|
||||
|
||||
# Concatenate sum arrays if present in both tallies
|
||||
if self.sum is not None and other_copy.sum is not None:
|
||||
self_sum = self.get_reshaped_data(value='sum')
|
||||
|
|
@ -1055,16 +997,9 @@ class Tally(IDManagerMixin):
|
|||
subelement.text = ' '.join(str(f.id) for f in self.filters)
|
||||
|
||||
# Optional Nuclides
|
||||
if len(self.nuclides) > 0:
|
||||
nuclides = ''
|
||||
for nuclide in self.nuclides:
|
||||
if isinstance(nuclide, openmc.Nuclide):
|
||||
nuclides += '{0} '.format(nuclide.name)
|
||||
else:
|
||||
nuclides += '{0} '.format(nuclide)
|
||||
|
||||
if self.nuclides:
|
||||
subelement = ET.SubElement(element, "nuclides")
|
||||
subelement.text = nuclides.rstrip(' ')
|
||||
subelement.text = ' '.join(str(n) for n in self.nuclides)
|
||||
|
||||
# Scores
|
||||
if len(self.scores) == 0:
|
||||
|
|
@ -1591,11 +1526,10 @@ class Tally(IDManagerMixin):
|
|||
|
||||
# Build DataFrame columns for filters if user requested them
|
||||
if filters:
|
||||
|
||||
# Append each Filter's DataFrame to the overall DataFrame
|
||||
for self_filter in self.filters:
|
||||
filter_df = self_filter.get_pandas_dataframe(
|
||||
data_size, paths=paths)
|
||||
for f, stride in zip(self.filters, self.filter_strides):
|
||||
filter_df = f.get_pandas_dataframe(
|
||||
data_size, stride, paths=paths)
|
||||
df = pd.concat([df, filter_df], axis=1)
|
||||
|
||||
# Include DataFrame column for nuclides if user requested it
|
||||
|
|
@ -1920,20 +1854,16 @@ class Tally(IDManagerMixin):
|
|||
new_score = cross_score(self_score, other_score, binary_op)
|
||||
new_tally.scores.append(new_score)
|
||||
|
||||
# Update the new tally's filter strides
|
||||
new_tally._update_filter_strides()
|
||||
|
||||
return new_tally
|
||||
|
||||
def _update_filter_strides(self):
|
||||
"""Update each filter's stride based on the tally's nuclides and scores
|
||||
for derived tallies created by tally arithmetic.
|
||||
"""
|
||||
|
||||
@property
|
||||
def filter_strides(self):
|
||||
all_strides = []
|
||||
stride = self.num_nuclides * self.num_scores
|
||||
for self_filter in reversed(self.filters):
|
||||
self_filter.stride = stride
|
||||
all_strides.append(stride)
|
||||
stride *= self_filter.num_bins
|
||||
return all_strides[::-1]
|
||||
|
||||
def _align_tally_data(self, other, filter_product, nuclide_product,
|
||||
score_product):
|
||||
|
|
@ -1971,10 +1901,8 @@ class Tally(IDManagerMixin):
|
|||
"""
|
||||
|
||||
# Get the set of filters that each tally is missing
|
||||
other_missing_filters = \
|
||||
set(self.filters).difference(set(other.filters))
|
||||
self_missing_filters = \
|
||||
set(other.filters).difference(set(self.filters))
|
||||
other_missing_filters = set(self.filters) - set(other.filters)
|
||||
self_missing_filters = set(other.filters) - set(self.filters)
|
||||
|
||||
# Add filters present in self but not in other to other
|
||||
for other_filter in other_missing_filters:
|
||||
|
|
@ -2001,14 +1929,10 @@ class Tally(IDManagerMixin):
|
|||
# Repeat and tile the data by nuclide in preparation for performing
|
||||
# the tensor product across nuclides.
|
||||
if nuclide_product == 'tensor':
|
||||
self._mean = \
|
||||
np.repeat(self.mean, other.num_nuclides, axis=1)
|
||||
self._std_dev = \
|
||||
np.repeat(self.std_dev, other.num_nuclides, axis=1)
|
||||
other._mean = \
|
||||
np.tile(other.mean, (1, self.num_nuclides, 1))
|
||||
other._std_dev = \
|
||||
np.tile(other.std_dev, (1, self.num_nuclides, 1))
|
||||
self._mean = np.repeat(self.mean, other.num_nuclides, axis=1)
|
||||
self._std_dev = np.repeat(self.std_dev, other.num_nuclides, axis=1)
|
||||
other._mean = np.tile(other.mean, (1, self.num_nuclides, 1))
|
||||
other._std_dev = np.tile(other.std_dev, (1, self.num_nuclides, 1))
|
||||
|
||||
# Add nuclides to each tally such that each tally contains the complete
|
||||
# set of nuclides necessary to perform an entrywise product. New
|
||||
|
|
@ -2016,25 +1940,21 @@ class Tally(IDManagerMixin):
|
|||
else:
|
||||
|
||||
# Get the set of nuclides that each tally is missing
|
||||
other_missing_nuclides = \
|
||||
set(self.nuclides).difference(set(other.nuclides))
|
||||
self_missing_nuclides = \
|
||||
set(other.nuclides).difference(set(self.nuclides))
|
||||
other_missing_nuclides = set(self.nuclides) - set(other.nuclides)
|
||||
self_missing_nuclides = set(other.nuclides) - set(self.nuclides)
|
||||
|
||||
# Add nuclides present in self but not in other to other
|
||||
for nuclide in other_missing_nuclides:
|
||||
other._mean = \
|
||||
np.insert(other.mean, other.num_nuclides, 0, axis=1)
|
||||
other._std_dev = \
|
||||
np.insert(other.std_dev, other.num_nuclides, 0, axis=1)
|
||||
other._mean = np.insert(other.mean, other.num_nuclides, 0, axis=1)
|
||||
other._std_dev = np.insert(other.std_dev, other.num_nuclides, 0,
|
||||
axis=1)
|
||||
other.nuclides.append(nuclide)
|
||||
|
||||
# Add nuclides present in other but not in self to self
|
||||
for nuclide in self_missing_nuclides:
|
||||
self._mean = \
|
||||
np.insert(self.mean, self.num_nuclides, 0, axis=1)
|
||||
self._std_dev = \
|
||||
np.insert(self.std_dev, self.num_nuclides, 0, axis=1)
|
||||
self._mean = np.insert(self.mean, self.num_nuclides, 0, axis=1)
|
||||
self._std_dev = np.insert(self.std_dev, self.num_nuclides, 0,
|
||||
axis=1)
|
||||
self.nuclides.append(nuclide)
|
||||
|
||||
# Align other nuclides with self nuclides
|
||||
|
|
@ -2059,10 +1979,8 @@ class Tally(IDManagerMixin):
|
|||
else:
|
||||
|
||||
# Get the set of scores that each tally is missing
|
||||
other_missing_scores = \
|
||||
set(self.scores).difference(set(other.scores))
|
||||
self_missing_scores = \
|
||||
set(other.scores).difference(set(self.scores))
|
||||
other_missing_scores = set(self.scores) - set(other.scores)
|
||||
self_missing_scores = set(other.scores) - set(self.scores)
|
||||
|
||||
# Add scores present in self but not in other to other
|
||||
for score in other_missing_scores:
|
||||
|
|
@ -2084,10 +2002,6 @@ class Tally(IDManagerMixin):
|
|||
if other_index != i:
|
||||
other._swap_scores(score, other.scores[i])
|
||||
|
||||
# Update the tallies' filter strides
|
||||
other._update_filter_strides()
|
||||
self._update_filter_strides()
|
||||
|
||||
data = {}
|
||||
data['self'] = {}
|
||||
data['other'] = {}
|
||||
|
|
@ -2172,9 +2086,6 @@ class Tally(IDManagerMixin):
|
|||
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(product(filter1_bins, filter2_bins)):
|
||||
filter_bins = [(bin1,), (bin2,)]
|
||||
|
|
@ -2906,28 +2817,33 @@ class Tally(IDManagerMixin):
|
|||
|
||||
# Remove and/or reorder filter bins to user specifications
|
||||
bin_indices = []
|
||||
num_bins = 0
|
||||
|
||||
for filter_bin in filter_bins[i]:
|
||||
bin_index = find_filter.get_bin_index(filter_bin)
|
||||
if filter_type in [openmc.EnergyFilter,
|
||||
openmc.EnergyoutFilter]:
|
||||
bin_indices.extend([bin_index])
|
||||
if issubclass(filter_type, openmc.RealFilter):
|
||||
bin_indices.extend([bin_index, bin_index+1])
|
||||
num_bins += 1
|
||||
elif filter_type in [openmc.DistribcellFilter,
|
||||
openmc.MeshFilter]:
|
||||
bin_indices = [0]
|
||||
num_bins = find_filter.num_bins
|
||||
else:
|
||||
bin_indices.append(bin_index)
|
||||
num_bins += 1
|
||||
|
||||
find_filter.bins = np.unique(find_filter.bins[bin_indices])
|
||||
find_filter.num_bins = num_bins
|
||||
# Set bins for mesh/distribcell filters apart from others
|
||||
if filter_type is openmc.MeshFilter:
|
||||
bins = find_filter.mesh
|
||||
elif filter_type is openmc.DistribcellFilter:
|
||||
bins = find_filter.bins
|
||||
else:
|
||||
bins = np.unique(find_filter.bins[bin_indices])
|
||||
|
||||
# Update the new tally's filter strides
|
||||
new_tally._update_filter_strides()
|
||||
# Create new filter
|
||||
new_filter = filter_type(bins)
|
||||
|
||||
# Set number of bins manually for mesh/distribcell filters
|
||||
if filter_type in (openmc.DistribcellFilter, openmc.MeshFilter):
|
||||
new_filter._num_bins = find_filter._num_bins
|
||||
|
||||
# Replace existing filter with new one
|
||||
for j, test_filter in enumerate(new_tally.filters):
|
||||
if isinstance(test_filter, filter_type):
|
||||
new_tally.filters[j] = new_filter
|
||||
|
||||
# If original tally was sparse, sparsify the sliced tally
|
||||
new_tally.sparse = self.sparse
|
||||
|
|
@ -3075,9 +2991,6 @@ class Tally(IDManagerMixin):
|
|||
else:
|
||||
tally_sum._scores = copy.deepcopy(self.scores)
|
||||
|
||||
# Update the tally sum's filter strides
|
||||
tally_sum._update_filter_strides()
|
||||
|
||||
# Reshape condensed data arrays with one dimension for all filters
|
||||
mean = np.reshape(mean, tally_sum.shape)
|
||||
std_dev = np.reshape(std_dev, tally_sum.shape)
|
||||
|
|
@ -3235,9 +3148,6 @@ class Tally(IDManagerMixin):
|
|||
else:
|
||||
tally_avg._scores = copy.deepcopy(self.scores)
|
||||
|
||||
# Update the tally avg's filter strides
|
||||
tally_avg._update_filter_strides()
|
||||
|
||||
# Reshape condensed data arrays with one dimension for all filters
|
||||
mean = np.reshape(mean, tally_avg.shape)
|
||||
std_dev = np.reshape(std_dev, tally_avg.shape)
|
||||
|
|
@ -3311,9 +3221,6 @@ class Tally(IDManagerMixin):
|
|||
new_tally._std_dev = np.zeros(new_tally.shape, dtype=np.float64)
|
||||
new_tally._std_dev[diag_indices, :, :] = self.std_dev
|
||||
|
||||
# Update the new tally's filter strides
|
||||
new_tally._update_filter_strides()
|
||||
|
||||
# If original tally was sparse, sparsify the diagonalized tally
|
||||
new_tally.sparse = self.sparse
|
||||
return new_tally
|
||||
|
|
@ -3502,12 +3409,12 @@ class Tallies(cv.CheckedList):
|
|||
for tally in self:
|
||||
for f in tally.filters:
|
||||
if isinstance(f, openmc.MeshFilter):
|
||||
if f.mesh not in already_written:
|
||||
if f.mesh.id not in already_written:
|
||||
if len(f.mesh.name) > 0:
|
||||
root_element.append(ET.Comment(f.mesh.name))
|
||||
|
||||
root_element.append(f.mesh.to_xml_element())
|
||||
already_written.add(f.mesh)
|
||||
already_written.add(f.mesh.id)
|
||||
|
||||
def _create_filter_subelements(self, root_element):
|
||||
already_written = dict()
|
||||
|
|
|
|||
|
|
@ -51,9 +51,6 @@ class TallyDerivative(EqualityMixin, IDManagerMixin):
|
|||
self.material = material
|
||||
self.nuclide = nuclide
|
||||
|
||||
def __hash__(self):
|
||||
return hash(repr(self))
|
||||
|
||||
def __repr__(self):
|
||||
string = 'Tally Derivative\n'
|
||||
string += '{: <16}=\t{}\n'.format('\tID', self.id)
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import random
|
|||
import sys
|
||||
|
||||
from six import string_types
|
||||
import matplotlib.pyplot as plt
|
||||
import numpy as np
|
||||
|
||||
import openmc
|
||||
|
|
@ -63,24 +64,6 @@ class Universe(IDManagerMixin):
|
|||
if cells is not None:
|
||||
self.add_cells(cells)
|
||||
|
||||
def __eq__(self, other):
|
||||
if not isinstance(other, Universe):
|
||||
return False
|
||||
elif self.id != other.id:
|
||||
return False
|
||||
elif self.name != other.name:
|
||||
return False
|
||||
elif dict.__ne__(self.cells, other.cells):
|
||||
return False
|
||||
else:
|
||||
return True
|
||||
|
||||
def __ne__(self, other):
|
||||
return not self == other
|
||||
|
||||
def __hash__(self):
|
||||
return hash(repr(self))
|
||||
|
||||
def __repr__(self):
|
||||
string = 'Universe\n'
|
||||
string += '{0: <16}{1}{2}\n'.format('\tID', '=\t', self._id)
|
||||
|
|
@ -243,8 +226,6 @@ class Universe(IDManagerMixin):
|
|||
:func:`matplotlib.pyplot.imshow`.
|
||||
|
||||
"""
|
||||
import matplotlib.pyplot as plt
|
||||
|
||||
# Seed the random number generator
|
||||
if seed is not None:
|
||||
random.seed(seed)
|
||||
|
|
|
|||
|
|
@ -2025,6 +2025,7 @@ contains
|
|||
|
||||
integer :: i ! loop index for materials
|
||||
integer :: j ! loop index for nuclides
|
||||
integer :: k ! loop index
|
||||
integer :: n ! number of nuclides
|
||||
integer :: n_sab ! number of sab tables for a material
|
||||
integer :: i_library ! index in libraries array
|
||||
|
|
@ -2035,11 +2036,12 @@ contains
|
|||
character(MAX_WORD_LEN) :: units ! units on density
|
||||
character(MAX_LINE_LEN) :: filename ! absolute path to materials.xml
|
||||
character(MAX_LINE_LEN) :: temp_str ! temporary string when reading
|
||||
character(MAX_WORD_LEN), allocatable :: sarray(:)
|
||||
real(8) :: val ! value entered for density
|
||||
real(8) :: temp_dble ! temporary double prec. real
|
||||
logical :: sum_density ! density is sum of nuclide densities
|
||||
type(VectorChar) :: names ! temporary list of nuclide names
|
||||
type(VectorInt) :: list_iso_lab ! temporary list of isotropic lab scatterers
|
||||
type(VectorChar) :: list_iso_lab ! temporary list of isotropic lab scatterers
|
||||
type(VectorReal) :: densities ! temporary list of nuclide densities
|
||||
type(Material), pointer :: mat => null()
|
||||
type(XMLDocument) :: doc
|
||||
|
|
@ -2246,23 +2248,6 @@ contains
|
|||
// trim(to_str(mat % id)))
|
||||
end if
|
||||
|
||||
! Check enforced isotropic lab scattering
|
||||
if (run_CE) then
|
||||
if (check_for_node(node_nuc, "scattering")) then
|
||||
call get_node_value(node_nuc, "scattering", temp_str)
|
||||
if (adjustl(to_lower(temp_str)) == "iso-in-lab") then
|
||||
call list_iso_lab % push_back(1)
|
||||
else if (adjustl(to_lower(temp_str)) == "data") then
|
||||
call list_iso_lab % push_back(0)
|
||||
else
|
||||
call fatal_error("Scattering must be isotropic in lab or follow&
|
||||
& the ACE file data")
|
||||
end if
|
||||
else
|
||||
call list_iso_lab % push_back(0)
|
||||
end if
|
||||
end if
|
||||
|
||||
! store nuclide name
|
||||
call get_node_value(node_nuc, "name", name)
|
||||
name = trim(name)
|
||||
|
|
@ -2297,6 +2282,19 @@ contains
|
|||
end do INDIVIDUAL_NUCLIDES
|
||||
end if
|
||||
|
||||
! =======================================================================
|
||||
! READ AND PARSE <isotropic> element
|
||||
|
||||
if (check_for_node(node_mat, "isotropic")) then
|
||||
n = node_word_count(node_mat, "isotropic")
|
||||
allocate(sarray(n))
|
||||
call get_node_array(node_mat, "isotropic", sarray)
|
||||
do j = 1, n
|
||||
call list_iso_lab % push_back(sarray(j))
|
||||
end do
|
||||
deallocate(sarray)
|
||||
end if
|
||||
|
||||
! ========================================================================
|
||||
! COPY NUCLIDES TO ARRAYS IN MATERIAL
|
||||
|
||||
|
|
@ -2306,7 +2304,6 @@ contains
|
|||
allocate(mat % names(n))
|
||||
allocate(mat % nuclide(n))
|
||||
allocate(mat % atom_density(n))
|
||||
allocate(mat % p0(n))
|
||||
|
||||
ALL_NUCLIDES: do j = 1, mat % n_nuclides
|
||||
! Check that this nuclide is listed in the cross_sections.xml file
|
||||
|
|
@ -2340,17 +2337,26 @@ contains
|
|||
mat % names(j) = name
|
||||
mat % atom_density(j) = densities % data(j)
|
||||
|
||||
! Cast integer isotropic lab scattering flag to boolean
|
||||
if (run_CE) then
|
||||
if (list_iso_lab % data(j) == 1) then
|
||||
mat % p0(j) = .true.
|
||||
else
|
||||
mat % p0(j) = .false.
|
||||
end if
|
||||
end if
|
||||
|
||||
end do ALL_NUCLIDES
|
||||
|
||||
if (run_CE) then
|
||||
! By default, isotropic-in-lab is not used
|
||||
if (list_iso_lab % size() > 0) then
|
||||
mat % has_isotropic_nuclides = .true.
|
||||
allocate(mat % p0(n))
|
||||
mat % p0(:) = .false.
|
||||
|
||||
! Apply isotropic-in-lab treatment to specified nuclides
|
||||
do j = 1, list_iso_lab % size()
|
||||
do k = 1, n
|
||||
if (names % data(k) == list_iso_lab % data(j)) then
|
||||
mat % p0(k) = .true.
|
||||
end if
|
||||
end do
|
||||
end do
|
||||
end if
|
||||
end if
|
||||
|
||||
! Check to make sure either all atom percents or all weight percents are
|
||||
! given
|
||||
if (.not. (all(mat % atom_density >= ZERO) .or. &
|
||||
|
|
|
|||
|
|
@ -57,7 +57,8 @@ module material_header
|
|||
logical :: fissionable = .false.
|
||||
logical :: depletable = .false.
|
||||
|
||||
! enforce isotropic scattering in lab
|
||||
! enforce isotropic scattering in lab for specific nuclides
|
||||
logical :: has_isotropic_nuclides = .false.
|
||||
logical, allocatable :: p0(:)
|
||||
|
||||
contains
|
||||
|
|
@ -302,7 +303,6 @@ contains
|
|||
real(8) :: awr
|
||||
integer, allocatable :: new_nuclide(:)
|
||||
real(8), allocatable :: new_density(:)
|
||||
logical, allocatable :: new_p0(:)
|
||||
character(:), allocatable :: name_
|
||||
|
||||
name_ = to_f_string(name)
|
||||
|
|
@ -339,11 +339,6 @@ contains
|
|||
if (n > 0) new_density(1:n) = m % atom_density
|
||||
call move_alloc(FROM=new_density, TO=m % atom_density)
|
||||
|
||||
allocate(new_p0(n + 1))
|
||||
if (n > 0) new_p0(1:n) = m % p0
|
||||
new_p0(n + 1) = .false.
|
||||
call move_alloc(FROM=new_p0, TO=m % p0)
|
||||
|
||||
! Append new nuclide/density
|
||||
k = nuclide_dict % get(to_lower(name_))
|
||||
m % nuclide(n + 1) = k
|
||||
|
|
@ -460,8 +455,8 @@ contains
|
|||
associate (m => materials(index))
|
||||
! If nuclide/density arrays are not correct size, reallocate
|
||||
if (n /= m % n_nuclides) then
|
||||
deallocate(m % nuclide, m % atom_density, m % p0, STAT=stat)
|
||||
allocate(m % nuclide(n), m % atom_density(n), m % p0(n))
|
||||
deallocate(m % nuclide, m % atom_density, STAT=stat)
|
||||
allocate(m % nuclide(n), m % atom_density(n))
|
||||
end if
|
||||
|
||||
do i = 1, n
|
||||
|
|
@ -479,9 +474,6 @@ contains
|
|||
end do
|
||||
m % n_nuclides = n
|
||||
|
||||
! Set isotropic flags to flags
|
||||
m % p0(:) = .false.
|
||||
|
||||
! Set total density to the sum of the vector
|
||||
err = m % set_density(sum(density))
|
||||
|
||||
|
|
|
|||
|
|
@ -419,19 +419,22 @@ contains
|
|||
! Set event component
|
||||
p % event = EVENT_SCATTER
|
||||
|
||||
! Sample new outgoing angle for isotropic in lab scattering
|
||||
if (materials(p % material) % p0(i_nuc_mat)) then
|
||||
! Sample new outgoing angle for isotropic-in-lab scattering
|
||||
associate (mat => materials(p % material))
|
||||
if (mat % has_isotropic_nuclides) then
|
||||
if (materials(p % material) % p0(i_nuc_mat)) then
|
||||
! Sample isotropic-in-lab outgoing direction
|
||||
uvw_new(1) = TWO * prn() - ONE
|
||||
phi = TWO * PI * prn()
|
||||
uvw_new(2) = cos(phi) * sqrt(ONE - uvw_new(1)*uvw_new(1))
|
||||
uvw_new(3) = sin(phi) * sqrt(ONE - uvw_new(1)*uvw_new(1))
|
||||
p % mu = dot_product(uvw_old, uvw_new)
|
||||
|
||||
! Sample isotropic-in-lab outgoing direction
|
||||
uvw_new(1) = TWO * prn() - ONE
|
||||
phi = TWO * PI * prn()
|
||||
uvw_new(2) = cos(phi) * sqrt(ONE - uvw_new(1)*uvw_new(1))
|
||||
uvw_new(3) = sin(phi) * sqrt(ONE - uvw_new(1)*uvw_new(1))
|
||||
p % mu = dot_product(uvw_old, uvw_new)
|
||||
|
||||
! Change direction of particle
|
||||
p % coord(1) % uvw = uvw_new
|
||||
end if
|
||||
! Change direction of particle
|
||||
p % coord(1) % uvw = uvw_new
|
||||
end if
|
||||
end if
|
||||
end associate
|
||||
|
||||
end subroutine scatter
|
||||
|
||||
|
|
|
|||
|
|
@ -14,14 +14,14 @@ element materials {
|
|||
|
||||
element nuclide {
|
||||
(element name { xsd:string } | attribute name { xsd:string }) &
|
||||
(element scattering { ( "data" | "iso-in-lab" ) } |
|
||||
attribute scattering { ( "data" | "iso-in-lab" ) })? &
|
||||
(
|
||||
(element ao { xsd:double } | attribute ao { xsd:double }) |
|
||||
(element wo { xsd:double } | attribute wo { xsd:double })
|
||||
)
|
||||
}* &
|
||||
|
||||
element isotropic { xsd:string }? &
|
||||
|
||||
element macroscopic {
|
||||
(element name { xsd:string } |
|
||||
attribute name { xsd:string })
|
||||
|
|
|
|||
|
|
@ -68,22 +68,6 @@
|
|||
<data type="string"/>
|
||||
</attribute>
|
||||
</choice>
|
||||
<optional>
|
||||
<choice>
|
||||
<element name="scattering">
|
||||
<choice>
|
||||
<value>data</value>
|
||||
<value>iso-in-lab</value>
|
||||
</choice>
|
||||
</element>
|
||||
<attribute name="scattering">
|
||||
<choice>
|
||||
<value>data</value>
|
||||
<value>iso-in-lab</value>
|
||||
</choice>
|
||||
</attribute>
|
||||
</choice>
|
||||
</optional>
|
||||
<choice>
|
||||
<choice>
|
||||
<element name="ao">
|
||||
|
|
@ -105,6 +89,11 @@
|
|||
</interleave>
|
||||
</element>
|
||||
</zeroOrMore>
|
||||
<optional>
|
||||
<element name="isotropic">
|
||||
<data type="string"/>
|
||||
</element>
|
||||
</optional>
|
||||
<zeroOrMore>
|
||||
<element name="macroscopic">
|
||||
<choice>
|
||||
|
|
|
|||
|
|
@ -150,149 +150,161 @@
|
|||
<materials>
|
||||
<material id="1" name="UOX fuel">
|
||||
<density units="g/cm3" value="10.062" />
|
||||
<nuclide ao="4.9476e-06" name="U234" scattering="iso-in-lab" />
|
||||
<nuclide ao="0.00048218" name="U235" scattering="iso-in-lab" />
|
||||
<nuclide ao="0.021504" name="U238" scattering="iso-in-lab" />
|
||||
<nuclide ao="1.0801e-08" name="Xe135" scattering="iso-in-lab" />
|
||||
<nuclide ao="0.045737" name="O16" scattering="iso-in-lab" />
|
||||
<nuclide ao="4.9476e-06" name="U234" />
|
||||
<nuclide ao="0.00048218" name="U235" />
|
||||
<nuclide ao="0.021504" name="U238" />
|
||||
<nuclide ao="1.0801e-08" name="Xe135" />
|
||||
<nuclide ao="0.045737" name="O16" />
|
||||
<isotropic>U234 U235 U238 Xe135 O16</isotropic>
|
||||
</material>
|
||||
<material id="2" name="Zircaloy">
|
||||
<density units="g/cm3" value="5.77" />
|
||||
<nuclide ao="0.5145" name="Zr90" scattering="iso-in-lab" />
|
||||
<nuclide ao="0.1122" name="Zr91" scattering="iso-in-lab" />
|
||||
<nuclide ao="0.1715" name="Zr92" scattering="iso-in-lab" />
|
||||
<nuclide ao="0.1738" name="Zr94" scattering="iso-in-lab" />
|
||||
<nuclide ao="0.028" name="Zr96" scattering="iso-in-lab" />
|
||||
<nuclide ao="0.5145" name="Zr90" />
|
||||
<nuclide ao="0.1122" name="Zr91" />
|
||||
<nuclide ao="0.1715" name="Zr92" />
|
||||
<nuclide ao="0.1738" name="Zr94" />
|
||||
<nuclide ao="0.028" name="Zr96" />
|
||||
<isotropic>Zr90 Zr91 Zr92 Zr94 Zr96</isotropic>
|
||||
</material>
|
||||
<material id="3" name="Cold borated water">
|
||||
<density units="atom/b-cm" value="0.07416" />
|
||||
<nuclide ao="2.0" name="H1" scattering="iso-in-lab" />
|
||||
<nuclide ao="1.0" name="O16" scattering="iso-in-lab" />
|
||||
<nuclide ao="0.000649" name="B10" scattering="iso-in-lab" />
|
||||
<nuclide ao="0.002689" name="B11" scattering="iso-in-lab" />
|
||||
<nuclide ao="2.0" name="H1" />
|
||||
<nuclide ao="1.0" name="O16" />
|
||||
<nuclide ao="0.000649" name="B10" />
|
||||
<nuclide ao="0.002689" name="B11" />
|
||||
<sab name="c_H_in_H2O" />
|
||||
<isotropic>H1 O16 B10 B11</isotropic>
|
||||
</material>
|
||||
<material id="4" name="Hot borated water">
|
||||
<density units="atom/b-cm" value="0.06614" />
|
||||
<nuclide ao="2.0" name="H1" scattering="iso-in-lab" />
|
||||
<nuclide ao="1.0" name="O16" scattering="iso-in-lab" />
|
||||
<nuclide ao="0.000649" name="B10" scattering="iso-in-lab" />
|
||||
<nuclide ao="0.002689" name="B11" scattering="iso-in-lab" />
|
||||
<nuclide ao="2.0" name="H1" />
|
||||
<nuclide ao="1.0" name="O16" />
|
||||
<nuclide ao="0.000649" name="B10" />
|
||||
<nuclide ao="0.002689" name="B11" />
|
||||
<sab name="c_H_in_H2O" />
|
||||
<isotropic>H1 O16 B10 B11</isotropic>
|
||||
</material>
|
||||
<material id="5" name="Reactor pressure vessel steel">
|
||||
<density units="g/cm3" value="7.9" />
|
||||
<nuclide name="Fe54" scattering="iso-in-lab" wo="0.05437098" />
|
||||
<nuclide name="Fe56" scattering="iso-in-lab" wo="0.88500663" />
|
||||
<nuclide name="Fe57" scattering="iso-in-lab" wo="0.0208008" />
|
||||
<nuclide name="Fe58" scattering="iso-in-lab" wo="0.00282159" />
|
||||
<nuclide name="Ni58" scattering="iso-in-lab" wo="0.0067198" />
|
||||
<nuclide name="Ni60" scattering="iso-in-lab" wo="0.0026776" />
|
||||
<nuclide name="Mn55" scattering="iso-in-lab" wo="0.01" />
|
||||
<nuclide name="Cr52" scattering="iso-in-lab" wo="0.002092475" />
|
||||
<nuclide name="C0" scattering="iso-in-lab" wo="0.0025" />
|
||||
<nuclide name="Cu63" scattering="iso-in-lab" wo="0.0013696" />
|
||||
<nuclide name="Fe54" wo="0.05437098" />
|
||||
<nuclide name="Fe56" wo="0.88500663" />
|
||||
<nuclide name="Fe57" wo="0.0208008" />
|
||||
<nuclide name="Fe58" wo="0.00282159" />
|
||||
<nuclide name="Ni58" wo="0.0067198" />
|
||||
<nuclide name="Ni60" wo="0.0026776" />
|
||||
<nuclide name="Mn55" wo="0.01" />
|
||||
<nuclide name="Cr52" wo="0.002092475" />
|
||||
<nuclide name="C0" wo="0.0025" />
|
||||
<nuclide name="Cu63" wo="0.0013696" />
|
||||
<isotropic>Fe54 Fe56 Fe57 Fe58 Ni58 Ni60 Mn55 Cr52 C0 Cu63</isotropic>
|
||||
</material>
|
||||
<material id="6" name="Lower radial reflector">
|
||||
<density units="g/cm3" value="4.32" />
|
||||
<nuclide name="H1" scattering="iso-in-lab" wo="0.0095661" />
|
||||
<nuclide name="O16" scattering="iso-in-lab" wo="0.0759107" />
|
||||
<nuclide name="B10" scattering="iso-in-lab" wo="3.08409e-05" />
|
||||
<nuclide name="B11" scattering="iso-in-lab" wo="0.000140499" />
|
||||
<nuclide name="Fe54" scattering="iso-in-lab" wo="0.035620772088" />
|
||||
<nuclide name="Fe56" scattering="iso-in-lab" wo="0.579805982228" />
|
||||
<nuclide name="Fe57" scattering="iso-in-lab" wo="0.01362750048" />
|
||||
<nuclide name="Fe58" scattering="iso-in-lab" wo="0.001848545204" />
|
||||
<nuclide name="Ni58" scattering="iso-in-lab" wo="0.055298376566" />
|
||||
<nuclide name="Mn55" scattering="iso-in-lab" wo="0.018287" />
|
||||
<nuclide name="Cr52" scattering="iso-in-lab" wo="0.145407678031" />
|
||||
<nuclide name="H1" wo="0.0095661" />
|
||||
<nuclide name="O16" wo="0.0759107" />
|
||||
<nuclide name="B10" wo="3.08409e-05" />
|
||||
<nuclide name="B11" wo="0.000140499" />
|
||||
<nuclide name="Fe54" wo="0.035620772088" />
|
||||
<nuclide name="Fe56" wo="0.579805982228" />
|
||||
<nuclide name="Fe57" wo="0.01362750048" />
|
||||
<nuclide name="Fe58" wo="0.001848545204" />
|
||||
<nuclide name="Ni58" wo="0.055298376566" />
|
||||
<nuclide name="Mn55" wo="0.018287" />
|
||||
<nuclide name="Cr52" wo="0.145407678031" />
|
||||
<sab name="c_H_in_H2O" />
|
||||
<isotropic>H1 O16 B10 B11 Fe54 Fe56 Fe57 Fe58 Ni58 Mn55 Cr52</isotropic>
|
||||
</material>
|
||||
<material id="7" name="Upper radial reflector / Top plate region">
|
||||
<density units="g/cm3" value="4.28" />
|
||||
<nuclide name="H1" scattering="iso-in-lab" wo="0.0086117" />
|
||||
<nuclide name="O16" scattering="iso-in-lab" wo="0.0683369" />
|
||||
<nuclide name="B10" scattering="iso-in-lab" wo="2.77638e-05" />
|
||||
<nuclide name="B11" scattering="iso-in-lab" wo="0.000126481" />
|
||||
<nuclide name="Fe54" scattering="iso-in-lab" wo="0.035953677186" />
|
||||
<nuclide name="Fe56" scattering="iso-in-lab" wo="0.585224740891" />
|
||||
<nuclide name="Fe57" scattering="iso-in-lab" wo="0.01375486056" />
|
||||
<nuclide name="Fe58" scattering="iso-in-lab" wo="0.001865821363" />
|
||||
<nuclide name="Ni58" scattering="iso-in-lab" wo="0.055815129186" />
|
||||
<nuclide name="Mn55" scattering="iso-in-lab" wo="0.0184579" />
|
||||
<nuclide name="Cr52" scattering="iso-in-lab" wo="0.146766614995" />
|
||||
<nuclide name="H1" wo="0.0086117" />
|
||||
<nuclide name="O16" wo="0.0683369" />
|
||||
<nuclide name="B10" wo="2.77638e-05" />
|
||||
<nuclide name="B11" wo="0.000126481" />
|
||||
<nuclide name="Fe54" wo="0.035953677186" />
|
||||
<nuclide name="Fe56" wo="0.585224740891" />
|
||||
<nuclide name="Fe57" wo="0.01375486056" />
|
||||
<nuclide name="Fe58" wo="0.001865821363" />
|
||||
<nuclide name="Ni58" wo="0.055815129186" />
|
||||
<nuclide name="Mn55" wo="0.0184579" />
|
||||
<nuclide name="Cr52" wo="0.146766614995" />
|
||||
<sab name="c_H_in_H2O" />
|
||||
<isotropic>H1 O16 B10 B11 Fe54 Fe56 Fe57 Fe58 Ni58 Mn55 Cr52</isotropic>
|
||||
</material>
|
||||
<material id="8" name="Bottom plate region">
|
||||
<density units="g/cm3" value="7.184" />
|
||||
<nuclide name="H1" scattering="iso-in-lab" wo="0.0011505" />
|
||||
<nuclide name="O16" scattering="iso-in-lab" wo="0.0091296" />
|
||||
<nuclide name="B10" scattering="iso-in-lab" wo="3.70915e-06" />
|
||||
<nuclide name="B11" scattering="iso-in-lab" wo="1.68974e-05" />
|
||||
<nuclide name="Fe54" scattering="iso-in-lab" wo="0.03855611055" />
|
||||
<nuclide name="Fe56" scattering="iso-in-lab" wo="0.627585036425" />
|
||||
<nuclide name="Fe57" scattering="iso-in-lab" wo="0.014750478" />
|
||||
<nuclide name="Fe58" scattering="iso-in-lab" wo="0.002000875025" />
|
||||
<nuclide name="Ni58" scattering="iso-in-lab" wo="0.059855207342" />
|
||||
<nuclide name="Mn55" scattering="iso-in-lab" wo="0.019794" />
|
||||
<nuclide name="Cr52" scattering="iso-in-lab" wo="0.157390026871" />
|
||||
<nuclide name="H1" wo="0.0011505" />
|
||||
<nuclide name="O16" wo="0.0091296" />
|
||||
<nuclide name="B10" wo="3.70915e-06" />
|
||||
<nuclide name="B11" wo="1.68974e-05" />
|
||||
<nuclide name="Fe54" wo="0.03855611055" />
|
||||
<nuclide name="Fe56" wo="0.627585036425" />
|
||||
<nuclide name="Fe57" wo="0.014750478" />
|
||||
<nuclide name="Fe58" wo="0.002000875025" />
|
||||
<nuclide name="Ni58" wo="0.059855207342" />
|
||||
<nuclide name="Mn55" wo="0.019794" />
|
||||
<nuclide name="Cr52" wo="0.157390026871" />
|
||||
<sab name="c_H_in_H2O" />
|
||||
<isotropic>H1 O16 B10 B11 Fe54 Fe56 Fe57 Fe58 Ni58 Mn55 Cr52</isotropic>
|
||||
</material>
|
||||
<material id="9" name="Bottom nozzle region">
|
||||
<density units="g/cm3" value="2.53" />
|
||||
<nuclide name="H1" scattering="iso-in-lab" wo="0.0245014" />
|
||||
<nuclide name="O16" scattering="iso-in-lab" wo="0.1944274" />
|
||||
<nuclide name="B10" scattering="iso-in-lab" wo="7.89917e-05" />
|
||||
<nuclide name="B11" scattering="iso-in-lab" wo="0.000359854" />
|
||||
<nuclide name="Fe54" scattering="iso-in-lab" wo="0.030411411144" />
|
||||
<nuclide name="Fe56" scattering="iso-in-lab" wo="0.495012237964" />
|
||||
<nuclide name="Fe57" scattering="iso-in-lab" wo="0.01163454624" />
|
||||
<nuclide name="Fe58" scattering="iso-in-lab" wo="0.001578204652" />
|
||||
<nuclide name="Ni58" scattering="iso-in-lab" wo="0.047211231662" />
|
||||
<nuclide name="Mn55" scattering="iso-in-lab" wo="0.0156126" />
|
||||
<nuclide name="Cr52" scattering="iso-in-lab" wo="0.124142524198" />
|
||||
<nuclide name="H1" wo="0.0245014" />
|
||||
<nuclide name="O16" wo="0.1944274" />
|
||||
<nuclide name="B10" wo="7.89917e-05" />
|
||||
<nuclide name="B11" wo="0.000359854" />
|
||||
<nuclide name="Fe54" wo="0.030411411144" />
|
||||
<nuclide name="Fe56" wo="0.495012237964" />
|
||||
<nuclide name="Fe57" wo="0.01163454624" />
|
||||
<nuclide name="Fe58" wo="0.001578204652" />
|
||||
<nuclide name="Ni58" wo="0.047211231662" />
|
||||
<nuclide name="Mn55" wo="0.0156126" />
|
||||
<nuclide name="Cr52" wo="0.124142524198" />
|
||||
<sab name="c_H_in_H2O" />
|
||||
<isotropic>H1 O16 B10 B11 Fe54 Fe56 Fe57 Fe58 Ni58 Mn55 Cr52</isotropic>
|
||||
</material>
|
||||
<material id="10" name="Top nozzle region">
|
||||
<density units="g/cm3" value="1.746" />
|
||||
<nuclide name="H1" scattering="iso-in-lab" wo="0.035887" />
|
||||
<nuclide name="O16" scattering="iso-in-lab" wo="0.2847761" />
|
||||
<nuclide name="B10" scattering="iso-in-lab" wo="0.000115699" />
|
||||
<nuclide name="B11" scattering="iso-in-lab" wo="0.000527075" />
|
||||
<nuclide name="Fe54" scattering="iso-in-lab" wo="0.02644016154" />
|
||||
<nuclide name="Fe56" scattering="iso-in-lab" wo="0.43037146399" />
|
||||
<nuclide name="Fe57" scattering="iso-in-lab" wo="0.0101152584" />
|
||||
<nuclide name="Fe58" scattering="iso-in-lab" wo="0.00137211607" />
|
||||
<nuclide name="Ni58" scattering="iso-in-lab" wo="0.04104621835" />
|
||||
<nuclide name="Mn55" scattering="iso-in-lab" wo="0.0135739" />
|
||||
<nuclide name="Cr52" scattering="iso-in-lab" wo="0.107931450781" />
|
||||
<nuclide name="H1" wo="0.035887" />
|
||||
<nuclide name="O16" wo="0.2847761" />
|
||||
<nuclide name="B10" wo="0.000115699" />
|
||||
<nuclide name="B11" wo="0.000527075" />
|
||||
<nuclide name="Fe54" wo="0.02644016154" />
|
||||
<nuclide name="Fe56" wo="0.43037146399" />
|
||||
<nuclide name="Fe57" wo="0.0101152584" />
|
||||
<nuclide name="Fe58" wo="0.00137211607" />
|
||||
<nuclide name="Ni58" wo="0.04104621835" />
|
||||
<nuclide name="Mn55" wo="0.0135739" />
|
||||
<nuclide name="Cr52" wo="0.107931450781" />
|
||||
<sab name="c_H_in_H2O" />
|
||||
<isotropic>H1 O16 B10 B11 Fe54 Fe56 Fe57 Fe58 Ni58 Mn55 Cr52</isotropic>
|
||||
</material>
|
||||
<material id="11" name="Top of fuel assemblies">
|
||||
<density units="g/cm3" value="3.044" />
|
||||
<nuclide name="H1" scattering="iso-in-lab" wo="0.0162913" />
|
||||
<nuclide name="O16" scattering="iso-in-lab" wo="0.1292776" />
|
||||
<nuclide name="B10" scattering="iso-in-lab" wo="5.25228e-05" />
|
||||
<nuclide name="B11" scattering="iso-in-lab" wo="0.000239272" />
|
||||
<nuclide name="Zr90" scattering="iso-in-lab" wo="0.43313403903" />
|
||||
<nuclide name="Zr91" scattering="iso-in-lab" wo="0.09549277374" />
|
||||
<nuclide name="Zr92" scattering="iso-in-lab" wo="0.14759527104" />
|
||||
<nuclide name="Zr94" scattering="iso-in-lab" wo="0.15280552077" />
|
||||
<nuclide name="Zr96" scattering="iso-in-lab" wo="0.02511169542" />
|
||||
<nuclide name="H1" wo="0.0162913" />
|
||||
<nuclide name="O16" wo="0.1292776" />
|
||||
<nuclide name="B10" wo="5.25228e-05" />
|
||||
<nuclide name="B11" wo="0.000239272" />
|
||||
<nuclide name="Zr90" wo="0.43313403903" />
|
||||
<nuclide name="Zr91" wo="0.09549277374" />
|
||||
<nuclide name="Zr92" wo="0.14759527104" />
|
||||
<nuclide name="Zr94" wo="0.15280552077" />
|
||||
<nuclide name="Zr96" wo="0.02511169542" />
|
||||
<sab name="c_H_in_H2O" />
|
||||
<isotropic>H1 O16 B10 B11 Zr90 Zr91 Zr92 Zr94 Zr96</isotropic>
|
||||
</material>
|
||||
<material id="12" name="Bottom of fuel assemblies">
|
||||
<density units="g/cm3" value="1.762" />
|
||||
<nuclide name="H1" scattering="iso-in-lab" wo="0.0292856" />
|
||||
<nuclide name="O16" scattering="iso-in-lab" wo="0.2323919" />
|
||||
<nuclide name="B10" scattering="iso-in-lab" wo="9.44159e-05" />
|
||||
<nuclide name="B11" scattering="iso-in-lab" wo="0.00043012" />
|
||||
<nuclide name="Zr90" scattering="iso-in-lab" wo="0.3741373658" />
|
||||
<nuclide name="Zr91" scattering="iso-in-lab" wo="0.0824858164" />
|
||||
<nuclide name="Zr92" scattering="iso-in-lab" wo="0.1274914944" />
|
||||
<nuclide name="Zr94" scattering="iso-in-lab" wo="0.1319920622" />
|
||||
<nuclide name="Zr96" scattering="iso-in-lab" wo="0.0216912612" />
|
||||
<nuclide name="H1" wo="0.0292856" />
|
||||
<nuclide name="O16" wo="0.2323919" />
|
||||
<nuclide name="B10" wo="9.44159e-05" />
|
||||
<nuclide name="B11" wo="0.00043012" />
|
||||
<nuclide name="Zr90" wo="0.3741373658" />
|
||||
<nuclide name="Zr91" wo="0.0824858164" />
|
||||
<nuclide name="Zr92" wo="0.1274914944" />
|
||||
<nuclide name="Zr94" wo="0.1319920622" />
|
||||
<nuclide name="Zr96" wo="0.0216912612" />
|
||||
<sab name="c_H_in_H2O" />
|
||||
<isotropic>H1 O16 B10 B11 Zr90 Zr91 Zr92 Zr94 Zr96</isotropic>
|
||||
</material>
|
||||
</materials>
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
|
|
|
|||
|
|
@ -28,10 +28,10 @@ if __name__ == '__main__':
|
|||
|
||||
mat_filter = openmc.MaterialFilter(model.materials)
|
||||
|
||||
nuclides = [xs.name for xs in model.xs_data]
|
||||
nuclides = model.xs_data
|
||||
|
||||
scores= {False: ['total', 'absorption', 'flux', 'fission', 'nu-fission'],
|
||||
True: ['total', 'absorption', 'fission', 'nu-fission']}
|
||||
scores = {False: ['total', 'absorption', 'flux', 'fission', 'nu-fission'],
|
||||
True: ['total', 'absorption', 'fission', 'nu-fission']}
|
||||
|
||||
for do_nuclides in [False, True]:
|
||||
t = openmc.Tally()
|
||||
|
|
|
|||
|
|
@ -36,8 +36,8 @@ class TRISOTestHarness(PyAPITestHarness):
|
|||
|
||||
sic = openmc.Material()
|
||||
sic.set_density('g/cm3', 3.20)
|
||||
sic.add_element('Si', 1.0)
|
||||
sic.add_nuclide('C0', 1.0)
|
||||
sic.add_element('Si', 1.0)
|
||||
|
||||
opyc = openmc.Material()
|
||||
opyc.set_density('g/cm3', 1.87)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue