mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-29 06:35:48 -04:00
Update Jupyter notebooks to remove use of openmc.Nuclide
This commit is contained in:
parent
2b6cd880f1
commit
9aaa927222
15 changed files with 1529 additions and 1767 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
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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']
|
||||
|
|
|
|||
|
|
@ -3437,12 +3437,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()
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import random
|
|||
import sys
|
||||
|
||||
from six import string_types
|
||||
import matplotlib.pyplot as plt
|
||||
import numpy as np
|
||||
|
||||
import openmc
|
||||
|
|
@ -225,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)
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue