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/wbinventor/miniconda3/lib/python3.5/site-packages/matplotlib/__init__.py:1350: 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. Before defining a material, we must create nuclides that are used in the material.


In [2]:
# Instantiate some Nuclides
h1 = openmc.Nuclide('H1')
o16 = openmc.Nuclide('O16')
u235 = openmc.Nuclide('U235')
u238 = openmc.Nuclide('U238')
zr90 = openmc.Nuclide('Zr90')

With the nuclides we defined, we will now create three distinct materials for water, clad and fuel.


In [3]:
# 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 [4]:
# 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 [5]:
# 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 [6]:
# 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 [7]:
# 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 [8]:
# Create Geometry and set root Universe
openmc_geometry = openmc.Geometry()
openmc_geometry.root_universe = 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 190 active batches each with 10,000 particles.


In [9]:
# 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 [10]:
# Instantiate a "coarse" 2-group EnergyGroups object
coarse_groups = mgxs.EnergyGroups()
coarse_groups.group_edges = np.array([0., 0.625, 20.0e6])

# Instantiate a "fine" 8-group EnergyGroups object
fine_groups = mgxs.EnergyGroups()
fine_groups.group_edges = np.array([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 [11]:
# 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 [12]:
# 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 [13]:
# 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()

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


In [14]:
# 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.8.0
          Git SHA1 | 647bf77a57a3cc5cce24b39cb192e1b99f52e499
         Date/Time | 2017-02-27 13:35:52
    OpenMP Threads | 4

 ===========================================================================
 ========================>     INITIALIZATION     <=========================
 ===========================================================================

 Reading settings XML file...
 Reading geometry XML file...
 Reading materials XML file...
 Reading cross sections XML file...
 Reading U235 from
 /home/wbinventor/Documents/NSE-CRPG-Codes/openmc/data/nndc_hdf5/U235.h5
 Reading U238 from
 /home/wbinventor/Documents/NSE-CRPG-Codes/openmc/data/nndc_hdf5/U238.h5
 Reading O16 from
 /home/wbinventor/Documents/NSE-CRPG-Codes/openmc/data/nndc_hdf5/O16.h5
 Reading H1 from
 /home/wbinventor/Documents/NSE-CRPG-Codes/openmc/data/nndc_hdf5/H1.h5
 Reading Zr90 from
 /home/wbinventor/Documents/NSE-CRPG-Codes/openmc/data/nndc_hdf5/Zr90.h5
 Maximum neutron transport energy: 2.00000E+07 eV for U235
 Reading tallies XML file...
 Building neighboring cells lists for each surface...
 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 10052
 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 10052
 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...

 ===========================================================================
 ======================>     SIMULATION FINISHED     <======================
 ===========================================================================


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

 Total time for initialization     =  4.8359E-01 seconds
   Reading cross sections          =  3.0552E-01 seconds
 Total time in simulation          =  1.4019E+02 seconds
   Time in transport only          =  1.3995E+02 seconds
   Time in inactive batches        =  8.5036E+00 seconds
   Time in active batches          =  1.3169E+02 seconds
   Time synchronizing fission bank =  2.6010E-02 seconds
     Sampling source sites         =  1.8806E-02 seconds
     SEND/RECV source sites        =  7.0698E-03 seconds
   Time accumulating tallies       =  2.8324E-03 seconds
 Total time for finalization       =  2.2540E-02 seconds
 Total time elapsed                =  1.4077E+02 seconds
 Calculation Rate (inactive)       =  11759.7 neutrons/second
 Calculation Rate (active)         =  3037.46 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[14]:
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 [15]:
# 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 [16]:
# 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 [17]:
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      =	10000
	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/wbinventor/Documents/NSE-CRPG-Codes/openmc/openmc/tallies.py:1835: 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 [18]:
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      =	10000
	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 [19]:
nuscatter = xs_library[moderator_cell.id]['nu-scatter']
df = nuscatter.get_pandas_dataframe(xs_type='micro')
df.head(10)


/home/wbinventor/Documents/NSE-CRPG-Codes/openmc/openmc/tallies.py:1835: RuntimeWarning: invalid value encountered in true_divide
  self_rel_err = data['self']['std. dev.'] / data['self']['mean']
Out[19]:
cell group in group out nuclide mean std. dev.
126 10002 1 1 H1 0.233991 0.003752
127 10002 1 1 O16 1.569288 0.006360
124 10002 1 2 H1 1.587279 0.003098
125 10002 1 2 O16 0.285599 0.001422
122 10002 1 3 H1 0.010482 0.000220
123 10002 1 3 O16 0.000000 0.000000
120 10002 1 4 H1 0.000009 0.000006
121 10002 1 4 O16 0.000000 0.000000
118 10002 1 5 H1 0.000005 0.000005
119 10002 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 [20]:
# Extract the 16-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 16-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 [21]:
condensed_xs.print_xs()


Multi-Group XS
	Reaction Type  =	transport
	Domain Type    =	cell
	Domain ID      =	10000
	Nuclide        =	U235
	Cross Sections [cm^-1]:
            Group 1 [0.625      - 20000000.0eV]:	7.84e-03 +/- 4.34e-01%
            Group 2 [0.0        - 0.625     eV]:	1.82e-01 +/- 1.91e-01%

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

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




In [22]:
df = condensed_xs.get_pandas_dataframe(xs_type='micro')
df


Out[22]:
cell group in nuclide mean std. dev.
3 10000 1 U235 20.912730 0.090857
4 10000 1 U238 9.577234 0.013248
5 10000 1 O16 3.158619 0.004864
0 10000 2 U235 485.364898 0.925632
1 10000 2 U238 11.196946 0.025466
2 10000 2 O16 3.788841 0.009855

Verification with OpenMOC

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


In [23]:
# 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 [24]:
# 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/wbinventor/Documents/NSE-CRPG-Codes/openmc/openmc/tallies.py:1835: RuntimeWarning: invalid value encountered in true_divide
  self_rel_err = data['self']['std. dev.'] / data['self']['mean']
/home/wbinventor/Documents/NSE-CRPG-Codes/openmc/openmc/tallies.py:1836: RuntimeWarning: invalid value encountered in true_divide
  other_rel_err = data['other']['std. dev.'] / data['other']['mean']
/home/wbinventor/Documents/NSE-CRPG-Codes/openmc/openmc/tallies.py:1837: 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 [25]:
# 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.423140	res = 0.000E+00
[  NORMAL ]  Iteration 1:	k_eff = 0.475976	res = 5.769E-01
[  NORMAL ]  Iteration 2:	k_eff = 0.491509	res = 1.249E-01
[  NORMAL ]  Iteration 3:	k_eff = 0.487503	res = 3.263E-02
[  NORMAL ]  Iteration 4:	k_eff = 0.484002	res = 8.150E-03
[  NORMAL ]  Iteration 5:	k_eff = 0.477365	res = 7.181E-03
[  NORMAL ]  Iteration 6:	k_eff = 0.469036	res = 1.371E-02
[  NORMAL ]  Iteration 7:	k_eff = 0.460429	res = 1.745E-02
[  NORMAL ]  Iteration 8:	k_eff = 0.450711	res = 1.835E-02
[  NORMAL ]  Iteration 9:	k_eff = 0.441506	res = 2.111E-02
[  NORMAL ]  Iteration 10:	k_eff = 0.432127	res = 2.042E-02
[  NORMAL ]  Iteration 11:	k_eff = 0.423076	res = 2.124E-02
[  NORMAL ]  Iteration 12:	k_eff = 0.414637	res = 2.095E-02
[  NORMAL ]  Iteration 13:	k_eff = 0.406863	res = 1.995E-02
[  NORMAL ]  Iteration 14:	k_eff = 0.399537	res = 1.875E-02
[  NORMAL ]  Iteration 15:	k_eff = 0.393230	res = 1.801E-02
[  NORMAL ]  Iteration 16:	k_eff = 0.387592	res = 1.579E-02
[  NORMAL ]  Iteration 17:	k_eff = 0.382836	res = 1.434E-02
[  NORMAL ]  Iteration 18:	k_eff = 0.378910	res = 1.227E-02
[  NORMAL ]  Iteration 19:	k_eff = 0.375812	res = 1.026E-02
[  NORMAL ]  Iteration 20:	k_eff = 0.373658	res = 8.176E-03
[  NORMAL ]  Iteration 21:	k_eff = 0.372526	res = 5.730E-03
[  NORMAL ]  Iteration 22:	k_eff = 0.372142	res = 3.031E-03
[  NORMAL ]  Iteration 23:	k_eff = 0.372747	res = 1.030E-03
[  NORMAL ]  Iteration 24:	k_eff = 0.374220	res = 1.627E-03
[  NORMAL ]  Iteration 25:	k_eff = 0.376545	res = 3.951E-03
[  NORMAL ]  Iteration 26:	k_eff = 0.379722	res = 6.213E-03
[  NORMAL ]  Iteration 27:	k_eff = 0.383738	res = 8.437E-03
[  NORMAL ]  Iteration 28:	k_eff = 0.388532	res = 1.058E-02
[  NORMAL ]  Iteration 29:	k_eff = 0.394086	res = 1.249E-02
[  NORMAL ]  Iteration 30:	k_eff = 0.400378	res = 1.429E-02
[  NORMAL ]  Iteration 31:	k_eff = 0.407375	res = 1.597E-02
[  NORMAL ]  Iteration 32:	k_eff = 0.415020	res = 1.747E-02
[  NORMAL ]  Iteration 33:	k_eff = 0.423303	res = 1.877E-02
[  NORMAL ]  Iteration 34:	k_eff = 0.432177	res = 1.996E-02
[  NORMAL ]  Iteration 35:	k_eff = 0.441592	res = 2.096E-02
[  NORMAL ]  Iteration 36:	k_eff = 0.451546	res = 2.179E-02
[  NORMAL ]  Iteration 37:	k_eff = 0.461964	res = 2.254E-02
[  NORMAL ]  Iteration 38:	k_eff = 0.472835	res = 2.307E-02
[  NORMAL ]  Iteration 39:	k_eff = 0.484106	res = 2.353E-02
[  NORMAL ]  Iteration 40:	k_eff = 0.495748	res = 2.384E-02
[  NORMAL ]  Iteration 41:	k_eff = 0.507723	res = 2.405E-02
[  NORMAL ]  Iteration 42:	k_eff = 0.519997	res = 2.416E-02
[  NORMAL ]  Iteration 43:	k_eff = 0.532536	res = 2.418E-02
[  NORMAL ]  Iteration 44:	k_eff = 0.545307	res = 2.411E-02
[  NORMAL ]  Iteration 45:	k_eff = 0.558277	res = 2.398E-02
[  NORMAL ]  Iteration 46:	k_eff = 0.571414	res = 2.379E-02
[  NORMAL ]  Iteration 47:	k_eff = 0.584691	res = 2.353E-02
[  NORMAL ]  Iteration 48:	k_eff = 0.598077	res = 2.323E-02
[  NORMAL ]  Iteration 49:	k_eff = 0.611545	res = 2.289E-02
[  NORMAL ]  Iteration 50:	k_eff = 0.625068	res = 2.252E-02
[  NORMAL ]  Iteration 51:	k_eff = 0.638624	res = 2.211E-02
[  NORMAL ]  Iteration 52:	k_eff = 0.652187	res = 2.169E-02
[  NORMAL ]  Iteration 53:	k_eff = 0.665734	res = 2.124E-02
[  NORMAL ]  Iteration 54:	k_eff = 0.679246	res = 2.077E-02
[  NORMAL ]  Iteration 55:	k_eff = 0.692702	res = 2.030E-02
[  NORMAL ]  Iteration 56:	k_eff = 0.706083	res = 1.981E-02
[  NORMAL ]  Iteration 57:	k_eff = 0.719373	res = 1.932E-02
[  NORMAL ]  Iteration 58:	k_eff = 0.732554	res = 1.882E-02
[  NORMAL ]  Iteration 59:	k_eff = 0.745613	res = 1.832E-02
[  NORMAL ]  Iteration 60:	k_eff = 0.758535	res = 1.783E-02
[  NORMAL ]  Iteration 61:	k_eff = 0.771307	res = 1.733E-02
[  NORMAL ]  Iteration 62:	k_eff = 0.783919	res = 1.684E-02
[  NORMAL ]  Iteration 63:	k_eff = 0.796359	res = 1.635E-02
[  NORMAL ]  Iteration 64:	k_eff = 0.808617	res = 1.587E-02
[  NORMAL ]  Iteration 65:	k_eff = 0.820685	res = 1.539E-02
[  NORMAL ]  Iteration 66:	k_eff = 0.832556	res = 1.492E-02
[  NORMAL ]  Iteration 67:	k_eff = 0.844222	res = 1.446E-02
[  NORMAL ]  Iteration 68:	k_eff = 0.855678	res = 1.401E-02
[  NORMAL ]  Iteration 69:	k_eff = 0.866918	res = 1.357E-02
[  NORMAL ]  Iteration 70:	k_eff = 0.877939	res = 1.314E-02
[  NORMAL ]  Iteration 71:	k_eff = 0.888734	res = 1.271E-02
[  NORMAL ]  Iteration 72:	k_eff = 0.899303	res = 1.230E-02
[  NORMAL ]  Iteration 73:	k_eff = 0.909643	res = 1.189E-02
[  NORMAL ]  Iteration 74:	k_eff = 0.919752	res = 1.150E-02
[  NORMAL ]  Iteration 75:	k_eff = 0.929628	res = 1.111E-02
[  NORMAL ]  Iteration 76:	k_eff = 0.939271	res = 1.074E-02
[  NORMAL ]  Iteration 77:	k_eff = 0.948681	res = 1.037E-02
[  NORMAL ]  Iteration 78:	k_eff = 0.957857	res = 1.002E-02
[  NORMAL ]  Iteration 79:	k_eff = 0.966802	res = 9.673E-03
[  NORMAL ]  Iteration 80:	k_eff = 0.975514	res = 9.338E-03
[  NORMAL ]  Iteration 81:	k_eff = 0.983997	res = 9.012E-03
[  NORMAL ]  Iteration 82:	k_eff = 0.992252	res = 8.696E-03
[  NORMAL ]  Iteration 83:	k_eff = 1.000280	res = 8.389E-03
[  NORMAL ]  Iteration 84:	k_eff = 1.008085	res = 8.091E-03
[  NORMAL ]  Iteration 85:	k_eff = 1.015668	res = 7.803E-03
[  NORMAL ]  Iteration 86:	k_eff = 1.023034	res = 7.522E-03
[  NORMAL ]  Iteration 87:	k_eff = 1.030183	res = 7.252E-03
[  NORMAL ]  Iteration 88:	k_eff = 1.037121	res = 6.989E-03
[  NORMAL ]  Iteration 89:	k_eff = 1.043850	res = 6.735E-03
[  NORMAL ]  Iteration 90:	k_eff = 1.050374	res = 6.488E-03
[  NORMAL ]  Iteration 91:	k_eff = 1.056697	res = 6.250E-03
[  NORMAL ]  Iteration 92:	k_eff = 1.062823	res = 6.020E-03
[  NORMAL ]  Iteration 93:	k_eff = 1.068754	res = 5.797E-03
[  NORMAL ]  Iteration 94:	k_eff = 1.074496	res = 5.581E-03
[  NORMAL ]  Iteration 95:	k_eff = 1.080052	res = 5.372E-03
[  NORMAL ]  Iteration 96:	k_eff = 1.085427	res = 5.171E-03
[  NORMAL ]  Iteration 97:	k_eff = 1.090623	res = 4.976E-03
[  NORMAL ]  Iteration 98:	k_eff = 1.095647	res = 4.788E-03
[  NORMAL ]  Iteration 99:	k_eff = 1.100501	res = 4.606E-03
[  NORMAL ]  Iteration 100:	k_eff = 1.105190	res = 4.431E-03
[  NORMAL ]  Iteration 101:	k_eff = 1.109719	res = 4.261E-03
[  NORMAL ]  Iteration 102:	k_eff = 1.114091	res = 4.098E-03
[  NORMAL ]  Iteration 103:	k_eff = 1.118310	res = 3.940E-03
[  NORMAL ]  Iteration 104:	k_eff = 1.122382	res = 3.787E-03
[  NORMAL ]  Iteration 105:	k_eff = 1.126308	res = 3.640E-03
[  NORMAL ]  Iteration 106:	k_eff = 1.130095	res = 3.498E-03
[  NORMAL ]  Iteration 107:	k_eff = 1.133745	res = 3.362E-03
[  NORMAL ]  Iteration 108:	k_eff = 1.137262	res = 3.230E-03
[  NORMAL ]  Iteration 109:	k_eff = 1.140652	res = 3.102E-03
[  NORMAL ]  Iteration 110:	k_eff = 1.143916	res = 2.980E-03
[  NORMAL ]  Iteration 111:	k_eff = 1.147061	res = 2.862E-03
[  NORMAL ]  Iteration 112:	k_eff = 1.150087	res = 2.749E-03
[  NORMAL ]  Iteration 113:	k_eff = 1.153001	res = 2.638E-03
[  NORMAL ]  Iteration 114:	k_eff = 1.155805	res = 2.534E-03
[  NORMAL ]  Iteration 115:	k_eff = 1.158502	res = 2.432E-03
[  NORMAL ]  Iteration 116:	k_eff = 1.161096	res = 2.333E-03
[  NORMAL ]  Iteration 117:	k_eff = 1.163591	res = 2.239E-03
[  NORMAL ]  Iteration 118:	k_eff = 1.165989	res = 2.149E-03
[  NORMAL ]  Iteration 119:	k_eff = 1.168295	res = 2.061E-03
[  NORMAL ]  Iteration 120:	k_eff = 1.170511	res = 1.978E-03
[  NORMAL ]  Iteration 121:	k_eff = 1.172640	res = 1.896E-03
[  NORMAL ]  Iteration 122:	k_eff = 1.174685	res = 1.819E-03
[  NORMAL ]  Iteration 123:	k_eff = 1.176649	res = 1.744E-03
[  NORMAL ]  Iteration 124:	k_eff = 1.178535	res = 1.672E-03
[  NORMAL ]  Iteration 125:	k_eff = 1.180345	res = 1.603E-03
[  NORMAL ]  Iteration 126:	k_eff = 1.182083	res = 1.536E-03
[  NORMAL ]  Iteration 127:	k_eff = 1.183751	res = 1.473E-03
[  NORMAL ]  Iteration 128:	k_eff = 1.185352	res = 1.411E-03
[  NORMAL ]  Iteration 129:	k_eff = 1.186888	res = 1.352E-03
[  NORMAL ]  Iteration 130:	k_eff = 1.188360	res = 1.295E-03
[  NORMAL ]  Iteration 131:	k_eff = 1.189772	res = 1.241E-03
[  NORMAL ]  Iteration 132:	k_eff = 1.191127	res = 1.189E-03
[  NORMAL ]  Iteration 133:	k_eff = 1.192425	res = 1.138E-03
[  NORMAL ]  Iteration 134:	k_eff = 1.193670	res = 1.090E-03
[  NORMAL ]  Iteration 135:	k_eff = 1.194863	res = 1.044E-03
[  NORMAL ]  Iteration 136:	k_eff = 1.196006	res = 9.995E-04
[  NORMAL ]  Iteration 137:	k_eff = 1.197101	res = 9.566E-04
[  NORMAL ]  Iteration 138:	k_eff = 1.198150	res = 9.162E-04
[  NORMAL ]  Iteration 139:	k_eff = 1.199155	res = 8.766E-04
[  NORMAL ]  Iteration 140:	k_eff = 1.200116	res = 8.384E-04
[  NORMAL ]  Iteration 141:	k_eff = 1.201038	res = 8.017E-04
[  NORMAL ]  Iteration 142:	k_eff = 1.201920	res = 7.684E-04
[  NORMAL ]  Iteration 143:	k_eff = 1.202765	res = 7.343E-04
[  NORMAL ]  Iteration 144:	k_eff = 1.203573	res = 7.030E-04
[  NORMAL ]  Iteration 145:	k_eff = 1.204347	res = 6.718E-04
[  NORMAL ]  Iteration 146:	k_eff = 1.205087	res = 6.424E-04
[  NORMAL ]  Iteration 147:	k_eff = 1.205796	res = 6.147E-04
[  NORMAL ]  Iteration 148:	k_eff = 1.206473	res = 5.881E-04
[  NORMAL ]  Iteration 149:	k_eff = 1.207122	res = 5.614E-04
[  NORMAL ]  Iteration 150:	k_eff = 1.207741	res = 5.376E-04
[  NORMAL ]  Iteration 151:	k_eff = 1.208334	res = 5.136E-04
[  NORMAL ]  Iteration 152:	k_eff = 1.208901	res = 4.903E-04
[  NORMAL ]  Iteration 153:	k_eff = 1.209443	res = 4.695E-04
[  NORMAL ]  Iteration 154:	k_eff = 1.209961	res = 4.482E-04
[  NORMAL ]  Iteration 155:	k_eff = 1.210455	res = 4.282E-04
[  NORMAL ]  Iteration 156:	k_eff = 1.210928	res = 4.088E-04
[  NORMAL ]  Iteration 157:	k_eff = 1.211380	res = 3.910E-04
[  NORMAL ]  Iteration 158:	k_eff = 1.211813	res = 3.730E-04
[  NORMAL ]  Iteration 159:	k_eff = 1.212225	res = 3.573E-04
[  NORMAL ]  Iteration 160:	k_eff = 1.212620	res = 3.403E-04
[  NORMAL ]  Iteration 161:	k_eff = 1.212997	res = 3.256E-04
[  NORMAL ]  Iteration 162:	k_eff = 1.213356	res = 3.107E-04
[  NORMAL ]  Iteration 163:	k_eff = 1.213700	res = 2.965E-04
[  NORMAL ]  Iteration 164:	k_eff = 1.214028	res = 2.829E-04
[  NORMAL ]  Iteration 165:	k_eff = 1.214341	res = 2.706E-04
[  NORMAL ]  Iteration 166:	k_eff = 1.214640	res = 2.581E-04
[  NORMAL ]  Iteration 167:	k_eff = 1.214926	res = 2.465E-04
[  NORMAL ]  Iteration 168:	k_eff = 1.215199	res = 2.352E-04
[  NORMAL ]  Iteration 169:	k_eff = 1.215459	res = 2.241E-04
[  NORMAL ]  Iteration 170:	k_eff = 1.215707	res = 2.144E-04
[  NORMAL ]  Iteration 171:	k_eff = 1.215944	res = 2.036E-04
[  NORMAL ]  Iteration 172:	k_eff = 1.216170	res = 1.952E-04
[  NORMAL ]  Iteration 173:	k_eff = 1.216386	res = 1.854E-04
[  NORMAL ]  Iteration 174:	k_eff = 1.216592	res = 1.780E-04
[  NORMAL ]  Iteration 175:	k_eff = 1.216788	res = 1.689E-04
[  NORMAL ]  Iteration 176:	k_eff = 1.216976	res = 1.615E-04
[  NORMAL ]  Iteration 177:	k_eff = 1.217154	res = 1.545E-04
[  NORMAL ]  Iteration 178:	k_eff = 1.217325	res = 1.462E-04
[  NORMAL ]  Iteration 179:	k_eff = 1.217487	res = 1.400E-04
[  NORMAL ]  Iteration 180:	k_eff = 1.217642	res = 1.336E-04
[  NORMAL ]  Iteration 181:	k_eff = 1.217789	res = 1.271E-04
[  NORMAL ]  Iteration 182:	k_eff = 1.217931	res = 1.212E-04
[  NORMAL ]  Iteration 183:	k_eff = 1.218065	res = 1.160E-04
[  NORMAL ]  Iteration 184:	k_eff = 1.218193	res = 1.102E-04
[  NORMAL ]  Iteration 185:	k_eff = 1.218315	res = 1.054E-04
[  NORMAL ]  Iteration 186:	k_eff = 1.218431	res = 9.964E-05
[  NORMAL ]  Iteration 187:	k_eff = 1.218542	res = 9.572E-05
[  NORMAL ]  Iteration 188:	k_eff = 1.218647	res = 9.081E-05
[  NORMAL ]  Iteration 189:	k_eff = 1.218748	res = 8.632E-05
[  NORMAL ]  Iteration 190:	k_eff = 1.218844	res = 8.232E-05
[  NORMAL ]  Iteration 191:	k_eff = 1.218936	res = 7.887E-05
[  NORMAL ]  Iteration 192:	k_eff = 1.219023	res = 7.563E-05
[  NORMAL ]  Iteration 193:	k_eff = 1.219106	res = 7.154E-05
[  NORMAL ]  Iteration 194:	k_eff = 1.219185	res = 6.778E-05
[  NORMAL ]  Iteration 195:	k_eff = 1.219261	res = 6.484E-05
[  NORMAL ]  Iteration 196:	k_eff = 1.219333	res = 6.207E-05
[  NORMAL ]  Iteration 197:	k_eff = 1.219401	res = 5.898E-05
[  NORMAL ]  Iteration 198:	k_eff = 1.219466	res = 5.590E-05
[  NORMAL ]  Iteration 199:	k_eff = 1.219528	res = 5.305E-05
[  NORMAL ]  Iteration 200:	k_eff = 1.219587	res = 5.076E-05
[  NORMAL ]  Iteration 201:	k_eff = 1.219643	res = 4.829E-05
[  NORMAL ]  Iteration 202:	k_eff = 1.219696	res = 4.595E-05
[  NORMAL ]  Iteration 203:	k_eff = 1.219747	res = 4.399E-05
[  NORMAL ]  Iteration 204:	k_eff = 1.219796	res = 4.161E-05
[  NORMAL ]  Iteration 205:	k_eff = 1.219842	res = 3.973E-05
[  NORMAL ]  Iteration 206:	k_eff = 1.219886	res = 3.781E-05
[  NORMAL ]  Iteration 207:	k_eff = 1.219928	res = 3.629E-05
[  NORMAL ]  Iteration 208:	k_eff = 1.219968	res = 3.451E-05
[  NORMAL ]  Iteration 209:	k_eff = 1.220006	res = 3.274E-05
[  NORMAL ]  Iteration 210:	k_eff = 1.220042	res = 3.108E-05
[  NORMAL ]  Iteration 211:	k_eff = 1.220076	res = 2.951E-05
[  NORMAL ]  Iteration 212:	k_eff = 1.220108	res = 2.785E-05
[  NORMAL ]  Iteration 213:	k_eff = 1.220139	res = 2.664E-05
[  NORMAL ]  Iteration 214:	k_eff = 1.220169	res = 2.518E-05
[  NORMAL ]  Iteration 215:	k_eff = 1.220197	res = 2.463E-05
[  NORMAL ]  Iteration 216:	k_eff = 1.220224	res = 2.318E-05
[  NORMAL ]  Iteration 217:	k_eff = 1.220249	res = 2.189E-05
[  NORMAL ]  Iteration 218:	k_eff = 1.220273	res = 2.075E-05
[  NORMAL ]  Iteration 219:	k_eff = 1.220296	res = 1.964E-05
[  NORMAL ]  Iteration 220:	k_eff = 1.220318	res = 1.922E-05
[  NORMAL ]  Iteration 221:	k_eff = 1.220339	res = 1.776E-05
[  NORMAL ]  Iteration 222:	k_eff = 1.220358	res = 1.701E-05
[  NORMAL ]  Iteration 223:	k_eff = 1.220377	res = 1.615E-05
[  NORMAL ]  Iteration 224:	k_eff = 1.220395	res = 1.559E-05
[  NORMAL ]  Iteration 225:	k_eff = 1.220412	res = 1.443E-05
[  NORMAL ]  Iteration 226:	k_eff = 1.220429	res = 1.403E-05
[  NORMAL ]  Iteration 227:	k_eff = 1.220444	res = 1.354E-05
[  NORMAL ]  Iteration 228:	k_eff = 1.220459	res = 1.235E-05
[  NORMAL ]  Iteration 229:	k_eff = 1.220472	res = 1.204E-05
[  NORMAL ]  Iteration 230:	k_eff = 1.220485	res = 1.135E-05
[  NORMAL ]  Iteration 231:	k_eff = 1.220498	res = 1.085E-05
[  NORMAL ]  Iteration 232:	k_eff = 1.220510	res = 1.022E-05

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


In [26]:
# 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.220510
bias [pcm]: -397.4

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 [27]:
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/wbinventor/Documents/NSE-CRPG-Codes/openmc/openmc/tallies.py:1835: RuntimeWarning: invalid value encountered in true_divide
  self_rel_err = data['self']['std. dev.'] / data['self']['mean']
/home/wbinventor/Documents/NSE-CRPG-Codes/openmc/openmc/tallies.py:1836: RuntimeWarning: invalid value encountered in true_divide
  other_rel_err = data['other']['std. dev.'] / data['other']['mean']
/home/wbinventor/Documents/NSE-CRPG-Codes/openmc/openmc/tallies.py:1837: RuntimeWarning: invalid value encountered in true_divide
  new_tally._mean = data['self']['mean'] / data['other']['mean']

In [28]:
# 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.366890	res = 0.000E+00
[  NORMAL ]  Iteration 1:	k_eff = 0.391200	res = 6.331E-01
[  NORMAL ]  Iteration 2:	k_eff = 0.393015	res = 6.626E-02
[  NORMAL ]  Iteration 3:	k_eff = 0.381131	res = 4.640E-03
[  NORMAL ]  Iteration 4:	k_eff = 0.375055	res = 3.024E-02
[  NORMAL ]  Iteration 5:	k_eff = 0.369635	res = 1.594E-02
[  NORMAL ]  Iteration 6:	k_eff = 0.365588	res = 1.445E-02
[  NORMAL ]  Iteration 7:	k_eff = 0.363102	res = 1.095E-02
[  NORMAL ]  Iteration 8:	k_eff = 0.361522	res = 6.801E-03
[  NORMAL ]  Iteration 9:	k_eff = 0.361329	res = 4.350E-03
[  NORMAL ]  Iteration 10:	k_eff = 0.362052	res = 5.337E-04
[  NORMAL ]  Iteration 11:	k_eff = 0.363766	res = 2.000E-03
[  NORMAL ]  Iteration 12:	k_eff = 0.366383	res = 4.733E-03
[  NORMAL ]  Iteration 13:	k_eff = 0.369846	res = 7.196E-03
[  NORMAL ]  Iteration 14:	k_eff = 0.374028	res = 9.452E-03
[  NORMAL ]  Iteration 15:	k_eff = 0.378957	res = 1.131E-02
[  NORMAL ]  Iteration 16:	k_eff = 0.384508	res = 1.318E-02
[  NORMAL ]  Iteration 17:	k_eff = 0.390660	res = 1.465E-02
[  NORMAL ]  Iteration 18:	k_eff = 0.397354	res = 1.600E-02
[  NORMAL ]  Iteration 19:	k_eff = 0.404542	res = 1.713E-02
[  NORMAL ]  Iteration 20:	k_eff = 0.412186	res = 1.809E-02
[  NORMAL ]  Iteration 21:	k_eff = 0.420246	res = 1.889E-02
[  NORMAL ]  Iteration 22:	k_eff = 0.428671	res = 1.956E-02
[  NORMAL ]  Iteration 23:	k_eff = 0.437437	res = 2.005E-02
[  NORMAL ]  Iteration 24:	k_eff = 0.446503	res = 2.045E-02
[  NORMAL ]  Iteration 25:	k_eff = 0.455839	res = 2.073E-02
[  NORMAL ]  Iteration 26:	k_eff = 0.465413	res = 2.091E-02
[  NORMAL ]  Iteration 27:	k_eff = 0.475198	res = 2.100E-02
[  NORMAL ]  Iteration 28:	k_eff = 0.485167	res = 2.103E-02
[  NORMAL ]  Iteration 29:	k_eff = 0.495295	res = 2.098E-02
[  NORMAL ]  Iteration 30:	k_eff = 0.505558	res = 2.087E-02
[  NORMAL ]  Iteration 31:	k_eff = 0.515935	res = 2.072E-02
[  NORMAL ]  Iteration 32:	k_eff = 0.526405	res = 2.053E-02
[  NORMAL ]  Iteration 33:	k_eff = 0.536950	res = 2.029E-02
[  NORMAL ]  Iteration 34:	k_eff = 0.547551	res = 2.003E-02
[  NORMAL ]  Iteration 35:	k_eff = 0.558191	res = 1.974E-02
[  NORMAL ]  Iteration 36:	k_eff = 0.568856	res = 1.943E-02
[  NORMAL ]  Iteration 37:	k_eff = 0.579532	res = 1.911E-02
[  NORMAL ]  Iteration 38:	k_eff = 0.590203	res = 1.877E-02
[  NORMAL ]  Iteration 39:	k_eff = 0.600860	res = 1.841E-02
[  NORMAL ]  Iteration 40:	k_eff = 0.611489	res = 1.806E-02
[  NORMAL ]  Iteration 41:	k_eff = 0.622080	res = 1.769E-02
[  NORMAL ]  Iteration 42:	k_eff = 0.632623	res = 1.732E-02
[  NORMAL ]  Iteration 43:	k_eff = 0.643111	res = 1.695E-02
[  NORMAL ]  Iteration 44:	k_eff = 0.653533	res = 1.658E-02
[  NORMAL ]  Iteration 45:	k_eff = 0.663882	res = 1.621E-02
[  NORMAL ]  Iteration 46:	k_eff = 0.674152	res = 1.584E-02
[  NORMAL ]  Iteration 47:	k_eff = 0.684335	res = 1.547E-02
[  NORMAL ]  Iteration 48:	k_eff = 0.694427	res = 1.511E-02
[  NORMAL ]  Iteration 49:	k_eff = 0.704421	res = 1.475E-02
[  NORMAL ]  Iteration 50:	k_eff = 0.714313	res = 1.439E-02
[  NORMAL ]  Iteration 51:	k_eff = 0.724099	res = 1.404E-02
[  NORMAL ]  Iteration 52:	k_eff = 0.733774	res = 1.370E-02
[  NORMAL ]  Iteration 53:	k_eff = 0.743335	res = 1.336E-02
[  NORMAL ]  Iteration 54:	k_eff = 0.752778	res = 1.303E-02
[  NORMAL ]  Iteration 55:	k_eff = 0.762103	res = 1.270E-02
[  NORMAL ]  Iteration 56:	k_eff = 0.771304	res = 1.239E-02
[  NORMAL ]  Iteration 57:	k_eff = 0.780382	res = 1.207E-02
[  NORMAL ]  Iteration 58:	k_eff = 0.789332	res = 1.177E-02
[  NORMAL ]  Iteration 59:	k_eff = 0.798155	res = 1.147E-02
[  NORMAL ]  Iteration 60:	k_eff = 0.806849	res = 1.118E-02
[  NORMAL ]  Iteration 61:	k_eff = 0.815413	res = 1.089E-02
[  NORMAL ]  Iteration 62:	k_eff = 0.823846	res = 1.061E-02
[  NORMAL ]  Iteration 63:	k_eff = 0.832147	res = 1.034E-02
[  NORMAL ]  Iteration 64:	k_eff = 0.840316	res = 1.008E-02
[  NORMAL ]  Iteration 65:	k_eff = 0.848354	res = 9.817E-03
[  NORMAL ]  Iteration 66:	k_eff = 0.856259	res = 9.565E-03
[  NORMAL ]  Iteration 67:	k_eff = 0.864033	res = 9.318E-03
[  NORMAL ]  Iteration 68:	k_eff = 0.871674	res = 9.078E-03
[  NORMAL ]  Iteration 69:	k_eff = 0.879184	res = 8.844E-03
[  NORMAL ]  Iteration 70:	k_eff = 0.886563	res = 8.616E-03
[  NORMAL ]  Iteration 71:	k_eff = 0.893812	res = 8.393E-03
[  NORMAL ]  Iteration 72:	k_eff = 0.900932	res = 8.177E-03
[  NORMAL ]  Iteration 73:	k_eff = 0.907923	res = 7.965E-03
[  NORMAL ]  Iteration 74:	k_eff = 0.914786	res = 7.760E-03
[  NORMAL ]  Iteration 75:	k_eff = 0.921523	res = 7.560E-03
[  NORMAL ]  Iteration 76:	k_eff = 0.928134	res = 7.365E-03
[  NORMAL ]  Iteration 77:	k_eff = 0.934621	res = 7.174E-03
[  NORMAL ]  Iteration 78:	k_eff = 0.940985	res = 6.989E-03
[  NORMAL ]  Iteration 79:	k_eff = 0.947227	res = 6.809E-03
[  NORMAL ]  Iteration 80:	k_eff = 0.953349	res = 6.634E-03
[  NORMAL ]  Iteration 81:	k_eff = 0.959352	res = 6.463E-03
[  NORMAL ]  Iteration 82:	k_eff = 0.965237	res = 6.297E-03
[  NORMAL ]  Iteration 83:	k_eff = 0.971006	res = 6.134E-03
[  NORMAL ]  Iteration 84:	k_eff = 0.976660	res = 5.977E-03
[  NORMAL ]  Iteration 85:	k_eff = 0.982201	res = 5.823E-03
[  NORMAL ]  Iteration 86:	k_eff = 0.987631	res = 5.674E-03
[  NORMAL ]  Iteration 87:	k_eff = 0.992950	res = 5.528E-03
[  NORMAL ]  Iteration 88:	k_eff = 0.998161	res = 5.386E-03
[  NORMAL ]  Iteration 89:	k_eff = 1.003266	res = 5.248E-03
[  NORMAL ]  Iteration 90:	k_eff = 1.008265	res = 5.114E-03
[  NORMAL ]  Iteration 91:	k_eff = 1.013161	res = 4.983E-03
[  NORMAL ]  Iteration 92:	k_eff = 1.017954	res = 4.856E-03
[  NORMAL ]  Iteration 93:	k_eff = 1.022648	res = 4.731E-03
[  NORMAL ]  Iteration 94:	k_eff = 1.027243	res = 4.611E-03
[  NORMAL ]  Iteration 95:	k_eff = 1.031741	res = 4.493E-03
[  NORMAL ]  Iteration 96:	k_eff = 1.036143	res = 4.379E-03
[  NORMAL ]  Iteration 97:	k_eff = 1.040452	res = 4.267E-03
[  NORMAL ]  Iteration 98:	k_eff = 1.044667	res = 4.159E-03
[  NORMAL ]  Iteration 99:	k_eff = 1.048794	res = 4.052E-03
[  NORMAL ]  Iteration 100:	k_eff = 1.052831	res = 3.950E-03
[  NORMAL ]  Iteration 101:	k_eff = 1.056781	res = 3.849E-03
[  NORMAL ]  Iteration 102:	k_eff = 1.060645	res = 3.752E-03
[  NORMAL ]  Iteration 103:	k_eff = 1.064425	res = 3.656E-03
[  NORMAL ]  Iteration 104:	k_eff = 1.068122	res = 3.564E-03
[  NORMAL ]  Iteration 105:	k_eff = 1.071738	res = 3.474E-03
[  NORMAL ]  Iteration 106:	k_eff = 1.075274	res = 3.386E-03
[  NORMAL ]  Iteration 107:	k_eff = 1.078734	res = 3.300E-03
[  NORMAL ]  Iteration 108:	k_eff = 1.082116	res = 3.217E-03
[  NORMAL ]  Iteration 109:	k_eff = 1.085423	res = 3.136E-03
[  NORMAL ]  Iteration 110:	k_eff = 1.088657	res = 3.056E-03
[  NORMAL ]  Iteration 111:	k_eff = 1.091818	res = 2.980E-03
[  NORMAL ]  Iteration 112:	k_eff = 1.094909	res = 2.904E-03
[  NORMAL ]  Iteration 113:	k_eff = 1.097930	res = 2.831E-03
[  NORMAL ]  Iteration 114:	k_eff = 1.100884	res = 2.760E-03
[  NORMAL ]  Iteration 115:	k_eff = 1.103771	res = 2.690E-03
[  NORMAL ]  Iteration 116:	k_eff = 1.106593	res = 2.623E-03
[  NORMAL ]  Iteration 117:	k_eff = 1.109351	res = 2.557E-03
[  NORMAL ]  Iteration 118:	k_eff = 1.112047	res = 2.492E-03
[  NORMAL ]  Iteration 119:	k_eff = 1.114682	res = 2.430E-03
[  NORMAL ]  Iteration 120:	k_eff = 1.117257	res = 2.369E-03
[  NORMAL ]  Iteration 121:	k_eff = 1.119772	res = 2.310E-03
[  NORMAL ]  Iteration 122:	k_eff = 1.122231	res = 2.251E-03
[  NORMAL ]  Iteration 123:	k_eff = 1.124633	res = 2.196E-03
[  NORMAL ]  Iteration 124:	k_eff = 1.126980	res = 2.140E-03
[  NORMAL ]  Iteration 125:	k_eff = 1.129273	res = 2.087E-03
[  NORMAL ]  Iteration 126:	k_eff = 1.131514	res = 2.035E-03
[  NORMAL ]  Iteration 127:	k_eff = 1.133703	res = 1.984E-03
[  NORMAL ]  Iteration 128:	k_eff = 1.135840	res = 1.934E-03
[  NORMAL ]  Iteration 129:	k_eff = 1.137929	res = 1.886E-03
[  NORMAL ]  Iteration 130:	k_eff = 1.139970	res = 1.839E-03
[  NORMAL ]  Iteration 131:	k_eff = 1.141963	res = 1.793E-03
[  NORMAL ]  Iteration 132:	k_eff = 1.143910	res = 1.749E-03
[  NORMAL ]  Iteration 133:	k_eff = 1.145812	res = 1.705E-03
[  NORMAL ]  Iteration 134:	k_eff = 1.147670	res = 1.663E-03
[  NORMAL ]  Iteration 135:	k_eff = 1.149484	res = 1.622E-03
[  NORMAL ]  Iteration 136:	k_eff = 1.151256	res = 1.581E-03
[  NORMAL ]  Iteration 137:	k_eff = 1.152986	res = 1.541E-03
[  NORMAL ]  Iteration 138:	k_eff = 1.154676	res = 1.503E-03
[  NORMAL ]  Iteration 139:	k_eff = 1.156326	res = 1.466E-03
[  NORMAL ]  Iteration 140:	k_eff = 1.157938	res = 1.429E-03
[  NORMAL ]  Iteration 141:	k_eff = 1.159512	res = 1.394E-03
[  NORMAL ]  Iteration 142:	k_eff = 1.161049	res = 1.359E-03
[  NORMAL ]  Iteration 143:	k_eff = 1.162549	res = 1.326E-03
[  NORMAL ]  Iteration 144:	k_eff = 1.164015	res = 1.292E-03
[  NORMAL ]  Iteration 145:	k_eff = 1.165446	res = 1.261E-03
[  NORMAL ]  Iteration 146:	k_eff = 1.166843	res = 1.229E-03
[  NORMAL ]  Iteration 147:	k_eff = 1.168208	res = 1.199E-03
[  NORMAL ]  Iteration 148:	k_eff = 1.169540	res = 1.169E-03
[  NORMAL ]  Iteration 149:	k_eff = 1.170840	res = 1.140E-03
[  NORMAL ]  Iteration 150:	k_eff = 1.172110	res = 1.112E-03
[  NORMAL ]  Iteration 151:	k_eff = 1.173350	res = 1.085E-03
[  NORMAL ]  Iteration 152:	k_eff = 1.174560	res = 1.058E-03
[  NORMAL ]  Iteration 153:	k_eff = 1.175742	res = 1.031E-03
[  NORMAL ]  Iteration 154:	k_eff = 1.176895	res = 1.006E-03
[  NORMAL ]  Iteration 155:	k_eff = 1.178021	res = 9.812E-04
[  NORMAL ]  Iteration 156:	k_eff = 1.179121	res = 9.567E-04
[  NORMAL ]  Iteration 157:	k_eff = 1.180194	res = 9.336E-04
[  NORMAL ]  Iteration 158:	k_eff = 1.181242	res = 9.100E-04
[  NORMAL ]  Iteration 159:	k_eff = 1.182264	res = 8.875E-04
[  NORMAL ]  Iteration 160:	k_eff = 1.183264	res = 8.656E-04
[  NORMAL ]  Iteration 161:	k_eff = 1.184238	res = 8.452E-04
[  NORMAL ]  Iteration 162:	k_eff = 1.185189	res = 8.233E-04
[  NORMAL ]  Iteration 163:	k_eff = 1.186118	res = 8.029E-04
[  NORMAL ]  Iteration 164:	k_eff = 1.187024	res = 7.839E-04
[  NORMAL ]  Iteration 165:	k_eff = 1.187908	res = 7.641E-04
[  NORMAL ]  Iteration 166:	k_eff = 1.188772	res = 7.449E-04
[  NORMAL ]  Iteration 167:	k_eff = 1.189615	res = 7.271E-04
[  NORMAL ]  Iteration 168:	k_eff = 1.190438	res = 7.093E-04
[  NORMAL ]  Iteration 169:	k_eff = 1.191241	res = 6.915E-04
[  NORMAL ]  Iteration 170:	k_eff = 1.192024	res = 6.742E-04
[  NORMAL ]  Iteration 171:	k_eff = 1.192789	res = 6.576E-04
[  NORMAL ]  Iteration 172:	k_eff = 1.193536	res = 6.419E-04
[  NORMAL ]  Iteration 173:	k_eff = 1.194265	res = 6.263E-04
[  NORMAL ]  Iteration 174:	k_eff = 1.194976	res = 6.104E-04
[  NORMAL ]  Iteration 175:	k_eff = 1.195670	res = 5.955E-04
[  NORMAL ]  Iteration 176:	k_eff = 1.196347	res = 5.806E-04
[  NORMAL ]  Iteration 177:	k_eff = 1.197008	res = 5.665E-04
[  NORMAL ]  Iteration 178:	k_eff = 1.197653	res = 5.525E-04
[  NORMAL ]  Iteration 179:	k_eff = 1.198284	res = 5.388E-04
[  NORMAL ]  Iteration 180:	k_eff = 1.198898	res = 5.263E-04
[  NORMAL ]  Iteration 181:	k_eff = 1.199498	res = 5.126E-04
[  NORMAL ]  Iteration 182:	k_eff = 1.200083	res = 5.000E-04
[  NORMAL ]  Iteration 183:	k_eff = 1.200654	res = 4.880E-04
[  NORMAL ]  Iteration 184:	k_eff = 1.201212	res = 4.757E-04
[  NORMAL ]  Iteration 185:	k_eff = 1.201756	res = 4.647E-04
[  NORMAL ]  Iteration 186:	k_eff = 1.202286	res = 4.528E-04
[  NORMAL ]  Iteration 187:	k_eff = 1.202804	res = 4.414E-04
[  NORMAL ]  Iteration 188:	k_eff = 1.203310	res = 4.310E-04
[  NORMAL ]  Iteration 189:	k_eff = 1.203803	res = 4.203E-04
[  NORMAL ]  Iteration 190:	k_eff = 1.204285	res = 4.100E-04
[  NORMAL ]  Iteration 191:	k_eff = 1.204755	res = 4.003E-04
[  NORMAL ]  Iteration 192:	k_eff = 1.205214	res = 3.902E-04
[  NORMAL ]  Iteration 193:	k_eff = 1.205661	res = 3.810E-04
[  NORMAL ]  Iteration 194:	k_eff = 1.206097	res = 3.711E-04
[  NORMAL ]  Iteration 195:	k_eff = 1.206523	res = 3.617E-04
[  NORMAL ]  Iteration 196:	k_eff = 1.206939	res = 3.528E-04
[  NORMAL ]  Iteration 197:	k_eff = 1.207345	res = 3.447E-04
[  NORMAL ]  Iteration 198:	k_eff = 1.207740	res = 3.363E-04
[  NORMAL ]  Iteration 199:	k_eff = 1.208127	res = 3.281E-04
[  NORMAL ]  Iteration 200:	k_eff = 1.208503	res = 3.198E-04
[  NORMAL ]  Iteration 201:	k_eff = 1.208871	res = 3.119E-04
[  NORMAL ]  Iteration 202:	k_eff = 1.209230	res = 3.041E-04
[  NORMAL ]  Iteration 203:	k_eff = 1.209580	res = 2.968E-04
[  NORMAL ]  Iteration 204:	k_eff = 1.209921	res = 2.897E-04
[  NORMAL ]  Iteration 205:	k_eff = 1.210255	res = 2.824E-04
[  NORMAL ]  Iteration 206:	k_eff = 1.210580	res = 2.759E-04
[  NORMAL ]  Iteration 207:	k_eff = 1.210898	res = 2.688E-04
[  NORMAL ]  Iteration 208:	k_eff = 1.211208	res = 2.622E-04
[  NORMAL ]  Iteration 209:	k_eff = 1.211510	res = 2.563E-04
[  NORMAL ]  Iteration 210:	k_eff = 1.211804	res = 2.495E-04
[  NORMAL ]  Iteration 211:	k_eff = 1.212092	res = 2.428E-04
[  NORMAL ]  Iteration 212:	k_eff = 1.212373	res = 2.374E-04
[  NORMAL ]  Iteration 213:	k_eff = 1.212647	res = 2.318E-04
[  NORMAL ]  Iteration 214:	k_eff = 1.212914	res = 2.258E-04
[  NORMAL ]  Iteration 215:	k_eff = 1.213175	res = 2.200E-04
[  NORMAL ]  Iteration 216:	k_eff = 1.213429	res = 2.153E-04
[  NORMAL ]  Iteration 217:	k_eff = 1.213678	res = 2.097E-04
[  NORMAL ]  Iteration 218:	k_eff = 1.213920	res = 2.049E-04
[  NORMAL ]  Iteration 219:	k_eff = 1.214156	res = 1.996E-04
[  NORMAL ]  Iteration 220:	k_eff = 1.214387	res = 1.945E-04
[  NORMAL ]  Iteration 221:	k_eff = 1.214612	res = 1.904E-04
[  NORMAL ]  Iteration 222:	k_eff = 1.214832	res = 1.853E-04
[  NORMAL ]  Iteration 223:	k_eff = 1.215046	res = 1.806E-04
[  NORMAL ]  Iteration 224:	k_eff = 1.215255	res = 1.762E-04
[  NORMAL ]  Iteration 225:	k_eff = 1.215459	res = 1.722E-04
[  NORMAL ]  Iteration 226:	k_eff = 1.215658	res = 1.676E-04
[  NORMAL ]  Iteration 227:	k_eff = 1.215852	res = 1.637E-04
[  NORMAL ]  Iteration 228:	k_eff = 1.216041	res = 1.597E-04
[  NORMAL ]  Iteration 229:	k_eff = 1.216226	res = 1.557E-04
[  NORMAL ]  Iteration 230:	k_eff = 1.216407	res = 1.520E-04
[  NORMAL ]  Iteration 231:	k_eff = 1.216582	res = 1.483E-04
[  NORMAL ]  Iteration 232:	k_eff = 1.216754	res = 1.444E-04
[  NORMAL ]  Iteration 233:	k_eff = 1.216921	res = 1.409E-04
[  NORMAL ]  Iteration 234:	k_eff = 1.217084	res = 1.376E-04
[  NORMAL ]  Iteration 235:	k_eff = 1.217244	res = 1.344E-04
[  NORMAL ]  Iteration 236:	k_eff = 1.217399	res = 1.309E-04
[  NORMAL ]  Iteration 237:	k_eff = 1.217551	res = 1.274E-04
[  NORMAL ]  Iteration 238:	k_eff = 1.217699	res = 1.247E-04
[  NORMAL ]  Iteration 239:	k_eff = 1.217843	res = 1.216E-04
[  NORMAL ]  Iteration 240:	k_eff = 1.217983	res = 1.184E-04
[  NORMAL ]  Iteration 241:	k_eff = 1.218121	res = 1.154E-04
[  NORMAL ]  Iteration 242:	k_eff = 1.218255	res = 1.131E-04
[  NORMAL ]  Iteration 243:	k_eff = 1.218386	res = 1.101E-04
[  NORMAL ]  Iteration 244:	k_eff = 1.218514	res = 1.075E-04
[  NORMAL ]  Iteration 245:	k_eff = 1.218639	res = 1.048E-04
[  NORMAL ]  Iteration 246:	k_eff = 1.218760	res = 1.024E-04
[  NORMAL ]  Iteration 247:	k_eff = 1.218879	res = 9.989E-05
[  NORMAL ]  Iteration 248:	k_eff = 1.218994	res = 9.739E-05
[  NORMAL ]  Iteration 249:	k_eff = 1.219107	res = 9.487E-05
[  NORMAL ]  Iteration 250:	k_eff = 1.219217	res = 9.257E-05
[  NORMAL ]  Iteration 251:	k_eff = 1.219324	res = 9.035E-05
[  NORMAL ]  Iteration 252:	k_eff = 1.219429	res = 8.803E-05
[  NORMAL ]  Iteration 253:	k_eff = 1.219531	res = 8.599E-05
[  NORMAL ]  Iteration 254:	k_eff = 1.219631	res = 8.364E-05
[  NORMAL ]  Iteration 255:	k_eff = 1.219728	res = 8.175E-05
[  NORMAL ]  Iteration 256:	k_eff = 1.219823	res = 7.971E-05
[  NORMAL ]  Iteration 257:	k_eff = 1.219916	res = 7.776E-05
[  NORMAL ]  Iteration 258:	k_eff = 1.220006	res = 7.582E-05
[  NORMAL ]  Iteration 259:	k_eff = 1.220094	res = 7.438E-05
[  NORMAL ]  Iteration 260:	k_eff = 1.220181	res = 7.227E-05
[  NORMAL ]  Iteration 261:	k_eff = 1.220264	res = 7.058E-05
[  NORMAL ]  Iteration 262:	k_eff = 1.220346	res = 6.872E-05
[  NORMAL ]  Iteration 263:	k_eff = 1.220426	res = 6.695E-05
[  NORMAL ]  Iteration 264:	k_eff = 1.220504	res = 6.549E-05
[  NORMAL ]  Iteration 265:	k_eff = 1.220580	res = 6.375E-05
[  NORMAL ]  Iteration 266:	k_eff = 1.220654	res = 6.240E-05
[  NORMAL ]  Iteration 267:	k_eff = 1.220726	res = 6.073E-05
[  NORMAL ]  Iteration 268:	k_eff = 1.220797	res = 5.942E-05
[  NORMAL ]  Iteration 269:	k_eff = 1.220866	res = 5.792E-05
[  NORMAL ]  Iteration 270:	k_eff = 1.220933	res = 5.661E-05
[  NORMAL ]  Iteration 271:	k_eff = 1.220999	res = 5.501E-05
[  NORMAL ]  Iteration 272:	k_eff = 1.221063	res = 5.368E-05
[  NORMAL ]  Iteration 273:	k_eff = 1.221125	res = 5.286E-05
[  NORMAL ]  Iteration 274:	k_eff = 1.221187	res = 5.103E-05
[  NORMAL ]  Iteration 275:	k_eff = 1.221246	res = 5.013E-05
[  NORMAL ]  Iteration 276:	k_eff = 1.221304	res = 4.861E-05
[  NORMAL ]  Iteration 277:	k_eff = 1.221360	res = 4.737E-05
[  NORMAL ]  Iteration 278:	k_eff = 1.221416	res = 4.629E-05
[  NORMAL ]  Iteration 279:	k_eff = 1.221470	res = 4.515E-05
[  NORMAL ]  Iteration 280:	k_eff = 1.221522	res = 4.417E-05
[  NORMAL ]  Iteration 281:	k_eff = 1.221574	res = 4.309E-05
[  NORMAL ]  Iteration 282:	k_eff = 1.221624	res = 4.219E-05
[  NORMAL ]  Iteration 283:	k_eff = 1.221673	res = 4.099E-05
[  NORMAL ]  Iteration 284:	k_eff = 1.221721	res = 3.998E-05
[  NORMAL ]  Iteration 285:	k_eff = 1.221767	res = 3.891E-05
[  NORMAL ]  Iteration 286:	k_eff = 1.221812	res = 3.781E-05
[  NORMAL ]  Iteration 287:	k_eff = 1.221857	res = 3.698E-05
[  NORMAL ]  Iteration 288:	k_eff = 1.221900	res = 3.633E-05
[  NORMAL ]  Iteration 289:	k_eff = 1.221942	res = 3.535E-05
[  NORMAL ]  Iteration 290:	k_eff = 1.221983	res = 3.445E-05
[  NORMAL ]  Iteration 291:	k_eff = 1.222023	res = 3.355E-05
[  NORMAL ]  Iteration 292:	k_eff = 1.222062	res = 3.281E-05
[  NORMAL ]  Iteration 293:	k_eff = 1.222100	res = 3.203E-05
[  NORMAL ]  Iteration 294:	k_eff = 1.222138	res = 3.108E-05
[  NORMAL ]  Iteration 295:	k_eff = 1.222174	res = 3.049E-05
[  NORMAL ]  Iteration 296:	k_eff = 1.222209	res = 2.969E-05
[  NORMAL ]  Iteration 297:	k_eff = 1.222244	res = 2.902E-05
[  NORMAL ]  Iteration 298:	k_eff = 1.222278	res = 2.820E-05
[  NORMAL ]  Iteration 299:	k_eff = 1.222310	res = 2.747E-05
[  NORMAL ]  Iteration 300:	k_eff = 1.222342	res = 2.679E-05
[  NORMAL ]  Iteration 301:	k_eff = 1.222374	res = 2.626E-05
[  NORMAL ]  Iteration 302:	k_eff = 1.222404	res = 2.554E-05
[  NORMAL ]  Iteration 303:	k_eff = 1.222434	res = 2.483E-05
[  NORMAL ]  Iteration 304:	k_eff = 1.222463	res = 2.432E-05
[  NORMAL ]  Iteration 305:	k_eff = 1.222492	res = 2.387E-05
[  NORMAL ]  Iteration 306:	k_eff = 1.222519	res = 2.316E-05
[  NORMAL ]  Iteration 307:	k_eff = 1.222546	res = 2.274E-05
[  NORMAL ]  Iteration 308:	k_eff = 1.222573	res = 2.220E-05
[  NORMAL ]  Iteration 309:	k_eff = 1.222599	res = 2.168E-05
[  NORMAL ]  Iteration 310:	k_eff = 1.222624	res = 2.107E-05
[  NORMAL ]  Iteration 311:	k_eff = 1.222648	res = 2.062E-05
[  NORMAL ]  Iteration 312:	k_eff = 1.222672	res = 2.005E-05
[  NORMAL ]  Iteration 313:	k_eff = 1.222696	res = 1.959E-05
[  NORMAL ]  Iteration 314:	k_eff = 1.222718	res = 1.898E-05
[  NORMAL ]  Iteration 315:	k_eff = 1.222740	res = 1.841E-05
[  NORMAL ]  Iteration 316:	k_eff = 1.222762	res = 1.808E-05
[  NORMAL ]  Iteration 317:	k_eff = 1.222783	res = 1.765E-05
[  NORMAL ]  Iteration 318:	k_eff = 1.222803	res = 1.713E-05
[  NORMAL ]  Iteration 319:	k_eff = 1.222823	res = 1.674E-05
[  NORMAL ]  Iteration 320:	k_eff = 1.222843	res = 1.638E-05
[  NORMAL ]  Iteration 321:	k_eff = 1.222862	res = 1.593E-05
[  NORMAL ]  Iteration 322:	k_eff = 1.222880	res = 1.546E-05
[  NORMAL ]  Iteration 323:	k_eff = 1.222898	res = 1.519E-05
[  NORMAL ]  Iteration 324:	k_eff = 1.222916	res = 1.487E-05
[  NORMAL ]  Iteration 325:	k_eff = 1.222933	res = 1.446E-05
[  NORMAL ]  Iteration 326:	k_eff = 1.222950	res = 1.403E-05
[  NORMAL ]  Iteration 327:	k_eff = 1.222967	res = 1.379E-05
[  NORMAL ]  Iteration 328:	k_eff = 1.222982	res = 1.342E-05
[  NORMAL ]  Iteration 329:	k_eff = 1.222998	res = 1.298E-05
[  NORMAL ]  Iteration 330:	k_eff = 1.223013	res = 1.278E-05
[  NORMAL ]  Iteration 331:	k_eff = 1.223028	res = 1.236E-05
[  NORMAL ]  Iteration 332:	k_eff = 1.223043	res = 1.227E-05
[  NORMAL ]  Iteration 333:	k_eff = 1.223057	res = 1.177E-05
[  NORMAL ]  Iteration 334:	k_eff = 1.223070	res = 1.146E-05
[  NORMAL ]  Iteration 335:	k_eff = 1.223084	res = 1.122E-05
[  NORMAL ]  Iteration 336:	k_eff = 1.223097	res = 1.105E-05
[  NORMAL ]  Iteration 337:	k_eff = 1.223110	res = 1.063E-05
[  NORMAL ]  Iteration 338:	k_eff = 1.223122	res = 1.054E-05
[  NORMAL ]  Iteration 339:	k_eff = 1.223134	res = 1.015E-05
[  NORMAL ]  Iteration 340:	k_eff = 1.223146	res = 1.005E-05

In [29]:
# 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.223146
bias [pcm]: -133.8

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 [30]:
# 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/wbinventor/Documents/NSE-CRPG-Codes/openmc/openmc/tallies.py:1835: RuntimeWarning: invalid value encountered in true_divide
  self_rel_err = data['self']['std. dev.'] / data['self']['mean']
Out[30]:
(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 [31]:
# 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 [32]:
# 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()