From 41a9ede62765630b9d10685f1c119a4612dc8941 Mon Sep 17 00:00:00 2001 From: Will Boyd Date: Thu, 8 Oct 2015 19:58:39 -0400 Subject: [PATCH] Implemented new static factory MGXS.get_mgxs(...) method --- .../examples/multi-group-cross-sections.ipynb | 450 ++++++++++++++++-- openmc/mgxs/mgxs.py | 92 +++- 2 files changed, 505 insertions(+), 37 deletions(-) diff --git a/docs/source/pythonapi/examples/multi-group-cross-sections.ipynb b/docs/source/pythonapi/examples/multi-group-cross-sections.ipynb index 70fdbfe11..652c21a11 100644 --- a/docs/source/pythonapi/examples/multi-group-cross-sections.ipynb +++ b/docs/source/pythonapi/examples/multi-group-cross-sections.ipynb @@ -437,7 +437,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 15, "metadata": { "collapsed": false }, @@ -463,7 +463,7 @@ " License: http://mit-crpg.github.io/openmc/license.html\n", " Version: 0.7.0\n", " Git SHA1: 23535afa1c69644bb299bde18a094c3b99d53ae0\n", - " Date/Time: 2015-10-08 19:25:10\n", + " Date/Time: 2015-10-08 19:56:45\n", " MPI Processes: 1\n", "\n", " ===========================================================================\n", @@ -533,8 +533,55 @@ " 42/1 1.11114 1.16491 +/- 0.00529\n", " 43/1 1.14227 1.16423 +/- 0.00517\n", " 44/1 1.14104 1.16355 +/- 0.00506\n", - " 45/1 1.16756 1.16366 +/- 0.00492\n" + " 45/1 1.16756 1.16366 +/- 0.00492\n", + " 46/1 1.13065 1.16274 +/- 0.00487\n", + " 47/1 1.11251 1.16139 +/- 0.00492\n", + " 48/1 1.14731 1.16101 +/- 0.00481\n", + " 49/1 1.16691 1.16117 +/- 0.00469\n", + " 50/1 1.19679 1.16206 +/- 0.00465\n", + " Creating state point statepoint.50.h5...\n", + "\n", + " ===========================================================================\n", + " ======================> SIMULATION FINISHED <======================\n", + " ===========================================================================\n", + "\n", + "\n", + " =======================> TIMING STATISTICS <=======================\n", + "\n", + " Total time for initialization = 4.5500E-01 seconds\n", + " Reading cross sections = 9.0000E-02 seconds\n", + " Total time in simulation = 1.3254E+01 seconds\n", + " Time in transport only = 1.3238E+01 seconds\n", + " Time in inactive batches = 1.8670E+00 seconds\n", + " Time in active batches = 1.1387E+01 seconds\n", + " Time synchronizing fission bank = 8.0000E-03 seconds\n", + " Sampling source sites = 7.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.3719E+01 seconds\n", + " Calculation Rate (inactive) = 13390.5 neutrons/second\n", + " Calculation Rate (active) = 8781.94 neutrons/second\n", + "\n", + " ============================> RESULTS <============================\n", + "\n", + " k-effective (Collision) = 1.16131 +/- 0.00453\n", + " k-effective (Track-length) = 1.16206 +/- 0.00465\n", + " k-effective (Absorption) = 1.16096 +/- 0.00364\n", + " Combined k-effective = 1.16120 +/- 0.00325\n", + " Leakage Fraction = 0.00000 +/- 0.00000\n", + "\n" ] + }, + { + "data": { + "text/plain": [ + "0" + ] + }, + "execution_count": 15, + "metadata": {}, + "output_type": "execute_result" } ], "source": [ @@ -559,7 +606,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 16, "metadata": { "collapsed": false }, @@ -578,7 +625,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 17, "metadata": { "collapsed": false }, @@ -598,7 +645,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 18, "metadata": { "collapsed": false }, @@ -620,11 +667,19 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 19, "metadata": { "collapsed": false }, - "outputs": [], + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "/usr/local/lib/python2.7/dist-packages/openmc-0.7.0-py2.7.egg/openmc/tallies.py:1486: RuntimeWarning: invalid value encountered in divide\n" + ] + } + ], "source": [ "transport.compute_xs()\n", "nufission.compute_xs()\n", @@ -655,11 +710,34 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 20, "metadata": { "collapsed": false }, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Multi-Group XS\n", + "\tReaction Type =\tnu-fission\n", + "\tDomain Type =\tcell\n", + "\tDomain ID =\t1\n", + "\tCross Sections [cm^-1]:\n", + " Group 1 [0.821 - 20.0 MeV]:\t1.11e-02 +/- 7.69e-01%\n", + " Group 2 [0.00553 - 0.821 MeV]:\t6.59e-04 +/- 2.97e-01%\n", + " Group 3 [4e-06 - 0.00553 MeV]:\t8.95e-03 +/- 5.12e-01%\n", + " Group 4 [6.25e-07 - 4e-06 MeV]:\t1.45e-02 +/- 7.10e-01%\n", + " Group 5 [2.8e-07 - 6.25e-07 MeV]:\t4.71e-02 +/- 1.02e+00%\n", + " Group 6 [1.4e-07 - 2.8e-07 MeV]:\t7.29e-02 +/- 8.86e-01%\n", + " Group 7 [5.8e-08 - 1.4e-07 MeV]:\t1.11e-01 +/- 6.67e-01%\n", + " Group 8 [0.0 - 5.8e-08 MeV]:\t2.38e-01 +/- 7.71e-01%\n", + "\n", + "\n", + "\n" + ] + } + ], "source": [ "nufission.print_xs()" ] @@ -673,11 +751,141 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 21, "metadata": { "collapsed": false }, - "outputs": [], + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
cellgroup ingroup outnuclidemeanstd. dev.
63111total0.0769700.001012
62112total0.0878760.000344
61113total0.0004180.000023
60114total0.0000000.000000
59115total0.0000000.000000
58116total0.0000000.000000
57117total0.0000000.000000
56118total0.0000000.000000
55121total0.0000000.000000
54122total0.2664990.001265
\n", + "
" + ], + "text/plain": [ + " cell group in group out nuclide mean std. dev.\n", + "63 1 1 1 total 0.076970 0.001012\n", + "62 1 1 2 total 0.087876 0.000344\n", + "61 1 1 3 total 0.000418 0.000023\n", + "60 1 1 4 total 0.000000 0.000000\n", + "59 1 1 5 total 0.000000 0.000000\n", + "58 1 1 6 total 0.000000 0.000000\n", + "57 1 1 7 total 0.000000 0.000000\n", + "56 1 1 8 total 0.000000 0.000000\n", + "55 1 2 1 total 0.000000 0.000000\n", + "54 1 2 2 total 0.266499 0.001265" + ] + }, + "execution_count": 21, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "df = nuscatter.get_pandas_dataframe()\n", "df.head(10)" @@ -692,7 +900,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 22, "metadata": { "collapsed": true }, @@ -710,7 +918,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 23, "metadata": { "collapsed": true }, @@ -738,11 +946,24 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 24, "metadata": { "collapsed": false }, - "outputs": [], + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "/usr/lib/pymodules/python2.7/matplotlib/__init__.py:1173: UserWarning: This call to matplotlib.use() has no effect\n", + "because the backend has already been chosen;\n", + "matplotlib.use() must be called *before* pylab, matplotlib.pyplot,\n", + "or matplotlib.backends is imported for the first time.\n", + "\n", + " warnings.warn(_use_error_msg)\n" + ] + } + ], "source": [ "# Import OpenMOC and the OpenMOC/OpenCG compatibility module\n", "import openmoc\n", @@ -764,7 +985,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 25, "metadata": { "collapsed": true }, @@ -798,11 +1019,148 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 26, "metadata": { "collapsed": false }, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[ NORMAL ] Ray tracing for track segmentation...\n", + "[ NORMAL ] Dumping tracks to file...\n", + "[ NORMAL ] Computing the eigenvalue...\n", + "[ NORMAL ] Iteration 0:\tk_eff = 0.685185\tres = 0.000E+00\n", + "[ NORMAL ] Iteration 1:\tk_eff = 0.785642\tres = 3.148E-01\n", + "[ NORMAL ] Iteration 2:\tk_eff = 0.750185\tres = 1.466E-01\n", + "[ NORMAL ] Iteration 3:\tk_eff = 0.728847\tres = 4.513E-02\n", + "[ NORMAL ] Iteration 4:\tk_eff = 0.695633\tres = 2.844E-02\n", + "[ NORMAL ] Iteration 5:\tk_eff = 0.663357\tres = 4.557E-02\n", + "[ NORMAL ] Iteration 6:\tk_eff = 0.632339\tres = 4.640E-02\n", + "[ NORMAL ] Iteration 7:\tk_eff = 0.604187\tres = 4.676E-02\n", + "[ NORMAL ] Iteration 8:\tk_eff = 0.579451\tres = 4.452E-02\n", + "[ NORMAL ] Iteration 9:\tk_eff = 0.558474\tres = 4.094E-02\n", + "[ NORMAL ] Iteration 10:\tk_eff = 0.541436\tres = 3.620E-02\n", + "[ NORMAL ] Iteration 11:\tk_eff = 0.528380\tres = 3.051E-02\n", + "[ NORMAL ] Iteration 12:\tk_eff = 0.519273\tres = 2.411E-02\n", + "[ NORMAL ] Iteration 13:\tk_eff = 0.513991\tres = 1.724E-02\n", + "[ NORMAL ] Iteration 14:\tk_eff = 0.512364\tres = 1.017E-02\n", + "[ NORMAL ] Iteration 15:\tk_eff = 0.514171\tres = 3.165E-03\n", + "[ NORMAL ] Iteration 16:\tk_eff = 0.519155\tres = 3.527E-03\n", + "[ NORMAL ] Iteration 17:\tk_eff = 0.527038\tres = 9.693E-03\n", + "[ NORMAL ] Iteration 18:\tk_eff = 0.537524\tres = 1.518E-02\n", + "[ NORMAL ] Iteration 19:\tk_eff = 0.550310\tres = 1.990E-02\n", + "[ NORMAL ] Iteration 20:\tk_eff = 0.565096\tres = 2.379E-02\n", + "[ NORMAL ] Iteration 21:\tk_eff = 0.581585\tres = 2.687E-02\n", + "[ NORMAL ] Iteration 22:\tk_eff = 0.599493\tres = 2.918E-02\n", + "[ NORMAL ] Iteration 23:\tk_eff = 0.618548\tres = 3.079E-02\n", + "[ NORMAL ] Iteration 24:\tk_eff = 0.638497\tres = 3.179E-02\n", + "[ NORMAL ] Iteration 25:\tk_eff = 0.659105\tres = 3.225E-02\n", + "[ NORMAL ] Iteration 26:\tk_eff = 0.680156\tres = 3.228E-02\n", + "[ NORMAL ] Iteration 27:\tk_eff = 0.701456\tres = 3.194E-02\n", + "[ NORMAL ] Iteration 28:\tk_eff = 0.722831\tres = 3.132E-02\n", + "[ NORMAL ] Iteration 29:\tk_eff = 0.744127\tres = 3.047E-02\n", + "[ NORMAL ] Iteration 30:\tk_eff = 0.765209\tres = 2.946E-02\n", + "[ NORMAL ] Iteration 31:\tk_eff = 0.785961\tres = 2.833E-02\n", + "[ NORMAL ] Iteration 32:\tk_eff = 0.806283\tres = 2.712E-02\n", + "[ NORMAL ] Iteration 33:\tk_eff = 0.826093\tres = 2.586E-02\n", + "[ NORMAL ] Iteration 34:\tk_eff = 0.845324\tres = 2.457E-02\n", + "[ NORMAL ] Iteration 35:\tk_eff = 0.863921\tres = 2.328E-02\n", + "[ NORMAL ] Iteration 36:\tk_eff = 0.881841\tres = 2.200E-02\n", + "[ NORMAL ] Iteration 37:\tk_eff = 0.899055\tres = 2.074E-02\n", + "[ NORMAL ] Iteration 38:\tk_eff = 0.915540\tres = 1.952E-02\n", + "[ NORMAL ] Iteration 39:\tk_eff = 0.931284\tres = 1.834E-02\n", + "[ NORMAL ] Iteration 40:\tk_eff = 0.946283\tres = 1.720E-02\n", + "[ NORMAL ] Iteration 41:\tk_eff = 0.960536\tres = 1.610E-02\n", + "[ NORMAL ] Iteration 42:\tk_eff = 0.974052\tres = 1.506E-02\n", + "[ NORMAL ] Iteration 43:\tk_eff = 0.986841\tres = 1.407E-02\n", + "[ NORMAL ] Iteration 44:\tk_eff = 0.998920\tres = 1.313E-02\n", + "[ NORMAL ] Iteration 45:\tk_eff = 1.010307\tres = 1.224E-02\n", + "[ NORMAL ] Iteration 46:\tk_eff = 1.021023\tres = 1.140E-02\n", + "[ NORMAL ] Iteration 47:\tk_eff = 1.031091\tres = 1.061E-02\n", + "[ NORMAL ] Iteration 48:\tk_eff = 1.040537\tres = 9.861E-03\n", + "[ NORMAL ] Iteration 49:\tk_eff = 1.049386\tres = 9.161E-03\n", + "[ NORMAL ] Iteration 50:\tk_eff = 1.057664\tres = 8.504E-03\n", + "[ NORMAL ] Iteration 51:\tk_eff = 1.065399\tres = 7.889E-03\n", + "[ NORMAL ] Iteration 52:\tk_eff = 1.072617\tres = 7.313E-03\n", + "[ NORMAL ] Iteration 53:\tk_eff = 1.079345\tres = 6.775E-03\n", + "[ NORMAL ] Iteration 54:\tk_eff = 1.085609\tres = 6.273E-03\n", + "[ NORMAL ] Iteration 55:\tk_eff = 1.091436\tres = 5.804E-03\n", + "[ NORMAL ] Iteration 56:\tk_eff = 1.096851\tres = 5.367E-03\n", + "[ NORMAL ] Iteration 57:\tk_eff = 1.101877\tres = 4.961E-03\n", + "[ NORMAL ] Iteration 58:\tk_eff = 1.106540\tres = 4.583E-03\n", + "[ NORMAL ] Iteration 59:\tk_eff = 1.110860\tres = 4.231E-03\n", + "[ NORMAL ] Iteration 60:\tk_eff = 1.114861\tres = 3.905E-03\n", + "[ NORMAL ] Iteration 61:\tk_eff = 1.118563\tres = 3.602E-03\n", + "[ NORMAL ] Iteration 62:\tk_eff = 1.121986\tres = 3.321E-03\n", + "[ NORMAL ] Iteration 63:\tk_eff = 1.125149\tres = 3.060E-03\n", + "[ NORMAL ] Iteration 64:\tk_eff = 1.128069\tres = 2.819E-03\n", + "[ NORMAL ] Iteration 65:\tk_eff = 1.130764\tres = 2.595E-03\n", + "[ NORMAL ] Iteration 66:\tk_eff = 1.133248\tres = 2.389E-03\n", + "[ NORMAL ] Iteration 67:\tk_eff = 1.135538\tres = 2.197E-03\n", + "[ NORMAL ] Iteration 68:\tk_eff = 1.137648\tres = 2.021E-03\n", + "[ NORMAL ] Iteration 69:\tk_eff = 1.139590\tres = 1.858E-03\n", + "[ NORMAL ] Iteration 70:\tk_eff = 1.141377\tres = 1.707E-03\n", + "[ NORMAL ] Iteration 71:\tk_eff = 1.143021\tres = 1.568E-03\n", + "[ NORMAL ] Iteration 72:\tk_eff = 1.144531\tres = 1.440E-03\n", + "[ NORMAL ] Iteration 73:\tk_eff = 1.145920\tres = 1.322E-03\n", + "[ NORMAL ] Iteration 74:\tk_eff = 1.147195\tres = 1.213E-03\n", + "[ NORMAL ] Iteration 75:\tk_eff = 1.148365\tres = 1.113E-03\n", + "[ NORMAL ] Iteration 76:\tk_eff = 1.149440\tres = 1.020E-03\n", + "[ NORMAL ] Iteration 77:\tk_eff = 1.150425\tres = 9.356E-04\n", + "[ NORMAL ] Iteration 78:\tk_eff = 1.151329\tres = 8.574E-04\n", + "[ NORMAL ] Iteration 79:\tk_eff = 1.152157\tres = 7.856E-04\n", + "[ NORMAL ] Iteration 80:\tk_eff = 1.152916\tres = 7.196E-04\n", + "[ NORMAL ] Iteration 81:\tk_eff = 1.153612\tres = 6.590E-04\n", + "[ NORMAL ] Iteration 82:\tk_eff = 1.154249\tres = 6.033E-04\n", + "[ NORMAL ] Iteration 83:\tk_eff = 1.154832\tres = 5.522E-04\n", + "[ NORMAL ] Iteration 84:\tk_eff = 1.155366\tres = 5.053E-04\n", + "[ NORMAL ] Iteration 85:\tk_eff = 1.155855\tres = 4.623E-04\n", + "[ NORMAL ] Iteration 86:\tk_eff = 1.156302\tres = 4.229E-04\n", + "[ NORMAL ] Iteration 87:\tk_eff = 1.156710\tres = 3.866E-04\n", + "[ NORMAL ] Iteration 88:\tk_eff = 1.157084\tres = 3.535E-04\n", + "[ NORMAL ] Iteration 89:\tk_eff = 1.157426\tres = 3.230E-04\n", + "[ NORMAL ] Iteration 90:\tk_eff = 1.157738\tres = 2.952E-04\n", + "[ NORMAL ] Iteration 91:\tk_eff = 1.158023\tres = 2.697E-04\n", + "[ NORMAL ] Iteration 92:\tk_eff = 1.158284\tres = 2.464E-04\n", + "[ NORMAL ] Iteration 93:\tk_eff = 1.158522\tres = 2.251E-04\n", + "[ NORMAL ] Iteration 94:\tk_eff = 1.158739\tres = 2.055E-04\n", + "[ NORMAL ] Iteration 95:\tk_eff = 1.158937\tres = 1.876E-04\n", + "[ NORMAL ] Iteration 96:\tk_eff = 1.159119\tres = 1.713E-04\n", + "[ NORMAL ] Iteration 97:\tk_eff = 1.159284\tres = 1.564E-04\n", + "[ NORMAL ] Iteration 98:\tk_eff = 1.159435\tres = 1.428E-04\n", + "[ NORMAL ] Iteration 99:\tk_eff = 1.159573\tres = 1.301E-04\n", + "[ NORMAL ] Iteration 100:\tk_eff = 1.159699\tres = 1.188E-04\n", + "[ NORMAL ] Iteration 101:\tk_eff = 1.159813\tres = 1.083E-04\n", + "[ NORMAL ] Iteration 102:\tk_eff = 1.159917\tres = 9.880E-05\n", + "[ NORMAL ] Iteration 103:\tk_eff = 1.160013\tres = 9.009E-05\n", + "[ NORMAL ] Iteration 104:\tk_eff = 1.160100\tres = 8.222E-05\n", + "[ NORMAL ] Iteration 105:\tk_eff = 1.160179\tres = 7.487E-05\n", + "[ NORMAL ] Iteration 106:\tk_eff = 1.160251\tres = 6.824E-05\n", + "[ NORMAL ] Iteration 107:\tk_eff = 1.160317\tres = 6.223E-05\n", + "[ NORMAL ] Iteration 108:\tk_eff = 1.160376\tres = 5.675E-05\n", + "[ NORMAL ] Iteration 109:\tk_eff = 1.160431\tres = 5.174E-05\n", + "[ NORMAL ] Iteration 110:\tk_eff = 1.160481\tres = 4.715E-05\n", + "[ NORMAL ] Iteration 111:\tk_eff = 1.160527\tres = 4.298E-05\n", + "[ NORMAL ] Iteration 112:\tk_eff = 1.160568\tres = 3.910E-05\n", + "[ NORMAL ] Iteration 113:\tk_eff = 1.160605\tres = 3.561E-05\n", + "[ NORMAL ] Iteration 114:\tk_eff = 1.160640\tres = 3.242E-05\n", + "[ NORMAL ] Iteration 115:\tk_eff = 1.160671\tres = 2.960E-05\n", + "[ NORMAL ] Iteration 116:\tk_eff = 1.160699\tres = 2.689E-05\n", + "[ NORMAL ] Iteration 117:\tk_eff = 1.160725\tres = 2.452E-05\n", + "[ NORMAL ] Iteration 118:\tk_eff = 1.160749\tres = 2.232E-05\n", + "[ NORMAL ] Iteration 119:\tk_eff = 1.160770\tres = 2.034E-05\n", + "[ NORMAL ] Iteration 120:\tk_eff = 1.160790\tres = 1.855E-05\n", + "[ NORMAL ] Iteration 121:\tk_eff = 1.160807\tres = 1.687E-05\n", + "[ NORMAL ] Iteration 122:\tk_eff = 1.160824\tres = 1.538E-05\n", + "[ NORMAL ] Iteration 123:\tk_eff = 1.160838\tres = 1.399E-05\n", + "[ NORMAL ] Iteration 124:\tk_eff = 1.160852\tres = 1.280E-05\n", + "[ NORMAL ] Iteration 125:\tk_eff = 1.160864\tres = 1.149E-05\n", + "[ NORMAL ] Iteration 126:\tk_eff = 1.160875\tres = 1.061E-05\n" + ] + } + ], "source": [ "# Generate tracks for OpenMOC\n", "openmoc_geometry.initializeFlatSourceRegions()\n", @@ -823,11 +1181,21 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 27, "metadata": { "collapsed": false }, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "openmc keff = 1.161200\n", + "openmoc keff = 1.160875\n", + "bias [pcm]: -32.5\n" + ] + } + ], "source": [ "# Print report of keff and bias with OpenMC\n", "openmoc_keff = solver.getKeff()\n", @@ -876,7 +1244,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 28, "metadata": { "collapsed": false }, @@ -910,7 +1278,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 29, "metadata": { "collapsed": true }, @@ -936,7 +1304,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 30, "metadata": { "collapsed": true }, @@ -965,11 +1333,22 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 31, "metadata": { "collapsed": false }, - "outputs": [], + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "/usr/local/lib/python2.7/dist-packages/openmc-0.7.0-py2.7.egg/openmc/universe.py:223: DeprecationWarning: Cell.add_surface(...) has been deprecated and may be removed in a future version. The region for a Cell should be defined using the region property directly.\n", + "/usr/local/lib/python2.7/dist-packages/openmc-0.7.0-py2.7.egg/openmc/universe.py:223: DeprecationWarning: Cell.add_surface(...) has been deprecated and may be removed in a future version. The region for a Cell should be defined using the region property directly.\n", + "/usr/local/lib/python2.7/dist-packages/openmc-0.7.0-py2.7.egg/openmc/universe.py:223: DeprecationWarning: Cell.add_surface(...) has been deprecated and may be removed in a future version. The region for a Cell should be defined using the region property directly.\n", + "/usr/local/lib/python2.7/dist-packages/openmc-0.7.0-py2.7.egg/openmc/universe.py:223: DeprecationWarning: Cell.add_surface(...) has been deprecated and may be removed in a future version. The region for a Cell should be defined using the region property directly.\n" + ] + } + ], "source": [ "# Create a Universe to encapsulate a fuel pin\n", "pin_cell_universe = openmc.Universe(name='1.6% Fuel Pin')\n", @@ -1003,11 +1382,22 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 32, "metadata": { "collapsed": false }, - "outputs": [], + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "/usr/local/lib/python2.7/dist-packages/openmc-0.7.0-py2.7.egg/openmc/universe.py:223: DeprecationWarning: Cell.add_surface(...) has been deprecated and may be removed in a future version. The region for a Cell should be defined using the region property directly.\n", + "/usr/local/lib/python2.7/dist-packages/openmc-0.7.0-py2.7.egg/openmc/universe.py:223: DeprecationWarning: Cell.add_surface(...) has been deprecated and may be removed in a future version. The region for a Cell should be defined using the region property directly.\n", + "/usr/local/lib/python2.7/dist-packages/openmc-0.7.0-py2.7.egg/openmc/universe.py:223: DeprecationWarning: Cell.add_surface(...) has been deprecated and may be removed in a future version. The region for a Cell should be defined using the region property directly.\n", + "/usr/local/lib/python2.7/dist-packages/openmc-0.7.0-py2.7.egg/openmc/universe.py:223: DeprecationWarning: Cell.add_surface(...) has been deprecated and may be removed in a future version. The region for a Cell should be defined using the region property directly.\n" + ] + } + ], "source": [ "# Create root Cell\n", "root_cell = openmc.Cell(name='root cell')\n", @@ -1033,7 +1423,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 33, "metadata": { "collapsed": true }, @@ -1060,7 +1450,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 34, "metadata": { "collapsed": false }, diff --git a/openmc/mgxs/mgxs.py b/openmc/mgxs/mgxs.py index 579557ae8..5659ec4d3 100644 --- a/openmc/mgxs/mgxs.py +++ b/openmc/mgxs/mgxs.py @@ -16,16 +16,30 @@ if sys.version_info[0] >= 3: basestring = str +# Supported cross section types +MGXS_TYPES = ['total', + 'transport', + 'absorption', + 'capture', + 'fission', + 'nu-fission', + 'scatter', + 'nu-scatter', + 'scatter matrix', + 'nu-scatter matrix', + 'chi'] + + # Supported domain types # TODO: Implement Mesh domains -DOMAIN_TYPES = ['cell', +_DOMAIN_TYPES = ['cell', 'distribcell', 'universe', 'material'] # Supported domain classes # TODO: Implement Mesh domains -DOMAINS = [openmc.Cell, +_DOMAINS = [openmc.Cell, openmc.Universe, openmc.Material] @@ -47,7 +61,7 @@ class MGXS(object): energy_groups : EnergyGroups The energy group structure for energy condensation by_nuclide : bool - If true, computes multi-group cross sections for each nuclide in domain + If true, computes cross sections for each nuclide in domain name : str, optional Name of the multi-group cross section. Used as a label to identify tallies in OpenMC 'tallies.xml' file. @@ -59,7 +73,7 @@ class MGXS(object): rxn_type : str Reaction type (e.g., 'total', 'nu-fission', etc.) by_nuclide : bool - If true, computes multi-group cross sections for each nuclide in domain + If true, computes cross sections for each nuclide in domain domain : Material or Cell or Universe Domain for spatial homogenization domain_type : {'material', 'cell', 'distribcell', 'universe'} @@ -197,12 +211,12 @@ class MGXS(object): @domain.setter def domain(self, domain): - cv.check_type('domain', domain, tuple(DOMAINS)) + cv.check_type('domain', domain, tuple(_DOMAINS)) self._domain = domain @domain_type.setter def domain_type(self, domain_type): - cv.check_value('domain type', domain_type, tuple(DOMAIN_TYPES)) + cv.check_value('domain type', domain_type, tuple(_DOMAIN_TYPES)) self._domain_type = domain_type @energy_groups.setter @@ -211,6 +225,70 @@ class MGXS(object): self._energy_groups = energy_groups self._num_groups = energy_groups.num_groups + @staticmethod + def get_mgxs(mgxs_type, domain=None, domain_type=None, + energy_groups=None, by_nuclide=False, name=''): + """Return a MGXS subclass object for some energy group structure within + some spatial domain for some reaction type. + + This is a factory method which can be used to quickly create MGXS + subclass objects for various reaction types. + + Parameters + ---------- + mgxs_type : {'total', 'transport', 'absorption', 'capture', 'fission', + 'nu-fission', 'scatter', 'nu-scatter', 'scatter matrix', + 'nu-scatter matrix', 'chi'} + The type of multi-group cross section object to return + domain : Material or Cell or Universe + The domain for spatial homogenization + domain_type : {'material', 'cell', 'distribcell', 'universe'} + The domain type for spatial homogenization + energy_groups : EnergyGroups + The energy group structure for energy condensation + by_nuclide : bool + If true, computes cross sections for each nuclide in domain + name : str, optional + Name of the multi-group cross section. Used as a label to identify + tallies in OpenMC 'tallies.xml' file. + + Returns + ------- + MGXS + A subclass of the abstract MGXS class for the multi-group cross + section type requeted by the user + + """ + + cv.check_value('mgxs_type', mgxs_type, MGXS_TYPES) + + if mgxs_type == 'total': + mgxs = TotalXS(domain, domain_type, energy_groups) + elif mgxs_type == 'transport': + mgxs = TransportXS(domain, domain_type, energy_groups) + elif mgxs_type == 'absorption': + mgxs = AbsorptionXS(domain, domain_type, energy_groups) + elif mgxs_type == 'capture': + mgxs = CaptureXS(domain, domain_type, energy_groups) + elif mgxs_type == 'fission': + mgxs = FissionXS(domain, domain_type, energy_groups) + elif mgxs_type == 'nu-fission': + mgxs = NuFissionXS(domain, domain_type, energy_groups) + elif mgxs_type == 'scatter': + mgxs = ScatterXS(domain, domain_type, energy_groups) + elif mgxs_type == 'nu-scatter': + mgxs = NuScatterXS(domain, domain_type, energy_groups) + elif mgxs_type == 'scatter matrix': + mgxs = ScatterMatrixXS(domain, domain_type, energy_groups) + elif mgxs_type == 'nu-scatter matrix': + mgxs = NuScatterMatrixXS(domain, domain_type, energy_groups) + elif mgxs_type == 'chi': + mgxs = Chi(domain, domain_type, energy_groups) + + mgxs.by_nuclide = by_nuclide + mgxs.name = name + return mgxs + def get_all_nuclides(self): """Get all nuclides in the cross section's spatial domain. @@ -1459,7 +1537,7 @@ class NuScatterXS(MGXS): # Create a list of scores for each Tally to be created scores = ['flux', 'nu-scatter'] - estimator = 'tracklength' + estimator = 'analog' keys = scores # Create the non-domain specific Filters for the Tallies