mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 14:15:42 -04:00
Merge remote-tracking branch 'upstream/develop' into distribcell-tally-sum
This commit is contained in:
commit
c0220b24e7
102 changed files with 3319 additions and 2166 deletions
|
|
@ -146,6 +146,8 @@
|
|||
"\n",
|
||||
"import openmc\n",
|
||||
"import openmc.mgxs as mgxs\n",
|
||||
"from openmc.source import Source\n",
|
||||
"from openmc.stats import Box\n",
|
||||
"\n",
|
||||
"%matplotlib inline"
|
||||
]
|
||||
|
|
@ -341,7 +343,8 @@
|
|||
"settings_file.particles = particles\n",
|
||||
"settings_file.output = {'tallies': True, 'summary': True}\n",
|
||||
"bounds = [-0.63, -0.63, -0.63, 0.63, 0.63, 0.63]\n",
|
||||
"settings_file.set_source_space('fission', bounds)\n",
|
||||
"settings_file.source = Source(space=Box(\n",
|
||||
" bounds[:3], bounds[3:], only_fissionable=True))\n",
|
||||
"\n",
|
||||
"# Export to \"settings.xml\"\n",
|
||||
"settings_file.export_to_xml()"
|
||||
|
|
@ -420,24 +423,22 @@
|
|||
"data": {
|
||||
"text/plain": [
|
||||
"OrderedDict([('flux', Tally\n",
|
||||
"\tID =\t10000\n",
|
||||
"\tName =\t\n",
|
||||
"\tFilters =\t\n",
|
||||
" \t\tcell\t[1]\n",
|
||||
" \t\tenergy\t[ 0.00000000e+00 6.25000000e-07 2.00000000e+01]\n",
|
||||
"\tNuclides =\ttotal \n",
|
||||
"\tScores =\t['flux']\n",
|
||||
"\tEstimator =\ttracklength\n",
|
||||
"), ('absorption', Tally\n",
|
||||
"\tID =\t10001\n",
|
||||
"\tName =\t\n",
|
||||
"\tFilters =\t\n",
|
||||
" \t\tcell\t[1]\n",
|
||||
" \t\tenergy\t[ 0.00000000e+00 6.25000000e-07 2.00000000e+01]\n",
|
||||
"\tNuclides =\ttotal \n",
|
||||
"\tScores =\t['absorption']\n",
|
||||
"\tEstimator =\ttracklength\n",
|
||||
")])"
|
||||
" \tID =\t10000\n",
|
||||
" \tName =\t\n",
|
||||
" \tFilters =\t\n",
|
||||
" \t\tcell\t[1]\n",
|
||||
" \t\tenergy\t[ 0.00000000e+00 6.25000000e-07 2.00000000e+01]\n",
|
||||
" \tNuclides =\ttotal \n",
|
||||
" \tScores =\t['flux']\n",
|
||||
" \tEstimator =\ttracklength), ('absorption', Tally\n",
|
||||
" \tID =\t10001\n",
|
||||
" \tName =\t\n",
|
||||
" \tFilters =\t\n",
|
||||
" \t\tcell\t[1]\n",
|
||||
" \t\tenergy\t[ 0.00000000e+00 6.25000000e-07 2.00000000e+01]\n",
|
||||
" \tNuclides =\ttotal \n",
|
||||
" \tScores =\t['absorption']\n",
|
||||
" \tEstimator =\ttracklength)])"
|
||||
]
|
||||
},
|
||||
"execution_count": 13,
|
||||
|
|
@ -516,10 +517,9 @@
|
|||
"\n",
|
||||
" Copyright: 2011-2015 Massachusetts Institute of Technology\n",
|
||||
" License: http://mit-crpg.github.io/openmc/license.html\n",
|
||||
" Version: 0.7.0\n",
|
||||
" Git SHA1: c4b14a5ef87f004528d35cbf33fef3ed15a386ca\n",
|
||||
" Date/Time: 2015-12-02 09:11:05\n",
|
||||
" MPI Processes: 1\n",
|
||||
" Version: 0.7.1\n",
|
||||
" Git SHA1: ea9fb637f63f9374c7436456141afa850b84acf9\n",
|
||||
" Date/Time: 2016-01-14 07:16:05\n",
|
||||
"\n",
|
||||
" ===========================================================================\n",
|
||||
" ========================> INITIALIZATION <=========================\n",
|
||||
|
|
@ -604,20 +604,20 @@
|
|||
"\n",
|
||||
" =======================> TIMING STATISTICS <=======================\n",
|
||||
"\n",
|
||||
" Total time for initialization = 4.1700E-01 seconds\n",
|
||||
" Reading cross sections = 8.9000E-02 seconds\n",
|
||||
" Total time in simulation = 1.4728E+01 seconds\n",
|
||||
" Time in transport only = 1.4712E+01 seconds\n",
|
||||
" Time in inactive batches = 1.7890E+00 seconds\n",
|
||||
" Time in active batches = 1.2939E+01 seconds\n",
|
||||
" Time synchronizing fission bank = 5.0000E-03 seconds\n",
|
||||
" Sampling source sites = 3.0000E-03 seconds\n",
|
||||
" SEND/RECV source sites = 2.0000E-03 seconds\n",
|
||||
" Time accumulating tallies = 1.0000E-03 seconds\n",
|
||||
" Total time for initialization = 1.1720E+00 seconds\n",
|
||||
" Reading cross sections = 9.0300E-01 seconds\n",
|
||||
" Total time in simulation = 1.7319E+01 seconds\n",
|
||||
" Time in transport only = 1.7310E+01 seconds\n",
|
||||
" Time in inactive batches = 1.9120E+00 seconds\n",
|
||||
" Time in active batches = 1.5407E+01 seconds\n",
|
||||
" Time synchronizing fission bank = 2.0000E-03 seconds\n",
|
||||
" Sampling source sites = 2.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.5155E+01 seconds\n",
|
||||
" Calculation Rate (inactive) = 13974.3 neutrons/second\n",
|
||||
" Calculation Rate (active) = 7728.57 neutrons/second\n",
|
||||
" Total time elapsed = 1.8507E+01 seconds\n",
|
||||
" Calculation Rate (inactive) = 13075.3 neutrons/second\n",
|
||||
" Calculation Rate (active) = 6490.56 neutrons/second\n",
|
||||
"\n",
|
||||
" ============================> RESULTS <============================\n",
|
||||
"\n",
|
||||
|
|
@ -779,7 +779,7 @@
|
|||
{
|
||||
"data": {
|
||||
"text/html": [
|
||||
"<div>\n",
|
||||
"<div style=\"max-height:1000px;max-width:1500px;overflow:auto;\">\n",
|
||||
"<table border=\"1\" class=\"dataframe\">\n",
|
||||
" <thead>\n",
|
||||
" <tr style=\"text-align: right;\">\n",
|
||||
|
|
@ -890,7 +890,7 @@
|
|||
{
|
||||
"data": {
|
||||
"text/html": [
|
||||
"<div>\n",
|
||||
"<div style=\"max-height:1000px;max-width:1500px;overflow:auto;\">\n",
|
||||
"<table border=\"1\" class=\"dataframe\">\n",
|
||||
" <thead>\n",
|
||||
" <tr style=\"text-align: right;\">\n",
|
||||
|
|
@ -966,7 +966,7 @@
|
|||
{
|
||||
"data": {
|
||||
"text/html": [
|
||||
"<div>\n",
|
||||
"<div style=\"max-height:1000px;max-width:1500px;overflow:auto;\">\n",
|
||||
"<table border=\"1\" class=\"dataframe\">\n",
|
||||
" <thead>\n",
|
||||
" <tr style=\"text-align: right;\">\n",
|
||||
|
|
@ -1035,7 +1035,7 @@
|
|||
{
|
||||
"data": {
|
||||
"text/html": [
|
||||
"<div>\n",
|
||||
"<div style=\"max-height:1000px;max-width:1500px;overflow:auto;\">\n",
|
||||
"<table border=\"1\" class=\"dataframe\">\n",
|
||||
" <thead>\n",
|
||||
" <tr style=\"text-align: right;\">\n",
|
||||
|
|
@ -1111,7 +1111,7 @@
|
|||
{
|
||||
"data": {
|
||||
"text/html": [
|
||||
"<div>\n",
|
||||
"<div style=\"max-height:1000px;max-width:1500px;overflow:auto;\">\n",
|
||||
"<table border=\"1\" class=\"dataframe\">\n",
|
||||
" <thead>\n",
|
||||
" <tr style=\"text-align: right;\">\n",
|
||||
|
|
@ -1187,7 +1187,7 @@
|
|||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython2",
|
||||
"version": "2.7.6"
|
||||
"version": "2.7.10"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -36,6 +36,8 @@
|
|||
"import openmc\n",
|
||||
"from openmc.statepoint import StatePoint\n",
|
||||
"from openmc.summary import Summary\n",
|
||||
"from openmc.source import Source\n",
|
||||
"from openmc.stats import Box\n",
|
||||
"\n",
|
||||
"%matplotlib inline"
|
||||
]
|
||||
|
|
@ -288,7 +290,8 @@
|
|||
"settings_file.particles = particles\n",
|
||||
"settings_file.output = {'tallies': True, 'summary': True}\n",
|
||||
"source_bounds = [-0.63, -0.63, -0.63, 0.63, 0.63, 0.63]\n",
|
||||
"settings_file.set_source_space('box', source_bounds)\n",
|
||||
"settings_file.source = Source(space=Box(\n",
|
||||
" source_bounds[:3], source_bounds[3:]))\n",
|
||||
"\n",
|
||||
"# Export to \"settings.xml\"\n",
|
||||
"settings_file.export_to_xml()"
|
||||
|
|
@ -363,26 +366,7 @@
|
|||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"image/png": [
|
||||
"iVBORw0KGgoAAAANSUhEUgAAAPoAAAD6AgMAAAD1grKuAAAABGdBTUEAALGPC/xhBQAAACBjSFJN\n",
|
||||
"AAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAADFBMVEX///9yEhLpgJFNv8Tq\n",
|
||||
"QYT7AAAAAWJLR0QAiAUdSAAAAAd0SU1FB98LGQ4UM+6dthcAAALKSURBVGje7dpLcqQwDAbgHHE2\n",
|
||||
"YeEj+D4cwQucBUfo+3CEXoSp8OhuhF70T4qpKXmdr21LogK2Pj7A8QmNP+HDhw8fPnz48Kf6VH9G\n",
|
||||
"+66vy+je8k19jnf8C5dXIPv86ms56lPdjvaYbyodx3ze+XLE76cXFiD4zPji99z0/AJ4n1lfvJ6f\n",
|
||||
"nl0A6x+578efMSg1wPr172/jPO5yFXM+Ef78gdblM+WPHyguP//t1/g6pA0wfln+ho/fwgYYn19C\n",
|
||||
"/xwDvwHGc9OvC+hs37DTrwuwfWanXxdQTC9Mvyygs3wjTL8uwPJpn/tNDbSGz7T0SBEWw4vLXzbQ\n",
|
||||
"6b6RoveIoO6TvPxlA63qs7z8ZQPF9F+SH22vbX8OQKf5Rtv+EgDNJ3X58wZaxWd1+fMGiuFvir8b\n",
|
||||
"vjp8J/tGy/6jAmRvhW8fwL3vVT+o3grfPoB7r/IpALI3tz8FoJN84/NV873hB8UnM3xzANtf8nb4\n",
|
||||
"dwmg3grfFEDJO8JPE0i9Ff4pAYL3pI8mkHor/HMCeO9JH00g9SafEsh7T/ppARBvp48UwJnelT5S\n",
|
||||
"ACd7O31TAlnvKx9SQCd7B58KgPO+8iMFuPWe9E8F8BveWX7bAjzX9y4//Jve+fhsH6Ctv7n8PTzj\n",
|
||||
"vY/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\n",
|
||||
"QBq+s+8f0ftP+P41axXguP9NWgDuu/Cdfv+N3r/D9/9TAID+A7T/Ae2/gPs/0P4TtP8F7r9J3AIO\n",
|
||||
"9P+g/Udw/9Oygbf7r9D+L7j/DO1/Q/vv4P4/tP8Q7n9E+y/h/k+0/xTuf4X7b+H+X7T/+BPuf3aM\n",
|
||||
"8OHDhw8fPnz4w/4vzcvgeY10sY0AAAAldEVYdGRhdGU6Y3JlYXRlADIwMTUtMTEtMjVUMTQ6MjA6\n",
|
||||
"NTEtMDg6MDDVsKLDAAAAJXRFWHRkYXRlOm1vZGlmeQAyMDE1LTExLTI1VDE0OjIwOjUxLTA4OjAw\n",
|
||||
"pO0afwAAAABJRU5ErkJggg==\n"
|
||||
],
|
||||
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAPoAAAD6AgMAAAD1grKuAAAABGdBTUEAALGPC/xhBQAAACBjSFJN\nAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAADFBMVEX///9yEhLpgJFNv8Tq\nQYT7AAAAAWJLR0QAiAUdSAAAAAd0SU1FB+ABDg0ADuhPUfUAAALKSURBVGje7dpLcqQwDAbgHHE2\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/4vzcvgeY10sY0AAAAldEVYdGRhdGU6Y3JlYXRlADIwMTYtMDEtMTRUMDc6MDA6\nMTQtMDY6MDA6WZzHAAAAJXRFWHRkYXRlOm1vZGlmeQAyMDE2LTAxLTE0VDA3OjAwOjE0LTA2OjAw\nSwQkewAAAABJRU5ErkJggg==\n",
|
||||
"text/plain": [
|
||||
"<IPython.core.display.Image object>"
|
||||
]
|
||||
|
|
@ -591,10 +575,9 @@
|
|||
"\n",
|
||||
" Copyright: 2011-2015 Massachusetts Institute of Technology\n",
|
||||
" License: http://mit-crpg.github.io/openmc/license.html\n",
|
||||
" Version: 0.7.0\n",
|
||||
" Git SHA1: 74ffcb447521c968fb64fdaa63e40598783f2fba\n",
|
||||
" Date/Time: 2015-11-25 14:20:51\n",
|
||||
" MPI Processes: 1\n",
|
||||
" Version: 0.7.1\n",
|
||||
" Git SHA1: ea9fb637f63f9374c7436456141afa850b84acf9\n",
|
||||
" Date/Time: 2016-01-14 07:00:14\n",
|
||||
"\n",
|
||||
" ===========================================================================\n",
|
||||
" ========================> INITIALIZATION <=========================\n",
|
||||
|
|
@ -634,13 +617,13 @@
|
|||
" 11/1 1.07867 1.05536 +/- 0.01277\n",
|
||||
" 12/1 1.04203 1.05345 +/- 0.01096\n",
|
||||
" 13/1 1.04482 1.05237 +/- 0.00955\n",
|
||||
" 14/1 1.04116 1.05113 +/- 0.00852\n",
|
||||
" 15/1 1.07569 1.05358 +/- 0.00800\n",
|
||||
" 16/1 1.04188 1.05252 +/- 0.00732\n",
|
||||
" 17/1 1.03775 1.05129 +/- 0.00679\n",
|
||||
" 18/1 0.98462 1.04616 +/- 0.00808\n",
|
||||
" 19/1 1.08613 1.04902 +/- 0.00801\n",
|
||||
" 20/1 1.00571 1.04613 +/- 0.00800\n",
|
||||
" 14/1 1.04117 1.05113 +/- 0.00852\n",
|
||||
" 15/1 1.07581 1.05360 +/- 0.00801\n",
|
||||
" 16/1 1.04235 1.05257 +/- 0.00731\n",
|
||||
" 17/1 1.02710 1.05045 +/- 0.00701\n",
|
||||
" 18/1 1.01970 1.04809 +/- 0.00687\n",
|
||||
" 19/1 1.01022 1.04538 +/- 0.00691\n",
|
||||
" 20/1 1.01449 1.04332 +/- 0.00675\n",
|
||||
" Creating state point statepoint.20.h5...\n",
|
||||
"\n",
|
||||
" ===========================================================================\n",
|
||||
|
|
@ -650,27 +633,27 @@
|
|||
"\n",
|
||||
" =======================> TIMING STATISTICS <=======================\n",
|
||||
"\n",
|
||||
" Total time for initialization = 7.9600E-01 seconds\n",
|
||||
" Reading cross sections = 2.1200E-01 seconds\n",
|
||||
" Total time in simulation = 1.8740E+01 seconds\n",
|
||||
" Time in transport only = 1.8727E+01 seconds\n",
|
||||
" Time in inactive batches = 2.5970E+00 seconds\n",
|
||||
" Time in active batches = 1.6143E+01 seconds\n",
|
||||
" Time synchronizing fission bank = 2.0000E-03 seconds\n",
|
||||
" Sampling source sites = 1.0000E-03 seconds\n",
|
||||
" Total time for initialization = 1.2510E+00 seconds\n",
|
||||
" Reading cross sections = 9.7600E-01 seconds\n",
|
||||
" Total time in simulation = 1.5844E+01 seconds\n",
|
||||
" Time in transport only = 1.5834E+01 seconds\n",
|
||||
" Time in inactive batches = 2.2840E+00 seconds\n",
|
||||
" Time in active batches = 1.3560E+01 seconds\n",
|
||||
" Time synchronizing fission bank = 3.0000E-03 seconds\n",
|
||||
" Sampling source sites = 2.0000E-03 seconds\n",
|
||||
" SEND/RECV source sites = 1.0000E-03 seconds\n",
|
||||
" Time accumulating tallies = 0.0000E+00 seconds\n",
|
||||
" Total time for finalization = 2.0000E-03 seconds\n",
|
||||
" Total time elapsed = 1.9553E+01 seconds\n",
|
||||
" Calculation Rate (inactive) = 4813.25 neutrons/second\n",
|
||||
" Calculation Rate (active) = 2322.99 neutrons/second\n",
|
||||
" Total time for finalization = 1.0000E-03 seconds\n",
|
||||
" Total time elapsed = 1.7110E+01 seconds\n",
|
||||
" Calculation Rate (inactive) = 5472.85 neutrons/second\n",
|
||||
" Calculation Rate (active) = 2765.49 neutrons/second\n",
|
||||
"\n",
|
||||
" ============================> RESULTS <============================\n",
|
||||
"\n",
|
||||
" k-effective (Collision) = 1.04597 +/- 0.00663\n",
|
||||
" k-effective (Track-length) = 1.04613 +/- 0.00800\n",
|
||||
" k-effective (Absorption) = 1.04087 +/- 0.00627\n",
|
||||
" Combined k-effective = 1.04322 +/- 0.00570\n",
|
||||
" k-effective (Collision) = 1.03935 +/- 0.00682\n",
|
||||
" k-effective (Track-length) = 1.04332 +/- 0.00675\n",
|
||||
" k-effective (Absorption) = 1.03845 +/- 0.00598\n",
|
||||
" Combined k-effective = 1.04024 +/- 0.00523\n",
|
||||
" Leakage Fraction = 0.00000 +/- 0.00000\n",
|
||||
"\n"
|
||||
]
|
||||
|
|
@ -775,10 +758,10 @@
|
|||
" <tbody>\n",
|
||||
" <tr>\n",
|
||||
" <th>0</th>\n",
|
||||
" <td> total</td>\n",
|
||||
" <td> (nu-fission / absorption)</td>\n",
|
||||
" <td> 1.040687</td>\n",
|
||||
" <td> 0.010913</td>\n",
|
||||
" <td>total</td>\n",
|
||||
" <td>(nu-fission / absorption)</td>\n",
|
||||
" <td>1.040166</td>\n",
|
||||
" <td>0.009069</td>\n",
|
||||
" </tr>\n",
|
||||
" </tbody>\n",
|
||||
"</table>\n",
|
||||
|
|
@ -786,7 +769,7 @@
|
|||
],
|
||||
"text/plain": [
|
||||
" nuclide score mean std. dev.\n",
|
||||
"0 total (nu-fission / absorption) 1.040687 0.010913"
|
||||
"0 total (nu-fission / absorption) 1.040166 0.009069"
|
||||
]
|
||||
},
|
||||
"execution_count": 26,
|
||||
|
|
@ -836,19 +819,19 @@
|
|||
" <tbody>\n",
|
||||
" <tr>\n",
|
||||
" <th>0</th>\n",
|
||||
" <td> (0.0e+00 - 6.2e-01)</td>\n",
|
||||
" <td> total</td>\n",
|
||||
" <td> absorption</td>\n",
|
||||
" <td> 0.959302</td>\n",
|
||||
" <td> 0.010033</td>\n",
|
||||
" <td>(0.0e+00 - 6.2e-01)</td>\n",
|
||||
" <td>total</td>\n",
|
||||
" <td>absorption</td>\n",
|
||||
" <td>0.95938</td>\n",
|
||||
" <td>0.008187</td>\n",
|
||||
" </tr>\n",
|
||||
" </tbody>\n",
|
||||
"</table>\n",
|
||||
"</div>"
|
||||
],
|
||||
"text/plain": [
|
||||
" energy [MeV] nuclide score mean std. dev.\n",
|
||||
"0 (0.0e+00 - 6.2e-01) total absorption 0.959302 0.010033"
|
||||
" energy [MeV] nuclide score mean std. dev.\n",
|
||||
"0 (0.0e+00 - 6.2e-01) total absorption 0.95938 0.008187"
|
||||
]
|
||||
},
|
||||
"execution_count": 27,
|
||||
|
|
@ -896,19 +879,19 @@
|
|||
" <tbody>\n",
|
||||
" <tr>\n",
|
||||
" <th>0</th>\n",
|
||||
" <td> (0.0e+00 - 6.2e-01)</td>\n",
|
||||
" <td> total</td>\n",
|
||||
" <td> nu-fission</td>\n",
|
||||
" <td> 1.09103</td>\n",
|
||||
" <td> 0.012491</td>\n",
|
||||
" <td>(0.0e+00 - 6.2e-01)</td>\n",
|
||||
" <td>total</td>\n",
|
||||
" <td>nu-fission</td>\n",
|
||||
" <td>1.090899</td>\n",
|
||||
" <td>0.010602</td>\n",
|
||||
" </tr>\n",
|
||||
" </tbody>\n",
|
||||
"</table>\n",
|
||||
"</div>"
|
||||
],
|
||||
"text/plain": [
|
||||
" energy [MeV] nuclide score mean std. dev.\n",
|
||||
"0 (0.0e+00 - 6.2e-01) total nu-fission 1.09103 0.012491"
|
||||
" energy [MeV] nuclide score mean std. dev.\n",
|
||||
"0 (0.0e+00 - 6.2e-01) total nu-fission 1.090899 0.010602"
|
||||
]
|
||||
},
|
||||
"execution_count": 28,
|
||||
|
|
@ -958,12 +941,12 @@
|
|||
" <tbody>\n",
|
||||
" <tr>\n",
|
||||
" <th>0</th>\n",
|
||||
" <td> (0.0e+00 - 6.2e-01)</td>\n",
|
||||
" <td> 10000</td>\n",
|
||||
" <td> total</td>\n",
|
||||
" <td> absorption</td>\n",
|
||||
" <td> 0.803182</td>\n",
|
||||
" <td> 0.008664</td>\n",
|
||||
" <td>(0.0e+00 - 6.2e-01)</td>\n",
|
||||
" <td>10000</td>\n",
|
||||
" <td>total</td>\n",
|
||||
" <td>absorption</td>\n",
|
||||
" <td>0.803413</td>\n",
|
||||
" <td>0.007031</td>\n",
|
||||
" </tr>\n",
|
||||
" </tbody>\n",
|
||||
"</table>\n",
|
||||
|
|
@ -971,7 +954,7 @@
|
|||
],
|
||||
"text/plain": [
|
||||
" energy [MeV] cell nuclide score mean std. dev.\n",
|
||||
"0 (0.0e+00 - 6.2e-01) 10000 total absorption 0.803182 0.008664"
|
||||
"0 (0.0e+00 - 6.2e-01) 10000 total absorption 0.803413 0.007031"
|
||||
]
|
||||
},
|
||||
"execution_count": 29,
|
||||
|
|
@ -1019,12 +1002,12 @@
|
|||
" <tbody>\n",
|
||||
" <tr>\n",
|
||||
" <th>0</th>\n",
|
||||
" <td> (0.0e+00 - 6.2e-01)</td>\n",
|
||||
" <td> 10000</td>\n",
|
||||
" <td> total</td>\n",
|
||||
" <td> (nu-fission / absorption)</td>\n",
|
||||
" <td> 1.237982</td>\n",
|
||||
" <td> 0.014179</td>\n",
|
||||
" <td>(0.0e+00 - 6.2e-01)</td>\n",
|
||||
" <td>10000</td>\n",
|
||||
" <td>total</td>\n",
|
||||
" <td>(nu-fission / absorption)</td>\n",
|
||||
" <td>1.237053</td>\n",
|
||||
" <td>0.011765</td>\n",
|
||||
" </tr>\n",
|
||||
" </tbody>\n",
|
||||
"</table>\n",
|
||||
|
|
@ -1032,10 +1015,10 @@
|
|||
],
|
||||
"text/plain": [
|
||||
" energy [MeV] cell nuclide score mean \\\n",
|
||||
"0 (0.0e+00 - 6.2e-01) 10000 total (nu-fission / absorption) 1.237982 \n",
|
||||
"0 (0.0e+00 - 6.2e-01) 10000 total (nu-fission / absorption) 1.237053 \n",
|
||||
"\n",
|
||||
" std. dev. \n",
|
||||
"0 0.014179 "
|
||||
"0 0.011765 "
|
||||
]
|
||||
},
|
||||
"execution_count": 30,
|
||||
|
|
@ -1082,12 +1065,12 @@
|
|||
" <tbody>\n",
|
||||
" <tr>\n",
|
||||
" <th>0</th>\n",
|
||||
" <td> (0.0e+00 - 6.2e-01)</td>\n",
|
||||
" <td> 10000</td>\n",
|
||||
" <td> total</td>\n",
|
||||
" <td> (((absorption * nu-fission) * absorption) * (n...</td>\n",
|
||||
" <td> 1.040687</td>\n",
|
||||
" <td> 0.022989</td>\n",
|
||||
" <td>(0.0e+00 - 6.2e-01)</td>\n",
|
||||
" <td>10000</td>\n",
|
||||
" <td>total</td>\n",
|
||||
" <td>(((absorption * nu-fission) * absorption) * (n...</td>\n",
|
||||
" <td>1.040166</td>\n",
|
||||
" <td>0.019018</td>\n",
|
||||
" </tr>\n",
|
||||
" </tbody>\n",
|
||||
"</table>\n",
|
||||
|
|
@ -1098,7 +1081,7 @@
|
|||
"0 (0.0e+00 - 6.2e-01) 10000 total \n",
|
||||
"\n",
|
||||
" score mean std. dev. \n",
|
||||
"0 (((absorption * nu-fission) * absorption) * (n... 1.040687 0.022989 "
|
||||
"0 (((absorption * nu-fission) * absorption) * (n... 1.040166 0.019018 "
|
||||
]
|
||||
},
|
||||
"execution_count": 31,
|
||||
|
|
@ -1162,75 +1145,75 @@
|
|||
" <tbody>\n",
|
||||
" <tr>\n",
|
||||
" <th>0</th>\n",
|
||||
" <td> 10000</td>\n",
|
||||
" <td> (0.0e+00 - 6.3e-07)</td>\n",
|
||||
" <td> (U-238 / total)</td>\n",
|
||||
" <td> (nu-fission / flux)</td>\n",
|
||||
" <td> 0.000001</td>\n",
|
||||
" <td> 8.078651e-09</td>\n",
|
||||
" <td>10000</td>\n",
|
||||
" <td>(0.0e+00 - 6.3e-07)</td>\n",
|
||||
" <td>(U-238 / total)</td>\n",
|
||||
" <td>(nu-fission / flux)</td>\n",
|
||||
" <td>0.000001</td>\n",
|
||||
" <td>7.377419e-09</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>1</th>\n",
|
||||
" <td> 10000</td>\n",
|
||||
" <td> (0.0e+00 - 6.3e-07)</td>\n",
|
||||
" <td> (U-238 / total)</td>\n",
|
||||
" <td> (scatter / flux)</td>\n",
|
||||
" <td> 0.209990</td>\n",
|
||||
" <td> 2.449396e-03</td>\n",
|
||||
" <td>10000</td>\n",
|
||||
" <td>(0.0e+00 - 6.3e-07)</td>\n",
|
||||
" <td>(U-238 / total)</td>\n",
|
||||
" <td>(scatter / flux)</td>\n",
|
||||
" <td>0.209989</td>\n",
|
||||
" <td>2.303838e-03</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>2</th>\n",
|
||||
" <td> 10000</td>\n",
|
||||
" <td> (0.0e+00 - 6.3e-07)</td>\n",
|
||||
" <td> (U-235 / total)</td>\n",
|
||||
" <td> (nu-fission / flux)</td>\n",
|
||||
" <td> 0.356117</td>\n",
|
||||
" <td> 4.364366e-03</td>\n",
|
||||
" <td>10000</td>\n",
|
||||
" <td>(0.0e+00 - 6.3e-07)</td>\n",
|
||||
" <td>(U-235 / total)</td>\n",
|
||||
" <td>(nu-fission / flux)</td>\n",
|
||||
" <td>0.356420</td>\n",
|
||||
" <td>3.951669e-03</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>3</th>\n",
|
||||
" <td> 10000</td>\n",
|
||||
" <td> (0.0e+00 - 6.3e-07)</td>\n",
|
||||
" <td> (U-235 / total)</td>\n",
|
||||
" <td> (scatter / flux)</td>\n",
|
||||
" <td> 0.005555</td>\n",
|
||||
" <td> 6.495710e-05</td>\n",
|
||||
" <td>10000</td>\n",
|
||||
" <td>(0.0e+00 - 6.3e-07)</td>\n",
|
||||
" <td>(U-235 / total)</td>\n",
|
||||
" <td>(scatter / flux)</td>\n",
|
||||
" <td>0.005555</td>\n",
|
||||
" <td>6.101004e-05</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>4</th>\n",
|
||||
" <td> 10000</td>\n",
|
||||
" <td> (6.3e-07 - 2.0e+01)</td>\n",
|
||||
" <td> (U-238 / total)</td>\n",
|
||||
" <td> (nu-fission / flux)</td>\n",
|
||||
" <td> 0.007190</td>\n",
|
||||
" <td> 7.596666e-05</td>\n",
|
||||
" <td>10000</td>\n",
|
||||
" <td>(6.3e-07 - 2.0e+01)</td>\n",
|
||||
" <td>(U-238 / total)</td>\n",
|
||||
" <td>(nu-fission / flux)</td>\n",
|
||||
" <td>0.007155</td>\n",
|
||||
" <td>8.053460e-05</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>5</th>\n",
|
||||
" <td> 10000</td>\n",
|
||||
" <td> (6.3e-07 - 2.0e+01)</td>\n",
|
||||
" <td> (U-238 / total)</td>\n",
|
||||
" <td> (scatter / flux)</td>\n",
|
||||
" <td> 0.227843</td>\n",
|
||||
" <td> 1.024510e-03</td>\n",
|
||||
" <td>10000</td>\n",
|
||||
" <td>(6.3e-07 - 2.0e+01)</td>\n",
|
||||
" <td>(U-238 / total)</td>\n",
|
||||
" <td>(scatter / flux)</td>\n",
|
||||
" <td>0.227770</td>\n",
|
||||
" <td>1.079289e-03</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>6</th>\n",
|
||||
" <td> 10000</td>\n",
|
||||
" <td> (6.3e-07 - 2.0e+01)</td>\n",
|
||||
" <td> (U-235 / total)</td>\n",
|
||||
" <td> (nu-fission / flux)</td>\n",
|
||||
" <td> 0.008086</td>\n",
|
||||
" <td> 6.251590e-05</td>\n",
|
||||
" <td>10000</td>\n",
|
||||
" <td>(6.3e-07 - 2.0e+01)</td>\n",
|
||||
" <td>(U-235 / total)</td>\n",
|
||||
" <td>(nu-fission / flux)</td>\n",
|
||||
" <td>0.008067</td>\n",
|
||||
" <td>5.254797e-05</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>7</th>\n",
|
||||
" <td> 10000</td>\n",
|
||||
" <td> (6.3e-07 - 2.0e+01)</td>\n",
|
||||
" <td> (U-235 / total)</td>\n",
|
||||
" <td> (scatter / flux)</td>\n",
|
||||
" <td> 0.003365</td>\n",
|
||||
" <td> 1.646663e-05</td>\n",
|
||||
" <td>10000</td>\n",
|
||||
" <td>(6.3e-07 - 2.0e+01)</td>\n",
|
||||
" <td>(U-235 / total)</td>\n",
|
||||
" <td>(scatter / flux)</td>\n",
|
||||
" <td>0.003367</td>\n",
|
||||
" <td>1.647058e-05</td>\n",
|
||||
" </tr>\n",
|
||||
" </tbody>\n",
|
||||
"</table>\n",
|
||||
|
|
@ -1239,23 +1222,23 @@
|
|||
"text/plain": [
|
||||
" cell energy [MeV] nuclide score mean \\\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.209990 \n",
|
||||
"2 10000 (0.0e+00 - 6.3e-07) (U-235 / total) (nu-fission / flux) 0.356117 \n",
|
||||
"1 10000 (0.0e+00 - 6.3e-07) (U-238 / total) (scatter / flux) 0.209989 \n",
|
||||
"2 10000 (0.0e+00 - 6.3e-07) (U-235 / total) (nu-fission / flux) 0.356420 \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.007190 \n",
|
||||
"5 10000 (6.3e-07 - 2.0e+01) (U-238 / total) (scatter / flux) 0.227843 \n",
|
||||
"6 10000 (6.3e-07 - 2.0e+01) (U-235 / total) (nu-fission / flux) 0.008086 \n",
|
||||
"7 10000 (6.3e-07 - 2.0e+01) (U-235 / total) (scatter / flux) 0.003365 \n",
|
||||
"4 10000 (6.3e-07 - 2.0e+01) (U-238 / total) (nu-fission / flux) 0.007155 \n",
|
||||
"5 10000 (6.3e-07 - 2.0e+01) (U-238 / total) (scatter / flux) 0.227770 \n",
|
||||
"6 10000 (6.3e-07 - 2.0e+01) (U-235 / total) (nu-fission / flux) 0.008067 \n",
|
||||
"7 10000 (6.3e-07 - 2.0e+01) (U-235 / total) (scatter / flux) 0.003367 \n",
|
||||
"\n",
|
||||
" std. dev. \n",
|
||||
"0 8.078651e-09 \n",
|
||||
"1 2.449396e-03 \n",
|
||||
"2 4.364366e-03 \n",
|
||||
"3 6.495710e-05 \n",
|
||||
"4 7.596666e-05 \n",
|
||||
"5 1.024510e-03 \n",
|
||||
"6 6.251590e-05 \n",
|
||||
"7 1.646663e-05 "
|
||||
"0 7.377419e-09 \n",
|
||||
"1 2.303838e-03 \n",
|
||||
"2 3.951669e-03 \n",
|
||||
"3 6.101004e-05 \n",
|
||||
"4 8.053460e-05 \n",
|
||||
"5 1.079289e-03 \n",
|
||||
"6 5.254797e-05 \n",
|
||||
"7 1.647058e-05 "
|
||||
]
|
||||
},
|
||||
"execution_count": 33,
|
||||
|
|
@ -1286,11 +1269,11 @@
|
|||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"[[[ 6.65302296e-07]\n",
|
||||
" [ 3.56116716e-01]]\n",
|
||||
"[[[ 6.65702880e-07]\n",
|
||||
" [ 3.56420449e-01]]\n",
|
||||
"\n",
|
||||
" [[ 7.19004460e-03]\n",
|
||||
" [ 8.08598751e-03]]]\n"
|
||||
" [[ 7.15488656e-03]\n",
|
||||
" [ 8.06673774e-03]]]\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
|
|
@ -1318,9 +1301,9 @@
|
|||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"[[[ 0.00555516]]\n",
|
||||
"[[[ 0.00555533]]\n",
|
||||
"\n",
|
||||
" [[ 0.00336498]]]\n"
|
||||
" [[ 0.0033668 ]]]\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
|
|
@ -1342,8 +1325,8 @@
|
|||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"[[[ 0.22784316]\n",
|
||||
" [ 0.00336498]]]\n"
|
||||
"[[[ 0.22777006]\n",
|
||||
" [ 0.0033668 ]]]\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
|
|
@ -1388,39 +1371,39 @@
|
|||
" <tbody>\n",
|
||||
" <tr>\n",
|
||||
" <th>0</th>\n",
|
||||
" <td> 10000</td>\n",
|
||||
" <td> (0.0e+00 - 6.3e-07)</td>\n",
|
||||
" <td> U-238</td>\n",
|
||||
" <td> nu-fission</td>\n",
|
||||
" <td> 0.000002</td>\n",
|
||||
" <td> 1.450189e-08</td>\n",
|
||||
" <td>10000</td>\n",
|
||||
" <td>(0.0e+00 - 6.3e-07)</td>\n",
|
||||
" <td>U-238</td>\n",
|
||||
" <td>nu-fission</td>\n",
|
||||
" <td>0.000002</td>\n",
|
||||
" <td>1.283958e-08</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>1</th>\n",
|
||||
" <td> 10000</td>\n",
|
||||
" <td> (0.0e+00 - 6.3e-07)</td>\n",
|
||||
" <td> U-235</td>\n",
|
||||
" <td> nu-fission</td>\n",
|
||||
" <td> 0.870882</td>\n",
|
||||
" <td> 7.895515e-03</td>\n",
|
||||
" <td>10000</td>\n",
|
||||
" <td>(0.0e+00 - 6.3e-07)</td>\n",
|
||||
" <td>U-235</td>\n",
|
||||
" <td>nu-fission</td>\n",
|
||||
" <td>0.868553</td>\n",
|
||||
" <td>6.880390e-03</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>2</th>\n",
|
||||
" <td> 10000</td>\n",
|
||||
" <td> (6.3e-07 - 2.0e+01)</td>\n",
|
||||
" <td> U-238</td>\n",
|
||||
" <td> nu-fission</td>\n",
|
||||
" <td> 0.082484</td>\n",
|
||||
" <td> 8.253437e-04</td>\n",
|
||||
" <td>10000</td>\n",
|
||||
" <td>(6.3e-07 - 2.0e+01)</td>\n",
|
||||
" <td>U-238</td>\n",
|
||||
" <td>nu-fission</td>\n",
|
||||
" <td>0.082149</td>\n",
|
||||
" <td>8.837250e-04</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>3</th>\n",
|
||||
" <td> 10000</td>\n",
|
||||
" <td> (6.3e-07 - 2.0e+01)</td>\n",
|
||||
" <td> U-235</td>\n",
|
||||
" <td> nu-fission</td>\n",
|
||||
" <td> 0.092762</td>\n",
|
||||
" <td> 6.444580e-04</td>\n",
|
||||
" <td>10000</td>\n",
|
||||
" <td>(6.3e-07 - 2.0e+01)</td>\n",
|
||||
" <td>U-235</td>\n",
|
||||
" <td>nu-fission</td>\n",
|
||||
" <td>0.092618</td>\n",
|
||||
" <td>5.195308e-04</td>\n",
|
||||
" </tr>\n",
|
||||
" </tbody>\n",
|
||||
"</table>\n",
|
||||
|
|
@ -1428,10 +1411,10 @@
|
|||
],
|
||||
"text/plain": [
|
||||
" cell energy [MeV] nuclide score mean std. dev.\n",
|
||||
"0 10000 (0.0e+00 - 6.3e-07) U-238 nu-fission 0.000002 1.450189e-08\n",
|
||||
"1 10000 (0.0e+00 - 6.3e-07) U-235 nu-fission 0.870882 7.895515e-03\n",
|
||||
"2 10000 (6.3e-07 - 2.0e+01) U-238 nu-fission 0.082484 8.253437e-04\n",
|
||||
"3 10000 (6.3e-07 - 2.0e+01) U-235 nu-fission 0.092762 6.444580e-04"
|
||||
"0 10000 (0.0e+00 - 6.3e-07) U-238 nu-fission 0.000002 1.283958e-08\n",
|
||||
"1 10000 (0.0e+00 - 6.3e-07) U-235 nu-fission 0.868553 6.880390e-03\n",
|
||||
"2 10000 (6.3e-07 - 2.0e+01) U-238 nu-fission 0.082149 8.837250e-04\n",
|
||||
"3 10000 (6.3e-07 - 2.0e+01) U-235 nu-fission 0.092618 5.195308e-04"
|
||||
]
|
||||
},
|
||||
"execution_count": 37,
|
||||
|
|
@ -1471,84 +1454,84 @@
|
|||
" <tbody>\n",
|
||||
" <tr>\n",
|
||||
" <th>0</th>\n",
|
||||
" <td> 10002</td>\n",
|
||||
" <td> (1.0e-08 - 1.1e-07)</td>\n",
|
||||
" <td> H-1</td>\n",
|
||||
" <td> scatter</td>\n",
|
||||
" <td> 4.630154</td>\n",
|
||||
" <td> 0.044512</td>\n",
|
||||
" <td>10002</td>\n",
|
||||
" <td>(1.0e-08 - 1.1e-07)</td>\n",
|
||||
" <td>H-1</td>\n",
|
||||
" <td>scatter</td>\n",
|
||||
" <td>4.619398</td>\n",
|
||||
" <td>0.040124</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>1</th>\n",
|
||||
" <td> 10002</td>\n",
|
||||
" <td> (1.1e-07 - 1.2e-06)</td>\n",
|
||||
" <td> H-1</td>\n",
|
||||
" <td> scatter</td>\n",
|
||||
" <td> 2.042984</td>\n",
|
||||
" <td> 0.011429</td>\n",
|
||||
" <td>10002</td>\n",
|
||||
" <td>(1.1e-07 - 1.2e-06)</td>\n",
|
||||
" <td>H-1</td>\n",
|
||||
" <td>scatter</td>\n",
|
||||
" <td>2.030757</td>\n",
|
||||
" <td>0.011239</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>2</th>\n",
|
||||
" <td> 10002</td>\n",
|
||||
" <td> (1.2e-06 - 1.3e-05)</td>\n",
|
||||
" <td> H-1</td>\n",
|
||||
" <td> scatter</td>\n",
|
||||
" <td> 1.657517</td>\n",
|
||||
" <td> 0.008617</td>\n",
|
||||
" <td>10002</td>\n",
|
||||
" <td>(1.2e-06 - 1.3e-05)</td>\n",
|
||||
" <td>H-1</td>\n",
|
||||
" <td>scatter</td>\n",
|
||||
" <td>1.658488</td>\n",
|
||||
" <td>0.009777</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>3</th>\n",
|
||||
" <td> 10002</td>\n",
|
||||
" <td> (1.3e-05 - 1.4e-04)</td>\n",
|
||||
" <td> H-1</td>\n",
|
||||
" <td> scatter</td>\n",
|
||||
" <td> 1.863326</td>\n",
|
||||
" <td> 0.008848</td>\n",
|
||||
" <td>10002</td>\n",
|
||||
" <td>(1.3e-05 - 1.4e-04)</td>\n",
|
||||
" <td>H-1</td>\n",
|
||||
" <td>scatter</td>\n",
|
||||
" <td>1.853002</td>\n",
|
||||
" <td>0.007378</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>4</th>\n",
|
||||
" <td> 10002</td>\n",
|
||||
" <td> (1.4e-04 - 1.5e-03)</td>\n",
|
||||
" <td> H-1</td>\n",
|
||||
" <td> scatter</td>\n",
|
||||
" <td> 2.043916</td>\n",
|
||||
" <td> 0.014195</td>\n",
|
||||
" <td>10002</td>\n",
|
||||
" <td>(1.4e-04 - 1.5e-03)</td>\n",
|
||||
" <td>H-1</td>\n",
|
||||
" <td>scatter</td>\n",
|
||||
" <td>2.050773</td>\n",
|
||||
" <td>0.012484</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>5</th>\n",
|
||||
" <td> 10002</td>\n",
|
||||
" <td> (1.5e-03 - 1.6e-02)</td>\n",
|
||||
" <td> H-1</td>\n",
|
||||
" <td> scatter</td>\n",
|
||||
" <td> 2.134458</td>\n",
|
||||
" <td> 0.007561</td>\n",
|
||||
" <td>10002</td>\n",
|
||||
" <td>(1.5e-03 - 1.6e-02)</td>\n",
|
||||
" <td>H-1</td>\n",
|
||||
" <td>scatter</td>\n",
|
||||
" <td>2.131759</td>\n",
|
||||
" <td>0.007821</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>6</th>\n",
|
||||
" <td> 10002</td>\n",
|
||||
" <td> (1.6e-02 - 1.7e-01)</td>\n",
|
||||
" <td> H-1</td>\n",
|
||||
" <td> scatter</td>\n",
|
||||
" <td> 2.209947</td>\n",
|
||||
" <td> 0.013848</td>\n",
|
||||
" <td>10002</td>\n",
|
||||
" <td>(1.6e-02 - 1.7e-01)</td>\n",
|
||||
" <td>H-1</td>\n",
|
||||
" <td>scatter</td>\n",
|
||||
" <td>2.213710</td>\n",
|
||||
" <td>0.015159</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>7</th>\n",
|
||||
" <td> 10002</td>\n",
|
||||
" <td> (1.7e-01 - 1.9e+00)</td>\n",
|
||||
" <td> H-1</td>\n",
|
||||
" <td> scatter</td>\n",
|
||||
" <td> 2.006967</td>\n",
|
||||
" <td> 0.009368</td>\n",
|
||||
" <td>10002</td>\n",
|
||||
" <td>(1.7e-01 - 1.9e+00)</td>\n",
|
||||
" <td>H-1</td>\n",
|
||||
" <td>scatter</td>\n",
|
||||
" <td>2.011925</td>\n",
|
||||
" <td>0.009406</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>8</th>\n",
|
||||
" <td> 10002</td>\n",
|
||||
" <td> (1.9e+00 - 2.0e+01)</td>\n",
|
||||
" <td> H-1</td>\n",
|
||||
" <td> scatter</td>\n",
|
||||
" <td> 0.373895</td>\n",
|
||||
" <td> 0.002964</td>\n",
|
||||
" <td>10002</td>\n",
|
||||
" <td>(1.9e+00 - 2.0e+01)</td>\n",
|
||||
" <td>H-1</td>\n",
|
||||
" <td>scatter</td>\n",
|
||||
" <td>0.371280</td>\n",
|
||||
" <td>0.003949</td>\n",
|
||||
" </tr>\n",
|
||||
" </tbody>\n",
|
||||
"</table>\n",
|
||||
|
|
@ -1556,15 +1539,15 @@
|
|||
],
|
||||
"text/plain": [
|
||||
" cell energy [MeV] nuclide score mean std. dev.\n",
|
||||
"0 10002 (1.0e-08 - 1.1e-07) H-1 scatter 4.630154 0.044512\n",
|
||||
"1 10002 (1.1e-07 - 1.2e-06) H-1 scatter 2.042984 0.011429\n",
|
||||
"2 10002 (1.2e-06 - 1.3e-05) H-1 scatter 1.657517 0.008617\n",
|
||||
"3 10002 (1.3e-05 - 1.4e-04) H-1 scatter 1.863326 0.008848\n",
|
||||
"4 10002 (1.4e-04 - 1.5e-03) H-1 scatter 2.043916 0.014195\n",
|
||||
"5 10002 (1.5e-03 - 1.6e-02) H-1 scatter 2.134458 0.007561\n",
|
||||
"6 10002 (1.6e-02 - 1.7e-01) H-1 scatter 2.209947 0.013848\n",
|
||||
"7 10002 (1.7e-01 - 1.9e+00) H-1 scatter 2.006967 0.009368\n",
|
||||
"8 10002 (1.9e+00 - 2.0e+01) H-1 scatter 0.373895 0.002964"
|
||||
"0 10002 (1.0e-08 - 1.1e-07) H-1 scatter 4.619398 0.040124\n",
|
||||
"1 10002 (1.1e-07 - 1.2e-06) H-1 scatter 2.030757 0.011239\n",
|
||||
"2 10002 (1.2e-06 - 1.3e-05) H-1 scatter 1.658488 0.009777\n",
|
||||
"3 10002 (1.3e-05 - 1.4e-04) H-1 scatter 1.853002 0.007378\n",
|
||||
"4 10002 (1.4e-04 - 1.5e-03) H-1 scatter 2.050773 0.012484\n",
|
||||
"5 10002 (1.5e-03 - 1.6e-02) H-1 scatter 2.131759 0.007821\n",
|
||||
"6 10002 (1.6e-02 - 1.7e-01) H-1 scatter 2.213710 0.015159\n",
|
||||
"7 10002 (1.7e-01 - 1.9e+00) H-1 scatter 2.011925 0.009406\n",
|
||||
"8 10002 (1.9e+00 - 2.0e+01) H-1 scatter 0.371280 0.003949"
|
||||
]
|
||||
},
|
||||
"execution_count": 38,
|
||||
|
|
|
|||
|
|
@ -35,6 +35,8 @@ on a given module or class.
|
|||
opencg_compatible
|
||||
plots
|
||||
settings
|
||||
source
|
||||
stats
|
||||
surface
|
||||
tallies
|
||||
trigger
|
||||
|
|
|
|||
8
docs/source/pythonapi/source.rst
Normal file
8
docs/source/pythonapi/source.rst
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
.. _pythonapi_source:
|
||||
|
||||
======
|
||||
Source
|
||||
======
|
||||
|
||||
.. automodule:: openmc.source
|
||||
:members:
|
||||
58
docs/source/pythonapi/stats.rst
Normal file
58
docs/source/pythonapi/stats.rst
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
.. _pythonapi_stats:
|
||||
|
||||
=====================
|
||||
Statistical Functions
|
||||
=====================
|
||||
|
||||
----------------------------
|
||||
Summary of Available Classes
|
||||
----------------------------
|
||||
|
||||
Univariate Probability Distributions
|
||||
------------------------------------
|
||||
|
||||
.. currentmodule:: openmc.stats.univariate
|
||||
|
||||
.. autosummary::
|
||||
|
||||
Univariate
|
||||
Discrete
|
||||
Uniform
|
||||
Maxwell
|
||||
Watt
|
||||
Tabular
|
||||
|
||||
Angular Distributions
|
||||
---------------------
|
||||
|
||||
.. currentmodule:: openmc.stats.multivariate
|
||||
|
||||
.. autosummary::
|
||||
|
||||
UnitSphere
|
||||
PolarAzimuthal
|
||||
Isotropic
|
||||
Monodirectional
|
||||
|
||||
Spatial Distributions
|
||||
---------------------
|
||||
|
||||
.. autosummary::
|
||||
|
||||
Spatial
|
||||
CartesianIndependent
|
||||
Box
|
||||
Point
|
||||
|
||||
|
||||
Univariate Probability Distributions
|
||||
------------------------------------
|
||||
|
||||
.. automodule:: openmc.stats.univariate
|
||||
:members:
|
||||
|
||||
Multivariate Probability Distributions
|
||||
--------------------------------------
|
||||
|
||||
.. automodule:: openmc.stats.multivariate
|
||||
:members:
|
||||
|
|
@ -424,9 +424,17 @@ pseudo-random number generator.
|
|||
|
||||
The ``source`` element gives information on an external source distribution to
|
||||
be used either as the source for a fixed source calculation or the initial
|
||||
source guess for criticality calculations. It takes the following
|
||||
source guess for criticality calculations. Multiple ``<source>`` elements may be
|
||||
specified to define different source distributions. Each one takes the following
|
||||
attributes/sub-elements:
|
||||
|
||||
:strength:
|
||||
The strength of the source. If multiple sources are present, the source
|
||||
strength indicates the relative probability of choosing one source over the
|
||||
other.
|
||||
|
||||
*Default*: 1.0
|
||||
|
||||
:file:
|
||||
If this attribute is given, it indicates that the source is to be read from
|
||||
a binary source file whose path is given by the value of this element. Note,
|
||||
|
|
@ -440,13 +448,13 @@ attributes/sub-elements:
|
|||
has the following attributes:
|
||||
|
||||
:type:
|
||||
|
||||
The type of spatial distribution. Valid options are "box", "fission", and
|
||||
"point". A "box" spatial distribution has coordinates sampled uniformly in
|
||||
a parallelepiped. A "fission" spatial distribution samples locations from
|
||||
a "box" distribution but only locations in fissionable materials are
|
||||
accepted. A "point" spatial distribution has coordinates specified by a
|
||||
triplet.
|
||||
The type of spatial distribution. Valid options are "box", "fission",
|
||||
"point", and "cartesian". A "box" spatial distribution has coordinates
|
||||
sampled uniformly in a parallelepiped. A "fission" spatial distribution
|
||||
samples locations from a "box" distribution but only locations in
|
||||
fissionable materials are accepted. A "point" spatial distribution has
|
||||
coordinates specified by a triplet. An "cartesian" spatial distribution
|
||||
specifies independent distributions of x-, y-, and z-coordinates.
|
||||
|
||||
*Default*: None
|
||||
|
||||
|
|
@ -459,67 +467,123 @@ attributes/sub-elements:
|
|||
|
||||
For a "point" spatial distribution, ``parameters`` should be given as
|
||||
three real numbers which specify the (x,y,z) location of an isotropic
|
||||
point source
|
||||
point source.
|
||||
|
||||
For an "cartesian" distribution, no parameters are specified. Instead,
|
||||
the ``x``, ``y``, and ``z`` elements must be specified.
|
||||
|
||||
*Default*: None
|
||||
|
||||
:x:
|
||||
For an "cartesian" distribution, this element specifies the distribution
|
||||
of x-coordinates. The necessary sub-elements/attributes are those of a
|
||||
univariate probability distribution (see the description in
|
||||
:ref:`univariate`).
|
||||
|
||||
:y:
|
||||
For an "cartesian" distribution, this element specifies the distribution
|
||||
of y-coordinates. The necessary sub-elements/attributes are those of a
|
||||
univariate probability distribution (see the description in
|
||||
:ref:`univariate`).
|
||||
|
||||
:z:
|
||||
For an "cartesian" distribution, this element specifies the distribution
|
||||
of z-coordinates. The necessary sub-elements/attributes are those of a
|
||||
univariate probability distribution (see the description in
|
||||
:ref:`univariate`).
|
||||
|
||||
:angle:
|
||||
An element specifying the angular distribution of source sites. This element
|
||||
has the following attributes:
|
||||
|
||||
:type:
|
||||
The type of angular distribution. Valid options are "isotropic" and
|
||||
"monodirectional". The angle of the particle emitted from a source site is
|
||||
isotropic if the "isotropic" option is given. The angle of the particle
|
||||
emitted from a source site is the direction specified in the <parameters>
|
||||
attribute if "monodirectional" option is given.
|
||||
The type of angular distribution. Valid options are "isotropic",
|
||||
"monodirectional", and "mu-phi". The angle of the particle emitted from a
|
||||
source site is isotropic if the "isotropic" option is given. The angle of
|
||||
the particle emitted from a source site is the direction specified in the
|
||||
``reference_uvw`` element/attribute if "monodirectional" option is
|
||||
given. The "mu-phi" option produces directions with the cosine of the
|
||||
polar angle and the azimuthal angle explicitly specified.
|
||||
|
||||
*Default*: isotropic
|
||||
|
||||
:parameters:
|
||||
For an "isotropic" angular distribution, ``parameters`` should not be
|
||||
specified.
|
||||
:reference_uvw:
|
||||
The direction from which the polar angle is measured. Represented by the
|
||||
x-, y-, and z-components of a unit vector. For a monodirectional
|
||||
distribution, this defines the direction of all sampled particles.
|
||||
|
||||
For a "monodirectional" angular distribution, ``parameters`` should be
|
||||
given as three real numbers which specify the angular cosines with respect
|
||||
to each axis.
|
||||
:mu:
|
||||
An element specifying the distribution of the cosine of the polar
|
||||
angle. Only relevant when the type is "mu-phi". The necessary
|
||||
sub-elements/attributes are those of a univariate probability distribution
|
||||
(see the description in :ref:`univariate`).
|
||||
|
||||
*Default*: None
|
||||
:phi:
|
||||
An element specifying the distribution of the azimuthal angle. Only
|
||||
relevant when the type is "mu-phi". The necessary sub-elements/attributes
|
||||
are those of a univariate probability distribution (see the description in
|
||||
:ref:`univariate`).
|
||||
|
||||
:energy:
|
||||
An element specifying the energy distribution of source sites. This element
|
||||
has the following attributes:
|
||||
|
||||
:type:
|
||||
|
||||
The type of energy distribution. Valid options are "monoenergetic",
|
||||
"watt", and "maxwell". The "monoenergetic" option produces source sites at
|
||||
a single energy. The "watt" option produces source sites whose energy is
|
||||
sampled from a Watt fission spectrum. The "maxwell" option produce source
|
||||
sites whose energy is sampled from a Maxwell fission spectrum.
|
||||
|
||||
*Default*: watt
|
||||
|
||||
:parameters:
|
||||
For a "monoenergetic" energy distribution, ``parameters`` should be
|
||||
given as the energy in MeV of the source sites.
|
||||
|
||||
For a "watt" energy distribution, ``parameters`` should be given as two
|
||||
real numbers :math:`a` and :math:`b` that parameterize the distribution
|
||||
:math:`p(E) dE = c e^{-E/a} \sinh \sqrt{b \, E} dE`.
|
||||
|
||||
For a "maxwell" energy distribution, ``parameters`` should be given as one
|
||||
real number :math:`a` that parameterizes the distribution :math:`p(E) dE =
|
||||
c E e^{-E/a} dE`.
|
||||
|
||||
*Default*: 0.988 2.249
|
||||
An element specifying the energy distribution of source sites. The necessary
|
||||
sub-elements/attributes are those of a univariate probability distribution
|
||||
(see the description in :ref:`univariate`).
|
||||
|
||||
:write_initial:
|
||||
An element specifying whether to write out the initial source bank used at
|
||||
the beginning of the first batch. The output file is named
|
||||
"initial_source.binary(h5)"
|
||||
"initial_source.h5"
|
||||
|
||||
*Default*: false
|
||||
*Default*: false
|
||||
|
||||
.. _univariate:
|
||||
|
||||
Univariate Probability Distributions
|
||||
++++++++++++++++++++++++++++++++++++
|
||||
|
||||
Various components of a source distribution involve probability distributions of
|
||||
a single random variable, e.g. the distribution of the energy, the distribution
|
||||
of the polar angle, and the distribution of x-coordinates. Each of these
|
||||
components supports the same syntax with an element whose tag signifies the
|
||||
variable and whose sub-elements/attributes are as follows:
|
||||
|
||||
:type:
|
||||
The type of the distribution. Valid options are "uniform", "discrete",
|
||||
"tabular", "maxwell", and "watt". The "uniform" option produces variates
|
||||
sampled from a uniform distribution over a finite interval. The "discrete"
|
||||
option produces random variates that can assume a finite number of values
|
||||
(i.e., a distribution characterized by a probability mass function). The
|
||||
"tabular" option produces random variates sampled from a tabulated
|
||||
distribution where the density function is either a histogram or
|
||||
linearly-interpolated between tabulated points. The "watt" option produces
|
||||
random variates is sampled from a Watt fission spectrum (only used for
|
||||
energies). The "maxwell" option produce variates sampled from a Maxwell
|
||||
fission spectrum (only used for energies).
|
||||
|
||||
*Default*: None
|
||||
|
||||
:parameters:
|
||||
For a "uniform" distribution, ``parameters`` should be given as two real
|
||||
numbers :math:`a` and :math:`b` that define the interval :math:`[a,b]` over
|
||||
which random variates are sampled.
|
||||
|
||||
For a "discrete" or "tabular" distribution, ``parameters`` provides the
|
||||
:math:`(x,p)` pairs defining the discrete/tabular distribution. All :math:`x`
|
||||
points are given first followed by corresponding :math:`p` points.
|
||||
|
||||
For a "watt" distribution, ``parameters`` should be given as two real numbers
|
||||
:math:`a` and :math:`b` that parameterize the distribution :math:`p(x) dx = c
|
||||
e^{-x/a} \sinh \sqrt{b \, x} dx`.
|
||||
|
||||
For a "maxwell" distribution, ``parameters`` should be given as one real
|
||||
number :math:`a` that parameterizes the distribution :math:`p(x) dx = c x
|
||||
e^{-x/a} dx`.
|
||||
|
||||
:interpolation:
|
||||
For a "tabular" distribution, ``interpolation`` can be set to "histogram" or
|
||||
"linear-linear" thereby specifying how tabular points are to be interpolated.
|
||||
|
||||
*Default*: histogram
|
||||
|
||||
``<state_point>`` Element
|
||||
-------------------------
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
import openmc
|
||||
from openmc.source import Source
|
||||
from openmc.stats import Box
|
||||
|
||||
###############################################################################
|
||||
# Simulation Input File Parameters
|
||||
|
|
@ -92,7 +94,7 @@ settings_file = openmc.SettingsFile()
|
|||
settings_file.batches = batches
|
||||
settings_file.inactive = inactive
|
||||
settings_file.particles = particles
|
||||
settings_file.set_source_space('box', [-4, -4, -4, 4, 4, 4])
|
||||
settings_file.source = Source(space=Box([-4, -4, -4], [4, 4, 4]))
|
||||
settings_file.export_to_xml()
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
import numpy as np
|
||||
|
||||
import openmc
|
||||
from openmc.source import Source
|
||||
from openmc.stats import Box
|
||||
|
||||
###############################################################################
|
||||
# Simulation Input File Parameters
|
||||
|
|
@ -117,7 +119,7 @@ settings_file = openmc.SettingsFile()
|
|||
settings_file.batches = batches
|
||||
settings_file.inactive = inactive
|
||||
settings_file.particles = particles
|
||||
settings_file.set_source_space('box', np.concatenate(outer_cube.bounding_box))
|
||||
settings_file.source = Source(space=Box(*outer_cube.bounding_box))
|
||||
settings_file.export_to_xml()
|
||||
|
||||
###############################################################################
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import openmc
|
||||
|
||||
from openmc.source import Source
|
||||
from openmc.stats import Box
|
||||
|
||||
###############################################################################
|
||||
# Simulation Input File Parameters
|
||||
|
|
@ -125,7 +126,8 @@ settings_file = openmc.SettingsFile()
|
|||
settings_file.batches = batches
|
||||
settings_file.inactive = inactive
|
||||
settings_file.particles = particles
|
||||
settings_file.set_source_space('box', [-1, -1, -1, 1, 1, 1])
|
||||
settings_file.source = Source(space=Box(
|
||||
[-1, -1, -1], [1, 1, 1]))
|
||||
settings_file.keff_trigger = {'type' : 'std_dev', 'threshold' : 5E-4}
|
||||
settings_file.trigger_active = True
|
||||
settings_file.trigger_max_batches = 100
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import openmc
|
||||
|
||||
from openmc.source import Source
|
||||
from openmc.stats import Box
|
||||
|
||||
###############################################################################
|
||||
# Simulation Input File Parameters
|
||||
|
|
@ -136,7 +137,8 @@ settings_file = openmc.SettingsFile()
|
|||
settings_file.batches = batches
|
||||
settings_file.inactive = inactive
|
||||
settings_file.particles = particles
|
||||
settings_file.set_source_space('box', [-1, -1, -1, 1, 1, 1])
|
||||
settings_file.source = Source(space=Box(
|
||||
[-1, -1, -1], [1, 1, 1]))
|
||||
settings_file.export_to_xml()
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
import openmc
|
||||
from openmc.source import Source
|
||||
from openmc.stats import Box
|
||||
|
||||
###############################################################################
|
||||
# Simulation Input File Parameters
|
||||
|
|
@ -125,7 +127,8 @@ settings_file = openmc.SettingsFile()
|
|||
settings_file.batches = batches
|
||||
settings_file.inactive = inactive
|
||||
settings_file.particles = particles
|
||||
settings_file.set_source_space('box', [-1, -1, -1, 1, 1, 1])
|
||||
settings_file.source = Source(space=Box(
|
||||
[-1, -1, -1], [1, 1, 1]))
|
||||
settings_file.trigger_active = True
|
||||
settings_file.trigger_max_batches = 100
|
||||
settings_file.export_to_xml()
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
import openmc
|
||||
from openmc.source import Source
|
||||
from openmc.stats import Box
|
||||
|
||||
###############################################################################
|
||||
# Simulation Input File Parameters
|
||||
|
|
@ -168,8 +170,8 @@ settings_file = openmc.SettingsFile()
|
|||
settings_file.batches = batches
|
||||
settings_file.inactive = inactive
|
||||
settings_file.particles = particles
|
||||
settings_file.set_source_space('box', [-0.62992, -0.62992, -1, \
|
||||
0.62992, 0.62992, 1])
|
||||
settings_file.source = Source(space=Box(
|
||||
[-0.62992, -0.62992, -1], [0.62992, 0.62992, 1]))
|
||||
settings_file.entropy_lower_left = [-0.39218, -0.39218, -1.e50]
|
||||
settings_file.entropy_upper_right = [0.39218, 0.39218, 1.e50]
|
||||
settings_file.entropy_dimension = [10, 10, 1]
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
import numpy as np
|
||||
|
||||
import openmc
|
||||
from openmc.stats import Box
|
||||
from openmc.source import Source
|
||||
|
||||
###############################################################################
|
||||
# Simulation Input File Parameters
|
||||
|
|
@ -84,5 +86,5 @@ settings_file = openmc.SettingsFile()
|
|||
settings_file.batches = batches
|
||||
settings_file.inactive = inactive
|
||||
settings_file.particles = particles
|
||||
settings_file.set_source_space('box', np.concatenate(cell.region.bounding_box))
|
||||
settings_file.source = Source(space=Box(*cell.region.bounding_box))
|
||||
settings_file.export_to_xml()
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import numpy as np
|
|||
from openmc.clean_xml import *
|
||||
from openmc.checkvalue import (check_type, check_length, check_value,
|
||||
check_greater_than, check_less_than)
|
||||
from openmc.source import Source
|
||||
|
||||
if sys.version_info[0] >= 3:
|
||||
basestring = str
|
||||
|
|
@ -36,8 +37,8 @@ class SettingsFile(object):
|
|||
type are 'variance', 'std_dev', and 'rel_err'. The threshold value
|
||||
should be a float indicating the variance, standard deviation, or
|
||||
relative error used.
|
||||
source_file : str
|
||||
Path to a source file
|
||||
source : Iterable of openmc.source.Source
|
||||
Distribution of source sites in space, angle, and energy
|
||||
output : dict
|
||||
Dictionary indicating what files to output. Valid keys are 'summary',
|
||||
'cross_sections', 'tallies', and 'distribmats'. Values corresponding to
|
||||
|
|
@ -134,14 +135,7 @@ class SettingsFile(object):
|
|||
self._keff_trigger = None
|
||||
|
||||
# Source subelement
|
||||
self._source_subelement = None
|
||||
self._source_file = None
|
||||
self._source_space_type = None
|
||||
self._source_space_params = None
|
||||
self._source_angle_type = None
|
||||
self._source_angle_params = None
|
||||
self._source_energy_type = None
|
||||
self._source_energy_params = None
|
||||
self._source = None
|
||||
|
||||
self._confidence_intervals = None
|
||||
self._cross_sections = None
|
||||
|
|
@ -228,32 +222,8 @@ class SettingsFile(object):
|
|||
return self._keff_trigger
|
||||
|
||||
@property
|
||||
def source_file(self):
|
||||
return self._source_file
|
||||
|
||||
@property
|
||||
def source_space_type(self):
|
||||
return self._source_space_type
|
||||
|
||||
@property
|
||||
def source_space_params(self):
|
||||
return self._source_space_params
|
||||
|
||||
@property
|
||||
def source_angle_type(self):
|
||||
return self._source_angle_type
|
||||
|
||||
@property
|
||||
def source_angle_params(self):
|
||||
return self._source_angle_params
|
||||
|
||||
@property
|
||||
def source_energy_type(self):
|
||||
return self._source_energy_type
|
||||
|
||||
@property
|
||||
def source_energy_params(self):
|
||||
return self._source_energy_params
|
||||
def source(self):
|
||||
return self._source
|
||||
|
||||
@property
|
||||
def confidence_intervals(self):
|
||||
|
|
@ -468,124 +438,13 @@ class SettingsFile(object):
|
|||
|
||||
self._keff_trigger = keff_trigger
|
||||
|
||||
@source_file.setter
|
||||
def source_file(self, source_file):
|
||||
check_type('source file', source_file, basestring)
|
||||
self._source_file = source_file
|
||||
|
||||
def set_source_space(self, stype, params):
|
||||
"""Defined the spatial bounds of the external/starting source.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
stype : str
|
||||
The type of spatial distribution. Valid options are "box",
|
||||
"fission", and "point". A "box" spatial distribution has coordinates
|
||||
sampled uniformly in a parallelepiped. A "fission" spatial
|
||||
distribution samples locations from a "box" distribution but only
|
||||
locations in fissionable materials are accepted. A "point" spatial
|
||||
distribution has coordinates specified by a triplet.
|
||||
params : Iterable of float
|
||||
For a "box" or "fission" spatial distribution, ``params`` should be
|
||||
given as six real numbers, the first three of which specify the
|
||||
lower-left corner of a parallelepiped and the last three of which
|
||||
specify the upper-right corner. Source sites are sampled uniformly
|
||||
through that parallelepiped.
|
||||
|
||||
For a "point" spatial distribution, ``params`` should be given as
|
||||
three real numbers which specify the (x,y,z) location of an
|
||||
isotropic point source
|
||||
|
||||
"""
|
||||
|
||||
check_type('source space type', stype, basestring)
|
||||
check_value('source space type', stype, ['box', 'fission', 'point'])
|
||||
check_type('source space parameters', params, Iterable, Real)
|
||||
if stype in ['box', 'fission']:
|
||||
check_length('source space parameters for a '
|
||||
'box/fission distribution', params, 6)
|
||||
elif stype == 'point':
|
||||
check_length('source space parameters for a point source',
|
||||
params, 3)
|
||||
|
||||
self._source_space_type = stype
|
||||
self._source_space_params = params
|
||||
|
||||
def set_source_angle(self, stype, params=[]):
|
||||
"""Defined the angular distribution of the external/starting source.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
stype : str
|
||||
The type of angular distribution. Valid options are "isotropic" and
|
||||
"monodirectional". The angle of the particle emitted from a source
|
||||
site is isotropic if the "isotropic" option is given. The angle of
|
||||
the particle emitted from a source site is the direction specified
|
||||
in ``params`` if the "monodirectional" option is given.
|
||||
params : Iterable of float
|
||||
For an "isotropic" angular distribution, ``params`` should not
|
||||
be specified.
|
||||
|
||||
For a "monodirectional" angular distribution, ``params`` should
|
||||
be given as three floats which specify the angular cosines
|
||||
with respect to each axis.
|
||||
|
||||
"""
|
||||
|
||||
check_type('source angle type', stype, basestring)
|
||||
check_value('source angle type', stype,
|
||||
['isotropic', 'monodirectional'])
|
||||
check_type('source angle parameters', params, Iterable, Real)
|
||||
if stype == 'isotropic' and params is not None:
|
||||
msg = 'Unable to set source angle parameters since they are not ' \
|
||||
'it is not supported for isotropic type sources'
|
||||
raise ValueError(msg)
|
||||
elif stype == 'monodirectional':
|
||||
check_length('source angle parameters for a monodirectional '
|
||||
'source', params, 3)
|
||||
|
||||
self._source_angle_type = stype
|
||||
self._source_angle_params = params
|
||||
|
||||
def set_source_energy(self, stype, params=[]):
|
||||
"""Defined the energy distribution of the external/starting source.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
stype : str
|
||||
The type of energy distribution. Valid options are "monoenergetic",
|
||||
"watt", and "maxwell". The "monoenergetic" option produces source
|
||||
sites at a single energy. The "watt" option produces source sites
|
||||
whose energy is sampled from a Watt fission spectrum. The "maxwell"
|
||||
option produce source sites whose energy is sampled from a Maxwell
|
||||
fission spectrum.
|
||||
params : Iterable of float
|
||||
For a "monoenergetic" energy distribution, ``params`` should be
|
||||
given as the energy in MeV of the source sites.
|
||||
|
||||
For a "watt" energy distribution, ``params`` should be given as two
|
||||
real numbers :math:`a` and :math:`b` that parameterize the
|
||||
distribution :math:`p(E) dE = c e^{-E/a} \sinh \sqrt{b \, E} dE`.
|
||||
|
||||
For a "maxwell" energy distribution, ``params`` should be given as
|
||||
one real number :math:`a` that parameterizes the distribution
|
||||
:math:`p(E) dE = c E e^{-E/a} dE`.
|
||||
|
||||
"""
|
||||
|
||||
check_type('source energy type', stype, basestring)
|
||||
check_value('source energy type', stype,
|
||||
['monoenergetic', 'watt', 'maxwell'])
|
||||
check_type('source energy parameters', params, Iterable, Real)
|
||||
if stype in ['monoenergetic', 'maxwell']:
|
||||
check_length('source energy parameters for a monoenergetic '
|
||||
'or Maxwell source', params, 1)
|
||||
elif stype == 'watt':
|
||||
check_length('source energy parameters for a Watt source',
|
||||
params, 2)
|
||||
|
||||
self._source_energy_type = stype
|
||||
self._source_energy_params = params
|
||||
@source.setter
|
||||
def source(self, source):
|
||||
if isinstance(source, Source):
|
||||
self._source = [source,]
|
||||
else:
|
||||
check_type('source distribution', source, Iterable, Source)
|
||||
self._source = source
|
||||
|
||||
@output.setter
|
||||
def output(self, output):
|
||||
|
|
@ -924,45 +783,9 @@ class SettingsFile(object):
|
|||
subelement.text = str(self._keff_trigger[key]).lower()
|
||||
|
||||
def _create_source_subelement(self):
|
||||
self._create_source_space_subelement()
|
||||
self._create_source_energy_subelement()
|
||||
self._create_source_angle_subelement()
|
||||
|
||||
def _create_source_space_subelement(self):
|
||||
if self._source_space_params is not None:
|
||||
if self._source_subelement is None:
|
||||
self._source_subelement = ET.SubElement(self._settings_file,
|
||||
"source")
|
||||
|
||||
element = ET.SubElement(self._source_subelement, "space")
|
||||
element.set("type", self._source_space_type)
|
||||
|
||||
subelement = ET.SubElement(element, "parameters")
|
||||
subelement.text = ' '.join(map(str, self._source_space_params))
|
||||
|
||||
def _create_source_angle_subelement(self):
|
||||
if self._source_angle_params is not None:
|
||||
if self._source_subelement is None:
|
||||
self._source_subelement = ET.SubElement(self._settings_file,
|
||||
"source")
|
||||
|
||||
element = ET.SubElement(self._source_subelement, "angle")
|
||||
element.set("type", self._source_angle_type)
|
||||
|
||||
subelement = ET.SubElement(element, "parameters")
|
||||
subelement.text = ' '.join(map(str, self._source_angle_params))
|
||||
|
||||
def _create_source_energy_subelement(self):
|
||||
if self._source_energy_params is not None:
|
||||
if self._source_subelement is None:
|
||||
self._source_subelement = ET.SubElement(self._settings_file,
|
||||
"source")
|
||||
|
||||
element = ET.SubElement(self._source_subelement, "energy")
|
||||
element.set("type", self._source_energy_type)
|
||||
|
||||
subelement = ET.SubElement(element, "parameters")
|
||||
subelement.text = ' '.join(map(str, self._source_energy_params))
|
||||
if self.source is not None:
|
||||
for source in self.source:
|
||||
self._settings_file.append(source.to_xml())
|
||||
|
||||
def _create_output_subelement(self):
|
||||
if self._output is not None:
|
||||
|
|
|
|||
117
openmc/source.py
Normal file
117
openmc/source.py
Normal file
|
|
@ -0,0 +1,117 @@
|
|||
from numbers import Real
|
||||
import sys
|
||||
from xml.etree import ElementTree as ET
|
||||
|
||||
from openmc.stats.univariate import Univariate
|
||||
from openmc.stats.multivariate import UnitSphere, Spatial
|
||||
import openmc.checkvalue as cv
|
||||
|
||||
if sys.version_info[0] >= 3:
|
||||
basestring = str
|
||||
|
||||
|
||||
class Source(object):
|
||||
"""Distribution of phase space coordinates for source sites.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
space : openmc.stats.Spatial, optional
|
||||
Spatial distribution of source sites
|
||||
angle : openmc.stats.UnitSphere, optional
|
||||
Angular distribution of source sites
|
||||
energy : openmc.stats.Univariate, optional
|
||||
Energy distribution of source sites
|
||||
filename : str, optional
|
||||
Source file from which sites should be sampled
|
||||
strength : Real
|
||||
Strength of the source
|
||||
|
||||
Attributes
|
||||
----------
|
||||
space : openmc.stats.Spatial or None
|
||||
Spatial distribution of source sites
|
||||
angle : openmc.stats.UnitSphere or None
|
||||
Angular distribution of source sites
|
||||
energy : openmc.stats.Univariate or None
|
||||
Energy distribution of source sites
|
||||
file : str or None
|
||||
Source file from which sites should be sampled
|
||||
strength : Real
|
||||
Strength of the source
|
||||
|
||||
"""
|
||||
|
||||
def __init__(self, space=None, angle=None, energy=None, filename=None, strength=1.0):
|
||||
self._space = None
|
||||
self._angle = None
|
||||
self._energy = None
|
||||
self._file = None
|
||||
|
||||
if space is not None:
|
||||
self.space = space
|
||||
if angle is not None:
|
||||
self.angle = angle
|
||||
if energy is not None:
|
||||
self.energy = energy
|
||||
if filename is not None:
|
||||
self.file = filename
|
||||
self.strength = strength
|
||||
|
||||
@property
|
||||
def file(self):
|
||||
return self._file
|
||||
|
||||
@property
|
||||
def space(self):
|
||||
return self._space
|
||||
|
||||
@property
|
||||
def angle(self):
|
||||
return self._angle
|
||||
|
||||
@property
|
||||
def energy(self):
|
||||
return self._energy
|
||||
|
||||
@property
|
||||
def strength(self):
|
||||
return self._strength
|
||||
|
||||
@file.setter
|
||||
def file(self, filename):
|
||||
cv.check_type('source file', filename, basestring)
|
||||
self._file = filename
|
||||
|
||||
@space.setter
|
||||
def space(self, space):
|
||||
cv.check_type('spatial distribution', space, Spatial)
|
||||
self._space = space
|
||||
|
||||
@angle.setter
|
||||
def angle(self, angle):
|
||||
cv.check_type('angular distribution', angle, UnitSphere)
|
||||
self._angle = angle
|
||||
|
||||
@energy.setter
|
||||
def energy(self, energy):
|
||||
cv.check_type('energy distribution', energy, Univariate)
|
||||
self._energy = energy
|
||||
|
||||
@strength.setter
|
||||
def strength(self, strength):
|
||||
cv.check_type('source strength', strength, Real)
|
||||
cv.check_greater_than('source strength', strength, 0.0, True)
|
||||
self._strength = strength
|
||||
|
||||
def to_xml(self):
|
||||
element = ET.Element("source")
|
||||
element.set("strength", str(self.strength))
|
||||
if self.file is not None:
|
||||
element.set("file", self.file)
|
||||
if self.space is not None:
|
||||
element.append(self.space.to_xml())
|
||||
if self.angle is not None:
|
||||
element.append(self.angle.to_xml())
|
||||
if self.energy is not None:
|
||||
element.append(self.energy.to_xml('energy'))
|
||||
return element
|
||||
2
openmc/stats/__init__.py
Normal file
2
openmc/stats/__init__.py
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
from openmc.stats.univariate import *
|
||||
from openmc.stats.multivariate import *
|
||||
360
openmc/stats/multivariate.py
Normal file
360
openmc/stats/multivariate.py
Normal file
|
|
@ -0,0 +1,360 @@
|
|||
from abc import ABCMeta, abstractmethod
|
||||
from collections import Iterable
|
||||
from math import pi
|
||||
from numbers import Real
|
||||
import sys
|
||||
from xml.etree import ElementTree as ET
|
||||
|
||||
import numpy as np
|
||||
|
||||
import openmc.checkvalue as cv
|
||||
from openmc.stats.univariate import Univariate, Uniform
|
||||
|
||||
if sys.version_info[0] >= 3:
|
||||
basestring = str
|
||||
|
||||
|
||||
class UnitSphere(object):
|
||||
"""Distribution of points on the unit sphere.
|
||||
|
||||
This abstract class is used for angular distributions, since a direction is
|
||||
represented as a unit vector (i.e., vector on the unit sphere).
|
||||
|
||||
Parameters
|
||||
----------
|
||||
reference_uvw : Iterable of Real
|
||||
Direction from which polar angle is measured
|
||||
|
||||
Attributes
|
||||
----------
|
||||
reference_uvw : Iterable of Real
|
||||
Direction from which polar angle is measured
|
||||
|
||||
"""
|
||||
|
||||
__metaclass__ = ABCMeta
|
||||
|
||||
def __init__(self, reference_uvw=None):
|
||||
self._reference_uvw = None
|
||||
if reference_uvw is not None:
|
||||
self.reference_uvw = reference_uvw
|
||||
|
||||
@property
|
||||
def reference_uvw(self):
|
||||
return self._reference_uvw
|
||||
|
||||
@reference_uvw.setter
|
||||
def reference_uvw(self, uvw):
|
||||
cv.check_type('reference direction', uvw, Iterable, Real)
|
||||
uvw = np.asarray(uvw)
|
||||
self._reference_uvw = uvw/np.linalg.norm(uvw)
|
||||
|
||||
@abstractmethod
|
||||
def to_xml(self):
|
||||
return ''
|
||||
|
||||
|
||||
class PolarAzimuthal(UnitSphere):
|
||||
"""Angular distribution represented by polar and azimuthal angles
|
||||
|
||||
This distribution allows one to specify the distribution of the cosine of
|
||||
the polar angle and the azimuthal angle independently of once another.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
mu : Univariate
|
||||
Distribution of the cosine of the polar angle
|
||||
phi : Univariate
|
||||
Distribution of the azimuthal angle in radians
|
||||
reference_uvw : Iterable of Real
|
||||
Direction from which polar angle is measured. Defaults to the positive
|
||||
z-direction.
|
||||
|
||||
Attributes
|
||||
----------
|
||||
mu : Univariate
|
||||
Distribution of the cosine of the polar angle
|
||||
phi : Univariate
|
||||
Distribution of the azimuthal angle in radians
|
||||
|
||||
"""
|
||||
|
||||
def __init__(self, mu=None, phi=None, reference_uvw=[0., 0., 1.]):
|
||||
super(PolarAzimuthal, self).__init__(reference_uvw)
|
||||
if mu is not None:
|
||||
self.mu = mu
|
||||
else:
|
||||
self.mu = Uniform(-1., 1.)
|
||||
|
||||
if phi is not None:
|
||||
self.phi = phi
|
||||
else:
|
||||
self.phi = Uniform(0., 2*pi)
|
||||
|
||||
@property
|
||||
def mu(self):
|
||||
return self._mu
|
||||
|
||||
@property
|
||||
def phi(self):
|
||||
return self._phi
|
||||
|
||||
@mu.setter
|
||||
def mu(self, mu):
|
||||
cv.check_type('cosine of polar angle', mu, Univariate)
|
||||
self._mu = mu
|
||||
|
||||
@phi.setter
|
||||
def phi(self, phi):
|
||||
cv.check_type('azimuthal angle', phi, Univariate)
|
||||
self._phi = phi
|
||||
|
||||
def to_xml(self):
|
||||
element = ET.Element('angle')
|
||||
element.set("type", "mu-phi")
|
||||
if self.reference_uvw is not None:
|
||||
element.set("reference_uvw", ' '.join(map(str, self.reference_uvw)))
|
||||
element.append(self.mu.to_xml('mu'))
|
||||
element.append(self.phi.to_xml('phi'))
|
||||
return element
|
||||
|
||||
|
||||
class Isotropic(UnitSphere):
|
||||
"""Isotropic angular distribution.
|
||||
|
||||
"""
|
||||
|
||||
def __init__(self):
|
||||
super(Isotropic, self).__init__()
|
||||
|
||||
def to_xml(self):
|
||||
element = ET.Element('angle')
|
||||
element.set("type", "isotropic")
|
||||
return element
|
||||
|
||||
|
||||
class Monodirectional(UnitSphere):
|
||||
"""Monodirectional angular distribution.
|
||||
|
||||
A monodirectional angular distribution is one for which the polar and
|
||||
azimuthal angles are always the same. It is completely specified by the
|
||||
reference direction vector.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
reference_uvw : Iterable of Real
|
||||
Direction from which polar angle is measured. Defaults to the positive
|
||||
x-direction.
|
||||
|
||||
"""
|
||||
|
||||
|
||||
def __init__(self, reference_uvw=[1., 0., 0.]):
|
||||
super(Monodirectional, self).__init__(reference_uvw)
|
||||
|
||||
def to_xml(self):
|
||||
element = ET.Element('angle')
|
||||
element.set("type", "monodirectional")
|
||||
if self.reference_uvw is not None:
|
||||
element.set("reference_uvw", ' '.join(map(str, self.reference_uvw)))
|
||||
return element
|
||||
|
||||
|
||||
class Spatial(object):
|
||||
"""Distribution of locations in three-dimensional Euclidean space.
|
||||
|
||||
Classes derived from this abstract class can be used for spatial
|
||||
distributions of source sites.
|
||||
|
||||
"""
|
||||
|
||||
__metaclass__ = ABCMeta
|
||||
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
def to_xml(self):
|
||||
return ''
|
||||
|
||||
|
||||
class CartesianIndependent(Spatial):
|
||||
"""Spatial distribution with independent x, y, and z distributions.
|
||||
|
||||
This distribution allows one to specify a coordinates whose x-, y-, and z-
|
||||
components are sampled independently from one another.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
x : Univariate
|
||||
Distribution of x-coordinates
|
||||
y : Univariate
|
||||
Distribution of y-coordinates
|
||||
z : Univariate
|
||||
Distribution of z-coordinates
|
||||
|
||||
Attributes
|
||||
----------
|
||||
x : Univariate
|
||||
Distribution of x-coordinates
|
||||
y : Univariate
|
||||
Distribution of y-coordinates
|
||||
z : Univariate
|
||||
Distribution of z-coordinates
|
||||
|
||||
"""
|
||||
|
||||
|
||||
def __init__(self, x, y, z):
|
||||
super(CartesianIndependent, self).__init__()
|
||||
self.x = x
|
||||
self.y = y
|
||||
self.z = z
|
||||
|
||||
@property
|
||||
def x(self):
|
||||
return self._x
|
||||
|
||||
@property
|
||||
def y(self):
|
||||
return self._y
|
||||
|
||||
@property
|
||||
def z(self):
|
||||
return self._z
|
||||
|
||||
@x.setter
|
||||
def x(self, x):
|
||||
cv.check_type('x coordinate', x, Univariate)
|
||||
self._x = x
|
||||
|
||||
@y.setter
|
||||
def y(self, y):
|
||||
cv.check_type('y coordinate', y, Univariate)
|
||||
self._y = y
|
||||
|
||||
@z.setter
|
||||
def z(self, z):
|
||||
cv.check_type('z coordinate', z, Univariate)
|
||||
self._z = z
|
||||
|
||||
def to_xml(self):
|
||||
element = ET.Element('space')
|
||||
element.set('type', 'cartesian')
|
||||
element.append(self.x.to_xml('x'))
|
||||
element.append(self.y.to_xml('y'))
|
||||
element.append(self.z.to_xml('z'))
|
||||
return element
|
||||
|
||||
|
||||
class Box(Spatial):
|
||||
"""Uniform distribution of coordinates in a rectangular cuboid.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
lower_left : Iterable of Real
|
||||
Lower-left coordinates of cuboid
|
||||
upper_right : Iterable of Real
|
||||
Upper-right coordinates of cuboid
|
||||
only_fissionable : bool, optional
|
||||
Whether spatial sites should only be accepted if they occur in
|
||||
fissionable materials
|
||||
|
||||
Attributes
|
||||
----------
|
||||
lower_left : Iterable of Real
|
||||
Lower-left coordinates of cuboid
|
||||
upper_right : Iterable of Real
|
||||
Upper-right coordinates of cuboid
|
||||
only_fissionable : bool, optional
|
||||
Whether spatial sites should only be accepted if they occur in
|
||||
fissionable materials
|
||||
|
||||
"""
|
||||
|
||||
|
||||
def __init__(self, lower_left, upper_right, only_fissionable=False):
|
||||
super(Box, self).__init__()
|
||||
self.lower_left = lower_left
|
||||
self.upper_right = upper_right
|
||||
self.only_fissionable = only_fissionable
|
||||
|
||||
@property
|
||||
def lower_left(self):
|
||||
return self._lower_left
|
||||
|
||||
@property
|
||||
def upper_right(self):
|
||||
return self._upper_right
|
||||
|
||||
@property
|
||||
def only_fissionable(self):
|
||||
return self._only_fissionable
|
||||
|
||||
@lower_left.setter
|
||||
def lower_left(self, lower_left):
|
||||
cv.check_type('lower left coordinate', lower_left, Iterable, Real)
|
||||
cv.check_length('lower left coordinate', lower_left, 3)
|
||||
self._lower_left = lower_left
|
||||
|
||||
@upper_right.setter
|
||||
def upper_right(self, upper_right):
|
||||
cv.check_type('upper right coordinate', upper_right, Iterable, Real)
|
||||
cv.check_length('upper right coordinate', upper_right, 3)
|
||||
self._upper_right = upper_right
|
||||
|
||||
@only_fissionable.setter
|
||||
def only_fissionable(self, only_fissionable):
|
||||
cv.check_type('only fissionable', only_fissionable, bool)
|
||||
self._only_fissionable = only_fissionable
|
||||
|
||||
def to_xml(self):
|
||||
element = ET.Element('space')
|
||||
if self.only_fissionable:
|
||||
element.set("type", "fission")
|
||||
else:
|
||||
element.set("type", "box")
|
||||
params = ET.SubElement(element, "parameters")
|
||||
params.text = ' '.join(map(str, self.lower_left)) + ' ' + \
|
||||
' '.join(map(str, self.upper_right))
|
||||
return element
|
||||
|
||||
|
||||
class Point(Spatial):
|
||||
"""Delta function in three dimensions.
|
||||
|
||||
This spatial distribution can be used for a point source where sites are
|
||||
emitted at a specific location given by its Cartesian coordinates.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
xyz : Iterable of Real
|
||||
Cartesian coordinates of location
|
||||
|
||||
Attributes
|
||||
----------
|
||||
xyz : Iterable of Real
|
||||
Cartesian coordinates of location
|
||||
|
||||
"""
|
||||
|
||||
def __init__(self, xyz):
|
||||
super(Point, self).__init__()
|
||||
self.xyz = xyz
|
||||
|
||||
@property
|
||||
def xyz(self):
|
||||
return self._xyz
|
||||
|
||||
@xyz.setter
|
||||
def xyz(self, xyz):
|
||||
cv.check_type('coordinate', xyz, Iterable, Real)
|
||||
cv.check_length('coordinate', xyz, 3)
|
||||
self._xyz = xyz
|
||||
|
||||
def to_xml(self):
|
||||
element = ET.Element('space')
|
||||
element.set("type", "point")
|
||||
params = ET.SubElement(element, "parameters")
|
||||
params.text = ' '.join(map(str, self.xyz))
|
||||
return element
|
||||
310
openmc/stats/univariate.py
Normal file
310
openmc/stats/univariate.py
Normal file
|
|
@ -0,0 +1,310 @@
|
|||
from abc import ABCMeta, abstractmethod
|
||||
from collections import Iterable
|
||||
from numbers import Real
|
||||
import sys
|
||||
from xml.etree import ElementTree as ET
|
||||
|
||||
import openmc.checkvalue as cv
|
||||
|
||||
if sys.version_info[0] >= 3:
|
||||
basestring = str
|
||||
|
||||
|
||||
class Univariate(object):
|
||||
"""Probability distribution of a single random variable.
|
||||
|
||||
The Univariate class is an abstract class that can be derived to implement a
|
||||
specific probability distribution.
|
||||
|
||||
"""
|
||||
|
||||
__metaclass__ = ABCMeta
|
||||
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
def to_xml(self):
|
||||
return ''
|
||||
|
||||
|
||||
class Discrete(Univariate):
|
||||
"""Distribution characterized by a probability mass function.
|
||||
|
||||
The Discrete distribution assigns probability values to discrete values of a
|
||||
random variable, rather than expressing the distribution as a continuous
|
||||
random variable.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
x : Iterable of Real
|
||||
Values of the random variable
|
||||
p : Iterable of Real
|
||||
Discrete probability for each value
|
||||
|
||||
Attributes
|
||||
----------
|
||||
x : Iterable of Real
|
||||
Values of the random variable
|
||||
p : Iterable of Real
|
||||
Discrete probability for each value
|
||||
|
||||
"""
|
||||
|
||||
def __init__(self, x, p):
|
||||
super(Discrete, self).__init__()
|
||||
self.x = x
|
||||
self.p = p
|
||||
|
||||
@property
|
||||
def x(self):
|
||||
return self._x
|
||||
|
||||
@property
|
||||
def p(self):
|
||||
return self._p
|
||||
|
||||
@x.setter
|
||||
def x(self, x):
|
||||
if cv._isinstance(x, Real):
|
||||
x = [x]
|
||||
cv.check_type('discrete values', x, Iterable, Real)
|
||||
self._x = x
|
||||
|
||||
@p.setter
|
||||
def p(self, p):
|
||||
if cv._isinstance(p, Real):
|
||||
p = [p]
|
||||
cv.check_type('discrete probabilities', p, Iterable, Real)
|
||||
for pk in p:
|
||||
cv.check_greater_than('discrete probability', pk, 0.0, True)
|
||||
self._p = p
|
||||
|
||||
def to_xml(self, element_name):
|
||||
element = ET.Element(element_name)
|
||||
element.set("type", "discrete")
|
||||
|
||||
params = ET.SubElement(element, "parameters")
|
||||
params.text = ' '.join(map(str, self.x)) + ' ' + ' '.join(map(str, self.p))
|
||||
|
||||
return element
|
||||
|
||||
|
||||
class Uniform(Univariate):
|
||||
"""Distribution with constant probability over a finite interval [a,b]
|
||||
|
||||
Parameters
|
||||
----------
|
||||
a : float, optional
|
||||
Lower bound of the sampling interval. Defaults to zero.
|
||||
b : float, optional
|
||||
Upper bound of the sampling interval. Defaults to unity.
|
||||
|
||||
Attributes
|
||||
----------
|
||||
a : float
|
||||
Lower bound of the sampling interval
|
||||
b : float
|
||||
Upper bound of the sampling interval
|
||||
|
||||
"""
|
||||
|
||||
def __init__(self, a=0.0, b=1.0):
|
||||
super(Uniform, self).__init__()
|
||||
self.a = a
|
||||
self.b = b
|
||||
|
||||
@property
|
||||
def a(self):
|
||||
return self._a
|
||||
|
||||
@property
|
||||
def b(self):
|
||||
return self._b
|
||||
|
||||
@a.setter
|
||||
def a(self, a):
|
||||
cv.check_type('Uniform a', a, Real)
|
||||
self._a = a
|
||||
|
||||
@b.setter
|
||||
def b(self, b):
|
||||
cv.check_type('Uniform b', b, Real)
|
||||
self._b = b
|
||||
|
||||
def to_xml(self, element_name):
|
||||
element = ET.Element(element_name)
|
||||
element.set("type", "uniform")
|
||||
element.set("parameters", '{} {}'.format(self.a, self.b))
|
||||
return element
|
||||
|
||||
|
||||
class Maxwell(Univariate):
|
||||
"""Maxwellian distribution in energy.
|
||||
|
||||
The Maxwellian distribution in energy is characterized by a single parameter
|
||||
:math:`\theta` and has a density function :math:`p(E) dE = c E e^{-E/\theta}
|
||||
dE`.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
theta : float
|
||||
Effective temperature for distribution
|
||||
|
||||
Attributes
|
||||
----------
|
||||
theta : float
|
||||
Effective temperature for distribution
|
||||
|
||||
"""
|
||||
|
||||
def __init__(self, theta):
|
||||
super(Maxwell, self).__init__()
|
||||
self.theta = theta
|
||||
|
||||
@property
|
||||
def theta(self):
|
||||
return self._theta
|
||||
|
||||
@theta.setter
|
||||
def theta(self, theta):
|
||||
cv.check_type('Maxwell temperature', theta, Real)
|
||||
cv.check_greater_than('Maxwell temperature', theta, 0.0)
|
||||
self._theta = theta
|
||||
|
||||
def to_xml(self, element_name):
|
||||
element = ET.Element(element_name)
|
||||
element.set("type", "maxwell")
|
||||
element.set("parameters", str(self.theta))
|
||||
return element
|
||||
|
||||
|
||||
class Watt(Univariate):
|
||||
"""Watt fission energy spectrum.
|
||||
|
||||
The Watt fission energy spectrum is characterized by two parameters
|
||||
:math:`a` and :math:`b` and has density function :math:`p(E) dE = c e^{-E/a}
|
||||
\sinh \sqrt{b \, E} dE`.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
a : float
|
||||
First parameter of distribution
|
||||
b : float
|
||||
Second parameter of distribution
|
||||
|
||||
Attributes
|
||||
----------
|
||||
a : float
|
||||
First parameter of distribution
|
||||
b : float
|
||||
Second parameter of distribution
|
||||
|
||||
"""
|
||||
|
||||
def __init__(self, a=0.988, b=2.249):
|
||||
super(Watt, self).__init__()
|
||||
self.a = a
|
||||
self.b = b
|
||||
|
||||
@property
|
||||
def a(self):
|
||||
return self._a
|
||||
|
||||
@property
|
||||
def b(self):
|
||||
return self._b
|
||||
|
||||
@a.setter
|
||||
def a(self, a):
|
||||
cv.check_type('Watt a', a, Real)
|
||||
cv.check_greater_than('Watt a', a, 0.0)
|
||||
self._a = a
|
||||
|
||||
@b.setter
|
||||
def b(self, b):
|
||||
cv.check_type('Watt b', b, Real)
|
||||
cv.check_greater_than('Watt b', b, 0.0)
|
||||
self._b = b
|
||||
|
||||
def to_xml(self, element_name):
|
||||
element = ET.Element(element_name)
|
||||
element.set("type", "watt")
|
||||
element.set("parameters", '{} {}'.format(self.a, self.b))
|
||||
return element
|
||||
|
||||
|
||||
class Tabular(Univariate):
|
||||
"""Piecewise continuous probability distribution.
|
||||
|
||||
This class is used to represent a probability distribution whose density
|
||||
function is tabulated at specific values and is either histogram or linearly
|
||||
interpolated between points.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
x : Iterable of Real
|
||||
Tabulated values of the random variable
|
||||
p : Iterable of Real
|
||||
Tabulated probabilities
|
||||
interpolation : {'histogram', 'linear-linear'}, optional
|
||||
Indicate whether the density function is constant between tabulated
|
||||
points or linearly-interpolated.
|
||||
|
||||
Attributes
|
||||
----------
|
||||
x : Iterable of Real
|
||||
Tabulated values of the random variable
|
||||
p : Iterable of Real
|
||||
Tabulated probabilities
|
||||
interpolation : {'histogram', 'linear-linear'}, optional
|
||||
Indicate whether the density function is constant between tabulated
|
||||
points or linearly-interpolated.
|
||||
|
||||
"""
|
||||
|
||||
def __init__(self, x, p, interpolation='linear-linear'):
|
||||
super(Tabular, self).__init__()
|
||||
self.x = x
|
||||
self.p = p
|
||||
self.interpolation = interpolation
|
||||
|
||||
@property
|
||||
def x(self):
|
||||
return self._x
|
||||
|
||||
@property
|
||||
def p(self):
|
||||
return self._p
|
||||
|
||||
@property
|
||||
def interpolation(self):
|
||||
return self._interpolation
|
||||
|
||||
@x.setter
|
||||
def x(self, x):
|
||||
cv.check_type('tabulated values', x, Iterable, Real)
|
||||
self._x = x
|
||||
|
||||
@p.setter
|
||||
def p(self, p):
|
||||
cv.check_type('tabulated probabilities', p, Iterable, Real)
|
||||
for pk in p:
|
||||
cv.check_greater_than('tabulated probability', pk, 0.0, True)
|
||||
self._p = p
|
||||
|
||||
@interpolation.setter
|
||||
def interpolation(self, interpolation):
|
||||
cv.check_value('interpolation', interpolation,
|
||||
['linear-linear', 'histogram'])
|
||||
self._interpolation = interpolation
|
||||
|
||||
def to_xml(self, element_name):
|
||||
element = ET.Element(element_name)
|
||||
element.set("type", "tabular")
|
||||
element.set("interpolation", self.interpolation)
|
||||
|
||||
params = ET.SubElement(element, "parameters")
|
||||
params.text = ' '.join(map(str, self.x)) + ' ' + ' '.join(map(str, self.p))
|
||||
|
||||
return element
|
||||
2
setup.py
2
setup.py
|
|
@ -11,7 +11,7 @@ except ImportError:
|
|||
|
||||
kwargs = {'name': 'openmc',
|
||||
'version': '0.7.1',
|
||||
'packages': ['openmc', 'openmc.mgxs'],
|
||||
'packages': ['openmc', 'openmc.mgxs', 'openmc.stats'],
|
||||
'scripts': glob.glob('scripts/openmc-*'),
|
||||
|
||||
# Metadata
|
||||
|
|
|
|||
|
|
@ -360,28 +360,6 @@ module constants
|
|||
integer, parameter :: STREAM_TALLIES = 2
|
||||
integer, parameter :: STREAM_SOURCE = 3
|
||||
|
||||
! ============================================================================
|
||||
! EXTERNAL SOURCE PARAMETERS
|
||||
|
||||
! Source spatial distribution types
|
||||
integer, parameter :: &
|
||||
SRC_SPACE_BOX = 1, & ! Source in a rectangular prism
|
||||
SRC_SPACE_POINT = 2, & ! Source at a single point
|
||||
SRC_SPACE_FISSION = 3 ! Source in prism filtered by fissionable mats
|
||||
|
||||
! Source angular distribution types
|
||||
integer, parameter :: &
|
||||
SRC_ANGLE_ISOTROPIC = 1, & ! Isotropic angular
|
||||
SRC_ANGLE_MONO = 2, & ! Monodirectional source
|
||||
SRC_ANGLE_TABULAR = 3 ! Tabular distribution
|
||||
|
||||
! Source energy distribution types
|
||||
integer, parameter :: &
|
||||
SRC_ENERGY_MONO = 1, & ! Monoenergetic source
|
||||
SRC_ENERGY_MAXWELL = 2, & ! Maxwell fission spectrum
|
||||
SRC_ENERGY_WATT = 3, & ! Watt fission spectrum
|
||||
SRC_ENERGY_TABULAR = 4 ! Tabular distribution
|
||||
|
||||
! ============================================================================
|
||||
! MISCELLANEOUS CONSTANTS
|
||||
|
||||
|
|
|
|||
162
src/distribution_multivariate.F90
Normal file
162
src/distribution_multivariate.F90
Normal file
|
|
@ -0,0 +1,162 @@
|
|||
module distribution_multivariate
|
||||
|
||||
use constants, only: ONE, TWO, PI
|
||||
use distribution_univariate, only: Distribution
|
||||
use math, only: rotate_angle
|
||||
use random_lcg, only: prn
|
||||
|
||||
implicit none
|
||||
|
||||
!===============================================================================
|
||||
! UNITSPHEREDISTRIBUTION type defines a probability density function for points
|
||||
! on the unit sphere. Extensions of this type are used to sample angular
|
||||
! distributions for starting sources
|
||||
!===============================================================================
|
||||
|
||||
type, abstract :: UnitSphereDistribution
|
||||
real(8) :: reference_uvw(3)
|
||||
contains
|
||||
procedure(iSample), deferred :: sample
|
||||
end type UnitSphereDistribution
|
||||
|
||||
abstract interface
|
||||
function iSample(this) result(uvw)
|
||||
import UnitSphereDistribution
|
||||
class(UnitSphereDistribution), intent(in) :: this
|
||||
real(8) :: uvw(3)
|
||||
end function iSample
|
||||
end interface
|
||||
|
||||
!===============================================================================
|
||||
! Derived classes of UnitSphereDistribution
|
||||
!===============================================================================
|
||||
|
||||
! Explicit distribution of polar and azimuthal angles
|
||||
type, extends(UnitSphereDistribution) :: PolarAzimuthal
|
||||
class(Distribution), allocatable :: mu
|
||||
class(Distribution), allocatable :: phi
|
||||
contains
|
||||
procedure :: sample => polar_azimuthal_sample
|
||||
end type PolarAzimuthal
|
||||
|
||||
! Uniform distribution on the unit sphere
|
||||
type, extends(UnitSphereDistribution) :: Isotropic
|
||||
contains
|
||||
procedure :: sample => isotropic_sample
|
||||
end type Isotropic
|
||||
|
||||
! Monodirectional distribution
|
||||
type, extends(UnitSphereDistribution) :: Monodirectional
|
||||
contains
|
||||
procedure :: sample => monodirectional_sample
|
||||
end type Monodirectional
|
||||
|
||||
!===============================================================================
|
||||
! SPATIALDISTRIBUTION type defines a probability density function for arbitrary
|
||||
! points in Euclidean space.
|
||||
!===============================================================================
|
||||
|
||||
type, abstract :: SpatialDistribution
|
||||
contains
|
||||
procedure(iSampleSpatial), deferred :: sample
|
||||
end type SpatialDistribution
|
||||
|
||||
abstract interface
|
||||
function iSampleSpatial(this) result(xyz)
|
||||
import SpatialDistribution
|
||||
class(SpatialDistribution), intent(in) :: this
|
||||
real(8) :: xyz(3)
|
||||
end function iSampleSpatial
|
||||
end interface
|
||||
|
||||
type, extends(SpatialDistribution) :: CartesianIndependent
|
||||
class(Distribution), allocatable :: x
|
||||
class(Distribution), allocatable :: y
|
||||
class(Distribution), allocatable :: z
|
||||
contains
|
||||
procedure :: sample => cartesian_independent_sample
|
||||
end type CartesianIndependent
|
||||
|
||||
type, extends(SpatialDistribution) :: SpatialBox
|
||||
real(8) :: lower_left(3)
|
||||
real(8) :: upper_right(3)
|
||||
logical :: only_fissionable = .false.
|
||||
contains
|
||||
procedure :: sample => spatial_box_sample
|
||||
end type SpatialBox
|
||||
|
||||
type, extends(SpatialDistribution) :: SpatialPoint
|
||||
real(8) :: xyz(3)
|
||||
contains
|
||||
procedure :: sample => spatial_point_sample
|
||||
end type SpatialPoint
|
||||
|
||||
contains
|
||||
|
||||
function polar_azimuthal_sample(this) result(uvw)
|
||||
class(PolarAzimuthal), intent(in) :: this
|
||||
real(8) :: uvw(3)
|
||||
|
||||
real(8) :: mu ! cosine of polar angle
|
||||
real(8) :: phi ! azimuthal angle
|
||||
|
||||
! Sample cosine of polar angle
|
||||
mu = this % mu % sample()
|
||||
if (mu == ONE) then
|
||||
uvw(:) = this % reference_uvw
|
||||
else
|
||||
! Sample azimuthal angle
|
||||
phi = this % phi % sample()
|
||||
uvw(:) = rotate_angle(this % reference_uvw, mu, phi)
|
||||
end if
|
||||
end function polar_azimuthal_sample
|
||||
|
||||
function isotropic_sample(this) result(uvw)
|
||||
class(Isotropic), intent(in) :: this
|
||||
real(8) :: uvw(3)
|
||||
|
||||
real(8) :: phi
|
||||
real(8) :: mu
|
||||
|
||||
phi = TWO*PI*prn()
|
||||
mu = TWO*prn() - ONE
|
||||
uvw(1) = mu
|
||||
uvw(2) = sqrt(ONE - mu*mu) * cos(phi)
|
||||
uvw(3) = sqrt(ONE - mu*mu) * sin(phi)
|
||||
end function isotropic_sample
|
||||
|
||||
function monodirectional_sample(this) result(uvw)
|
||||
class(Monodirectional), intent(in) :: this
|
||||
real(8) :: uvw(3)
|
||||
|
||||
uvw(:) = this % reference_uvw
|
||||
end function monodirectional_sample
|
||||
|
||||
function cartesian_independent_sample(this) result(xyz)
|
||||
class(CartesianIndependent), intent(in) :: this
|
||||
real(8) :: xyz(3)
|
||||
|
||||
xyz(1) = this % x % sample()
|
||||
xyz(2) = this % y % sample()
|
||||
xyz(3) = this % z % sample()
|
||||
end function cartesian_independent_sample
|
||||
|
||||
function spatial_box_sample(this) result(xyz)
|
||||
class(SpatialBox), intent(in) :: this
|
||||
real(8) :: xyz(3)
|
||||
|
||||
integer :: i
|
||||
real(8) :: r(3)
|
||||
|
||||
r = [ (prn(), i = 1,3) ]
|
||||
xyz(:) = this % lower_left + r*(this % upper_right - this % lower_left)
|
||||
end function spatial_box_sample
|
||||
|
||||
function spatial_point_sample(this) result(xyz)
|
||||
class(SpatialPoint), intent(in) :: this
|
||||
real(8) :: xyz(3)
|
||||
|
||||
xyz(:) = this % xyz
|
||||
end function spatial_point_sample
|
||||
|
||||
end module distribution_multivariate
|
||||
347
src/distribution_univariate.F90
Normal file
347
src/distribution_univariate.F90
Normal file
|
|
@ -0,0 +1,347 @@
|
|||
module distribution_univariate
|
||||
|
||||
use constants, only: ZERO, HALF, HISTOGRAM, LINEAR_LINEAR, MAX_LINE_LEN, &
|
||||
MAX_WORD_LEN
|
||||
use error, only: fatal_error
|
||||
use math, only: maxwell_spectrum, watt_spectrum
|
||||
use random_lcg, only: prn
|
||||
use string, only: to_lower
|
||||
use xml_interface
|
||||
|
||||
implicit none
|
||||
|
||||
!===============================================================================
|
||||
! DISTRIBUTION type defines a probability density function
|
||||
!===============================================================================
|
||||
|
||||
type, abstract :: Distribution
|
||||
contains
|
||||
procedure(iSample), deferred :: sample
|
||||
end type Distribution
|
||||
|
||||
type DistributionContainer
|
||||
class(Distribution), allocatable :: obj
|
||||
end type DistributionContainer
|
||||
|
||||
abstract interface
|
||||
function iSample(this) result(x)
|
||||
import Distribution
|
||||
class(Distribution), intent(in) :: this
|
||||
real(8) :: x
|
||||
end function iSample
|
||||
end interface
|
||||
|
||||
!===============================================================================
|
||||
! Derived classes of Distribution
|
||||
!===============================================================================
|
||||
|
||||
! Discrete distribution
|
||||
type, extends(Distribution) :: Discrete
|
||||
real(8), allocatable :: x(:)
|
||||
real(8), allocatable :: p(:)
|
||||
contains
|
||||
procedure :: sample => discrete_sample
|
||||
procedure :: initialize => discrete_initialize
|
||||
end type Discrete
|
||||
|
||||
! Uniform distribution over the interval [a,b]
|
||||
type, extends(Distribution) :: Uniform
|
||||
real(8) :: a
|
||||
real(8) :: b
|
||||
contains
|
||||
procedure :: sample => uniform_sample
|
||||
end type Uniform
|
||||
|
||||
! Maxwellian distribution of form c*E*exp(-E/a)
|
||||
type, extends(Distribution) :: Maxwell
|
||||
real(8) :: theta
|
||||
contains
|
||||
procedure :: sample => maxwell_sample
|
||||
end type Maxwell
|
||||
|
||||
! Watt fission spectrum with form c*exp(-E/a)*sinh(sqrt(b*E))
|
||||
type, extends(Distribution) :: Watt
|
||||
real(8) :: a
|
||||
real(8) :: b
|
||||
contains
|
||||
procedure :: sample => watt_sample
|
||||
end type Watt
|
||||
|
||||
! Histogram or linear-linear interpolated tabular distribution
|
||||
type, extends(Distribution) :: Tabular
|
||||
integer :: interpolation
|
||||
real(8), allocatable :: x(:) ! tabulated independent variable
|
||||
real(8), allocatable :: p(:) ! tabulated probability density
|
||||
real(8), allocatable :: c(:) ! cumulative distribution at tabulated values
|
||||
contains
|
||||
procedure :: sample => tabular_sample
|
||||
procedure :: initialize => tabular_initialize
|
||||
end type Tabular
|
||||
|
||||
contains
|
||||
|
||||
function discrete_sample(this) result(x)
|
||||
class(Discrete), intent(in) :: this
|
||||
real(8) :: x
|
||||
|
||||
integer :: i ! loop counter
|
||||
integer :: n ! size of distribution
|
||||
real(8) :: c ! cumulative frequency
|
||||
real(8) :: xi ! sampled CDF value
|
||||
|
||||
n = size(this%x)
|
||||
if (n > 1) then
|
||||
xi = prn()
|
||||
c = ZERO
|
||||
do i = 1, size(this%x)
|
||||
c = c + this%p(i)
|
||||
if (xi < c) exit
|
||||
end do
|
||||
x = this%x(i)
|
||||
else
|
||||
x = this%x(1)
|
||||
end if
|
||||
end function discrete_sample
|
||||
|
||||
subroutine discrete_initialize(this, x, p)
|
||||
class(Discrete), intent(inout) :: this
|
||||
real(8), intent(in) :: x(:)
|
||||
real(8), intent(in) :: p(:)
|
||||
|
||||
integer :: n
|
||||
|
||||
! Check length of x, p arrays
|
||||
if (size(x) /= size(p)) then
|
||||
call fatal_error('Tabulated probabilities not of same length as &
|
||||
&independent variable.')
|
||||
end if
|
||||
|
||||
! Copy probability density function
|
||||
n = size(x)
|
||||
allocate(this%x(n), this%p(n))
|
||||
this%x(:) = x(:)
|
||||
this%p(:) = p(:)
|
||||
|
||||
! Normalize density function
|
||||
this%p(:) = this%p(:)/sum(this%p)
|
||||
end subroutine
|
||||
|
||||
function uniform_sample(this) result(x)
|
||||
class(Uniform), intent(in) :: this
|
||||
real(8) :: x
|
||||
|
||||
x = this%a + prn()*(this%b - this%a)
|
||||
end function uniform_sample
|
||||
|
||||
function maxwell_sample(this) result(x)
|
||||
class(Maxwell), intent(in) :: this
|
||||
real(8) :: x
|
||||
|
||||
x = maxwell_spectrum(this%theta)
|
||||
end function maxwell_sample
|
||||
|
||||
function watt_sample(this) result(x)
|
||||
class(Watt), intent(in) :: this
|
||||
real(8) :: x
|
||||
|
||||
x = watt_spectrum(this%a, this%b)
|
||||
end function watt_sample
|
||||
|
||||
function tabular_sample(this) result(x)
|
||||
class(Tabular), intent(in) :: this
|
||||
real(8) :: x
|
||||
|
||||
integer :: i
|
||||
real(8) :: c ! sampled cumulative frequency
|
||||
real(8) :: m ! slope of PDF
|
||||
real(8) :: x_i, x_i1 ! i-th and (i+1)th x values
|
||||
real(8) :: c_i, c_i1 ! i-th and (i+1)th cumulative distribution values
|
||||
real(8) :: p_i, p_i1 ! i-th and (i+1)th probability density values
|
||||
|
||||
! Sample value of CDF
|
||||
c = prn()
|
||||
|
||||
! Find first CDF bin which is above the sampled value
|
||||
c_i = this%c(1)
|
||||
do i = 1, size(this%c) - 1
|
||||
c_i1 = this%c(i + 1)
|
||||
if (c <= c_i1) exit
|
||||
c_i = c_i1
|
||||
end do
|
||||
|
||||
! Determine bounding PDF values
|
||||
x_i = this%x(i)
|
||||
p_i = this%p(i)
|
||||
|
||||
if (this%interpolation == HISTOGRAM) then
|
||||
! Histogram interpolation
|
||||
if (p_i > ZERO) then
|
||||
x = x_i + (c - c_i)/p_i
|
||||
else
|
||||
x = x_i
|
||||
end if
|
||||
else
|
||||
! Linear-linear interpolation
|
||||
x_i1 = this%x(i + 1)
|
||||
p_i1 = this%p(i + 1)
|
||||
|
||||
m = (p_i1 - p_i)/(x_i1 - x_i)
|
||||
if (m == ZERO) then
|
||||
x = x_i + (c - c_i)/p_i
|
||||
else
|
||||
x = x_i + (sqrt(max(ZERO, p_i*p_i + 2*m*(c - c_i))) - p_i)/m
|
||||
end if
|
||||
end if
|
||||
end function tabular_sample
|
||||
|
||||
subroutine tabular_initialize(this, x, p, interp)
|
||||
class(Tabular), intent(inout) :: this
|
||||
real(8), intent(in) :: x(:)
|
||||
real(8), intent(in) :: p(:)
|
||||
integer, intent(in) :: interp
|
||||
|
||||
integer :: i
|
||||
integer :: n
|
||||
|
||||
! Check interpolation parameter
|
||||
if (interp /= HISTOGRAM .and. interp /= LINEAR_LINEAR) then
|
||||
call fatal_error('Only histogram and linear-linear interpolation for tabular &
|
||||
&distribution is supported.')
|
||||
end if
|
||||
|
||||
! Check length of x, p arrays
|
||||
if (size(x) /= size(p)) then
|
||||
call fatal_error('Tabulated probabilities not of same length as &
|
||||
&independent variable.')
|
||||
end if
|
||||
|
||||
! Copy probability density function and interpolation parameter
|
||||
n = size(x)
|
||||
allocate(this%x(n), this%p(n), this%c(n))
|
||||
this%interpolation = interp
|
||||
this%x(:) = x(:)
|
||||
this%p(:) = p(:)
|
||||
|
||||
! Calculate cumulative distribution function
|
||||
this%c(1) = ZERO
|
||||
do i = 2, n
|
||||
if (this%interpolation == HISTOGRAM) then
|
||||
this%c(i) = this%c(i-1) + this%p(i-1)*(this%x(i) - this%x(i-1))
|
||||
elseif (this%interpolation == LINEAR_LINEAR) then
|
||||
this%c(i) = this%c(i-1) + HALF*(this%p(i-1) + this%p(i)) * &
|
||||
(this%x(i) - this%x(i-1))
|
||||
end if
|
||||
end do
|
||||
|
||||
! Normalize density and distribution functions
|
||||
this%p(:) = this%p(:)/this%c(n)
|
||||
this%c(:) = this%c(:)/this%c(n)
|
||||
end subroutine tabular_initialize
|
||||
|
||||
subroutine distribution_from_xml(dist, node_dist)
|
||||
class(Distribution), allocatable, intent(inout) :: dist
|
||||
type(Node), pointer :: node_dist
|
||||
|
||||
character(MAX_WORD_LEN) :: type
|
||||
character(MAX_LINE_LEN) :: temp_str
|
||||
integer :: n
|
||||
integer :: temp_int
|
||||
real(8), allocatable :: temp_real(:)
|
||||
|
||||
if (check_for_node(node_dist, "type")) then
|
||||
! Determine type of distribution
|
||||
call get_node_value(node_dist, "type", type)
|
||||
|
||||
! Determine number of parameters specified
|
||||
if (check_for_node(node_dist, "parameters")) then
|
||||
n = get_arraysize_double(node_dist, "parameters")
|
||||
else
|
||||
n = 0
|
||||
end if
|
||||
|
||||
! Allocate extension of Distribution
|
||||
select case (to_lower(type))
|
||||
case ('uniform')
|
||||
allocate(Uniform :: dist)
|
||||
if (n /= 2) then
|
||||
call fatal_error('Uniform distribution must have two &
|
||||
¶meters specified.')
|
||||
end if
|
||||
|
||||
case ('maxwell')
|
||||
allocate(Maxwell :: dist)
|
||||
if (n /= 1) then
|
||||
call fatal_error('Maxwell energy distribution must have one &
|
||||
¶meter specified.')
|
||||
end if
|
||||
|
||||
case ('watt')
|
||||
allocate(Watt :: dist)
|
||||
if (n /= 2) then
|
||||
call fatal_error('Watt energy distribution must have two &
|
||||
¶meters specified.')
|
||||
end if
|
||||
|
||||
case ('discrete')
|
||||
allocate(Discrete :: dist)
|
||||
|
||||
case ('tabular')
|
||||
allocate(Tabular :: dist)
|
||||
|
||||
case default
|
||||
call fatal_error('Invalid distribution type: ' // trim(type) // '.')
|
||||
|
||||
end select
|
||||
|
||||
! Read parameters and interpolation for distribution
|
||||
select type (dist)
|
||||
type is (Uniform)
|
||||
allocate(temp_real(2))
|
||||
call get_node_array(node_dist, "parameters", temp_real)
|
||||
dist%a = temp_real(1)
|
||||
dist%b = temp_real(2)
|
||||
deallocate(temp_real)
|
||||
|
||||
type is (Maxwell)
|
||||
call get_node_value(node_dist, "parameters", dist%theta)
|
||||
|
||||
type is (Watt)
|
||||
allocate(temp_real(2))
|
||||
call get_node_array(node_dist, "parameters", temp_real)
|
||||
dist%a = temp_real(1)
|
||||
dist%b = temp_real(2)
|
||||
deallocate(temp_real)
|
||||
|
||||
type is (Discrete)
|
||||
allocate(temp_real(n))
|
||||
call get_node_array(node_dist, "parameters", temp_real)
|
||||
call dist%initialize(temp_real(1:n/2), temp_real(n/2+1:n))
|
||||
deallocate(temp_real)
|
||||
|
||||
type is (Tabular)
|
||||
! Read interpolation
|
||||
if (check_for_node(node_dist, "interpolation")) then
|
||||
call get_node_value(node_dist, "interpolation", temp_str)
|
||||
select case(to_lower(temp_str))
|
||||
case ('histogram')
|
||||
temp_int = HISTOGRAM
|
||||
case ('linear-linear')
|
||||
temp_int = LINEAR_LINEAR
|
||||
case default
|
||||
call fatal_error("Unknown interpolation type for distribution: " &
|
||||
// trim(temp_str))
|
||||
end select
|
||||
else
|
||||
temp_int = HISTOGRAM
|
||||
end if
|
||||
|
||||
! Read and initialize tabular distribution
|
||||
allocate(temp_real(n))
|
||||
call get_node_array(node_dist, "parameters", temp_real)
|
||||
call dist%initialize(temp_real(1:n/2), temp_real(n/2+1:n), temp_int)
|
||||
deallocate(temp_real)
|
||||
end select
|
||||
end if
|
||||
end subroutine distribution_from_xml
|
||||
|
||||
end module distribution_univariate
|
||||
|
|
@ -3,8 +3,6 @@ module error
|
|||
use, intrinsic :: ISO_FORTRAN_ENV
|
||||
use constants
|
||||
|
||||
use global
|
||||
|
||||
#ifdef MPI
|
||||
use message_passing
|
||||
#endif
|
||||
|
|
@ -87,6 +85,9 @@ contains
|
|||
integer :: line_wrap ! length of line
|
||||
integer :: length ! length of message
|
||||
integer :: indent ! length of indentation
|
||||
#ifdef MPI
|
||||
integer :: mpi_err
|
||||
#endif
|
||||
|
||||
|
||||
! set default error code
|
||||
|
|
@ -136,16 +137,6 @@ contains
|
|||
end if
|
||||
end do
|
||||
|
||||
! Write information on current batch, generation, and particle
|
||||
if (current_batch > 0) then
|
||||
write(ERROR_UNIT,'(1X,A,I12) ') 'Batch: ', current_batch
|
||||
write(ERROR_UNIT,'(1X,A,I12) ') 'Generation:', current_gen
|
||||
write(ERROR_UNIT,*)
|
||||
end if
|
||||
|
||||
! Release memory from all allocatable arrays
|
||||
call free_memory()
|
||||
|
||||
#ifdef MPI
|
||||
! Abort MPI
|
||||
call MPI_ABORT(MPI_COMM_WORLD, code, mpi_err)
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ module global
|
|||
use plot_header, only: ObjectPlot
|
||||
use set_header, only: SetInt
|
||||
use surface_header, only: SurfaceContainer
|
||||
use source_header, only: ExtSource
|
||||
use source_header, only: SourceDistribution
|
||||
use tally_header, only: TallyObject, TallyMap, TallyResult
|
||||
use trigger_header, only: KTrigger
|
||||
use timer_header, only: Timer
|
||||
|
|
@ -182,7 +182,7 @@ module global
|
|||
logical :: satisfy_triggers = .false. ! whether triggers are satisfied
|
||||
|
||||
! External source
|
||||
type(ExtSource), target :: external_source
|
||||
type(SourceDistribution), allocatable :: external_source(:)
|
||||
|
||||
! Source and fission bank
|
||||
type(Bank), allocatable, target :: source_bank(:)
|
||||
|
|
@ -289,9 +289,6 @@ module global
|
|||
character(MAX_FILE_LEN) :: path_particle_restart ! Path to particle restart
|
||||
character(MAX_FILE_LEN) :: path_output = '' ! Path to output directory
|
||||
|
||||
! Random number seed
|
||||
integer(8) :: seed = 1_8
|
||||
|
||||
! The verbosity controls how much information will be printed to the
|
||||
! screen and in logs
|
||||
integer :: verbosity = 7
|
||||
|
|
@ -453,12 +450,7 @@ contains
|
|||
if (allocated(micro_xs)) deallocate(micro_xs)
|
||||
|
||||
! Deallocate external source
|
||||
if (allocated(external_source % params_space)) &
|
||||
deallocate(external_source % params_space)
|
||||
if (allocated(external_source % params_angle)) &
|
||||
deallocate(external_source % params_angle)
|
||||
if (allocated(external_source % params_energy)) &
|
||||
deallocate(external_source % params_energy)
|
||||
if (allocated(external_source)) deallocate(external_source)
|
||||
|
||||
! Deallocate k and entropy
|
||||
if (allocated(k_generation)) deallocate(k_generation)
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@ module input_xml
|
|||
use cmfd_input, only: configure_cmfd
|
||||
use constants
|
||||
use dict_header, only: DictIntInt, ElemKeyValueCI
|
||||
use distribution_multivariate
|
||||
use distribution_univariate
|
||||
use energy_grid, only: grid_method, n_log_bins
|
||||
use error, only: fatal_error, warning
|
||||
use geometry_header, only: Cell, Lattice, RectLattice, HexLattice
|
||||
|
|
@ -11,7 +13,7 @@ module input_xml
|
|||
use mesh_header, only: RegularMesh
|
||||
use output, only: write_message
|
||||
use plot_header
|
||||
use random_lcg, only: prn
|
||||
use random_lcg, only: prn, seed
|
||||
use surface_header
|
||||
use stl_vector, only: VectorInt
|
||||
use string, only: to_lower, to_str, str_to_int, str_to_real, &
|
||||
|
|
@ -54,11 +56,11 @@ contains
|
|||
character(MAX_LINE_LEN) :: temp_str
|
||||
integer :: i
|
||||
integer :: n
|
||||
integer :: coeffs_reqd
|
||||
integer :: temp_int
|
||||
integer :: temp_int_array3(3)
|
||||
integer, allocatable :: temp_int_array(:)
|
||||
integer(8) :: temp_long
|
||||
real(8), allocatable :: temp_real(:)
|
||||
integer :: n_tracks
|
||||
logical :: file_exists
|
||||
character(MAX_FILE_LEN) :: env_variable
|
||||
|
|
@ -67,6 +69,8 @@ contains
|
|||
type(Node), pointer :: doc => null()
|
||||
type(Node), pointer :: node_mode => null()
|
||||
type(Node), pointer :: node_source => null()
|
||||
type(Node), pointer :: node_space => null()
|
||||
type(Node), pointer :: node_angle => null()
|
||||
type(Node), pointer :: node_dist => null()
|
||||
type(Node), pointer :: node_cutoff => null()
|
||||
type(Node), pointer :: node_entropy => null()
|
||||
|
|
@ -79,6 +83,7 @@ contains
|
|||
type(Node), pointer :: node_trigger => null()
|
||||
type(Node), pointer :: node_keff_trigger => null()
|
||||
type(NodeList), pointer :: node_scat_list => null()
|
||||
type(NodeList), pointer :: node_source_list => null()
|
||||
|
||||
! Display output message
|
||||
call write_message("Reading settings XML file...", 5)
|
||||
|
|
@ -339,185 +344,249 @@ contains
|
|||
! ==========================================================================
|
||||
! EXTERNAL SOURCE
|
||||
|
||||
! Get pointer to source
|
||||
if (check_for_node(doc, "source")) then
|
||||
call get_node_ptr(doc, "source", node_source)
|
||||
else
|
||||
call fatal_error("No source specified in settings XML file.")
|
||||
end if
|
||||
! Get point to list of <source> elements and make sure there is at least one
|
||||
call get_node_list(doc, "source", node_source_list)
|
||||
n = get_list_size(node_source_list)
|
||||
if (n == 0) call fatal_error("No source specified in settings XML file.")
|
||||
|
||||
! Check if we want to write out source
|
||||
if (check_for_node(node_source, "write_initial")) then
|
||||
call get_node_value(node_source, "write_initial", temp_str)
|
||||
temp_str = to_lower(temp_str)
|
||||
if (trim(temp_str) == 'true' .or. trim(temp_str) == '1') &
|
||||
write_initial_source = .true.
|
||||
end if
|
||||
! Allocate array for sources
|
||||
allocate(external_source(n))
|
||||
|
||||
! Check for external source file
|
||||
if (check_for_node(node_source, "file")) then
|
||||
! Copy path of source file
|
||||
call get_node_value(node_source, "file", path_source)
|
||||
! Read each source
|
||||
do i = 1, n
|
||||
! Get pointer to source
|
||||
call get_list_item(node_source_list, i, node_source)
|
||||
|
||||
! Check if source file exists
|
||||
inquire(FILE=path_source, EXIST=file_exists)
|
||||
if (.not. file_exists) then
|
||||
call fatal_error("Binary source file '" // trim(path_source) &
|
||||
&// "' does not exist!")
|
||||
! Check if we want to write out source
|
||||
if (check_for_node(node_source, "write_initial")) then
|
||||
call get_node_value(node_source, "write_initial", temp_str)
|
||||
temp_str = to_lower(temp_str)
|
||||
if (trim(temp_str) == 'true' .or. trim(temp_str) == '1') &
|
||||
write_initial_source = .true.
|
||||
end if
|
||||
|
||||
else
|
||||
|
||||
! Spatial distribution for external source
|
||||
if (check_for_node(node_source, "space")) then
|
||||
|
||||
! Get pointer to spatial distribution
|
||||
call get_node_ptr(node_source, "space", node_dist)
|
||||
|
||||
! Check for type of spatial distribution
|
||||
type = ''
|
||||
if (check_for_node(node_dist, "type")) &
|
||||
call get_node_value(node_dist, "type", type)
|
||||
select case (to_lower(type))
|
||||
case ('box')
|
||||
external_source % type_space = SRC_SPACE_BOX
|
||||
coeffs_reqd = 6
|
||||
case ('fission')
|
||||
external_source % type_space = SRC_SPACE_FISSION
|
||||
coeffs_reqd = 6
|
||||
case ('point')
|
||||
external_source % type_space = SRC_SPACE_POINT
|
||||
coeffs_reqd = 3
|
||||
case default
|
||||
call fatal_error("Invalid spatial distribution for external source: "&
|
||||
&// trim(type))
|
||||
end select
|
||||
|
||||
! Determine number of parameters specified
|
||||
if (check_for_node(node_dist, "parameters")) then
|
||||
n = get_arraysize_double(node_dist, "parameters")
|
||||
else
|
||||
n = 0
|
||||
end if
|
||||
|
||||
! Read parameters for spatial distribution
|
||||
if (n < coeffs_reqd) then
|
||||
call fatal_error("Not enough parameters specified for spatial &
|
||||
&distribution of external source.")
|
||||
elseif (n > coeffs_reqd) then
|
||||
call fatal_error("Too many parameters specified for spatial &
|
||||
&distribution of external source.")
|
||||
elseif (n > 0) then
|
||||
allocate(external_source % params_space(n))
|
||||
call get_node_array(node_dist, "parameters", &
|
||||
external_source % params_space)
|
||||
end if
|
||||
! Check for source strength
|
||||
if (check_for_node(node_source, "strength")) then
|
||||
call get_node_value(node_source, "strength", external_source(i)%strength)
|
||||
else
|
||||
call fatal_error("No spatial distribution specified for external &
|
||||
&source.")
|
||||
external_source(i)%strength = ONE
|
||||
end if
|
||||
|
||||
! Determine external source angular distribution
|
||||
if (check_for_node(node_source, "angle")) then
|
||||
! Check for external source file
|
||||
if (check_for_node(node_source, "file")) then
|
||||
! Copy path of source file
|
||||
call get_node_value(node_source, "file", path_source)
|
||||
|
||||
! Get pointer to angular distribution
|
||||
call get_node_ptr(node_source, "angle", node_dist)
|
||||
|
||||
! Check for type of angular distribution
|
||||
type = ''
|
||||
if (check_for_node(node_dist, "type")) &
|
||||
call get_node_value(node_dist, "type", type)
|
||||
select case (to_lower(type))
|
||||
case ('isotropic')
|
||||
external_source % type_angle = SRC_ANGLE_ISOTROPIC
|
||||
coeffs_reqd = 0
|
||||
case ('monodirectional')
|
||||
external_source % type_angle = SRC_ANGLE_MONO
|
||||
coeffs_reqd = 3
|
||||
case ('tabular')
|
||||
external_source % type_angle = SRC_ANGLE_TABULAR
|
||||
case default
|
||||
call fatal_error("Invalid angular distribution for external source: "&
|
||||
&// trim(type))
|
||||
end select
|
||||
|
||||
! Determine number of parameters specified
|
||||
if (check_for_node(node_dist, "parameters")) then
|
||||
n = get_arraysize_double(node_dist, "parameters")
|
||||
else
|
||||
n = 0
|
||||
! Check if source file exists
|
||||
inquire(FILE=path_source, EXIST=file_exists)
|
||||
if (.not. file_exists) then
|
||||
call fatal_error("Binary source file '" // trim(path_source) &
|
||||
&// "' does not exist!")
|
||||
end if
|
||||
|
||||
! Read parameters for angle distribution
|
||||
if (n < coeffs_reqd) then
|
||||
call fatal_error("Not enough parameters specified for angle &
|
||||
&distribution of external source.")
|
||||
elseif (n > coeffs_reqd) then
|
||||
call fatal_error("Too many parameters specified for angle &
|
||||
&distribution of external source.")
|
||||
elseif (n > 0) then
|
||||
allocate(external_source % params_angle(n))
|
||||
call get_node_array(node_dist, "parameters", &
|
||||
external_source % params_angle)
|
||||
end if
|
||||
else
|
||||
! Set default angular distribution isotropic
|
||||
external_source % type_angle = SRC_ANGLE_ISOTROPIC
|
||||
end if
|
||||
|
||||
! Determine external source energy distribution
|
||||
if (check_for_node(node_source, "energy")) then
|
||||
! Spatial distribution for external source
|
||||
if (check_for_node(node_source, "space")) then
|
||||
|
||||
! Get pointer to energy distribution
|
||||
call get_node_ptr(node_source, "energy", node_dist)
|
||||
! Get pointer to spatial distribution
|
||||
call get_node_ptr(node_source, "space", node_space)
|
||||
|
||||
! Check for type of energy distribution
|
||||
type = ''
|
||||
if (check_for_node(node_dist, "type")) &
|
||||
call get_node_value(node_dist, "type", type)
|
||||
select case (to_lower(type))
|
||||
case ('monoenergetic')
|
||||
external_source % type_energy = SRC_ENERGY_MONO
|
||||
coeffs_reqd = 1
|
||||
case ('maxwell')
|
||||
external_source % type_energy = SRC_ENERGY_MAXWELL
|
||||
coeffs_reqd = 1
|
||||
case ('watt')
|
||||
external_source % type_energy = SRC_ENERGY_WATT
|
||||
coeffs_reqd = 2
|
||||
case ('tabular')
|
||||
external_source % type_energy = SRC_ENERGY_TABULAR
|
||||
case default
|
||||
call fatal_error("Invalid energy distribution for external source: " &
|
||||
&// trim(type))
|
||||
end select
|
||||
! Check for type of spatial distribution
|
||||
type = ''
|
||||
if (check_for_node(node_space, "type")) &
|
||||
call get_node_value(node_space, "type", type)
|
||||
select case (to_lower(type))
|
||||
case ('cartesian')
|
||||
allocate(CartesianIndependent :: external_source(i)%space)
|
||||
|
||||
case ('box')
|
||||
allocate(SpatialBox :: external_source(i)%space)
|
||||
|
||||
case ('fission')
|
||||
allocate(SpatialBox :: external_source(i)%space)
|
||||
select type(space => external_source(i)%space)
|
||||
type is (SpatialBox)
|
||||
space%only_fissionable = .true.
|
||||
end select
|
||||
|
||||
case ('point')
|
||||
allocate(SpatialPoint :: external_source(i)%space)
|
||||
|
||||
case default
|
||||
call fatal_error("Invalid spatial distribution for external source: "&
|
||||
// trim(type))
|
||||
end select
|
||||
|
||||
select type (space => external_source(i)%space)
|
||||
type is (CartesianIndependent)
|
||||
! Read distribution for x coordinate
|
||||
if (check_for_node(node_space, "x")) then
|
||||
call get_node_ptr(node_space, "x", node_dist)
|
||||
call distribution_from_xml(space%x, node_dist)
|
||||
else
|
||||
allocate(Discrete :: space%x)
|
||||
select type (dist => space%x)
|
||||
type is (Discrete)
|
||||
allocate(dist%x(1), dist%p(1))
|
||||
dist%x(1) = ZERO
|
||||
dist%p(1) = ONE
|
||||
end select
|
||||
end if
|
||||
|
||||
! Read distribution for y coordinate
|
||||
if (check_for_node(node_space, "y")) then
|
||||
call get_node_ptr(node_space, "y", node_dist)
|
||||
call distribution_from_xml(space%y, node_dist)
|
||||
else
|
||||
allocate(Discrete :: space%y)
|
||||
select type (dist => space%y)
|
||||
type is (Discrete)
|
||||
allocate(dist%x(1), dist%p(1))
|
||||
dist%x(1) = ZERO
|
||||
dist%p(1) = ONE
|
||||
end select
|
||||
end if
|
||||
|
||||
if (check_for_node(node_space, "z")) then
|
||||
call get_node_ptr(node_space, "z", node_dist)
|
||||
call distribution_from_xml(space%z, node_dist)
|
||||
else
|
||||
allocate(Discrete :: space%z)
|
||||
select type (dist => space%z)
|
||||
type is (Discrete)
|
||||
allocate(dist%x(1), dist%p(1))
|
||||
dist%x(1) = ZERO
|
||||
dist%p(1) = ONE
|
||||
end select
|
||||
end if
|
||||
|
||||
type is (SpatialBox)
|
||||
! Make sure correct number of parameters are given
|
||||
if (get_arraysize_double(node_space, "parameters") /= 6) then
|
||||
call fatal_error('Box/fission spatial source must have &
|
||||
&six parameters specified.')
|
||||
end if
|
||||
|
||||
! Read lower-right/upper-left coordinates
|
||||
allocate(temp_real(6))
|
||||
call get_node_array(node_space, "parameters", temp_real)
|
||||
space%lower_left(:) = temp_real(1:3)
|
||||
space%upper_right(:) = temp_real(4:6)
|
||||
deallocate(temp_real)
|
||||
|
||||
type is (SpatialPoint)
|
||||
! Make sure correct number of parameters are given
|
||||
if (get_arraysize_double(node_space, "parameters") /= 3) then
|
||||
call fatal_error('Point spatial source must have &
|
||||
&three parameters specified.')
|
||||
end if
|
||||
|
||||
! Read location of point source
|
||||
allocate(temp_real(3))
|
||||
call get_node_array(node_space, "parameters", temp_real)
|
||||
space%xyz(:) = temp_real
|
||||
deallocate(temp_real)
|
||||
|
||||
end select
|
||||
|
||||
! Determine number of parameters specified
|
||||
if (check_for_node(node_dist, "parameters")) then
|
||||
n = get_arraysize_double(node_dist, "parameters")
|
||||
else
|
||||
n = 0
|
||||
call fatal_error("No spatial distribution specified for external &
|
||||
&source.")
|
||||
end if
|
||||
|
||||
! Read parameters for energy distribution
|
||||
if (n < coeffs_reqd) then
|
||||
call fatal_error("Not enough parameters specified for energy &
|
||||
&distribution of external source.")
|
||||
elseif (n > coeffs_reqd) then
|
||||
call fatal_error("Too many parameters specified for energy &
|
||||
&distribution of external source.")
|
||||
elseif (n > 0) then
|
||||
allocate(external_source % params_energy(n))
|
||||
call get_node_array(node_dist, "parameters", &
|
||||
external_source % params_energy)
|
||||
! Determine external source angular distribution
|
||||
if (check_for_node(node_source, "angle")) then
|
||||
|
||||
! Get pointer to angular distribution
|
||||
call get_node_ptr(node_source, "angle", node_angle)
|
||||
|
||||
! Check for type of angular distribution
|
||||
type = ''
|
||||
if (check_for_node(node_angle, "type")) &
|
||||
call get_node_value(node_angle, "type", type)
|
||||
select case (to_lower(type))
|
||||
case ('isotropic')
|
||||
allocate(Isotropic :: external_source(i)%angle)
|
||||
|
||||
case ('monodirectional')
|
||||
allocate(Monodirectional :: external_source(i)%angle)
|
||||
|
||||
case ('mu-phi')
|
||||
allocate(PolarAzimuthal :: external_source(i)%angle)
|
||||
|
||||
case default
|
||||
call fatal_error("Invalid angular distribution for external source: "&
|
||||
// trim(type))
|
||||
end select
|
||||
|
||||
! Read reference directional unit vector
|
||||
if (check_for_node(node_angle, "reference_uvw")) then
|
||||
n = get_arraysize_double(node_angle, "reference_uvw")
|
||||
if (n /= 3) then
|
||||
call fatal_error('Angular distribution reference direction must have &
|
||||
&three parameters specified.')
|
||||
end if
|
||||
call get_node_array(node_angle, "reference_uvw", &
|
||||
external_source(i)%angle%reference_uvw)
|
||||
else
|
||||
! By default, set reference unit vector to be positive z-direction
|
||||
external_source(i)%angle%reference_uvw(:) = [ZERO, ZERO, ONE]
|
||||
end if
|
||||
|
||||
! Read parameters for angle distribution
|
||||
select type (angle => external_source(i)%angle)
|
||||
type is (Monodirectional)
|
||||
call get_node_array(node_angle, "reference_uvw", &
|
||||
external_source(i)%angle%reference_uvw)
|
||||
|
||||
type is (PolarAzimuthal)
|
||||
if (check_for_node(node_angle, "mu")) then
|
||||
call get_node_ptr(node_angle, "mu", node_dist)
|
||||
call distribution_from_xml(angle%mu, node_dist)
|
||||
else
|
||||
allocate(Uniform :: angle%mu)
|
||||
select type (mu => angle%mu)
|
||||
type is (Uniform)
|
||||
mu%a = -ONE
|
||||
mu%b = ONE
|
||||
end select
|
||||
end if
|
||||
|
||||
if (check_for_node(node_angle, "phi")) then
|
||||
call get_node_ptr(node_angle, "phi", node_dist)
|
||||
call distribution_from_xml(angle%phi, node_dist)
|
||||
else
|
||||
allocate(Uniform :: angle%phi)
|
||||
select type (phi => angle%phi)
|
||||
type is (Uniform)
|
||||
phi%a = ZERO
|
||||
phi%b = TWO*PI
|
||||
end select
|
||||
end if
|
||||
end select
|
||||
|
||||
else
|
||||
! Set default angular distribution isotropic
|
||||
allocate(Isotropic :: external_source(i)%angle)
|
||||
external_source(i)%angle%reference_uvw(:) = [ZERO, ZERO, ONE]
|
||||
end if
|
||||
|
||||
! Determine external source energy distribution
|
||||
if (check_for_node(node_source, "energy")) then
|
||||
call get_node_ptr(node_source, "energy", node_dist)
|
||||
call distribution_from_xml(external_source(i)%energy, node_dist)
|
||||
else
|
||||
! Default to a Watt spectrum with parameters 0.988 MeV and 2.249 MeV^-1
|
||||
allocate(Watt :: external_source(i)%energy)
|
||||
select type(energy => external_source(i)%energy)
|
||||
type is (Watt)
|
||||
energy%a = 0.988_8
|
||||
energy%b = 2.249_8
|
||||
end select
|
||||
end if
|
||||
else
|
||||
! Set default energy distribution to Watt fission spectrum
|
||||
external_source % type_energy = SRC_ENERGY_WATT
|
||||
allocate(external_source % params_energy(2))
|
||||
external_source % params_energy = (/ 0.988_8, 2.249_8 /)
|
||||
end if
|
||||
end if
|
||||
end do
|
||||
|
||||
! Survival biasing
|
||||
if (check_for_node(doc, "survival_biasing")) then
|
||||
|
|
|
|||
54
src/math.F90
54
src/math.F90
|
|
@ -557,6 +557,60 @@ contains
|
|||
|
||||
end function calc_rn
|
||||
|
||||
!===============================================================================
|
||||
! ROTATE_ANGLE rotates direction cosines through a polar angle whose cosine is
|
||||
! mu and through an azimuthal angle sampled uniformly. Note that this is done
|
||||
! with direct sampling rather than rejection as is done in MCNP and SERPENT.
|
||||
!===============================================================================
|
||||
|
||||
function rotate_angle(uvw0, mu, phi) result(uvw)
|
||||
real(8), intent(in) :: uvw0(3) ! directional cosine
|
||||
real(8), intent(in) :: mu ! cosine of angle in lab or CM
|
||||
real(8), optional :: phi ! azimuthal angle
|
||||
real(8) :: uvw(3) ! rotated directional cosine
|
||||
|
||||
real(8) :: phi_ ! azimuthal angle
|
||||
real(8) :: sinphi ! sine of azimuthal angle
|
||||
real(8) :: cosphi ! cosine of azimuthal angle
|
||||
real(8) :: a ! sqrt(1 - mu^2)
|
||||
real(8) :: b ! sqrt(1 - w^2)
|
||||
real(8) :: u0 ! original cosine in x direction
|
||||
real(8) :: v0 ! original cosine in y direction
|
||||
real(8) :: w0 ! original cosine in z direction
|
||||
|
||||
! Copy original directional cosines
|
||||
u0 = uvw0(1)
|
||||
v0 = uvw0(2)
|
||||
w0 = uvw0(3)
|
||||
|
||||
! Sample azimuthal angle in [0,2pi) if none provided
|
||||
if (present(phi)) then
|
||||
phi_ = phi
|
||||
else
|
||||
phi_ = TWO * PI * prn()
|
||||
end if
|
||||
|
||||
! Precompute factors to save flops
|
||||
sinphi = sin(phi_)
|
||||
cosphi = cos(phi_)
|
||||
a = sqrt(max(ZERO, ONE - mu*mu))
|
||||
b = sqrt(max(ZERO, ONE - w0*w0))
|
||||
|
||||
! Need to treat special case where sqrt(1 - w**2) is close to zero by
|
||||
! expanding about the v component rather than the w component
|
||||
if (b > 1e-10) then
|
||||
uvw(1) = mu*u0 + a*(u0*w0*cosphi - v0*sinphi)/b
|
||||
uvw(2) = mu*v0 + a*(v0*w0*cosphi + u0*sinphi)/b
|
||||
uvw(3) = mu*w0 - a*b*cosphi
|
||||
else
|
||||
b = sqrt(ONE - v0*v0)
|
||||
uvw(1) = mu*u0 + a*(u0*v0*cosphi + w0*sinphi)/b
|
||||
uvw(2) = mu*v0 - a*b*cosphi
|
||||
uvw(3) = mu*w0 + a*(v0*w0*cosphi - u0*sinphi)/b
|
||||
end if
|
||||
|
||||
end function rotate_angle
|
||||
|
||||
!===============================================================================
|
||||
! MAXWELL_SPECTRUM samples an energy from the Maxwell fission distribution based
|
||||
! on a direct sampling scheme. The probability distribution function for a
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ module physics
|
|||
use global
|
||||
use interpolation, only: interpolate_tab1
|
||||
use material_header, only: Material
|
||||
use math, only: maxwell_spectrum, watt_spectrum
|
||||
use math, only: rotate_angle, maxwell_spectrum, watt_spectrum
|
||||
use mesh, only: get_mesh_indices
|
||||
use output, only: write_message
|
||||
use particle_header, only: Particle
|
||||
|
|
@ -1517,55 +1517,6 @@ contains
|
|||
|
||||
end function sample_angle
|
||||
|
||||
!===============================================================================
|
||||
! ROTATE_ANGLE rotates direction cosines through a polar angle whose cosine is
|
||||
! mu and through an azimuthal angle sampled uniformly. Note that this is done
|
||||
! with direct sampling rather than rejection as is done in MCNP and SERPENT.
|
||||
!===============================================================================
|
||||
|
||||
function rotate_angle(uvw0, mu) result(uvw)
|
||||
real(8), intent(in) :: uvw0(3) ! directional cosine
|
||||
real(8), intent(in) :: mu ! cosine of angle in lab or CM
|
||||
real(8) :: uvw(3) ! rotated directional cosine
|
||||
|
||||
real(8) :: phi ! azimuthal angle
|
||||
real(8) :: sinphi ! sine of azimuthal angle
|
||||
real(8) :: cosphi ! cosine of azimuthal angle
|
||||
real(8) :: a ! sqrt(1 - mu^2)
|
||||
real(8) :: b ! sqrt(1 - w^2)
|
||||
real(8) :: u0 ! original cosine in x direction
|
||||
real(8) :: v0 ! original cosine in y direction
|
||||
real(8) :: w0 ! original cosine in z direction
|
||||
|
||||
! Copy original directional cosines
|
||||
u0 = uvw0(1)
|
||||
v0 = uvw0(2)
|
||||
w0 = uvw0(3)
|
||||
|
||||
! Sample azimuthal angle in [0,2pi)
|
||||
phi = TWO * PI * prn()
|
||||
|
||||
! Precompute factors to save flops
|
||||
sinphi = sin(phi)
|
||||
cosphi = cos(phi)
|
||||
a = sqrt(max(ZERO, ONE - mu*mu))
|
||||
b = sqrt(max(ZERO, ONE - w0*w0))
|
||||
|
||||
! Need to treat special case where sqrt(1 - w**2) is close to zero by
|
||||
! expanding about the v component rather than the w component
|
||||
if (b > 1e-10) then
|
||||
uvw(1) = mu*u0 + a*(u0*w0*cosphi - v0*sinphi)/b
|
||||
uvw(2) = mu*v0 + a*(v0*w0*cosphi + u0*sinphi)/b
|
||||
uvw(3) = mu*w0 - a*b*cosphi
|
||||
else
|
||||
b = sqrt(ONE - v0*v0)
|
||||
uvw(1) = mu*u0 + a*(u0*v0*cosphi + w0*sinphi)/b
|
||||
uvw(2) = mu*v0 - a*b*cosphi
|
||||
uvw(3) = mu*w0 + a*(v0*w0*cosphi - u0*sinphi)/b
|
||||
end if
|
||||
|
||||
end function rotate_angle
|
||||
|
||||
!===============================================================================
|
||||
! SAMPLE_ENERGY samples an outgoing energy distribution, either for a secondary
|
||||
! neutron from a collision or for a prompt/delayed fission neutron
|
||||
|
|
|
|||
|
|
@ -7,6 +7,9 @@ module random_lcg
|
|||
private
|
||||
save
|
||||
|
||||
! Random number seed
|
||||
integer(8), public :: seed = 1_8
|
||||
|
||||
integer(8) :: prn_seed0 ! original seed
|
||||
integer(8) :: prn_seed(N_STREAMS) ! current seed
|
||||
integer(8) :: prn_mult ! multiplication factor, g
|
||||
|
|
@ -56,8 +59,6 @@ contains
|
|||
|
||||
subroutine initialize_prng()
|
||||
|
||||
use global, only: seed
|
||||
|
||||
integer :: i
|
||||
|
||||
prn_seed0 = seed
|
||||
|
|
|
|||
|
|
@ -65,36 +65,36 @@ element settings {
|
|||
element seed { xsd:positiveInteger }? &
|
||||
|
||||
element source {
|
||||
element file { xsd:string { maxLength = "255" } }? &
|
||||
element space {
|
||||
(element type { xsd:string { maxLength = "16" } } |
|
||||
attribute type { xsd:string { maxLength = "16" } }) &
|
||||
(element length { xsd:int } | attribute length { xsd:int })? &
|
||||
(element interpolation { xsd:string { maxLength = "10" } } |
|
||||
attribute interplation { xsd:string { maxLength = "10" } })? &
|
||||
(element parameters { list { xsd:double+ } } |
|
||||
attribute parameters { list { xsd:double+ } })?
|
||||
}? &
|
||||
element angle {
|
||||
(element type { xsd:string { maxLength = "16" } } |
|
||||
attribute type { xsd:string { maxLength = "16" } }) &
|
||||
(element length { xsd:int } | attribute length { xsd:int })? &
|
||||
(element interpolation { xsd:string { maxLength = "10" } } |
|
||||
attribute interplation { xsd:string { maxLength = "10" } })? &
|
||||
(element parameters { list { xsd:double+ } } |
|
||||
attribute parameters { list { xsd:double+ } })?
|
||||
}? &
|
||||
element energy {
|
||||
(element type { xsd:string { maxLength = "16" } } |
|
||||
attribute type { xsd:string { maxLength = "16" } }) &
|
||||
(element length { xsd:int } | attribute length { xsd:int })? &
|
||||
(element interpolation { xsd:string { maxLength = "10" } } |
|
||||
attribute interplation { xsd:string { maxLength = "10" } })? &
|
||||
(element parameters { list { xsd:double+ } } |
|
||||
attribute parameters { list { xsd:double+ } })?
|
||||
}? &
|
||||
(element write_initial { xsd:boolean } | attribute write_initial { xsd:boolean })?
|
||||
}? &
|
||||
grammar {
|
||||
start =
|
||||
(element strength { xsd:double } | attribute strength { xsd:double })? &
|
||||
(element file { xsd:string } | attribute file { xsd:string })? &
|
||||
element space {
|
||||
(element type { xsd:string } | attribute type { xsd:string }) &
|
||||
(element parameters { list { xsd:double+ } } |
|
||||
attribute parameters { list { xsd:double+ } })? &
|
||||
element x { distribution }? &
|
||||
element y { distribution }? &
|
||||
element z { distribution }?
|
||||
}? &
|
||||
element angle {
|
||||
(element type { xsd:string } | attribute type { xsd:string }) &
|
||||
(element reference_uvw { list { xsd:double, xsd:double, xsd:double } } |
|
||||
attribute reference_uvw { list { xsd:double, xsd:double, xsd:double } })? &
|
||||
element mu { distribution }? &
|
||||
element phi { distribution }?
|
||||
}? &
|
||||
element energy { distribution }? &
|
||||
(element write_initial { xsd:boolean } | attribute write_initial { xsd:boolean })?
|
||||
distribution =
|
||||
(element type { xsd:string { maxLength = "16" } } |
|
||||
attribute type { xsd:string { maxLength = "16" } }) &
|
||||
(element interpolation { xsd:string } |
|
||||
attribute interpolation { xsd:string })? &
|
||||
(element parameters { list { xsd:double+ } } |
|
||||
attribute parameters { list { xsd:double+ } })?
|
||||
}
|
||||
}* &
|
||||
|
||||
element state_point {
|
||||
(
|
||||
|
|
|
|||
|
|
@ -264,209 +264,184 @@
|
|||
<data type="positiveInteger"/>
|
||||
</element>
|
||||
</optional>
|
||||
<optional>
|
||||
<zeroOrMore>
|
||||
<element name="source">
|
||||
<interleave>
|
||||
<optional>
|
||||
<element name="file">
|
||||
<data type="string">
|
||||
<param name="maxLength">255</param>
|
||||
</data>
|
||||
</element>
|
||||
</optional>
|
||||
<optional>
|
||||
<element name="space">
|
||||
<interleave>
|
||||
<grammar>
|
||||
<start>
|
||||
<interleave>
|
||||
<optional>
|
||||
<choice>
|
||||
<element name="type">
|
||||
<data type="string">
|
||||
<param name="maxLength">16</param>
|
||||
</data>
|
||||
<element name="strength">
|
||||
<data type="double"/>
|
||||
</element>
|
||||
<attribute name="type">
|
||||
<data type="string">
|
||||
<param name="maxLength">16</param>
|
||||
</data>
|
||||
<attribute name="strength">
|
||||
<data type="double"/>
|
||||
</attribute>
|
||||
</choice>
|
||||
<optional>
|
||||
<choice>
|
||||
<element name="length">
|
||||
<data type="int"/>
|
||||
</element>
|
||||
<attribute name="length">
|
||||
<data type="int"/>
|
||||
</attribute>
|
||||
</choice>
|
||||
</optional>
|
||||
<optional>
|
||||
<choice>
|
||||
<element name="interpolation">
|
||||
<data type="string">
|
||||
<param name="maxLength">10</param>
|
||||
</data>
|
||||
</element>
|
||||
<attribute name="interplation">
|
||||
<data type="string">
|
||||
<param name="maxLength">10</param>
|
||||
</data>
|
||||
</attribute>
|
||||
</choice>
|
||||
</optional>
|
||||
<optional>
|
||||
<choice>
|
||||
<element name="parameters">
|
||||
<list>
|
||||
<oneOrMore>
|
||||
<data type="double"/>
|
||||
</oneOrMore>
|
||||
</list>
|
||||
</element>
|
||||
<attribute name="parameters">
|
||||
<list>
|
||||
<oneOrMore>
|
||||
<data type="double"/>
|
||||
</oneOrMore>
|
||||
</list>
|
||||
</attribute>
|
||||
</choice>
|
||||
</optional>
|
||||
</interleave>
|
||||
</element>
|
||||
</optional>
|
||||
<optional>
|
||||
<element name="angle">
|
||||
<interleave>
|
||||
</optional>
|
||||
<optional>
|
||||
<choice>
|
||||
<element name="type">
|
||||
<data type="string">
|
||||
<param name="maxLength">16</param>
|
||||
</data>
|
||||
<element name="file">
|
||||
<data type="string"/>
|
||||
</element>
|
||||
<attribute name="type">
|
||||
<data type="string">
|
||||
<param name="maxLength">16</param>
|
||||
</data>
|
||||
<attribute name="file">
|
||||
<data type="string"/>
|
||||
</attribute>
|
||||
</choice>
|
||||
<optional>
|
||||
<choice>
|
||||
<element name="length">
|
||||
<data type="int"/>
|
||||
</element>
|
||||
<attribute name="length">
|
||||
<data type="int"/>
|
||||
</attribute>
|
||||
</choice>
|
||||
</optional>
|
||||
<optional>
|
||||
<choice>
|
||||
<element name="interpolation">
|
||||
<data type="string">
|
||||
<param name="maxLength">10</param>
|
||||
</data>
|
||||
</element>
|
||||
<attribute name="interplation">
|
||||
<data type="string">
|
||||
<param name="maxLength">10</param>
|
||||
</data>
|
||||
</attribute>
|
||||
</choice>
|
||||
</optional>
|
||||
<optional>
|
||||
<choice>
|
||||
<element name="parameters">
|
||||
<list>
|
||||
<oneOrMore>
|
||||
<data type="double"/>
|
||||
</oneOrMore>
|
||||
</list>
|
||||
</element>
|
||||
<attribute name="parameters">
|
||||
<list>
|
||||
<oneOrMore>
|
||||
<data type="double"/>
|
||||
</oneOrMore>
|
||||
</list>
|
||||
</attribute>
|
||||
</choice>
|
||||
</optional>
|
||||
</interleave>
|
||||
</element>
|
||||
</optional>
|
||||
<optional>
|
||||
<element name="energy">
|
||||
<interleave>
|
||||
</optional>
|
||||
<optional>
|
||||
<element name="space">
|
||||
<interleave>
|
||||
<choice>
|
||||
<element name="type">
|
||||
<data type="string"/>
|
||||
</element>
|
||||
<attribute name="type">
|
||||
<data type="string"/>
|
||||
</attribute>
|
||||
</choice>
|
||||
<optional>
|
||||
<choice>
|
||||
<element name="parameters">
|
||||
<list>
|
||||
<oneOrMore>
|
||||
<data type="double"/>
|
||||
</oneOrMore>
|
||||
</list>
|
||||
</element>
|
||||
<attribute name="parameters">
|
||||
<list>
|
||||
<oneOrMore>
|
||||
<data type="double"/>
|
||||
</oneOrMore>
|
||||
</list>
|
||||
</attribute>
|
||||
</choice>
|
||||
</optional>
|
||||
<optional>
|
||||
<element name="x">
|
||||
<ref name="distribution"/>
|
||||
</element>
|
||||
</optional>
|
||||
<optional>
|
||||
<element name="y">
|
||||
<ref name="distribution"/>
|
||||
</element>
|
||||
</optional>
|
||||
<optional>
|
||||
<element name="z">
|
||||
<ref name="distribution"/>
|
||||
</element>
|
||||
</optional>
|
||||
</interleave>
|
||||
</element>
|
||||
</optional>
|
||||
<optional>
|
||||
<element name="angle">
|
||||
<interleave>
|
||||
<choice>
|
||||
<element name="type">
|
||||
<data type="string"/>
|
||||
</element>
|
||||
<attribute name="type">
|
||||
<data type="string"/>
|
||||
</attribute>
|
||||
</choice>
|
||||
<optional>
|
||||
<choice>
|
||||
<element name="reference_uvw">
|
||||
<list>
|
||||
<data type="double"/>
|
||||
<data type="double"/>
|
||||
<data type="double"/>
|
||||
</list>
|
||||
</element>
|
||||
<attribute name="reference_uvw">
|
||||
<list>
|
||||
<data type="double"/>
|
||||
<data type="double"/>
|
||||
<data type="double"/>
|
||||
</list>
|
||||
</attribute>
|
||||
</choice>
|
||||
</optional>
|
||||
<optional>
|
||||
<element name="mu">
|
||||
<ref name="distribution"/>
|
||||
</element>
|
||||
</optional>
|
||||
<optional>
|
||||
<element name="phi">
|
||||
<ref name="distribution"/>
|
||||
</element>
|
||||
</optional>
|
||||
</interleave>
|
||||
</element>
|
||||
</optional>
|
||||
<optional>
|
||||
<element name="energy">
|
||||
<ref name="distribution"/>
|
||||
</element>
|
||||
</optional>
|
||||
<optional>
|
||||
<choice>
|
||||
<element name="type">
|
||||
<data type="string">
|
||||
<param name="maxLength">16</param>
|
||||
</data>
|
||||
<element name="write_initial">
|
||||
<data type="boolean"/>
|
||||
</element>
|
||||
<attribute name="type">
|
||||
<data type="string">
|
||||
<param name="maxLength">16</param>
|
||||
</data>
|
||||
<attribute name="write_initial">
|
||||
<data type="boolean"/>
|
||||
</attribute>
|
||||
</choice>
|
||||
<optional>
|
||||
<choice>
|
||||
<element name="length">
|
||||
<data type="int"/>
|
||||
</element>
|
||||
<attribute name="length">
|
||||
<data type="int"/>
|
||||
</attribute>
|
||||
</choice>
|
||||
</optional>
|
||||
<optional>
|
||||
<choice>
|
||||
<element name="interpolation">
|
||||
<data type="string">
|
||||
<param name="maxLength">10</param>
|
||||
</data>
|
||||
</element>
|
||||
<attribute name="interplation">
|
||||
<data type="string">
|
||||
<param name="maxLength">10</param>
|
||||
</data>
|
||||
</attribute>
|
||||
</choice>
|
||||
</optional>
|
||||
<optional>
|
||||
<choice>
|
||||
<element name="parameters">
|
||||
<list>
|
||||
<oneOrMore>
|
||||
<data type="double"/>
|
||||
</oneOrMore>
|
||||
</list>
|
||||
</element>
|
||||
<attribute name="parameters">
|
||||
<list>
|
||||
<oneOrMore>
|
||||
<data type="double"/>
|
||||
</oneOrMore>
|
||||
</list>
|
||||
</attribute>
|
||||
</choice>
|
||||
</optional>
|
||||
</interleave>
|
||||
</element>
|
||||
</optional>
|
||||
<optional>
|
||||
<choice>
|
||||
<element name="write_initial">
|
||||
<data type="boolean"/>
|
||||
</element>
|
||||
<attribute name="write_initial">
|
||||
<data type="boolean"/>
|
||||
</attribute>
|
||||
</choice>
|
||||
</optional>
|
||||
</interleave>
|
||||
</optional>
|
||||
</interleave>
|
||||
</start>
|
||||
<define name="distribution">
|
||||
<interleave>
|
||||
<choice>
|
||||
<element name="type">
|
||||
<data type="string">
|
||||
<param name="maxLength">16</param>
|
||||
</data>
|
||||
</element>
|
||||
<attribute name="type">
|
||||
<data type="string">
|
||||
<param name="maxLength">16</param>
|
||||
</data>
|
||||
</attribute>
|
||||
</choice>
|
||||
<optional>
|
||||
<choice>
|
||||
<element name="interpolation">
|
||||
<data type="string"/>
|
||||
</element>
|
||||
<attribute name="interpolation">
|
||||
<data type="string"/>
|
||||
</attribute>
|
||||
</choice>
|
||||
</optional>
|
||||
<optional>
|
||||
<choice>
|
||||
<element name="parameters">
|
||||
<list>
|
||||
<oneOrMore>
|
||||
<data type="double"/>
|
||||
</oneOrMore>
|
||||
</list>
|
||||
</element>
|
||||
<attribute name="parameters">
|
||||
<list>
|
||||
<oneOrMore>
|
||||
<data type="double"/>
|
||||
</oneOrMore>
|
||||
</list>
|
||||
</attribute>
|
||||
</choice>
|
||||
</optional>
|
||||
</interleave>
|
||||
</define>
|
||||
</grammar>
|
||||
</element>
|
||||
</optional>
|
||||
</zeroOrMore>
|
||||
<optional>
|
||||
<element name="state_point">
|
||||
<choice>
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ element tallies {
|
|||
(element type { xsd:string } | attribute type { xsd:string }) &
|
||||
(element threshold { xsd:double} | attribute threshold { xsd:double }) &
|
||||
(element scores { list { xsd:string { maxLength = "20" }+ } } | attribute scores { list { xsd:string { maxLength = "20"}+ } } )?
|
||||
}?
|
||||
}*
|
||||
}* &
|
||||
|
||||
element assume_separate { xsd:boolean }?
|
||||
|
|
|
|||
|
|
@ -145,10 +145,10 @@
|
|||
<value>mesh</value>
|
||||
<value>energy</value>
|
||||
<value>energyout</value>
|
||||
<value>delayedgroup</value>
|
||||
<value>mu</value>
|
||||
<value>polar</value>
|
||||
<value>azimuthal</value>
|
||||
<value>delayedgroup</value>
|
||||
</choice>
|
||||
</element>
|
||||
<attribute name="type">
|
||||
|
|
@ -162,10 +162,10 @@
|
|||
<value>mesh</value>
|
||||
<value>energy</value>
|
||||
<value>energyout</value>
|
||||
<value>delayedgroup</value>
|
||||
<value>mu</value>
|
||||
<value>polar</value>
|
||||
<value>azimuthal</value>
|
||||
<value>delayedgroup</value>
|
||||
</choice>
|
||||
</attribute>
|
||||
</choice>
|
||||
|
|
@ -208,7 +208,7 @@
|
|||
</oneOrMore>
|
||||
</list>
|
||||
</element>
|
||||
<optional>
|
||||
<zeroOrMore>
|
||||
<element name="trigger">
|
||||
<interleave>
|
||||
<choice>
|
||||
|
|
@ -251,7 +251,7 @@
|
|||
</optional>
|
||||
</interleave>
|
||||
</element>
|
||||
</optional>
|
||||
</zeroOrMore>
|
||||
</interleave>
|
||||
</element>
|
||||
</zeroOrMore>
|
||||
|
|
|
|||
178
src/source.F90
178
src/source.F90
|
|
@ -2,6 +2,8 @@ module source
|
|||
|
||||
use bank_header, only: Bank
|
||||
use constants
|
||||
use distribution_univariate, only: Discrete
|
||||
use distribution_multivariate, only: SpatialBox
|
||||
use error, only: fatal_error
|
||||
use geometry, only: find_cell
|
||||
use geometry_header, only: BASE_UNIVERSE
|
||||
|
|
@ -99,13 +101,9 @@ contains
|
|||
type(Bank), intent(inout) :: site ! source site
|
||||
|
||||
integer :: i ! dummy loop index
|
||||
integer :: n_source ! number of source distributions
|
||||
real(8) :: c ! cumulative frequency
|
||||
real(8) :: r(3) ! sampled coordinates
|
||||
real(8) :: phi ! azimuthal angle
|
||||
real(8) :: mu ! cosine of polar angle
|
||||
real(8) :: p_min(3) ! minimum coordinates of source
|
||||
real(8) :: p_max(3) ! maximum coordinates of source
|
||||
real(8) :: a ! Arbitrary parameter 'a'
|
||||
real(8) :: b ! Arbitrary parameter 'b'
|
||||
logical :: found ! Does the source particle exist within geometry?
|
||||
type(Particle) :: p ! Temporary particle for using find_cell
|
||||
integer, save :: num_resamples = 0 ! Number of resamples encountered
|
||||
|
|
@ -116,130 +114,80 @@ contains
|
|||
! Set the random number generator to the source stream.
|
||||
call prn_set_stream(STREAM_SOURCE)
|
||||
|
||||
! Sample position
|
||||
select case (external_source%type_space)
|
||||
case (SRC_SPACE_BOX)
|
||||
! Sample from among multiple source distributions
|
||||
n_source = size(external_source)
|
||||
if (n_source > 1) then
|
||||
r(1) = prn()*sum(external_source(:)%strength)
|
||||
c = ZERO
|
||||
do i = 1, n_source
|
||||
c = c + external_source(i)%strength
|
||||
if (r(1) < c) exit
|
||||
end do
|
||||
else
|
||||
i = 1
|
||||
end if
|
||||
|
||||
! Repeat sampling source location until a good site has been found
|
||||
found = .false.
|
||||
do while (.not.found)
|
||||
! Set particle defaults
|
||||
call p%initialize()
|
||||
! Repeat sampling source location until a good site has been found
|
||||
found = .false.
|
||||
do while (.not.found)
|
||||
! Coordinates sampled uniformly over a box
|
||||
p_min = external_source%params_space(1:3)
|
||||
p_max = external_source%params_space(4:6)
|
||||
r = (/ (prn(), i = 1,3) /)
|
||||
site%xyz = p_min + r*(p_max - p_min)
|
||||
|
||||
! Fill p with needed data
|
||||
p%coord(1)%xyz = site%xyz
|
||||
p%coord(1)%uvw = [ ONE, ZERO, ZERO ]
|
||||
! Sample spatial distribution
|
||||
site%xyz(:) = external_source(i)%space%sample()
|
||||
|
||||
! Now search to see if location exists in geometry
|
||||
call find_cell(p, found)
|
||||
if (.not. found) then
|
||||
num_resamples = num_resamples + 1
|
||||
if (num_resamples == MAX_EXTSRC_RESAMPLES) then
|
||||
call fatal_error("Maximum number of external source spatial &
|
||||
&resamples reached!")
|
||||
! Fill p with needed data
|
||||
p%coord(1)%xyz(:) = site%xyz
|
||||
p%coord(1)%uvw(:) = [ ONE, ZERO, ZERO ]
|
||||
|
||||
! Now search to see if location exists in geometry
|
||||
call find_cell(p, found)
|
||||
if (.not. found) then
|
||||
num_resamples = num_resamples + 1
|
||||
if (num_resamples == MAX_EXTSRC_RESAMPLES) then
|
||||
call fatal_error("Maximum number of external source spatial &
|
||||
&resamples reached!")
|
||||
end if
|
||||
end if
|
||||
|
||||
! Check if spatial site is in fissionable material
|
||||
select type (space => external_source(i)%space)
|
||||
type is (SpatialBox)
|
||||
if (space%only_fissionable) then
|
||||
if (p%material == MATERIAL_VOID) then
|
||||
found = .false.
|
||||
elseif (.not. materials(p%material)%fissionable) then
|
||||
found = .false.
|
||||
end if
|
||||
end if
|
||||
end do
|
||||
call p%clear()
|
||||
end select
|
||||
end do
|
||||
|
||||
case (SRC_SPACE_FISSION)
|
||||
! Repeat sampling source location until a good site has been found
|
||||
found = .false.
|
||||
do while (.not.found)
|
||||
! Set particle defaults
|
||||
call p%initialize()
|
||||
|
||||
! Coordinates sampled uniformly over a box
|
||||
p_min = external_source%params_space(1:3)
|
||||
p_max = external_source%params_space(4:6)
|
||||
r = (/ (prn(), i = 1,3) /)
|
||||
site%xyz = p_min + r*(p_max - p_min)
|
||||
|
||||
! Fill p with needed data
|
||||
p%coord(1)%xyz = site%xyz
|
||||
p%coord(1)%uvw = [ ONE, ZERO, ZERO ]
|
||||
|
||||
! Now search to see if location exists in geometry
|
||||
call find_cell(p, found)
|
||||
if (.not. found) then
|
||||
num_resamples = num_resamples + 1
|
||||
if (num_resamples == MAX_EXTSRC_RESAMPLES) then
|
||||
call fatal_error("Maximum number of external source spatial &
|
||||
&resamples reached!")
|
||||
end if
|
||||
cycle
|
||||
end if
|
||||
if (p%material == MATERIAL_VOID) then
|
||||
found = .false.
|
||||
cycle
|
||||
end if
|
||||
if (.not. materials(p%material)%fissionable) found = .false.
|
||||
end do
|
||||
call p%clear()
|
||||
|
||||
case (SRC_SPACE_POINT)
|
||||
! Point source
|
||||
site%xyz = external_source%params_space
|
||||
|
||||
end select
|
||||
call p%clear()
|
||||
|
||||
! Sample angle
|
||||
select case (external_source%type_angle)
|
||||
case (SRC_ANGLE_ISOTROPIC)
|
||||
! Sample isotropic distribution
|
||||
phi = TWO*PI*prn()
|
||||
mu = TWO*prn() - ONE
|
||||
site%uvw(1) = mu
|
||||
site%uvw(2) = sqrt(ONE - mu*mu) * cos(phi)
|
||||
site%uvw(3) = sqrt(ONE - mu*mu) * sin(phi)
|
||||
site%uvw(:) = external_source(i)%angle%sample()
|
||||
|
||||
case (SRC_ANGLE_MONO)
|
||||
! Monodirectional source
|
||||
site%uvw = external_source%params_angle
|
||||
|
||||
case default
|
||||
call fatal_error("No angle distribution specified for external source!")
|
||||
end select
|
||||
|
||||
! Sample energy distribution
|
||||
select case (external_source%type_energy)
|
||||
case (SRC_ENERGY_MONO)
|
||||
! Monoenergtic source
|
||||
site%E = external_source%params_energy(1)
|
||||
if (site%E >= energy_max_neutron) then
|
||||
! Check for monoenergetic source above maximum neutron energy
|
||||
select type (energy => external_source(i)%energy)
|
||||
type is (Discrete)
|
||||
if (any(energy%x >= energy_max_neutron)) then
|
||||
call fatal_error("Source energy above range of energies of at least &
|
||||
&one cross section table")
|
||||
end if
|
||||
|
||||
case (SRC_ENERGY_MAXWELL)
|
||||
a = external_source%params_energy(1)
|
||||
do
|
||||
! Sample Maxwellian fission spectrum
|
||||
site%E = maxwell_spectrum(a)
|
||||
|
||||
! resample if energy is greater than maximum neutron energy
|
||||
if (site%E < energy_max_neutron) exit
|
||||
end do
|
||||
|
||||
case (SRC_ENERGY_WATT)
|
||||
a = external_source%params_energy(1)
|
||||
b = external_source%params_energy(2)
|
||||
do
|
||||
! Sample Watt fission spectrum
|
||||
site%E = watt_spectrum(a, b)
|
||||
|
||||
! resample if energy is greater than maximum neutron energy
|
||||
if (site%E < energy_max_neutron) exit
|
||||
end do
|
||||
|
||||
case default
|
||||
call fatal_error("No energy distribution specified for external source!")
|
||||
end select
|
||||
|
||||
do
|
||||
! Sample energy spectrum
|
||||
site%E = external_source(i)%energy%sample()
|
||||
|
||||
! resample if energy is greater than maximum neutron energy
|
||||
if (site%E < energy_max_neutron) exit
|
||||
end do
|
||||
|
||||
! Set delayed group
|
||||
site%delayed_group = 0
|
||||
|
||||
! Set the random number generator back to the tracking stream.
|
||||
call prn_set_stream(STREAM_TRACKING)
|
||||
|
||||
|
|
|
|||
|
|
@ -1,19 +1,20 @@
|
|||
module source_header
|
||||
|
||||
use distribution_univariate, only: Distribution
|
||||
use distribution_multivariate, only: UnitSphereDistribution, SpatialDistribution
|
||||
|
||||
implicit none
|
||||
|
||||
!===============================================================================
|
||||
! EXTSOURCE describes an external source of neutrons for a fixed-source problem
|
||||
! or for the starting source in a k eigenvalue problem
|
||||
! SOURCEDISTRIBUTION describes an external source of particles for a
|
||||
! fixed-source problem or for the starting source in a k eigenvalue problem
|
||||
!===============================================================================
|
||||
|
||||
type ExtSource
|
||||
integer :: type_space ! spacial distribution, e.g. 'box' or 'point'
|
||||
integer :: type_angle ! angle distribution, e.g. 'isotropic'
|
||||
integer :: type_energy ! energy distribution, e.g. 'Watt'
|
||||
real(8), allocatable :: params_space(:) ! parameters for spatial distribution
|
||||
real(8), allocatable :: params_angle(:) ! parameters for angle distribution
|
||||
real(8), allocatable :: params_energy(:) ! parameters for energy distribution
|
||||
end type ExtSource
|
||||
type SourceDistribution
|
||||
real(8) :: strength ! source strength
|
||||
class(SpatialDistribution), allocatable :: space ! spatial distribution
|
||||
class(UnitSphereDistribution), allocatable :: angle ! angle distribution
|
||||
class(Distribution), allocatable :: energy ! energy distribution
|
||||
end type SourceDistribution
|
||||
|
||||
end module source_header
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ module state_point
|
|||
use tally_header, only: TallyObject
|
||||
use mesh_header, only: RegularMesh
|
||||
use dict_header, only: ElemKeyValueII, ElemKeyValueCI
|
||||
use random_lcg, only: seed
|
||||
|
||||
#ifdef MPI
|
||||
use message_passing
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ module string
|
|||
use constants, only: MAX_WORDS, MAX_LINE_LEN, ERROR_INT, ERROR_REAL, &
|
||||
OP_LEFT_PAREN, OP_RIGHT_PAREN, OP_COMPLEMENT, OP_INTERSECTION, OP_UNION
|
||||
use error, only: fatal_error, warning
|
||||
use global, only: master
|
||||
use stl_vector, only: VectorInt
|
||||
|
||||
implicit none
|
||||
|
|
@ -50,8 +49,8 @@ contains
|
|||
if (i_end > 0) then
|
||||
n = n + 1
|
||||
if (i_end - i_start + 1 > len(words(n))) then
|
||||
if (master) call warning("The word '" // string(i_start:i_end) &
|
||||
&// "' is longer than the space allocated for it.")
|
||||
call warning("The word '" // string(i_start:i_end) &
|
||||
// "' is longer than the space allocated for it.")
|
||||
end if
|
||||
words(n) = string(i_start:i_end)
|
||||
! reset indices
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
import openmc
|
||||
from openmc.source import Source
|
||||
from openmc.stats import Box
|
||||
|
||||
|
||||
class InputSet(object):
|
||||
|
|
@ -558,7 +560,8 @@ class InputSet(object):
|
|||
self.settings.batches = 10
|
||||
self.settings.inactive = 5
|
||||
self.settings.particles = 100
|
||||
self.settings.set_source_space('box', (-160, -160, -183, 160, 160, 183))
|
||||
self.settings.source = Source(space=Box(
|
||||
[-160, -160, -183], [160, 160, 183]))
|
||||
|
||||
def build_defualt_plots(self):
|
||||
plot = openmc.Plot()
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
83a9f1412b1ddfdd8b9fa8c7e8b44be8137dc6aa785d44c3eea9f0928242475aea4ba73ba4eef01afdf63bd1bff18116e40b798eeafab50c856186de4c68d5a6
|
||||
401b8be1b296db7f21ccae089c7ac480044d953b7264ca0ae8e34bb79e24cbb57195bcb568deda6f2f7e07366bbfac408a92306351b9169edd04499723707e1b
|
||||
|
|
@ -5,6 +5,8 @@ import sys
|
|||
sys.path.insert(0, os.pardir)
|
||||
from testing_harness import TestHarness, PyAPITestHarness
|
||||
import openmc
|
||||
from openmc.stats import Box
|
||||
from openmc.source import Source
|
||||
|
||||
|
||||
class DistribmatTestHarness(PyAPITestHarness):
|
||||
|
|
@ -85,7 +87,7 @@ class DistribmatTestHarness(PyAPITestHarness):
|
|||
sets_file.batches = 5
|
||||
sets_file.inactive = 0
|
||||
sets_file.particles = 1000
|
||||
sets_file.set_source_space('box', [-1, -1, -1, 1, 1, 1])
|
||||
sets_file.source = Source(space=Box([-1, -1, -1], [1, 1, 1]))
|
||||
sets_file.output = {'summary': True}
|
||||
sets_file.export_to_xml()
|
||||
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
1d5f81d12f607f4a8436dfb65167e2a2be55dbf86fbc2cc465cec274671be5eaff517d781a4d40e264bb695e3c66c7ff61a650217c99de2ca8c15ca747fe6b80
|
||||
57d6fd9cb5180c38efd2729a5dea0708cbd5fd0bf7dcf0c9d5c9cef5d818aeab5a926d03e70dedcf1b60d5740938fb3ba80e6ccdb09c661d159c0893da3bd593
|
||||
|
|
@ -1 +1 @@
|
|||
caae173f01f7073d634a68a5c4ce97177423e13596a863976e1c40303dc8c05afed457d5a1aa0ae73627ec953143e4f9c1f45bdbd3b0cca76433062467d59777
|
||||
f8359184c02fbab5dca5368689a84924066ab1fb09cae575588ceddd696d5461db577498df9959365d89fe933e9b338390e44e362c603c6f2aa5bcf4acc14b20
|
||||
|
|
@ -1 +1 @@
|
|||
2f24eb86cda981982a8db5bb110c72e9cef542c06e15b748c1c7e459f96b0d8ba0978b51dffc006e813cd2e2ae1fa0357336f8322ae263189841afde01f0327b
|
||||
8ae662f8881ce8cdec550069c6233c2c91e9a10f7200af6892cf6f2d77712ccfa17895dbd2eee02e6daf3d665c6ed84b29e17d89ff519e70c37b36d75a431d53
|
||||
|
|
@ -1 +1 @@
|
|||
e771470681d3b4af57a70d148f5eb728df57f1fd7bdb5d6f76ac556b69f10bf0cdd5645fe488f1e17f07cbb72e9fb34af2fd7ede95c8e39c5ffa6ea9b6c5810e
|
||||
a7c8ce7ffbc3a7b965d8a3077a4d9132130561afef19047b279b2d23198e248b09664856a092a32394894e19fef7708cebad99b3839d735c4e98ae0c9af58cb7
|
||||
|
|
@ -1 +1 @@
|
|||
49835200052ee1a4c9583a7bb4e9430de7d01a6d7a8d4f63ae37be9bbac4fd8c7ed9135ecbc4ab4cb075fd4d77b322265783463dd07c127decceee8c9fe25bfd
|
||||
51d3e2c43f36712a7b26c5fa26e0e2ca6fb9af205af04f0f8cd44c6b100e36382417c2c63d711e4677ce3c1958d15072727d5fd32424a3f6eb08d1f3b1c7db5a
|
||||
|
|
@ -1 +1 @@
|
|||
183b4a06cbd0930cfa4f28d0c385cf3ae93ab97c171580c2ba9eec0e4b716102ad83f510d62258ef6769c446e72e1d5ba9f630b171ee239ec04c9bbd1e56742e
|
||||
f0810606c5f947a9fe03bcfc87de3883ce46f59d8603e02ed30f853ebf301b2dc6bdcd109889801ada9e6e0b7be4932efeca97d4beea875af8c8e3ecb7511444
|
||||
|
|
@ -1 +1 @@
|
|||
461a6a4ec3b0b6dc7199c09fa8f527e51cc7a1ea4281a708f8b7bcdbb12f7162027928dfcef68a24eaf6c06037a68e151df9aac9eac6ce56617466f2f5270b71
|
||||
c4d4334d44956d6dc9abe854a5e9403d7f8a87ffb04a15a3d128e8d18eb4111f46ca277b751e1b0e836d69527502f9abba115a4b2fc64c38da63a9d57968d860
|
||||
|
|
@ -1 +1 @@
|
|||
2fbd0986abff08126680925284929cf67bdad0cd564775197b78065ce3b0e6ad8094f5ca4d14ea69347db69a6cdcc9796a095178ae9b14a927b101f32f3cd0ec
|
||||
7689b2c88391128377b7f9bfcda347a42f77d69d194186629fa965ecd3fc51be0bfd1ac92fb9d7551128d8b6ed5241ead4fb94b27ae29d80230863e78fbbcb68
|
||||
|
|
@ -1 +1 @@
|
|||
cd2aeb24baafe9a904e697955990f6cffb5f25618fdf8c972775715bfe6e92bc259e36fd2b5addff8181439de58ad6f530972ec391e827f46146a2aaace34358
|
||||
ecc649936e2cc364b079944f47e18fb81ec7290017b4bd5837e5aa1e24e1146df77897f44c7c2a88500e3f525566b51777cd9b84ec6a636f5883e411e4c1f75c
|
||||
|
|
@ -1 +1 @@
|
|||
2de29e0a083af0722039ebc246469f26e260d604ab8b76314b2ac472bbd23004e031aec7afe3dbfc4c6112428846cd0cf0c1430e878832b9dab36463d026dee6
|
||||
301824991a022884215609f39797a61933faf7ccacf81ad6bb883af08857563e8bd74ab946fc4fd072860168d77f76d0c76d1467375158072dce431fc6a1c449
|
||||
|
|
@ -1 +1 @@
|
|||
51fcaf0aa527d1fd1022e5f312d4d25cd9bacc5fc9792d9f7702ee97cac43700a31f25be767a2cff769c37b5e1cdf3f922467977a9958fa34561e2a102bf8537
|
||||
164804414f48a818c93e197f2901ce6ae375d88071a03e89c920dbc4462e7a2c8d2c85acf6560fcd6eb3d7c0c53d3b426ab1cc4b7721266fe8adec3e7231149e
|
||||
|
|
@ -1 +1 @@
|
|||
35f99f1973b3bf3efcec6c2dddf56d6679a15dab8582ab5336e86e4fdf90967ce91036e5c30c345decb994ab9133a906b82dc8fad0cdd3398a612d9aa05c1c77
|
||||
53b1740921b71e4ead909ab9e4c25f7d43990fe7d7051fde6f66c39c0a6082177385640244010e1b9dbeaf5f34adf1627e9603088af729fadd6b589c19102edc
|
||||
|
|
@ -1 +1 @@
|
|||
35f99f1973b3bf3efcec6c2dddf56d6679a15dab8582ab5336e86e4fdf90967ce91036e5c30c345decb994ab9133a906b82dc8fad0cdd3398a612d9aa05c1c77
|
||||
53b1740921b71e4ead909ab9e4c25f7d43990fe7d7051fde6f66c39c0a6082177385640244010e1b9dbeaf5f34adf1627e9603088af729fadd6b589c19102edc
|
||||
|
|
@ -1 +1 @@
|
|||
35f99f1973b3bf3efcec6c2dddf56d6679a15dab8582ab5336e86e4fdf90967ce91036e5c30c345decb994ab9133a906b82dc8fad0cdd3398a612d9aa05c1c77
|
||||
53b1740921b71e4ead909ab9e4c25f7d43990fe7d7051fde6f66c39c0a6082177385640244010e1b9dbeaf5f34adf1627e9603088af729fadd6b589c19102edc
|
||||
|
|
@ -1 +1 @@
|
|||
7c1deb8a54fbe1a1ce6ef27cea4a11995210ad3e5ecf32bd83d7c80041edf0793378a7325ffe7ebf9c537e9c278fd4545642fec6c1e46b9c5418118f035d5e95
|
||||
c6a2a1c707bc723fd38bafd18efcfb22beaac0bd5953d7524ced1d47866cc1e1ee4152e39234d32a06fe43aff446fb12f8c5b62a44075607f274778b49110762
|
||||
|
|
@ -1 +1 @@
|
|||
7270299e4a4dde19d250825b0124fa36b60df847f046e058ccdfc74d4690beaaaaf387e050f596cb3445caf793d6a390ddb2d19650a3dccd4eb60056ae3b1477
|
||||
0e8ecbc5afb7fb5e521913f239849febadbc969bbf99159b42d6d7e7930dcdb34f0e778e00a6e7c48170d4dd176b5776455ba96b722ad9cb6f2438e6ac3ce406
|
||||
|
|
@ -1 +1 @@
|
|||
482760c362f56e453ce4b466083e77f84a461e636330d7cc2cb1cf7facced678a57a7c785ff9d039b3f575396cb435f99df05d6fa207f553c28ed3ce4f8151b3
|
||||
df0089700d7ca25e997d9e6da4aa7132575298feb14398b2e806961fdb2e1d9bfbd23beb7bbc2a71b2ce18abe324702c2ab654af32e826bba5571a068b00a848
|
||||
|
|
@ -1 +1 @@
|
|||
f3c246a1c83b1283163b22069f78231e3f6623fa3c2eb664ce400d0fff07105b6106d0fa8c6dfd49512a7eb676c80e4ee602e19063a9fc453394fe07a94a1bdd
|
||||
2fb062798cab618153187fe3d8aaee4c6fb61132ab8215742e5939633ab321fb937d4d33a85856271bdf465257aca9cbba1b52716f233c22202ecfbbb9c15b1f
|
||||
|
|
@ -1 +1 @@
|
|||
a97ae7049ac8c30b838987a3e87cbe5ff70b004ee0434e6204931def46c4c099bfef06e74658dab1114cc1035d3f404211a9bc94ef96e9cfb5b788da39d17bbd
|
||||
1e43a3ef68b15aededc0466c913d2f784d237adc88827a980a3dcdcfd64e9bb73679cc3114d69caf389f9c478c439a8771602c397461b90ae0db58a81bfb739a
|
||||
|
|
@ -1 +1 @@
|
|||
5a0461d03b0d9653ee35fded4be23e9b8316e3b7e21d352f822bc1f9763c03e9edab922bdc431f30d2a647c4216d45deba396bf56203027a328b7b28d970e0b8
|
||||
dc94fe38751001e3950450f8f6e7a865a42e699be76372ac7846da863283b6bb963c32b477ace4217be60e1f7a473e946d27238b3faf17d3b7426dbd1a34f9e6
|
||||
|
|
@ -1 +1 @@
|
|||
33b7b97f55a337d7001e7927517db6d36d512efec01fa5512c80bbc76b0b581f691a72a3810251aa97491b8cdf25a8ddcc9c9b3e3f54ccc6c315a84e715567d3
|
||||
bd5362b44190406434cdaa086b7e7397e8f6841b86ad61eda2c3f604df03746832dbcff0e8e96e355f5ba5b4333d6a336358379f8ced51f7a1721ceacb620daa
|
||||
|
|
@ -1 +1 @@
|
|||
b1a63345fc721f87c8fc25babb06741b585ee5dff5f29bb6debfbabb2ad57cb762d98c14e544df998a27bc725fb2704092fcdde54315ff832dff96c3641551d0
|
||||
7909822f2ad84443506129719c664b71ac0eac875a7c234be42c553564435794b6028078b096b21e9fb5dad650495b84f2b53decf73e277c84a3ea52799c008e
|
||||
|
|
@ -1 +1 @@
|
|||
ba1010f940c50314d61aae9f729b7bb476a6b35c5556fbc689ba3fde70ff50b0ba5dad0db3b38349a1562d67817047090ac450a64d895c8f3393163fe7914763
|
||||
4eee301ac8b984041ded725f1b031602e823edec1dd0883481fba794d6301eb5b83a0e87cf77b1298901de518c783ee5a017a91b5ac962ab0db8b37bb9918053
|
||||
|
|
@ -1 +1 @@
|
|||
57e4aa7550789aec0fcbc4a8917e9d28b1f1ae098a09cde95b757fd87d0dd3924c1bb9d4b23c59cd3793446fb6bbc8af4e1bb46323d70d5e5acd13db1167f545
|
||||
32c8c6625dbeecd8ed670871234a0aa9878a29cd86d93328151d90eda209bf70ee83901418cb29f7e8ef66d6f9bdc74a350f2340b285abc64d772baf02ed6377
|
||||
|
|
@ -1 +1 @@
|
|||
a42b2e165f59d3f499865d5db1e7db9b4cb25e48290f94080e569a9efc0b437d75cbb5773ac564f6cc95b19521fb7bc97a3eb641b491828c90cd086dc0c06a4b
|
||||
ef1c9dc1906068cb48427ffc8776d8b95810ca1aca4534692ab7f788d8dac84c5f4545c7edbd884b55fb3e2b35aa1f28b9277d359427fe89bed012b38bf6342e
|
||||
|
|
@ -1 +1 @@
|
|||
764d3ba6b1bc86b462d44151242bd18fa5f0200b831bb7537cf881b728622799eb95a457f88a503487bfd30095c1fa995818d50a6bc41dd182009772c010e82b
|
||||
2ec83c8c9175d4fccd6421ef736cced51f90bf01f7e20992a0d1b49db04221132d483032467c9dcda5f562f10a67f5fde1967a025230e4ea2bf9668816881d21
|
||||
|
|
@ -1 +1 @@
|
|||
17541e365f35ebd25134465a02d9a66e46536c4e3f5769da62137ec94ee7c8fb46ef38b9039aa6430261329a4e1b0ce677174323563e5be2f1368dc0c552e312
|
||||
b304e586966abb31fbe625a7a48547e51ea563061928c61bc8bbec01df94b4a61b8c874dd4b5cac86a74508e81dd3f7dd8d801fcc4fe75ded5eeb3f73cf113a2
|
||||
|
|
@ -1 +1 @@
|
|||
8ae1b048b90a049d9ed42336a0a2e8f7a250a14d889cc15e0c2831ed71617a78b92570480a15f936f2dd623c75f55693e38c69041c3cae24aba082409b51bc9f
|
||||
9c3d305ad2c4ac642db896100805c32ce0cf0bbf89958718a30afde7e1dd1329fb7946c35fc628355d29270760e5f1c3700890dfba1afe8d31f4deab63de86ff
|
||||
|
|
@ -1 +1 @@
|
|||
205e5cac8129797b815f0e79dad6c41a1876157ba69fcffecf67c3603dc36ded5f0168f9961d51fcb7dc7db6d732e7a3e8f82d04947aa0309df56bb8333d4bc9
|
||||
c483f62afa60f7390bbd82d7372a1f629f6783f8fb85857c63a3912e8d980118eff38f356b53312d067daa0f190634ac89bebac19cfe15325fb2b440473addae
|
||||
|
|
@ -1 +1 @@
|
|||
b5baba05419ce120bd22d935af9cdd6d206ad5dc5cae5991a9d160c70bb029f2d87040fa4e19f7190de64b908ac6a41a8b28db4a4f3883ec16e529b1449e983d
|
||||
b3e7dc8968d814e455866532c05702196bab7dbdaca3c6cd3eb4f22243efb67755b373a7c54de7d767c6f3e0c4b5db612c345832c8f07cd1f50bc08fc841b3b8
|
||||
|
|
@ -1 +1 @@
|
|||
a153add0502ff0fd4b0670f01679e104be1bb05941e73fb35e426c7f1e41a6144c7eb81fdba0d62ea3f39c7c6798028ff6d5df8c7a50b3e3f9e9bfe72fd48c2f
|
||||
fae463e84fbb166a9ec03390824e359d162fae9f8556d44681c76907c22a0d48e69281dcce6ffd7f3d6e4b19dad3d705c516328d902878288300f87c4a72a671
|
||||
|
|
@ -1 +1 @@
|
|||
fe56d58827d1803c1a49391711ad682be4a7cbc51519248812554f66e3e46266edc179f4254291a5f455751d3cdc13a17bbd103b9810c8818f36e4d283b503be
|
||||
2d2e8de66740bbed327dd926f59d75120b04d30ffb9d7c96876ba21c7768c367c63e3624c3ee40553dc40d9a5379fa0052a932a6c5f45d1ad4327c4ac83cdff2
|
||||
|
|
@ -1 +1 @@
|
|||
d80a9e8befab978bc84a231437a2b96c8f6dba81984c9e82a79360feb26bc9875b661131dbaa2deeb66b0aa50a39b2e738303bc40c5c65ee1995cf52f687ae46
|
||||
8dd146ebd2008801a4c83470e8d9fcc8d39fe5e687c65f980eca209dd5f7fb8d17bfadf3bf3d452eaa564ee5f35a8fc97adc3dda44160d6ad574b784f2dd0030
|
||||
|
|
@ -1 +1 @@
|
|||
8813917cab656135c4eebfdbe5f0d95e6a9409a2b36df1dfb483bdd193a3c0978727918a58399b259b82a7d51ae3f1801148bd978603fec11f27acdbf89520e2
|
||||
7bf8aa36c31ca8b34f7c410901cb96e1ba7d389c33c850591519b15753c1322b75e5051c960dbc2e254cf46cc9720dd5e348aac0acbb70d10c71165e2f5ab9e4
|
||||
|
|
@ -1 +1 @@
|
|||
4dbbd9cec921d2420e7567533c833afbe94335073aa760d1fd937adb695191b3ab7c070ec0d32721dddb4a46054e68322cf6a058420e20e439eb1d44f09f4be4
|
||||
3c05a49f78866eda267c9f8eab2669a3a1aeb4eabfade9697d551b13f482d9076190c63a52a8aade59c20d917cebdd3e9bedabda6bc5bfd549db43cc61d7466f
|
||||
1
tests/test_source/inputs_true.dat
Normal file
1
tests/test_source/inputs_true.dat
Normal file
|
|
@ -0,0 +1 @@
|
|||
5c2fdde85affcd44c1b02c07c300acb8e5c189c1adbf7aa079e37a68e8b8313678fc292bd7f6e0d0957f723e05b8146bd165cf3315dde5f6b2f88ebc954cd65e
|
||||
2
tests/test_source/results_true.dat
Normal file
2
tests/test_source/results_true.dat
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
k-combined:
|
||||
3.014392E-01 7.185055E-03
|
||||
73
tests/test_source/test_source.py
Normal file
73
tests/test_source/test_source.py
Normal file
|
|
@ -0,0 +1,73 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
from math import pi
|
||||
import os
|
||||
import sys
|
||||
|
||||
import numpy as np
|
||||
|
||||
sys.path.insert(0, os.pardir)
|
||||
from testing_harness import PyAPITestHarness
|
||||
import openmc
|
||||
import openmc.stats
|
||||
from openmc.source import Source
|
||||
|
||||
|
||||
class SourceTestHarness(PyAPITestHarness):
|
||||
def _build_inputs(self):
|
||||
mat1 = openmc.Material(material_id=1)
|
||||
mat1.set_density('g/cm3', 4.5)
|
||||
mat1.add_nuclide(openmc.Nuclide('U-235', '71c'), 1.0)
|
||||
materials = openmc.MaterialsFile()
|
||||
materials.add_material(mat1)
|
||||
materials.export_to_xml()
|
||||
|
||||
sphere = openmc.Sphere(surface_id=1, R=10.0, boundary_type='vacuum')
|
||||
inside_sphere = openmc.Cell(cell_id=1)
|
||||
inside_sphere.region = -sphere
|
||||
inside_sphere.fill = mat1
|
||||
|
||||
root = openmc.Universe(universe_id=0)
|
||||
root.add_cell(inside_sphere)
|
||||
geometry = openmc.Geometry()
|
||||
geometry.root_universe = root
|
||||
geometry_xml = openmc.GeometryFile()
|
||||
geometry_xml.geometry = geometry
|
||||
geometry_xml.export_to_xml()
|
||||
|
||||
# Create an array of different sources
|
||||
x_dist = openmc.stats.Uniform(-3., 3.)
|
||||
y_dist = openmc.stats.Discrete([-4., -1., 3.], [0.2, 0.3, 0.5])
|
||||
z_dist = openmc.stats.Tabular([-2., 0., 2.], [0.2, 0.3, 0.2])
|
||||
spatial1 = openmc.stats.CartesianIndependent(x_dist, y_dist, z_dist)
|
||||
spatial2 = openmc.stats.Box([-4., -4., -4.], [4., 4., 4.])
|
||||
spatial3 = openmc.stats.Point([1.2, -2.3, 0.781])
|
||||
|
||||
mu_dist = openmc.stats.Discrete([-1., 0., 1.], [0.5, 0.25, 0.25])
|
||||
phi_dist = openmc.stats.Uniform(0., 6.28318530718)
|
||||
angle1 = openmc.stats.PolarAzimuthal(mu_dist, phi_dist)
|
||||
angle2 = openmc.stats.Monodirectional(reference_uvw=[0., 1., 0.])
|
||||
angle3 = openmc.stats.Isotropic()
|
||||
|
||||
E = np.logspace(-6, 1)
|
||||
p = np.sin(np.linspace(0., pi))
|
||||
p /= sum(np.diff(E)*p[:-1])
|
||||
energy1 = openmc.stats.Maxwell(1.2895)
|
||||
energy2 = openmc.stats.Watt(0.988, 2.249)
|
||||
energy3 = openmc.stats.Tabular(E, p, interpolation='histogram')
|
||||
|
||||
source1 = Source(spatial1, angle1, energy1, strength=0.5)
|
||||
source2 = Source(spatial2, angle2, energy2, strength=0.3)
|
||||
source3 = Source(spatial3, angle3, energy3, strength=0.2)
|
||||
|
||||
settings = openmc.SettingsFile()
|
||||
settings.batches = 10
|
||||
settings.inactive = 5
|
||||
settings.particles = 1000
|
||||
settings.source = [source1, source2, source3]
|
||||
settings.export_to_xml()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
harness = SourceTestHarness('statepoint.10.h5')
|
||||
harness.main()
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<geometry>
|
||||
|
||||
<!-- Sphere with radius 10 -->
|
||||
<surface id="1" type="sphere" coeffs="0 0 0 10" boundary="vacuum"/>
|
||||
<cell id="1" material="1" region="-1" />
|
||||
|
||||
</geometry>
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<materials>
|
||||
|
||||
<material id="1">
|
||||
<density value="4.5" units="g/cc" />
|
||||
<nuclide name="U-235" xs="71c" ao="1.0" />
|
||||
</material>
|
||||
|
||||
</materials>
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
k-combined:
|
||||
2.964943E-01 1.201478E-02
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<settings>
|
||||
|
||||
<eigenvalue>
|
||||
<batches>10</batches>
|
||||
<inactive>5</inactive>
|
||||
<particles>1000</particles>
|
||||
</eigenvalue>
|
||||
|
||||
<source>
|
||||
<space type="box" parameters="-4 -4 -4 4 4 4" />
|
||||
<angle type="monodirectional" parameters="1 0 0" />
|
||||
</source>
|
||||
|
||||
</settings>
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import os
|
||||
import sys
|
||||
sys.path.insert(0, os.pardir)
|
||||
from testing_harness import TestHarness
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
harness = TestHarness('statepoint.10.*')
|
||||
harness.main()
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<geometry>
|
||||
|
||||
<!-- Sphere with radius 10 -->
|
||||
<surface id="1" type="sphere" coeffs="0 0 0 10" boundary="vacuum"/>
|
||||
<cell id="1" material="1" region="-1" />
|
||||
|
||||
</geometry>
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<materials>
|
||||
|
||||
<material id="1">
|
||||
<density value="4.5" units="g/cc" />
|
||||
<nuclide name="U-235" xs="71c" ao="1.0" />
|
||||
</material>
|
||||
|
||||
</materials>
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
k-combined:
|
||||
2.886671E-01 7.534631E-03
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<settings>
|
||||
|
||||
<eigenvalue>
|
||||
<batches>10</batches>
|
||||
<inactive>5</inactive>
|
||||
<particles>1000</particles>
|
||||
</eigenvalue>
|
||||
|
||||
<source>
|
||||
<space type="box" parameters="-4 -4 -4 4 4 4" />
|
||||
<energy type="maxwell" parameters="1.2895" />
|
||||
</source>
|
||||
|
||||
</settings>
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import os
|
||||
import sys
|
||||
sys.path.insert(0, os.pardir)
|
||||
from testing_harness import TestHarness
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
harness = TestHarness('statepoint.10.*')
|
||||
harness.main()
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<geometry>
|
||||
|
||||
<!-- Sphere with radius 10 -->
|
||||
<surface id="1" type="sphere" coeffs="0 0 0 10" boundary="vacuum"/>
|
||||
<cell id="1" material="1" region="-1" />
|
||||
|
||||
</geometry>
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<materials>
|
||||
|
||||
<material id="1">
|
||||
<density value="4.5" units="g/cc" />
|
||||
<nuclide name="U-235" xs="71c" ao="1.0" />
|
||||
</material>
|
||||
|
||||
</materials>
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
k-combined:
|
||||
3.002731E-01 7.561170E-03
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<settings>
|
||||
|
||||
<eigenvalue>
|
||||
<batches>10</batches>
|
||||
<inactive>5</inactive>
|
||||
<particles>1000</particles>
|
||||
</eigenvalue>
|
||||
|
||||
<source>
|
||||
<space type="box" parameters="-4 -4 -4 4 4 4" />
|
||||
<energy type="monoenergetic" parameters="0.0253e-6" />
|
||||
</source>
|
||||
|
||||
</settings>
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import os
|
||||
import sys
|
||||
sys.path.insert(0, os.pardir)
|
||||
from testing_harness import TestHarness
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
harness = TestHarness('statepoint.10.*')
|
||||
harness.main()
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<geometry>
|
||||
|
||||
<!-- Sphere with radius 10 -->
|
||||
<surface id="1" type="sphere" coeffs="0 0 0 10" boundary="vacuum"/>
|
||||
<cell id="1" material="1" region="-1" />
|
||||
|
||||
</geometry>
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<materials>
|
||||
|
||||
<material id="1">
|
||||
<density value="4.5" units="g/cc" />
|
||||
<nuclide name="U-235" xs="71c" ao="1.0" />
|
||||
</material>
|
||||
|
||||
</materials>
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
k-combined:
|
||||
3.041148E-01 4.558319E-03
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<settings>
|
||||
|
||||
<eigenvalue>
|
||||
<batches>10</batches>
|
||||
<inactive>5</inactive>
|
||||
<particles>1000</particles>
|
||||
</eigenvalue>
|
||||
|
||||
<source>
|
||||
<space type="point" parameters="1.2 -2.3 0.781" />
|
||||
</source>
|
||||
|
||||
</settings>
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue