MGXS Part II: Advanced Features

mgxs-part-ii

This IPython Notebook illustrates the use of the openmc.mgxs module to calculate multi-group cross sections for a heterogeneous fuel pin cell geometry. In particular, this Notebook illustrates the following features:

  • Creation of multi-group cross sections on a heterogeneous geometry
  • Calculation of cross sections on a nuclide-by-nuclide basis
  • The use of tally precision triggers with multi-group cross sections
  • Built-in features for energy condensation in downstream data processing
  • The use of the openmc.data module to plot continuous-energy vs. multi-group cross sections
  • Validation of multi-group cross sections with OpenMOC

Note: This Notebook was created using OpenMOC to verify the multi-group cross-sections generated by OpenMC. You must install OpenMOC on your system in order to run this Notebook in its entirety. In addition, this Notebook illustrates the use of Pandas DataFrames to containerize multi-group cross section data.

Generate Input Files

In [1]:
import numpy as np
import matplotlib.pyplot as plt
plt.style.use('seaborn-dark')

import openmoc

import openmc
import openmc.mgxs as mgxs
import openmc.data
from openmc.openmoc_compatible import get_openmoc_geometry

%matplotlib inline
/home/romano/miniconda3/envs/python3/lib/python3.6/site-packages/matplotlib/__init__.py:1401: UserWarning:  This call to matplotlib.use() has no effect
because the backend has already been chosen;
matplotlib.use() must be called *before* pylab, matplotlib.pyplot,
or matplotlib.backends is imported for the first time.

  warnings.warn(_use_error_msg)

First we need to define materials that will be used in the problem. We'll create three distinct materials for water, clad and fuel.

In [2]:
# 1.6% enriched fuel
fuel = openmc.Material(name='1.6% Fuel')
fuel.set_density('g/cm3', 10.31341)
fuel.add_nuclide('U235', 3.7503e-4)
fuel.add_nuclide('U238', 2.2625e-2)
fuel.add_nuclide('O16', 4.6007e-2)

# borated water
water = openmc.Material(name='Borated Water')
water.set_density('g/cm3', 0.740582)
water.add_nuclide('H1', 4.9457e-2)
water.add_nuclide('O16', 2.4732e-2)

# zircaloy
zircaloy = openmc.Material(name='Zircaloy')
zircaloy.set_density('g/cm3', 6.55)
zircaloy.add_nuclide('Zr90', 7.2758e-3)

With our materials, we can now create a Materials object that can be exported to an actual XML file.

In [3]:
# Instantiate a Materials collection
materials_file = openmc.Materials([fuel, water, zircaloy])

# Export to "materials.xml"
materials_file.export_to_xml()

Now let's move on to the geometry. Our problem will have three regions for the fuel, the clad, and the surrounding coolant. The first step is to create the bounding surfaces -- in this case two cylinders and six reflective planes.

In [4]:
# Create cylinders for the fuel and clad
fuel_outer_radius = openmc.ZCylinder(x0=0.0, y0=0.0, R=0.39218)
clad_outer_radius = openmc.ZCylinder(x0=0.0, y0=0.0, R=0.45720)

# Create boundary planes to surround the geometry
min_x = openmc.XPlane(x0=-0.63, boundary_type='reflective')
max_x = openmc.XPlane(x0=+0.63, boundary_type='reflective')
min_y = openmc.YPlane(y0=-0.63, boundary_type='reflective')
max_y = openmc.YPlane(y0=+0.63, boundary_type='reflective')
min_z = openmc.ZPlane(z0=-0.63, boundary_type='reflective')
max_z = openmc.ZPlane(z0=+0.63, boundary_type='reflective')

With the surfaces defined, we can now create cells that are defined by intersections of half-spaces created by the surfaces.

In [5]:
# Create a Universe to encapsulate a fuel pin
pin_cell_universe = openmc.Universe(name='1.6% Fuel Pin')

# Create fuel Cell
fuel_cell = openmc.Cell(name='1.6% Fuel')
fuel_cell.fill = fuel
fuel_cell.region = -fuel_outer_radius
pin_cell_universe.add_cell(fuel_cell)

# Create a clad Cell
clad_cell = openmc.Cell(name='1.6% Clad')
clad_cell.fill = zircaloy
clad_cell.region = +fuel_outer_radius & -clad_outer_radius
pin_cell_universe.add_cell(clad_cell)

# Create a moderator Cell
moderator_cell = openmc.Cell(name='1.6% Moderator')
moderator_cell.fill = water
moderator_cell.region = +clad_outer_radius
pin_cell_universe.add_cell(moderator_cell)

OpenMC requires that there is a "root" universe. Let us create a root cell that is filled by the pin cell universe and then assign it to the root universe.

In [6]:
# Create root Cell
root_cell = openmc.Cell(name='root cell')
root_cell.region = +min_x & -max_x & +min_y & -max_y
root_cell.fill = pin_cell_universe

# Create root Universe
root_universe = openmc.Universe(universe_id=0, name='root universe')
root_universe.add_cell(root_cell)

We now must create a geometry that is assigned a root universe and export it to XML.

In [7]:
# Create Geometry and set root Universe
openmc_geometry = openmc.Geometry(root_universe)

# Export to "geometry.xml"
openmc_geometry.export_to_xml()

Next, we must define simulation parameters. In this case, we will use 10 inactive batches and 40 active batches each with 10,000 particles.

In [8]:
# OpenMC simulation parameters
batches = 50
inactive = 10
particles = 10000

# Instantiate a Settings object
settings_file = openmc.Settings()
settings_file.batches = batches
settings_file.inactive = inactive
settings_file.particles = particles
settings_file.output = {'tallies': True}

# Create an initial uniform spatial source distribution over fissionable zones
bounds = [-0.63, -0.63, -0.63, 0.63, 0.63, 0.63]
uniform_dist = openmc.stats.Box(bounds[:3], bounds[3:], only_fissionable=True)
settings_file.source = openmc.source.Source(space=uniform_dist)

# Activate tally precision triggers
settings_file.trigger_active = True
settings_file.trigger_max_batches = settings_file.batches * 4

# Export to "settings.xml"
settings_file.export_to_xml()

Now we are finally ready to make use of the openmc.mgxs module to generate multi-group cross sections! First, let's define "coarse" 2-group and "fine" 8-group structures using the built-in EnergyGroups class.

In [9]:
# Instantiate a "coarse" 2-group EnergyGroups object
coarse_groups = mgxs.EnergyGroups([0., 0.625, 20.0e6])

# Instantiate a "fine" 8-group EnergyGroups object
fine_groups = mgxs.EnergyGroups([0., 0.058, 0.14, 0.28,
                                 0.625, 4.0, 5.53e3, 821.0e3, 20.0e6])

Now we will instantiate a variety of MGXS objects needed to run an OpenMOC simulation to verify the accuracy of our cross sections. In particular, we define transport, fission, nu-fission, nu-scatter and chi cross sections for each of the three cells in the fuel pin with the 8-group structure as our energy groups.

In [10]:
# Extract all Cells filled by Materials
openmc_cells = openmc_geometry.get_all_material_cells().values()

# Create dictionary to store multi-group cross sections for all cells
xs_library = {}

# Instantiate 8-group cross sections for each cell
for cell in openmc_cells:
    xs_library[cell.id] = {}
    xs_library[cell.id]['transport']  = mgxs.TransportXS(groups=fine_groups)
    xs_library[cell.id]['fission'] = mgxs.FissionXS(groups=fine_groups)
    xs_library[cell.id]['nu-fission'] = mgxs.FissionXS(groups=fine_groups, nu=True)
    xs_library[cell.id]['nu-scatter'] = mgxs.ScatterMatrixXS(groups=fine_groups, nu=True)
    xs_library[cell.id]['chi'] = mgxs.Chi(groups=fine_groups)

Next, we showcase the use of OpenMC's tally precision trigger feature in conjunction with the openmc.mgxs module. In particular, we will assign a tally trigger of 1E-2 on the standard deviation for each of the tallies used to compute multi-group cross sections.

In [11]:
# Create a tally trigger for +/- 0.01 on each tally used to compute the multi-group cross sections
tally_trigger = openmc.Trigger('std_dev', 1E-2)

# Add the tally trigger to each of the multi-group cross section tallies
for cell in openmc_cells:
    for mgxs_type in xs_library[cell.id]:
        xs_library[cell.id][mgxs_type].tally_trigger = tally_trigger

Now, we must loop over all cells to set the cross section domains to the various cells - fuel, clad and moderator - included in the geometry. In addition, we will set each cross section to tally cross sections on a per-nuclide basis through the use of the MGXS class' boolean by_nuclide instance attribute.

In [12]:
# Instantiate an empty Tallies object
tallies_file = openmc.Tallies()

# Iterate over all cells and cross section types
for cell in openmc_cells:
    for rxn_type in xs_library[cell.id]:

        # Set the cross sections domain to the cell
        xs_library[cell.id][rxn_type].domain = cell
        
        # Tally cross sections by nuclide
        xs_library[cell.id][rxn_type].by_nuclide = True
                
        # Add OpenMC tallies to the tallies file for XML generation
        for tally in xs_library[cell.id][rxn_type].tallies.values():
            tallies_file.append(tally, merge=True)

# Export to "tallies.xml"
tallies_file.export_to_xml()
/home/romano/openmc/openmc/mixin.py:61: IDWarning: Another CellFilter instance already exists with id=48.
  warn(msg, IDWarning)
/home/romano/openmc/openmc/mixin.py:61: IDWarning: Another CellFilter instance already exists with id=18.
  warn(msg, IDWarning)
/home/romano/openmc/openmc/mixin.py:61: IDWarning: Another EnergyFilter instance already exists with id=2.
  warn(msg, IDWarning)
/home/romano/openmc/openmc/mixin.py:61: IDWarning: Another EnergyoutFilter instance already exists with id=3.
  warn(msg, IDWarning)
/home/romano/openmc/openmc/mixin.py:61: IDWarning: Another CellFilter instance already exists with id=40.
  warn(msg, IDWarning)
/home/romano/openmc/openmc/mixin.py:61: IDWarning: Another CellFilter instance already exists with id=43.
  warn(msg, IDWarning)
/home/romano/openmc/openmc/mixin.py:61: IDWarning: Another EnergyFilter instance already exists with id=13.
  warn(msg, IDWarning)

Now we a have a complete set of inputs, so we can go ahead and run our simulation.

In [13]:
# Run OpenMC
openmc.run()
                               %%%%%%%%%%%%%%%
                          %%%%%%%%%%%%%%%%%%%%%%%%
                       %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
                     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
                   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
                  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
                                   %%%%%%%%%%%%%%%%%%%%%%%%
                                    %%%%%%%%%%%%%%%%%%%%%%%%
                ###############      %%%%%%%%%%%%%%%%%%%%%%%%
               ##################     %%%%%%%%%%%%%%%%%%%%%%%
               ###################     %%%%%%%%%%%%%%%%%%%%%%%
               ####################     %%%%%%%%%%%%%%%%%%%%%%
               #####################     %%%%%%%%%%%%%%%%%%%%%
               ######################     %%%%%%%%%%%%%%%%%%%%
               #######################     %%%%%%%%%%%%%%%%%%
                #######################     %%%%%%%%%%%%%%%%%
                ######################     %%%%%%%%%%%%%%%%%
                 ####################     %%%%%%%%%%%%%%%%%
                   #################     %%%%%%%%%%%%%%%%%
                    ###############     %%%%%%%%%%%%%%%%
                      ############     %%%%%%%%%%%%%%%
                         ########     %%%%%%%%%%%%%%
                                     %%%%%%%%%%%

                   | The OpenMC Monte Carlo Code
         Copyright | 2011-2017 Massachusetts Institute of Technology
           License | http://openmc.readthedocs.io/en/latest/license.html
           Version | 0.9.0
          Git SHA1 | da61fb4a55e1feaa127799ad9293a766161fbb3e
         Date/Time | 2017-12-11 16:37:11
    OpenMP Threads | 4

 Reading settings XML file...
 Reading cross sections XML file...
 Reading materials XML file...
 Reading geometry XML file...
 Building neighboring cells lists for each surface...
 Reading U235 from /home/romano/openmc/scripts/nndc_hdf5/U235.h5
 Reading U238 from /home/romano/openmc/scripts/nndc_hdf5/U238.h5
 Reading O16 from /home/romano/openmc/scripts/nndc_hdf5/O16.h5
 Reading H1 from /home/romano/openmc/scripts/nndc_hdf5/H1.h5
 Reading Zr90 from /home/romano/openmc/scripts/nndc_hdf5/Zr90.h5
 Maximum neutron transport energy: 2.00000E+07 eV for U235
 Reading tallies XML file...
 Writing summary.h5 file...
 Initializing source particles...

 ====================>     K EIGENVALUE SIMULATION     <====================

  Bat./Gen.      k            Average k         
  =========   ========   ====================   
        1/1    1.20332                       
        2/1    1.22209                       
        3/1    1.24322                       
        4/1    1.21622                       
        5/1    1.25850                       
        6/1    1.22581                       
        7/1    1.21118                       
        8/1    1.23377                       
        9/1    1.24254                       
       10/1    1.21241                       
       11/1    1.21042                       
       12/1    1.23539    1.22290 +/- 0.01249
       13/1    1.22436    1.22339 +/- 0.00723
       14/1    1.22888    1.22476 +/- 0.00529
       15/1    1.22553    1.22491 +/- 0.00410
       16/1    1.24194    1.22775 +/- 0.00439
       17/1    1.24755    1.23058 +/- 0.00466
       18/1    1.21117    1.22815 +/- 0.00471
       19/1    1.22530    1.22784 +/- 0.00417
       20/1    1.20762    1.22582 +/- 0.00424
       21/1    1.20377    1.22381 +/- 0.00433
       22/1    1.24305    1.22541 +/- 0.00426
       23/1    1.22434    1.22533 +/- 0.00392
       24/1    1.22937    1.22562 +/- 0.00364
       25/1    1.22458    1.22555 +/- 0.00339
       26/1    1.18978    1.22332 +/- 0.00388
       27/1    1.20582    1.22229 +/- 0.00379
       28/1    1.22719    1.22256 +/- 0.00358
       29/1    1.21307    1.22206 +/- 0.00343
       30/1    1.20915    1.22141 +/- 0.00331
       31/1    1.22799    1.22173 +/- 0.00317
       32/1    1.21251    1.22131 +/- 0.00305
       33/1    1.20540    1.22062 +/- 0.00299
       34/1    1.20052    1.21978 +/- 0.00299
       35/1    1.24552    1.22081 +/- 0.00304
       36/1    1.21685    1.22066 +/- 0.00293
       37/1    1.22395    1.22078 +/- 0.00282
       38/1    1.22379    1.22089 +/- 0.00272
       39/1    1.20951    1.22049 +/- 0.00265
       40/1    1.25199    1.22154 +/- 0.00277
       41/1    1.23243    1.22190 +/- 0.00270
       42/1    1.20973    1.22152 +/- 0.00264
       43/1    1.24682    1.22228 +/- 0.00268
       44/1    1.20694    1.22183 +/- 0.00263
       45/1    1.22196    1.22183 +/- 0.00256
       46/1    1.20687    1.22142 +/- 0.00252
       47/1    1.22023    1.22139 +/- 0.00245
       48/1    1.22204    1.22140 +/- 0.00239
       49/1    1.22077    1.22139 +/- 0.00232
       50/1    1.23166    1.22164 +/- 0.00228
 Triggers unsatisfied, max unc./thresh. is 1.17623 for flux in tally 58
 The estimated number of batches is 66
 Creating state point statepoint.050.h5...
       51/1    1.20071    1.22113 +/- 0.00228
       52/1    1.21423    1.22097 +/- 0.00223
       53/1    1.25595    1.22178 +/- 0.00233
       54/1    1.21806    1.22170 +/- 0.00227
       55/1    1.22911    1.22186 +/- 0.00223
       56/1    1.23054    1.22205 +/- 0.00219
       57/1    1.19384    1.22145 +/- 0.00222
       58/1    1.20625    1.22114 +/- 0.00220
       59/1    1.21977    1.22111 +/- 0.00216
       60/1    1.20813    1.22085 +/- 0.00213
       61/1    1.22077    1.22085 +/- 0.00209
       62/1    1.21956    1.22082 +/- 0.00205
       63/1    1.22360    1.22087 +/- 0.00201
       64/1    1.23955    1.22122 +/- 0.00200
       65/1    1.21143    1.22104 +/- 0.00197
       66/1    1.21791    1.22099 +/- 0.00194
 Triggers unsatisfied, max unc./thresh. is 1.13207 for flux in tally 58
 The estimated number of batches is 82
       67/1    1.24897    1.22148 +/- 0.00196
       68/1    1.22221    1.22149 +/- 0.00193
       69/1    1.25627    1.22208 +/- 0.00199
       70/1    1.21493    1.22196 +/- 0.00196
       71/1    1.23406    1.22216 +/- 0.00193
       72/1    1.23842    1.22242 +/- 0.00192
       73/1    1.24542    1.22279 +/- 0.00193
       74/1    1.21314    1.22263 +/- 0.00190
       75/1    1.26484    1.22328 +/- 0.00198
       76/1    1.22243    1.22327 +/- 0.00195
       77/1    1.21865    1.22320 +/- 0.00192
       78/1    1.23500    1.22338 +/- 0.00190
       79/1    1.22125    1.22334 +/- 0.00187
       80/1    1.23793    1.22355 +/- 0.00186
       81/1    1.24238    1.22382 +/- 0.00185
       82/1    1.23493    1.22397 +/- 0.00183
 Triggers satisfied for batch 82
 Creating state point statepoint.082.h5...

 =======================>     TIMING STATISTICS     <=======================

 Total time for initialization     =  4.1610E-01 seconds
   Reading cross sections          =  3.7942E-01 seconds
 Total time in simulation          =  1.1100E+02 seconds
   Time in transport only          =  1.1076E+02 seconds
   Time in inactive batches        =  5.8101E+00 seconds
   Time in active batches          =  1.0519E+02 seconds
   Time synchronizing fission bank =  3.8707E-02 seconds
     Sampling source sites         =  2.7232E-02 seconds
     SEND/RECV source sites        =  1.1284E-02 seconds
   Time accumulating tallies       =  1.0514E-03 seconds
 Total time for finalization       =  1.4526E-02 seconds
 Total time elapsed                =  1.1150E+02 seconds
 Calculation Rate (inactive)       =  17211.3 neutrons/second
 Calculation Rate (active)         =  6844.60 neutrons/second

 ============================>     RESULTS     <============================

 k-effective (Collision)     =  1.22348 +/-  0.00169
 k-effective (Track-length)  =  1.22397 +/-  0.00183
 k-effective (Absorption)    =  1.22467 +/-  0.00117
 Combined k-effective        =  1.22448 +/-  0.00108
 Leakage Fraction            =  0.00000 +/-  0.00000

Out[13]:
0

Tally Data Processing

Our simulation ran successfully and created statepoint and summary output files. We begin our analysis by instantiating a StatePoint object.

In [14]:
# Load the last statepoint file
sp = openmc.StatePoint('statepoint.082.h5')

The statepoint is now ready to be analyzed by our multi-group cross sections. We simply have to load the tallies from the StatePoint into each object as follows and our MGXS objects will compute the cross sections for us under-the-hood.

In [15]:
# Iterate over all cells and cross section types
for cell in openmc_cells:
    for rxn_type in xs_library[cell.id]:
        xs_library[cell.id][rxn_type].load_from_statepoint(sp)

That's it! Our multi-group cross sections are now ready for the big spotlight. This time we have cross sections in three distinct spatial zones - fuel, clad and moderator - on a per-nuclide basis.

Extracting and Storing MGXS Data

Let's first inspect one of our cross sections by printing it to the screen as a microscopic cross section in units of barns.

In [16]:
nufission = xs_library[fuel_cell.id]['nu-fission']
nufission.print_xs(xs_type='micro', nuclides=['U235', 'U238'])
Multi-Group XS
	Reaction Type  =	nu-fission
	Domain Type    =	cell
	Domain ID      =	1
	Nuclide        =	U235
	Cross Sections [barns]:
            Group 1 [821000.0   - 20000000.0eV]:	3.30e+00 +/- 2.14e-01%
            Group 2 [5530.0     - 821000.0  eV]:	3.96e+00 +/- 1.33e-01%
            Group 3 [4.0        - 5530.0    eV]:	5.50e+01 +/- 2.29e-01%
            Group 4 [0.625      - 4.0       eV]:	8.85e+01 +/- 3.10e-01%
            Group 5 [0.28       - 0.625     eV]:	2.90e+02 +/- 3.94e-01%
            Group 6 [0.14       - 0.28      eV]:	4.49e+02 +/- 4.12e-01%
            Group 7 [0.058      - 0.14      eV]:	6.87e+02 +/- 3.01e-01%
            Group 8 [0.0        - 0.058     eV]:	1.44e+03 +/- 2.79e-01%

	Nuclide        =	U238
	Cross Sections [barns]:
            Group 1 [821000.0   - 20000000.0eV]:	1.06e+00 +/- 2.53e-01%
            Group 2 [5530.0     - 821000.0  eV]:	1.21e-03 +/- 2.60e-01%
            Group 3 [4.0        - 5530.0    eV]:	5.73e-04 +/- 2.93e+00%
            Group 4 [0.625      - 4.0       eV]:	6.54e-06 +/- 2.72e-01%
            Group 5 [0.28       - 0.625     eV]:	1.07e-05 +/- 3.83e-01%
            Group 6 [0.14       - 0.28      eV]:	1.55e-05 +/- 4.13e-01%
            Group 7 [0.058      - 0.14      eV]:	2.30e-05 +/- 3.01e-01%
            Group 8 [0.0        - 0.058     eV]:	4.24e-05 +/- 2.79e-01%



/home/romano/openmc/openmc/tallies.py:1798: RuntimeWarning: invalid value encountered in true_divide
  self_rel_err = data['self']['std. dev.'] / data['self']['mean']

Our multi-group cross sections are capable of summing across all nuclides to provide us with macroscopic cross sections as well.

In [17]:
nufission = xs_library[fuel_cell.id]['nu-fission']
nufission.print_xs(xs_type='macro', nuclides='sum')
Multi-Group XS
	Reaction Type  =	nu-fission
	Domain Type    =	cell
	Domain ID      =	1
	Cross Sections [cm^-1]:
            Group 1 [821000.0   - 20000000.0eV]:	2.52e-02 +/- 2.41e-01%
            Group 2 [5530.0     - 821000.0  eV]:	1.51e-03 +/- 1.31e-01%
            Group 3 [4.0        - 5530.0    eV]:	2.07e-02 +/- 2.29e-01%
            Group 4 [0.625      - 4.0       eV]:	3.32e-02 +/- 3.10e-01%
            Group 5 [0.28       - 0.625     eV]:	1.09e-01 +/- 3.94e-01%
            Group 6 [0.14       - 0.28      eV]:	1.69e-01 +/- 4.12e-01%
            Group 7 [0.058      - 0.14      eV]:	2.58e-01 +/- 3.01e-01%
            Group 8 [0.0        - 0.058     eV]:	5.40e-01 +/- 2.79e-01%



Although a printed report is nice, it is not scalable or flexible. Let's extract the microscopic cross section data for the moderator as a Pandas DataFrame .

In [18]:
nuscatter = xs_library[moderator_cell.id]['nu-scatter']
df = nuscatter.get_pandas_dataframe(xs_type='micro')
df.head(10)
/home/romano/openmc/openmc/tallies.py:1798: RuntimeWarning: invalid value encountered in true_divide
  self_rel_err = data['self']['std. dev.'] / data['self']['mean']
Out[18]:
cell group in group out nuclide mean std. dev.
126 3 1 1 H1 0.233991 0.003752
127 3 1 1 O16 1.569288 0.006360
124 3 1 2 H1 1.587279 0.003098
125 3 1 2 O16 0.285599 0.001422
122 3 1 3 H1 0.010482 0.000220
123 3 1 3 O16 0.000000 0.000000
120 3 1 4 H1 0.000009 0.000006
121 3 1 4 O16 0.000000 0.000000
118 3 1 5 H1 0.000005 0.000005
119 3 1 5 O16 0.000000 0.000000

Next, we illustate how one can easily take multi-group cross sections and condense them down to a coarser energy group structure. The MGXS class includes a get_condensed_xs(...) method which takes an EnergyGroups parameter with a coarse(r) group structure and returns a new MGXS condensed to the coarse groups. We illustrate this process below using the 2-group structure created earlier.

In [19]:
# Extract the 8-group transport cross section for the fuel
fine_xs = xs_library[fuel_cell.id]['transport']

# Condense to the 2-group structure
condensed_xs = fine_xs.get_condensed_xs(coarse_groups)

Group condensation is as simple as that! We now have a new coarse 2-group TransportXS in addition to our original 8-group TransportXS. Let's inspect the 2-group TransportXS by printing it to the screen and extracting a Pandas DataFrame as we have already learned how to do.

In [20]:
condensed_xs.print_xs()
Multi-Group XS
	Reaction Type  =	transport
	Domain Type    =	cell
	Domain ID      =	1
	Nuclide        =	U235
	Cross Sections [cm^-1]:
            Group 1 [0.625      - 20000000.0eV]:	7.79e-03 +/- 2.12e-01%
            Group 2 [0.0        - 0.625     eV]:	1.82e-01 +/- 1.92e-01%

	Nuclide        =	U238
	Cross Sections [cm^-1]:
            Group 1 [0.625      - 20000000.0eV]:	2.17e-01 +/- 1.12e-01%
            Group 2 [0.0        - 0.625     eV]:	2.53e-01 +/- 1.89e-01%

	Nuclide        =	O16
	Cross Sections [cm^-1]:
            Group 1 [0.625      - 20000000.0eV]:	1.45e-01 +/- 1.12e-01%
            Group 2 [0.0        - 0.625     eV]:	1.74e-01 +/- 2.03e-01%



In [21]:
df = condensed_xs.get_pandas_dataframe(xs_type='micro')
df
Out[21]:
cell group in nuclide mean std. dev.
3 1 1 U235 20.763062 0.044093
4 1 1 U238 9.579086 0.010757
5 1 1 O16 3.157274 0.003531
0 1 2 U235 485.349036 0.930937
1 1 2 U238 11.199167 0.021167
2 1 2 O16 3.788383 0.007676

Verification with OpenMOC

Now, let's verify our cross sections using OpenMOC. First, we construct an equivalent OpenMOC geometry.

In [22]:
# Create an OpenMOC Geometry from the OpenMC Geometry
openmoc_geometry = get_openmoc_geometry(sp.summary.geometry)

Next, we we can inject the multi-group cross sections into the equivalent fuel pin cell OpenMOC geometry.

In [23]:
# Get all OpenMOC cells in the gometry
openmoc_cells = openmoc_geometry.getRootUniverse().getAllCells()

# Inject multi-group cross sections into OpenMOC Materials
for cell_id, cell in openmoc_cells.items():
    
    # Ignore the root cell
    if cell.getName() == 'root cell':
        continue
    
    # Get a reference to the Material filling this Cell
    openmoc_material = cell.getFillMaterial()
    
    # Set the number of energy groups for the Material
    openmoc_material.setNumEnergyGroups(fine_groups.num_groups)
    
    # Extract the appropriate cross section objects for this cell
    transport = xs_library[cell_id]['transport']
    nufission = xs_library[cell_id]['nu-fission']
    nuscatter = xs_library[cell_id]['nu-scatter']
    chi = xs_library[cell_id]['chi']
    
    # Inject NumPy arrays of cross section data into the Material
    # NOTE: Sum across nuclides to get macro cross sections needed by OpenMOC
    openmoc_material.setSigmaT(transport.get_xs(nuclides='sum').flatten())
    openmoc_material.setNuSigmaF(nufission.get_xs(nuclides='sum').flatten())
    openmoc_material.setSigmaS(nuscatter.get_xs(nuclides='sum').flatten())
    openmoc_material.setChi(chi.get_xs(nuclides='sum').flatten())
/home/romano/openmc/openmc/tallies.py:1798: RuntimeWarning: invalid value encountered in true_divide
  self_rel_err = data['self']['std. dev.'] / data['self']['mean']
/home/romano/openmc/openmc/tallies.py:1799: RuntimeWarning: invalid value encountered in true_divide
  other_rel_err = data['other']['std. dev.'] / data['other']['mean']
/home/romano/openmc/openmc/tallies.py:1800: RuntimeWarning: invalid value encountered in true_divide
  new_tally._mean = data['self']['mean'] / data['other']['mean']

We are now ready to run OpenMOC to verify our cross-sections from OpenMC.

In [24]:
# Generate tracks for OpenMOC
track_generator = openmoc.TrackGenerator(openmoc_geometry, num_azim=128, azim_spacing=0.1)
track_generator.generateTracks()

# Run OpenMOC
solver = openmoc.CPUSolver(track_generator)
solver.computeEigenvalue()
[  NORMAL ]  Importing ray tracing data from file...
[  NORMAL ]  Computing the eigenvalue...
[  NORMAL ]  Iteration 0:	k_eff = 0.423134	res = 0.000E+00
[  NORMAL ]  Iteration 1:	k_eff = 0.475951	res = 5.769E-01
[  NORMAL ]  Iteration 2:	k_eff = 0.491466	res = 1.248E-01
[  NORMAL ]  Iteration 3:	k_eff = 0.487444	res = 3.260E-02
[  NORMAL ]  Iteration 4:	k_eff = 0.483929	res = 8.184E-03
[  NORMAL ]  Iteration 5:	k_eff = 0.477278	res = 7.213E-03
[  NORMAL ]  Iteration 6:	k_eff = 0.468936	res = 1.374E-02
[  NORMAL ]  Iteration 7:	k_eff = 0.460317	res = 1.748E-02
[  NORMAL ]  Iteration 8:	k_eff = 0.450589	res = 1.838E-02
[  NORMAL ]  Iteration 9:	k_eff = 0.441375	res = 2.113E-02
[  NORMAL ]  Iteration 10:	k_eff = 0.431988	res = 2.045E-02
[  NORMAL ]  Iteration 11:	k_eff = 0.422929	res = 2.127E-02
[  NORMAL ]  Iteration 12:	k_eff = 0.414483	res = 2.097E-02
[  NORMAL ]  Iteration 13:	k_eff = 0.406704	res = 1.997E-02
[  NORMAL ]  Iteration 14:	k_eff = 0.399374	res = 1.877E-02
[  NORMAL ]  Iteration 15:	k_eff = 0.393064	res = 1.802E-02
[  NORMAL ]  Iteration 16:	k_eff = 0.387423	res = 1.580E-02
[  NORMAL ]  Iteration 17:	k_eff = 0.382664	res = 1.435E-02
[  NORMAL ]  Iteration 18:	k_eff = 0.378737	res = 1.228E-02
[  NORMAL ]  Iteration 19:	k_eff = 0.375638	res = 1.026E-02
[  NORMAL ]  Iteration 20:	k_eff = 0.373485	res = 8.180E-03
[  NORMAL ]  Iteration 21:	k_eff = 0.372353	res = 5.734E-03
[  NORMAL ]  Iteration 22:	k_eff = 0.371970	res = 3.031E-03
[  NORMAL ]  Iteration 23:	k_eff = 0.372577	res = 1.027E-03
[  NORMAL ]  Iteration 24:	k_eff = 0.374052	res = 1.632E-03
[  NORMAL ]  Iteration 25:	k_eff = 0.376380	res = 3.959E-03
[  NORMAL ]  Iteration 26:	k_eff = 0.379559	res = 6.223E-03
[  NORMAL ]  Iteration 27:	k_eff = 0.383579	res = 8.447E-03
[  NORMAL ]  Iteration 28:	k_eff = 0.388377	res = 1.059E-02
[  NORMAL ]  Iteration 29:	k_eff = 0.393934	res = 1.251E-02
[  NORMAL ]  Iteration 30:	k_eff = 0.400230	res = 1.431E-02
[  NORMAL ]  Iteration 31:	k_eff = 0.407231	res = 1.598E-02
[  NORMAL ]  Iteration 32:	k_eff = 0.414881	res = 1.749E-02
[  NORMAL ]  Iteration 33:	k_eff = 0.423169	res = 1.879E-02
[  NORMAL ]  Iteration 34:	k_eff = 0.432048	res = 1.998E-02
[  NORMAL ]  Iteration 35:	k_eff = 0.441469	res = 2.098E-02
[  NORMAL ]  Iteration 36:	k_eff = 0.451428	res = 2.181E-02
[  NORMAL ]  Iteration 37:	k_eff = 0.461851	res = 2.256E-02
[  NORMAL ]  Iteration 38:	k_eff = 0.472728	res = 2.309E-02
[  NORMAL ]  Iteration 39:	k_eff = 0.484004	res = 2.355E-02
[  NORMAL ]  Iteration 40:	k_eff = 0.495652	res = 2.385E-02
[  NORMAL ]  Iteration 41:	k_eff = 0.507633	res = 2.406E-02
[  NORMAL ]  Iteration 42:	k_eff = 0.519913	res = 2.417E-02
[  NORMAL ]  Iteration 43:	k_eff = 0.532458	res = 2.419E-02
[  NORMAL ]  Iteration 44:	k_eff = 0.545234	res = 2.413E-02
[  NORMAL ]  Iteration 45:	k_eff = 0.558210	res = 2.400E-02
[  NORMAL ]  Iteration 46:	k_eff = 0.571353	res = 2.380E-02
[  NORMAL ]  Iteration 47:	k_eff = 0.584635	res = 2.354E-02
[  NORMAL ]  Iteration 48:	k_eff = 0.598027	res = 2.325E-02
[  NORMAL ]  Iteration 49:	k_eff = 0.611501	res = 2.291E-02
[  NORMAL ]  Iteration 50:	k_eff = 0.625030	res = 2.253E-02
[  NORMAL ]  Iteration 51:	k_eff = 0.638591	res = 2.212E-02
[  NORMAL ]  Iteration 52:	k_eff = 0.652160	res = 2.170E-02
[  NORMAL ]  Iteration 53:	k_eff = 0.665712	res = 2.125E-02
[  NORMAL ]  Iteration 54:	k_eff = 0.679230	res = 2.078E-02
[  NORMAL ]  Iteration 55:	k_eff = 0.692690	res = 2.031E-02
[  NORMAL ]  Iteration 56:	k_eff = 0.706077	res = 1.982E-02
[  NORMAL ]  Iteration 57:	k_eff = 0.719372	res = 1.933E-02
[  NORMAL ]  Iteration 58:	k_eff = 0.732558	res = 1.883E-02
[  NORMAL ]  Iteration 59:	k_eff = 0.745622	res = 1.833E-02
[  NORMAL ]  Iteration 60:	k_eff = 0.758549	res = 1.783E-02
[  NORMAL ]  Iteration 61:	k_eff = 0.771326	res = 1.734E-02
[  NORMAL ]  Iteration 62:	k_eff = 0.783943	res = 1.684E-02
[  NORMAL ]  Iteration 63:	k_eff = 0.796387	res = 1.636E-02
[  NORMAL ]  Iteration 64:	k_eff = 0.808649	res = 1.587E-02
[  NORMAL ]  Iteration 65:	k_eff = 0.820722	res = 1.540E-02
[  NORMAL ]  Iteration 66:	k_eff = 0.832597	res = 1.493E-02
[  NORMAL ]  Iteration 67:	k_eff = 0.844268	res = 1.447E-02
[  NORMAL ]  Iteration 68:	k_eff = 0.855727	res = 1.402E-02
[  NORMAL ]  Iteration 69:	k_eff = 0.866972	res = 1.357E-02
[  NORMAL ]  Iteration 70:	k_eff = 0.877995	res = 1.314E-02
[  NORMAL ]  Iteration 71:	k_eff = 0.888795	res = 1.272E-02
[  NORMAL ]  Iteration 72:	k_eff = 0.899368	res = 1.230E-02
[  NORMAL ]  Iteration 73:	k_eff = 0.909712	res = 1.190E-02
[  NORMAL ]  Iteration 74:	k_eff = 0.919823	res = 1.150E-02
[  NORMAL ]  Iteration 75:	k_eff = 0.929703	res = 1.112E-02
[  NORMAL ]  Iteration 76:	k_eff = 0.939349	res = 1.074E-02
[  NORMAL ]  Iteration 77:	k_eff = 0.948762	res = 1.038E-02
[  NORMAL ]  Iteration 78:	k_eff = 0.957942	res = 1.002E-02
[  NORMAL ]  Iteration 79:	k_eff = 0.966889	res = 9.676E-03
[  NORMAL ]  Iteration 80:	k_eff = 0.975605	res = 9.339E-03
[  NORMAL ]  Iteration 81:	k_eff = 0.984090	res = 9.015E-03
[  NORMAL ]  Iteration 82:	k_eff = 0.992347	res = 8.698E-03
[  NORMAL ]  Iteration 83:	k_eff = 1.000378	res = 8.391E-03
[  NORMAL ]  Iteration 84:	k_eff = 1.008186	res = 8.093E-03
[  NORMAL ]  Iteration 85:	k_eff = 1.015772	res = 7.804E-03
[  NORMAL ]  Iteration 86:	k_eff = 1.023139	res = 7.524E-03
[  NORMAL ]  Iteration 87:	k_eff = 1.030292	res = 7.253E-03
[  NORMAL ]  Iteration 88:	k_eff = 1.037231	res = 6.991E-03
[  NORMAL ]  Iteration 89:	k_eff = 1.043963	res = 6.736E-03
[  NORMAL ]  Iteration 90:	k_eff = 1.050489	res = 6.490E-03
[  NORMAL ]  Iteration 91:	k_eff = 1.056814	res = 6.252E-03
[  NORMAL ]  Iteration 92:	k_eff = 1.062941	res = 6.021E-03
[  NORMAL ]  Iteration 93:	k_eff = 1.068875	res = 5.798E-03
[  NORMAL ]  Iteration 94:	k_eff = 1.074618	res = 5.582E-03
[  NORMAL ]  Iteration 95:	k_eff = 1.080176	res = 5.373E-03
[  NORMAL ]  Iteration 96:	k_eff = 1.085552	res = 5.172E-03
[  NORMAL ]  Iteration 97:	k_eff = 1.090750	res = 4.977E-03
[  NORMAL ]  Iteration 98:	k_eff = 1.095775	res = 4.789E-03
[  NORMAL ]  Iteration 99:	k_eff = 1.100631	res = 4.607E-03
[  NORMAL ]  Iteration 100:	k_eff = 1.105322	res = 4.432E-03
[  NORMAL ]  Iteration 101:	k_eff = 1.109852	res = 4.262E-03
[  NORMAL ]  Iteration 102:	k_eff = 1.114225	res = 4.098E-03
[  NORMAL ]  Iteration 103:	k_eff = 1.118446	res = 3.940E-03
[  NORMAL ]  Iteration 104:	k_eff = 1.122519	res = 3.788E-03
[  NORMAL ]  Iteration 105:	k_eff = 1.126446	res = 3.641E-03
[  NORMAL ]  Iteration 106:	k_eff = 1.130234	res = 3.499E-03
[  NORMAL ]  Iteration 107:	k_eff = 1.133885	res = 3.362E-03
[  NORMAL ]  Iteration 108:	k_eff = 1.137404	res = 3.231E-03
[  NORMAL ]  Iteration 109:	k_eff = 1.140795	res = 3.103E-03
[  NORMAL ]  Iteration 110:	k_eff = 1.144060	res = 2.981E-03
[  NORMAL ]  Iteration 111:	k_eff = 1.147205	res = 2.863E-03
[  NORMAL ]  Iteration 112:	k_eff = 1.150233	res = 2.749E-03
[  NORMAL ]  Iteration 113:	k_eff = 1.153147	res = 2.639E-03
[  NORMAL ]  Iteration 114:	k_eff = 1.155952	res = 2.533E-03
[  NORMAL ]  Iteration 115:	k_eff = 1.158650	res = 2.432E-03
[  NORMAL ]  Iteration 116:	k_eff = 1.161245	res = 2.334E-03
[  NORMAL ]  Iteration 117:	k_eff = 1.163741	res = 2.240E-03
[  NORMAL ]  Iteration 118:	k_eff = 1.166140	res = 2.149E-03
[  NORMAL ]  Iteration 119:	k_eff = 1.168446	res = 2.061E-03
[  NORMAL ]  Iteration 120:	k_eff = 1.170663	res = 1.978E-03
[  NORMAL ]  Iteration 121:	k_eff = 1.172792	res = 1.897E-03
[  NORMAL ]  Iteration 122:	k_eff = 1.174838	res = 1.819E-03
[  NORMAL ]  Iteration 123:	k_eff = 1.176803	res = 1.745E-03
[  NORMAL ]  Iteration 124:	k_eff = 1.178689	res = 1.672E-03
[  NORMAL ]  Iteration 125:	k_eff = 1.180500	res = 1.603E-03
[  NORMAL ]  Iteration 126:	k_eff = 1.182238	res = 1.537E-03
[  NORMAL ]  Iteration 127:	k_eff = 1.183907	res = 1.473E-03
[  NORMAL ]  Iteration 128:	k_eff = 1.185508	res = 1.411E-03
[  NORMAL ]  Iteration 129:	k_eff = 1.187044	res = 1.352E-03
[  NORMAL ]  Iteration 130:	k_eff = 1.188517	res = 1.296E-03
[  NORMAL ]  Iteration 131:	k_eff = 1.189930	res = 1.241E-03
[  NORMAL ]  Iteration 132:	k_eff = 1.191285	res = 1.189E-03
[  NORMAL ]  Iteration 133:	k_eff = 1.192584	res = 1.139E-03
[  NORMAL ]  Iteration 134:	k_eff = 1.193829	res = 1.090E-03
[  NORMAL ]  Iteration 135:	k_eff = 1.195022	res = 1.044E-03
[  NORMAL ]  Iteration 136:	k_eff = 1.196165	res = 9.990E-04
[  NORMAL ]  Iteration 137:	k_eff = 1.197260	res = 9.567E-04
[  NORMAL ]  Iteration 138:	k_eff = 1.198310	res = 9.157E-04
[  NORMAL ]  Iteration 139:	k_eff = 1.199315	res = 8.769E-04
[  NORMAL ]  Iteration 140:	k_eff = 1.200278	res = 8.387E-04
[  NORMAL ]  Iteration 141:	k_eff = 1.201200	res = 8.029E-04
[  NORMAL ]  Iteration 142:	k_eff = 1.202082	res = 7.680E-04
[  NORMAL ]  Iteration 143:	k_eff = 1.202927	res = 7.346E-04
[  NORMAL ]  Iteration 144:	k_eff = 1.203735	res = 7.025E-04
[  NORMAL ]  Iteration 145:	k_eff = 1.204509	res = 6.720E-04
[  NORMAL ]  Iteration 146:	k_eff = 1.205250	res = 6.427E-04
[  NORMAL ]  Iteration 147:	k_eff = 1.205958	res = 6.153E-04
[  NORMAL ]  Iteration 148:	k_eff = 1.206636	res = 5.875E-04
[  NORMAL ]  Iteration 149:	k_eff = 1.207283	res = 5.623E-04
[  NORMAL ]  Iteration 150:	k_eff = 1.207903	res = 5.369E-04
[  NORMAL ]  Iteration 151:	k_eff = 1.208496	res = 5.133E-04
[  NORMAL ]  Iteration 152:	k_eff = 1.209063	res = 4.911E-04
[  NORMAL ]  Iteration 153:	k_eff = 1.209605	res = 4.693E-04
[  NORMAL ]  Iteration 154:	k_eff = 1.210123	res = 4.478E-04
[  NORMAL ]  Iteration 155:	k_eff = 1.210618	res = 4.283E-04
[  NORMAL ]  Iteration 156:	k_eff = 1.211091	res = 4.091E-04
[  NORMAL ]  Iteration 157:	k_eff = 1.211544	res = 3.910E-04
[  NORMAL ]  Iteration 158:	k_eff = 1.211976	res = 3.738E-04
[  NORMAL ]  Iteration 159:	k_eff = 1.212389	res = 3.565E-04
[  NORMAL ]  Iteration 160:	k_eff = 1.212783	res = 3.406E-04
[  NORMAL ]  Iteration 161:	k_eff = 1.213160	res = 3.252E-04
[  NORMAL ]  Iteration 162:	k_eff = 1.213519	res = 3.108E-04
[  NORMAL ]  Iteration 163:	k_eff = 1.213863	res = 2.962E-04
[  NORMAL ]  Iteration 164:	k_eff = 1.214191	res = 2.837E-04
[  NORMAL ]  Iteration 165:	k_eff = 1.214505	res = 2.699E-04
[  NORMAL ]  Iteration 166:	k_eff = 1.214804	res = 2.585E-04
[  NORMAL ]  Iteration 167:	k_eff = 1.215089	res = 2.463E-04
[  NORMAL ]  Iteration 168:	k_eff = 1.215362	res = 2.349E-04
[  NORMAL ]  Iteration 169:	k_eff = 1.215622	res = 2.247E-04
[  NORMAL ]  Iteration 170:	k_eff = 1.215871	res = 2.140E-04
[  NORMAL ]  Iteration 171:	k_eff = 1.216107	res = 2.044E-04
[  NORMAL ]  Iteration 172:	k_eff = 1.216334	res = 1.948E-04
[  NORMAL ]  Iteration 173:	k_eff = 1.216549	res = 1.861E-04
[  NORMAL ]  Iteration 174:	k_eff = 1.216755	res = 1.769E-04
[  NORMAL ]  Iteration 175:	k_eff = 1.216952	res = 1.697E-04
[  NORMAL ]  Iteration 176:	k_eff = 1.217139	res = 1.615E-04
[  NORMAL ]  Iteration 177:	k_eff = 1.217317	res = 1.541E-04
[  NORMAL ]  Iteration 178:	k_eff = 1.217487	res = 1.462E-04
[  NORMAL ]  Iteration 179:	k_eff = 1.217650	res = 1.398E-04
[  NORMAL ]  Iteration 180:	k_eff = 1.217805	res = 1.335E-04
[  NORMAL ]  Iteration 181:	k_eff = 1.217953	res = 1.274E-04
[  NORMAL ]  Iteration 182:	k_eff = 1.218094	res = 1.217E-04
[  NORMAL ]  Iteration 183:	k_eff = 1.218228	res = 1.159E-04
[  NORMAL ]  Iteration 184:	k_eff = 1.218356	res = 1.100E-04
[  NORMAL ]  Iteration 185:	k_eff = 1.218478	res = 1.048E-04
[  NORMAL ]  Iteration 186:	k_eff = 1.218595	res = 1.003E-04
[  NORMAL ]  Iteration 187:	k_eff = 1.218706	res = 9.574E-05
[  NORMAL ]  Iteration 188:	k_eff = 1.218811	res = 9.094E-05
[  NORMAL ]  Iteration 189:	k_eff = 1.218912	res = 8.629E-05
[  NORMAL ]  Iteration 190:	k_eff = 1.219007	res = 8.297E-05
[  NORMAL ]  Iteration 191:	k_eff = 1.219099	res = 7.863E-05
[  NORMAL ]  Iteration 192:	k_eff = 1.219186	res = 7.491E-05
[  NORMAL ]  Iteration 193:	k_eff = 1.219269	res = 7.150E-05
[  NORMAL ]  Iteration 194:	k_eff = 1.219348	res = 6.807E-05
[  NORMAL ]  Iteration 195:	k_eff = 1.219422	res = 6.487E-05
[  NORMAL ]  Iteration 196:	k_eff = 1.219495	res = 6.123E-05
[  NORMAL ]  Iteration 197:	k_eff = 1.219563	res = 5.915E-05
[  NORMAL ]  Iteration 198:	k_eff = 1.219628	res = 5.636E-05
[  NORMAL ]  Iteration 199:	k_eff = 1.219690	res = 5.317E-05
[  NORMAL ]  Iteration 200:	k_eff = 1.219749	res = 5.112E-05
[  NORMAL ]  Iteration 201:	k_eff = 1.219805	res = 4.824E-05
[  NORMAL ]  Iteration 202:	k_eff = 1.219859	res = 4.589E-05
[  NORMAL ]  Iteration 203:	k_eff = 1.219910	res = 4.396E-05
[  NORMAL ]  Iteration 204:	k_eff = 1.219958	res = 4.158E-05
[  NORMAL ]  Iteration 205:	k_eff = 1.220004	res = 3.979E-05
[  NORMAL ]  Iteration 206:	k_eff = 1.220049	res = 3.760E-05
[  NORMAL ]  Iteration 207:	k_eff = 1.220090	res = 3.661E-05
[  NORMAL ]  Iteration 208:	k_eff = 1.220130	res = 3.402E-05
[  NORMAL ]  Iteration 209:	k_eff = 1.220168	res = 3.256E-05
[  NORMAL ]  Iteration 210:	k_eff = 1.220204	res = 3.124E-05
[  NORMAL ]  Iteration 211:	k_eff = 1.220238	res = 2.947E-05
[  NORMAL ]  Iteration 212:	k_eff = 1.220271	res = 2.821E-05
[  NORMAL ]  Iteration 213:	k_eff = 1.220302	res = 2.666E-05
[  NORMAL ]  Iteration 214:	k_eff = 1.220332	res = 2.561E-05
[  NORMAL ]  Iteration 215:	k_eff = 1.220360	res = 2.450E-05
[  NORMAL ]  Iteration 216:	k_eff = 1.220387	res = 2.299E-05
[  NORMAL ]  Iteration 217:	k_eff = 1.220413	res = 2.190E-05
[  NORMAL ]  Iteration 218:	k_eff = 1.220437	res = 2.109E-05
[  NORMAL ]  Iteration 219:	k_eff = 1.220460	res = 1.982E-05
[  NORMAL ]  Iteration 220:	k_eff = 1.220482	res = 1.916E-05
[  NORMAL ]  Iteration 221:	k_eff = 1.220503	res = 1.792E-05
[  NORMAL ]  Iteration 222:	k_eff = 1.220523	res = 1.701E-05
[  NORMAL ]  Iteration 223:	k_eff = 1.220541	res = 1.615E-05
[  NORMAL ]  Iteration 224:	k_eff = 1.220559	res = 1.526E-05
[  NORMAL ]  Iteration 225:	k_eff = 1.220576	res = 1.439E-05
[  NORMAL ]  Iteration 226:	k_eff = 1.220592	res = 1.418E-05
[  NORMAL ]  Iteration 227:	k_eff = 1.220608	res = 1.350E-05
[  NORMAL ]  Iteration 228:	k_eff = 1.220623	res = 1.269E-05
[  NORMAL ]  Iteration 229:	k_eff = 1.220637	res = 1.193E-05
[  NORMAL ]  Iteration 230:	k_eff = 1.220650	res = 1.161E-05
[  NORMAL ]  Iteration 231:	k_eff = 1.220663	res = 1.090E-05
[  NORMAL ]  Iteration 232:	k_eff = 1.220675	res = 1.033E-05

We report the eigenvalues computed by OpenMC and OpenMOC here together to summarize our results.

In [25]:
# Print report of keff and bias with OpenMC
openmoc_keff = solver.getKeff()
openmc_keff = sp.k_combined[0]
bias = (openmoc_keff - openmc_keff) * 1e5

print('openmc keff = {0:1.6f}'.format(openmc_keff))
print('openmoc keff = {0:1.6f}'.format(openmoc_keff))
print('bias [pcm]: {0:1.1f}'.format(bias))
openmc keff = 1.224484
openmoc keff = 1.220675
bias [pcm]: -380.9

As a sanity check, let's run a simulation with the coarse 2-group cross sections to ensure that they also produce a reasonable result.

In [26]:
openmoc_geometry = get_openmoc_geometry(sp.summary.geometry)
openmoc_cells = openmoc_geometry.getRootUniverse().getAllCells()

# Inject multi-group cross sections into OpenMOC Materials
for cell_id, cell in openmoc_cells.items():
    
    # Ignore the root cell
    if cell.getName() == 'root cell':
        continue
    
    openmoc_material = cell.getFillMaterial()
    openmoc_material.setNumEnergyGroups(coarse_groups.num_groups)
    
    # Extract the appropriate cross section objects for this cell
    transport = xs_library[cell_id]['transport']
    nufission = xs_library[cell_id]['nu-fission']
    nuscatter = xs_library[cell_id]['nu-scatter']
    chi = xs_library[cell_id]['chi']
    
    # Perform group condensation
    transport = transport.get_condensed_xs(coarse_groups)
    nufission = nufission.get_condensed_xs(coarse_groups)
    nuscatter = nuscatter.get_condensed_xs(coarse_groups)
    chi = chi.get_condensed_xs(coarse_groups)
    
    # Inject NumPy arrays of cross section data into the Material
    openmoc_material.setSigmaT(transport.get_xs(nuclides='sum').flatten())
    openmoc_material.setNuSigmaF(nufission.get_xs(nuclides='sum').flatten())
    openmoc_material.setSigmaS(nuscatter.get_xs(nuclides='sum').flatten())
    openmoc_material.setChi(chi.get_xs(nuclides='sum').flatten())
/home/romano/openmc/openmc/tallies.py:1798: RuntimeWarning: invalid value encountered in true_divide
  self_rel_err = data['self']['std. dev.'] / data['self']['mean']
/home/romano/openmc/openmc/tallies.py:1799: RuntimeWarning: invalid value encountered in true_divide
  other_rel_err = data['other']['std. dev.'] / data['other']['mean']
/home/romano/openmc/openmc/tallies.py:1800: RuntimeWarning: invalid value encountered in true_divide
  new_tally._mean = data['self']['mean'] / data['other']['mean']
In [27]:
# Generate tracks for OpenMOC
track_generator = openmoc.TrackGenerator(openmoc_geometry, num_azim=128, azim_spacing=0.1)
track_generator.generateTracks()

# Run OpenMOC
solver = openmoc.CPUSolver(track_generator)
solver.computeEigenvalue()
[  NORMAL ]  Importing ray tracing data from file...
[  NORMAL ]  Computing the eigenvalue...
[  NORMAL ]  Iteration 0:	k_eff = 0.366885	res = 0.000E+00
[  NORMAL ]  Iteration 1:	k_eff = 0.391184	res = 6.331E-01
[  NORMAL ]  Iteration 2:	k_eff = 0.392990	res = 6.623E-02
[  NORMAL ]  Iteration 3:	k_eff = 0.381099	res = 4.617E-03
[  NORMAL ]  Iteration 4:	k_eff = 0.375018	res = 3.026E-02
[  NORMAL ]  Iteration 5:	k_eff = 0.369593	res = 1.596E-02
[  NORMAL ]  Iteration 6:	k_eff = 0.365543	res = 1.446E-02
[  NORMAL ]  Iteration 7:	k_eff = 0.363055	res = 1.096E-02
[  NORMAL ]  Iteration 8:	k_eff = 0.361474	res = 6.809E-03
[  NORMAL ]  Iteration 9:	k_eff = 0.361280	res = 4.354E-03
[  NORMAL ]  Iteration 10:	k_eff = 0.362004	res = 5.348E-04
[  NORMAL ]  Iteration 11:	k_eff = 0.363719	res = 2.003E-03
[  NORMAL ]  Iteration 12:	k_eff = 0.366339	res = 4.737E-03
[  NORMAL ]  Iteration 13:	k_eff = 0.369805	res = 7.203E-03
[  NORMAL ]  Iteration 14:	k_eff = 0.373990	res = 9.461E-03
[  NORMAL ]  Iteration 15:	k_eff = 0.378924	res = 1.132E-02
[  NORMAL ]  Iteration 16:	k_eff = 0.384480	res = 1.319E-02
[  NORMAL ]  Iteration 17:	k_eff = 0.390638	res = 1.466E-02
[  NORMAL ]  Iteration 18:	k_eff = 0.397339	res = 1.602E-02
[  NORMAL ]  Iteration 19:	k_eff = 0.404534	res = 1.715E-02
[  NORMAL ]  Iteration 20:	k_eff = 0.412185	res = 1.811E-02
[  NORMAL ]  Iteration 21:	k_eff = 0.420255	res = 1.891E-02
[  NORMAL ]  Iteration 22:	k_eff = 0.428688	res = 1.958E-02
[  NORMAL ]  Iteration 23:	k_eff = 0.437464	res = 2.007E-02
[  NORMAL ]  Iteration 24:	k_eff = 0.446540	res = 2.047E-02
[  NORMAL ]  Iteration 25:	k_eff = 0.455885	res = 2.075E-02
[  NORMAL ]  Iteration 26:	k_eff = 0.465470	res = 2.093E-02
[  NORMAL ]  Iteration 27:	k_eff = 0.475267	res = 2.103E-02
[  NORMAL ]  Iteration 28:	k_eff = 0.485247	res = 2.105E-02
[  NORMAL ]  Iteration 29:	k_eff = 0.495387	res = 2.100E-02
[  NORMAL ]  Iteration 30:	k_eff = 0.505663	res = 2.090E-02
[  NORMAL ]  Iteration 31:	k_eff = 0.516053	res = 2.074E-02
[  NORMAL ]  Iteration 32:	k_eff = 0.526536	res = 2.055E-02
[  NORMAL ]  Iteration 33:	k_eff = 0.537094	res = 2.031E-02
[  NORMAL ]  Iteration 34:	k_eff = 0.547708	res = 2.005E-02
[  NORMAL ]  Iteration 35:	k_eff = 0.558363	res = 1.976E-02
[  NORMAL ]  Iteration 36:	k_eff = 0.569042	res = 1.945E-02
[  NORMAL ]  Iteration 37:	k_eff = 0.579732	res = 1.913E-02
[  NORMAL ]  Iteration 38:	k_eff = 0.590419	res = 1.879E-02
[  NORMAL ]  Iteration 39:	k_eff = 0.601090	res = 1.843E-02
[  NORMAL ]  Iteration 40:	k_eff = 0.611734	res = 1.807E-02
[  NORMAL ]  Iteration 41:	k_eff = 0.622340	res = 1.771E-02
[  NORMAL ]  Iteration 42:	k_eff = 0.632899	res = 1.734E-02
[  NORMAL ]  Iteration 43:	k_eff = 0.643402	res = 1.697E-02
[  NORMAL ]  Iteration 44:	k_eff = 0.653840	res = 1.659E-02
[  NORMAL ]  Iteration 45:	k_eff = 0.664206	res = 1.622E-02
[  NORMAL ]  Iteration 46:	k_eff = 0.674492	res = 1.585E-02
[  NORMAL ]  Iteration 47:	k_eff = 0.684691	res = 1.549E-02
[  NORMAL ]  Iteration 48:	k_eff = 0.694799	res = 1.512E-02
[  NORMAL ]  Iteration 49:	k_eff = 0.704810	res = 1.476E-02
[  NORMAL ]  Iteration 50:	k_eff = 0.714718	res = 1.441E-02
[  NORMAL ]  Iteration 51:	k_eff = 0.724520	res = 1.406E-02
[  NORMAL ]  Iteration 52:	k_eff = 0.734212	res = 1.371E-02
[  NORMAL ]  Iteration 53:	k_eff = 0.743790	res = 1.338E-02
[  NORMAL ]  Iteration 54:	k_eff = 0.753250	res = 1.304E-02
[  NORMAL ]  Iteration 55:	k_eff = 0.762592	res = 1.272E-02
[  NORMAL ]  Iteration 56:	k_eff = 0.771809	res = 1.240E-02
[  NORMAL ]  Iteration 57:	k_eff = 0.780904	res = 1.209E-02
[  NORMAL ]  Iteration 58:	k_eff = 0.789871	res = 1.178E-02
[  NORMAL ]  Iteration 59:	k_eff = 0.798711	res = 1.148E-02
[  NORMAL ]  Iteration 60:	k_eff = 0.807422	res = 1.119E-02
[  NORMAL ]  Iteration 61:	k_eff = 0.816003	res = 1.091E-02
[  NORMAL ]  Iteration 62:	k_eff = 0.824453	res = 1.063E-02
[  NORMAL ]  Iteration 63:	k_eff = 0.832771	res = 1.035E-02
[  NORMAL ]  Iteration 64:	k_eff = 0.840957	res = 1.009E-02
[  NORMAL ]  Iteration 65:	k_eff = 0.849011	res = 9.830E-03
[  NORMAL ]  Iteration 66:	k_eff = 0.856933	res = 9.577E-03
[  NORMAL ]  Iteration 67:	k_eff = 0.864723	res = 9.331E-03
[  NORMAL ]  Iteration 68:	k_eff = 0.872381	res = 9.090E-03
[  NORMAL ]  Iteration 69:	k_eff = 0.879908	res = 8.856E-03
[  NORMAL ]  Iteration 70:	k_eff = 0.887304	res = 8.628E-03
[  NORMAL ]  Iteration 71:	k_eff = 0.894569	res = 8.405E-03
[  NORMAL ]  Iteration 72:	k_eff = 0.901706	res = 8.188E-03
[  NORMAL ]  Iteration 73:	k_eff = 0.908713	res = 7.978E-03
[  NORMAL ]  Iteration 74:	k_eff = 0.915593	res = 7.771E-03
[  NORMAL ]  Iteration 75:	k_eff = 0.922346	res = 7.571E-03
[  NORMAL ]  Iteration 76:	k_eff = 0.928973	res = 7.376E-03
[  NORMAL ]  Iteration 77:	k_eff = 0.935476	res = 7.186E-03
[  NORMAL ]  Iteration 78:	k_eff = 0.941856	res = 7.000E-03
[  NORMAL ]  Iteration 79:	k_eff = 0.948114	res = 6.820E-03
[  NORMAL ]  Iteration 80:	k_eff = 0.954252	res = 6.645E-03
[  NORMAL ]  Iteration 81:	k_eff = 0.960270	res = 6.473E-03
[  NORMAL ]  Iteration 82:	k_eff = 0.966171	res = 6.307E-03
[  NORMAL ]  Iteration 83:	k_eff = 0.971955	res = 6.145E-03
[  NORMAL ]  Iteration 84:	k_eff = 0.977625	res = 5.987E-03
[  NORMAL ]  Iteration 85:	k_eff = 0.983181	res = 5.833E-03
[  NORMAL ]  Iteration 86:	k_eff = 0.988626	res = 5.684E-03
[  NORMAL ]  Iteration 87:	k_eff = 0.993961	res = 5.538E-03
[  NORMAL ]  Iteration 88:	k_eff = 0.999186	res = 5.396E-03
[  NORMAL ]  Iteration 89:	k_eff = 1.004306	res = 5.258E-03
[  NORMAL ]  Iteration 90:	k_eff = 1.009320	res = 5.124E-03
[  NORMAL ]  Iteration 91:	k_eff = 1.014230	res = 4.993E-03
[  NORMAL ]  Iteration 92:	k_eff = 1.019038	res = 4.865E-03
[  NORMAL ]  Iteration 93:	k_eff = 1.023746	res = 4.740E-03
[  NORMAL ]  Iteration 94:	k_eff = 1.028355	res = 4.621E-03
[  NORMAL ]  Iteration 95:	k_eff = 1.032868	res = 4.502E-03
[  NORMAL ]  Iteration 96:	k_eff = 1.037284	res = 4.388E-03
[  NORMAL ]  Iteration 97:	k_eff = 1.041606	res = 4.275E-03
[  NORMAL ]  Iteration 98:	k_eff = 1.045837	res = 4.167E-03
[  NORMAL ]  Iteration 99:	k_eff = 1.049976	res = 4.062E-03
[  NORMAL ]  Iteration 100:	k_eff = 1.054027	res = 3.958E-03
[  NORMAL ]  Iteration 101:	k_eff = 1.057990	res = 3.858E-03
[  NORMAL ]  Iteration 102:	k_eff = 1.061867	res = 3.760E-03
[  NORMAL ]  Iteration 103:	k_eff = 1.065660	res = 3.665E-03
[  NORMAL ]  Iteration 104:	k_eff = 1.069370	res = 3.572E-03
[  NORMAL ]  Iteration 105:	k_eff = 1.072999	res = 3.482E-03
[  NORMAL ]  Iteration 106:	k_eff = 1.076548	res = 3.394E-03
[  NORMAL ]  Iteration 107:	k_eff = 1.080020	res = 3.307E-03
[  NORMAL ]  Iteration 108:	k_eff = 1.083415	res = 3.225E-03
[  NORMAL ]  Iteration 109:	k_eff = 1.086734	res = 3.143E-03
[  NORMAL ]  Iteration 110:	k_eff = 1.089979	res = 3.064E-03
[  NORMAL ]  Iteration 111:	k_eff = 1.093153	res = 2.986E-03
[  NORMAL ]  Iteration 112:	k_eff = 1.096256	res = 2.912E-03
[  NORMAL ]  Iteration 113:	k_eff = 1.099289	res = 2.838E-03
[  NORMAL ]  Iteration 114:	k_eff = 1.102254	res = 2.767E-03
[  NORMAL ]  Iteration 115:	k_eff = 1.105153	res = 2.697E-03
[  NORMAL ]  Iteration 116:	k_eff = 1.107986	res = 2.630E-03
[  NORMAL ]  Iteration 117:	k_eff = 1.110755	res = 2.564E-03
[  NORMAL ]  Iteration 118:	k_eff = 1.113462	res = 2.500E-03
[  NORMAL ]  Iteration 119:	k_eff = 1.116107	res = 2.437E-03
[  NORMAL ]  Iteration 120:	k_eff = 1.118693	res = 2.376E-03
[  NORMAL ]  Iteration 121:	k_eff = 1.121219	res = 2.316E-03
[  NORMAL ]  Iteration 122:	k_eff = 1.123687	res = 2.258E-03
[  NORMAL ]  Iteration 123:	k_eff = 1.126100	res = 2.202E-03
[  NORMAL ]  Iteration 124:	k_eff = 1.128457	res = 2.148E-03
[  NORMAL ]  Iteration 125:	k_eff = 1.130760	res = 2.093E-03
[  NORMAL ]  Iteration 126:	k_eff = 1.133010	res = 2.041E-03
[  NORMAL ]  Iteration 127:	k_eff = 1.135208	res = 1.990E-03
[  NORMAL ]  Iteration 128:	k_eff = 1.137357	res = 1.941E-03
[  NORMAL ]  Iteration 129:	k_eff = 1.139455	res = 1.892E-03
[  NORMAL ]  Iteration 130:	k_eff = 1.141505	res = 1.845E-03
[  NORMAL ]  Iteration 131:	k_eff = 1.143507	res = 1.799E-03
[  NORMAL ]  Iteration 132:	k_eff = 1.145464	res = 1.754E-03
[  NORMAL ]  Iteration 133:	k_eff = 1.147374	res = 1.711E-03
[  NORMAL ]  Iteration 134:	k_eff = 1.149240	res = 1.668E-03
[  NORMAL ]  Iteration 135:	k_eff = 1.151063	res = 1.626E-03
[  NORMAL ]  Iteration 136:	k_eff = 1.152844	res = 1.586E-03
[  NORMAL ]  Iteration 137:	k_eff = 1.154583	res = 1.547E-03
[  NORMAL ]  Iteration 138:	k_eff = 1.156281	res = 1.508E-03
[  NORMAL ]  Iteration 139:	k_eff = 1.157940	res = 1.471E-03
[  NORMAL ]  Iteration 140:	k_eff = 1.159560	res = 1.435E-03
[  NORMAL ]  Iteration 141:	k_eff = 1.161142	res = 1.399E-03
[  NORMAL ]  Iteration 142:	k_eff = 1.162687	res = 1.364E-03
[  NORMAL ]  Iteration 143:	k_eff = 1.164195	res = 1.330E-03
[  NORMAL ]  Iteration 144:	k_eff = 1.165669	res = 1.297E-03
[  NORMAL ]  Iteration 145:	k_eff = 1.167107	res = 1.266E-03
[  NORMAL ]  Iteration 146:	k_eff = 1.168512	res = 1.234E-03
[  NORMAL ]  Iteration 147:	k_eff = 1.169883	res = 1.203E-03
[  NORMAL ]  Iteration 148:	k_eff = 1.171222	res = 1.174E-03
[  NORMAL ]  Iteration 149:	k_eff = 1.172530	res = 1.144E-03
[  NORMAL ]  Iteration 150:	k_eff = 1.173807	res = 1.117E-03
[  NORMAL ]  Iteration 151:	k_eff = 1.175054	res = 1.089E-03
[  NORMAL ]  Iteration 152:	k_eff = 1.176271	res = 1.062E-03
[  NORMAL ]  Iteration 153:	k_eff = 1.177459	res = 1.036E-03
[  NORMAL ]  Iteration 154:	k_eff = 1.178619	res = 1.010E-03
[  NORMAL ]  Iteration 155:	k_eff = 1.179752	res = 9.854E-04
[  NORMAL ]  Iteration 156:	k_eff = 1.180858	res = 9.608E-04
[  NORMAL ]  Iteration 157:	k_eff = 1.181938	res = 9.371E-04
[  NORMAL ]  Iteration 158:	k_eff = 1.182992	res = 9.147E-04
[  NORMAL ]  Iteration 159:	k_eff = 1.184020	res = 8.915E-04
[  NORMAL ]  Iteration 160:	k_eff = 1.185025	res = 8.696E-04
[  NORMAL ]  Iteration 161:	k_eff = 1.186005	res = 8.487E-04
[  NORMAL ]  Iteration 162:	k_eff = 1.186962	res = 8.268E-04
[  NORMAL ]  Iteration 163:	k_eff = 1.187896	res = 8.073E-04
[  NORMAL ]  Iteration 164:	k_eff = 1.188808	res = 7.869E-04
[  NORMAL ]  Iteration 165:	k_eff = 1.189698	res = 7.679E-04
[  NORMAL ]  Iteration 166:	k_eff = 1.190567	res = 7.487E-04
[  NORMAL ]  Iteration 167:	k_eff = 1.191415	res = 7.301E-04
[  NORMAL ]  Iteration 168:	k_eff = 1.192243	res = 7.126E-04
[  NORMAL ]  Iteration 169:	k_eff = 1.193051	res = 6.949E-04
[  NORMAL ]  Iteration 170:	k_eff = 1.193840	res = 6.775E-04
[  NORMAL ]  Iteration 171:	k_eff = 1.194610	res = 6.613E-04
[  NORMAL ]  Iteration 172:	k_eff = 1.195361	res = 6.454E-04
[  NORMAL ]  Iteration 173:	k_eff = 1.196095	res = 6.290E-04
[  NORMAL ]  Iteration 174:	k_eff = 1.196810	res = 6.136E-04
[  NORMAL ]  Iteration 175:	k_eff = 1.197509	res = 5.981E-04
[  NORMAL ]  Iteration 176:	k_eff = 1.198191	res = 5.840E-04
[  NORMAL ]  Iteration 177:	k_eff = 1.198857	res = 5.694E-04
[  NORMAL ]  Iteration 178:	k_eff = 1.199507	res = 5.556E-04
[  NORMAL ]  Iteration 179:	k_eff = 1.200141	res = 5.422E-04
[  NORMAL ]  Iteration 180:	k_eff = 1.200760	res = 5.284E-04
[  NORMAL ]  Iteration 181:	k_eff = 1.201364	res = 5.157E-04
[  NORMAL ]  Iteration 182:	k_eff = 1.201954	res = 5.031E-04
[  NORMAL ]  Iteration 183:	k_eff = 1.202528	res = 4.908E-04
[  NORMAL ]  Iteration 184:	k_eff = 1.203090	res = 4.782E-04
[  NORMAL ]  Iteration 185:	k_eff = 1.203638	res = 4.671E-04
[  NORMAL ]  Iteration 186:	k_eff = 1.204172	res = 4.552E-04
[  NORMAL ]  Iteration 187:	k_eff = 1.204694	res = 4.442E-04
[  NORMAL ]  Iteration 188:	k_eff = 1.205204	res = 4.335E-04
[  NORMAL ]  Iteration 189:	k_eff = 1.205701	res = 4.227E-04
[  NORMAL ]  Iteration 190:	k_eff = 1.206186	res = 4.128E-04
[  NORMAL ]  Iteration 191:	k_eff = 1.206660	res = 4.025E-04
[  NORMAL ]  Iteration 192:	k_eff = 1.207121	res = 3.925E-04
[  NORMAL ]  Iteration 193:	k_eff = 1.207571	res = 3.824E-04
[  NORMAL ]  Iteration 194:	k_eff = 1.208011	res = 3.729E-04
[  NORMAL ]  Iteration 195:	k_eff = 1.208440	res = 3.641E-04
[  NORMAL ]  Iteration 196:	k_eff = 1.208859	res = 3.558E-04
[  NORMAL ]  Iteration 197:	k_eff = 1.209268	res = 3.467E-04
[  NORMAL ]  Iteration 198:	k_eff = 1.209667	res = 3.379E-04
[  NORMAL ]  Iteration 199:	k_eff = 1.210056	res = 3.299E-04
[  NORMAL ]  Iteration 200:	k_eff = 1.210436	res = 3.221E-04
[  NORMAL ]  Iteration 201:	k_eff = 1.210807	res = 3.139E-04
[  NORMAL ]  Iteration 202:	k_eff = 1.211169	res = 3.064E-04
[  NORMAL ]  Iteration 203:	k_eff = 1.211522	res = 2.988E-04
[  NORMAL ]  Iteration 204:	k_eff = 1.211866	res = 2.916E-04
[  NORMAL ]  Iteration 205:	k_eff = 1.212203	res = 2.840E-04
[  NORMAL ]  Iteration 206:	k_eff = 1.212530	res = 2.779E-04
[  NORMAL ]  Iteration 207:	k_eff = 1.212850	res = 2.701E-04
[  NORMAL ]  Iteration 208:	k_eff = 1.213162	res = 2.638E-04
[  NORMAL ]  Iteration 209:	k_eff = 1.213466	res = 2.575E-04
[  NORMAL ]  Iteration 210:	k_eff = 1.213764	res = 2.507E-04
[  NORMAL ]  Iteration 211:	k_eff = 1.214054	res = 2.452E-04
[  NORMAL ]  Iteration 212:	k_eff = 1.214337	res = 2.392E-04
[  NORMAL ]  Iteration 213:	k_eff = 1.214614	res = 2.331E-04
[  NORMAL ]  Iteration 214:	k_eff = 1.214884	res = 2.278E-04
[  NORMAL ]  Iteration 215:	k_eff = 1.215146	res = 2.221E-04
[  NORMAL ]  Iteration 216:	k_eff = 1.215403	res = 2.161E-04
[  NORMAL ]  Iteration 217:	k_eff = 1.215654	res = 2.114E-04
[  NORMAL ]  Iteration 218:	k_eff = 1.215898	res = 2.063E-04
[  NORMAL ]  Iteration 219:	k_eff = 1.216136	res = 2.009E-04
[  NORMAL ]  Iteration 220:	k_eff = 1.216369	res = 1.962E-04
[  NORMAL ]  Iteration 221:	k_eff = 1.216596	res = 1.912E-04
[  NORMAL ]  Iteration 222:	k_eff = 1.216817	res = 1.863E-04
[  NORMAL ]  Iteration 223:	k_eff = 1.217033	res = 1.820E-04
[  NORMAL ]  Iteration 224:	k_eff = 1.217245	res = 1.774E-04
[  NORMAL ]  Iteration 225:	k_eff = 1.217450	res = 1.735E-04
[  NORMAL ]  Iteration 226:	k_eff = 1.217651	res = 1.692E-04
[  NORMAL ]  Iteration 227:	k_eff = 1.217847	res = 1.651E-04
[  NORMAL ]  Iteration 228:	k_eff = 1.218039	res = 1.610E-04
[  NORMAL ]  Iteration 229:	k_eff = 1.218225	res = 1.570E-04
[  NORMAL ]  Iteration 230:	k_eff = 1.218407	res = 1.533E-04
[  NORMAL ]  Iteration 231:	k_eff = 1.218585	res = 1.496E-04
[  NORMAL ]  Iteration 232:	k_eff = 1.218758	res = 1.454E-04
[  NORMAL ]  Iteration 233:	k_eff = 1.218927	res = 1.419E-04
[  NORMAL ]  Iteration 234:	k_eff = 1.219092	res = 1.387E-04
[  NORMAL ]  Iteration 235:	k_eff = 1.219253	res = 1.357E-04
[  NORMAL ]  Iteration 236:	k_eff = 1.219410	res = 1.322E-04
[  NORMAL ]  Iteration 237:	k_eff = 1.219563	res = 1.287E-04
[  NORMAL ]  Iteration 238:	k_eff = 1.219713	res = 1.259E-04
[  NORMAL ]  Iteration 239:	k_eff = 1.219859	res = 1.226E-04
[  NORMAL ]  Iteration 240:	k_eff = 1.220001	res = 1.197E-04
[  NORMAL ]  Iteration 241:	k_eff = 1.220140	res = 1.165E-04
[  NORMAL ]  Iteration 242:	k_eff = 1.220275	res = 1.137E-04
[  NORMAL ]  Iteration 243:	k_eff = 1.220407	res = 1.110E-04
[  NORMAL ]  Iteration 244:	k_eff = 1.220536	res = 1.083E-04
[  NORMAL ]  Iteration 245:	k_eff = 1.220662	res = 1.055E-04
[  NORMAL ]  Iteration 246:	k_eff = 1.220785	res = 1.032E-04
[  NORMAL ]  Iteration 247:	k_eff = 1.220904	res = 1.006E-04
[  NORMAL ]  Iteration 248:	k_eff = 1.221022	res = 9.809E-05
[  NORMAL ]  Iteration 249:	k_eff = 1.221135	res = 9.592E-05
[  NORMAL ]  Iteration 250:	k_eff = 1.221247	res = 9.321E-05
[  NORMAL ]  Iteration 251:	k_eff = 1.221355	res = 9.097E-05
[  NORMAL ]  Iteration 252:	k_eff = 1.221462	res = 8.887E-05
[  NORMAL ]  Iteration 253:	k_eff = 1.221565	res = 8.723E-05
[  NORMAL ]  Iteration 254:	k_eff = 1.221666	res = 8.475E-05
[  NORMAL ]  Iteration 255:	k_eff = 1.221765	res = 8.255E-05
[  NORMAL ]  Iteration 256:	k_eff = 1.221861	res = 8.043E-05
[  NORMAL ]  Iteration 257:	k_eff = 1.221955	res = 7.865E-05
[  NORMAL ]  Iteration 258:	k_eff = 1.222046	res = 7.688E-05
[  NORMAL ]  Iteration 259:	k_eff = 1.222135	res = 7.466E-05
[  NORMAL ]  Iteration 260:	k_eff = 1.222223	res = 7.284E-05
[  NORMAL ]  Iteration 261:	k_eff = 1.222308	res = 7.152E-05
[  NORMAL ]  Iteration 262:	k_eff = 1.222391	res = 6.950E-05
[  NORMAL ]  Iteration 263:	k_eff = 1.222471	res = 6.795E-05
[  NORMAL ]  Iteration 264:	k_eff = 1.222551	res = 6.597E-05
[  NORMAL ]  Iteration 265:	k_eff = 1.222628	res = 6.472E-05
[  NORMAL ]  Iteration 266:	k_eff = 1.222703	res = 6.301E-05
[  NORMAL ]  Iteration 267:	k_eff = 1.222776	res = 6.133E-05
[  NORMAL ]  Iteration 268:	k_eff = 1.222847	res = 5.983E-05
[  NORMAL ]  Iteration 269:	k_eff = 1.222916	res = 5.841E-05
[  NORMAL ]  Iteration 270:	k_eff = 1.222985	res = 5.693E-05
[  NORMAL ]  Iteration 271:	k_eff = 1.223051	res = 5.580E-05
[  NORMAL ]  Iteration 272:	k_eff = 1.223116	res = 5.434E-05
[  NORMAL ]  Iteration 273:	k_eff = 1.223179	res = 5.309E-05
[  NORMAL ]  Iteration 274:	k_eff = 1.223241	res = 5.180E-05
[  NORMAL ]  Iteration 275:	k_eff = 1.223301	res = 5.028E-05
[  NORMAL ]  Iteration 276:	k_eff = 1.223360	res = 4.919E-05
[  NORMAL ]  Iteration 277:	k_eff = 1.223417	res = 4.820E-05
[  NORMAL ]  Iteration 278:	k_eff = 1.223473	res = 4.688E-05
[  NORMAL ]  Iteration 279:	k_eff = 1.223528	res = 4.559E-05
[  NORMAL ]  Iteration 280:	k_eff = 1.223581	res = 4.450E-05
[  NORMAL ]  Iteration 281:	k_eff = 1.223633	res = 4.364E-05
[  NORMAL ]  Iteration 282:	k_eff = 1.223683	res = 4.228E-05
[  NORMAL ]  Iteration 283:	k_eff = 1.223733	res = 4.136E-05
[  NORMAL ]  Iteration 284:	k_eff = 1.223781	res = 4.026E-05
[  NORMAL ]  Iteration 285:	k_eff = 1.223827	res = 3.920E-05
[  NORMAL ]  Iteration 286:	k_eff = 1.223873	res = 3.823E-05
[  NORMAL ]  Iteration 287:	k_eff = 1.223918	res = 3.753E-05
[  NORMAL ]  Iteration 288:	k_eff = 1.223962	res = 3.644E-05
[  NORMAL ]  Iteration 289:	k_eff = 1.224004	res = 3.550E-05
[  NORMAL ]  Iteration 290:	k_eff = 1.224046	res = 3.466E-05
[  NORMAL ]  Iteration 291:	k_eff = 1.224086	res = 3.402E-05
[  NORMAL ]  Iteration 292:	k_eff = 1.224126	res = 3.307E-05
[  NORMAL ]  Iteration 293:	k_eff = 1.224164	res = 3.223E-05
[  NORMAL ]  Iteration 294:	k_eff = 1.224202	res = 3.152E-05
[  NORMAL ]  Iteration 295:	k_eff = 1.224238	res = 3.065E-05
[  NORMAL ]  Iteration 296:	k_eff = 1.224274	res = 2.986E-05
[  NORMAL ]  Iteration 297:	k_eff = 1.224309	res = 2.910E-05
[  NORMAL ]  Iteration 298:	k_eff = 1.224343	res = 2.846E-05
[  NORMAL ]  Iteration 299:	k_eff = 1.224376	res = 2.759E-05
[  NORMAL ]  Iteration 300:	k_eff = 1.224409	res = 2.719E-05
[  NORMAL ]  Iteration 301:	k_eff = 1.224440	res = 2.648E-05
[  NORMAL ]  Iteration 302:	k_eff = 1.224471	res = 2.590E-05
[  NORMAL ]  Iteration 303:	k_eff = 1.224501	res = 2.516E-05
[  NORMAL ]  Iteration 304:	k_eff = 1.224530	res = 2.465E-05
[  NORMAL ]  Iteration 305:	k_eff = 1.224559	res = 2.396E-05
[  NORMAL ]  Iteration 306:	k_eff = 1.224587	res = 2.342E-05
[  NORMAL ]  Iteration 307:	k_eff = 1.224614	res = 2.290E-05
[  NORMAL ]  Iteration 308:	k_eff = 1.224641	res = 2.223E-05
[  NORMAL ]  Iteration 309:	k_eff = 1.224667	res = 2.184E-05
[  NORMAL ]  Iteration 310:	k_eff = 1.224692	res = 2.128E-05
[  NORMAL ]  Iteration 311:	k_eff = 1.224717	res = 2.079E-05
[  NORMAL ]  Iteration 312:	k_eff = 1.224741	res = 2.012E-05
[  NORMAL ]  Iteration 313:	k_eff = 1.224765	res = 1.973E-05
[  NORMAL ]  Iteration 314:	k_eff = 1.224788	res = 1.914E-05
[  NORMAL ]  Iteration 315:	k_eff = 1.224810	res = 1.873E-05
[  NORMAL ]  Iteration 316:	k_eff = 1.224832	res = 1.829E-05
[  NORMAL ]  Iteration 317:	k_eff = 1.224853	res = 1.789E-05
[  NORMAL ]  Iteration 318:	k_eff = 1.224874	res = 1.741E-05
[  NORMAL ]  Iteration 319:	k_eff = 1.224894	res = 1.709E-05
[  NORMAL ]  Iteration 320:	k_eff = 1.224914	res = 1.658E-05
[  NORMAL ]  Iteration 321:	k_eff = 1.224933	res = 1.610E-05
[  NORMAL ]  Iteration 322:	k_eff = 1.224952	res = 1.591E-05
[  NORMAL ]  Iteration 323:	k_eff = 1.224971	res = 1.536E-05
[  NORMAL ]  Iteration 324:	k_eff = 1.224989	res = 1.503E-05
[  NORMAL ]  Iteration 325:	k_eff = 1.225006	res = 1.462E-05
[  NORMAL ]  Iteration 326:	k_eff = 1.225024	res = 1.423E-05
[  NORMAL ]  Iteration 327:	k_eff = 1.225040	res = 1.403E-05
[  NORMAL ]  Iteration 328:	k_eff = 1.225057	res = 1.356E-05
[  NORMAL ]  Iteration 329:	k_eff = 1.225073	res = 1.327E-05
[  NORMAL ]  Iteration 330:	k_eff = 1.225088	res = 1.311E-05
[  NORMAL ]  Iteration 331:	k_eff = 1.225103	res = 1.278E-05
[  NORMAL ]  Iteration 332:	k_eff = 1.225118	res = 1.230E-05
[  NORMAL ]  Iteration 333:	k_eff = 1.225132	res = 1.199E-05
[  NORMAL ]  Iteration 334:	k_eff = 1.225146	res = 1.169E-05
[  NORMAL ]  Iteration 335:	k_eff = 1.225160	res = 1.134E-05
[  NORMAL ]  Iteration 336:	k_eff = 1.225173	res = 1.111E-05
[  NORMAL ]  Iteration 337:	k_eff = 1.225186	res = 1.073E-05
[  NORMAL ]  Iteration 338:	k_eff = 1.225199	res = 1.067E-05
[  NORMAL ]  Iteration 339:	k_eff = 1.225211	res = 1.050E-05
In [28]:
# Print report of keff and bias with OpenMC
openmoc_keff = solver.getKeff()
openmc_keff = sp.k_combined[0]
bias = (openmoc_keff - openmc_keff) * 1e5

print('openmc keff = {0:1.6f}'.format(openmc_keff))
print('openmoc keff = {0:1.6f}'.format(openmoc_keff))
print('bias [pcm]: {0:1.1f}'.format(bias))
openmc keff = 1.224484
openmoc keff = 1.225211
bias [pcm]: 72.7

There is a non-trivial bias in both the 2-group and 8-group cases. In the case of a pin cell, one can show that these biases do not converge to <100 pcm with more particle histories. For heterogeneous geometries, additional measures must be taken to address the following three sources of bias:

  • Appropriate transport-corrected cross sections
  • Spatial discretization of OpenMOC's mesh
  • Constant-in-angle multi-group cross sections

Visualizing MGXS Data

It is often insightful to generate visual depictions of multi-group cross sections. There are many different types of plots which may be useful for multi-group cross section visualization, only a few of which will be shown here for enrichment and inspiration.

One particularly useful visualization is a comparison of the continuous-energy and multi-group cross sections for a particular nuclide and reaction type. We illustrate one option for generating such plots with the use of the openmc.plotter module to plot continuous-energy cross sections from the openly available cross section library distributed by NNDC.

The MGXS data can also be plotted using the openmc.plot_xs command, however we will do this manually here to show how the openmc.Mgxs.get_xs method can be used to obtain data.

In [29]:
# Create a figure of the U-235 continuous-energy fission cross section 
fig = openmc.plot_xs('U235', ['fission'])

# Get the axis to use for plotting the MGXS
ax = fig.gca()

# Extract energy group bounds and MGXS values to plot
fission = xs_library[fuel_cell.id]['fission']
energy_groups = fission.energy_groups
x = energy_groups.group_edges
y = fission.get_xs(nuclides=['U235'], order_groups='decreasing', xs_type='micro')
y = np.squeeze(y)

# Fix low energy bound
x[0] = 1.e-5

# Extend the mgxs values array for matplotlib's step plot
y = np.insert(y, 0, y[0])

# Create a step plot for the MGXS
ax.plot(x, y, drawstyle='steps', color='r', linewidth=3)

ax.set_title('U-235 Fission Cross Section')
ax.legend(['Continuous', 'Multi-Group'])
ax.set_xlim((x.min(), x.max()))
/home/romano/openmc/openmc/tallies.py:1798: RuntimeWarning: invalid value encountered in true_divide
  self_rel_err = data['self']['std. dev.'] / data['self']['mean']
Out[29]:
(1.0000000000000001e-05, 20000000.0)

Another useful type of illustration is scattering matrix sparsity structures. First, we extract Pandas DataFrames for the H-1 and O-16 scattering matrices.

In [30]:
# Construct a Pandas DataFrame for the microscopic nu-scattering matrix
nuscatter = xs_library[moderator_cell.id]['nu-scatter']
df = nuscatter.get_pandas_dataframe(xs_type='micro')

# Slice DataFrame in two for each nuclide's mean values
h1 = df[df['nuclide'] == 'H1']['mean']
o16 = df[df['nuclide'] == 'O16']['mean']

# Cast DataFrames as NumPy arrays
h1 = h1.as_matrix()
o16 = o16.as_matrix()

# Reshape arrays to 2D matrix for plotting
h1.shape = (fine_groups.num_groups, fine_groups.num_groups)
o16.shape = (fine_groups.num_groups, fine_groups.num_groups)

Matplotlib's imshow routine can be used to plot the matrices to illustrate their sparsity structures.

In [31]:
# Create plot of the H-1 scattering matrix
fig = plt.subplot(121)
fig.imshow(h1, interpolation='nearest', cmap='jet')
plt.title('H-1 Scattering Matrix')
plt.xlabel('Group Out')
plt.ylabel('Group In')

# Create plot of the O-16 scattering matrix
fig2 = plt.subplot(122)
fig2.imshow(o16, interpolation='nearest', cmap='jet')
plt.title('O-16 Scattering Matrix')
plt.xlabel('Group Out')
plt.ylabel('Group In')

# Show the plot on screen
plt.show()