Fixed merge conflicts with develop branch

This commit is contained in:
Will Boyd 2015-09-25 16:24:06 -04:00
commit e05ab41527
99 changed files with 5737 additions and 3263 deletions

View file

@ -16,5 +16,4 @@ as debugging.
styleguide
workflow
xml-parsing
voxel
docbuild

View file

@ -1,52 +0,0 @@
.. _devguide_voxel:
=====================================
Voxel Plot Binary File Specifications
=====================================
The current revision of the voxel plot binary file is 1.
**integer(4) n_voxels_x**
Number of voxels in the x direction
**integer(4) n_voxels_y**
Number of voxels in the y direction
**integer(4) n_voxels_z**
Number of voxels in the z direction
**real(8) width_voxel_x**
Width of voxels in the x direction
**real(8) width_voxel_y**
Width of voxels in the y direction
**real(8) width_voxel_z**
Width of voxels in the z direction
**real(8) lower_left_x**
Lower left x point of the voxel grid
**real(8) lower_left_y**
Lower left y point of the voxel grid
**real(8) lower_left_z**
Lower left z point of the voxel grid
*do x = 1, n_voxels_x*
*do y = 1, n_voxels_y*
*do z = 1, n_voxels_z*
**integer(4) id**
Cell or material id number at this voxel center. Set to -1 when
cell not_found.

View file

@ -1027,14 +1027,19 @@ probability distribution function can be found by integrating equation
Let us call the normalization factor in the denominator of equation
:eq:`target-pdf-1` :math:`C`.
It is normally assumed that :math:`\sigma (v_r)` is constant over the range of
Constant Cross Section Model
----------------------------
It is often assumed that :math:`\sigma (v_r)` is constant over the range of
relative velocities of interest. This is a good assumption for almost all cases
since the elastic scattering cross section varies slowly with velocity for light
nuclei, and for heavy nuclei where large variations can occur due to resonance
scattering, the moderating effect is rather small. Nonetheless, this assumption
may cause incorrect answers in systems with low-lying resonances that can cause
a significant amount of up-scatter that would be ignored by this assumption
(e.g. U-238 in commercial light-water reactors). Nevertheless, with this
(e.g. U-238 in commercial light-water reactors). We will revisit this assumption
later in :ref:`energy_dependent_xs_model`. For now, continuing with the
assumption, we write :math:`\sigma (v_r) = \sigma_s` which simplifies
:eq:`target-pdf-1` to
@ -1232,6 +1237,35 @@ If is not accepted, then we repeat the process and resample a target speed and
cosine until a combination is found that satisfies equation
:eq:`freegas-accept-2`.
.. _energy_dependent_xs_model:
Energy-Dependent Cross Section Model
------------------------------------
As was noted earlier, assuming that the elastic scattering cross section is
constant in :eq:`reaction-rate` is not strictly correct, especially when
low-lying resonances are present in the cross sections for heavy nuclides. To
correctly account for energy dependence of the scattering cross section entails
performing another rejection step. The most common method is to sample
:math:`\mu` and :math:`v_T` as in the constant cross section approximation and
then perform a rejection on the ratio of the 0 K elastic scattering cross
section at the relative velocity to the maximum 0 K elastic scattering cross
section over the range of velocities considered:
.. math::
:label: dbrc
p_{dbrc} = \frac{\sigma_s(v_r)}{\sigma_{s,max}}
where it should be noted that the maximum is taken over the range :math:`[v_n -
4/\beta, 4_n + 4\beta]`. This method is known as Doppler broadening rejection
correction (DBRC) and was first introduced by `Becker et al.`_. OpenMC has an
implementation of DBRC as well as an accelerated sampling method that are
described fully in `Walsh et al.`_
.. _Becker et al.: http://dx.doi.org/10.1016/j.anucene.2008.12.001
.. _Walsh et al.: http://dx.doi.org/10.1016/j.anucene.2014.01.017
.. _sab_tables:
------------

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

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

View file

@ -358,7 +358,7 @@
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAPoAAAD6AgMAAAD1grKuAAAABGdBTUEAALGPC/xhBQAAAAFzUkdC\nAK7OHOkAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAxQTFRF\n////chIS6YCRTb/E6kGE+wAAAAFiS0dEAIgFHUgAAAAJcEhZcwAAAEgAAABIAEbJaz4AAALKSURB\nVGje7dpLcqQwDAbgHHE2YeEj+D4cwQucBUfo+3CEXoSp8OhuhF70T4qpKXmdr21LogK2Pj7A8QmN\nP+HDhw8fPnz48Kf6VH9G+66vy+je8k19jnf8C5dXIPv86ms56lPdjvaYbyodx3ze+XLE76cXFiD4\nzPji99z0/AJ4n1lfvJ6fnl0A6x+578efMSg1wPr172/jPO5yFXM+Ef78gdblM+WPHyguP//t1/g6\npA0wfln+ho/fwgYYn19C/xwDvwHGc9OvC+hs37DTrwuwfWanXxdQTC9Mvyygs3wjTL8uwPJpn/tN\nDbSGz7T0SBEWw4vLXzbQ6b6RoveIoO6TvPxlA63qs7z8ZQPF9F+SH22vbX8OQKf5Rtv+EgDNJ3X5\n8wZaxWd1+fMGiuFvir8bvjp8J/tGy/6jAmRvhW8fwL3vVT+o3grfPoB7r/IpALI3tz8FoJN84/NV\n873hB8UnM3xzANtf8nb4dwmg3grfFEDJO8JPE0i9Ff4pAYL3pI8mkHor/HMCeO9JH00g9SafEsh7\nT/ppARBvp48UwJnelT5SACd7O31TAlnvKx9SQCd7B58KgPO+8iMFuPWe9E8F8BveWX7bAjzX9y4/\n/Jve+fhsH6Ctv7n8PTzjvY/v9gEOHz58+PBX+6v/f/wPvnd54f3j6venE/yl769Xv7+j3x/o98/V\n32/o9+fl389Xnx+g5x/o+Qt6/oOeP6HnX+j5G3z+h54/ouefV5/foufP6Pk3ev4On/+j9w/o/Qd6\n/4Le/6D3T/D9V67Y/ZsVQBq+s+8f0ftP+P41axXguP9NWgDuu/Cdfv+N3r/D9/9TAID+A7T/Ae2/\ngPs/0P4TtP8F7r9J3AIO9P+g/Udw/9Oygbf7r9D+L7j/DO1/Q/vv4P4/tP8Q7n9E+y/h/k+0/xTu\nf4X7b+H+X7T/+BPuf3aM8OHDhw8fPnz4w/4vzcvgeY10sY0AAAAldEVYdGRhdGU6Y3JlYXRlADIw\nMTUtMDgtMDZUMTY6NDM6MTMrMDc6MDBtUQj+AAAAJXRFWHRkYXRlOm1vZGlmeQAyMDE1LTA4LTA2\nVDE2OjQzOjEzKzA3OjAwHAywQgAAAABJRU5ErkJggg==\n",
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAPoAAAD6AgMAAAD1grKuAAAABGdBTUEAALGPC/xhBQAAACBjSFJN\nAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAADFBMVEX///9yEhLpgJFNv8Tq\nQYT7AAAAAWJLR0QAiAUdSAAAAAd0SU1FB98JFQMZGiFPL70AAALKSURBVGje7dpLcqQwDAbgHHE2\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/4vzcvgeY10sY0AAAAldEVYdGRhdGU6Y3JlYXRlADIwMTUtMDktMjFUMTA6MDg6\nNTcrMDc6MDALr51VAAAAJXRFWHRkYXRlOm1vZGlmeQAyMDE1LTA5LTIxVDEwOjA4OjU3KzA3OjAw\nevIl6QAAAABJRU5ErkJggg==\n",
"text/plain": [
"<IPython.core.display.Image object>"
]
@ -569,7 +569,8 @@
" Copyright: 2011-2015 Massachusetts Institute of Technology\n",
" License: http://mit-crpg.github.io/openmc/license.html\n",
" Version: 0.7.0\n",
" Date/Time: 2015-08-15 10:52:49\n",
" Git SHA1: b167d70c877c516deca785801b9fa6f53fb0985b\n",
" Date/Time: 2015-09-21 10:25:26\n",
"\n",
" ===========================================================================\n",
" ========================> INITIALIZATION <=========================\n",
@ -595,26 +596,26 @@
"\n",
" Bat./Gen. k Average k \n",
" ========= ======== ==================== \n",
" 1/1 1.00465 \n",
" 2/1 1.05814 \n",
" 3/1 1.05114 \n",
" 4/1 1.09189 \n",
" 5/1 1.03731 \n",
" 6/1 1.03510 \n",
" 7/1 1.09378 1.06444 +/- 0.02934\n",
" 8/1 1.04522 1.05803 +/- 0.01811\n",
" 9/1 1.06557 1.05992 +/- 0.01294\n",
" 10/1 1.05757 1.05945 +/- 0.01004\n",
" 11/1 1.04858 1.05764 +/- 0.00839\n",
" 12/1 1.01832 1.05202 +/- 0.00905\n",
" 13/1 1.05822 1.05279 +/- 0.00787\n",
" 14/1 1.07684 1.05547 +/- 0.00744\n",
" 15/1 1.00349 1.05027 +/- 0.00844\n",
" 16/1 1.06969 1.05203 +/- 0.00784\n",
" 17/1 1.06377 1.05301 +/- 0.00722\n",
" 18/1 1.02897 1.05116 +/- 0.00690\n",
" 19/1 1.00685 1.04800 +/- 0.00713\n",
" 20/1 1.02644 1.04656 +/- 0.00679\n",
" 1/1 1.00279 \n",
" 2/1 1.03320 \n",
" 3/1 1.04467 \n",
" 4/1 1.09693 \n",
" 5/1 1.05008 \n",
" 6/1 1.08426 \n",
" 7/1 1.05363 1.06894 +/- 0.01531\n",
" 8/1 0.97961 1.03917 +/- 0.03106\n",
" 9/1 1.06444 1.04549 +/- 0.02285\n",
" 10/1 1.08345 1.05308 +/- 0.01926\n",
" 11/1 1.06871 1.05568 +/- 0.01594\n",
" 12/1 1.03183 1.05228 +/- 0.01390\n",
" 13/1 1.04486 1.05135 +/- 0.01207\n",
" 14/1 1.06468 1.05283 +/- 0.01075\n",
" 15/1 1.04185 1.05173 +/- 0.00968\n",
" 16/1 1.01268 1.04818 +/- 0.00944\n",
" 17/1 1.04129 1.04761 +/- 0.00864\n",
" 18/1 1.01127 1.04481 +/- 0.00843\n",
" 19/1 1.03738 1.04428 +/- 0.00782\n",
" 20/1 1.04410 1.04427 +/- 0.00728\n",
" Creating state point statepoint.20.h5...\n",
"\n",
" ===========================================================================\n",
@ -624,27 +625,27 @@
"\n",
" =======================> TIMING STATISTICS <=======================\n",
"\n",
" Total time for initialization = 4.4100E-01 seconds\n",
" Reading cross sections = 1.1300E-01 seconds\n",
" Total time in simulation = 1.8418E+01 seconds\n",
" Time in transport only = 1.8403E+01 seconds\n",
" Time in inactive batches = 2.1070E+00 seconds\n",
" Time in active batches = 1.6311E+01 seconds\n",
" Time synchronizing fission bank = 2.0000E-03 seconds\n",
" Sampling source sites = 2.0000E-03 seconds\n",
" Total time for initialization = 9.1800E-01 seconds\n",
" Reading cross sections = 6.5800E-01 seconds\n",
" Total time in simulation = 1.7037E+01 seconds\n",
" Time in transport only = 1.7024E+01 seconds\n",
" Time in inactive batches = 2.8600E+00 seconds\n",
" Time in active batches = 1.4177E+01 seconds\n",
" Time synchronizing fission bank = 4.0000E-03 seconds\n",
" Sampling source sites = 4.0000E-03 seconds\n",
" SEND/RECV source sites = 0.0000E+00 seconds\n",
" Time accumulating tallies = 0.0000E+00 seconds\n",
" Total time for finalization = 1.0000E-03 seconds\n",
" Total time elapsed = 1.8861E+01 seconds\n",
" Calculation Rate (inactive) = 5932.61 neutrons/second\n",
" Calculation Rate (active) = 2299.06 neutrons/second\n",
" Total time elapsed = 1.7971E+01 seconds\n",
" Calculation Rate (inactive) = 4370.63 neutrons/second\n",
" Calculation Rate (active) = 2645.13 neutrons/second\n",
"\n",
" ============================> RESULTS <============================\n",
"\n",
" k-effective (Collision) = 1.04599 +/- 0.00622\n",
" k-effective (Track-length) = 1.04656 +/- 0.00679\n",
" k-effective (Absorption) = 1.04614 +/- 0.00461\n",
" Combined k-effective = 1.04651 +/- 0.00368\n",
" k-effective (Collision) = 1.04044 +/- 0.00527\n",
" k-effective (Track-length) = 1.04427 +/- 0.00728\n",
" k-effective (Absorption) = 1.04794 +/- 0.00535\n",
" Combined k-effective = 1.04628 +/- 0.00467\n",
" Leakage Fraction = 0.00000 +/- 0.00000\n",
"\n"
]
@ -692,8 +693,7 @@
"outputs": [],
"source": [
"# Load the statepoint file\n",
"sp = StatePoint('statepoint.20.h5')\n",
"sp.read_results()"
"sp = StatePoint('statepoint.20.h5')"
]
},
{
@ -759,8 +759,8 @@
" <th>0</th>\n",
" <td>total</td>\n",
" <td>(nu-fission / absorption)</td>\n",
" <td>1.042726</td>\n",
" <td>0.008661</td>\n",
" <td>1.046353</td>\n",
" <td>0.00935</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
@ -769,7 +769,7 @@
"text/plain": [
" nuclide score mean std. dev.\n",
"bin \n",
"0 total (nu-fission / absorption) 1.042726 0.008661"
"0 total (nu-fission / absorption) 1.046353 0.00935"
]
},
"execution_count": 26,
@ -827,17 +827,17 @@
" <th>0</th>\n",
" <td>total</td>\n",
" <td>absorption</td>\n",
" <td>0.958874</td>\n",
" <td>0.007146</td>\n",
" <td>0.95873</td>\n",
" <td>0.00774</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" nuclide score mean std. dev.\n",
"bin \n",
"0 total absorption 0.958874 0.007146"
" nuclide score mean std. dev.\n",
"bin \n",
"0 total absorption 0.95873 0.00774"
]
},
"execution_count": 27,
@ -893,17 +893,17 @@
" <th>0</th>\n",
" <td>total</td>\n",
" <td>nu-fission</td>\n",
" <td>1.09186</td>\n",
" <td>0.010424</td>\n",
" <td>1.091622</td>\n",
" <td>0.011163</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" nuclide score mean std. dev.\n",
"bin \n",
"0 total nu-fission 1.09186 0.010424"
" nuclide score mean std. dev.\n",
"bin \n",
"0 total nu-fission 1.091622 0.011163"
]
},
"execution_count": 28,
@ -966,8 +966,8 @@
" <td>10000</td>\n",
" <td>total</td>\n",
" <td>absorption</td>\n",
" <td>0.802921</td>\n",
" <td>0.006109</td>\n",
" <td>0.802012</td>\n",
" <td>0.006609</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
@ -976,7 +976,7 @@
"text/plain": [
" energy [MeV] cell nuclide score mean std. dev.\n",
"bin \n",
"0 0.0e+00 - 6.2e-01 10000 total absorption 0.802921 0.006109"
"0 0.0e+00 - 6.2e-01 10000 total absorption 0.802012 0.006609"
]
},
"execution_count": 29,
@ -1037,8 +1037,8 @@
" <td>10000</td>\n",
" <td>total</td>\n",
" <td>(nu-fission / absorption)</td>\n",
" <td>1.240421</td>\n",
" <td>0.010978</td>\n",
" <td>1.246604</td>\n",
" <td>0.011825</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
@ -1047,11 +1047,11 @@
"text/plain": [
" energy [MeV] cell nuclide score mean \\\n",
"bin \n",
"0 0.0e+00 - 6.2e-01 10000 total (nu-fission / absorption) 1.240421 \n",
"0 0.0e+00 - 6.2e-01 10000 total (nu-fission / absorption) 1.246604 \n",
"\n",
" std. dev. \n",
"bin \n",
"0 0.010978 "
"0 0.011825 "
]
},
"execution_count": 30,
@ -1105,8 +1105,8 @@
" <th>0</th>\n",
" <td>total</td>\n",
" <td>(((absorption * nu-fission) * absorption) * (n...</td>\n",
" <td>1.042726</td>\n",
" <td>0.017538</td>\n",
" <td>1.046353</td>\n",
" <td>0.01894</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
@ -1115,11 +1115,11 @@
"text/plain": [
" nuclide score mean \\\n",
"bin \n",
"0 total (((absorption * nu-fission) * absorption) * (n... 1.042726 \n",
"0 total (((absorption * nu-fission) * absorption) * (n... 1.046353 \n",
"\n",
" std. dev. \n",
"bin \n",
"0 0.017538 "
"0 0.01894 "
]
},
"execution_count": 31,
@ -1197,7 +1197,7 @@
" <td>(U-238 / total)</td>\n",
" <td>(nu-fission / flux)</td>\n",
" <td>0.000001</td>\n",
" <td>6.985151e-09</td>\n",
" <td>6.859257e-09</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
@ -1205,8 +1205,8 @@
" <td>0.0e+00 - 6.3e-07</td>\n",
" <td>(U-238 / total)</td>\n",
" <td>(scatter / flux)</td>\n",
" <td>0.209988</td>\n",
" <td>2.206753e-03</td>\n",
" <td>0.209986</td>\n",
" <td>1.966887e-03</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
@ -1214,8 +1214,8 @@
" <td>0.0e+00 - 6.3e-07</td>\n",
" <td>(U-235 / total)</td>\n",
" <td>(nu-fission / flux)</td>\n",
" <td>0.355276</td>\n",
" <td>3.741612e-03</td>\n",
" <td>0.355667</td>\n",
" <td>3.717881e-03</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
@ -1224,7 +1224,7 @@
" <td>(U-235 / total)</td>\n",
" <td>(scatter / flux)</td>\n",
" <td>0.005555</td>\n",
" <td>5.842517e-05</td>\n",
" <td>5.218094e-05</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
@ -1232,8 +1232,8 @@
" <td>6.3e-07 - 2.0e+01</td>\n",
" <td>(U-238 / total)</td>\n",
" <td>(nu-fission / flux)</td>\n",
" <td>0.007229</td>\n",
" <td>5.951357e-05</td>\n",
" <td>0.007165</td>\n",
" <td>5.625590e-05</td>\n",
" </tr>\n",
" <tr>\n",
" <th>5</th>\n",
@ -1241,8 +1241,8 @@
" <td>6.3e-07 - 2.0e+01</td>\n",
" <td>(U-238 / total)</td>\n",
" <td>(scatter / flux)</td>\n",
" <td>0.227642</td>\n",
" <td>9.496469e-04</td>\n",
" <td>0.227653</td>\n",
" <td>8.544314e-04</td>\n",
" </tr>\n",
" <tr>\n",
" <th>6</th>\n",
@ -1250,8 +1250,8 @@
" <td>6.3e-07 - 2.0e+01</td>\n",
" <td>(U-235 / total)</td>\n",
" <td>(nu-fission / flux)</td>\n",
" <td>0.008076</td>\n",
" <td>5.699123e-05</td>\n",
" <td>0.008089</td>\n",
" <td>5.080374e-05</td>\n",
" </tr>\n",
" <tr>\n",
" <th>7</th>\n",
@ -1259,8 +1259,8 @@
" <td>6.3e-07 - 2.0e+01</td>\n",
" <td>(U-235 / total)</td>\n",
" <td>(scatter / flux)</td>\n",
" <td>0.003369</td>\n",
" <td>1.369755e-05</td>\n",
" <td>0.003370</td>\n",
" <td>1.361116e-05</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
@ -1270,24 +1270,24 @@
" cell energy [MeV] nuclide score mean \\\n",
"bin \n",
"0 10000 0.0e+00 - 6.3e-07 (U-238 / total) (nu-fission / flux) 0.000001 \n",
"1 10000 0.0e+00 - 6.3e-07 (U-238 / total) (scatter / flux) 0.209988 \n",
"2 10000 0.0e+00 - 6.3e-07 (U-235 / total) (nu-fission / flux) 0.355276 \n",
"1 10000 0.0e+00 - 6.3e-07 (U-238 / total) (scatter / flux) 0.209986 \n",
"2 10000 0.0e+00 - 6.3e-07 (U-235 / total) (nu-fission / flux) 0.355667 \n",
"3 10000 0.0e+00 - 6.3e-07 (U-235 / total) (scatter / flux) 0.005555 \n",
"4 10000 6.3e-07 - 2.0e+01 (U-238 / total) (nu-fission / flux) 0.007229 \n",
"5 10000 6.3e-07 - 2.0e+01 (U-238 / total) (scatter / flux) 0.227642 \n",
"6 10000 6.3e-07 - 2.0e+01 (U-235 / total) (nu-fission / flux) 0.008076 \n",
"7 10000 6.3e-07 - 2.0e+01 (U-235 / total) (scatter / flux) 0.003369 \n",
"4 10000 6.3e-07 - 2.0e+01 (U-238 / total) (nu-fission / flux) 0.007165 \n",
"5 10000 6.3e-07 - 2.0e+01 (U-238 / total) (scatter / flux) 0.227653 \n",
"6 10000 6.3e-07 - 2.0e+01 (U-235 / total) (nu-fission / flux) 0.008089 \n",
"7 10000 6.3e-07 - 2.0e+01 (U-235 / total) (scatter / flux) 0.003370 \n",
"\n",
" std. dev. \n",
"bin \n",
"0 6.985151e-09 \n",
"1 2.206753e-03 \n",
"2 3.741612e-03 \n",
"3 5.842517e-05 \n",
"4 5.951357e-05 \n",
"5 9.496469e-04 \n",
"6 5.699123e-05 \n",
"7 1.369755e-05 "
"0 6.859257e-09 \n",
"1 1.966887e-03 \n",
"2 3.717881e-03 \n",
"3 5.218094e-05 \n",
"4 5.625590e-05 \n",
"5 8.544314e-04 \n",
"6 5.080374e-05 \n",
"7 1.361116e-05 "
]
},
"execution_count": 33,
@ -1318,11 +1318,11 @@
"name": "stdout",
"output_type": "stream",
"text": [
"[[[ 6.63809296e-07]\n",
" [ 3.55275544e-01]]\n",
"[[[ 6.64174599e-07]\n",
" [ 3.55666541e-01]]\n",
"\n",
" [[ 7.22895528e-03]\n",
" [ 8.07565148e-03]]]\n"
" [[ 7.16505734e-03]\n",
" [ 8.08949336e-03]]]\n"
]
}
],
@ -1350,9 +1350,9 @@
"name": "stdout",
"output_type": "stream",
"text": [
"[[[ 0.00555505]]\n",
"[[[ 0.00555465]]\n",
"\n",
" [[ 0.0033688 ]]]\n"
" [[ 0.00337011]]]\n"
]
}
],
@ -1374,8 +1374,8 @@
"name": "stdout",
"output_type": "stream",
"text": [
"[[[ 0.2276418]\n",
" [ 0.0033688]]]\n"
"[[[ 0.22765348]\n",
" [ 0.00337011]]]\n"
]
}
],
@ -1434,7 +1434,7 @@
" <td>U-238</td>\n",
" <td>nu-fission</td>\n",
" <td>0.000002</td>\n",
" <td>1.211808e-08</td>\n",
" <td>1.284890e-08</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
@ -1442,8 +1442,8 @@
" <td>0.0e+00 - 6.3e-07</td>\n",
" <td>U-235</td>\n",
" <td>nu-fission</td>\n",
" <td>0.870360</td>\n",
" <td>6.496431e-03</td>\n",
" <td>0.867982</td>\n",
" <td>7.022256e-03</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
@ -1451,8 +1451,8 @@
" <td>6.3e-07 - 2.0e+01</td>\n",
" <td>U-238</td>\n",
" <td>nu-fission</td>\n",
" <td>0.083226</td>\n",
" <td>6.367951e-04</td>\n",
" <td>0.082801</td>\n",
" <td>6.087096e-04</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
@ -1460,8 +1460,8 @@
" <td>6.3e-07 - 2.0e+01</td>\n",
" <td>U-235</td>\n",
" <td>nu-fission</td>\n",
" <td>0.092974</td>\n",
" <td>5.921990e-04</td>\n",
" <td>0.093484</td>\n",
" <td>5.275039e-04</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
@ -1470,10 +1470,10 @@
"text/plain": [
" cell energy [MeV] nuclide score mean std. dev.\n",
"bin \n",
"0 10000 0.0e+00 - 6.3e-07 U-238 nu-fission 0.000002 1.211808e-08\n",
"1 10000 0.0e+00 - 6.3e-07 U-235 nu-fission 0.870360 6.496431e-03\n",
"2 10000 6.3e-07 - 2.0e+01 U-238 nu-fission 0.083226 6.367951e-04\n",
"3 10000 6.3e-07 - 2.0e+01 U-235 nu-fission 0.092974 5.921990e-04"
"0 10000 0.0e+00 - 6.3e-07 U-238 nu-fission 0.000002 1.284890e-08\n",
"1 10000 0.0e+00 - 6.3e-07 U-235 nu-fission 0.867982 7.022256e-03\n",
"2 10000 6.3e-07 - 2.0e+01 U-238 nu-fission 0.082801 6.087096e-04\n",
"3 10000 6.3e-07 - 2.0e+01 U-235 nu-fission 0.093484 5.275039e-04"
]
},
"execution_count": 37,
@ -1526,8 +1526,8 @@
" <td>1.0e-08 - 1.1e-07</td>\n",
" <td>H-1</td>\n",
" <td>scatter</td>\n",
" <td>4.638428</td>\n",
" <td>0.034134</td>\n",
" <td>4.620525</td>\n",
" <td>0.038249</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
@ -1535,8 +1535,8 @@
" <td>1.1e-07 - 1.2e-06</td>\n",
" <td>H-1</td>\n",
" <td>scatter</td>\n",
" <td>2.050818</td>\n",
" <td>0.010745</td>\n",
" <td>2.036841</td>\n",
" <td>0.013203</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
@ -1544,8 +1544,8 @@
" <td>1.2e-06 - 1.3e-05</td>\n",
" <td>H-1</td>\n",
" <td>scatter</td>\n",
" <td>1.656905</td>\n",
" <td>0.009480</td>\n",
" <td>1.659916</td>\n",
" <td>0.010107</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
@ -1553,8 +1553,8 @@
" <td>1.3e-05 - 1.4e-04</td>\n",
" <td>H-1</td>\n",
" <td>scatter</td>\n",
" <td>1.870808</td>\n",
" <td>0.011883</td>\n",
" <td>1.861546</td>\n",
" <td>0.013328</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
@ -1562,8 +1562,8 @@
" <td>1.4e-04 - 1.5e-03</td>\n",
" <td>H-1</td>\n",
" <td>scatter</td>\n",
" <td>2.045621</td>\n",
" <td>0.011414</td>\n",
" <td>2.049664</td>\n",
" <td>0.008215</td>\n",
" </tr>\n",
" <tr>\n",
" <th>5</th>\n",
@ -1571,8 +1571,8 @@
" <td>1.5e-03 - 1.6e-02</td>\n",
" <td>H-1</td>\n",
" <td>scatter</td>\n",
" <td>2.163297</td>\n",
" <td>0.008725</td>\n",
" <td>2.162157</td>\n",
" <td>0.010245</td>\n",
" </tr>\n",
" <tr>\n",
" <th>6</th>\n",
@ -1580,8 +1580,8 @@
" <td>1.6e-02 - 1.7e-01</td>\n",
" <td>H-1</td>\n",
" <td>scatter</td>\n",
" <td>2.202045</td>\n",
" <td>0.013500</td>\n",
" <td>2.224496</td>\n",
" <td>0.013796</td>\n",
" </tr>\n",
" <tr>\n",
" <th>7</th>\n",
@ -1589,8 +1589,8 @@
" <td>1.7e-01 - 1.9e+00</td>\n",
" <td>H-1</td>\n",
" <td>scatter</td>\n",
" <td>1.996977</td>\n",
" <td>0.010791</td>\n",
" <td>1.997585</td>\n",
" <td>0.009161</td>\n",
" </tr>\n",
" <tr>\n",
" <th>8</th>\n",
@ -1598,8 +1598,8 @@
" <td>1.9e+00 - 2.0e+01</td>\n",
" <td>H-1</td>\n",
" <td>scatter</td>\n",
" <td>0.370890</td>\n",
" <td>0.003597</td>\n",
" <td>0.373472</td>\n",
" <td>0.003922</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
@ -1608,15 +1608,15 @@
"text/plain": [
" cell energy [MeV] nuclide score mean std. dev.\n",
"bin \n",
"0 10002 1.0e-08 - 1.1e-07 H-1 scatter 4.638428 0.034134\n",
"1 10002 1.1e-07 - 1.2e-06 H-1 scatter 2.050818 0.010745\n",
"2 10002 1.2e-06 - 1.3e-05 H-1 scatter 1.656905 0.009480\n",
"3 10002 1.3e-05 - 1.4e-04 H-1 scatter 1.870808 0.011883\n",
"4 10002 1.4e-04 - 1.5e-03 H-1 scatter 2.045621 0.011414\n",
"5 10002 1.5e-03 - 1.6e-02 H-1 scatter 2.163297 0.008725\n",
"6 10002 1.6e-02 - 1.7e-01 H-1 scatter 2.202045 0.013500\n",
"7 10002 1.7e-01 - 1.9e+00 H-1 scatter 1.996977 0.010791\n",
"8 10002 1.9e+00 - 2.0e+01 H-1 scatter 0.370890 0.003597"
"0 10002 1.0e-08 - 1.1e-07 H-1 scatter 4.620525 0.038249\n",
"1 10002 1.1e-07 - 1.2e-06 H-1 scatter 2.036841 0.013203\n",
"2 10002 1.2e-06 - 1.3e-05 H-1 scatter 1.659916 0.010107\n",
"3 10002 1.3e-05 - 1.4e-04 H-1 scatter 1.861546 0.013328\n",
"4 10002 1.4e-04 - 1.5e-03 H-1 scatter 2.049664 0.008215\n",
"5 10002 1.5e-03 - 1.6e-02 H-1 scatter 2.162157 0.010245\n",
"6 10002 1.6e-02 - 1.7e-01 H-1 scatter 2.224496 0.013796\n",
"7 10002 1.7e-01 - 1.9e+00 H-1 scatter 1.997585 0.009161\n",
"8 10002 1.9e+00 - 2.0e+01 H-1 scatter 0.373472 0.003922"
]
},
"execution_count": 38,
@ -1649,7 +1649,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.8"
"version": "2.7.9"
}
},
"nbformat": 4,

View file

@ -62,6 +62,7 @@ on a given module or class.
.. toctree::
:maxdepth: 1
examples/post-processing
examples/pandas-dataframes
examples/tally-arithmetic

View file

@ -79,14 +79,13 @@ Message Description
[VALID] XML file matches RelaxNG.
======================== ===================================
As an example, if OpenMC is installed in the directory
``/opt/openmc/0.6.2`` and the current working directory is where
OpenMC XML input files are located, they can be validated using
the following command:
As an example, if OpenMC is installed in the directory ``/opt/openmc/`` and the
current working directory is where OpenMC XML input files are located, they can
be validated using the following command:
.. code-block:: bash
/opt/openmc/0.6.2/bin/xml_validate
/opt/openmc/bin/openmc-validate-xml
--------------------------------------
Settings Specification -- settings.xml
@ -1278,14 +1277,16 @@ The ``<tally>`` element accepts the following sub-elements:
*Default*: total
:estimator:
The estimator element is used to force the use of either ``analog`` or
``tracklength`` tally estimation. ''analog'' is generally less efficient
though it can be used with every score type. ''tracklength'' is generally
the most efficient, though its usage is restricted to tallies that do not
score particle information which requires a collision to have occured, such
as a scattering tally which utilizes outgoing energy filters.
The estimator element is used to force the use of either ``analog``,
``collision``, or ``tracklength`` tally estimation. ``analog`` is generally
the least efficient though it can be used with every score type.
``tracklength`` is generally the most efficient, but neither ``tracklength``
nor ``collision`` can be used to score a tally that requires post-collision
information. For example, a scattering tally with outgoing energy filters
cannot be used with ``tracklength`` or ``collision`` because the code will
not know the outgoing energy distribution.
*Default*: ``tracklength`` but will revert to analog if necessary.
*Default*: ``tracklength`` but will revert to ``analog`` if necessary.
:scores:
A space-separated list of the desired responses to be accumulated. Accepted
@ -1296,7 +1297,9 @@ The ``<tally>`` element accepts the following sub-elements:
physical quantities:
:flux:
Total flux in particle-cm per source particle.
Total flux in particle-cm per source particle. Note: The ``analog``
estimator is actually identical to the ``collision`` estimator for the
flux score.
:total:
Total reaction rate in reactions per source particle.
@ -1423,8 +1426,7 @@ a separate element with the tag name ``<mesh>``. This element has the following
attributes/sub-elements:
:type:
The type of structured mesh. Valid options include "rectangular" and
"hexagonal".
The type of structured mesh. The only valid option is "regular".
:dimension:
The number of mesh cells in each direction.
@ -1526,16 +1528,16 @@ sub-elements:
*Default*: None - Required entry
:type:
Keyword for type of plot to be produced. Currently only "slice" and
"voxel" plots are implemented. The "slice" plot type creates 2D pixel
maps saved in the PPM file format. PPM files can be displayed in most
viewers (e.g. the default Gnome viewer, IrfanView, etc.). The "voxel"
plot type produces a binary datafile containing voxel grid positioning and
the cell or material (specified by the ``color`` tag) at the center of each
voxel. These datafiles can be processed into 3D SILO files using the
``voxel.py`` utility provided with the OpenMC source, and subsequently
viewed with a 3D viewer such as VISIT or Paraview. See the
:ref:`devguide_voxel` for information about the datafile structure.
Keyword for type of plot to be produced. Currently only "slice" and "voxel"
plots are implemented. The "slice" plot type creates 2D pixel maps saved in
the PPM file format. PPM files can be displayed in most viewers (e.g. the
default Gnome viewer, IrfanView, etc.). The "voxel" plot type produces a
binary datafile containing voxel grid positioning and the cell or material
(specified by the ``color`` tag) at the center of each voxel. These
datafiles can be processed into 3D SILO files using the
``openmc-voxel-to-silovtk`` utility provided with the OpenMC source, and
subsequently viewed with a 3D viewer such as VISIT or Paraview. See the
:ref:`usersguide_voxel` for information about the datafile structure.
.. note:: Since the PPM format is saved without any kind of compression,
the resulting file sizes can be quite large. Saving the image in

View file

@ -10,5 +10,7 @@ Output File Formats
statepoint
source
summary
particle_restart
track
voxel

View file

@ -6,11 +6,9 @@ Particle Restart File Format
The current revision of the particle restart file format is 1.
**/filetype** (*int*)
**/filetype** (*char[]*)
Flags what type of file this is. A value of -1 indicates a statepoint file,
a value of -2 indicates a particle restart file, a value of -3 indicates a
source file, and a value of -4 indicates a track file.
String indicating the type of file.
**/revision** (*int*)

View file

@ -8,11 +8,9 @@ Normally, source data is stored in a state point file. However, it is possible
to request that the source be written separately, in which case the format used
is that documented here.
**/filetype** (*int*)
**/filetype** (*char[]*)
Flags what type of file this is. A value of -1 indicates a statepoint file,
a value of -2 indicates a particle restart file, a value of -3 indicates a
source file, and a value of -4 indicates a track file.
String indicating the type of file.
**/source_bank** (Compound type)

View file

@ -6,11 +6,9 @@ State Point File Format
The current revision of the statepoint file format is 13.
**/filetype** (*int*)
**/filetype** (*char[]*)
Flags what type of file this is. A value of -1 indicates a statepoint file,
a value of -2 indicates a particle restart file, a value of -3 indicates a
source file, and a value of -4 indicates a track file.
String indicating the type of file.
**/revision** (*int*)
@ -29,11 +27,11 @@ The current revision of the statepoint file format is 13.
Release version number for OpenMC
**/time_stamp** (*char[19]*)
**/date_and_time** (*char[]*)
Date and time the state point was written.
**/path** (*char[255]*)
**/path** (*char[]*)
Absolute path to directory containing input files.
@ -41,7 +39,7 @@ The current revision of the statepoint file format is 13.
Pseudo-random number generator seed.
**/run_mode** (*int*)
**/run_mode** (*char[]*)
Run mode used. A value of 1 indicates a fixed-source run and a value of 2
indicates an eigenvalue run.
@ -58,7 +56,7 @@ The current revision of the statepoint file format is 13.
The number of batches already simulated.
if (run_mode == MODE_EIGENVALUE)
if run_mode == 'k-eigenvalue':
**/n_inactive** (*int*)
@ -136,37 +134,27 @@ if (run_mode == MODE_EIGENVALUE)
**/tally/meshes/keys** (*int[]*)
User-identified unique ID of each mesh
User-identified unique ID of each mesh.
*do i = 1, n_meshes*
**/tallies/meshes/mesh <uid>/type** (*char[]*)
**/tallies/meshes/mesh i/id** (*int*)
Type of mesh.
Unique identifier of the mesh.
**/tallies/meshes/mesh <uid>/dimension** (*int*)
**/tallies/meshes/mesh i/type** (*int*)
Number of mesh cells in each dimension.
Type of mesh.
**/tallies/meshes/mesh <uid>/lower_left** (*double[]*)
**/tallies/meshes/mesh i/n_dimension** (*int*)
Coordinates of lower-left corner of mesh.
Number of dimensions for mesh (2 or 3).
**/tallies/meshes/mesh <uid>/upper_right** (*double[]*)
**/tallies/meshes/mesh i/dimension** (*int*)
Coordinates of upper-right corner of mesh.
Number of mesh cells in each dimension.
**/tallies/meshes/mesh <uid>/width** (*double[]*)
**/tallies/meshes/mesh i/lower_left** (*double[]*)
Coordinates of lower-left corner of mesh.
**/tallies/meshes/mesh i/upper_right** (*double[]*)
Coordinates of upper-right corner of mesh.
**/tallies/meshes/mesh i/width** (*double[]*)
Width of each mesh cell in each dimension.
Width of each mesh cell in each dimension.
**/tallies/n_tallies** (*int*)
@ -180,65 +168,66 @@ if (run_mode == MODE_EIGENVALUE)
User-identified unique ID of each tally.
*do i = 1, n_tallies*
**/tallies/tally <uid>/estimator** (*char[]*)
**/tallies/tally i/estimator** (*int*)
Type of tally estimator, either 'analog', 'tracklength', or 'collision'.
Type of tally estimator: analog (1) or tracklength (2).
**/tallies/tally <uid>/n_realizations** (*int*)
**/tallies/tally i/n_realizations** (*int*)
Number of realizations.
Number of realizations.
**/tallies/tally <uid>/n_filters** (*int*)
**/tallies/tally i/n_filters** (*int*)
Number of filters used.
Number of filters used.
**/tallies/tally <uid>/filter <j>/type** (*char[]*)
*do j = 1, tallies(i) % n_filters*
Type of the j-th filter. Can be 'universe', 'material', 'cell', 'cellborn',
'surface', 'mesh', 'energy', 'energyout', or 'distribcell'.
**/tallies/tally i/filter j/type** (*int*)
**/tallies/tally <uid>/filter <j>/offset** (*int*)
Type of tally filter.
Filter offset (used for distribcell filter).
**/tallies/tally i/filter j/offset** (*int*)
**/tallies/tally <uid>/filter <j>/n_bins** (*int*)
Filter offset (used for distribcell).
Number of bins for the j-th filter.
**/tallies/tally i/filter j/n_bins** (*int*)
**/tallies/tally <uid>/filter <j>/bins** (*int[]* or *double[]*)
Number of bins for filter.
Value for each filter bin of this type.
**/tallies/tally i/filter j/bins** (*int[]* or *double[]*)
**/tallies/tally <uid>/nuclides** (*char[][]*)
Value for each filter bin of this type.
Array of nuclides to tally. Note that if no nuclide is specified in the user
input, a single 'total' nuclide appears here.
**/tallies/tally i/n_nuclides** (*int*)
**/tallies/tally <uid>/n_score_bins** (*int*)
Number of nuclide bins. If none are specified, this is just one.
Number of scoring bins for a single nuclide. In general, this can be greater
than the number of user-specified scores since each score might have
multiple scoring bins, e.g., scatter-PN.
**/tallies/tally i/nuclides** (*int[]*)
**/tallies/tally <uid>/score_bins** (*char[][]*)
Values of specified nuclide bins (ZAID identifiers)
Values of specified scores.
**/tallies/tally i/n_score_bins** (*int*)
**/tallies/tally <uid>/n_user_scores** (*int*)
Number of scoring bins.
Number of scores without accounting for those added by expansions,
e.g. scatter-PN.
**/tallies/tally i/score_bins** (*int*)
**/tallies/tally <uid>/moment_orders** (*char[][]*)
Values of specified scoring bins (e.g. SCORE_FLUX).
Tallying moment orders for Legendre and spherical harmonic tally expansions
(*e.g.*, 'P2', 'Y1,2', etc.).
**/tallies/tally i/n_user_score_bins**
**/tallies/tally <uid>/results** (Compound type)
Number of scoring bins without accounting for those added by
expansions, e.g. scatter-PN.
*do J = 1, total number of moments*
**/tallies/tally i/moments/orderJ** (*char[8]*)
Tallying moment order for Legendre and spherical
harmonic tally expansions (*e.g.*, 'P2', 'Y1,2', etc.).
Accumulated sum and sum-of-squares for each bin of the i-th tally. This is a
two-dimensional array, the first dimension of which represents combinations
of filter bins and the second dimensions of which represents scoring
bins. Each element of the array has fields 'sum' and 'sum_sq'.
**/source_present** (*int*)
@ -261,13 +250,7 @@ if (run_mode == MODE_EIGENVALUE)
Flag indicated if tallies are present in the file.
*do i = 1, n_tallies*
**/tallies/tally i/results** (Compound type)
Accumulated sum and sum-of-squares for each bin of the tally i-th tally
if (run_mode == MODE_EIGENVALUE and source_present)
if (run_mode == 'k-eigenvalue' and source_present > 0)
**/source_bank** (Compound type)

View file

@ -0,0 +1,310 @@
.. _usersguide_summary:
===================
Summary File Format
===================
The current revision of the summary file format is 1.
**/filetype** (*char[]*)
String indicating the type of file.
**/revision** (*int*)
Revision of the summary file format. Any time a change is made in the
format, this integer is incremented.
**/version_major** (*int*)
Major version number for OpenMC
**/version_minor** (*int*)
Minor version number for OpenMC
**/version_release** (*int*)
Release version number for OpenMC
**/date_and_time** (*char[]*)
Date and time the summary was written.
**/n_procs** (*int*)
Number of MPI processes used.
**/n_particles** (*int8_t*)
Number of particles used per generation.
**/n_batches** (*int*)
Number of batches to simulate.
**/n_inactive** (*int*)
Number of inactive batches. Only present if /run_mode is set to
'k-eigenvalue'.
**/n_active** (*int*)
Number of active batches. Only present if /run_mode is set to
'k-eigenvalue'.
**/gen_per_batch** (*int*)
Number of generations per batch. Only present if /run_mode is set to
'k-eigenvalue'.
**/geometry/n_cells** (*int*)
Number of cells in the problem.
**/geometry/n_surfaces** (*int*)
Number of surfaces in the problem.
**/geometry/n_universes** (*int*)
Number of unique universes in the problem.
**/geometry/n_lattices** (*int*)
Number of lattices in the problem.
**/geometry/cells/cell <uid>/index** (*int*)
Index in cells array used internally in OpenMC.
**/geometry/cells/cell <uid>/name** (*char[]*)
Name of the cell.
**/geometry/cells/cell <uid>/universe** (*int*)
Universe assigned to the cell. If none is specified, the default
universe (0) is assigned.
**/geometry/cells/cell <uid>/fill_type** (*char[]*)
Type of fill for the cell. Can be 'normal', 'universe', or 'lattice'.
**/geometry/cells/cell <uid>/material** (*int*)
Unique ID of the material assigned to the cell. This dataset is present only
if fill_type is set to 'normal'.
**/geometry/cells/cell <uid>/offset** (*int[]*)
Offsets used for distribcell tally filter. This dataset is present only if
fill_type is set to 'universe'.
**/geometry/cells/cell <uid>/translation** (*double[3]*)
Translation applied to the fill universe. This dataset is present only if
fill_type is set to 'universe'.
**/geometry/cells/cell <uid>/rotation** (*double[3]*)
Angles in degrees about the x-, y-, and z-axes for which the fill universe
should be rotated. This dataset is present only if fill_type is set to
'universe'.
**/geometry/cells/cell <uid>/lattice** (*int*)
Unique ID of the lattice which fills the cell. Only present if fill_type is
set to 'lattice'.
**/geometry/cells/cell <uid>/surfaces** (*int[]*)
Surface specification for the cell.
**/geometry/surfaces/surface <uid>/index** (*int*)
Index in surfaces array used internally in OpenMC.
**/geometry/surfaces/surface <uid>/name** (*char[]*)
Name of the surface.
**/geometry/surfaces/surface <uid>/type** (*char[]*)
Type of the surface. Can be 'x-plane', 'y-plane', 'z-plane', 'plane',
'x-cylinder', 'y-cylinder', 'sphere', 'x-cone', 'y-cone', or 'z-cone'.
**/geometry/surfaces/surface <uid>/coefficients** (*double[]*)
Array of coefficients that define the surface. See :ref:`surface_element`
for what coefficients are defined for each surface type.
**/geometry/surfaces/surface <uid>/boundary_condition** (*char[]*)
Boundary condition applied to the surface. Can be 'transmission', 'vacuum',
'reflective', or 'periodic'.
**/geometry/universes/universe <uid>/index** (*int*)
Index in the universes array used internally in OpenMC.
**/geometry/universes/universe <uid>/cells** (*int[]*)
Array of unique IDs of cells that appear in the universe.
**/geometry/lattices/lattice <uid>/index** (*int*)
Index in the lattices array used internally in OpenMC.
**/geometry/lattices/lattice <uid>/name** (*char[]*)
Name of the lattice.
**/geometry/lattices/lattice <uid>/type** (*char[]*)
Type of the lattice, either 'rectangular' or 'hexagonal'.
**/geometry/lattices/lattice <uid>/pitch** (*double[]*)
Pitch of the lattice.
**/geometry/lattices/lattice <uid>/outer** (*int*)
Outer universe assigned to lattice cells outside the defined range.
**/geometry/lattices/lattice <uid>/offsets** (*int[]*)
Offsets used for distribcell tally filter.
**/geometry/lattices/lattice <uid>/universes** (*int[]*)
Three-dimensional array of universes assigned to each cell of the lattice.
**/geometry/lattices/lattice <uid>/dimension** (*int[]*)
The number of lattice cells in each direction. This dataset is present only
when the 'type' dataset is set to 'rectangular'.
**/geometry/lattices/lattice <uid>/lower_left** (*double[]*)
The coordinates of the lower-left corner of the lattice. This dataset is
present only when the 'type' dataset is set to 'rectangular'.
**/geometry/lattices/lattice <uid>/n_rings** (*int*)
Number of radial ring positions in the xy-plane. This dataset is present
only when the 'type' dataset is set to 'hexagonal'.
**/geometry/lattices/lattice <uid>/n_axial** (*int*)
Number of lattice positions along the z-axis. This dataset is present only
when the 'type' dataset is set to 'hexagonal'.
**/geometry/lattices/lattice <uid>/center** (*double[]*)
Coordinates of the center of the lattice. This dataset is present only when
the 'type' dataset is set to 'hexagonal'.
**/n_materials** (*int*)
Number of materials in the problem.
**/materials/material <uid>/index** (*int*)
Index in materials array used internally in OpenMC.
**/materials/material <uid>/name** (*char[]*)
Name of the material.
**/materials/material <uid>/atom_density** (*double[]*)
Total atom density of the material in atom/b-cm.
**/materials/material <uid>/nuclides** (*char[][]*)
Array of nuclides present in the material, e.g., 'U-235.71c'.
**/materials/material <uid>/nuclide_densities** (*double[]*)
Atom density of each nuclide.
**/materials/material <uid>/sab_names** (*char[][]*)
Names of S(:math:`\alpha`,:math:`\beta`) tables assigned to the material.
**/tallies/n_tallies** (*int*)
Number of tallies in the problem.
**/tallies/n_meshes** (*int*)
Number of meshes in the problem.
**/tallies/mesh <uid>/index** (*int*)
Index in the meshes array used internally in OpenMC.
**/tallies/mesh <uid>/type** (*char[]*)
Type of the mesh. The only valid option is currently 'regular'.
**/tallies/mesh <uid>/dimension** (*int[]*)
Number of mesh cells in each direction.
**/tallies/mesh <uid>/lower_left** (*double[]*)
Coordinates of the lower-left corner of the mesh.
**/tallies/mesh <uid>/upper_right** (*double[]*)
Coordinates of the upper-right corner of the mesh.
**/tallies/mesh <uid>/width** (*double[]*)
Width of a single mesh cell in each direction.
**/tallies/tally <uid>/index** (*int*)
Index in tallies array used internally in OpenMC.
**/tallies/tally <uid>/name** (*char[]*)
Name of the tally.
**/tallies/tally <uid>/n_filters** (*int*)
Number of filters applied to the tally.
**/tallies/tally <uid>/filter <j>/type** (*char[]*)
Type of the j-th filter. Can be 'universe', 'material', 'cell', 'cellborn',
'surface', 'mesh', 'energy', 'energyout', or 'distribcell'.
**/tallies/tally <uid>/filter <j>/offset** (*int*)
Filter offset (used for distribcell filter).
**/tallies/tally <uid>/filter <j>/n_bins** (*int*)
Number of bins for the j-th filter.
**/tallies/tally <uid>/filter <j>/bins** (*int[]* or *double[]*)
Value for each filter bin of this type.
**/tallies/tally <uid>/nuclides** (*char[][]*)
Array of nuclides to tally. Note that if no nuclide is specified in the user
input, a single 'total' nuclide appears here.
**/tallies/tally <uid>/n_score_bins** (*int*)
Number of scoring bins for a single nuclide. In general, this can be greater
than the number of user-specified scores since each score might have
multiple scoring bins, e.g., scatter-PN.
**/tallies/tally <uid>/score_bins** (*char[][]*)
Scoring bins for the tally.

View file

@ -6,11 +6,9 @@ Track File Format
The current revision of the particle track file format is 1.
**/filetype** (*int*)
**/filetype** (*char[]*)
Flags what type of file this is. A value of -1 indicates a statepoint file,
a value of -2 indicates a particle restart file, a value of -3 indicates a
source file, and a value of -4 indicates a track file.
String indicating the type of file.
**/revision** (*int*)

View file

@ -0,0 +1,25 @@
.. _usersguide_voxel:
======================
Voxel Plot File Format
======================
**/filetype** (*char[]*)
String indicating the type of file.
**/num_voxels** (*int[3]*)
Number of voxels in the x-, y-, and z- directions.
**/voxel_width** (*double[3]*)
Width of a voxel in centimeters.
**/lower_left** (*double[3]*)
Cartesian coordinates of the lower-left corner of the plot.
**/data** (*int[][][]*)
Data for each voxel that represents a material or cell ID.

View file

@ -6,31 +6,34 @@ Data Processing and Visualization
This section is intended to explain in detail the recommended procedures for
carrying out common post-processing tasks with OpenMC. While several utilities
of varying complexity are provided to help automate the process, in many cases
it will be extremely beneficial to do some coding in Python to quickly obtain
results. In these cases, and for many of the provided utilities, it is necessary
for your Python installation to contain:
of varying complexity are provided to help automate the process, the most
powerful capabilities for post-processing derive from use of the :ref:`Python
API <pythonapi>`. Both the provided scripts and the Python API rely on a number
third-party Python packages, including:
* [1]_ `Numpy <http://www.numpy.org/>`_
* [1]_ `Scipy <http://www.scipy.org/>`_
* [2]_ `h5py <http://code.google.com/p/h5py/>`_
* [3]_ `Matplotlib <http://matplotlib.org/>`_
* [3]_ `Silomesh <https://github.com/nhorelik/silomesh>`_
* [3]_ `VTK <http://www.vtk.org/>`_
* [1]_ `NumPy <http://www.numpy.org/>`_
* [2]_ `h5py <http://www.h5py.org>`_
* [3]_ `pandas <http://pandas.pydata.org>`_
* [4]_ `matplotlib <http://matplotlib.org/>`_
* [4]_ `Silomesh <https://github.com/nhorelik/silomesh>`_
* [4]_ `VTK <http://www.vtk.org/>`_
* [4]_ `lxml <http://lxml.de>`_
Most of these are easily obtainable in Ubuntu through the package manager, or
are easily installed with distutils.
Most of these are can easily be installed with `pip <https://pip.pypa.io>`_
or alternatively obtaining through a package manager.
.. [1] Required for tally data extraction from statepoints with statepoint.py
.. [2] Required only if reading HDF5 statepoint files.
.. [3] Optional for plotting utilities
.. [1] Required for most post-processing tasks
.. [2] Required for reading HDF5 output files
.. [3] Optional dependency for advanced features in Python API
.. [4] Not used directly by the Python API, but are optional dependencies for a
number of scripts.
----------------------
Geometry Visualization
----------------------
Geometry plotting is carried out by creating a plots.xml, specifying plots, and
running OpenMC with the -plot or -p command-line option (See
running OpenMC with the --plot or -p command-line option (See
:ref:`usersguide_plotting`).
Plotting in 2D
@ -128,27 +131,26 @@ capabilities of 3D voxel plots.
Voxel plots are built the same way 2D slice plots are, by determining the cell
or material id of a particle at the center of each voxel. In this example, the
space covered is the cube between the points (-5,-5,-5) and (5,5,5), with voxel
centers 10/500 = 0.02 cm apart. The binary VOXEL files that are produced do not
centers 10/500 = 0.02 cm apart. The HDF5 voxel files that are produced do not
specify any color - instead containing only material or cell ids (material id
in this example) - and thus the ``background``, ``col_spec``, and ``mask``
elements are not used. If no cell is found at a voxel center, an id of -1 is
stored.
The binary VOXEL files output by OpenMC can not be viewed directly by any
existing viewers. In order to view them, they must be converted into a standard
mesh format that can be viewed in ParaView, Visit, etc. This typically will
compress the size of the file significantly. The provided utility voxel.py
accomplishes this for SILO:
The voxel plot data is written to an HDF5 file. The voxel file can subsequently
be converted into a standard mesh format that can be viewed in ParaView, Visit,
etc. This typically will compress the size of the file significantly. The
provided utility openmc-voxel-to-silovtk accomplishes this for SILO:
.. code-block:: sh
<openmc_root>/src/utils/voxel.py myplot.voxel -o output.silo
openmc-voxel-to-silovtk myplot.voxel -o output.silo
and VTK file formats:
.. code-block:: sh
<openmc_root>/src/utils/voxel.py myplot.voxel --vtk -o output.vti
openmc-voxel-to-silovtk myplot.voxel --vtk -o output.vti
To use this utility you need either
@ -156,11 +158,10 @@ To use this utility you need either
or
* `VTK <http://www.vtk.org/>`_ with python bindings - On Ubuntu, these are
easily obtained with ``sudo apt-get install python-vtk``
* `VTK <http://www.vtk.org/>`_ with python bindings. On debian derivatives,
these are easily obtained with ``sudo apt-get install python-vtk``
Users can process the binary into any other format if desired by following the
example of voxel.py. For the binary file structure, see :ref:`devguide_voxel`.
For the HDF5 file structure, see :ref:`usersguide_voxel`.
Once processed into a standard 3D file format, colors and masks can be defined
using the stored id numbers to better explore the geometry. The process for
@ -183,150 +184,38 @@ doing this will depend on the 3D viewer, but should be straightforward.
Tally Visualization
-------------------
Tally results are saved in both a text file (tallies.out) as well as a binary
Tally results are saved in both a text file (tallies.out) as well as an HDF5
statepoint file. While the tallies.out file may be fine for simple tallies, in
many cases the user requires more information about the tally or the run, or
has to deal with a large number of result values (e.g. for mesh tallies). In
these cases, extracting data from the statepoint file via Python scripting is
the preferred method of data analysis and visualization.
many cases the user requires more information about the tally or the run, or has
to deal with a large number of result values (e.g. for mesh tallies). In these
cases, extracting data from the statepoint file via the :ref:`pythonapi` is the
preferred method of data analysis and visualization.
Data Extraction
---------------
A great deal of information is available in statepoint files (See
:ref:`usersguide_statepoint`), most of which is easily extracted by the provided
utility statepoint.py. This utility provides a Python class to load statepoints
and extract data - it is used in many of the provided plotting utilities, and
can be used in user-created scripts to carry out manipulations of the data. To
read tallies using this utility, make sure statepoint.py is in your PYTHONPATH,
and then import the class, instantiate it, and call read_results:
:ref:`usersguide_statepoint`), all of which is accessible through the Python
API. The ``openmc.statepoint`` module (see :ref:`pythonapi_statepoint`) provides
a class to load statepoints and access data as requested; it is used in many of
the provided plotting utilities, OpenMC's regression test suite, and can be used
in user-created scripts to carry out manipulations of the data.
.. code-block:: python
from statepoint import StatePoint
sp = StatePoint('statepoint.100.binary')
sp.read_results()
At this point the user can extract entire scores from tallies into a data
dictionary containing numpy arrays:
.. code-block:: python
tallyid = 1
score = 'flux'
data = sp.extract_results(tallyid, score)
means = data['means']
print data.keys()
The results from this function contain all filter bins (all mesh points, all
energy groups, etc.), which can be reshaped with the bin ordering also contained
in the output dictionary. This is the best choice of output for easily
integrating ranges of data.
Alternatively the user can extract specific values for a single score/filter
combination:
.. code-block:: python
tallyid = 1
score = 'flux'
filters = [('mesh', (1, 1, 5)), ('energyin', 0)]
value, error = sp.get_value(tallyid, filters, score)
In the future more documentation may become available here for statepoint.py and
the data extraction functions of StatePoint objects. However, for now it is up
to the user to explore the classes in statepoint.py to discover what data is
available in StatePoint objects (we highly recommend interactively exploring
with `IPython <http://ipython.org/>`_). Many examples can be found by looking
through the other utilities that use statepoint.py, and a few common
visualization tasks will be described here in the following sections.
An :ref:`example IPython notebook <notebook_post_processing>` demonstrates how
to extract data from a statepoint using the Python API.
Plotting in 2D
--------------
The :ref:`IPython notebook example <notebook_post_processing>` also demonstrates
how to plot a mesh tally in two dimensions using the Python API. Note, however,
that there is also a script distributed with OpenMC, ``openmc-plot-mesh-tally``,
that provides an interactive GUI to explore and plot mesh tallies for any scores
and filter bins.
.. image:: ../_images/plotmeshtally.png
:height: 200px
For simple viewing of 2D slices of a mesh plot, the utility plot_mesh_tally.py
is provided. This utility provides an interactive GUI to explore and plot
mesh tallies for any scores and filter bins. It requires statepoint.py.
.. image:: ../_images/fluxplot.png
:height: 200px
Alternatively, the user can write their own Python script to manipulate the data
appropriately. Consider a run where the first tally contains a 105x105x20 mesh
over a small core, with a flux score and two energyin filter bins. To explicitly
extract the data and create a plot with gnuplot, the following script can be
used. The script operates in several steps for clarity, and is not necessarily
the most efficient way to extract data from large mesh tallies. This creates the
two heatmaps in the previous figure.
.. code-block:: python
#!/usr/bin/env python
import os
import statepoint
# load and parse the statepoint file
sp = statepoint.StatePoint('statepoint.300.binary')
sp.read_results()
tallyid = 0 # This is tally 1
score = 0 # This corresponds to flux (see tally.scores)
# get mesh dimensions
meshid = sp.tallies[tallyid].filters['mesh'].bins[0]
for i,m in enumerate(sp.meshes):
if m.id == meshid:
mesh = m
break
nx,ny,nz = mesh.dimension
# loop through mesh and extract values to python dictionaries
thermal = {}
fast = {}
for x in range(1,nx+1):
for y in range(1,ny+1):
for z in range(1,nz+1):
val,err = sp.get_value(tallyid,
[('mesh',(x,y,z)),('energyin',0)],
score)
thermal[(x,y,z)] = val
val,err = sp.get_value(tallyid,
[('mesh',(x,y,z)),('energyin',1)],
score)
fast[(x,y,z)] = val
# sum up the axial values and write datafile for gnuplot
with open('meshdata.dat','w') as fh:
for x in range(1,nx+1):
for y in range(1,ny+1):
thermalval = 0.
fastval = 0.
for z in range(1,nz+1):
thermalval += thermal[(x,y,z)]
fastval += fast[(x,y,z)]
fh.write("{} {} {} {}\n".format(x,y,thermalval,fastval))
# write gnuplot file
with open('tmp.gnuplot','w') as fh:
fh.write(r"""set terminal png size 1000 400
set output 'fluxplot.png'
set nokey
set autoscale fix
set multiplot layout 1,2 title "Pin Mesh Flux Tally"
set title "Thermal"
plot 'meshdata.dat' using 1:2:3 with image
set title "Fast"
plot 'meshdata.dat' using 1:2:4 with image
""")
# make plot
os.system("gnuplot < tmp.gnuplot")
Plotting in 3D
--------------
@ -334,22 +223,23 @@ Plotting in 3D
:height: 200px
As with 3D plots of the geometry, meshtally data needs to be put into a standard
format for viewing. The utility statepoint_3d.py is provided to accomplish this
for both VTK and SILO. By default statepoint_3d.py processes a statepoint into a
3D file with all mesh tallies and filter/score combinations,
format for viewing. The utility ``openmc-statepoint-3d`` is provided to
accomplish this for both VTK and SILO. By default ``openmc-statepoint-3d``
processes a statepoint into a 3D file with all mesh tallies and filter/score
combinations,
.. code-block:: sh
<openmc_root>/src/utils/statepoint_3d.py <statepoint_file> -o output.silo
<openmc_root>/src/utils/statepoint_3d.py <statepoint_file> --vtk -o output.vtm
openmc-statepoint-3d <statepoint_file> -o output.silo
openmc-statepoint-3d <statepoint_file> --vtk -o output.vtm
but it also provides several command-line options to selectively process only
certain data arrays in order to keep file sizes down.
.. code-block:: sh
statepoint_3d.py <statepoint_file> --tallies 2,4 --scores 4.1,4.3 -o output.silo
statepoint_3d.py <statepoint_file> --filters 2.energyin.1 --vtk -o output.vtm
openmc-statepoint-3d <statepoint_file> --tallies 2,4 --scores 4.1,4.3 -o output.silo
openmc-statepoint-3d <statepoint_file> --filters 2.energyin.1 --vtk -o output.vtm
All available options for specifying a subset of tallies, scores, and filters
can be listed with the ``--list`` or ``-l`` command line options.
@ -426,13 +316,11 @@ Getting Data into MATLAB
------------------------
There is currently no front-end utility to dump tally data to MATLAB files, but
the process is straightforward. First extract the data using a custom Python
script with statepoint.py, put the data into appropriately-shaped numpy arrays,
and then use the `Scipy MATLAB IO routines
the process is straightforward. First extract the data using the Python API via
``openmc.statepoint`` and then use the `Scipy MATLAB IO routines
<http://docs.scipy.org/doc/scipy/reference/tutorial/io.html>`_ to save to a MAT
file. Note that the data contained in the output from
``StatePoint.extract_result`` is already in a Numpy array that can be reshaped
and dumped to MATLAB in one step.
file. Note that all arrays that are accessible in a statepoint are already in
NumPy arrays that can be reshaped and dumped to MATLAB in one step.
----------------------------
Particle Track Visualization
@ -463,15 +351,15 @@ particle numbers, respectively. For example, to output the tracks for particles
</track>
After running OpenMC, the directory should contain a file of the form
"track_(batch #)_(generation #)_(particle #).(binary or h5)" for each particle
tracked. These track files can be converted into VTK poly data files with the
"track.py" utility. The usage of track.py is of the form "track.py [-o OUT] IN"
where OUT is the optional output filename and IN is one or more filenames
describing track files. The default output name is "track.pvtp". A common
usage of track.py is "track.py track*.binary" which will use the data from all
binary track files in the directory to write a "track.pvtp" VTK output file.
The .pvtp file can then be read and plotted by 3d visualization programs such as
ParaView.
"track_(batch #)_(generation #)_(particle #).h5" for each particle tracked.
These track files can be converted into VTK poly data files with the
``openmc-track-to-vtk`` utility. The usage of ``openmc-track-to-vtk`` is of the
form "openmc-track-to-vtk [-o OUT] IN" where OUT is the optional output filename
and IN is one or more filenames describing track files. The default output name
is "track.pvtp". A common usage of track.py is "openmc-track-to-vtk track*.h5"
which will use the data from all binary track files in the directory to write a
"track.pvtp" VTK output file. The .pvtp file can then be read and plotted by 3d
visualization programs such as ParaView.
----------------------
Source Site Processing
@ -480,43 +368,6 @@ Source Site Processing
For eigenvalue problems, OpenMC will store information on the fission source
sites in the statepoint file by default. For each source site, the weight,
position, sampled direction, and sampled energy are stored. To extract this data
from a statepoint file, the statepoint.py Python module can be used. Below is an
example of an interactive ipython session using the statepoint.py Python module:
.. code-block:: python
In [1]: import statepoint
In [2]: sp = statepoint.StatePoint('statepoint.100.h5')
In [3]: sp.read_source()
In [4]: len(sp.source)
Out[4]: 1000
In [5]: sp.source[0:10]
Out[5]:
[<SourceSite: xyz=[ 2.21980946 -8.92686048 87.93720485] at E=0.932923263566>,
<SourceSite: xyz=[ 2.21980946 -8.92686048 87.93720485] at E=0.349240220512>,
<SourceSite: xyz=[-31.21542213 -30.26762771 72.10845757] at E=3.75843584486>,
<SourceSite: xyz=[-31.21542213 -30.26762771 72.10845757] at E=0.80550137267>,
<SourceSite: xyz=[ 0.18805099 -69.13376508 103.67726838] at E=1.67922461097>,
<SourceSite: xyz=[ 0.18805099 -69.13376508 103.67726838] at E=1.16304110199>,
<SourceSite: xyz=[ -50.42189115 -9.96571672 123.34077905] at E=0.710937974074>,
<SourceSite: xyz=[ -32.80427668 -15.49316628 125.26301151] at E=1.61907104162>,
<SourceSite: xyz=[ 53.20376026 -15.38643708 120.58071044] at E=3.33962024907>,
<SourceSite: xyz=[ 53.20376026 -15.38643708 120.58071044] at E=1.90185680329>]
In [6]: site = sp.source[0]
In [7]: site.weight
Out[7]: 1.0
In [8]: site.xyz
Out[8]: array([ 2.21980946, -8.92686048, 87.93720485])
In [9]: site.uvw
Out[9]: array([ 0.06740523, 0.50612814, 0.85982024])
In [10]: site.E
Out[10]: 0.93292326356564159
from a statepoint file, the ``openmc.statepoint`` module can be used. An
:ref:`example IPython notebook <notebook_post_processing>` demontrates how to
analyze and plot source information.

View file

@ -31,21 +31,6 @@ f951: error: unrecognized command line option "-fbacktrace"
You are probably using a version of the gfortran compiler that is too
old. Download and install the latest version of gfortran_.
make[1]: ifort: Command not found
*********************************
You tried compiling with the Intel Fortran compiler and it was not found on your
:envvar:`PATH`. If you have the Intel compiler installed, make sure the shell
can locate it (this can be tested with :program:`which ifort`).
make[1]: pgf90: Command not found
*********************************
You tried compiling with the PGI Fortran compiler and it was not found on your
:envvar:`PATH`. If you have the PGI compiler installed, make sure the shell can
locate it (this can be tested with :program:`which pgf90`).
-------------------------
Problems with Simulations
-------------------------
@ -56,13 +41,13 @@ Segmentation Fault
A segmentation fault occurs when the program tries to access a variable in
memory that was outside the memory allocated for the program. The best way to
debug a segmentation fault is to re-compile OpenMC with debug options turned
on. First go to your ``openmc/src`` directory where OpenMC was compiled and type
the following commands:
on. Create a new build directory and type the following commands:
.. code-block:: sh
make distclean
make DEBUG=yes
mkdir build-debug && cd build-debug
cmake -Ddebug=on /path/to/openmc
make
Now when you re-run your problem, it should report exactly where the program
failed. If after reading the debug output, you are still unsure why the program

View file

@ -168,7 +168,7 @@ plot_file.export_to_xml()
# Instantiate a tally mesh
mesh = openmc.Mesh(mesh_id=1)
mesh.type = 'rectangular'
mesh.type = 'regular'
mesh.dimension = [4, 4]
mesh.lower_left = [-2, -2]
mesh.width = [1, 1]

View file

@ -157,7 +157,7 @@ plot_file.export_to_xml()
# Instantiate a tally mesh
mesh = openmc.Mesh(mesh_id=1)
mesh.type = 'rectangular'
mesh.type = 'regular'
mesh.dimension = [4, 4]
mesh.lower_left = [-2, -2]
mesh.width = [1, 1]

View file

@ -189,7 +189,7 @@ settings_file.export_to_xml()
# Instantiate a tally mesh
mesh = openmc.Mesh(mesh_id=1)
mesh.type = 'rectangular'
mesh.type = 'regular'
mesh.dimension = [100, 100, 1]
mesh.lower_left = [-0.62992, -0.62992, -1.e50]
mesh.upper_right = [0.62992, 0.62992, 1.e50]

View file

@ -2,7 +2,7 @@
<tallies>
<mesh id="1">
<type>rectangular</type>
<type>regular</type>
<dimension>4 4</dimension>
<lower_left>-2.0 -2.0</lower_left>
<width>1.0 1.0</width>

View file

@ -2,7 +2,7 @@
<tallies>
<mesh id="1">
<type>rectangular</type>
<type>regular</type>
<dimension>4 4</dimension>
<lower_left>-2.0 -2.0</lower_left>
<width>1.0 1.0</width>

View file

@ -1,7 +1,7 @@
<?xml version="1.0"?>
<tallies>
<mesh id="1" type="rectangular">
<mesh id="1" type="regular">
<dimension>100 100 1</dimension>
<lower_left>-0.62992 -0.62992 -1.e50</lower_left>
<upper_right>0.62992 0.62992 1.e50</upper_right>
@ -13,4 +13,4 @@
<scores>flux fission nu-fission</scores>
</tally>
</tallies>
</tallies>

View file

@ -1,123 +0,0 @@
"""Dictionaries of integer-to-string mappings from openmc/src/constants.F90"""
SURFACE_TYPES = {1: 'x-plane',
2: 'y-plane',
3: 'z-plane',
4: 'plane',
5: 'x-cylinder',
6: 'y-cylinder',
7: 'z-cylinder',
8: 'sphere',
9: 'x-cone',
10: 'y-cone',
11: 'z-cone'}
BC_TYPES = {0: 'transmission',
1: 'vacuum',
2: 'reflective',
3: 'periodic'}
FILL_TYPES = {1: 'normal',
2: 'fill',
3: 'lattice'}
LATTICE_TYPES = {1: 'rectangular',
2: 'hexagonal'}
ESTIMATOR_TYPES = {1: 'analog',
2: 'tracklength'}
FILTER_TYPES = {1: 'universe',
2: 'material',
3: 'cell',
4: 'cellborn',
5: 'surface',
6: 'mesh',
7: 'energy',
8: 'energyout',
9: 'distribcell'}
SCORE_TYPES = {-1: 'flux',
-2: 'total',
-3: 'scatter',
-4: 'nu-scatter',
-5: 'scatter-n',
-6: 'scatter-pn',
-7: 'nu-scatter-n',
-8: 'nu-scatter-pn',
-9: 'transport',
-10: 'n1n',
-11: 'absorption',
-12: 'fission',
-13: 'nu-fission',
-14: 'kappa-fission',
-15: 'current',
-16: 'flux-yn',
-17: 'total-yn',
-18: 'scatter-yn',
-19: 'nu-scatter-yn',
-20: 'events',
1: '(n,total)',
2: '(n,elastic)',
4: '(n,level)',
11: '(n,2nd)',
16: '(n,2n)',
17: '(n,3n)',
18: '(n,fission)',
19: '(n,f)',
20: '(n,nf)',
21: '(n,2nf)',
22: '(n,na)',
23: '(n,n3a)',
24: '(n,2na)',
25: '(n,3na)',
28: '(n,np)',
29: '(n,n2a)',
30: '(n,2n2a)',
32: '(n,nd)',
33: '(n,nt)',
34: '(n,nHe-3)',
35: '(n,nd2a)',
36: '(n,nt2a)',
37: '(n,4n)',
38: '(n,3nf)',
41: '(n,2np)',
42: '(n,3np)',
44: '(n,n2p)',
45: '(n,npa)',
91: '(n,nc)',
101: '(n,disappear)',
102: '(n,gamma)',
103: '(n,p)',
104: '(n,d)',
105: '(n,t)',
106: '(n,3He)',
107: '(n,a)',
108: '(n,2a)',
109: '(n,3a)',
111: '(n,2p)',
112: '(n,pa)',
113: '(n,t2a)',
114: '(n,d2a)',
115: '(n,pd)',
116: '(n,pt)',
117: '(n,da)',
201: '(n,Xn)',
202: '(n,Xgamma)',
203: '(n,Xp)',
204: '(n,Xd)',
205: '(n,Xt)',
206: '(n,X3He)',
207: '(n,Xa)',
444: '(damage)',
649: '(n,pc)',
699: '(n,dc)',
749: '(n,tc)',
799: '(n,3Hec)',
849: '(n,tc)'}
SCORE_TYPES.update({MT: '(n,n' + str(MT-50) + ')' for MT in range(51,91)})
SCORE_TYPES.update({MT: '(n,p' + str(MT-600) + ')' for MT in range(600,649)})
SCORE_TYPES.update({MT: '(n,d' + str(MT-650) + ')' for MT in range(650,699)})
SCORE_TYPES.update({MT: '(n,t' + str(MT-700) + ')' for MT in range(700,749)})
SCORE_TYPES.update({MT: '(n,3He' + str(MT-750) + ')' for MT in range(750,649)})
SCORE_TYPES.update({MT: '(n,a' + str(MT-800) + ')' for MT in range(800,849)})

View file

@ -15,6 +15,9 @@ if sys.version_info[0] >= 3:
basestring = str
_FILTER_TYPES = ['universe', 'material', 'cell', 'cellborn', 'surface',
'mesh', 'energy', 'energyout', 'distribcell']
class Filter(object):
"""A filter used to constrain a tally to a specific criterion, e.g. only
tally events when the particle is in a certain cell and energy range.
@ -135,7 +138,9 @@ class Filter(object):
@type.setter
def type(self, type):
if type not in FILTER_TYPES.values():
if type is None:
self._type = type
elif type not in _FILTER_TYPES:
msg = 'Unable to set Filter type to "{0}" since it is not one ' \
'of the supported types'.format(type)
raise ValueError(msg)

View file

@ -56,7 +56,7 @@ class Mesh(object):
# Initialize Mesh class attributes
self.id = mesh_id
self.name = name
self._type = 'rectangular'
self._type = 'regular'
self._dimension = None
self._lower_left = None
self._upper_right = None
@ -158,7 +158,7 @@ class Mesh(object):
cv.check_type('type for mesh ID="{0}"'.format(self._id),
meshtype, basestring)
cv.check_value('type for mesh ID="{0}"'.format(self._id),
meshtype, ['rectangular', 'hexagonal'])
meshtype, ['regular'])
self._type = meshtype
@dimension.setter

View file

@ -246,9 +246,6 @@ class MultiGroupXS(object):
cv.check_type('statepoint', statepoint, openmc.statepoint.StatePoint)
# Ensure that tally metadata has been loaded from the statepoint file
statepoint.read_results()
# Create Tallies to search for in StatePoint
self.create_tallies()
@ -1304,4 +1301,4 @@ class Chi(MultiGroupXS):
nu_fission_out = self.tallies['nu-fission-out']
self._xs_tally = nu_fission_out / nu_fission_in
self._xs_tally._mean = np.nan_to_num(self.xs_tally.mean)
self._xs_tally._std_dev = np.nan_to_num(self.xs_tally.std_dev)
self._xs_tally._std_dev = np.nan_to_num(self.xs_tally.std_dev)

View file

@ -12,10 +12,6 @@ class Particle(object):
Attributes
----------
filetype : int
Integer indicating the file type
revision : int
Revision of the particle restart format
current_batch : int
The batch containing the particle
gen_per_batch : int
@ -43,28 +39,52 @@ class Particle(object):
import h5py
self._f = h5py.File(filename, 'r')
# Read all metadata
self._read_data()
# Ensure filetype and revision are correct
if 'filetype' not in self._f or self._f[
'filetype'].value.decode() != 'particle restart':
raise IOError('{} is not a particle restart file.'.format(filename))
if self._f['revision'].value != 1:
raise IOError('Particle restart file has a file revision of {} '
'which is not consistent with the revision this '
'version of OpenMC expects ({}).'.format(
self._f['revision'].value, 1))
def _read_data(self):
# Read filetype
self.filetype = self._f['filetype'].value
@property
def current_batch(self):
return self._f['current_batch'].value
# Read statepoint revision
self.revision = self._f['revision'].value
@property
def current_gen(self):
return self._f['current_gen'].value
# Read current batch
self.current_batch = self._f['current_batch'].value
@property
def energy(self):
return self._f['energy'].value
# Read run information
self.gen_per_batch = self._f['gen_per_batch'].value
self.current_gen = self._f['current_gen'].value
self.n_particles = self._f['n_particles'].value
self.run_mode = self._f['run_mode'].value
@property
def gen_per_batch(self):
return self._f['gen_per_batch'].value
# Read particle properties
self.id = self._f['id'].value
self.weight = self._f['weight'].value
self.energy = self._f['energy'].value
self.xyz = self._f['xyz'].value
self.uvw = self._f['uvw'].value
@property
def id(self):
return self._f['id'].value
@property
def n_particles(self):
return self._f['n_particles'].value
@property
def run_mode(self):
return self._f['run_mode'].value.decode()
@property
def uvw(self):
return self._f['uvw'].value
@property
def weight(self):
return self._f['weight'].value
@property
def xyz(self):
return self._f['xyz'].value

View file

@ -2,62 +2,13 @@ import copy
import sys
import numpy as np
import scipy.stats
import openmc
from openmc.constants import *
if sys.version > '3':
long = int
class SourceSite(object):
"""A single source site produced from fission.
Attributes
----------
weight : float
Weight of the particle arising from the site
xyz : list of float
Cartesian coordinates of the site
uvw : list of float
Directional cosines for particles emerging from the site
E : float
Energy of the emerging particle in MeV
"""
def __init__(self):
self._weight = None
self._xyz = None
self._uvw = None
self._E = None
def __repr__(self):
string = 'SourceSite\n'
string += '{0: <16}{1}{2}\n'.format('\tweight', '=\t', self._weight)
string += '{0: <16}{1}{2}\n'.format('\tE', '=\t', self._E)
string += '{0: <16}{1}{2}\n'.format('\t(x,y,z)', '=\t', self._xyz)
string += '{0: <16}{1}{2}\n'.format('\t(u,v,w)', '=\t', self._uvw)
return string
@property
def weight(self):
return self._weight
@property
def xyz(self):
return self._xyz
@property
def uvw(self):
return self._uvw
@property
def E(self):
return self._E
class StatePoint(object):
"""State information on a simulation at a certain point in time (at the end of a
given batch). Statepoints can be used to analyze tally results as well as
@ -65,28 +16,74 @@ class StatePoint(object):
Attributes
----------
cmfd_on : bool
Indicate whether CMFD is active
cmfd_balance : ndarray
Residual neutron balance for each batch
cmfd_dominance
Dominance ratio for each batch
cmfd_entropy : ndarray
Shannon entropy of CMFD fission source for each batch
cmfd_indices : ndarray
Number of CMFD mesh cells and energy groups. The first three indices
correspond to the x-, y-, and z- spatial directions and the fourth index
is the number of energy groups.
cmfd_srccmp : ndarray
Root-mean-square difference between OpenMC and CMFD fission source for
each batch
cmfd_src : ndarray
CMFD fission source distribution over all mesh cells and energy groups.
current_batch : int
Number of batches simulated
date_and_time : str
Date and time when simulation began
entropy : ndarray
Shannon entropy of fission source at each batch
gen_per_batch : int
Number of fission generations per batch
global_tallies : ndarray of compound datatype
Global tallies for k-effective estimates and leakage. The compound
datatype has fields 'name', 'sum', 'sum_sq', 'mean', and 'std_dev'.
k_combined : list
Combined estimator for k-effective and its uncertainty
n_particles : int
Number of particles per generation
k_col_abs : float
Cross-product of collision and absorption estimates of k-effective
k_col_tra : float
Cross-product of collision and tracklength estimates of k-effective
k_abs_tra : float
Cross-product of absorption and tracklength estimates of k-effective
k_generation : ndarray
Estimate of k-effective for each batch/generation
meshes : dict
Dictionary whose keys are mesh IDs and whose values are Mesh objects
n_batches : int
Number of batches
current_batch :
Number of batches simulated
results : bool
Indicate whether tally results have been read
source : ndarray of SourceSite
Array of source sites
with_summary : bool
Indicate whether statepoint data has been linked against a summary file
n_inactive : int
Number of inactive batches
n_particles : int
Number of particles per generation
n_realizations : int
Number of tally realizations
path : str
Working directory for simulation
run_mode : str
Simulation run mode, e.g. 'k-eigenvalue'
seed : int
Pseudorandom number generator seed
source : ndarray of compound datatype
Array of source sites. The compound datatype has fields 'wgt', 'xyz',
'uvw', and 'E' corresponding to the weight, position, direction, and
energy of the source site.
source_present : bool
Indicate whether source sites are present
tallies : dict
Dictionary whose keys are tally IDs and whose values are Tally objects
tallies_present : bool
Indicate whether user-defined tallies are present
global_tallies : ndarray
Global tallies and their uncertainties
n_realizations : int
Number of tally realizations
version: tuple of int
Version of OpenMC
with_summary : bool
Indicate whether statepoint data has been linked against a summary file
"""
@ -94,474 +91,375 @@ class StatePoint(object):
import h5py
self._f = h5py.File(filename, 'r')
# Ensure filetype and revision are correct
if 'filetype' not in self._f or self._f[
'filetype'].value.decode() != 'statepoint':
raise IOError('{} is not a statepoint file.'.format(filename))
if self._f['revision'].value != 14:
raise IOError('Statepoint file has a file revision of {} '
'which is not consistent with the revision this '
'version of OpenMC expects ({}).'.format(
self._f['revision'].value, 14))
# Set flags for what data has been read
self._results = False
self._source = False
self._meshes_read = False
self._tallies_read = False
self._with_summary = False
# Read all metadata
self._read_metadata()
# Read information about tally meshes
self._read_meshes()
# Read tally metadata
self._read_tallies()
self._global_tallies = None
def close(self):
self._f.close()
@property
def k_combined(self):
return self._k_combined
def cmfd_on(self):
return self._f['cmfd_on'].value > 0
@property
def n_particles(self):
return self._n_particles
def cmfd_balance(self):
if self.cmfd_on:
return self._f['cmfd/cmfd_balance'].value
else:
return None
@property
def n_batches(self):
return self._n_batches
def cmfd_dominance(self):
if self.cmfd_on:
return self._f['cmfd/cmfd_dominance'].value
else:
return None
@property
def cmfd_entropy(self):
if self.cmfd_on:
return self._f['cmfd/cmfd_entropy'].value
else:
return None
@property
def cmfd_indices(self):
if self.cmfd_on:
return self._f['cmfd/indices'].value
else:
return None
@property
def cmfd_src(self):
if self.cmfd_on:
data = self._f['cmfd/cmfd_src'].value
return np.reshape(data, tuple(self.cmfd_indices), order='F')
else:
return None
@property
def cmfd_srccmp(self):
if self.cmfd_on:
return self._f['cmfd/cmfd_srccmp'].value
else:
return None
@property
def current_batch(self):
return self._current_batch
return self._f['current_batch'].value
@property
def results(self):
return self._results
def date_and_time(self):
return self._f['date_and_time'].value.decode()
@property
def entropy(self):
if self.run_mode == 'k-eigenvalue':
return self._f['entropy'].value
else:
return None
@property
def gen_per_batch(self):
if self.run_mode == 'k-eigenvalue':
return self._f['gen_per_batch'].value
else:
return None
@property
def global_tallies(self):
if self._global_tallies is None:
data = self._f['global_tallies'].value
gt = np.zeros_like(data, dtype=[
('name', 'a14'), ('sum', 'f8'), ('sum_sq', 'f8'),
('mean', 'f8'), ('std_dev', 'f8')])
gt['name'] = ['k-collision', 'k-absorption', 'k-tracklength',
'leakage']
gt['sum'] = data['sum']
gt['sum_sq'] = data['sum_sq']
# Calculate mean and sample standard deviation of mean
n = self.n_realizations
gt['mean'] = gt['sum']/n
gt['std_dev'] = np.sqrt((gt['sum_sq']/n - gt['mean']**2)/(n - 1))
self._global_tallies = gt
return self._global_tallies
@property
def k_cmfd(self):
if self.cmfd_on:
return self._f['cmfd/k_cmfd'].value
else:
return None
@property
def k_generation(self):
if self.run_mode == 'k-eigenvalue':
return self._f['k_generation'].value
else:
return None
@property
def k_combined(self):
if self.run_mode == 'k-eigenvalue':
return self._f['k_combined'].value
else:
return None
@property
def k_col_abs(self):
if self.run_mode == 'k-eigenvalue':
return self._f['k_col_abs'].value
else:
return None
@property
def k_col_tra(self):
if self.run_mode == 'k-eigenvalue':
return self._f['k_col_tra'].value
else:
return None
@property
def k_abs_tra(self):
if self.run_mode == 'k-eigenvalue':
return self._f['k_abs_tra'].value
else:
return None
@property
def meshes(self):
if not self._meshes_read:
# Initialize dictionaries for the Meshes
# Keys - Mesh IDs
# Values - Mesh objects
self._meshes = {}
# Read the number of Meshes
n_meshes = self._f['tallies/meshes/n_meshes'].value
# Read a list of the IDs for each Mesh
if n_meshes > 0:
# User-defined Mesh IDs
mesh_keys = self._f['tallies/meshes/keys'].value
else:
mesh_keys = []
# Build dictionary of Meshes
base = 'tallies/meshes/mesh '
# Iterate over all Meshes
for mesh_key in mesh_keys:
# Read the mesh type
mesh_type = self._f['{0}{1}/type'.format(base, mesh_key)].value.decode()
# Read the mesh dimensions, lower-left coordinates,
# upper-right coordinates, and width of each mesh cell
dimension = self._f['{0}{1}/dimension'.format(base, mesh_key)].value
lower_left = self._f['{0}{1}/lower_left'.format(base, mesh_key)].value
upper_right = self._f['{0}{1}/upper_right'.format(base, mesh_key)].value
width = self._f['{0}{1}/width'.format(base, mesh_key)].value
# Create the Mesh and assign properties to it
mesh = openmc.Mesh(mesh_key)
mesh.dimension = dimension
mesh.width = width
mesh.lower_left = lower_left
mesh.upper_right = upper_right
mesh.type = mesh_type
# Add mesh to the global dictionary of all Meshes
self._meshes[mesh_key] = mesh
self._meshes_read = True
return self._meshes
@property
def n_batches(self):
return self._f['n_batches'].value
@property
def n_inactive(self):
if self.run_mode == 'k-eigenvalue':
return self._f['n_inactive'].value
else:
return None
@property
def n_particles(self):
return self._f['n_particles'].value
@property
def n_realizations(self):
return self._f['n_realizations'].value
@property
def path(self):
return self._f['path'].value.decode()
@property
def run_mode(self):
return self._f['run_mode'].value.decode()
@property
def seed(self):
return self._f['seed'].value
@property
def source(self):
return self._source
if self.source_present:
return self._f['source_bank'].value
else:
return None
@property
def with_summary(self):
return self._with_summary
def source_present(self):
return self._f['source_present'].value > 0
@property
def tallies(self):
if not self._tallies_read:
# Initialize dictionary for tallies
self._tallies = {}
# Read the number of tallies
n_tallies = self._f['tallies/n_tallies'].value
# Read a list of the IDs for each Tally
if n_tallies > 0:
# OpenMC Tally IDs (redefined internally from user definitions)
tally_keys = self._f['tallies/keys'].value
else:
tally_keys = []
base = 'tallies/tally '
# Iterate over all Tallies
for tally_key in tally_keys:
# Read the Tally size specifications
n_realizations = self._f['{0}{1}/n_realizations'.format(base, tally_key)].value
# Create Tally object and assign basic properties
tally = openmc.Tally(tally_id=tally_key)
tally._statepoint = self
tally.estimator = self._f['{0}{1}/estimator'.format(
base, tally_key)].value.decode()
tally.num_realizations = n_realizations
# Read the number of Filters
n_filters = self._f['{0}{1}/n_filters'.format(base, tally_key)].value
subbase = '{0}{1}/filter '.format(base, tally_key)
# Initialize all Filters
for j in range(1, n_filters+1):
# Read the Filter type
filter_type = self._f['{0}{1}/type'.format(subbase, j)].value.decode()
# Read the Filter offset
offset = self._f['{0}{1}/offset'.format(subbase, j)].value
n_bins = self._f['{0}{1}/n_bins'.format(subbase, j)].value
# Read the bin values
bins = self._f['{0}{1}/bins'.format(subbase, j)].value
# Create Filter object
filter = openmc.Filter(filter_type, bins)
filter.offset = offset
filter.num_bins = n_bins
if filter_type == 'mesh':
mesh_ids = self._f['tallies/meshes/ids'].value
mesh_keys = self._f['tallies/meshes/keys'].value
key = mesh_keys[mesh_ids == bins][0]
filter.mesh = self.meshes[key]
# Add Filter to the Tally
tally.add_filter(filter)
# Read Nuclide bins
nuclide_names = self._f['{0}{1}/nuclides'.format(base, tally_key)].value
# Add all Nuclides to the Tally
for name in nuclide_names:
nuclide = openmc.Nuclide(name.decode().strip())
tally.add_nuclide(nuclide)
# Read score bins
n_score_bins = self._f['{0}{1}/n_score_bins'.format(base, tally_key)].value
tally.num_score_bins = n_score_bins
scores = self._f['{0}{1}/score_bins'.format(
base, tally_key)].value
n_user_scores = self._f['{0}{1}/n_user_score_bins'
.format(base, tally_key)].value
# Compute and set the filter strides
for i in range(n_filters):
filter = tally.filters[i]
filter.stride = n_score_bins * len(nuclide_names)
for j in range(i+1, n_filters):
filter.stride *= tally.filters[j].num_bins
# Read scattering moment order strings (e.g., P3, Y-1,2, etc.)
moments = self._f['{0}{1}/moment_orders'.format(
base, tally_key)].value
# Add the scores to the Tally
for j, score in enumerate(scores):
score = score.decode()
# If this is a scattering moment, insert the scattering order
if '-n' in score:
score = score.replace('-n', '-' + moments[j].decode())
elif '-pn' in score:
score = score.replace('-pn', '-' + moments[j].decode())
elif '-yn' in score:
score = score.replace('-yn', '-' + moments[j].decode())
tally.add_score(score)
# Add Tally to the global dictionary of all Tallies
self._tallies[tally_key] = tally
self._tallies_read = True
return self._tallies
@property
def tallies_present(self):
return self._tallies_present
return self._f['tallies/tallies_present'].value
@property
def global_tallies(self):
return self._global_tallies
def version(self):
return (self._f['version_major'].value,
self._f['version_minor'].value,
self._f['version_release'].value)
@property
def n_realizations(self):
return self._n_realizations
def _read_metadata(self):
# Read filetype
self._filetype = self._f['filetype'].value
# Read statepoint revision
self._revision = self._f['revision'].value
if self._revision != 13:
raise Exception('Statepoint Revision is not consistent.')
# Read OpenMC version
self._version = [self._f['version_major'].value,
self._f['version_minor'].value,
self._f['version_release'].value]
# Read date and time
self._date_and_time = self._f['date_and_time'].value[0]
# Read path
self._path = self._f['path'].value[0].strip()
# Read random number seed
self._seed = self._f['seed'].value
# Read run information
self._run_mode = self._f['run_mode'].value
self._n_particles = self._f['n_particles'].value
self._n_batches = self._f['n_batches'].value
# Read current batch
self._current_batch = self._f['current_batch'].value
# Read whether or not the source site distribution is present
self._source_present = self._f['source_present'].value
# Read criticality information
if self._run_mode == 2:
self._read_criticality()
def _read_criticality(self):
# Read criticality information
if self._run_mode == 2:
self._n_inactive = self._f['n_inactive'].value
self._gen_per_batch = self._f['gen_per_batch'].value
self._k_generation = self._f['k_generation'].value
self._entropy = self._f['entropy'].value
self._k_col_abs = self._f['k_col_abs'].value
self._k_col_tra = self._f['k_col_tra'].value
self._k_abs_tra = self._f['k_abs_tra'].value
self._k_combined = self._f['k_combined'].value
# Read CMFD information (if used)
self._read_cmfd()
def _read_cmfd(self):
base = 'cmfd'
# Read CMFD information
self._cmfd_on = self._f['cmfd_on'].value
if self._cmfd_on == 1:
self._cmfd_indices = self._f['{0}/indices'.format(base)].value
self._k_cmfd = self._f['{0}/k_cmfd'.format(base)].value
self._cmfd_src = self._f['{0}/cmfd_src'.format(base)].value
self._cmfd_src = np.reshape(self._cmfd_src, tuple(self._cmfd_indices),
order='F')
self._cmfd_entropy = self._f['{0}/cmfd_entropy'.format(base)].value
self._cmfd_balance = self._f['{0}/cmfd_balance'.format(base)].value
self._cmfd_dominance = self._f['{0}/cmfd_dominance'.format(base)].value
self._cmfd_srccmp = self._f['{0}/cmfd_srccmp'.format(base)].value
def _read_meshes(self):
# Initialize dictionaries for the Meshes
# Keys - Mesh IDs
# Values - Mesh objects
self._meshes = {}
# Read the number of Meshes
self._n_meshes = self._f['tallies/meshes/n_meshes'].value
# Read a list of the IDs for each Mesh
if self._n_meshes > 0:
# OpenMC Mesh IDs (redefined internally from user definitions)
self._mesh_ids = self._f['tallies/meshes/ids'].value
# User-defined Mesh IDs
self._mesh_keys = self._f['tallies/meshes/keys'].value
else:
self._mesh_keys = []
self._mesh_ids = []
# Build dictionary of Meshes
base = 'tallies/meshes/mesh '
# Iterate over all Meshes
for mesh_key in self._mesh_keys:
# Read the user-specified Mesh ID and type
mesh_id = self._f['{0}{1}/id'.format(base, mesh_key)].value
mesh_type = self._f['{0}{1}/type'.format(base, mesh_key)].value
# Get the Mesh dimension
n_dimension = self._f['{0}{1}/n_dimension'.format(base, mesh_key)].value
# Read the mesh dimensions, lower-left coordinates,
# upper-right coordinates, and width of each mesh cell
dimension = self._f['{0}{1}/dimension'.format(base, mesh_key)].value
lower_left = self._f['{0}{1}/lower_left'.format(base, mesh_key)].value
upper_right = self._f['{0}{1}/upper_right'.format(base, mesh_key)].value
width = self._f['{0}{1}/width'.format(base, mesh_key)].value
# Create the Mesh and assign properties to it
mesh = openmc.Mesh(mesh_id)
mesh.dimension = dimension
mesh.width = width
mesh.lower_left = lower_left
mesh.upper_right = upper_right
#FIXME: Set the mesh type to 'rectangular' by default
mesh.type = 'rectangular'
# Add mesh to the global dictionary of all Meshes
self._meshes[mesh_id] = mesh
def _read_tallies(self):
# Initialize dictionaries for the Tallies
# Keys - Tally IDs
# Values - Tally objects
self._tallies = {}
# Read the number of tallies
self._n_tallies = self._f['/tallies/n_tallies'].value
# Read a list of the IDs for each Tally
if self._n_tallies > 0:
# OpenMC Tally IDs (redefined internally from user definitions)
self._tally_ids = self._f['tallies/ids'].value
# User-defined Tally IDs
self._tally_keys = self._f['tallies/keys'].value
else:
self._tally_keys = []
self._tally_ids = []
base = 'tallies/tally '
# Iterate over all Tallies
for tally_key in self._tally_keys:
# Read integer Tally estimator type code (analog or tracklength)
estimator_type = self._f['{0}{1}/estimator'.format(base, tally_key)].value
# Read the Tally size specifications
n_realizations = self._f['{0}{1}/n_realizations'.format(base, tally_key)].value
# Create Tally object and assign basic properties
tally = openmc.Tally(tally_key)
tally.estimator = ESTIMATOR_TYPES[estimator_type]
tally.num_realizations = n_realizations
# Read the number of Filters
n_filters = self._f['{0}{1}/n_filters'.format(base, tally_key)].value
subbase = '{0}{1}/filter '.format(base, tally_key)
# Initialize all Filters
for j in range(1, n_filters+1):
# Read the integer Filter type code
filter_type = self._f['{0}{1}/type'.format(subbase, j)].value
# Read the Filter offset
offset = self._f['{0}{1}/offset'.format(subbase, j)].value
n_bins = self._f['{0}{1}/n_bins'.format(subbase, j)].value
if n_bins <= 0:
msg = 'Unable to create Filter "{0}" for Tally ID="{1}" ' \
'since no bins were specified'.format(j, tally_key)
raise ValueError(msg)
# Read the bin values
if FILTER_TYPES[filter_type] in ['energy', 'energyout']:
bins = self._f['{0}{1}/bins'.format(subbase, j)].value
elif FILTER_TYPES[filter_type] in ['mesh', 'distribcell']:
bins = self._f['{0}{1}/bins'.format(subbase, j)].value
else:
bins = self._f['{0}{1}/bins'.format(subbase, j)].value
# Create Filter object
filter = openmc.Filter(FILTER_TYPES[filter_type], bins)
filter.offset = offset
filter.num_bins = n_bins
if FILTER_TYPES[filter_type] == 'mesh':
key = self._mesh_keys[self._mesh_ids == bins][0]
filter.mesh = self._meshes[key]
# Add Filter to the Tally
tally.add_filter(filter)
# Read Nuclide bins
n_nuclides = self._f['{0}{1}/n_nuclides'.format(base, tally_key)].value
nuclide_zaids = self._f['{0}{1}/nuclides'.format(base, tally_key)].value
# Add all Nuclides to the Tally
for nuclide_zaid in nuclide_zaids:
tally.add_nuclide(nuclide_zaid)
# Read score bins
n_score_bins = self._f['{0}{1}/n_score_bins'.format(base, tally_key)].value
tally.num_score_bins = n_score_bins
score_bins = self._f['{0}{1}/score_bins'.format(
base, tally_key)].value
scores = [SCORE_TYPES[score] for score in score_bins]
n_user_scores = self._f['{0}{1}/n_user_score_bins'
.format(base, tally_key)].value
# Compute and set the filter strides
for i in range(n_filters):
filter = tally.filters[i]
filter.stride = n_score_bins * n_nuclides
for j in range(i+1, n_filters):
filter.stride *= tally.filters[j].num_bins
# Read scattering moment order strings (e.g., P3, Y-1,2, etc.)
moments = []
subbase = '{0}{1}/moments/'.format(base, tally_key)
# Extract the moment order string for each score
for k in range(len(scores)):
moment = str(self._f['{0}order{1}'.format(
subbase, k+1)].value[0])
moment = moment.lstrip('[\'')
moment = moment.rstrip('\']')
# Remove extra whitespace
moment.replace(" ", "")
moments.append(moment)
# Add the scores to the Tally
for j, score in enumerate(scores):
# If this is a scattering moment, insert the scattering order
if '-n' in score:
score = score.replace('-n', '-' + str(moments[j]))
elif '-pn' in score:
score = score.replace('-pn', '-' + str(moments[j]))
elif '-yn' in score:
score = score.replace('-yn', '-' + str(moments[j]))
tally.add_score(score)
# Add Tally to the global dictionary of all Tallies
self.tallies[tally_key] = tally
def read_results(self):
"""Read tally results and store them in the ``tallies`` attribute. No results
are read when the statepoint is instantiated.
"""
# Number of realizations for global Tallies
self._n_realizations = self._f['n_realizations'].value
# Read global Tallies
n_global_tallies = self._f['n_global_tallies'].value
data = self._f['global_tallies'].value
self._global_tallies = np.column_stack((data['sum'], data['sum_sq']))
# Flag indicating if Tallies are present
self._tallies_present = self._f['tallies/tallies_present'].value
base = 'tallies/tally '
# Read Tally results
if self._tallies_present:
# Iterate over and extract the results for all Tallies
for tally_key in self._tally_keys:
# Get this Tally
tally = self._tallies[tally_key]
# Compute the total number of bins for this Tally
num_tot_bins = tally.num_bins
# Extract Tally data from the file
data = self._f['{0}{1}/results'.format(base, tally_key)].value
sum = data['sum']
sum_sq = data['sum_sq']
# Define a routine to convert 0 to 1
def nonzero(val):
return 1 if not val else val
# Reshape the results arrays
new_shape = (nonzero(tally.num_filter_bins),
nonzero(tally.num_nuclides),
nonzero(tally.num_score_bins))
sum = np.reshape(sum, new_shape)
sum_sq = np.reshape(sum_sq, new_shape)
# Set the data for this Tally
tally.sum = sum
tally.sum_sq = sum_sq
# Indicate that Tally results have been read
self._results = True
def read_source(self):
"""Read and store source sites from the statepoint file. By default, source
sites are not loaded upon initialization.
"""
# Check whether Tally results have been read
if not self._results:
self.read_results()
# Check if source bank is in statepoint
if not self._source_present:
print('Unable to read source since it is not in statepoint file')
return
# Initialize a NumPy array for the source sites
self._source = np.empty(self._n_particles, dtype=SourceSite)
# For HDF5 state points, copy entire bank
source_sites = self._f['source_bank'].value
# Initialize SourceSite object for each particle
for i in range(self._n_particles):
# Initialize new source site
site = SourceSite()
# Read position, angle, and energy
site._weight, site._xyz, site._uvw, site._E = source_sites[i]
# Store the source site in the NumPy array
self._source[i] = site
def compute_ci(self, confidence=0.95):
"""Computes confidence intervals for each Tally bin.
This method is equivalent to calling compute_stdev(...) when the
confidence is known as opposed to its corresponding t value.
Parameters
----------
confidence : float, optional
Confidence level. Defaults to 0.95.
"""
# Determine significance level and percentile for two-sided CI
alpha = 1 - confidence
percentile = 1 - alpha/2
# Calculate t-value
t_value = scipy.stats.t.ppf(percentile, self._n_realizations - 1)
self.compute_stdev(t_value)
def compute_stdev(self, t_value=1.0):
"""Computes the sample mean and the standard deviation of the mean
for each Tally bin.
Parameters
----------
t_value : float, optional
Student's t-value applied to the uncertainty. Defaults to 1.0,
meaning the reported value is the sample standard deviation.
"""
# Determine number of realizations
n = self._n_realizations
# Calculate the standard deviation for each global tally
for i in range(len(self._global_tallies)):
# Get sum and sum of squares
s, s2 = self._global_tallies[i]
# Calculate sample mean and replace value
s /= n
self._global_tallies[i, 0] = s
# Calculate standard deviation
if s != 0.0:
self._global_tallies[i, 1] = t_value * np.sqrt((s2 / n - s**2) / (n-1))
# Calculate sample mean and standard deviation for user-defined Tallies
for tally_id, tally in self.tallies.items():
tally.compute_std_dev(t_value)
def with_summary(self):
return self._with_summary
def get_tally(self, scores=[], filters=[], nuclides=[],
name=None, id=None, estimator=None):
@ -706,15 +604,6 @@ class StatePoint(object):
tally.name = summary.tallies[tally_id].name
tally.with_summary = True
nuclide_zaids = copy.deepcopy(tally.nuclides)
for nuclide_zaid in nuclide_zaids:
tally.remove_nuclide(nuclide_zaid)
if nuclide_zaid == -1:
tally.add_nuclide(openmc.Nuclide('total'))
else:
tally.add_nuclide(summary.nuclides[nuclide_zaid])
for filter in tally.filters:
if filter.type == 'surface':
surface_ids = []

View file

@ -46,7 +46,6 @@ class Summary(object):
def _read_geometry(self):
# Read in and initialize the Materials and Geometry
self._read_nuclides()
self._read_materials()
self._read_surfaces()
self._read_cells()
@ -54,35 +53,6 @@ class Summary(object):
self._read_lattices()
self._finalize_geometry()
def _read_nuclides(self):
self.n_nuclides = self._f['nuclides/n_nuclides']
# Initialize dictionary for each Nuclide
# Keys - Nuclide ZAIDs
# Values - Nuclide objects
self.nuclides = {}
for key in self._f['nuclides'].keys():
if key == 'n_nuclides':
continue
index = self._f['nuclides'][key]['index'].value
alias = self._f['nuclides'][key]['alias'][0]
zaid = self._f['nuclides'][key]['zaid'].value
# Read the Nuclide's name (e.g., 'H-1' or 'U-235')
name = alias.split('.')[0]
# Read the Nuclide's cross-section identifier (e.g., '70c')
xs = alias.split('.')[1]
# Initialize this Nuclide and add to global dictionary of Nuclides
if 'nat' in name:
self.nuclides[zaid] = openmc.Element(name=name, xs=xs)
else:
self.nuclides[zaid] = openmc.Nuclide(name=name, xs=xs)
self.nuclides[zaid].zaid = zaid
def _read_materials(self):
self.n_materials = self._f['n_materials'].value
@ -97,23 +67,17 @@ class Summary(object):
material_id = int(key.lstrip('material '))
index = self._f['materials'][key]['index'].value
name = self._f['materials'][key]['name'][0]
name = self._f['materials'][key]['name'].value.decode()
density = self._f['materials'][key]['atom_density'].value
nuc_densities = self._f['materials'][key]['nuclide_densities'][...]
nuclides = self._f['materials'][key]['nuclides'][...]
n_sab = self._f['materials'][key]['n_sab'].value
nuclides = self._f['materials'][key]['nuclides'].value
sab_names = []
sab_xs = []
# Read the names of the S(a,b) tables for this Material
for i in range(1, n_sab+1):
sab_table = \
self._f['materials'][key]['sab_tables'][str(i)].value
# Read the cross-section identifiers for each S(a,b) table
sab_names.append(sab_table.split('.')[0])
sab_xs.append(sab_table.split('.')[1])
# Read the names of the S(a,b) tables for this Material and add them
if 'sab_names' in self._f['materials'][key]:
sab_tables = self._f['materials'][key]['sab_names'].value
for sab_table in sab_tables:
name, xs = sab_table.decode().split('.')
material.add_s_alpha_beta(name, xs)
# Create the Material
material = openmc.Material(material_id=material_id, name=name)
@ -121,21 +85,17 @@ class Summary(object):
# Set the Material's density to g/cm3 - this is what is used in OpenMC
material.set_density(density=density, units='g/cm3')
# Add all Nuclides to the Material
for i, zaid in enumerate(nuclides):
nuclide = self.get_nuclide_by_zaid(zaid)
density = nuc_densities[i]
# Add all nuclides to the Material
for fullname, density in zip(nuclides, nuc_densities):
fullname = fullname.decode().strip()
name, xs = fullname.split('.')
if isinstance(nuclide, openmc.Nuclide):
material.add_nuclide(nuclide, percent=density, percent_type='ao')
elif isinstance(nuclide, openmc.Element):
material.add_element(nuclide, percent=density, percent_type='ao')
# Add S(a,b) table(s?) to the Material
for i in range(n_sab):
name = sab_names[i]
xs = sab_xs[i]
material.add_s_alpha_beta(name, xs)
if 'nat' in name:
material.add_element(openmc.Element(name=name, xs=xs),
percent=density, percent_type='ao')
else:
material.add_nuclide(openmc.Nuclide(name=name, xs=xs),
percent=density, percent_type='ao')
# Add the Material to the global dictionary of all Materials
self.materials[index] = material
@ -154,67 +114,67 @@ class Summary(object):
surface_id = int(key.lstrip('surface '))
index = self._f['geometry/surfaces'][key]['index'].value
name = self._f['geometry/surfaces'][key]['name'][0]
surf_type = self._f['geometry/surfaces'][key]['type'][...]
bc = self._f['geometry/surfaces'][key]['boundary_condition'][...][0]
name = self._f['geometry/surfaces'][key]['name'].value.decode()
surf_type = self._f['geometry/surfaces'][key]['type'].value.decode()
bc = self._f['geometry/surfaces'][key]['boundary_condition'].value.decode()
coeffs = self._f['geometry/surfaces'][key]['coefficients'][...]
# Create the Surface based on its type
if surf_type == 'X Plane':
if surf_type == 'x-plane':
x0 = coeffs[0]
surface = openmc.XPlane(surface_id, bc, x0, name)
elif surf_type == 'Y Plane':
elif surf_type == 'y-plane':
y0 = coeffs[0]
surface = openmc.YPlane(surface_id, bc, y0, name)
elif surf_type == 'Z Plane':
elif surf_type == 'z-plane':
z0 = coeffs[0]
surface = openmc.ZPlane(surface_id, bc, z0, name)
elif surf_type == 'Plane':
elif surf_type == 'plane':
A = coeffs[0]
B = coeffs[1]
C = coeffs[2]
D = coeffs[3]
surface = openmc.Plane(surface_id, bc, A, B, C, D, name)
elif surf_type == 'X Cylinder':
elif surf_type == 'x-cylinder':
y0 = coeffs[0]
z0 = coeffs[1]
R = coeffs[2]
surface = openmc.XCylinder(surface_id, bc, y0, z0, R, name)
elif surf_type == 'Y Cylinder':
elif surf_type == 'y-cylinder':
x0 = coeffs[0]
z0 = coeffs[1]
R = coeffs[2]
surface = openmc.YCylinder(surface_id, bc, x0, z0, R, name)
elif surf_type == 'Z Cylinder':
elif surf_type == 'z-cylinder':
x0 = coeffs[0]
y0 = coeffs[1]
R = coeffs[2]
surface = openmc.ZCylinder(surface_id, bc, x0, y0, R, name)
elif surf_type == 'Sphere':
elif surf_type == 'sphere':
x0 = coeffs[0]
y0 = coeffs[1]
z0 = coeffs[2]
R = coeffs[3]
surface = openmc.Sphere(surface_id, bc, x0, y0, z0, R, name)
elif surf_type in ['X Cone', 'Y Cone', 'Z Cone']:
elif surf_type in ['x-cone', 'y-cone', 'z-cone']:
x0 = coeffs[0]
y0 = coeffs[1]
z0 = coeffs[2]
R2 = coeffs[3]
if surf_type == 'X Cone':
if surf_type == 'x-cone':
surface = openmc.XCone(surface_id, bc, x0, y0, z0, R2, name)
if surf_type == 'Y Cone':
if surf_type == 'y-cone':
surface = openmc.YCone(surface_id, bc, x0, y0, z0, R2, name)
if surf_type == 'Z Cone':
if surf_type == 'z-cone':
surface = openmc.ZCone(surface_id, bc, x0, y0, z0, R2, name)
# Add Surface to global dictionary of all Surfaces
@ -242,8 +202,8 @@ class Summary(object):
cell_id = int(key.lstrip('cell '))
index = self._f['geometry/cells'][key]['index'].value
name = self._f['geometry/cells'][key]['name'][0]
fill_type = self._f['geometry/cells'][key]['fill_type'][...][0]
name = self._f['geometry/cells'][key]['name'].value.decode()
fill_type = self._f['geometry/cells'][key]['fill_type'].value.decode()
if fill_type == 'normal':
fill = self._f['geometry/cells'][key]['material'].value
@ -261,21 +221,17 @@ class Summary(object):
cell = openmc.Cell(cell_id=cell_id, name=name)
if fill_type == 'universe':
maps = self._f['geometry/cells'][key]['maps'].value
if maps > 0:
if 'offset' in self._f['geometry/cells'][key]:
offset = self._f['geometry/cells'][key]['offset'][...]
cell.offsets = offset
translated = self._f['geometry/cells'][key]['translated'].value
if translated:
if 'translation' in self._f['geometry/cells'][key]:
translation = \
self._f['geometry/cells'][key]['translation'][...]
translation = np.asarray(translation, dtype=np.float64)
cell.translation = translation
rotated = self._f['geometry/cells'][key]['rotated'].value
if rotated:
if 'rotation' in self._f['geometry/cells'][key]:
rotation = \
self._f['geometry/cells'][key]['rotation'][...]
rotation = np.asarray(rotation, dtype=np.int)
@ -288,8 +244,8 @@ class Summary(object):
for surface_halfspace in surfaces:
halfspace = np.sign(surface_halfspace)
surface_id = np.abs(surface_halfspace)
surface = self.surfaces[surface_id]
surface_id = abs(surface_halfspace)
surface = self.get_surface_by_id(surface_id)
cell.add_surface(surface, halfspace)
# Add the Cell to the global dictionary of all Cells
@ -336,13 +292,13 @@ class Summary(object):
lattice_id = int(key.lstrip('lattice '))
index = self._f['geometry/lattices'][key]['index'].value
name = self._f['geometry/lattices'][key]['name'][...][0]
lattice_type = self._f['geometry/lattices'][key]['type'][...][0]
maps = self._f['geometry/lattices'][key]['maps'].value
offset_size = self._f['geometry/lattices'][key]['offset_size'].value
name = self._f['geometry/lattices'][key]['name'].value.decode()
lattice_type = self._f['geometry/lattices'][key]['type'].value.decode()
if offset_size > 0:
if 'offsets' in self._f['geometry/lattices'][key]:
offsets = self._f['geometry/lattices'][key]['offsets'][...]
else:
offsets = None
if lattice_type == 'rectangular':
dimension = self._f['geometry/lattices'][key]['dimension'][...]
@ -383,7 +339,7 @@ class Summary(object):
universes = universes[:, ::-1, :]
lattice.universes = universes
if offset_size > 0:
if offsets is not None:
offsets = np.swapaxes(offsets, 0, 1)
offsets = np.swapaxes(offsets, 1, 2)
lattice.offsets = offsets
@ -477,7 +433,7 @@ class Summary(object):
# Lattice is 2D; extract the only axial level
lattice.universes = universes[0]
if offset_size > 0:
if offsets is not None:
lattice.offsets = offsets
# Add the Lattice to the global dictionary of all Lattices
@ -532,26 +488,19 @@ class Summary(object):
# Iterate over all Tallies
for tally_key in tally_keys:
tally_id = int(tally_key.strip('tally '))
subbase = '{0}{1}'.format(base, tally_id)
# Read Tally name metadata
name_size = self._f['{0}/name_size'.format(subbase)][...]
if (name_size > 0):
tally_name = self._f['{0}/name'.format(subbase)][...][0]
tally_name = tally_name.lstrip('[\'')
tally_name = tally_name.rstrip('\']')
else:
tally_name = ''
tally_name = self._f['{0}/name'.format(subbase)].value.decode()
# Create Tally object and assign basic properties
tally = openmc.Tally(tally_id, tally_name)
# Read score metadata
score_bins = self._f['{0}/score_bins'.format(subbase)][...]
for score_bin in score_bins:
tally.add_score(openmc.SCORE_TYPES[score_bin])
scores = self._f['{0}/score_bins'.format(subbase)].value
for score in scores:
tally.add_score(score.decode())
num_score_bins = self._f['{0}/n_score_bins'.format(subbase)][...]
tally.num_score_bins = num_score_bins
@ -560,12 +509,10 @@ class Summary(object):
# Initialize all Filters
for j in range(1, num_filters+1):
subsubbase = '{0}/filter {1}'.format(subbase, j)
# Read filter type (e.g., "cell", "energy", etc.)
filter_type_code = self._f['{0}/type'.format(subsubbase)].value
filter_type = openmc.FILTER_TYPES[filter_type_code]
filter_type = self._f['{0}/type'.format(subsubbase)].value.decode()
# Read the filter bins
num_bins = self._f['{0}/n_bins'.format(subsubbase)].value
@ -597,29 +544,6 @@ class Summary(object):
if self.opencg_geometry is None:
self.opencg_geometry = get_opencg_geometry(self.openmc_geometry)
def get_nuclide_by_zaid(self, zaid):
"""Return a Nuclide object given the 'zaid' identifier for the nuclide.
Parameters
----------
zaid : int
1000*Z + A, where Z is the atomic number of the nuclide and A is the
mass number. For example, the zaid for U-235 is 92235.
Returns
-------
nuclide : openmc.nuclide.Nuclide or None
Nuclide matching the specified zaid, or None if no matching object
is found.
"""
for index, nuclide in self.nuclides.items():
if nuclide._zaid == zaid:
return nuclide
return None
def get_material_by_id(self, material_id):
"""Return a Material object given the material id

View file

@ -4,7 +4,6 @@ from xml.etree import ElementTree as ET
import sys
from openmc.checkvalue import check_type, check_value, check_greater_than
from openmc.constants import BC_TYPES
if sys.version_info[0] >= 3:
basestring = str
@ -12,6 +11,8 @@ if sys.version_info[0] >= 3:
# A static variable for auto-generated Surface IDs
AUTO_SURFACE_ID = 10000
_BC_TYPES = ['transmission', 'vacuum', 'reflective', 'periodic']
def reset_auto_surface_id():
global AUTO_SURFACE_ID
@ -106,7 +107,7 @@ class Surface(object):
@boundary_type.setter
def boundary_type(self, boundary_type):
check_type('boundary type', boundary_type, basestring)
check_value('boundary type', boundary_type, BC_TYPES.values())
check_value('boundary type', boundary_type, _BC_TYPES)
self._boundary_type = boundary_type
def __repr__(self):
@ -134,7 +135,7 @@ class Surface(object):
element.set("type", self._type)
element.set("boundary", self._boundary_type)
element.set("coeffs", ' '.join([str(self._coeffs[key])
element.set("coeffs", ' '.join([str(self._coeffs.setdefault(key, 0.0))
for key in self._coeff_keys]))
return element

View file

@ -52,7 +52,7 @@ class Tally(object):
List of nuclides to score results for
scores : list of str
List of defined scores, e.g. 'flux', 'fission', etc.
estimator : {'analog', 'tracklength'}
estimator : {'analog', 'tracklength', 'collision'}
Type of estimator for the tally
triggers : list of openmc.trigger.Trigger
List of tally triggers
@ -103,6 +103,9 @@ class Tally(object):
self._with_batch_statistics = False
self._derived = False
self._statepoint = None
self._results_read = False
def __deepcopy__(self, memo):
existing = memo.get(id(self))
@ -121,6 +124,8 @@ class Tally(object):
clone._with_summary = self.with_summary
clone._with_batch_statistics = self.with_batch_statistics
clone._derived = self.derived
clone._statepoint = self._statepoint
clone._results_read = self._results_read
clone._filters = []
for filter in self.filters:
@ -265,24 +270,69 @@ class Tally(object):
@property
def sum(self):
if not self._statepoint:
return None
if not self._results_read:
# Extract Tally data from the file
data = self._statepoint._f['tallies/tally {0}/results'.format(
self.id)].value
sum = data['sum']
sum_sq = data['sum_sq']
# Define a routine to convert 0 to 1
def nonzero(val):
return 1 if not val else val
# Reshape the results arrays
new_shape = (nonzero(self.num_filter_bins),
nonzero(self.num_nuclides),
nonzero(self.num_score_bins))
sum = np.reshape(sum, new_shape)
sum_sq = np.reshape(sum_sq, new_shape)
# Set the data for this Tally
self._sum = sum
self._sum_sq = sum_sq
# Indicate that Tally results have been read
self._results_read = True
return self._sum
@property
def sum_sq(self):
if not self._statepoint:
return None
if not self._results_read:
# Force reading of sum and sum_sq
self.sum
return self._sum_sq
@property
def mean(self):
# Compute the mean if needed
if self._mean is None:
self.compute_mean()
if not self._statepoint:
return None
self._mean = self.sum / self.num_realizations
return self._mean
@property
def std_dev(self):
# Compute the standard deviation if needed
if self._std_dev is None:
self.compute_std_dev()
if not self._statepoint:
return None
n = self.num_realizations
nonzero = np.abs(self.mean) > 0
self._std_dev = np.zeros_like(self.mean)
self._std_dev[nonzero] = np.sqrt((self.sum_sq[nonzero]/n -
self.mean[nonzero]**2)/(n - 1))
self.with_batch_statistics = True
return self._std_dev
@property
@ -295,7 +345,8 @@ class Tally(object):
@estimator.setter
def estimator(self, estimator):
cv.check_value('estimator', estimator, ['analog', 'tracklength'])
cv.check_value('estimator', estimator,
['analog', 'tracklength', 'collision'])
self._estimator = estimator
def add_trigger(self, trigger):
@ -462,30 +513,6 @@ class Tally(object):
self._nuclides.remove(nuclide)
def compute_mean(self):
"""Compute the sample mean for each bin in the tally"""
# Calculate sample mean
self._mean = self.sum / self.num_realizations
def compute_std_dev(self, t_value=1.0):
"""Compute the sample standard deviation for each bin in the tally
Parameters
----------
t_value : float, optional
Student's t-value applied to the uncertainty. Defaults to 1.0,
meaning the reported value is the sample standard deviation.
"""
# Calculate sample standard deviation
self.compute_mean()
self._std_dev = np.sqrt((self.sum_sq / self.num_realizations -
self.mean**2) / (self.num_realizations - 1))
self._std_dev *= t_value
self.with_batch_statistics = True
def __repr__(self):
string = 'Tally\n'
string += '{0: <16}{1}{2}\n'.format('\tID', '=\t', self.id)

View file

@ -273,8 +273,6 @@ class MeshPlotter(tk.Frame):
def get_file_data(self, filename):
# Create StatePoint object and read in data
self.datafile = StatePoint(filename)
self.datafile.read_results()
self.datafile.compute_stdev()
# Find which tallies are mesh tallies
self.meshTallies = []

View file

@ -1,43 +0,0 @@
#!/usr/bin/env python
from __future__ import print_function
from sys import argv
from math import sqrt
import numpy as np
import scipy.stats
import matplotlib.pyplot as plt
from openmc.statepoint import StatePoint
# Get filename
filename = argv[1]
# Create StatePoint object
sp = StatePoint(filename)
sp.read_results()
sp.compute_ci()
# Check if tallies are present
if not sp.tallies_present:
raise Exception("No tally data in state point!")
# Loop over all tallies
for i, t in sp.tallies.items():
# Determine relative error and fraction of bins with less than 1% half-width
# of CI
n_bins = t.mean.size
relative_error = t.std_dev[t.mean > 0.] / t.mean[t.mean > 0.]
fraction = float(sum(relative_error < 0.01))/n_bins
# Display results
print("Tally " + str(i))
print(" Fraction under 1% = {0}".format(fraction))
print(" Min relative error = {0}".format(min(relative_error)))
print(" Max relative error = {0}".format(max(relative_error)))
print(" Non-scoring bins = {0}".format(
1.0 - float(relative_error.size)/n_bins))
# Plot histogram
plt.hist(relative_error, 100)
plt.show()

View file

@ -1,9 +1,11 @@
#!/usr/bin/env python2
#!/usr/bin/env python
from __future__ import division, print_function
import struct
import sys
import numpy as np
import h5py
def parse_options():
"""Process command line arguments"""
@ -22,14 +24,16 @@ def parse_options():
return parsed
def main(file_, o):
print(file_)
fh = open(file_, 'rb')
header = get_header(fh)
meshparms = (header['dimension'] + header['lower_left'] +
header['upper_right'])
nx, ny, nz = meshparms[:3]
ll = header['lower_left']
def main(filename, o):
# Read data from voxel file
fh = h5py.File(filename, 'r')
dimension = fh['num_voxels'].value
width = fh['voxel_width'].value
lower_left = fh['lower_left'].value
voxel_data = fh['data'].value
nx, ny, nz = dimension
upper_right = lower_left + width*dimension
if o.vtk:
try:
@ -40,13 +44,10 @@ def main(file_, o):
'See: http://www.vtk.org/')
return
origin = [(l + w*n/2.) for n, l, w in
zip((nx, ny, nz), ll, header['width'])]
grid = vtk.vtkImageData()
grid.SetDimensions(nx+1, ny+1, nz+1)
grid.SetOrigin(*ll)
grid.SetSpacing(*header['width'])
grid.SetOrigin(*lower_left)
grid.SetSpacing(*width)
data = vtk.vtkDoubleArray()
data.SetName("id")
@ -57,8 +58,7 @@ def main(file_, o):
for y in range(ny):
for z in range(nz):
i = z*nx*ny + y*nx + x
id_ = get_int(fh)[0]
data.SetValue(i, id_)
data.SetValue(i, voxel_data[x,y,z])
grid.GetCellData().AddArray(data)
writer = vtk.vtkXMLImageDataWriter()
@ -81,44 +81,23 @@ def main(file_, o):
if not o.output.endswith(".silo"):
o.output += ".silo"
silomesh.init_silo(o.output)
silomesh.init_mesh('plot', *meshparms)
meshparams = list(map(int, dimension)) + list(map(float, lower_left)) + \
list(map(float, upper_right))
silomesh.init_mesh('plot', *meshparams)
silomesh.init_var("id")
for x in range(1, nx+1):
for x in range(nx):
sys.stdout.write(" {0}%\r".format(int(x/nx*100)))
sys.stdout.flush()
for y in range(1, ny+1):
for z in range(1, nz+1):
id_ = get_int(fh)[0]
silomesh.set_value(float(id_), x, y, z)
for y in range(ny):
for z in range(nz):
silomesh.set_value(float(voxel_data[x,y,z]),
x + 1, y + 1, z + 1)
print()
silomesh.finalize_var()
silomesh.finalize_mesh()
silomesh.finalize_silo()
def get_header(file_):
nx, ny, nz = get_int(file_, 3)
wx, wy, wz = get_double(file_, 3)
lx, ly, lz = get_double(file_, 3)
header = {'dimension': [nx, ny, nz], 'width': [wx, wy, wz],
'lower_left': [lx, ly, lz],
'upper_right': [lx+wx*nx, ly+wy*ny, lz+wz*nz]}
return header
def get_data(file_, n, typeCode, size):
return list(struct.unpack('={0}{1}'.format(n, typeCode),
file_.read(n*size)))
def get_int(file_, n=1, path=None):
return get_data(file_, n, 'i', 4)
def get_double(file_, n=1, path=None):
return get_data(file_, n, 'd', 8)
if __name__ == '__main__':
(options, args) = parse_options()
if args:

View file

@ -32,7 +32,7 @@ kwargs = {'name': 'openmc',
if have_setuptools:
kwargs.update({
# Required dependencies
'install_requires': ['numpy', 'scipy', 'h5py', 'matplotlib'],
'install_requires': ['numpy', 'h5py', 'matplotlib'],
# Optional dependencies
'extras_require': {

View file

@ -234,7 +234,7 @@ contains
integer :: location ! location of ACE table
integer :: entries ! number of entries on each record
integer :: length ! length of ACE table
integer :: in = 7 ! file unit
integer :: unit_ace ! file unit
integer :: zaids(16) ! list of ZAIDs (only used for S(a,b))
integer :: filetype ! filetype (ASCII or BINARY)
real(8) :: kT ! temperature of table
@ -277,14 +277,14 @@ contains
! READ ACE TABLE IN ASCII FORMAT
! Find location of table
open(UNIT=in, FILE=filename, STATUS='old', ACTION='read')
rewind(UNIT=in)
open(NEWUNIT=unit_ace, FILE=filename, STATUS='old', ACTION='read')
rewind(UNIT=unit_ace)
do i = 1, location - 1
read(UNIT=in, FMT=*)
read(UNIT=unit_ace, FMT=*)
end do
! Read first line of header
read(UNIT=in, FMT='(A10,2G12.0,1X,A10)') name, awr, kT, date_
read(UNIT=unit_ace, FMT='(A10,2G12.0,1X,A10)') name, awr, kT, date_
! Check that correct xs was found -- if cross_sections.xml is broken, the
! location of the table may be wrong
@ -294,7 +294,7 @@ contains
end if
! Read more header and NXS and JXS
read(UNIT=in, FMT=100) comment, mat, &
read(UNIT=unit_ace, FMT=100) comment, mat, &
(zaids(i), awrs(i), i=1,16), NXS, JXS
100 format(A70,A10/4(I7,F11.0)/4(I7,F11.0)/4(I7,F11.0)/4(I7,F11.0)/&
,8I9/8I9/8I9/8I9/8I9/8I9)
@ -304,21 +304,21 @@ contains
allocate(XSS(length))
! Read XSS array
read(UNIT=in, FMT='(4G20.0)') XSS
read(UNIT=unit_ace, FMT='(4G20.0)') XSS
! Close ACE file
close(UNIT=in)
close(UNIT=unit_ace)
elseif (filetype == BINARY) then
! =======================================================================
! READ ACE TABLE IN BINARY FORMAT
! Open ACE file
open(UNIT=in, FILE=filename, STATUS='old', ACTION='read', &
open(NEWUNIT=unit_ace, FILE=filename, STATUS='old', ACTION='read', &
ACCESS='direct', RECL=record_length)
! Read all header information
read(UNIT=in, REC=location) name, awr, kT, date_, &
read(UNIT=unit_ace, REC=location) name, awr, kT, date_, &
comment, mat, (zaids(i), awrs(i), i=1,16), NXS, JXS
! determine table length
@ -329,11 +329,11 @@ contains
do i = 1, (length + entries - 1)/entries
j1 = 1 + (i-1)*entries
j2 = min(length, j1 + entries - 1)
read(UNIT=IN, REC=location + i) (XSS(j), j=j1,j2)
read(UNIT=UNIT_ACE, REC=location + i) (XSS(j), j=j1,j2)
end do
! Close ACE file
close(UNIT=in)
close(UNIT=unit_ace)
end if
! ==========================================================================

View file

@ -57,7 +57,7 @@ contains
use global, only: cmfd, n_cmfd_tallies, cmfd_tallies, meshes,&
matching_bins
use mesh, only: mesh_indices_to_bin
use mesh_header, only: StructuredMesh
use mesh_header, only: RegularMesh
use string, only: to_str
use tally_header, only: TallyObject
@ -79,8 +79,8 @@ contains
integer :: i_filter_eout ! index for outgoing energy filter
integer :: i_filter_surf ! index for surface filter
real(8) :: flux ! temp variable for flux
type(TallyObject), pointer :: t => null() ! pointer for tally object
type(StructuredMesh), pointer :: m => null() ! pointer for mesh object
type(TallyObject), pointer :: t ! pointer for tally object
type(RegularMesh), pointer :: m ! pointer for mesh object
! Extract spatial and energy indices from object
nx = cmfd % indices(1)

View file

@ -217,7 +217,7 @@ contains
use error, only: warning, fatal_error
use global, only: meshes, source_bank, work, n_user_meshes, cmfd, &
master
use mesh_header, only: StructuredMesh
use mesh_header, only: RegularMesh
use mesh, only: count_bank_sites, get_mesh_indices
use search, only: binary_search
use string, only: to_str
@ -239,8 +239,7 @@ contains
integer :: n_groups ! number of energy groups
logical :: outside ! any source sites outside mesh
logical :: in_mesh ! source site is inside mesh
type(StructuredMesh), pointer :: m ! point to mesh
type(RegularMesh), pointer :: m ! point to mesh
! Associate pointer
m => meshes(n_user_meshes + 1)

View file

@ -247,7 +247,7 @@ contains
use constants, only: MAX_LINE_LEN
use error, only: fatal_error, warning
use mesh_header, only: StructuredMesh
use mesh_header, only: RegularMesh
use string
use tally, only: setup_active_cmfdtallies
use tally_header, only: TallyObject, TallyFilter
@ -264,10 +264,10 @@ contains
integer :: i_filter_mesh ! index for mesh filter
integer :: iarray3(3) ! temp integer array
real(8) :: rarray3(3) ! temp double array
type(TallyObject), pointer :: t => null()
type(StructuredMesh), pointer :: m => null()
type(TallyObject), pointer :: t
type(RegularMesh), pointer :: m
type(TallyFilter) :: filters(N_FILTER_TYPES) ! temporary filters
type(Node), pointer :: node_mesh => null()
type(Node), pointer :: node_mesh
! Set global variables if they are 0 (this can happen if there is no tally
! file)

View file

@ -11,16 +11,10 @@ module constants
integer, parameter :: VERSION_RELEASE = 0
! Revision numbers for binary files
integer, parameter :: REVISION_STATEPOINT = 13
integer, parameter :: REVISION_STATEPOINT = 14
integer, parameter :: REVISION_PARTICLE_RESTART = 1
integer, parameter :: REVISION_TRACK = 1
! Binary file types
integer, parameter :: &
FILETYPE_STATEPOINT = -1, &
FILETYPE_PARTICLE_RESTART = -2, &
FILETYPE_SOURCE = -3, &
FILETYPE_TRACK = -4
integer, parameter :: REVISION_SUMMARY = 1
! ============================================================================
! ADJUSTABLE PARAMETERS
@ -251,7 +245,8 @@ module constants
! Tally estimator types
integer, parameter :: &
ESTIMATOR_ANALOG = 1, &
ESTIMATOR_TRACKLENGTH = 2
ESTIMATOR_TRACKLENGTH = 2, &
ESTIMATOR_COLLISION = 3
! Event types for tallies
integer, parameter :: &
@ -317,6 +312,10 @@ module constants
FILTER_ENERGYOUT = 8, &
FILTER_DISTRIBCELL = 9
! Mesh types
integer, parameter :: &
MESH_REGULAR = 1
! Tally surface current directions
integer, parameter :: &
IN_RIGHT = 1, &
@ -332,7 +331,7 @@ module constants
RELATIVE_ERROR = 2, &
STANDARD_DEVIATION = 3
! Global tallY parameters
! Global tally parameters
integer, parameter :: N_GLOBAL_TALLIES = 4
integer, parameter :: &
K_COLLISION = 1, &
@ -394,14 +393,6 @@ module constants
MODE_PLOTTING = 3, & ! Plotting mode
MODE_PARTICLE = 4 ! Particle restart mode
! Unit numbers
integer, parameter :: UNIT_SUMMARY = 11 ! unit # for writing summary file
integer, parameter :: UNIT_TALLY = 12 ! unit # for writing tally file
integer, parameter :: UNIT_PLOT = 13 ! unit # for writing plot file
integer, parameter :: UNIT_XS = 14 ! unit # for writing xs summary file
integer, parameter :: UNIT_PARTICLE = 15 ! unit # for writing particle restart
integer, parameter :: UNIT_OUTPUT = 16 ! unit # for writing output
!=============================================================================
! CMFD CONSTANTS

View file

@ -9,7 +9,7 @@ module eigenvalue
use global
use math, only: t_percentile
use mesh, only: count_bank_sites
use mesh_header, only: StructuredMesh
use mesh_header, only: RegularMesh
use particle_header, only: Particle
use random_lcg, only: prn, set_particle_seed, prn_skip
use search, only: binary_search
@ -304,7 +304,7 @@ contains
integer :: i, j, k ! index for bank sites
integer :: n ! # of boxes in each dimension
logical :: sites_outside ! were there sites outside entropy box?
type(StructuredMesh), pointer :: m => null()
type(RegularMesh), pointer :: m
! Get pointer to entropy mesh
m => entropy_mesh

View file

@ -8,7 +8,7 @@ module global
use dict_header, only: DictCharInt, DictIntInt
use geometry_header, only: Cell, Universe, Lattice, LatticeContainer, Surface
use material_header, only: Material
use mesh_header, only: StructuredMesh
use mesh_header, only: RegularMesh
use plot_header, only: ObjectPlot
use set_header, only: SetInt
use source_header, only: ExtSource
@ -90,7 +90,7 @@ module global
! ============================================================================
! TALLY-RELATED VARIABLES
type(StructuredMesh), allocatable, target :: meshes(:)
type(RegularMesh), allocatable, target :: meshes(:)
type(TallyObject), allocatable, target :: tallies(:)
integer, allocatable :: matching_bins(:)
@ -106,9 +106,11 @@ module global
type(SetInt) :: active_analog_tallies
type(SetInt) :: active_tracklength_tallies
type(SetInt) :: active_current_tallies
type(SetInt) :: active_collision_tallies
type(SetInt) :: active_tallies
!$omp threadprivate(active_analog_tallies, active_tracklength_tallies, &
!$omp& active_current_tallies, active_tallies)
!$omp& active_current_tallies, active_collision_tallies, &
!$omp& active_tallies)
! Global tallies
! 1) collision estimate of k-eff
@ -201,11 +203,11 @@ module global
logical :: entropy_on = .false.
real(8), allocatable :: entropy(:) ! shannon entropy at each generation
real(8), allocatable :: entropy_p(:,:,:,:) ! % of source sites in each cell
type(StructuredMesh), pointer :: entropy_mesh
type(RegularMesh), pointer :: entropy_mesh
! Uniform fission source weighting
logical :: ufs = .false.
type(StructuredMesh), pointer :: ufs_mesh => null()
type(RegularMesh), pointer :: ufs_mesh => null()
real(8), allocatable :: source_frac(:,:,:,:)
! Write source at end of simulation
@ -487,6 +489,7 @@ contains
call active_analog_tallies % clear()
call active_tracklength_tallies % clear()
call active_current_tallies % clear()
call active_collision_tallies % clear()
call active_tallies % clear()
! Deallocate track_identifiers

View file

@ -41,6 +41,7 @@ module hdf5_interface
module procedure write_integer_4D
module procedure write_long
module procedure write_string
module procedure write_string_1D
module procedure write_tally_result_1D
module procedure write_tally_result_2D
end interface write_dataset
@ -58,6 +59,7 @@ module hdf5_interface
module procedure read_integer_4D
module procedure read_long
module procedure read_string
module procedure read_string_1D
module procedure read_tally_result_1D
module procedure read_tally_result_2D
end interface read_dataset
@ -329,7 +331,7 @@ contains
end subroutine read_double
!===============================================================================
! WRITE_DOUBLE_1DARRAY writes double precision 1-D array data
! WRITE_DOUBLE_1D writes double precision 1-D array data
!===============================================================================
subroutine write_double_1D(group_id, name, buffer, indep)
@ -391,7 +393,7 @@ contains
end subroutine write_double_1D_explicit
!===============================================================================
! READ_DOUBLE_1DARRAY reads double precision 1-D array data
! READ_DOUBLE_1D reads double precision 1-D array data
!===============================================================================
subroutine read_double_1D(group_id, name, buffer, indep)
@ -449,7 +451,7 @@ contains
end subroutine read_double_1D_explicit
!===============================================================================
! WRITE_DOUBLE_2DARRAY writes double precision 2-D array data
! WRITE_DOUBLE_2D writes double precision 2-D array data
!===============================================================================
subroutine write_double_2D(group_id, name, buffer, indep)
@ -511,7 +513,7 @@ contains
end subroutine write_double_2D_explicit
!===============================================================================
! READ_DOUBLE_2DARRAY reads double precision 2-D array data
! READ_DOUBLE_2D reads double precision 2-D array data
!===============================================================================
subroutine read_double_2D(group_id, name, buffer, indep)
@ -569,7 +571,7 @@ contains
end subroutine read_double_2D_explicit
!===============================================================================
! WRITE_DOUBLE_3DARRAY writes double precision 3-D array data
! WRITE_DOUBLE_3D writes double precision 3-D array data
!===============================================================================
subroutine write_double_3D(group_id, name, buffer, indep)
@ -631,7 +633,7 @@ contains
end subroutine write_double_3D_explicit
!===============================================================================
! READ_DOUBLE_3DARRAY reads double precision 3-D array data
! READ_DOUBLE_3D reads double precision 3-D array data
!===============================================================================
subroutine read_double_3D(group_id, name, buffer, indep)
@ -689,7 +691,7 @@ contains
end subroutine read_double_3D_explicit
!===============================================================================
! WRITE_DOUBLE_4DARRAY writes double precision 4-D array data
! WRITE_DOUBLE_4D writes double precision 4-D array data
!===============================================================================
subroutine write_double_4D(group_id, name, buffer, indep)
@ -751,7 +753,7 @@ contains
end subroutine write_double_4D_explicit
!===============================================================================
! READ_DOUBLE_4DARRAY reads double precision 4-D array data
! READ_DOUBLE_4D reads double precision 4-D array data
!===============================================================================
subroutine read_double_4D(group_id, name, buffer, indep)
@ -896,7 +898,7 @@ contains
end subroutine read_integer
!===============================================================================
! WRITE_INTEGER_1DARRAY writes integer precision 1-D array data
! WRITE_INTEGER_1D writes integer precision 1-D array data
!===============================================================================
subroutine write_integer_1D(group_id, name, buffer, indep)
@ -958,7 +960,7 @@ contains
end subroutine write_integer_1D_explicit
!===============================================================================
! READ_INTEGER_1DARRAY reads integer precision 1-D array data
! READ_INTEGER_1D reads integer precision 1-D array data
!===============================================================================
subroutine read_integer_1D(group_id, name, buffer, indep)
@ -1016,7 +1018,7 @@ contains
end subroutine read_integer_1D_explicit
!===============================================================================
! WRITE_INTEGER_2DARRAY writes integer precision 2-D array data
! WRITE_INTEGER_2D writes integer precision 2-D array data
!===============================================================================
subroutine write_integer_2D(group_id, name, buffer, indep)
@ -1078,7 +1080,7 @@ contains
end subroutine write_integer_2D_explicit
!===============================================================================
! READ_INTEGER_2DARRAY reads integer precision 2-D array data
! READ_INTEGER_2D reads integer precision 2-D array data
!===============================================================================
subroutine read_integer_2D(group_id, name, buffer, indep)
@ -1136,7 +1138,7 @@ contains
end subroutine read_integer_2D_explicit
!===============================================================================
! WRITE_INTEGER_3DARRAY writes integer precision 3-D array data
! WRITE_INTEGER_3D writes integer precision 3-D array data
!===============================================================================
subroutine write_integer_3D(group_id, name, buffer, indep)
@ -1198,7 +1200,7 @@ contains
end subroutine write_integer_3D_explicit
!===============================================================================
! READ_INTEGER_3DARRAY reads integer precision 3-D array data
! READ_INTEGER_3D reads integer precision 3-D array data
!===============================================================================
subroutine read_integer_3D(group_id, name, buffer, indep)
@ -1256,7 +1258,7 @@ contains
end subroutine read_integer_3D_explicit
!===============================================================================
! WRITE_INTEGER_4DARRAY writes integer precision 4-D array data
! WRITE_INTEGER_4D writes integer precision 4-D array data
!===============================================================================
subroutine write_integer_4D(group_id, name, buffer, indep)
@ -1318,7 +1320,7 @@ contains
end subroutine write_integer_4D_explicit
!===============================================================================
! READ_INTEGER_4DARRAY reads integer precision 4-D array data
! READ_INTEGER_4D reads integer precision 4-D array data
!===============================================================================
subroutine read_integer_4D(group_id, name, buffer, indep)
@ -1469,10 +1471,9 @@ contains
subroutine write_string(group_id, name, buffer, indep)
integer(HID_T), intent(in) :: group_id
character(*), intent(in) :: name ! name for data
character(*), intent(in) :: buffer ! read data to here
character(*), intent(in), target :: buffer ! read data to here
logical, intent(in), optional :: indep ! independent I/O
integer :: n
integer :: hdf5_err
integer :: data_xfer_mode
#ifdef PHDF5
@ -1480,9 +1481,10 @@ contains
#endif
integer(HID_T) :: dset ! data set handle
integer(HID_T) :: dspace ! data or file space handle
integer(HSIZE_T) :: dims1(1)
integer(HSIZE_T) :: dims2(2)
character(len=len_trim(buffer)), dimension(1) :: str_tmp
integer(HID_T) :: filetype
integer(HID_T) :: memtype
integer(HSIZE_T) :: n
type(c_ptr) :: f_ptr
! Set up collective vs. independent I/O
data_xfer_mode = H5FD_MPIO_COLLECTIVE_F
@ -1490,37 +1492,37 @@ contains
if (indep) data_xfer_mode = H5FD_MPIO_INDEPENDENT_F
end if
! Insert null character at end of string when writing
call h5tset_strpad_f(H5T_STRING, H5T_STR_NULLPAD_F, hdf5_err)
! Create the dataspace and dataset
dims1(1) = 1
call h5screate_simple_f(1, dims1, dspace, hdf5_err)
call h5dcreate_f(group_id, trim(name), H5T_STRING, dspace, dset, hdf5_err)
! Set up dimesnions of string to write
! Create datatype for HDF5 file based on C char
n = len_trim(buffer)
dims2(:) = [n, 1] ! full array of strings to write
dims1(1) = n ! length of string
call h5tcopy_f(H5T_C_S1, filetype, hdf5_err)
call h5tset_size_f(filetype, n + 1, hdf5_err)
! Copy over string buffer to a rank 1 array
str_tmp(1) = buffer
! Create datatype in memory based on Fortran character
call h5tcopy_f(H5T_FORTRAN_S1, memtype, hdf5_err)
if (n > 0) call h5tset_size_f(memtype, n, hdf5_err)
! Create dataspace/dataset
call h5screate_f(H5S_SCALAR_F, dspace, hdf5_err)
call h5dcreate_f(group_id, trim(name), filetype, dspace, dset, hdf5_err)
! Get pointer to start of string
f_ptr = c_loc(buffer(1:1))
if (using_mpio_device(group_id)) then
#ifdef PHDF5
call h5pcreate_f(H5P_DATASET_XFER_F, plist, hdf5_err)
call h5pset_dxpl_mpio_f(plist, data_xfer_mode, hdf5_err)
call h5dwrite_vl_f(dset, H5T_STRING, str_tmp, dims2, dims1, hdf5_err, &
mem_space_id=dspace, xfer_prp=plist)
if (n > 0) call h5dwrite_f(dset, memtype, f_ptr, hdf5_err, xfer_prp=plist)
call h5pclose_f(plist, hdf5_err)
#endif
else
call h5dwrite_vl_f(dset, H5T_STRING, str_tmp, dims2, dims1, hdf5_err, &
mem_space_id=dspace)
if (n > 0) call h5dwrite_f(dset, memtype, f_ptr, hdf5_err)
end if
call h5dclose_f(dset, hdf5_err)
call h5sclose_f(dspace, hdf5_err)
call h5tclose_f(memtype, hdf5_err)
call h5tclose_f(filetype, hdf5_err)
end subroutine write_string
!===============================================================================
@ -1529,11 +1531,10 @@ contains
subroutine read_string(group_id, name, buffer, indep)
integer(HID_T), intent(in) :: group_id
character(*), intent(in) :: name ! name for data
character(*), intent(inout) :: buffer ! read data to here
logical, intent(in), optional :: indep ! independent I/O
character(*), intent(in) :: name ! name for data
character(*), intent(inout), target :: buffer ! read data to here
logical, intent(in), optional :: indep ! independent I/O
integer :: n
integer :: hdf5_err
integer :: data_xfer_mode
#ifdef PHDF5
@ -1541,9 +1542,11 @@ contains
#endif
integer(HID_T) :: dset ! data set handle
integer(HID_T) :: dspace ! data or file space handle
integer(HSIZE_T) :: dims1(1)
integer(HSIZE_T) :: dims2(2)
character(len=len_trim(buffer)), dimension(1) :: str_tmp
integer(HID_T) :: filetype
integer(HID_T) :: memtype
integer(HSIZE_T) :: size
integer(HSIZE_T) :: n
type(c_ptr) :: f_ptr
! Set up collective vs. independent I/O
data_xfer_mode = H5FD_MPIO_COLLECTIVE_F
@ -1551,34 +1554,206 @@ contains
if (indep) data_xfer_mode = H5FD_MPIO_INDEPENDENT_F
end if
! Set up dimesnions of string to write
n = len_trim(buffer)
dims2(:) = [n, 1] ! full array of strings to write
dims1(1) = n ! length of string
! Get dataset and dataspace
call h5dopen_f(group_id, trim(name), dset, hdf5_err)
call h5dget_space_f(dset, dspace, hdf5_err)
! Make sure buffer is large enough
call h5dget_type_f(dset, filetype, hdf5_err)
call h5tget_size_f(filetype, size, hdf5_err)
if (size > len(buffer) + 1) then
call fatal_error("Character buffer is not long enough to &
&read HDF5 string.")
end if
! Get datatype in memory based on Fortran character
n = len(buffer)
call h5tcopy_f(H5T_FORTRAN_S1, memtype, hdf5_err)
call h5tset_size_f(memtype, n, hdf5_err)
! Get pointer to start of string
f_ptr = c_loc(buffer(1:1))
if (using_mpio_device(group_id)) then
#ifdef PHDF5
call h5pcreate_f(H5P_DATASET_XFER_F, plist, hdf5_err)
call h5pset_dxpl_mpio_f(plist, data_xfer_mode, hdf5_err)
call h5dread_vl_f(dset, H5T_STRING, str_tmp, dims2, dims1, hdf5_err, &
mem_space_id=dspace, xfer_prp=plist)
call h5dread_f(dset, memtype, f_ptr, hdf5_err, mem_space_id=dspace, &
xfer_prp=plist)
call h5pclose_f(plist, hdf5_err)
#endif
else
call h5dread_vl_f(dset, H5T_STRING, str_tmp, dims2, dims1, hdf5_err, &
mem_space_id=dspace)
call h5dread_f(dset, memtype, f_ptr, hdf5_err, mem_space_id=dspace)
end if
! Copy over buffer
buffer = str_tmp(1)
! Close dataset
call h5dclose_f(dset, hdf5_err)
call h5sclose_f(dspace, hdf5_err)
call h5tclose_f(filetype, hdf5_err)
call h5tclose_f(memtype, hdf5_err)
end subroutine read_string
!===============================================================================
! WRITE_STRING_1D writes string 1-D array data
!===============================================================================
subroutine write_string_1D(group_id, name, buffer, indep)
integer(HID_T), intent(in) :: group_id
character(*), intent(in) :: name ! name for data
character(*), intent(in), target :: buffer(:) ! read data to here
logical, intent(in), optional :: indep ! independent I/O
integer(HSIZE_T) :: dims(1)
dims(:) = shape(buffer)
if (present(indep)) then
call write_string_1D_explicit(group_id, dims, name, buffer, indep)
else
call write_string_1D_explicit(group_id, dims, name, buffer)
end if
end subroutine write_string_1D
subroutine write_string_1D_explicit(group_id, dims, name, buffer, indep)
integer(HID_T), intent(in) :: group_id
integer(HSIZE_T), intent(in) :: dims(1)
character(*), intent(in) :: name
character(*), intent(in), target :: buffer(dims(1))
logical, intent(in), optional :: indep ! independent I/O
integer :: hdf5_err
integer :: data_xfer_mode
#ifdef PHDF5
integer(HID_T) :: plist ! property list
#endif
integer(HID_T) :: dset ! data set handle
integer(HID_T) :: dspace ! data or file space handle
integer(HID_T) :: filetype
integer(HID_T) :: memtype
integer(HSIZE_T) :: n
type(c_ptr) :: f_ptr
! Set up collective vs. independent I/O
data_xfer_mode = H5FD_MPIO_COLLECTIVE_F
if (present(indep)) then
if (indep) data_xfer_mode = H5FD_MPIO_INDEPENDENT_F
end if
! Create datatype for HDF5 file based on C char
n = maxval(len_trim(buffer))
call h5tcopy_f(H5T_C_S1, filetype, hdf5_err)
call h5tset_size_f(filetype, n + 1, hdf5_err)
! Create datatype in memory based on Fortran character
call h5tcopy_f(H5T_FORTRAN_S1, memtype, hdf5_err)
call h5tset_size_f(memtype, int(len(buffer(1)), HSIZE_T), hdf5_err)
! Create dataspace/dataset
call h5screate_simple_f(1, dims, dspace, hdf5_err)
call h5dcreate_f(group_id, trim(name), filetype, dspace, dset, hdf5_err)
! Get pointer to start of string
f_ptr = c_loc(buffer(1)(1:1))
if (using_mpio_device(group_id)) then
#ifdef PHDF5
call h5pcreate_f(H5P_DATASET_XFER_F, plist, hdf5_err)
call h5pset_dxpl_mpio_f(plist, data_xfer_mode, hdf5_err)
if (n > 0) call h5dwrite_f(dset, memtype, f_ptr, hdf5_err, xfer_prp=plist)
call h5pclose_f(plist, hdf5_err)
#endif
else
if (n > 0) call h5dwrite_f(dset, memtype, f_ptr, hdf5_err)
end if
call h5dclose_f(dset, hdf5_err)
call h5sclose_f(dspace, hdf5_err)
call h5tclose_f(memtype, hdf5_err)
call h5tclose_f(filetype, hdf5_err)
end subroutine write_string_1D_explicit
!===============================================================================
! READ_STRING_1D reads string 1-D array data
!===============================================================================
subroutine read_string_1D(group_id, name, buffer, indep)
integer(HID_T), intent(in) :: group_id
character(*), intent(in) :: name
character(*), intent(inout), target :: buffer(:)
logical, intent(in), optional :: indep ! independent I/O
integer(HSIZE_T) :: dims(1)
dims(:) = shape(buffer)
if (present(indep)) then
call read_string_1D_explicit(group_id, dims, name, buffer, indep)
else
call read_string_1D_explicit(group_id, dims, name, buffer)
end if
end subroutine read_string_1D
subroutine read_string_1D_explicit(group_id, dims, name, buffer, indep)
integer(HID_T), intent(in) :: group_id
integer(HSIZE_T), intent(in) :: dims(1)
character(*), intent(in) :: name
character(*), intent(inout), target :: buffer(dims(1))
logical, intent(in), optional :: indep ! independent I/O
integer :: hdf5_err
integer :: data_xfer_mode
#ifdef PHDF5
integer(HID_T) :: plist ! property list
#endif
integer(HID_T) :: dset ! data set handle
integer(HID_T) :: dspace ! data or file space handle
integer(HID_T) :: filetype
integer(HID_T) :: memtype
integer(HSIZE_T) :: size
integer(HSIZE_T) :: n
type(c_ptr) :: f_ptr
! Set up collective vs. independent I/O
data_xfer_mode = H5FD_MPIO_COLLECTIVE_F
if (present(indep)) then
if (indep) data_xfer_mode = H5FD_MPIO_INDEPENDENT_F
end if
! Get dataset and dataspace
call h5dopen_f(group_id, trim(name), dset, hdf5_err)
call h5dget_space_f(dset, dspace, hdf5_err)
! Make sure buffer is large enough
call h5dget_type_f(dset, filetype, hdf5_err)
call h5tget_size_f(filetype, size, hdf5_err)
if (size > len(buffer(1)) + 1) then
call fatal_error("Character buffer is not long enough to &
&read HDF5 string array.")
end if
! Get datatype in memory based on Fortran character
n = len(buffer(1))
call h5tcopy_f(H5T_FORTRAN_S1, memtype, hdf5_err)
call h5tset_size_f(memtype, n, hdf5_err)
! Get pointer to start of string
f_ptr = c_loc(buffer(1)(1:1))
if (using_mpio_device(group_id)) then
#ifdef PHDF5
call h5pcreate_f(H5P_DATASET_XFER_F, plist, hdf5_err)
call h5pset_dxpl_mpio_f(plist, data_xfer_mode, hdf5_err)
call h5dread_f(dset, memtype, f_ptr, hdf5_err, mem_space_id=dspace, &
xfer_prp=plist)
call h5pclose_f(plist, hdf5_err)
#endif
else
call h5dread_f(dset, memtype, f_ptr, hdf5_err, mem_space_id=dspace)
end if
call h5dclose_f(dset, hdf5_err)
call h5sclose_f(dspace, hdf5_err)
call h5tclose_f(filetype, hdf5_err)
call h5tclose_f(memtype, hdf5_err)
end subroutine read_string_1D_explicit
!===============================================================================
! WRITE_ATTRIBUTE_STRING
!===============================================================================

View file

@ -321,7 +321,7 @@ contains
integer :: i ! loop index
integer :: argc ! number of command line arguments
integer :: last_flag ! index of last flag
integer :: filetype
character(MAX_WORD_LEN) :: filetype
integer(HID_T) :: file_id
character(MAX_WORD_LEN), allocatable :: argv(:) ! command line arguments
@ -366,10 +366,10 @@ contains
! Set path and flag for type of run
select case (filetype)
case (FILETYPE_STATEPOINT)
case ('statepoint')
path_state_point = argv(i)
restart_run = .true.
case (FILETYPE_PARTICLE_RESTART)
case ('particle restart')
path_particle_restart = argv(i)
particle_restart_run = .true.
case default
@ -389,7 +389,7 @@ contains
file_id = file_open(argv(i), 'r', parallel=.true.)
call read_dataset(file_id, 'filetype', filetype)
call file_close(file_id)
if (filetype /= FILETYPE_SOURCE) then
if (filetype /= 'source') then
call fatal_error("Second file after restart flag must be a &
&source file")
end if

View file

@ -8,7 +8,7 @@ module input_xml
use geometry_header, only: Cell, Surface, Lattice, RectLattice, HexLattice
use global
use list_header, only: ListChar, ListReal
use mesh_header, only: StructuredMesh
use mesh_header, only: RegularMesh
use output, only: write_message
use plot_header
use random_lcg, only: prn
@ -2091,9 +2091,9 @@ contains
character(MAX_WORD_LEN) :: temp_str
character(MAX_WORD_LEN), allocatable :: sarray(:)
type(DictCharInt) :: trigger_scores
type(ElemKeyValueCI), pointer :: pair_list => null()
type(TallyObject), pointer :: t => null()
type(StructuredMesh), pointer :: m => null()
type(ElemKeyValueCI), pointer :: pair_list
type(TallyObject), pointer :: t
type(RegularMesh), pointer :: m
type(TallyFilter), allocatable :: filters(:) ! temporary filters
type(Node), pointer :: doc => null()
type(Node), pointer :: node_mesh => null()
@ -2188,9 +2188,11 @@ contains
call get_node_value(node_mesh, "type", temp_str)
select case (to_lower(temp_str))
case ('rect', 'rectangle', 'rectangular')
m % type = LATTICE_RECT
case ('hex', 'hexagon', 'hexagonal')
m % type = LATTICE_HEX
call warning("Mesh type '" // trim(temp_str) // "' is deprecated. &
&Please use 'regular' instead.")
m % type = MESH_REGULAR
case ('regular')
m % type = MESH_REGULAR
case default
call fatal_error("Invalid mesh type: " // trim(temp_str))
end select
@ -2730,7 +2732,7 @@ contains
t % moment_order(j : j + n_bins - 1) = n_order
j = j + n_bins - 1
case ('total')
case ('total', '(n,total)')
t % score_bins(j) = SCORE_TOTAL
if (t % find_filter(FILTER_ENERGYOUT) > 0) then
call fatal_error("Cannot tally total reaction rate with an &
@ -2816,13 +2818,13 @@ contains
! Set tally estimator to analog
t % estimator = ESTIMATOR_ANALOG
case ('n2n')
case ('n2n', '(n,2n)')
t % score_bins(j) = N_2N
case ('n3n')
case ('n3n', '(n,3n)')
t % score_bins(j) = N_3N
case ('n4n')
case ('n4n', '(n,4n)')
t % score_bins(j) = N_4N
case ('absorption')
@ -2903,6 +2905,79 @@ contains
case ('events')
t % score_bins(j) = SCORE_EVENTS
case ('elastic', '(n,elastic)')
t % score_bins(j) = ELASTIC
case ('(n,2nd)')
t % score_bins(j) = N_2ND
case ('(n,na)')
t % score_bins(j) = N_2NA
case ('(n,n3a)')
t % score_bins(j) = N_N3A
case ('(n,2na)')
t % score_bins(j) = N_2NA
case ('(n,3na)')
t % score_bins(j) = N_3NA
case ('(n,np)')
t % score_bins(j) = N_NP
case ('(n,n2a)')
t % score_bins(j) = N_N2A
case ('(n,2n2a)')
t % score_bins(j) = N_2N2A
case ('(n,nd)')
t % score_bins(j) = N_ND
case ('(n,nt)')
t % score_bins(j) = N_NT
case ('(n,nHe-3)')
t % score_bins(j) = N_N3HE
case ('(n,nd2a)')
t % score_bins(j) = N_ND2A
case ('(n,nt2a)')
t % score_bins(j) = N_NT2A
case ('(n,3nf)')
t % score_bins(j) = N_3NF
case ('(n,2np)')
t % score_bins(j) = N_2NP
case ('(n,3np)')
t % score_bins(j) = N_3NP
case ('(n,n2p)')
t % score_bins(j) = N_N2P
case ('(n,npa)')
t % score_bins(j) = N_NPA
case ('(n,n1)')
t % score_bins(j) = N_N1
case ('(n,nc)')
t % score_bins(j) = N_NC
case ('(n,gamma)')
t % score_bins(j) = N_GAMMA
case ('(n,p)')
t % score_bins(j) = N_P
case ('(n,d)')
t % score_bins(j) = N_D
case ('(n,t)')
t % score_bins(j) = N_T
case ('(n,3He)')
t % score_bins(j) = N_3HE
case ('(n,a)')
t % score_bins(j) = N_A
case ('(n,2a)')
t % score_bins(j) = N_2A
case ('(n,3a)')
t % score_bins(j) = N_3A
case ('(n,2p)')
t % score_bins(j) = N_2P
case ('(n,pa)')
t % score_bins(j) = N_PA
case ('(n,t2a)')
t % score_bins(j) = N_T2A
case ('(n,d2a)')
t % score_bins(j) = N_D2A
case ('(n,pd)')
t % score_bins(j) = N_PD
case ('(n,pt)')
t % score_bins(j) = N_PT
case ('(n,da)')
t % score_bins(j) = N_DA
case default
! Assume that user has specified an MT number
MT = int(str_to_int(score_name))
@ -3132,15 +3207,26 @@ contains
! tally needs post-collision information
if (t % estimator == ESTIMATOR_ANALOG) then
call fatal_error("Cannot use track-length estimator for tally " &
&// to_str(t % id))
// to_str(t % id))
end if
! Set estimator to track-length estimator
t % estimator = ESTIMATOR_TRACKLENGTH
case ('collision')
! If the estimator was set to an analog estimator, this means the
! tally needs post-collision information
if (t % estimator == ESTIMATOR_ANALOG) then
call fatal_error("Cannot use collision estimator for tally " &
// to_str(t % id))
end if
! Set estimator to collision estimator
t % estimator = ESTIMATOR_COLLISION
case default
call fatal_error("Invalid estimator '" // trim(temp_str) &
&// "' on tally " // to_str(t % id))
// "' on tally " // to_str(t % id))
end select
end if

View file

@ -20,7 +20,7 @@ contains
subroutine get_mesh_bin(m, xyz, bin)
type(StructuredMesh), pointer :: m ! mesh pointer
type(RegularMesh), pointer :: m ! mesh pointer
real(8), intent(in) :: xyz(:) ! coordinates
integer, intent(out) :: bin ! tally bin
@ -73,7 +73,7 @@ contains
subroutine get_mesh_indices(m, xyz, ijk, in_mesh)
type(StructuredMesh), pointer :: m
type(RegularMesh), pointer :: m
real(8), intent(in) :: xyz(:) ! coordinates to check
integer, intent(out) :: ijk(:) ! indices in mesh
logical, intent(out) :: in_mesh ! were given coords in mesh?
@ -98,7 +98,7 @@ contains
function mesh_indices_to_bin(m, ijk, surface_current) result(bin)
type(StructuredMesh), pointer :: m
type(RegularMesh), pointer :: m
integer, intent(in) :: ijk(:)
logical, optional :: surface_current
integer :: bin
@ -132,7 +132,7 @@ contains
subroutine bin_to_mesh_indices(m, bin, ijk)
type(StructuredMesh), pointer :: m
type(RegularMesh), pointer :: m
integer, intent(in) :: bin
integer, intent(out) :: ijk(:)
@ -163,7 +163,7 @@ contains
subroutine count_bank_sites(m, bank_array, cnt, energies, size_bank, &
sites_outside)
type(StructuredMesh), pointer :: m ! mesh to count sites
type(RegularMesh), pointer :: m ! mesh to count sites
type(Bank), intent(in) :: bank_array(:) ! fission or source bank
real(8), intent(out) :: cnt(:,:,:,:) ! weight of sites in each
! cell and energy group
@ -264,7 +264,7 @@ contains
function mesh_intersects_2d(m, xyz0, xyz1) result(intersects)
type(StructuredMesh), pointer :: m
type(RegularMesh), pointer :: m
real(8), intent(in) :: xyz0(2)
real(8), intent(in) :: xyz1(2)
logical :: intersects
@ -330,7 +330,7 @@ contains
function mesh_intersects_3d(m, xyz0, xyz1) result(intersects)
type(StructuredMesh), pointer :: m
type(RegularMesh), pointer :: m
real(8), intent(in) :: xyz0(3)
real(8), intent(in) :: xyz1(3)
logical :: intersects

View file

@ -7,7 +7,7 @@ module mesh_header
! congruent squares or cubes
!===============================================================================
type StructuredMesh
type RegularMesh
integer :: id ! user-specified id
integer :: type ! rectangular, hexagonal
integer :: n_dimension ! rank of mesh
@ -16,6 +16,6 @@ module mesh_header
real(8), allocatable :: lower_left(:) ! lower-left corner of mesh
real(8), allocatable :: upper_right(:) ! upper-right corner of mesh
real(8), allocatable :: width(:) ! width of each mesh cell
end type StructuredMesh
end type RegularMesh
end module mesh_header

View file

@ -10,7 +10,7 @@ module output
HexLattice, BASE_UNIVERSE
use global
use math, only: t_percentile
use mesh_header, only: StructuredMesh
use mesh_header, only: RegularMesh
use mesh, only: mesh_indices_to_bin, bin_to_mesh_indices
use particle_header, only: LocalCoord, Particle
use plot_header
@ -315,694 +315,6 @@ contains
end subroutine print_particle
!===============================================================================
! PRINT_REACTION displays the attributes of a reaction
!===============================================================================
subroutine print_reaction(rxn)
type(Reaction), pointer :: rxn
write(ou,*) 'Reaction ' // reaction_name(rxn % MT)
write(ou,*) ' MT = ' // to_str(rxn % MT)
write(ou,*) ' Q-value = ' // to_str(rxn % Q_value)
write(ou,*) ' Multiplicity = ' // to_str(rxn % multiplicity)
write(ou,*) ' Threshold = ' // to_str(rxn % threshold)
if (rxn % has_energy_dist) then
write(ou,*) ' Energy: Law ' // to_str(rxn % edist % law)
end if
write(ou,*)
end subroutine print_reaction
!===============================================================================
! PRINT_CELL displays the attributes of a cell
!===============================================================================
subroutine print_cell(c, unit)
type(Cell), pointer :: c
integer, optional :: unit ! specified unit to write to
integer :: index_cell ! index in cells array
integer :: i ! loop index for surfaces
integer :: index_surf ! index in surfaces array
integer :: unit_ ! unit to write to
character(MAX_LINE_LEN) :: string
type(Universe), pointer :: u => null()
class(Lattice), pointer :: l => null()
type(Material), pointer :: m => null()
! Set unit to stdout if not already set
if (present(unit)) then
unit_ = unit
else
unit_ = OUTPUT_UNIT
end if
! Write user-specified id for cell
write(unit_,*) 'Cell ' // to_str(c % id)
! Write user-specified name for cell
write(unit_,*) ' Name = ' // c % name
! Find index in cells array and write
index_cell = cell_dict % get_key(c % id)
write(unit_,*) ' Array Index = ' // to_str(index_cell)
! Write what universe this cell is in
u => universes(c % universe)
write(unit_,*) ' Universe = ' // to_str(u % id)
! Write information on fill for cell
select case (c % type)
case (CELL_NORMAL)
write(unit_,*) ' Fill = NONE'
case (CELL_FILL)
u => universes(c % fill)
write(unit_,*) ' Fill = Universe ' // to_str(u % id)
case (CELL_LATTICE)
l => lattices(c % fill) % obj
write(unit_,*) ' Fill = Lattice ' // to_str(l % id)
end select
! Write information on material
if (c % material == 0) then
write(unit_,*) ' Material = NONE'
elseif (c % material == MATERIAL_VOID) then
write(unit_,*) ' Material = Void'
else
m => materials(c % material)
write(unit_,*) ' Material = ' // to_str(m % id)
end if
! Write surface specification
string = ""
do i = 1, c % n_surfaces
select case (c % surfaces(i))
case (OP_LEFT_PAREN)
string = trim(string) // ' ('
case (OP_RIGHT_PAREN)
string = trim(string) // ' )'
case (OP_UNION)
string = trim(string) // ' :'
case (OP_DIFFERENCE)
string = trim(string) // ' !'
case default
index_surf = abs(c % surfaces(i))
string = trim(string) // ' ' // to_str(sign(&
surfaces(index_surf) % id, c % surfaces(i)))
end select
end do
write(unit_,*) ' Surface Specification:' // trim(string)
write(unit_,*)
end subroutine print_cell
!===============================================================================
! PRINT_UNIVERSE displays the attributes of a universe
!===============================================================================
subroutine print_universe(univ, unit)
type(Universe), pointer :: univ
integer, optional :: unit
integer :: i ! loop index for cells in this universe
integer :: unit_ ! unit to write to
character(MAX_LINE_LEN) :: string
type(Cell), pointer :: c => null()
type(Universe), pointer :: base_u => null()
! Set default unit to stdout if not specified
if (present(unit)) then
unit_ = unit
else
unit_ = OUTPUT_UNIT
end if
! Get a pointer to the base universe
base_u => universes(BASE_UNIVERSE)
! Write user-specified id for this universe
write(unit_,*) 'Universe ' // to_str(univ % id)
! If this is the base universe, indicate so
if (associated(univ, base_u)) then
write(unit_,*) ' Base Universe'
end if
! Write list of cells in this universe
string = ""
do i = 1, univ % n_cells
c => cells(univ % cells(i))
string = trim(string) // ' ' // to_str(c % id)
end do
write(unit_,*) ' Cells =' // trim(string)
write(unit_,*)
end subroutine print_universe
!===============================================================================
! PRINT_LATTICE displays the attributes of a lattice
!===============================================================================
subroutine print_lattice(lat, unit)
class(Lattice), pointer :: lat
integer, optional :: unit
integer :: unit_ ! unit to write to
! set default unit if not specified
if (present(unit)) then
unit_ = unit
else
unit_ = OUTPUT_UNIT
end if
! Write information about lattice
write(unit_,*) 'Lattice ' // to_str(lat % id)
! Write user-specified name for lattice
write(unit_,*) ' Name = ' // lat % name
select type(lat)
type is (RectLattice)
! Write dimension of lattice.
if (lat % is_3d) then
write(unit_, *) ' Dimension = ' // to_str(lat % n_cells(1)) &
&// ' ' // to_str(lat % n_cells(2)) // ' ' &
&// to_str(lat % n_cells(3))
else
write(unit_, *) ' Dimension = ' // to_str(lat % n_cells(1)) &
&// ' ' // to_str(lat % n_cells(2))
end if
! Write lower-left coordinates of lattice.
if (lat % is_3d) then
write(unit_, *) ' Lower-left = ' // to_str(lat % lower_left(1)) &
&// ' ' // to_str(lat % lower_left(2)) // ' ' &
&// to_str(lat % lower_left(3))
else
write(unit_, *) ' Lower-left = ' // to_str(lat % lower_left(1)) &
&// ' ' // to_str(lat % lower_left(2))
end if
! Write lattice pitch along each axis.
if (lat % is_3d) then
write(unit_, *) ' Pitch = ' // to_str(lat % pitch(1)) &
&// ' ' // to_str(lat % pitch(2)) // ' ' &
&// to_str(lat % pitch(3))
else
write(unit_, *) ' Pitch = ' // to_str(lat % pitch(1)) &
&// ' ' // to_str(lat % pitch(2))
end if
write(unit_,*)
type is (HexLattice)
! Write dimension of lattice.
write(unit_,*) ' N-rings = ' // to_str(lat % n_rings)
if (lat % is_3d) write(unit_,*) ' N-axial = ' // to_str(lat % n_axial)
! Write center coordinates of lattice.
if (lat % is_3d) then
write(unit_, *) ' Center = ' // to_str(lat % center(1)) &
&// ' ' // to_str(lat % center(2)) // ' ' &
&// to_str(lat % center(3))
else
write(unit_, *) ' Center = ' // to_str(lat % center(1)) &
&// ' ' // to_str(lat % center(2))
end if
! Write lattice pitch along each axis.
if (lat % is_3d) then
write(unit_, *) ' Pitch = ' // to_str(lat % pitch(1)) &
&// ' ' // to_str(lat % pitch(2))
else
write(unit_, *) ' Pitch = ' // to_str(lat % pitch(1))
end if
write(unit_,*)
end select
end subroutine print_lattice
!===============================================================================
! PRINT_SURFACE displays the attributes of a surface
!===============================================================================
subroutine print_surface(surf, unit)
type(Surface), pointer :: surf
integer, optional :: unit ! specified unit to write to
integer :: i ! loop index for coefficients
integer :: unit_ ! unit to write to
character(MAX_LINE_LEN) :: string
type(Cell), pointer :: c => null()
! set default unit if not specified
if (present(unit)) then
unit_ = unit
else
unit_ = OUTPUT_UNIT
end if
! Write user-specified id of surface
write(unit_,*) 'Surface ' // to_str(surf % id)
! Write user-specified name for surface
write(unit_,*) ' Name = ' // surf % name
! Write type of surface
select case (surf % type)
case (SURF_PX)
string = "X Plane"
case (SURF_PY)
string = "Y Plane"
case (SURF_PZ)
string = "Z Plane"
case (SURF_PLANE)
string = "Plane"
case (SURF_CYL_X)
string = "X Cylinder"
case (SURF_CYL_Y)
string = "Y Cylinder"
case (SURF_CYL_Z)
string = "Z Cylinder"
case (SURF_SPHERE)
string = "Sphere"
case (SURF_CONE_X)
string = "X Cone"
case (SURF_CONE_Y)
string = "Y Cone"
case (SURF_CONE_Z)
string = "Z Cone"
end select
write(unit_,*) ' Type = ' // trim(string)
! Write coefficients for this surface
string = ""
do i = 1, size(surf % coeffs)
string = trim(string) // ' ' // to_str(surf % coeffs(i), 4)
end do
write(unit_,*) ' Coefficients = ' // trim(string)
! Write neighboring cells on positive side of this surface
string = ""
if (allocated(surf % neighbor_pos)) then
do i = 1, size(surf % neighbor_pos)
c => cells(abs(surf % neighbor_pos(i)))
string = trim(string) // ' ' // to_str(&
sign(c % id, surf % neighbor_pos(i)))
end do
end if
write(unit_,*) ' Positive Neighbors = ' // trim(string)
! Write neighboring cells on negative side of this surface
string = ""
if (allocated(surf % neighbor_neg)) then
do i = 1, size(surf % neighbor_neg)
c => cells(abs(surf % neighbor_neg(i)))
string = trim(string) // ' ' // to_str(&
sign(c % id, surf % neighbor_neg(i)))
end do
end if
write(unit_,*) ' Negative Neighbors =' // trim(string)
! Write boundary condition for this surface
select case (surf % bc)
case (BC_TRANSMIT)
write(unit_,*) ' Boundary Condition = Transmission'
case (BC_VACUUM)
write(unit_,*) ' Boundary Condition = Vacuum'
case (BC_REFLECT)
write(unit_,*) ' Boundary Condition = Reflective'
case (BC_PERIODIC)
write(unit_,*) ' Boundary Condition = Periodic'
end select
write(unit_,*)
end subroutine print_surface
!===============================================================================
! PRINT_MATERIAL displays the attributes of a material
!===============================================================================
subroutine print_material(mat, unit)
type(Material), pointer :: mat
integer, optional :: unit
integer :: i ! loop index for nuclides
integer :: unit_ ! unit to write to
real(8) :: density ! density in atom/b-cm
character(MAX_LINE_LEN) :: string
type(Nuclide), pointer :: nuc => null()
! set default unit to stdout if not specified
if (present(unit)) then
unit_ = unit
else
unit_ = OUTPUT_UNIT
end if
! Write identifier for material
write(unit_,*) 'Material ' // to_str(mat % id)
! Write user-specified name for material
write(unit_,*) ' Name = ' // mat % name
! Write total atom density in atom/b-cm
write(unit_,*) ' Atom Density = ' // trim(to_str(mat % density)) &
// ' atom/b-cm'
! Write atom density for each nuclide in material
write(unit_,*) ' Nuclides:'
do i = 1, mat % n_nuclides
nuc => nuclides(mat % nuclide(i))
density = mat % atom_density(i)
string = ' ' // trim(nuc % name) // ' = ' // &
trim(to_str(density)) // ' atom/b-cm'
write(unit_,*) trim(string)
end do
! Write information on S(a,b) table
if (mat % n_sab > 0) then
write(unit_,*) ' S(a,b) tables:'
do i = 1, mat % n_sab
write(unit_,*) ' ' // trim(&
sab_tables(mat % i_sab_tables(i)) % name)
end do
end if
write(unit_,*)
end subroutine print_material
!===============================================================================
! PRINT_TALLY displays the attributes of a tally
!===============================================================================
subroutine print_tally(t, unit)
type(TallyObject), pointer :: t
integer, optional :: unit
integer :: i ! index for filter or score bins
integer :: j ! index in filters array
integer :: id ! user-specified id
integer :: unit_ ! unit to write to
integer :: n ! moment order to include in name
character(MAX_LINE_LEN) :: string
character(MAX_WORD_LEN) :: pn_string
type(Cell), pointer :: c => null()
type(Surface), pointer :: s => null()
type(Universe), pointer :: u => null()
type(Material), pointer :: m => null()
type(StructuredMesh), pointer :: sm => null()
! set default unit to stdout if not specified
if (present(unit)) then
unit_ = unit
else
unit_ = OUTPUT_UNIT
end if
! Write user-specified id of tally
write(unit_,*) 'Tally ' // to_str(t % id)
! Write the type of tally
select case(t % type)
case (TALLY_VOLUME)
write(unit_,*) ' Type: Volume'
case (TALLY_SURFACE_CURRENT)
write(unit_,*) ' Type: Surface Current'
end select
! Write the estimator used
select case(t % estimator)
case(ESTIMATOR_ANALOG)
write(unit_,*) ' Estimator: Analog'
case(ESTIMATOR_TRACKLENGTH)
write(unit_,*) ' Estimator: Track-length'
end select
! Write any cells bins if present
j = t % find_filter(FILTER_DISTRIBCELL)
if (j > 0) then
string = ""
id = t % filters(j) % int_bins(1)
c => cells(id)
string = trim(string) // ' ' // trim(to_str(c % id))
write(unit_, *) ' Distribcell Bins:' // trim(string)
end if
! Write any cells bins if present
j = t % find_filter(FILTER_CELL)
if (j > 0) then
string = ""
do i = 1, t % filters(j) % n_bins
id = t % filters(j) % int_bins(i)
c => cells(id)
string = trim(string) // ' ' // trim(to_str(c % id))
end do
write(unit_, *) ' Cell Bins:' // trim(string)
end if
! Write any surface bins if present
j = t % find_filter(FILTER_SURFACE)
if (j > 0) then
string = ""
do i = 1, t % filters(j) % n_bins
id = t % filters(j) % int_bins(i)
s => surfaces(id)
string = trim(string) // ' ' // trim(to_str(s % id))
end do
write(unit_, *) ' Surface Bins:' // trim(string)
end if
! Write any universe bins if present
j = t % find_filter(FILTER_UNIVERSE)
if (j > 0) then
string = ""
do i = 1, t % filters(j) % n_bins
id = t % filters(j) % int_bins(i)
u => universes(id)
string = trim(string) // ' ' // trim(to_str(u % id))
end do
write(unit_, *) ' Universe Bins:' // trim(string)
end if
! Write any material bins if present
j = t % find_filter(FILTER_MATERIAL)
if (j > 0) then
string = ""
do i = 1, t % filters(j) % n_bins
id = t % filters(j) % int_bins(i)
m => materials(id)
string = trim(string) // ' ' // trim(to_str(m % id))
end do
write(unit_, *) ' Material Bins:' // trim(string)
end if
! Write any mesh bins if present
j = t % find_filter(FILTER_MESH)
if (j > 0) then
string = ""
id = t % filters(j) % int_bins(1)
sm => meshes(id)
string = trim(string) // ' ' // trim(to_str(sm % dimension(1)))
do i = 2, sm % n_dimension
string = trim(string) // ' x ' // trim(to_str(sm % dimension(i)))
end do
write(unit_, *) ' Mesh Bins:' // trim(string)
end if
! Write any birth region bins if present
j = t % find_filter(FILTER_CELLBORN)
if (j > 0) then
string = ""
do i = 1, t % filters(j) % n_bins
id = t % filters(j) % int_bins(i)
c => cells(id)
string = trim(string) // ' ' // trim(to_str(c % id))
end do
write(unit_, *) ' Birth Region Bins:' // trim(string)
end if
! Write any incoming energy bins if present
j = t % find_filter(FILTER_ENERGYIN)
if (j > 0) then
string = ""
do i = 1, t % filters(j) % n_bins + 1
string = trim(string) // ' ' // trim(to_str(&
t % filters(j) % real_bins(i)))
end do
write(unit_,*) ' Incoming Energy Bins:' // trim(string)
end if
! Write any outgoing energy bins if present
j = t % find_filter(FILTER_ENERGYOUT)
if (j > 0) then
string = ""
do i = 1, t % filters(j) % n_bins + 1
string = trim(string) // ' ' // trim(to_str(&
t % filters(j) % real_bins(i)))
end do
write(unit_,*) ' Outgoing Energy Bins:' // trim(string)
end if
! Write nuclides bins
write(unit_,fmt='(1X,A)',advance='no') ' Nuclide Bins:'
do i = 1, t % n_nuclide_bins
if (t % nuclide_bins(i) == -1) then
write(unit_,fmt='(A)',advance='no') ' total'
else
write(unit_,fmt='(A)',advance='no') ' ' // trim(adjustl(&
nuclides(t % nuclide_bins(i)) % name))
end if
if (mod(i,4) == 0 .and. i /= t % n_nuclide_bins) &
write(unit_,'(/18X)',advance='no')
end do
write(unit_,*)
! Write score bins
string = ""
j = 0
do i = 1, t % n_user_score_bins
j = j + 1
select case (t % score_bins(j))
case (SCORE_FLUX)
string = trim(string) // ' flux'
case (SCORE_FLUX_YN)
pn_string = ' flux'
string = trim(string) // pn_string
do n = 1, t % moment_order(j)
pn_string = ' flux-y' // trim(to_str(n))
string = trim(string) // pn_string
end do
j = j + n - 1
case (SCORE_TOTAL)
string = trim(string) // ' total'
case (SCORE_TOTAL_YN)
pn_string = ' total'
string = trim(string) // pn_string
do n = 1, t % moment_order(j)
pn_string = ' total-y' // trim(to_str(n))
string = trim(string) // pn_string
end do
j = j + n - 1
case (SCORE_SCATTER)
string = trim(string) // ' scatter'
case (SCORE_NU_SCATTER)
string = trim(string) // ' nu-scatter'
case (SCORE_SCATTER_N)
pn_string = ' scatter-' // trim(to_str(t % moment_order(j)))
string = trim(string) // pn_string
case (SCORE_SCATTER_PN)
pn_string = ' scatter'
string = trim(string) // pn_string
do n = 1, t % moment_order(j)
pn_string = ' scatter-p' // trim(to_str(n))
string = trim(string) // pn_string
end do
j = j + n - 1
case (SCORE_NU_SCATTER_N)
pn_string = ' nu-scatter-' // trim(to_str(t % moment_order(j)))
string = trim(string) // pn_string
case (SCORE_NU_SCATTER_PN)
pn_string = ' nu-scatter'
string = trim(string) // pn_string
do n = 1, t % moment_order(j)
pn_string = ' nu-scatter-p' // trim(to_str(n))
string = trim(string) // pn_string
end do
j = j + n - 1
case (SCORE_SCATTER_YN)
pn_string = ' scatter'
string = trim(string) // pn_string
do n = 1, t % moment_order(j)
pn_string = ' scatter-y' // trim(to_str(n))
string = trim(string) // pn_string
end do
j = j + n - 1
case (SCORE_NU_SCATTER_YN)
pn_string = ' nu-scatter'
string = trim(string) // pn_string
do n = 1, t % moment_order(j)
pn_string = ' nu-scatter-y' // trim(to_str(n))
string = trim(string) // pn_string
end do
j = j + n - 1
case (SCORE_TRANSPORT)
string = trim(string) // ' transport'
case (SCORE_N_1N)
string = trim(string) // ' n1n'
case (SCORE_ABSORPTION)
string = trim(string) // ' absorption'
case (SCORE_FISSION)
string = trim(string) // ' fission'
case (SCORE_NU_FISSION)
string = trim(string) // ' nu-fission'
case (SCORE_KAPPA_FISSION)
string = trim(string) // ' kappa-fission'
case (SCORE_CURRENT)
string = trim(string) // ' current'
case default
string = trim(string) // ' ' // reaction_name(t % score_bins(j))
end select
end do
write(unit_,*) ' Scores:' // trim(string)
write(unit_,*)
end subroutine print_tally
!===============================================================================
! PRINT_GEOMETRY displays the attributes of all cells, surfaces, universes,
! surfaces, and lattices read in the input files.
!===============================================================================
subroutine print_geometry()
integer :: i ! loop index for various arrays
type(Surface), pointer :: s => null()
type(Cell), pointer :: c => null()
type(Universe), pointer :: u => null()
class(Lattice), pointer :: l => null()
! print summary of surfaces
call header("SURFACE SUMMARY", unit=UNIT_SUMMARY)
do i = 1, n_surfaces
s => surfaces(i)
call print_surface(s, unit=UNIT_SUMMARY)
end do
! print summary of cells
call header("CELL SUMMARY", unit=UNIT_SUMMARY)
do i = 1, n_cells
c => cells(i)
call print_cell(c, unit=UNIT_SUMMARY)
end do
! print summary of universes
call header("UNIVERSE SUMMARY", unit=UNIT_SUMMARY)
do i = 1, n_universes
u => universes(i)
call print_universe(u, unit=UNIT_SUMMARY)
end do
! print summary of lattices
if (n_lattices > 0) then
call header("LATTICE SUMMARY", unit=UNIT_SUMMARY)
do i = 1, n_lattices
l => lattices(i) % obj
call print_lattice(l, unit=UNIT_SUMMARY)
end do
end if
end subroutine print_geometry
!===============================================================================
! PRINT_NUCLIDE displays information about a continuous-energy neutron
! cross_section table and its reactions and secondary angle/energy distributions
@ -1212,7 +524,8 @@ contains
subroutine write_xs_summary()
integer :: i ! loop index
integer :: i ! loop index
integer :: unit_xs ! cross_sections.out file unit
character(MAX_FILE_LEN) :: path ! path of summary file
type(Nuclide), pointer :: nuc => null()
type(SAlphaBeta), pointer :: sab => null()
@ -1221,17 +534,17 @@ contains
path = trim(path_output) // "cross_sections.out"
! Open log file for writing
open(UNIT=UNIT_XS, FILE=path, STATUS='replace', ACTION='write')
open(NEWUNIT=unit_xs, FILE=path, STATUS='replace', ACTION='write')
! Write header
call header("CROSS SECTION TABLES", unit=UNIT_XS)
call header("CROSS SECTION TABLES", unit=unit_xs)
NUCLIDE_LOOP: do i = 1, n_nuclides_total
! Get pointer to nuclide
nuc => nuclides(i)
! Print information about nuclide
call print_nuclide(nuc, unit=UNIT_XS)
call print_nuclide(nuc, unit=unit_xs)
end do NUCLIDE_LOOP
SAB_TABLES_LOOP: do i = 1, n_sab_tables
@ -1239,11 +552,11 @@ contains
sab => sab_tables(i)
! Print information about S(a,b) table
call print_sab_table(sab, unit=UNIT_XS)
call print_sab_table(sab, unit=unit_xs)
end do SAB_TABLES_LOOP
! Close cross section summary file
close(UNIT_XS)
close(unit_xs)
end subroutine write_xs_summary
@ -1624,6 +937,7 @@ contains
integer :: i_listing ! index in xs_listings array
integer :: n_order ! loop index for moment orders
integer :: nm_order ! loop index for Ynm moment orders
integer :: unit_tally ! tallies.out file unit
real(8) :: t_value ! t-values for confidence intervals
real(8) :: alpha ! significance level for CI
character(MAX_FILE_LEN) :: filename ! name of output file
@ -1672,7 +986,7 @@ contains
filename = trim(path_output) // "tallies.out"
! Open tally file for writing
open(FILE=filename, UNIT=UNIT_TALLY, STATUS='replace', ACTION='write')
open(FILE=filename, NEWUNIT=unit_tally, STATUS='replace', ACTION='write')
! Calculate t-value for confidence intervals
if (confidence_intervals) then
@ -1696,16 +1010,16 @@ contains
! Write header block
if (t % name == "") then
call header("TALLY " // trim(to_str(t % id)), unit=UNIT_TALLY, &
call header("TALLY " // trim(to_str(t % id)), unit=unit_tally, &
level=3)
else
call header("TALLY " // trim(to_str(t % id)) // ": " &
// trim(t % name), unit=UNIT_TALLY, level=3)
// trim(t % name), unit=unit_tally, level=3)
endif
! Handle surface current tallies separately
if (t % type == TALLY_SURFACE_CURRENT) then
call write_surface_current(t)
call write_surface_current(t, unit_tally)
cycle
end if
@ -1748,7 +1062,7 @@ contains
! Print current filter information
type = t % filters(j) % type
write(UNIT=UNIT_TALLY, FMT='(1X,2A,1X,A)') repeat(" ", indent), &
write(UNIT=unit_tally, FMT='(1X,2A,1X,A)') repeat(" ", indent), &
trim(filter_name(type)), trim(get_label(t, j))
indent = indent + 2
j = j + 1
@ -1759,7 +1073,7 @@ contains
! Print filter information
if (t % n_filters > 0) then
type = t % filters(j) % type
write(UNIT=UNIT_TALLY, FMT='(1X,2A,1X,A)') repeat(" ", indent), &
write(UNIT=unit_tally, FMT='(1X,2A,1X,A)') repeat(" ", indent), &
trim(filter_name(type)), trim(get_label(t, j))
end if
@ -1780,11 +1094,11 @@ contains
! Write label for nuclide
i_nuclide = t % nuclide_bins(n)
if (i_nuclide == -1) then
write(UNIT=UNIT_TALLY, FMT='(1X,2A,1X,A)') repeat(" ", indent), &
write(UNIT=unit_tally, FMT='(1X,2A,1X,A)') repeat(" ", indent), &
"Total Material"
else
i_listing = nuclides(i_nuclide) % listing
write(UNIT=UNIT_TALLY, FMT='(1X,2A,1X,A)') repeat(" ", indent), &
write(UNIT=unit_tally, FMT='(1X,2A,1X,A)') repeat(" ", indent), &
trim(xs_listings(i_listing) % alias)
end if
@ -1797,7 +1111,7 @@ contains
case (SCORE_SCATTER_N, SCORE_NU_SCATTER_N)
score_name = 'P' // trim(to_str(t % moment_order(k))) // " " // &
score_names(abs(t % score_bins(k)))
write(UNIT=UNIT_TALLY, FMT='(1X,2A,1X,A,"+/- ",A)') &
write(UNIT=unit_tally, FMT='(1X,2A,1X,A,"+/- ",A)') &
repeat(" ", indent), score_name, &
to_str(t % results(score_index,filter_index) % sum), &
trim(to_str(t % results(score_index,filter_index) % sum_sq))
@ -1807,7 +1121,7 @@ contains
score_index = score_index + 1
score_name = 'P' // trim(to_str(n_order)) // " " //&
score_names(abs(t % score_bins(k)))
write(UNIT=UNIT_TALLY, FMT='(1X,2A,1X,A,"+/- ",A)') &
write(UNIT=unit_tally, FMT='(1X,2A,1X,A,"+/- ",A)') &
repeat(" ", indent), score_name, &
to_str(t % results(score_index,filter_index) % sum), &
trim(to_str(t % results(score_index,filter_index) &
@ -1823,7 +1137,7 @@ contains
score_name = 'Y' // trim(to_str(n_order)) // ',' // &
trim(to_str(nm_order)) // " " &
// score_names(abs(t % score_bins(k)))
write(UNIT=UNIT_TALLY, FMT='(1X,2A,1X,A,"+/- ",A)') &
write(UNIT=unit_tally, FMT='(1X,2A,1X,A,"+/- ",A)') &
repeat(" ", indent), score_name, &
to_str(t % results(score_index,filter_index) % sum), &
trim(to_str(t % results(score_index,filter_index)&
@ -1837,7 +1151,7 @@ contains
else
score_name = score_names(abs(t % score_bins(k)))
end if
write(UNIT=UNIT_TALLY, FMT='(1X,2A,1X,A,"+/- ",A)') &
write(UNIT=unit_tally, FMT='(1X,2A,1X,A,"+/- ",A)') &
repeat(" ", indent), score_name, &
to_str(t % results(score_index,filter_index) % sum), &
trim(to_str(t % results(score_index,filter_index) % sum_sq))
@ -1854,7 +1168,7 @@ contains
end do TALLY_LOOP
close(UNIT=UNIT_TALLY)
close(UNIT=unit_tally)
end subroutine write_tallies
@ -1863,9 +1177,9 @@ contains
! tallies.out file.
!===============================================================================
subroutine write_surface_current(t)
subroutine write_surface_current(t, unit_tally)
type(TallyObject), pointer :: t
integer, intent(in) :: unit_tally
integer :: i ! mesh index for x
integer :: j ! mesh index for y
@ -1880,7 +1194,7 @@ contains
integer :: filter_index ! index in results array for filters
logical :: print_ebin ! should incoming energy bin be displayed?
character(MAX_LINE_LEN) :: string
type(StructuredMesh), pointer :: m => null()
type(RegularMesh), pointer :: m
! Get pointer to mesh
i_filter_mesh = t % find_filter(FILTER_MESH)
@ -1909,7 +1223,7 @@ contains
do k = 1, m % dimension(3)
! Write mesh cell index
string = string(1:len2+1) // trim(to_str(k)) // ")"
write(UNIT=UNIT_TALLY, FMT='(1X,A)') trim(string)
write(UNIT=unit_tally, FMT='(1X,A)') trim(string)
do l = 1, n
if (print_ebin) then
@ -1917,7 +1231,7 @@ contains
matching_bins(i_filter_ein) = l
! Write incoming energy bin
write(UNIT=UNIT_TALLY, FMT='(3X,A,1X,A)') &
write(UNIT=unit_tally, FMT='(3X,A,1X,A)') &
"Incoming Energy", trim(get_label(t, i_filter_ein))
end if
@ -1926,14 +1240,14 @@ contains
mesh_indices_to_bin(m, (/ i-1, j, k /) + 1, .true.)
matching_bins(i_filter_surf) = IN_RIGHT
filter_index = sum((matching_bins(1:t%n_filters) - 1) * t % stride) + 1
write(UNIT=UNIT_TALLY, FMT='(5X,A,T35,A,"+/- ",A)') &
write(UNIT=unit_tally, FMT='(5X,A,T35,A,"+/- ",A)') &
"Outgoing Current to Left", &
to_str(t % results(1,filter_index) % sum), &
trim(to_str(t % results(1,filter_index) % sum_sq))
matching_bins(i_filter_surf) = OUT_RIGHT
filter_index = sum((matching_bins(1:t%n_filters) - 1) * t % stride) + 1
write(UNIT=UNIT_TALLY, FMT='(5X,A,T35,A,"+/- ",A)') &
write(UNIT=unit_tally, FMT='(5X,A,T35,A,"+/- ",A)') &
"Incoming Current from Left", &
to_str(t % results(1,filter_index) % sum), &
trim(to_str(t % results(1,filter_index) % sum_sq))
@ -1943,14 +1257,14 @@ contains
mesh_indices_to_bin(m, (/ i, j, k /) + 1, .true.)
matching_bins(i_filter_surf) = IN_RIGHT
filter_index = sum((matching_bins(1:t%n_filters) - 1) * t % stride) + 1
write(UNIT=UNIT_TALLY, FMT='(5X,A,T35,A,"+/- ",A)') &
write(UNIT=unit_tally, FMT='(5X,A,T35,A,"+/- ",A)') &
"Incoming Current from Right", &
to_str(t % results(1,filter_index) % sum), &
trim(to_str(t % results(1,filter_index) % sum_sq))
matching_bins(i_filter_surf) = OUT_RIGHT
filter_index = sum((matching_bins(1:t%n_filters) - 1) * t % stride) + 1
write(UNIT=UNIT_TALLY, FMT='(5X,A,T35,A,"+/- ",A)') &
write(UNIT=unit_tally, FMT='(5X,A,T35,A,"+/- ",A)') &
"Outgoing Current to Right", &
to_str(t % results(1,filter_index) % sum), &
trim(to_str(t % results(1,filter_index) % sum_sq))
@ -1960,14 +1274,14 @@ contains
mesh_indices_to_bin(m, (/ i, j-1, k /) + 1, .true.)
matching_bins(i_filter_surf) = IN_FRONT
filter_index = sum((matching_bins(1:t%n_filters) - 1) * t % stride) + 1
write(UNIT=UNIT_TALLY, FMT='(5X,A,T35,A,"+/- ",A)') &
write(UNIT=unit_tally, FMT='(5X,A,T35,A,"+/- ",A)') &
"Outgoing Current to Back", &
to_str(t % results(1,filter_index) % sum), &
trim(to_str(t % results(1,filter_index) % sum_sq))
matching_bins(i_filter_surf) = OUT_FRONT
filter_index = sum((matching_bins(1:t%n_filters) - 1) * t % stride) + 1
write(UNIT=UNIT_TALLY, FMT='(5X,A,T35,A,"+/- ",A)') &
write(UNIT=unit_tally, FMT='(5X,A,T35,A,"+/- ",A)') &
"Incoming Current from Back", &
to_str(t % results(1,filter_index) % sum), &
trim(to_str(t % results(1,filter_index) % sum_sq))
@ -1977,14 +1291,14 @@ contains
mesh_indices_to_bin(m, (/ i, j, k /) + 1, .true.)
matching_bins(i_filter_surf) = IN_FRONT
filter_index = sum((matching_bins(1:t%n_filters) - 1) * t % stride) + 1
write(UNIT=UNIT_TALLY, FMT='(5X,A,T35,A,"+/- ",A)') &
write(UNIT=unit_tally, FMT='(5X,A,T35,A,"+/- ",A)') &
"Incoming Current from Front", &
to_str(t % results(1,filter_index) % sum), &
trim(to_str(t % results(1,filter_index) % sum_sq))
matching_bins(i_filter_surf) = OUT_FRONT
filter_index = sum((matching_bins(1:t%n_filters) - 1) * t % stride) + 1
write(UNIT=UNIT_TALLY, FMT='(5X,A,T35,A,"+/- ",A)') &
write(UNIT=unit_tally, FMT='(5X,A,T35,A,"+/- ",A)') &
"Outgoing Current to Front", &
to_str(t % results(1,filter_index) % sum), &
trim(to_str(t % results(1,filter_index) % sum_sq))
@ -1994,14 +1308,14 @@ contains
mesh_indices_to_bin(m, (/ i, j, k-1 /) + 1, .true.)
matching_bins(i_filter_surf) = IN_TOP
filter_index = sum((matching_bins(1:t%n_filters) - 1) * t % stride) + 1
write(UNIT=UNIT_TALLY, FMT='(5X,A,T35,A,"+/- ",A)') &
write(UNIT=unit_tally, FMT='(5X,A,T35,A,"+/- ",A)') &
"Outgoing Current to Bottom", &
to_str(t % results(1,filter_index) % sum), &
trim(to_str(t % results(1,filter_index) % sum_sq))
matching_bins(i_filter_surf) = OUT_TOP
filter_index = sum((matching_bins(1:t%n_filters) - 1) * t % stride) + 1
write(UNIT=UNIT_TALLY, FMT='(5X,A,T35,A,"+/- ",A)') &
write(UNIT=unit_tally, FMT='(5X,A,T35,A,"+/- ",A)') &
"Incoming Current from Bottom", &
to_str(t % results(1,filter_index) % sum), &
trim(to_str(t % results(1,filter_index) % sum_sq))
@ -2011,14 +1325,14 @@ contains
mesh_indices_to_bin(m, (/ i, j, k /) + 1, .true.)
matching_bins(i_filter_surf) = IN_TOP
filter_index = sum((matching_bins(1:t%n_filters) - 1) * t % stride) + 1
write(UNIT=UNIT_TALLY, FMT='(5X,A,T35,A,"+/- ",A)') &
write(UNIT=unit_tally, FMT='(5X,A,T35,A,"+/- ",A)') &
"Incoming Current from Top", &
to_str(t % results(1,filter_index) % sum), &
trim(to_str(t % results(1,filter_index) % sum_sq))
matching_bins(i_filter_surf) = OUT_TOP
filter_index = sum((matching_bins(1:t%n_filters) - 1) * t % stride) + 1
write(UNIT=UNIT_TALLY, FMT='(5X,A,T35,A,"+/- ",A)') &
write(UNIT=unit_tally, FMT='(5X,A,T35,A,"+/- ",A)') &
"Outgoing Current to Top", &
to_str(t % results(1,filter_index) % sum), &
trim(to_str(t % results(1,filter_index) % sum_sq))
@ -2047,8 +1361,8 @@ contains
integer, allocatable :: ijk(:) ! indices in mesh
real(8) :: E0 ! lower bound for energy bin
real(8) :: E1 ! upper bound for energy bin
type(StructuredMesh), pointer :: m => null()
type(Universe), pointer :: univ => null()
type(RegularMesh), pointer :: m
type(Universe), pointer :: univ
bin = matching_bins(i_filter)

View file

@ -71,6 +71,7 @@ contains
integer :: int_scalar
integer(HID_T) :: file_id
character(MAX_WORD_LEN) :: mode
! Write meessage
call write_message("Loading particle restart file " &
@ -86,7 +87,13 @@ contains
call read_dataset(file_id, 'gen_per_batch', gen_per_batch)
call read_dataset(file_id, 'current_gen', current_gen)
call read_dataset(file_id, 'n_particles', n_particles)
call read_dataset(file_id, 'run_mode', previous_run_mode)
call read_dataset(file_id, 'run_mode', mode)
select case (mode)
case ('k-eigenvalue')
previous_run_mode = MODE_EIGENVALUE
case ('fixed source')
previous_run_mode = MODE_FIXEDSOURCE
end select
call read_dataset(file_id, 'id', p%id)
call read_dataset(file_id, 'weight', p%wgt)
call read_dataset(file_id, 'energy', p%E)

View file

@ -40,13 +40,20 @@ contains
src => source_bank(current_work)
! Write data to file
call write_dataset(file_id, 'filetype', FILETYPE_PARTICLE_RESTART)
call write_dataset(file_id, 'filetype', 'particle restart')
call write_dataset(file_id, 'revision', REVISION_PARTICLE_RESTART)
call write_dataset(file_id, 'current_batch', current_batch)
call write_dataset(file_id, 'gen_per_batch', gen_per_batch)
call write_dataset(file_id, 'current_gen', current_gen)
call write_dataset(file_id, 'n_particles', n_particles)
call write_dataset(file_id, 'run_mode', run_mode)
select case(run_mode)
case (MODE_FIXEDSOURCE)
call write_dataset(file_id, 'run_mode', 'fixed source')
case (MODE_EIGENVALUE)
call write_dataset(file_id, 'run_mode', 'k-eigenvalue')
case (MODE_PARTICLE)
call write_dataset(file_id, 'run_mode', 'particle restart')
end select
call write_dataset(file_id, 'id', p%id)
call write_dataset(file_id, 'weight', src%wgt)
call write_dataset(file_id, 'energy', src%E)

View file

@ -5,7 +5,9 @@ module plot
use geometry, only: find_cell, check_cell_overlap
use geometry_header, only: Cell, BASE_UNIVERSE
use global
use hdf5_interface
use mesh, only: get_mesh_indices
use mesh_header, only: RegularMesh
use output, only: write_message
use particle_header, only: Particle, LocalCoord
use plot_header
@ -14,6 +16,8 @@ module plot
use progress_header, only: ProgressBar
use string, only: to_str
use hdf5
implicit none
contains
@ -212,7 +216,7 @@ contains
real(8) :: xyz_ur_plot(3) ! upper right xyz of plot image
real(8) :: xyz_ll(3) ! lower left xyz
real(8) :: xyz_ur(3) ! upper right xyz
type(StructuredMesh), pointer :: m => null()
type(RegularMesh), pointer :: m
m => pl % meshlines_mesh
@ -305,25 +309,26 @@ contains
integer :: i ! loop index for height
integer :: j ! loop index for width
integer :: unit_plot
! Open PPM file for writing
open(UNIT=UNIT_PLOT, FILE=pl % path_plot)
open(NEWUNIT=unit_plot, FILE=pl % path_plot)
! Write header
write(UNIT_PLOT, '(A2)') 'P6'
write(UNIT_PLOT, '(I0,'' '',I0)') img%width, img%height
write(UNIT_PLOT, '(A)') '255'
write(unit_plot, '(A2)') 'P6'
write(unit_plot, '(I0,'' '',I0)') img%width, img%height
write(unit_plot, '(A)') '255'
! Write color for each pixel
do j = 1, img % height
do i = 1, img % width
write(UNIT_PLOT, '(3A1)', advance='no') achar(img%red(i,j)), &
write(unit_plot, '(3A1)', advance='no') achar(img%red(i,j)), &
achar(img%green(i,j)), achar(img%blue(i,j))
end do
end do
! Close plot file
close(UNIT=UNIT_PLOT)
close(UNIT=unit_plot)
end subroutine output_ppm
@ -346,10 +351,20 @@ contains
integer :: x, y, z ! voxel location indices
integer :: rgb(3) ! colors (red, green, blue) from 0-255
integer :: id ! id of cell or material
integer :: hdf5_err
integer, target :: data(pl%pixels(3),pl%pixels(2))
integer(HID_T) :: file_id
integer(HID_T) :: dspace
integeR(HID_T) :: memspace
integer(HID_T) :: dset
integer(HSIZE_T) :: dims(3)
integer(HSIZE_T) :: dims_slab(3)
integer(HSIZE_T) :: offset(3)
real(8) :: vox(3) ! x, y, and z voxel widths
real(8) :: ll(3) ! lower left starting point for each sweep direction
type(Particle) :: p
type(ProgressBar) :: progress
type(c_ptr) :: f_ptr
! compute voxel widths in each direction
vox = pl % width/dble(pl % pixels)
@ -364,11 +379,30 @@ contains
p % coord(1) % universe = BASE_UNIVERSE
! Open binary plot file for writing
open(UNIT=UNIT_PLOT, FILE=pl % path_plot, STATUS='replace', &
ACCESS='stream')
file_id = file_create(pl%path_plot)
! write plot header info
write(UNIT_PLOT) pl % pixels, vox, ll
call write_dataset(file_id, "filetype", 'voxel')
call write_dataset(file_id, "num_voxels", pl%pixels)
call write_dataset(file_id, "voxel_width", vox)
call write_dataset(file_id, "lower_left", ll)
! Create dataset for voxel data -- note that the dimensions are reversed
! since we want the order in the file to be z, y, x
dims(:) = [pl%pixels(3), pl%pixels(2), pl%pixels(1)]
call h5screate_simple_f(3, dims, dspace, hdf5_err)
call h5dcreate_f(file_id, "data", H5T_NATIVE_INTEGER, dspace, dset, hdf5_err)
! Create another dataspace for 2D array in memory
dims_slab(1) = pl%pixels(3)
dims_slab(2) = pl%pixels(2)
dims_slab(3) = 1
call h5screate_simple_f(2, dims_slab(1:2), memspace, hdf5_err)
! Initialize offset and get pointer to data
offset(:) = 0
call h5sselect_hyperslab_f(dspace, H5S_SELECT_SET_F, offset, dims_slab, hdf5_err)
f_ptr = c_loc(data)
! move to center of voxels
ll = ll + vox / TWO
@ -377,22 +411,19 @@ contains
call progress % set_value(dble(x)/dble(pl % pixels(1))*100)
do y = 1, pl % pixels(2)
do z = 1, pl % pixels(3)
! get voxel color
call position_rgb(p, pl, rgb, id)
! write to plot file
write(UNIT_PLOT) id
data(z,y) = id
! advance particle in z direction
p % coord(1) % xyz(3) = p % coord(1) % xyz(3) + vox(3)
end do
! advance particle in y direction
p % coord(1) % xyz(2) = p % coord(1) % xyz(2) + vox(2)
p % coord(1) % xyz(3) = ll(3)
end do
! advance particle in y direction
@ -400,9 +431,17 @@ contains
p % coord(1) % xyz(2) = ll(2)
p % coord(1) % xyz(3) = ll(3)
! Write to HDF5 dataset
offset(3) = x - 1
call h5soffset_simple_f(dspace, offset, hdf5_err)
call h5dwrite_f(dset, H5T_NATIVE_INTEGER, f_ptr, hdf5_err, &
mem_space_id=memspace, file_space_id=dspace)
end do
close(UNIT_PLOT)
call h5dclose_f(dset, hdf5_err)
call h5sclose_f(dspace, hdf5_err)
call h5sclose_f(memspace, hdf5_err)
call file_close(file_id)
end subroutine create_3d_dump

View file

@ -1,7 +1,7 @@
module plot_header
use constants
use mesh_header, only: StructuredMesh
use mesh_header, only: RegularMesh
implicit none
@ -28,7 +28,7 @@ module plot_header
integer :: pixels(3) ! pixel width/height of plot slice
integer :: meshlines_width ! pixel width of meshlines
integer :: level ! universe depth to plot the cells of
type(StructuredMesh), pointer :: meshlines_mesh => null() ! mesh to plot
type(RegularMesh), pointer :: meshlines_mesh => null() ! mesh to plot
type(ObjectColor) :: meshlines_color ! Color for meshlines
type(ObjectColor) :: not_found ! color for positions where no cell found
type(ObjectColor), allocatable :: colors(:) ! colors of cells/mats

View file

@ -6,7 +6,7 @@ element geometry {
(element universe { xsd:int } | attribute universe { xsd:int })? &
(
(element fill { xsd:int } | attribute fill { xsd:int }) |
(element material { ( xsd:int | "void" ) } |
(element material { ( xsd:int | "void" ) } |
attribute material { ( xsd:int | "void" ) })
) &
(element surfaces { list { xsd:int* } } | attribute surfaces { list { xsd:int* } })? &
@ -18,7 +18,7 @@ element geometry {
(element id { xsd:int } | attribute id { xsd:int }) &
(element name { xsd:string { maxLength="52" } } |
attribute name { xsd:string { maxLength="52" } })? &
(element type { xsd:string { maxLength = "15" } } |
(element type { xsd:string { maxLength = "15" } } |
attribute type { xsd:string { maxLength = "15" } }) &
(element coeffs { list { xsd:double+ } } | attribute coeffs { list { xsd:double+ } }) &
(element boundary { ( "transmit" | "reflective" | "vacuum" ) } |
@ -29,12 +29,12 @@ element geometry {
(element id { xsd:int } | attribute id { xsd:int }) &
(element name { xsd:string { maxLength="52" } } |
attribute name { xsd:string { maxLength="52" } })? &
(element dimension { list { xsd:positiveInteger+ } } |
(element dimension { list { xsd:positiveInteger+ } } |
attribute dimension { list { xsd:positiveInteger+ } }) &
(element lower_left { list { xsd:double+ } } | attribute lower_left { list { xsd:double+ } }) &
(element pitch { list { xsd:double+ } } | attribute pitch { list { xsd:double+ } }) &
(element universes { list { xsd:int+ } } | attribute universes { list { xsd:int+ } }) &
(element outside { xsd:int } | attribute outside { xsd:int })?
(element outer { xsd:int } | attribute outer { xsd:int })?
}*
& element hex_lattice {

View file

@ -282,10 +282,10 @@
</choice>
<optional>
<choice>
<element name="outside">
<element name="outer">
<data type="int"/>
</element>
<attribute name="outside">
<attribute name="outer">
<data type="int"/>
</attribute>
</choice>

View file

@ -1,8 +1,8 @@
element tallies {
element mesh {
(element id { xsd:int } | attribute id { xsd:int }) &
(element type { ( "rectangular" | "hexagonal" ) } |
attribute type { ( "rectangular" | "hexagonal" ) }) &
(element type { ( "regular" ) } |
attribute type { ( "regular" ) }) &
(element dimension { list { xsd:positiveInteger+ } } |
attribute dimension { list { xsd:positiveInteger+ } }) &
(element lower_left { list { xsd:double+ } } |
@ -32,7 +32,7 @@ element tallies {
element nuclides {
list { xsd:string { maxLength = "12" }+ }
}? &
element scores {
element scores {
list { xsd:string { maxLength = "20" }+ }
} &
element trigger {

View file

@ -14,16 +14,10 @@
</choice>
<choice>
<element name="type">
<choice>
<value>rectangular</value>
<value>hexagonal</value>
</choice>
<value>regular</value>
</element>
<attribute name="type">
<choice>
<value>rectangular</value>
<value>hexagonal</value>
</choice>
<value>regular</value>
</attribute>
</choice>
<choice>

View file

@ -32,8 +32,8 @@ contains
integer(8) :: i ! loop index over bank sites
integer(8) :: id ! particle id
integer(4) :: itmp ! temporary integer
integer(HID_T) :: file_id
character(MAX_WORD_LEN) :: filetype
character(MAX_FILE_LEN) :: filename
type(Bank), pointer :: src ! source bank site
@ -50,10 +50,10 @@ contains
file_id = file_open(path_source, 'r', parallel=.true.)
! Read the file type
call read_dataset(file_id, "filetype", itmp)
call read_dataset(file_id, "filetype", filetype)
! Check to make sure this is a source file
if (itmp /= FILETYPE_SOURCE) then
if (filetype /= 'source') then
call fatal_error("Specified starting source file not a source file &
&type.")
end if

View file

@ -13,13 +13,14 @@ module state_point
use constants
use endf, only: reaction_name
use error, only: fatal_error, warning
use global
use hdf5_interface
use output, only: write_message, time_stamp
use string, only: to_str, zero_padded, count_digits
use tally_header, only: TallyObject
use mesh_header, only: StructuredMesh
use mesh_header, only: RegularMesh
use dict_header, only: ElemKeyValueII, ElemKeyValueCI
#ifdef MPI
@ -40,19 +41,20 @@ contains
subroutine write_state_point()
integer :: i, j, k
integer :: n_order ! loop index for moment orders
integer :: nm_order ! loop index for Ynm moment orders
integer, allocatable :: id_array(:)
integer, allocatable :: key_array(:)
integer :: i, j, k
integer :: i_list, i_xs
integer :: n_order ! loop index for moment orders
integer :: nm_order ! loop index for Ynm moment orders
integer, allocatable :: id_array(:)
integer, allocatable :: key_array(:)
integer(HID_T) :: file_id
integer(HID_T) :: cmfd_group
integer(HID_T) :: tallies_group, tally_group
integer(HID_T) :: meshes_group, mesh_group
integer(HID_T) :: filter_group, moments_group
character(8) :: moment_name ! name of moment (e.g, P3)
character(MAX_FILE_LEN) :: filename
type(StructuredMesh), pointer :: meshp
integer(HID_T) :: filter_group
character(20), allocatable :: str_array(:)
character(MAX_FILE_LEN) :: filename
type(RegularMesh), pointer :: meshp
type(TallyObject), pointer :: tally
type(ElemKeyValueII), pointer :: current
type(ElemKeyValueII), pointer :: next
@ -70,7 +72,7 @@ contains
file_id = file_create(filename)
! Write file type
call write_dataset(file_id, "filetype", FILETYPE_STATEPOINT)
call write_dataset(file_id, "filetype", 'statepoint')
! Write revision number for state point file
call write_dataset(file_id, "revision", REVISION_STATEPOINT)
@ -90,7 +92,12 @@ contains
call write_dataset(file_id, "seed", seed)
! Write run information
call write_dataset(file_id, "run_mode", run_mode)
select case(run_mode)
case (MODE_FIXEDSOURCE)
call write_dataset(file_id, "run_mode", "fixed source")
case (MODE_EIGENVALUE)
call write_dataset(file_id, "run_mode", "k-eigenvalue")
end select
call write_dataset(file_id, "n_particles", n_particles)
call write_dataset(file_id, "n_batches", n_batches)
@ -169,9 +176,10 @@ contains
meshp => meshes(id_array(i))
mesh_group = create_group(meshes_group, "mesh " // trim(to_str(meshp%id)))
call write_dataset(mesh_group, "id", meshp%id)
call write_dataset(mesh_group, "type", meshp%type)
call write_dataset(mesh_group, "n_dimension", meshp%n_dimension)
select case (meshp%type)
case (MESH_REGULAR)
call write_dataset(mesh_group, "type", "regular")
end select
call write_dataset(mesh_group, "dimension", meshp%dimension)
call write_dataset(mesh_group, "lower_left", meshp%lower_left)
call write_dataset(mesh_group, "upper_right", meshp%upper_right)
@ -214,7 +222,14 @@ contains
tally_group = create_group(tallies_group, "tally " // &
trim(to_str(tally%id)))
call write_dataset(tally_group, "estimator", tally%estimator)
select case(tally%estimator)
case (ESTIMATOR_ANALOG)
call write_dataset(tally_group, "estimator", "analog")
case (ESTIMATOR_TRACKLENGTH)
call write_dataset(tally_group, "estimator", "tracklength")
case (ESTIMATOR_COLLISION)
call write_dataset(tally_group, "estimator", "collision")
end select
call write_dataset(tally_group, "n_realizations", tally%n_realizations)
call write_dataset(tally_group, "n_filters", tally%n_filters)
@ -223,7 +238,28 @@ contains
filter_group = create_group(tally_group, "filter " // &
trim(to_str(j)))
call write_dataset(filter_group, "type", tally%filters(j)%type)
! Write name of type
select case (tally%filters(j)%type)
case(FILTER_UNIVERSE)
call write_dataset(filter_group, "type", "universe")
case(FILTER_MATERIAL)
call write_dataset(filter_group, "type", "material")
case(FILTER_CELL)
call write_dataset(filter_group, "type", "cell")
case(FILTER_CELLBORN)
call write_dataset(filter_group, "type", "cellborn")
case(FILTER_SURFACE)
call write_dataset(filter_group, "type", "surface")
case(FILTER_MESH)
call write_dataset(filter_group, "type", "mesh")
case(FILTER_ENERGYIN)
call write_dataset(filter_group, "type", "energy")
case(FILTER_ENERGYOUT)
call write_dataset(filter_group, "type", "energyout")
case(FILTER_DISTRIBCELL)
call write_dataset(filter_group, "type", "distribcell")
end select
call write_dataset(filter_group, "offset", tally%filters(j)%offset)
call write_dataset(filter_group, "n_bins", tally%filters(j)%n_bins)
if (tally%filters(j)%type == FILTER_ENERGYIN .or. &
@ -238,59 +274,112 @@ contains
call close_group(filter_group)
end do FILTER_LOOP
call write_dataset(tally_group, "n_nuclides", tally%n_nuclide_bins)
! Set up nuclide bin array and then write
allocate(key_array(tally%n_nuclide_bins))
allocate(str_array(tally%n_nuclide_bins))
NUCLIDE_LOOP: do j = 1, tally%n_nuclide_bins
if (tally%nuclide_bins(j) > 0) then
key_array(j) = nuclides(tally%nuclide_bins(j))%zaid
! Get index in cross section listings for this nuclide
i_list = nuclides(tally%nuclide_bins(j))%listing
! Determine position of . in alias string (e.g. "U-235.71c"). If
! no . is found, just use the entire string.
i_xs = index(xs_listings(i_list)%alias, '.')
if (i_xs > 0) then
str_array(j) = xs_listings(i_list)%alias(1:i_xs - 1)
else
str_array(j) = xs_listings(i_list)%alias
end if
else
key_array(j) = tally%nuclide_bins(j)
str_array(j) = 'total'
end if
end do NUCLIDE_LOOP
call write_dataset(tally_group, "nuclides", key_array)
deallocate(key_array)
call write_dataset(tally_group, "nuclides", str_array)
deallocate(str_array)
call write_dataset(tally_group, "n_score_bins", tally%n_score_bins)
call write_dataset(tally_group, "score_bins", tally%score_bins)
allocate(str_array(size(tally%score_bins)))
do j = 1, size(tally%score_bins)
select case(tally%score_bins(j))
case (SCORE_FLUX)
str_array(j) = "flux"
case (SCORE_TOTAL)
str_array(j) = "total"
case (SCORE_SCATTER)
str_array(j) = "scatter"
case (SCORE_NU_SCATTER)
str_array(j) = "nu-scatter"
case (SCORE_SCATTER_N)
str_array(j) = "scatter-n"
case (SCORE_SCATTER_PN)
str_array(j) = "scatter-pn"
case (SCORE_NU_SCATTER_N)
str_array(j) = "nu-scatter-n"
case (SCORE_NU_SCATTER_PN)
str_array(j) = "nu-scatter-pn"
case (SCORE_TRANSPORT)
str_array(j) = "transport"
case (SCORE_N_1N)
str_array(j) = "n1n"
case (SCORE_ABSORPTION)
str_array(j) = "absorption"
case (SCORE_FISSION)
str_array(j) = "fission"
case (SCORE_NU_FISSION)
str_array(j) = "nu-fission"
case (SCORE_KAPPA_FISSION)
str_array(j) = "kappa-fission"
case (SCORE_CURRENT)
str_array(j) = "current"
case (SCORE_FLUX_YN)
str_array(j) = "flux-yn"
case (SCORE_TOTAL_YN)
str_array(j) = "total-yn"
case (SCORE_SCATTER_YN)
str_array(j) = "scatter-yn"
case (SCORE_NU_SCATTER_YN)
str_array(j) = "nu-scatter-yn"
case (SCORE_EVENTS)
str_array(j) = "events"
case default
str_array(j) = reaction_name(tally%score_bins(j))
end select
end do
call write_dataset(tally_group, "score_bins", str_array)
call write_dataset(tally_group, "n_user_score_bins", tally%n_user_score_bins)
deallocate(str_array)
! Write explicit moment order strings for each score bin
moments_group = create_group(tally_group, "moments")
k = 1
allocate(str_array(tally%n_score_bins))
MOMENT_LOOP: do j = 1, tally%n_user_score_bins
select case(tally%score_bins(k))
case (SCORE_SCATTER_N, SCORE_NU_SCATTER_N)
moment_name = 'P' // trim(to_str(tally%moment_order(k)))
call write_dataset(moments_group, "order" // trim(to_str(k)), moment_name)
str_array(k) = 'P' // trim(to_str(tally%moment_order(k)))
k = k + 1
case (SCORE_SCATTER_PN, SCORE_NU_SCATTER_PN)
do n_order = 0, tally%moment_order(k)
moment_name = 'P' // trim(to_str(n_order))
call write_dataset(moments_group, "order" // trim(to_str(k)), moment_name)
str_array(k) = 'P' // trim(to_str(n_order))
k = k + 1
end do
case (SCORE_SCATTER_YN, SCORE_NU_SCATTER_YN, SCORE_FLUX_YN, &
SCORE_TOTAL_YN)
SCORE_TOTAL_YN)
do n_order = 0, tally%moment_order(k)
do nm_order = -n_order, n_order
moment_name = 'Y' // trim(to_str(n_order)) // ',' // &
str_array(k) = 'Y' // trim(to_str(n_order)) // ',' // &
trim(to_str(nm_order))
call write_dataset(moments_group, "order" // &
trim(to_str(k)), moment_name)
k = k + 1
k = k + 1
end do
end do
case default
moment_name = ''
call write_dataset(moments_group, "order" // trim(to_str(k)), &
moment_name)
str_array(k) = ''
k = k + 1
end select
end do MOMENT_LOOP
call close_group(moments_group)
call write_dataset(tally_group, "moment_orders", str_array)
deallocate(str_array)
call close_group(tally_group)
end do TALLY_METADATA
@ -379,7 +468,7 @@ contains
! Create separate source file
if (master .or. parallel) then
file_id = file_create(filename, parallel=.true.)
call write_dataset(file_id, "filetype", FILETYPE_SOURCE)
call write_dataset(file_id, "filetype", 'source')
end if
else
filename = trim(path_output) // 'statepoint.' // &
@ -401,7 +490,7 @@ contains
call write_message("Creating source file " // trim(filename) // "...", 1)
if (master .or. parallel) then
file_id = file_create(filename, parallel=.true.)
call write_dataset(file_id, "filetype", FILETYPE_SOURCE)
call write_dataset(file_id, "filetype", 'source')
end if
call write_source_bank(file_id)
@ -582,25 +671,15 @@ contains
subroutine load_state_point()
integer :: i, j, k
integer :: int_array(3)
integer :: curr_key
integer :: n_order ! loop index for moment orders
integer :: nm_order ! loop index for Ynm moment orders
integer, allocatable :: id_array(:)
integer, allocatable :: key_array(:)
integer, allocatable :: temp_array(:)
integer :: i
integer :: int_array(3)
integer(HID_T) :: file_id
integer(HID_T) :: cmfd_group
integer(HID_T) :: tallies_group, tally_group
integer(HID_T) :: meshes_group, mesh_group
integer(HID_T) :: filter_group, moments_group
real(8) :: real_array(3)
logical :: source_present
character(MAX_FILE_LEN) :: path_temp
character(19) :: current_time
character(8) :: moment_name ! name of moment (e.g, P3, Y-1,1)
type(StructuredMesh), pointer :: meshp
integer(HID_T) :: tallies_group
integer(HID_T) :: tally_group
real(8) :: real_array(3)
logical :: source_present
character(MAX_WORD_LEN) :: word
type(TallyObject), pointer :: tally
! Write message
@ -621,27 +700,17 @@ contains
&in OpenMC.")
end if
! Read OpenMC version
call read_dataset(file_id, "version_major", int_array(1))
call read_dataset(file_id, "version_minor", int_array(2))
call read_dataset(file_id, "version_release", int_array(3))
if (int_array(1) /= VERSION_MAJOR .or. int_array(2) /= VERSION_MINOR &
.or. int_array(3) /= VERSION_RELEASE) then
if (master) call warning("State point file was created with a different &
&version of OpenMC.")
end if
! Read date and time
call read_dataset(file_id, "date_and_time", current_time)
! Read path to input
call read_dataset(file_id, "path", path_temp)
! Read and overwrite random number seed
call read_dataset(file_id, "seed", seed)
! Read and overwrite run information except number of batches
call read_dataset(file_id, "run_mode", run_mode)
call read_dataset(file_id, "run_mode", word)
select case(word)
case ('fixed source')
run_mode = MODE_FIXEDSOURCE
case ('k-eigenvalue')
run_mode = MODE_EIGENVALUE
end select
call read_dataset(file_id, "n_particles", n_particles)
call read_dataset(file_id, "n_batches", int_array(1))
@ -701,142 +770,6 @@ contains
end if
end if
! Read number of meshes
tallies_group = open_group(file_id, "tallies")
meshes_group = open_group(tallies_group, "meshes")
call read_dataset(meshes_group, "n_meshes", n_meshes)
if (n_meshes > 0) then
! Read list of mesh keys-> IDs
allocate(id_array(n_meshes))
allocate(key_array(n_meshes))
call read_dataset(meshes_group, "ids", id_array)
call read_dataset(meshes_group, "keys", key_array)
! Read and overwrite mesh information
MESH_LOOP: do i = 1, n_meshes
meshp => meshes(id_array(i))
curr_key = key_array(id_array(i))
mesh_group = open_group(meshes_group, "mesh " // &
trim(to_str(curr_key)))
call read_dataset(mesh_group, "id", meshp%id)
call read_dataset(mesh_group, "type", meshp%type)
call read_dataset(mesh_group, "n_dimension", meshp%n_dimension)
call read_dataset(mesh_group, "dimension", meshp%dimension)
call read_dataset(mesh_group, "lower_left", meshp%lower_left)
call read_dataset(mesh_group, "upper_right", meshp%upper_right)
call read_dataset(mesh_group, "width", meshp%width)
call close_group(mesh_group)
end do MESH_LOOP
deallocate(id_array)
deallocate(key_array)
end if
call close_group(meshes_group)
! Read and overwrite number of tallies
call read_dataset(tallies_group, "n_tallies", n_tallies)
! Read list of tally keys-> IDs
allocate(id_array(n_tallies))
allocate(key_array(n_tallies))
call read_dataset(tallies_group, "ids", id_array)
call read_dataset(tallies_group, "keys", key_array)
! Read in tally metadata
TALLY_METADATA: do i = 1, n_tallies
! Get pointer to tally
tally => tallies(i)
curr_key = key_array(id_array(i))
tally_group = open_group(tallies_group, "tally " // &
trim(to_str(curr_key)))
call read_dataset(tally_group, "estimator", tally%estimator)
call read_dataset(tally_group, "n_realizations", tally%n_realizations)
call read_dataset(tally_group, "n_filters", tally%n_filters)
FILTER_LOOP: do j = 1, tally%n_filters
filter_group = open_group(tally_group, "filter " // trim(to_str(j)))
call read_dataset(filter_group, "type", tally%filters(j)%type)
call read_dataset(filter_group, "offset", tally%filters(j)%offset)
call read_dataset(filter_group, "n_bins", tally%filters(j)%n_bins)
if (tally%filters(j)%type == FILTER_ENERGYIN .or. &
tally%filters(j)%type == FILTER_ENERGYOUT) then
call read_dataset(filter_group, "bins", tally%filters(j)%real_bins)
else
call read_dataset(filter_group, "bins", tally%filters(j)%int_bins)
end if
call close_group(filter_group)
end do FILTER_LOOP
call read_dataset(tally_group, "n_nuclides", tally%n_nuclide_bins)
! Set up nuclide bin array and then read
allocate(temp_array(tally%n_nuclide_bins))
call read_dataset(tally_group, "nuclides", temp_array)
NUCLIDE_LOOP: do j = 1, tally%n_nuclide_bins
if (temp_array(j) > 0) then
tally%nuclide_bins(j) = temp_array(j)
else
tally%nuclide_bins(j) = temp_array(j)
end if
end do NUCLIDE_LOOP
deallocate(temp_array)
! Write number of score bins, score bins, user score bins
call read_dataset(tally_group, "n_score_bins", tally%n_score_bins)
call read_dataset(tally_group, "score_bins", tally%score_bins)
call read_dataset(tally_group, "n_user_score_bins", tally%n_user_score_bins)
! Read explicit moment order strings for each score bin
k = 1
moments_group = open_group(tally_group, "moments")
MOMENT_LOOP: do j = 1, tally%n_user_score_bins
select case(tally%score_bins(k))
case (SCORE_SCATTER_N, SCORE_NU_SCATTER_N)
call read_dataset(moments_group, "order" // trim(to_str(k)), &
moment_name)
k = k + 1
case (SCORE_SCATTER_PN, SCORE_NU_SCATTER_PN)
do n_order = 0, tally%moment_order(k)
call read_dataset(moments_group, "order" // trim(to_str(k)), &
moment_name)
k = k + 1
end do
case (SCORE_SCATTER_YN, SCORE_NU_SCATTER_YN, SCORE_FLUX_YN, &
SCORE_TOTAL_YN)
do n_order = 0, tally%moment_order(k)
do nm_order = -n_order, n_order
call read_dataset(moments_group, "order" // trim(to_str(k)), &
moment_name)
k = k + 1
end do
end do
case default
call read_dataset(moments_group, "order" // trim(to_str(k)), &
moment_name)
k = k + 1
end select
end do MOMENT_LOOP
call close_group(moments_group)
call close_group(tally_group)
end do TALLY_METADATA
! Check to make sure source bank is present
if (path_source_point == path_state_point .and. .not. source_present) then
call fatal_error("Source bank must be contained in statepoint restart &
@ -849,13 +782,6 @@ contains
! Read number of realizations for global tallies
call read_dataset(file_id, "n_realizations", n_realizations, indep=.true.)
! Read number of global tallies
call read_dataset(file_id, "n_global_tallies", int_array(1), indep=.false.)
if (int_array(1) /= N_GLOBAL_TALLIES) then
call fatal_error("Number of global tallies does not match in state &
&point.")
end if
! Read global tally data
call read_dataset(file_id, "global_tallies", global_tallies)
@ -866,14 +792,12 @@ contains
! Read in sum and sum squared
if (int_array(1) == 1) then
TALLY_RESULTS: do i = 1, n_tallies
! Set pointer to tally
tally => tallies(i)
curr_key = key_array(id_array(i))
! Read sum and sum_sq for each bin
tally_group = open_group(tallies_group, "tally " // &
trim(to_str(curr_key)))
trim(to_str(tally%id)))
call read_dataset(tally_group, "results", tally%results)
call close_group(tally_group)
end do TALLY_RESULTS
@ -882,8 +806,6 @@ contains
call close_group(tallies_group)
end if
deallocate(id_array)
deallocate(key_array)
! Read source if in eigenvalue mode
if (run_mode == MODE_EIGENVALUE) then

View file

@ -8,7 +8,7 @@ module summary
use global
use hdf5_interface
use material_header, only: Material
use mesh_header, only: StructuredMesh
use mesh_header, only: RegularMesh
use output, only: time_stamp
use string, only: to_str
use tally_header, only: TallyObject
@ -62,7 +62,6 @@ contains
call write_geometry(file_id)
call write_materials(file_id)
call write_nuclides(file_id)
if (n_tallies > 0) then
call write_tallies(file_id)
end if
@ -79,6 +78,10 @@ contains
subroutine write_header(file_id)
integer(HID_T), intent(in) :: file_id
! Write filetype and revision
call write_dataset(file_id, "filetype", "summary")
call write_dataset(file_id, "revision", REVISION_SUMMARY)
! Write version information
call write_dataset(file_id, "version_major", VERSION_MAJOR)
call write_dataset(file_id, "version_minor", VERSION_MINOR)
@ -103,6 +106,7 @@ contains
integer :: i, j, k, m
integer, allocatable :: lattice_universes(:,:,:)
integer, allocatable :: surface_ids(:)
integer(HID_T) :: geom_group
integer(HID_T) :: cells_group, cell_group
integer(HID_T) :: surfaces_group, surface_group
@ -153,23 +157,15 @@ contains
case (CELL_FILL)
call write_dataset(cell_group, "fill_type", "universe")
call write_dataset(cell_group, "fill", universes(c%fill)%id)
call write_dataset(cell_group, "maps", size(c%offset))
if (size(c%offset) > 0) then
call write_dataset(cell_group, "offset", c%offset)
end if
if (allocated(c%translation)) then
call write_dataset(cell_group, "translated", 1)
call write_dataset(cell_group, "translation", c%translation)
else
call write_dataset(cell_group, "translated", 0)
end if
if (allocated(c%rotation)) then
call write_dataset(cell_group, "rotated", 1)
call write_dataset(cell_group, "rotation", c%rotation)
else
call write_dataset(cell_group, "rotated", 0)
end if
case (CELL_LATTICE)
@ -179,7 +175,13 @@ contains
! Write list of bounding surfaces
if (c%n_surfaces > 0) then
call write_dataset(cell_group, "surfaces", c%surfaces)
allocate(surface_ids(c%n_surfaces))
do j = 1, c%n_surfaces
k = c%surfaces(j)
surface_ids(j) = sign(surfaces(abs(k))%id, k)
end do
call write_dataset(cell_group, "surfaces", surface_ids)
deallocate(surface_ids)
end if
call close_group(cell_group)
@ -208,42 +210,32 @@ contains
! Write surface type
select case (s%type)
case (SURF_PX)
call write_dataset(surface_group, "type", "X Plane")
call write_dataset(surface_group, "type", "x-plane")
case (SURF_PY)
call write_dataset(surface_group, "type", "Y Plane")
call write_dataset(surface_group, "type", "y-plane")
case (SURF_PZ)
call write_dataset(surface_group, "type", "Z Plane")
call write_dataset(surface_group, "type", "z-plane")
case (SURF_PLANE)
call write_dataset(surface_group, "type", "Plane")
call write_dataset(surface_group, "type", "plane")
case (SURF_CYL_X)
call write_dataset(surface_group, "type", "X Cylinder")
call write_dataset(surface_group, "type", "x-cylinder")
case (SURF_CYL_Y)
call write_dataset(surface_group, "type", "Y Cylinder")
call write_dataset(surface_group, "type", "y-cylinder")
case (SURF_CYL_Z)
call write_dataset(surface_group, "type", "Z Cylinder")
call write_dataset(surface_group, "type", "z-cylinder")
case (SURF_SPHERE)
call write_dataset(surface_group, "type", "Sphere")
call write_dataset(surface_group, "type", "sphere")
case (SURF_CONE_X)
call write_dataset(surface_group, "type", "X Cone")
call write_dataset(surface_group, "type", "x-cone")
case (SURF_CONE_Y)
call write_dataset(surface_group, "type", "Y Cone")
call write_dataset(surface_group, "type", "y-cone")
case (SURF_CONE_Z)
call write_dataset(surface_group, "type", "Z Cone")
call write_dataset(surface_group, "type", "z-cone")
end select
! Write coefficients for surface
call write_dataset(surface_group, "coefficients", s%coeffs)
! Write positive neighbors
if (allocated(s%neighbor_pos)) then
call write_dataset(surface_group, "neighbors_positive", s%neighbor_pos)
end if
! Write negative neighbors
if (allocated(s%neighbor_neg)) then
call write_dataset(surface_group, "neighbors_negative", s%neighbor_neg)
end if
! Write boundary condition
select case (s%bc)
case (BC_TRANSMIT)
@ -298,10 +290,16 @@ contains
! Write internal OpenMC index for this lattice
call write_dataset(lattice_group, "index", i)
! Write name for this lattice
! Write name, pitch, and outer universe
call write_dataset(lattice_group, "name", lat%name)
call write_dataset(lattice_group, "pitch", lat%pitch)
call write_dataset(lattice_group, "outer", lat%outer)
! Write distribcell offsets if present
if (size(lat%offset) > 0) then
call write_dataset(lattice_group, "offsets", lat%offset)
end if
! Write lattice type
select type (lat)
type is (RectLattice)
! Write lattice type.
@ -310,15 +308,6 @@ contains
! Write lattice dimensions, lower left corner, and pitch
call write_dataset(lattice_group, "dimension", lat%n_cells)
call write_dataset(lattice_group, "lower_left", lat%lower_left)
call write_dataset(lattice_group, "pitch", lat%pitch)
call write_dataset(lattice_group, "outer", lat%outer)
call write_dataset(lattice_group, "offset_size", size(lat%offset))
call write_dataset(lattice_group, "maps", size(lat%offset,1))
if (size(lat%offset) > 0) then
call write_dataset(lattice_group, "offsets", lat%offset)
end if
! Write lattice universes.
allocate(lattice_universes(lat%n_cells(1), lat%n_cells(2), &
@ -330,8 +319,6 @@ contains
end do
end do
end do
call write_dataset(lattice_group, "universes", lattice_universes)
deallocate(lattice_universes)
type is (HexLattice)
! Write lattice type.
@ -341,17 +328,8 @@ contains
call write_dataset(lattice_group, "n_rings", lat%n_rings)
call write_dataset(lattice_group, "n_axial", lat%n_axial)
! Write lattice center, pitch and outer universe.
! Write lattice center
call write_dataset(lattice_group, "center", lat%center)
call write_dataset(lattice_group, "pitch", lat%pitch)
call write_dataset(lattice_group, "outer", lat%outer)
call write_dataset(lattice_group, "offset_size", size(lat%offset))
call write_dataset(lattice_group, "maps", size(lat%offset,1))
if (size(lat%offset) > 0) then
call write_dataset(lattice_group, "offsets", lat%offset)
end if
! Write lattice universes.
allocate(lattice_universes(2*lat%n_rings - 1, 2*lat%n_rings - 1, &
@ -372,10 +350,12 @@ contains
end do
end do
end do
call write_dataset(lattice_group, "universes", lattice_universes)
deallocate(lattice_universes)
end select
! Write lattice universes
call write_dataset(lattice_group, "universes", lattice_universes)
deallocate(lattice_universes)
call close_group(lattice_group)
end do LATTICE_LOOP
@ -391,12 +371,12 @@ contains
subroutine write_materials(file_id)
integer(HID_T), intent(in) :: file_id
integer :: i
integer :: j
integer, allocatable :: zaids(:)
integer :: i
integer :: j
integer :: i_list
character(12), allocatable :: nucnames(:)
integer(HID_T) :: materials_group
integer(HID_T) :: material_group
integer(HID_T) :: sab_group
type(Material), pointer :: m
materials_group = create_group(file_id, "materials")
@ -422,32 +402,23 @@ contains
"atom/b-cm")
! Copy ZAID for each nuclide to temporary array
allocate(zaids(m%n_nuclides))
allocate(nucnames(m%n_nuclides))
do j = 1, m%n_nuclides
zaids(j) = nuclides(m%nuclide(j))%zaid
i_list = nuclides(m%nuclide(j))%listing
nucnames(j) = xs_listings(i_list)%alias
end do
! Write temporary array to 'nuclides'
call write_dataset(material_group, "nuclides", zaids)
call write_dataset(material_group, "nuclides", nucnames)
! Deallocate temporary array
deallocate(zaids)
deallocate(nucnames)
! Write atom densities
call write_dataset(material_group, "nuclide_densities", m%atom_density)
! Write S(a,b) information if present
call write_dataset(material_group, "n_sab", m%n_sab)
if (m%n_sab > 0) then
call write_dataset(material_group, "i_sab_nuclides", m%i_sab_nuclides)
call write_dataset(material_group, "i_sab_tables", m%i_sab_tables)
sab_group = create_group(material_group, "sab_tables")
do j = 1, m%n_sab
call write_dataset(sab_group, to_str(j), m%sab_names(j))
end do
call close_group(sab_group)
call write_dataset(material_group, "sab_names", m%sab_names)
end if
call close_group(material_group)
@ -464,13 +435,14 @@ contains
subroutine write_tallies(file_id)
integer(HID_T), intent(in) :: file_id
integer :: i, j
integer, allocatable :: temp_array(:) ! nuclide bin array
integer :: i, j
integer :: i_list, i_xs
integer(HID_T) :: tallies_group
integer(HID_T) :: mesh_group
integer(HID_T) :: tally_group
integer(HID_T) :: filter_group
type(StructuredMesh), pointer :: m
character(20), allocatable :: str_array(:)
type(RegularMesh), pointer :: m
type(TallyObject), pointer :: t
tallies_group = create_group(file_id, "tallies")
@ -483,9 +455,11 @@ contains
m => meshes(i)
mesh_group = create_group(tallies_group, "mesh " // trim(to_str(m%id)))
! Write internal OpenMC index for this mesh
call write_dataset(mesh_group, "index", i)
! Write type and number of dimensions
call write_dataset(mesh_group, "type", m%type)
call write_dataset(mesh_group, "n_dimension", m%n_dimension)
call write_dataset(mesh_group, "type", "regular")
! Write mesh information
call write_dataset(mesh_group, "dimension", m%dimension)
@ -504,15 +478,11 @@ contains
t => tallies(i)
tally_group = create_group(tallies_group, "tally " // trim(to_str(t%id)))
! Write the name for this tally
call write_dataset(tally_group, "name_size", len(t%name))
if (len(t%name) > 0) then
call write_dataset(tally_group, "name", t%name)
endif
! Write internal OpenMC index for this tally
call write_dataset(tally_group, "index", i)
! Write size of each tally
call write_dataset(tally_group, "total_score_bins", t%total_score_bins)
call write_dataset(tally_group, "total_filter_bins", t%total_filter_bins)
! Write the name for this tally
call write_dataset(tally_group, "name", t%name)
! Write number of filters
call write_dataset(tally_group, "n_filters", t%n_filters)
@ -520,10 +490,8 @@ contains
FILTER_LOOP: do j = 1, t%n_filters
filter_group = create_group(tally_group, "filter " // trim(to_str(j)))
! Write type of filter
call write_dataset(filter_group, "type", t%filters(j)%type)
! Write number of bins for this filter
call write_dataset(filter_group, "offset", t%filters(j)%offset)
call write_dataset(filter_group, "n_bins", t%filters(j)%n_bins)
! Write filter bins
@ -537,46 +505,100 @@ contains
! Write name of type
select case (t%filters(j)%type)
case(FILTER_UNIVERSE)
call write_dataset(filter_group, "type_name", "universe")
call write_dataset(filter_group, "type", "universe")
case(FILTER_MATERIAL)
call write_dataset(filter_group, "type_name", "material")
call write_dataset(filter_group, "type", "material")
case(FILTER_CELL)
call write_dataset(filter_group, "type_name", "cell")
call write_dataset(filter_group, "type", "cell")
case(FILTER_CELLBORN)
call write_dataset(filter_group, "type_name", "cellborn")
call write_dataset(filter_group, "type", "cellborn")
case(FILTER_SURFACE)
call write_dataset(filter_group, "type_name", "surface")
call write_dataset(filter_group, "type", "surface")
case(FILTER_MESH)
call write_dataset(filter_group, "type_name", "mesh")
call write_dataset(filter_group, "type", "mesh")
case(FILTER_ENERGYIN)
call write_dataset(filter_group, "type_name", "energy")
call write_dataset(filter_group, "type", "energy")
case(FILTER_ENERGYOUT)
call write_dataset(filter_group, "type_name", "energyout")
call write_dataset(filter_group, "type", "energyout")
case(FILTER_DISTRIBCELL)
call write_dataset(filter_group, "type", "distribcell")
end select
call close_group(filter_group)
end do FILTER_LOOP
! Write number of nuclide bins
call write_dataset(tally_group, "n_nuclide_bins", t%n_nuclide_bins)
! Create temporary array for nuclide bins
allocate(temp_array(t%n_nuclide_bins))
allocate(str_array(t%n_nuclide_bins))
NUCLIDE_LOOP: do j = 1, t%n_nuclide_bins
if (t%nuclide_bins(j) > 0) then
temp_array(j) = nuclides(t%nuclide_bins(j))%zaid
i_list = nuclides(t%nuclide_bins(j))%listing
i_xs = index(xs_listings(i_list)%alias, '.')
if (i_xs > 0) then
str_array(j) = xs_listings(i_list)%alias(1:i_xs - 1)
else
str_array(j) = xs_listings(i_list)%alias
end if
else
temp_array(j) = t%nuclide_bins(j)
str_array(j) = 'total'
end if
end do NUCLIDE_LOOP
! Write and deallocate nuclide bins
call write_dataset(tally_group, "nuclide_bins", temp_array)
deallocate(temp_array)
call write_dataset(tally_group, "nuclides", str_array)
deallocate(str_array)
! Write number of score bins
call write_dataset(tally_group, "n_score_bins", t%n_score_bins)
call write_dataset(tally_group, "score_bins", t%score_bins)
allocate(str_array(size(t%score_bins)))
do j = 1, size(t%score_bins)
select case(t%score_bins(j))
case (SCORE_FLUX)
str_array(j) = "flux"
case (SCORE_TOTAL)
str_array(j) = "total"
case (SCORE_SCATTER)
str_array(j) = "scatter"
case (SCORE_NU_SCATTER)
str_array(j) = "nu-scatter"
case (SCORE_SCATTER_N)
str_array(j) = "scatter-n"
case (SCORE_SCATTER_PN)
str_array(j) = "scatter-pn"
case (SCORE_NU_SCATTER_N)
str_array(j) = "nu-scatter-n"
case (SCORE_NU_SCATTER_PN)
str_array(j) = "nu-scatter-pn"
case (SCORE_TRANSPORT)
str_array(j) = "transport"
case (SCORE_N_1N)
str_array(j) = "n1n"
case (SCORE_ABSORPTION)
str_array(j) = "absorption"
case (SCORE_FISSION)
str_array(j) = "fission"
case (SCORE_NU_FISSION)
str_array(j) = "nu-fission"
case (SCORE_KAPPA_FISSION)
str_array(j) = "kappa-fission"
case (SCORE_CURRENT)
str_array(j) = "current"
case (SCORE_FLUX_YN)
str_array(j) = "flux-yn"
case (SCORE_TOTAL_YN)
str_array(j) = "total-yn"
case (SCORE_SCATTER_YN)
str_array(j) = "scatter-yn"
case (SCORE_NU_SCATTER_YN)
str_array(j) = "nu-scatter-yn"
case (SCORE_EVENTS)
str_array(j) = "events"
case default
str_array(j) = reaction_name(t%score_bins(j))
end select
end do
call write_dataset(tally_group, "score_bins", str_array)
deallocate(str_array)
call close_group(tally_group)
end do TALLY_METADATA
@ -585,115 +607,6 @@ contains
end subroutine write_tallies
!===============================================================================
! WRITE_NUCLIDES
!===============================================================================
subroutine write_nuclides(file_id)
integer(HID_T), intent(in) :: file_id
integer :: i, j
integer :: size_total
integer :: size_xs
integer :: size_angle
integer :: size_energy
integer(HID_T) :: nuclides_group, nuclide_group
integer(HID_T) :: reactions_group, rxn_group
type(Nuclide), pointer :: nuc
type(Reaction), pointer :: rxn
type(UrrData), pointer :: urr
nuclides_group = create_group(file_id, "nuclides")
! write number of nuclides
call write_dataset(nuclides_group, "n_nuclides", n_nuclides_total)
! Write information on each nuclide
NUCLIDE_LOOP: do i = 1, n_nuclides_total
nuc => nuclides(i)
nuclide_group = create_group(nuclides_group, nuc%name)
! Write internal OpenMC index for this nuclide
call write_dataset(nuclide_group, "index", i)
! Determine size of cross-sections
size_xs = (5 + nuc%n_reaction) * nuc%n_grid * 8
size_total = size_xs
! Write some basic attributes
call write_dataset(nuclide_group, "zaid", nuc%zaid)
call write_dataset(nuclide_group, "alias", xs_listings(nuc%listing)%alias)
call write_dataset(nuclide_group, "awr", nuc%awr)
call write_dataset(nuclide_group, "kT", nuc%kT)
call write_dataset(nuclide_group, "n_grid", nuc%n_grid)
call write_dataset(nuclide_group, "n_reactions", nuc%n_reaction)
call write_dataset(nuclide_group, "n_fission", nuc%n_fission)
call write_dataset(nuclide_group, "size_xs", size_xs)
! =======================================================================
! WRITE INFORMATION ON EACH REACTION
! Create overall group for reactions and close it
reactions_group = create_group(nuclide_group, "reactions")
RXN_LOOP: do j = 1, nuc%n_reaction
! Information on each reaction
rxn => nuc%reactions(j)
rxn_group = create_group(reactions_group, trim(reaction_name(rxn%MT)))
! Determine size of angle distribution
if (rxn%has_angle_dist) then
size_angle = rxn%adist%n_energy * 16 + size(rxn%adist%data) * 8
else
size_angle = 0
end if
! Determine size of energy distribution
if (rxn%has_energy_dist) then
size_energy = size(rxn%edist%data) * 8
else
size_energy = 0
end if
! Write information on reaction
call write_dataset(rxn_group, "Q_value", rxn%Q_value)
call write_dataset(rxn_group, "multiplicity", rxn%multiplicity)
call write_dataset(rxn_group, "threshold", rxn%threshold)
call write_dataset(rxn_group, "size_angle", size_angle)
call write_dataset(rxn_group, "size_energy", size_energy)
! Accumulate data size
size_total = size_total + size_angle + size_energy
call close_group(rxn_group)
end do RXN_LOOP
call close_group(reactions_group)
! =======================================================================
! WRITE INFORMATION ON URR PROBABILITY TABLES
if (nuc%urr_present) then
urr => nuc%urr_data
call write_dataset(nuclide_group, "urr_n_energy", urr%n_energy)
call write_dataset(nuclide_group, "urr_n_prob", urr%n_prob)
call write_dataset(nuclide_group, "urr_interp", urr%interp)
call write_dataset(nuclide_group, "urr_inelastic", urr%inelastic_flag)
call write_dataset(nuclide_group, "urr_absorption", urr%absorption_flag)
call write_dataset(nuclide_group, "urr_min_E", urr%energy(1))
call write_dataset(nuclide_group, "urr_max_E", urr%energy(urr%n_energy))
end if
! Write total memory used
call write_dataset(nuclide_group, "size_total", size_total)
call close_group(nuclide_group)
end do NUCLIDE_LOOP
call close_group(nuclides_group)
end subroutine write_nuclides
!===============================================================================
! WRITE_TIMING
!===============================================================================

View file

@ -9,7 +9,7 @@ module tally
use mesh, only: get_mesh_bin, bin_to_mesh_indices, &
get_mesh_indices, mesh_indices_to_bin, &
mesh_intersects_2d, mesh_intersects_3d
use mesh_header, only: StructuredMesh
use mesh_header, only: RegularMesh
use output, only: header
use particle_header, only: LocalCoord, Particle
use search, only: binary_search
@ -81,8 +81,8 @@ contains
case (SCORE_FLUX, SCORE_FLUX_YN)
if (t % estimator == ESTIMATOR_ANALOG) then
! All events score to a flux bin. We actually use a collision
! estimator since there is no way to count 'events' exactly for
! the flux
! estimator in place of an analog one since there is no way to count
! 'events' exactly for the flux
if (survival_biasing) then
! We need to account for the fact that some weight was already
! absorbed
@ -92,7 +92,7 @@ contains
end if
score = score / material_xs % total
else if (t % estimator == ESTIMATOR_TRACKLENGTH) then
else
! For flux, we need no cross section
score = flux
end if
@ -111,7 +111,7 @@ contains
score = p % last_wgt
end if
else if (t % estimator == ESTIMATOR_TRACKLENGTH) then
else
if (i_nuclide > 0) then
score = micro_xs(i_nuclide) % total * atom_density * flux
else
@ -129,8 +129,8 @@ contains
! reaction rate
score = p % last_wgt
else if (t % estimator == ESTIMATOR_TRACKLENGTH) then
! Note SCORE_SCATTER_N not available for tracklength.
else
! Note SCORE_SCATTER_N not available for tracklength/collision.
if (i_nuclide > 0) then
score = (micro_xs(i_nuclide) % total &
- micro_xs(i_nuclide) % absorption) * atom_density * flux
@ -240,7 +240,7 @@ contains
score = p % last_wgt
end if
else if (t % estimator == ESTIMATOR_TRACKLENGTH) then
else
if (i_nuclide > 0) then
score = micro_xs(i_nuclide) % absorption * atom_density * flux
else
@ -271,7 +271,7 @@ contains
/ micro_xs(p % event_nuclide) % absorption
end if
else if (t % estimator == ESTIMATOR_TRACKLENGTH) then
else
if (i_nuclide > 0) then
score = micro_xs(i_nuclide) % fission * atom_density * flux
else
@ -314,7 +314,7 @@ contains
score = keff * p % wgt_bank
end if
else if (t % estimator == ESTIMATOR_TRACKLENGTH) then
else
if (i_nuclide > 0) then
score = micro_xs(i_nuclide) % nu_fission * atom_density * flux
else
@ -347,7 +347,7 @@ contains
micro_xs(p % event_nuclide) % absorption
end if
else if (t % estimator == ESTIMATOR_TRACKLENGTH) then
else
if (i_nuclide > 0) then
score = micro_xs(i_nuclide) % kappa_fission * atom_density * flux
else
@ -360,6 +360,19 @@ contains
! Simply count number of scoring events
score = ONE
case (ELASTIC)
if (t % estimator == ESTIMATOR_ANALOG) then
! Check if event MT matches
if (p % event_MT /= ELASTIC) cycle SCORE_LOOP
score = p % last_wgt
else
if (i_nuclide > 0) then
score = micro_xs(i_nuclide) % elastic * atom_density * flux
else
score = material_xs % elastic * flux
end if
end if
case default
if (t % estimator == ESTIMATOR_ANALOG) then
@ -368,7 +381,7 @@ contains
if (p % event_MT /= score_bin) cycle SCORE_LOOP
score = p % last_wgt
else if (t % estimator == ESTIMATOR_TRACKLENGTH) then
else
! Any other cross section has to be calculated on-the-fly. For
! cross sections that are used often (e.g. n2n, ngamma, etc. for
! depletion), it might make sense to optimize this section or
@ -484,7 +497,8 @@ contains
case(SCORE_FLUX_YN, SCORE_TOTAL_YN)
score_index = score_index - 1
num_nm = 1
if (t % estimator == ESTIMATOR_ANALOG) then
if (t % estimator == ESTIMATOR_ANALOG .or. &
t % estimator == ESTIMATOR_COLLISION) then
uvw = p % last_uvw
else if (t % estimator == ESTIMATOR_TRACKLENGTH) then
uvw = p % coord(1) % uvw
@ -536,6 +550,59 @@ contains
end do SCORE_LOOP
end subroutine score_general
!===============================================================================
! SCORE_ALL_NUCLIDES tallies individual nuclide reaction rates specifically when
! the user requests <nuclides>all</nuclides>.
!===============================================================================
subroutine score_all_nuclides(p, i_tally, flux, filter_index)
type(Particle), intent(in) :: p
integer, intent(in) :: i_tally
real(8), intent(in) :: flux
integer, intent(in) :: filter_index
integer :: i ! loop index for nuclides in material
integer :: i_nuclide ! index in nuclides array
real(8) :: atom_density ! atom density of single nuclide in atom/b-cm
type(TallyObject), pointer :: t
type(Material), pointer :: mat
! Get pointer to tally
t => tallies(i_tally)
! Get pointer to current material. We need this in order to determine what
! nuclides are in the material
mat => materials(p % material)
! ==========================================================================
! SCORE ALL INDIVIDUAL NUCLIDE REACTION RATES
NUCLIDE_LOOP: do i = 1, mat % n_nuclides
! Determine index in nuclides array and atom density for i-th nuclide in
! current material
i_nuclide = mat % nuclide(i)
atom_density = mat % atom_density(i)
! Determine score for each bin
call score_general(p, t, (i_nuclide-1)*t % n_score_bins, filter_index, &
i_nuclide, atom_density, flux)
end do NUCLIDE_LOOP
! ==========================================================================
! SCORE TOTAL MATERIAL REACTION RATES
i_nuclide = -1
atom_density = ZERO
! Determine score for each bin
call score_general(p, t, n_nuclides_total*t % n_score_bins, filter_index, &
i_nuclide, atom_density, flux)
end subroutine score_all_nuclides
!===============================================================================
! SCORE_ANALOG_TALLY keeps track of how many events occur in a specified cell,
! energy range, etc. Note that since these are "analog" tallies, they are only
@ -819,59 +886,6 @@ contains
end subroutine score_tracklength_tally
!===============================================================================
! SCORE_ALL_NUCLIDES tallies individual nuclide reaction rates specifically when
! the user requests <nuclides>all</nuclides>.
!===============================================================================
subroutine score_all_nuclides(p, i_tally, flux, filter_index)
type(Particle), intent(in) :: p
integer, intent(in) :: i_tally
real(8), intent(in) :: flux
integer, intent(in) :: filter_index
integer :: i ! loop index for nuclides in material
integer :: i_nuclide ! index in nuclides array
real(8) :: atom_density ! atom density of single nuclide in atom/b-cm
type(TallyObject), pointer :: t
type(Material), pointer :: mat
! Get pointer to tally
t => tallies(i_tally)
! Get pointer to current material. We need this in order to determine what
! nuclides are in the material
mat => materials(p % material)
! ==========================================================================
! SCORE ALL INDIVIDUAL NUCLIDE REACTION RATES
NUCLIDE_LOOP: do i = 1, mat % n_nuclides
! Determine index in nuclides array and atom density for i-th nuclide in
! current material
i_nuclide = mat % nuclide(i)
atom_density = mat % atom_density(i)
! Determine score for each bin
call score_general(p, t, (i_nuclide-1)*t % n_score_bins, filter_index, &
i_nuclide, atom_density, flux)
end do NUCLIDE_LOOP
! ==========================================================================
! SCORE TOTAL MATERIAL REACTION RATES
i_nuclide = -1
atom_density = ZERO
! Determine score for each bin
call score_general(p, t, n_nuclides_total*t % n_score_bins, filter_index, &
i_nuclide, atom_density, flux)
end subroutine score_all_nuclides
!===============================================================================
! SCORE_TL_ON_MESH calculate fluxes and reaction rates based on the track-length
! estimate of the flux specifically for tallies that have mesh filters. For
@ -907,7 +921,7 @@ contains
logical :: start_in_mesh ! starting coordinates inside mesh?
logical :: end_in_mesh ! ending coordinates inside mesh?
type(TallyObject), pointer :: t
type(StructuredMesh), pointer :: m
type(RegularMesh), pointer :: m
type(Material), pointer :: mat
t => tallies(i_tally)
@ -1119,6 +1133,118 @@ contains
end subroutine score_tl_on_mesh
!===============================================================================
! SCORE_COLLISION_TALLY calculates fluxes and reaction rates based on the
! 1/Sigma_t estimate of the flux. This is triggered after every collision. It
! is invalid for tallies that require post-collison information because it can
! score reactions that didn't actually occur, and we don't a priori know what
! the outcome will be for reactions that we didn't sample.
!===============================================================================
subroutine score_collision_tally(p)
type(Particle), intent(in) :: p
integer :: i
integer :: i_tally
integer :: j ! loop index for scoring bins
integer :: k ! loop index for nuclide bins
integer :: filter_index ! single index for single bin
integer :: i_nuclide ! index in nuclides array (from bins)
real(8) :: flux ! collision estimate of flux
real(8) :: atom_density ! atom density of single nuclide
! in atom/b-cm
logical :: found_bin ! scoring bin found?
type(TallyObject), pointer :: t
type(Material), pointer :: mat
! Determine collision estimate of flux
if (survival_biasing) then
! We need to account for the fact that some weight was already absorbed
flux = (p % last_wgt + p % absorb_wgt) / material_xs % total
else
flux = p % last_wgt / material_xs % total
end if
! A loop over all tallies is necessary because we need to simultaneously
! determine different filter bins for the same tally in order to score to it
TALLY_LOOP: do i = 1, active_collision_tallies % size()
! Get index of tally and pointer to tally
i_tally = active_collision_tallies % get_item(i)
t => tallies(i_tally)
! =======================================================================
! DETERMINE SCORING BIN COMBINATION
call get_scoring_bins(p, i_tally, found_bin)
if (.not. found_bin) cycle
! =======================================================================
! CALCULATE RESULTS AND ACCUMULATE TALLY
! If we have made it here, we have a scoring combination of bins for this
! tally -- now we need to determine where in the results array we should
! be accumulating the tally values
! Determine scoring index for this filter combination
filter_index = sum((matching_bins(1:t%n_filters) - 1) * t % stride) + 1
if (t % all_nuclides) then
if (p % material /= MATERIAL_VOID) then
call score_all_nuclides(p, i_tally, flux, filter_index)
end if
else
NUCLIDE_BIN_LOOP: do k = 1, t % n_nuclide_bins
! Get index of nuclide in nuclides array
i_nuclide = t % nuclide_bins(k)
if (i_nuclide > 0) then
if (p % material /= MATERIAL_VOID) then
! Get pointer to current material
mat => materials(p % material)
! Determine if nuclide is actually in material
NUCLIDE_MAT_LOOP: do j = 1, mat % n_nuclides
! If index of nuclide matches the j-th nuclide listed in the
! material, break out of the loop
if (i_nuclide == mat % nuclide(j)) exit
! If we've reached the last nuclide in the material, it means
! the specified nuclide to be tallied is not in this material
if (j == mat % n_nuclides) then
cycle NUCLIDE_BIN_LOOP
end if
end do NUCLIDE_MAT_LOOP
atom_density = mat % atom_density(j)
else
atom_density = ZERO
end if
end if
! Determine score for each bin
call score_general(p, t, (k-1)*t % n_score_bins, filter_index, &
i_nuclide, atom_density, flux)
end do NUCLIDE_BIN_LOOP
end if
! If the user has specified that we can assume all tallies are spatially
! separate, this implies that once a tally has been scored to, we needn't
! check the others. This cuts down on overhead when there are many
! tallies specified
if (assume_separate) exit TALLY_LOOP
end do TALLY_LOOP
! Reset tally map positioning
position = 0
end subroutine score_collision_tally
!===============================================================================
! GET_SCORING_BINS determines a combination of filter bins that should be scored
! for a tally based on the particle's current attributes.
@ -1136,7 +1262,7 @@ contains
integer :: offset ! offset for distribcell
real(8) :: E ! particle energy
type(TallyObject), pointer :: t
type(StructuredMesh), pointer :: m
type(RegularMesh), pointer :: m
found_bin = .true.
t => tallies(i_tally)
@ -1289,7 +1415,7 @@ contains
logical :: y_same ! same starting/ending y index (j)
logical :: z_same ! same starting/ending z index (k)
type(TallyObject), pointer :: t
type(StructuredMesh), pointer :: m
type(RegularMesh), pointer :: m
TALLY_LOOP: do i = 1, active_current_tallies % size()
! Copy starting and ending location of particle
@ -1873,6 +1999,8 @@ contains
call active_analog_tallies % add(i_user_tallies + i)
elseif (user_tallies(i) % estimator == ESTIMATOR_TRACKLENGTH) then
call active_tracklength_tallies % add(i_user_tallies + i)
elseif (user_tallies(i) % estimator == ESTIMATOR_COLLISION) then
call active_collision_tallies % add(i_user_tallies + i)
end if
elseif (user_tallies(i) % type == TALLY_SURFACE_CURRENT) then
call active_current_tallies % add(i_user_tallies + i)

View file

@ -114,7 +114,7 @@ contains
!$omp critical (FinalizeParticleTrack)
file_id = file_create(fname)
call write_dataset(file_id, 'filetype', FILETYPE_TRACK)
call write_dataset(file_id, 'filetype', 'track')
call write_dataset(file_id, 'revision', REVISION_TRACK)
call write_dataset(file_id, 'n_particles', n_particle_tracks)
call write_dataset(file_id, 'n_coords', n_coords)

View file

@ -13,7 +13,7 @@ module tracking
use random_lcg, only: prn
use string, only: to_str
use tally, only: score_analog_tally, score_tracklength_tally, &
score_surface_current
score_collision_tally, score_surface_current
use track_output, only: initialize_particle_track, write_particle_track, &
add_particle_track, finalize_particle_track
@ -157,6 +157,7 @@ contains
! has occurred rather than before because we need information on the
! outgoing energy for any tallies with an outgoing energy filter
if (active_collision_tallies % size() > 0) call score_collision_tally(p)
if (active_analog_tallies % size() > 0) call score_analog_tally(p)
! Reset banked weight during collision

View file

@ -9,6 +9,7 @@ module trigger
use string, only: to_str
use output, only: warning, write_message
use mesh, only: mesh_indices_to_bin
use mesh_header, only: RegularMesh
use trigger_header, only: TriggerObject
use tally, only: TallyObject
@ -315,7 +316,7 @@ contains
real(8) :: std_dev = ZERO ! temporary standard deviration of result
type(TallyObject), pointer :: t ! surface current tally
type(TriggerObject) :: trigger ! surface current tally trigger
type(StructuredMesh), pointer :: m ! surface current mesh
type(RegularMesh), pointer :: m ! surface current mesh
! Get pointer to mesh
i_filter_mesh = t % find_filter(FILTER_MESH)

View file

@ -2,7 +2,7 @@
<tallies>
<mesh id="1">
<type>rectangular</type>
<type>regular</type>
<lower_left>-10 -1 -1 </lower_left>
<upper_right>10 1 1</upper_right>
<dimension>10 1 1</dimension>

View file

@ -2,7 +2,7 @@
<tallies>
<mesh id="1">
<type>rectangular</type>
<type>regular</type>
<lower_left>-10 -1 -1 </lower_left>
<upper_right>10 1 1</upper_right>
<dimension>10 1 1</dimension>

View file

@ -14,7 +14,6 @@ class EntropyTestHarness(TestHarness):
# Read the statepoint file.
statepoint = glob.glob(os.path.join(os.getcwd(), self._sp_name))[0]
sp = StatePoint(statepoint)
sp.read_results()
# Write out k-combined.
outstr = 'k-combined:\n'
@ -23,7 +22,7 @@ class EntropyTestHarness(TestHarness):
# Write out entropy data.
outstr += 'entropy:\n'
results = ['{0:12.6E}'.format(x) for x in sp._entropy]
results = ['{0:12.6E}'.format(x) for x in sp.entropy]
outstr += '\n'.join(results) + '\n'
return outstr

View file

@ -2,7 +2,7 @@
<tallies>
<mesh id="1">
<type>rectangular</type>
<type>regular</type>
<lower_left>-182.07 -182.07</lower_left>
<upper_right>182.07 182.07</upper_right>
<dimension>17 17</dimension>
@ -13,4 +13,4 @@
<scores>total</scores>
</tally>
</tallies>
</tallies>

View file

@ -2,7 +2,7 @@
<tallies>
<mesh id="1">
<type>rectangular</type>
<type>regular</type>
<lower_left>-182.07 -182.07 -183.00</lower_left>
<upper_right>182.07 182.07 183.00</upper_right>
<dimension>17 17 17</dimension>
@ -13,4 +13,4 @@
<scores>total</scores>
</tally>
</tallies>
</tallies>

View file

@ -14,26 +14,26 @@ class FixedSourceTestHarness(TestHarness):
# Read the statepoint file.
statepoint = glob.glob(os.path.join(os.getcwd(), self._sp_name))[0]
sp = StatePoint(statepoint)
sp.read_results()
# Write out tally data.
outstr = ''
if self._tallies:
tally_num = 1
for tally_ind in sp._tallies:
tally = sp._tallies[tally_ind]
results = np.zeros((tally._sum.size*2, ))
results[0::2] = tally._sum.ravel()
results[1::2] = tally._sum_sq.ravel()
for tally_ind in sp.tallies:
tally = sp.tallies[tally_ind]
results = np.zeros((tally.sum.size*2, ))
results[0::2] = tally.sum.ravel()
results[1::2] = tally.sum_sq.ravel()
results = ['{0:12.6E}'.format(x) for x in results]
outstr += 'tally ' + str(tally_num) + ':\n'
outstr += '\n'.join(results) + '\n'
tally_num += 1
gt = sp.global_tallies
outstr += 'leakage:\n'
outstr += '{0:12.6E}'.format(sp._global_tallies[3][0]) + '\n'
outstr += '{0:12.6E}'.format(sp._global_tallies[3][1]) + '\n'
outstr += '{0:12.6E}'.format(gt[gt['name'] == b'leakage'][0]['sum']) + '\n'
outstr += '{0:12.6E}'.format(gt[gt['name'] == b'leakage'][0]['sum_sq']) + '\n'
return outstr

View file

@ -5,7 +5,7 @@ current gen:
particle id:
5.550000E+02
run mode:
2.000000E+00
k-eigenvalue
particle weight:
1.000000E+00
particle energy:

View file

@ -5,7 +5,7 @@ current gen:
particle id:
9.280000E+02
run mode:
1.000000E+00
fixed source
particle weight:
1.000000E+00
particle energy:

View file

@ -33,3 +33,69 @@ tally 1:
2.080857E-09
6.101318E-02
8.452067E-04
tally 2:
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
3.000000E-01
2.440000E-02
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
4.000000E-02
6.000000E-04
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
tally 3:
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
5.724026E-03
1.684945E-05
5.724026E-03
1.684945E-05
3.250298E-01
2.370870E-02
1.083784E+00
2.568556E-01
4.449887E-05
1.980149E-09
4.449887E-05
1.980149E-09
3.526275E-02
2.863085E-04
1.417358E-02
4.375519E-05
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
5.106469E-05
8.605176E-10
6.204277E-02
8.555398E-04

View file

@ -6,4 +6,16 @@
<scores>n2n 16 51 102</scores>
</tally>
</tallies>
<tally id="2">
<filter type="cell" bins="10 21 22 23" />
<scores>n2n 16 51 102</scores>
<estimator>analog</estimator>
</tally>
<tally id="3">
<filter type="cell" bins="10 21 22 23" />
<scores>n2n 16 51 102</scores>
<estimator>collision</estimator>
</tally>
</tallies>

View file

@ -18,3 +18,12 @@ tally 2:
0.000000E+00
4.000000E-01
4.240000E-02
tally 3:
0.000000E+00
0.000000E+00
1.990713E+00
8.557870E-01
1.427399E-02
4.420707E-05
2.968053E-01
1.960663E-02

View file

@ -12,4 +12,10 @@
<scores>absorption</scores>
</tally>
</tallies>
<tally id="3">
<filter type="cell" bins="10 21 22 23" />
<estimator>collision</estimator>
<scores>absorption</scores>
</tally>
</tallies>

View file

@ -2,7 +2,7 @@
<tallies>
<mesh id="1">
<type>rectangular</type>
<type>regular</type>
<lower_left>-182.07 -182.07 -183.00</lower_left>
<upper_right>182.07 182.07 183.00</upper_right>
<dimension>17 17 17</dimension>
@ -19,4 +19,4 @@
<scores>current</scores>
</tally>
</tallies>
</tallies>

View file

@ -18,3 +18,12 @@ tally 2:
0.000000E+00
9.923196E-01
2.067216E-01
tally 3:
9.036254E-01
1.746552E-01
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
9.912744E-01
2.192705E-01

View file

@ -12,4 +12,10 @@
<scores>fission</scores>
</tally>
</tallies>
<tally id="3">
<filter type="cell" bins="21 22 23 27" />
<estimator>collision</estimator>
<scores>fission</scores>
</tally>
</tallies>

View file

@ -13,3 +13,29 @@ tally 1:
2.880575E+01
5.605671E+01
6.804062E+02
tally 2:
3.077754E+01
2.017424E+02
1.172238E+01
3.139127E+01
5.231699E+01
5.870469E+02
3.259142E+01
2.336719E+02
1.040924E+01
2.432332E+01
5.709679E+01
6.978668E+02
tally 3:
3.077754E+01
2.017424E+02
1.172238E+01
3.139127E+01
5.231699E+01
5.870469E+02
3.259142E+01
2.336719E+02
1.040924E+01
2.432332E+01
5.709679E+01
6.978668E+02

View file

@ -6,4 +6,16 @@
<scores>flux</scores>
</tally>
</tallies>
<tally id="2">
<filter type="cell" bins="21 22 23 27 28 29" />
<scores>flux</scores>
<estimator>analog</estimator>
</tally>
<tally id="3">
<filter type="cell" bins="21 22 23 27 28 29" />
<scores>flux</scores>
<estimator>collision</estimator>
</tally>
</tallies>

View file

@ -446,3 +446,869 @@ tally 2:
1.093913E-01
2.235961E-01
5.449263E-02
tally 3:
3.077754E+01
2.017424E+02
-4.040800E-01
5.606719E-01
-5.238239E-01
4.460714E-01
1.155164E-01
1.686786E-01
-1.972294E-01
2.912851E-01
4.908524E-01
1.374195E-01
-1.467088E-02
1.080839E-01
6.749037E-02
1.397361E-01
4.136479E-03
9.237632E-02
-3.742305E-01
9.917374E-02
5.374208E-01
2.530961E-01
2.270996E-01
9.415721E-02
-4.568867E-02
1.277446E-01
1.581716E-01
6.217155E-02
4.667840E-01
1.143380E-01
9.684270E-02
7.302998E-02
8.366629E-01
1.797483E-01
-5.657893E-01
2.553910E-01
-2.351441E-02
4.395513E-02
7.843306E-01
1.466478E-01
4.617856E-02
1.154681E-02
1.431343E-01
3.531062E-02
4.625825E-01
6.235642E-02
-8.837342E-02
6.231694E-02
-3.766755E-01
6.412261E-02
1.995226E-01
1.743990E-01
-2.498625E-02
8.897536E-02
-1.039315E-01
1.868672E-01
6.712910E-01
2.084042E-01
5.805639E-02
4.049580E-02
1.603677E-01
4.280033E-02
3.909878E-01
7.726018E-02
9.878354E-02
4.630595E-02
-2.389983E-01
3.528604E-02
1.641046E-01
1.669859E-01
-2.351986E-02
1.048794E-02
1.172238E+01
3.139127E+01
-1.057733E+00
2.820672E-01
5.708838E-02
6.224675E-02
2.492981E-02
1.827498E-01
-1.339268E-01
1.968929E-02
2.363867E-01
3.028587E-02
-2.867841E-01
2.680318E-02
-2.352784E-01
1.895006E-02
4.365572E-01
1.883240E-01
-3.388837E-01
7.209932E-02
3.488374E-01
6.640137E-02
-3.343893E-01
4.149634E-02
-4.575314E-01
7.461614E-02
4.436881E-01
1.325092E-01
3.394853E-01
2.987173E-02
-2.633936E-02
6.171428E-02
9.994191E-02
6.447641E-02
-1.618840E-01
3.497845E-02
-1.290678E-01
3.735394E-02
9.852126E-03
2.963925E-02
-1.656539E-01
4.190396E-02
-2.292763E-01
7.045480E-02
-4.616824E-03
1.926690E-02
-1.960839E-01
1.396042E-02
-2.133526E-02
5.189823E-02
2.933136E-01
5.721356E-02
-1.084914E-01
2.448532E-02
-4.778583E-01
7.644033E-02
1.736901E-01
6.630467E-02
-5.460801E-02
1.510381E-02
1.106093E-01
1.590306E-02
1.659501E-01
5.983218E-02
1.343781E-02
2.751294E-02
2.052693E-01
3.478581E-02
-1.006298E-01
1.815313E-02
-2.563766E-01
3.045246E-02
5.231699E+01
5.870469E+02
-6.102587E-01
5.930968E-01
1.184182E+00
1.364433E+00
-6.362263E-02
8.852514E-01
-4.844978E-01
1.751923E-01
8.223413E-01
2.436206E-01
-9.656506E-01
3.513566E-01
2.710494E-01
7.170772E-01
4.792482E-01
2.551569E-01
-1.266077E-01
2.824778E-01
6.389964E-01
2.501483E-01
8.915816E-01
3.557431E-01
-1.007448E+00
5.743018E-01
3.528444E-01
2.428078E-01
-5.833000E-01
3.733648E-01
-4.660289E-01
6.567263E-02
5.856088E-01
2.336146E-01
3.836351E-02
7.665403E-02
-6.721211E-01
2.651780E-01
5.725993E-01
2.101026E-01
-2.130594E-01
1.855350E-02
2.607168E-01
1.564288E-01
-3.399382E-02
3.067656E-02
-1.228976E+00
6.554836E-01
-2.962235E-01
1.808511E-01
5.521675E-01
1.722073E-01
-1.658751E-01
1.994119E-02
-2.671896E-01
1.343320E-01
-2.325282E-01
4.677656E-02
-3.380310E-01
1.703532E-01
-3.571853E-01
1.140525E-01
3.836770E-02
8.586429E-02
7.328263E-01
1.567227E-01
4.840110E-02
2.718471E-02
5.654783E-01
3.645579E-01
-3.027585E-01
1.407867E-01
3.259142E+01
2.336719E+02
3.053294E-01
2.086257E-01
-7.563597E-01
2.816768E-01
-3.039288E-01
2.855043E-01
-2.648323E-01
1.883784E-01
2.665933E-01
1.782353E-01
1.978960E-01
1.419567E-01
1.228712E-01
1.913946E-01
-9.152681E-03
1.324681E-01
-5.707326E-01
1.092067E-01
2.326858E-01
6.731743E-02
-5.170241E-01
1.353439E-01
-4.064026E-01
9.715030E-02
-1.142031E-01
7.748788E-02
2.928039E-01
2.716157E-01
-1.721186E-01
1.447738E-01
6.452116E-01
1.821975E-01
-5.697276E-01
1.047333E-01
-9.640967E-02
1.139327E-01
-4.509832E-01
2.079493E-01
-2.134684E-02
2.907667E-01
-2.434868E-01
1.235397E-01
2.550330E-01
2.979627E-01
9.598615E-01
3.140885E-01
1.218430E-01
6.283872E-02
2.412915E-01
1.907292E-02
-2.236667E-01
4.379414E-02
2.844474E-01
2.965692E-02
1.618860E-01
8.293785E-03
-1.265583E-01
4.515449E-02
6.356127E-02
1.358134E-02
-3.844886E-01
8.600010E-02
-1.942739E-01
7.516022E-02
1.765511E-01
3.522611E-02
-3.433188E-01
3.456066E-02
-1.501983E-01
5.633844E-02
1.040924E+01
2.432332E+01
-4.138270E-01
1.309129E-01
-3.151106E-01
1.286964E-01
9.213222E-02
6.189454E-02
-2.746107E-01
8.103949E-02
-9.781742E-02
3.783736E-02
-1.178371E-01
3.242332E-02
-5.837932E-01
2.059491E-01
-7.338223E-03
8.012203E-02
5.628994E-02
2.190669E-02
8.155585E-02
1.039007E-01
6.052048E-02
4.339463E-02
-1.157646E-02
1.839000E-02
-2.641673E-01
4.737589E-02
-8.531135E-02
5.432766E-02
6.036555E-01
1.190329E-01
-3.149976E-01
5.735264E-02
-8.456340E-02
4.563143E-03
2.224065E-01
6.600030E-02
9.562392E-03
1.843524E-02
-2.400599E-01
3.182217E-02
-6.534941E-01
1.180315E-01
4.371157E-01
9.076666E-02
3.257455E-02
2.936184E-02
-8.788428E-02
1.923293E-02
-2.604776E-01
3.660313E-02
-6.315350E-02
1.503534E-02
5.609294E-01
8.783528E-02
-7.363672E-01
1.789210E-01
2.883575E-01
6.478578E-02
-3.302954E-02
1.517946E-02
-3.234157E-01
4.418920E-02
2.846318E-01
2.712085E-02
-3.227536E-01
5.062832E-02
4.391474E-01
5.548002E-02
1.322988E-01
2.995854E-02
5.709679E+01
6.978668E+02
2.859201E-02
1.094507E+00
6.058587E-01
6.079927E-01
7.553798E-02
1.131607E+00
-5.851206E-01
1.215663E+00
8.266012E-02
9.031287E-01
-7.088368E-01
3.984608E-01
-4.414986E-01
1.502417E-01
2.241998E-01
3.228823E-01
-7.328574E-01
2.430448E-01
-8.070160E-01
1.767265E-01
-1.154449E-01
8.739303E-03
-3.787161E-01
4.728756E-01
-1.743577E-01
1.091245E-01
2.878137E-01
2.724285E-01
2.128994E-01
4.440539E-01
9.495567E-01
3.622719E-01
1.422950E-01
5.309223E-02
1.323659E-01
1.911979E-01
-1.303752E-01
5.710728E-01
-4.611294E-02
4.086632E-02
5.937879E-01
1.006156E-01
-3.558925E-01
2.998983E-01
1.175971E+00
5.323321E-01
2.426485E-01
1.497265E-01
7.805090E-02
5.060214E-02
-2.914577E-01
2.233355E-01
1.053098E-01
6.693123E-02
4.541315E-01
1.328340E-01
-6.290732E-02
8.910616E-02
7.371592E-01
1.980732E-01
5.804701E-01
1.711949E-01
-6.642202E-01
1.131866E-01
1.779818E-01
6.530190E-02
-5.224739E-01
2.534102E-01
-1.824905E-01
2.910309E-02
tally 4:
3.077754E+01
2.017424E+02
-4.040800E-01
5.606719E-01
-5.238239E-01
4.460714E-01
1.155164E-01
1.686786E-01
-1.972294E-01
2.912851E-01
4.908524E-01
1.374195E-01
-1.467088E-02
1.080839E-01
6.749037E-02
1.397361E-01
4.136479E-03
9.237632E-02
-3.742305E-01
9.917374E-02
5.374208E-01
2.530961E-01
2.270996E-01
9.415721E-02
-4.568867E-02
1.277446E-01
1.581716E-01
6.217155E-02
4.667840E-01
1.143380E-01
9.684270E-02
7.302998E-02
8.366629E-01
1.797483E-01
-5.657893E-01
2.553910E-01
-2.351441E-02
4.395513E-02
7.843306E-01
1.466478E-01
4.617856E-02
1.154681E-02
1.431343E-01
3.531062E-02
4.625825E-01
6.235642E-02
-8.837342E-02
6.231694E-02
-3.766755E-01
6.412261E-02
1.995226E-01
1.743990E-01
-2.498625E-02
8.897536E-02
-1.039315E-01
1.868672E-01
6.712910E-01
2.084042E-01
5.805639E-02
4.049580E-02
1.603677E-01
4.280033E-02
3.909878E-01
7.726018E-02
9.878354E-02
4.630595E-02
-2.389983E-01
3.528604E-02
1.641046E-01
1.669859E-01
-2.351986E-02
1.048794E-02
1.172238E+01
3.139127E+01
-1.057733E+00
2.820672E-01
5.708838E-02
6.224675E-02
2.492981E-02
1.827498E-01
-1.339268E-01
1.968929E-02
2.363867E-01
3.028587E-02
-2.867841E-01
2.680318E-02
-2.352784E-01
1.895006E-02
4.365572E-01
1.883240E-01
-3.388837E-01
7.209932E-02
3.488374E-01
6.640137E-02
-3.343893E-01
4.149634E-02
-4.575314E-01
7.461614E-02
4.436881E-01
1.325092E-01
3.394853E-01
2.987173E-02
-2.633936E-02
6.171428E-02
9.994191E-02
6.447641E-02
-1.618840E-01
3.497845E-02
-1.290678E-01
3.735394E-02
9.852126E-03
2.963925E-02
-1.656539E-01
4.190396E-02
-2.292763E-01
7.045480E-02
-4.616824E-03
1.926690E-02
-1.960839E-01
1.396042E-02
-2.133526E-02
5.189823E-02
2.933136E-01
5.721356E-02
-1.084914E-01
2.448532E-02
-4.778583E-01
7.644033E-02
1.736901E-01
6.630467E-02
-5.460801E-02
1.510381E-02
1.106093E-01
1.590306E-02
1.659501E-01
5.983218E-02
1.343781E-02
2.751294E-02
2.052693E-01
3.478581E-02
-1.006298E-01
1.815313E-02
-2.563766E-01
3.045246E-02
5.231699E+01
5.870469E+02
-6.102587E-01
5.930968E-01
1.184182E+00
1.364433E+00
-6.362263E-02
8.852514E-01
-4.844978E-01
1.751923E-01
8.223413E-01
2.436206E-01
-9.656506E-01
3.513566E-01
2.710494E-01
7.170772E-01
4.792482E-01
2.551569E-01
-1.266077E-01
2.824778E-01
6.389964E-01
2.501483E-01
8.915816E-01
3.557431E-01
-1.007448E+00
5.743018E-01
3.528444E-01
2.428078E-01
-5.833000E-01
3.733648E-01
-4.660289E-01
6.567263E-02
5.856088E-01
2.336146E-01
3.836351E-02
7.665403E-02
-6.721211E-01
2.651780E-01
5.725993E-01
2.101026E-01
-2.130594E-01
1.855350E-02
2.607168E-01
1.564288E-01
-3.399382E-02
3.067656E-02
-1.228976E+00
6.554836E-01
-2.962235E-01
1.808511E-01
5.521675E-01
1.722073E-01
-1.658751E-01
1.994119E-02
-2.671896E-01
1.343320E-01
-2.325282E-01
4.677656E-02
-3.380310E-01
1.703532E-01
-3.571853E-01
1.140525E-01
3.836770E-02
8.586429E-02
7.328263E-01
1.567227E-01
4.840110E-02
2.718471E-02
5.654783E-01
3.645579E-01
-3.027585E-01
1.407867E-01
3.259142E+01
2.336719E+02
3.053294E-01
2.086257E-01
-7.563597E-01
2.816768E-01
-3.039288E-01
2.855043E-01
-2.648323E-01
1.883784E-01
2.665933E-01
1.782353E-01
1.978960E-01
1.419567E-01
1.228712E-01
1.913946E-01
-9.152681E-03
1.324681E-01
-5.707326E-01
1.092067E-01
2.326858E-01
6.731743E-02
-5.170241E-01
1.353439E-01
-4.064026E-01
9.715030E-02
-1.142031E-01
7.748788E-02
2.928039E-01
2.716157E-01
-1.721186E-01
1.447738E-01
6.452116E-01
1.821975E-01
-5.697276E-01
1.047333E-01
-9.640967E-02
1.139327E-01
-4.509832E-01
2.079493E-01
-2.134684E-02
2.907667E-01
-2.434868E-01
1.235397E-01
2.550330E-01
2.979627E-01
9.598615E-01
3.140885E-01
1.218430E-01
6.283872E-02
2.412915E-01
1.907292E-02
-2.236667E-01
4.379414E-02
2.844474E-01
2.965692E-02
1.618860E-01
8.293785E-03
-1.265583E-01
4.515449E-02
6.356127E-02
1.358134E-02
-3.844886E-01
8.600010E-02
-1.942739E-01
7.516022E-02
1.765511E-01
3.522611E-02
-3.433188E-01
3.456066E-02
-1.501983E-01
5.633844E-02
1.040924E+01
2.432332E+01
-4.138270E-01
1.309129E-01
-3.151106E-01
1.286964E-01
9.213222E-02
6.189454E-02
-2.746107E-01
8.103949E-02
-9.781742E-02
3.783736E-02
-1.178371E-01
3.242332E-02
-5.837932E-01
2.059491E-01
-7.338223E-03
8.012203E-02
5.628994E-02
2.190669E-02
8.155585E-02
1.039007E-01
6.052048E-02
4.339463E-02
-1.157646E-02
1.839000E-02
-2.641673E-01
4.737589E-02
-8.531135E-02
5.432766E-02
6.036555E-01
1.190329E-01
-3.149976E-01
5.735264E-02
-8.456340E-02
4.563143E-03
2.224065E-01
6.600030E-02
9.562392E-03
1.843524E-02
-2.400599E-01
3.182217E-02
-6.534941E-01
1.180315E-01
4.371157E-01
9.076666E-02
3.257455E-02
2.936184E-02
-8.788428E-02
1.923293E-02
-2.604776E-01
3.660313E-02
-6.315350E-02
1.503534E-02
5.609294E-01
8.783528E-02
-7.363672E-01
1.789210E-01
2.883575E-01
6.478578E-02
-3.302954E-02
1.517946E-02
-3.234157E-01
4.418920E-02
2.846318E-01
2.712085E-02
-3.227536E-01
5.062832E-02
4.391474E-01
5.548002E-02
1.322988E-01
2.995854E-02
5.709679E+01
6.978668E+02
2.859201E-02
1.094507E+00
6.058587E-01
6.079927E-01
7.553798E-02
1.131607E+00
-5.851206E-01
1.215663E+00
8.266012E-02
9.031287E-01
-7.088368E-01
3.984608E-01
-4.414986E-01
1.502417E-01
2.241998E-01
3.228823E-01
-7.328574E-01
2.430448E-01
-8.070160E-01
1.767265E-01
-1.154449E-01
8.739303E-03
-3.787161E-01
4.728756E-01
-1.743577E-01
1.091245E-01
2.878137E-01
2.724285E-01
2.128994E-01
4.440539E-01
9.495567E-01
3.622719E-01
1.422950E-01
5.309223E-02
1.323659E-01
1.911979E-01
-1.303752E-01
5.710728E-01
-4.611294E-02
4.086632E-02
5.937879E-01
1.006156E-01
-3.558925E-01
2.998983E-01
1.175971E+00
5.323321E-01
2.426485E-01
1.497265E-01
7.805090E-02
5.060214E-02
-2.914577E-01
2.233355E-01
1.053098E-01
6.693123E-02
4.541315E-01
1.328340E-01
-6.290732E-02
8.910616E-02
7.371592E-01
1.980732E-01
5.804701E-01
1.711949E-01
-6.642202E-01
1.131866E-01
1.779818E-01
6.530190E-02
-5.224739E-01
2.534102E-01
-1.824905E-01
2.910309E-02

View file

@ -10,5 +10,17 @@
<filter type="cell" bins="21 22 23 27 28 29" />
<scores>flux-y5</scores>
</tally>
<tally id="3">
<filter type="cell" bins="21 22 23 27 28 29" />
<scores>flux-y5</scores>
<estimator>analog</estimator>
</tally>
<tally id="4">
<filter type="cell" bins="21 22 23 27 28 29" />
<scores>flux-y5</scores>
<estimator>collision</estimator>
</tally>
</tallies>

View file

@ -9,3 +9,21 @@ tally 1:
0.000000E+00
2.035912E+02
8.999693E+03
tally 2:
1.765331E+02
6.974050E+03
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
1.938441E+02
7.888708E+03
tally 3:
1.770125E+02
6.702714E+03
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
1.942246E+02
8.416720E+03

View file

@ -6,4 +6,16 @@
<scores>kappa-fission</scores>
</tally>
</tallies>
<tally id="2">
<filter type="cell" bins="21 22 23 27" />
<scores>kappa-fission</scores>
<estimator>analog</estimator>
</tally>
<tally id="3">
<filter type="cell" bins="21 22 23 27" />
<scores>kappa-fission</scores>
<estimator>collision</estimator>
</tally>
</tallies>

View file

@ -9,3 +9,21 @@ tally 1:
0.000000E+00
2.733038E+00
1.616903E+00
tally 2:
2.296157E+00
1.167084E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
2.679940E+00
1.498454E+00
tally 3:
2.381373E+00
1.213497E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
2.607077E+00
1.513932E+00

View file

@ -6,4 +6,16 @@
<scores>nu-fission</scores>
</tally>
</tallies>
<tally id="2">
<filter type="cell" bins="21 22 23 27" />
<scores>nu-fission</scores>
<estimator>analog</estimator>
</tally>
<tally id="3">
<filter type="cell" bins="21 22 23 27" />
<scores>nu-fission</scores>
<estimator>collision</estimator>
</tally>
</tallies>

View file

@ -9,3 +9,21 @@ tally 1:
1.814004E+00
4.059013E+01
3.609499E+02
tally 2:
0.000000E+00
0.000000E+00
1.169000E+01
2.915330E+01
3.200000E+00
2.342600E+00
4.064000E+01
3.595168E+02
tally 3:
0.000000E+00
0.000000E+00
1.172929E+01
2.935812E+01
3.185726E+00
2.323517E+00
4.074319E+01
3.614902E+02

View file

@ -6,4 +6,16 @@
<scores>scatter</scores>
</tally>
</tallies>
<tally id="2">
<filter type="cell" bins="10 21 22 23" />
<scores>scatter</scores>
<estimator>analog</estimator>
</tally>
<tally id="3">
<filter type="cell" bins="10 21 22 23" />
<scores>scatter</scores>
<estimator>collision</estimator>
</tally>
</tallies>

View file

@ -9,3 +9,21 @@ tally 1:
1.831649E+00
4.088282E+01
3.662539E+02
tally 2:
0.000000E+00
0.000000E+00
1.372000E+01
4.018980E+01
3.200000E+00
2.342600E+00
4.104000E+01
3.668254E+02
tally 3:
0.000000E+00
0.000000E+00
1.372000E+01
4.018980E+01
3.200000E+00
2.342600E+00
4.104000E+01
3.668254E+02

View file

@ -6,4 +6,16 @@
<scores>total</scores>
</tally>
</tallies>
<tally id="2">
<filter type="cell" bins="10 21 22 23" />
<scores>total</scores>
<estimator>analog</estimator>
</tally>
<tally id="3">
<filter type="cell" bins="10 21 22 23" />
<scores>total</scores>
<estimator>collision</estimator>
</tally>
</tallies>

View file

@ -410,3 +410,805 @@ tally 2:
3.130205E-02
-3.695818E-01
4.703480E-02
tally 3:
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
7.200000E-01
1.152000E-01
-9.800486E-03
5.637123E-04
-2.018554E-02
4.617738E-04
-6.271657E-03
8.252833E-04
-8.231683E-03
3.035447E-03
-2.566508E-02
1.108829E-03
2.748466E-03
1.641191E-03
6.833190E-03
5.993876E-04
3.392213E-02
2.143714E-03
3.105616E-02
1.012625E-03
-5.473567E-02
1.615531E-03
-1.435523E-02
1.095690E-03
4.579564E-03
6.451444E-04
-1.570409E-02
3.833387E-04
1.633422E-02
2.144997E-03
-7.438775E-03
6.441846E-04
5.440025E-04
1.290719E-04
-1.687899E-02
1.606230E-03
3.315902E-02
1.061759E-03
-1.184684E-02
4.312573E-04
-4.732586E-02
1.387994E-03
-1.563538E-02
3.316015E-04
3.681927E-02
5.403320E-04
2.928507E-03
5.761742E-04
-3.519362E-02
6.725185E-04
1.372000E+01
4.018980E+01
-2.015212E-01
1.072884E-01
-2.606953E-01
4.894468E-02
7.537153E-02
2.216346E-02
-3.818524E-02
6.301675E-02
2.386335E-01
1.931104E-02
-1.872805E-02
1.265896E-02
3.732943E-02
2.347696E-02
-8.857050E-02
1.636275E-02
-1.718450E-01
1.043488E-02
1.526226E-01
2.435399E-02
7.344765E-02
1.541644E-02
-9.819186E-03
1.473467E-02
-8.215914E-03
1.463085E-02
2.197504E-01
2.244815E-02
2.521002E-02
8.206540E-03
3.677974E-01
3.982027E-02
-1.934606E-01
3.440019E-02
1.050141E-01
2.346980E-02
2.458487E-01
1.861429E-02
4.226131E-02
2.690841E-03
3.174234E-02
1.867018E-02
2.284995E-01
1.190246E-02
-7.894573E-03
3.715471E-03
-1.593928E-01
1.391828E-02
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
3.200000E+00
2.342600E+00
-2.991985E-01
1.868406E-02
4.460301E-02
4.132113E-03
-2.190630E-02
1.023889E-02
-3.265764E-02
2.060374E-03
3.491521E-02
4.785957E-04
-3.623623E-02
5.929111E-04
-4.962268E-02
1.814245E-03
1.406439E-01
1.174445E-02
-9.433277E-02
5.036897E-03
9.058176E-02
3.871598E-03
-1.409089E-01
6.665385E-03
-1.062337E-01
4.771650E-03
1.155280E-01
8.020320E-03
8.348336E-02
1.633941E-03
1.475434E-02
3.411046E-03
4.474425E-03
6.049348E-03
6.716359E-03
2.898000E-03
-3.674047E-02
2.971797E-03
-2.368070E-02
9.474965E-04
-6.109826E-02
4.846201E-03
-5.076118E-02
8.354393E-03
-1.763594E-02
1.017310E-03
-2.941064E-02
1.044916E-03
-5.631429E-03
3.915186E-03
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
4.104000E+01
3.668254E+02
-7.832373E-01
3.913941E-01
2.281642E-01
2.669856E-01
-3.731272E-01
6.152809E-01
-3.232973E-01
7.526283E-02
3.686513E-01
9.047618E-02
-6.018185E-01
9.140623E-02
3.848843E-01
3.431711E-01
3.397425E-03
8.879103E-02
-2.471531E-02
5.561795E-02
1.373897E-01
7.288680E-02
1.816888E-01
5.419638E-02
-3.504404E-01
1.461853E-01
1.225356E-01
3.443595E-02
-3.109887E-01
5.492397E-02
-3.542105E-01
6.530224E-02
2.104218E-01
4.093872E-02
2.661467E-02
3.058847E-02
-3.744331E-01
6.755739E-02
1.391218E-01
4.432842E-02
1.622041E-01
6.843992E-03
4.149973E-02
1.782398E-02
2.551752E-01
2.626972E-02
-4.706697E-01
9.193926E-02
-1.287882E-01
3.489982E-02
tally 4:
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
7.652157E-01
1.242826E-01
-1.008373E-02
5.281691E-04
-1.014715E-02
2.749212E-04
-2.506414E-02
2.613512E-04
4.320187E-03
4.316562E-04
1.439246E-02
9.138575E-05
-1.532539E-02
2.360878E-04
9.963404E-03
1.511695E-04
-6.314554E-03
2.742799E-05
7.969329E-03
1.380329E-04
-1.298431E-03
3.287236E-04
1.441639E-02
1.409552E-04
6.516689E-03
2.511011E-04
1.294596E-02
2.249729E-04
6.983038E-03
6.334969E-05
-1.086161E-02
1.140033E-04
2.217006E-02
4.221807E-04
-6.503276E-03
2.028281E-04
2.915180E-02
3.659182E-04
-9.080091E-03
1.503808E-04
-6.476980E-04
1.927326E-04
-1.549603E-02
3.445843E-04
2.957508E-02
1.835035E-04
6.982790E-03
1.237342E-04
-2.653281E-02
2.606704E-04
1.372000E+01
4.018980E+01
-2.015212E-01
1.072884E-01
-2.606953E-01
4.894468E-02
7.537153E-02
2.216346E-02
-3.818524E-02
6.301675E-02
2.386335E-01
1.931104E-02
-1.872805E-02
1.265896E-02
3.732943E-02
2.347696E-02
-8.857050E-02
1.636275E-02
-1.718450E-01
1.043488E-02
1.526226E-01
2.435399E-02
7.344765E-02
1.541644E-02
-9.819186E-03
1.473467E-02
-8.215914E-03
1.463085E-02
2.197504E-01
2.244815E-02
2.521002E-02
8.206540E-03
3.677974E-01
3.982027E-02
-1.934606E-01
3.440019E-02
1.050141E-01
2.346980E-02
2.458487E-01
1.861429E-02
4.226131E-02
2.690841E-03
3.174234E-02
1.867018E-02
2.284995E-01
1.190246E-02
-7.894573E-03
3.715471E-03
-1.593928E-01
1.391828E-02
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
3.200000E+00
2.342600E+00
-2.991985E-01
1.868406E-02
4.460301E-02
4.132113E-03
-2.190630E-02
1.023889E-02
-3.265764E-02
2.060374E-03
3.491521E-02
4.785957E-04
-3.623623E-02
5.929111E-04
-4.962268E-02
1.814245E-03
1.406439E-01
1.174445E-02
-9.433277E-02
5.036897E-03
9.058176E-02
3.871598E-03
-1.409089E-01
6.665385E-03
-1.062337E-01
4.771650E-03
1.155280E-01
8.020320E-03
8.348336E-02
1.633941E-03
1.475434E-02
3.411046E-03
4.474425E-03
6.049348E-03
6.716359E-03
2.898000E-03
-3.674047E-02
2.971797E-03
-2.368070E-02
9.474965E-04
-6.109826E-02
4.846201E-03
-5.076118E-02
8.354393E-03
-1.763594E-02
1.017310E-03
-2.941064E-02
1.044916E-03
-5.631429E-03
3.915186E-03
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
4.104000E+01
3.668254E+02
-7.832373E-01
3.913941E-01
2.281642E-01
2.669856E-01
-3.731272E-01
6.152809E-01
-3.232973E-01
7.526283E-02
3.686513E-01
9.047618E-02
-6.018185E-01
9.140623E-02
3.848843E-01
3.431711E-01
3.397425E-03
8.879103E-02
-2.471531E-02
5.561795E-02
1.373897E-01
7.288680E-02
1.816888E-01
5.419638E-02
-3.504404E-01
1.461853E-01
1.225356E-01
3.443595E-02
-3.109887E-01
5.492397E-02
-3.542105E-01
6.530224E-02
2.104218E-01
4.093872E-02
2.661467E-02
3.058847E-02
-3.744331E-01
6.755739E-02
1.391218E-01
4.432842E-02
1.622041E-01
6.843992E-03
4.149973E-02
1.782398E-02
2.551752E-01
2.626972E-02
-4.706697E-01
9.193926E-02
-1.287882E-01
3.489982E-02

View file

@ -11,5 +11,19 @@
<scores>total-y4</scores>
<nuclides>U-235 total</nuclides>
</tally>
<tally id="3">
<filter type="cell" bins="10 21 22 23" />
<scores>total-y4</scores>
<nuclides>U-235 total</nuclides>
<estimator>analog</estimator>
</tally>
<tally id="4">
<filter type="cell" bins="10 21 22 23" />
<scores>total-y4</scores>
<nuclides>U-235 total</nuclides>
<estimator>collision</estimator>
</tally>
</tallies>

View file

@ -21,14 +21,12 @@ class SourcepointTestHarness(TestHarness):
# Read the statepoint file.
statepoint = glob.glob(os.path.join(os.getcwd(), self._sp_name))[0]
sp = StatePoint(statepoint)
sp.read_results()
sp.read_source()
# Get the eigenvalue information.
outstr = TestHarness._get_results(self)
# Add the source information.
xyz = sp._source[0]._xyz
xyz = sp.source[0]['xyz']
outstr += ' '.join(['{0:12.6E}'.format(x) for x in xyz])
outstr += "\n"

View file

@ -21,14 +21,12 @@ class SourcepointTestHarness(TestHarness):
# Read the statepoint file.
statepoint = glob.glob(os.path.join(os.getcwd(), self._sp_name))[0]
sp = StatePoint(statepoint)
sp.read_results()
sp.read_source()
# Get the eigenvalue information.
outstr = TestHarness._get_results(self)
# Add the source information.
xyz = sp._source[0]._xyz
xyz = sp.source[0]['xyz']
outstr += ' '.join(['{0:12.6E}'.format(x) for x in xyz])
outstr += "\n"

View file

@ -2,7 +2,7 @@
<tallies>
<mesh id="1">
<type>rectangular</type>
<type>regular</type>
<dimension>5 3 4</dimension>
<lower_left>-10. -5. 0.</lower_left>
<upper_right>10. 4. 9.</upper_right>
@ -20,4 +20,4 @@
<scores>fission absorption total flux</scores>
</tally>
</tallies>
</tallies>

View file

@ -2,7 +2,7 @@
<tallies>
<mesh id="1">
<type>rectangular</type>
<type>regular</type>
<dimension>5 3 4</dimension>
<lower_left>-10. -5. 0.</lower_left>
<upper_right>10. 4. 9.</upper_right>
@ -20,4 +20,4 @@
<scores>fission absorption total flux</scores>
</tally>
</tallies>
</tallies>

View file

@ -93,7 +93,6 @@ class TestHarness(object):
# Read the statepoint file.
statepoint = glob.glob(os.path.join(os.getcwd(), self._sp_name))[0]
sp = StatePoint(statepoint)
sp.read_results()
# Write out k-combined.
outstr = 'k-combined:\n'
@ -103,11 +102,11 @@ class TestHarness(object):
# Write out tally data.
if self._tallies:
tally_num = 1
for tally_ind in sp._tallies:
tally = sp._tallies[tally_ind]
results = np.zeros((tally._sum.size*2, ))
results[0::2] = tally._sum.ravel()
results[1::2] = tally._sum_sq.ravel()
for tally_ind in sp.tallies:
tally = sp.tallies[tally_ind]
results = np.zeros((tally.sum.size*2, ))
results[0::2] = tally.sum.ravel()
results[1::2] = tally.sum_sq.ravel()
results = ['{0:12.6E}'.format(x) for x in results]
outstr += 'tally ' + str(tally_num) + ':\n'
@ -204,26 +203,25 @@ class CMFDTestHarness(TestHarness):
# Read the statepoint file.
statepoint = glob.glob(os.path.join(os.getcwd(), self._sp_name))[0]
sp = StatePoint(statepoint)
sp.read_results()
# Write out the eigenvalue and tallies.
outstr = TestHarness._get_results(self)
# Write out CMFD data.
outstr += 'cmfd indices\n'
outstr += '\n'.join(['{0:12.6E}'.format(x) for x in sp._cmfd_indices])
outstr += '\n'.join(['{0:12.6E}'.format(x) for x in sp.cmfd_indices])
outstr += '\nk cmfd\n'
outstr += '\n'.join(['{0:12.6E}'.format(x) for x in sp._k_cmfd])
outstr += '\n'.join(['{0:12.6E}'.format(x) for x in sp.k_cmfd])
outstr += '\ncmfd entropy\n'
outstr += '\n'.join(['{0:12.6E}'.format(x) for x in sp._cmfd_entropy])
outstr += '\n'.join(['{0:12.6E}'.format(x) for x in sp.cmfd_entropy])
outstr += '\ncmfd balance\n'
outstr += '\n'.join(['{0:12.6E}'.format(x) for x in sp._cmfd_balance])
outstr += '\n'.join(['{0:12.6E}'.format(x) for x in sp.cmfd_balance])
outstr += '\ncmfd dominance ratio\n'
outstr += '\n'.join(['{0:10.3E}'.format(x) for x in sp._cmfd_dominance])
outstr += '\n'.join(['{0:10.3E}'.format(x) for x in sp.cmfd_dominance])
outstr += '\ncmfd openmc source comparison\n'
outstr += '\n'.join(['{0:12.6E}'.format(x) for x in sp._cmfd_srccmp])
outstr += '\n'.join(['{0:12.6E}'.format(x) for x in sp.cmfd_srccmp])
outstr += '\ncmfd source\n'
cmfdsrc = np.reshape(sp._cmfd_src, np.product(sp._cmfd_indices),
cmfdsrc = np.reshape(sp.cmfd_src, np.product(sp.cmfd_indices),
order='F')
outstr += '\n'.join(['{0:12.6E}'.format(x) for x in cmfdsrc])
outstr += '\n'
@ -256,7 +254,7 @@ class ParticleRestartTestHarness(TestHarness):
outstr += 'particle id:\n'
outstr += "{0:12.6E}\n".format(p.id)
outstr += 'run mode:\n'
outstr += "{0:12.6E}\n".format(p.run_mode)
outstr += "{0}\n".format(p.run_mode)
outstr += 'particle weight:\n'
outstr += "{0:12.6E}\n".format(p.weight)
outstr += 'particle energy:\n'