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. In order to run this Notebook in its entirety, you must have OpenMOC installed on your system, along with OpenCG to convert the OpenMC geometries into OpenMOC geometries. 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
import seaborn as sns

import openmoc
from openmoc.opencg_compatible import get_openmoc_geometry

import openmc
import openmc.mgxs as mgxs
import openmc.data

%matplotlib inline


/usr/lib/python3.5/site-packages/matplotlib/__init__.py:1357: 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()

# 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.NuFissionXS(groups=fine_groups)
    xs_library[cell.id]['nu-scatter'] = mgxs.NuScatterMatrixXS(groups=fine_groups)
    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(output=True)


                               %%%%%%%%%%%%%%%
                          %%%%%%%%%%%%%%%%%%%%%%%%
                       %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
                     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
                   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
                  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
                                   %%%%%%%%%%%%%%%%%%%%%%%%
                                    %%%%%%%%%%%%%%%%%%%%%%%%
                ###############      %%%%%%%%%%%%%%%%%%%%%%%%
               ##################     %%%%%%%%%%%%%%%%%%%%%%%
               ###################     %%%%%%%%%%%%%%%%%%%%%%%
               ####################     %%%%%%%%%%%%%%%%%%%%%%
               #####################     %%%%%%%%%%%%%%%%%%%%%
               ######################     %%%%%%%%%%%%%%%%%%%%
               #######################     %%%%%%%%%%%%%%%%%%
                #######################     %%%%%%%%%%%%%%%%%
                ######################     %%%%%%%%%%%%%%%%%
                 ####################     %%%%%%%%%%%%%%%%%
                   #################     %%%%%%%%%%%%%%%%%
                    ###############     %%%%%%%%%%%%%%%%
                      ############     %%%%%%%%%%%%%%%
                         ########     %%%%%%%%%%%%%%
                                     %%%%%%%%%%%

                   | The OpenMC Monte Carlo Code
         Copyright | 2011-2016 Massachusetts Institute of Technology
           License | http://openmc.readthedocs.io/en/latest/license.html
           Version | 0.8.0
          Git SHA1 | d2979851f07f4162f0f02d95a847019bf9f2068d
         Date/Time | 2016-11-30 19:38:02
    OpenMP Threads | 8

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

 Reading settings XML file...
 Reading geometry XML file...
 Reading materials XML file...
 Reading cross sections XML file...
 Reading U235 from /opt/xsdata/nndc/U235.h5
 Reading U238 from /opt/xsdata/nndc/U238.h5
 Reading O16 from /opt/xsdata/nndc/O16.h5
 Reading H1 from /opt/xsdata/nndc/H1.h5
 Reading Zr90 from /opt/xsdata/nndc/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.24309                       
        4/1    1.22833                       
        5/1    1.21786                       
        6/1    1.22005                       
        7/1    1.20894                       
        8/1    1.22071                       
        9/1    1.21279                       
       10/1    1.22198                       
       11/1    1.22287                       
       12/1    1.25490    1.23888 +/- 0.01602
       13/1    1.20224    1.22667 +/- 0.01532
       14/1    1.23375    1.22844 +/- 0.01098
       15/1    1.23068    1.22889 +/- 0.00851
       16/1    1.23073    1.22920 +/- 0.00696
       17/1    1.25364    1.23269 +/- 0.00684
       18/1    1.20820    1.22963 +/- 0.00667
       19/1    1.23138    1.22982 +/- 0.00588
       20/1    1.20682    1.22752 +/- 0.00574
       21/1    1.23580    1.22827 +/- 0.00525
       22/1    1.24190    1.22941 +/- 0.00492
       23/1    1.23125    1.22955 +/- 0.00453
       24/1    1.21606    1.22859 +/- 0.00430
       25/1    1.23653    1.22912 +/- 0.00404
       26/1    1.23850    1.22970 +/- 0.00383
       27/1    1.20986    1.22853 +/- 0.00378
       28/1    1.25277    1.22988 +/- 0.00381
       29/1    1.23334    1.23006 +/- 0.00361
       30/1    1.24345    1.23073 +/- 0.00349
       31/1    1.21565    1.23001 +/- 0.00339
       32/1    1.20555    1.22890 +/- 0.00342
       33/1    1.22995    1.22895 +/- 0.00327
       34/1    1.19763    1.22764 +/- 0.00339
       35/1    1.22645    1.22760 +/- 0.00325
       36/1    1.23900    1.22803 +/- 0.00316
       37/1    1.24305    1.22859 +/- 0.00309
       38/1    1.22484    1.22846 +/- 0.00298
       39/1    1.20986    1.22782 +/- 0.00294
       40/1    1.23764    1.22814 +/- 0.00286
       41/1    1.20476    1.22739 +/- 0.00287
       42/1    1.21652    1.22705 +/- 0.00280
       43/1    1.21279    1.22662 +/- 0.00275
       44/1    1.20210    1.22590 +/- 0.00276
       45/1    1.22644    1.22591 +/- 0.00268
       46/1    1.22907    1.22600 +/- 0.00261
       47/1    1.24057    1.22639 +/- 0.00257
       48/1    1.21610    1.22612 +/- 0.00251
       49/1    1.22199    1.22602 +/- 0.00245
       50/1    1.20860    1.22558 +/- 0.00243
 Triggers unsatisfied, max unc./thresh. is 1.25496 for flux in tally 10057
 The estimated number of batches is 73
 Creating state point statepoint.050.h5...
       51/1    1.21850    1.22541 +/- 0.00237
       52/1    1.22833    1.22548 +/- 0.00232
       53/1    1.20239    1.22494 +/- 0.00233
       54/1    1.24876    1.22548 +/- 0.00234
       55/1    1.20670    1.22506 +/- 0.00232
       56/1    1.24260    1.22545 +/- 0.00230
       57/1    1.21039    1.22512 +/- 0.00228
       58/1    1.23929    1.22542 +/- 0.00225
       59/1    1.21357    1.22518 +/- 0.00221
       60/1    1.23456    1.22537 +/- 0.00218
       61/1    1.23963    1.22565 +/- 0.00215
       62/1    1.24020    1.22593 +/- 0.00213
       63/1    1.22325    1.22587 +/- 0.00209
       64/1    1.22070    1.22578 +/- 0.00205
       65/1    1.22423    1.22575 +/- 0.00201
       66/1    1.22973    1.22582 +/- 0.00198
       67/1    1.21842    1.22569 +/- 0.00195
       68/1    1.19552    1.22517 +/- 0.00198
       69/1    1.21475    1.22500 +/- 0.00196
       70/1    1.21888    1.22489 +/- 0.00193
       71/1    1.19720    1.22444 +/- 0.00195
       72/1    1.23770    1.22465 +/- 0.00193
       73/1    1.23894    1.22488 +/- 0.00191
 Triggers unsatisfied, max unc./thresh. is 1.00243 for flux in tally 10057
 The estimated number of batches is 74
       74/1    1.22437    1.22487 +/- 0.00188
 Triggers satisfied for batch 74
 Creating state point statepoint.074.h5...

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


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

 Total time for initialization     =  3.0758E-01 seconds
   Reading cross sections          =  2.2344E-01 seconds
 Total time in simulation          =  2.7832E+01 seconds
   Time in transport only          =  2.7708E+01 seconds
   Time in inactive batches        =  1.7095E+00 seconds
   Time in active batches          =  2.6122E+01 seconds
   Time synchronizing fission bank =  1.4982E-02 seconds
     Sampling source sites         =  1.0718E-02 seconds
     SEND/RECV source sites        =  4.2104E-03 seconds
   Time accumulating tallies       =  4.1146E-04 seconds
 Total time for finalization       =  1.5648E-02 seconds
 Total time elapsed                =  2.8184E+01 seconds
 Calculation Rate (inactive)       =  58495.1 neutrons/second
 Calculation Rate (active)         =  15312.7 neutrons/second

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

 k-effective (Collision)     =  1.22358 +/-  0.00179
 k-effective (Track-length)  =  1.22487 +/-  0.00188
 k-effective (Absorption)    =  1.22300 +/-  0.00114
 Combined k-effective        =  1.22347 +/-  0.00106
 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.074.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.19e-01%
            Group 2 [5530.0     - 821000.0  eV]:	3.96e+00 +/- 1.32e-01%
            Group 3 [4.0        - 5530.0    eV]:	5.52e+01 +/- 2.31e-01%
            Group 4 [0.625      - 4.0       eV]:	8.83e+01 +/- 2.96e-01%
            Group 5 [0.28       - 0.625     eV]:	2.90e+02 +/- 4.64e-01%
            Group 6 [0.14       - 0.28      eV]:	4.49e+02 +/- 4.22e-01%
            Group 7 [0.058      - 0.14      eV]:	6.87e+02 +/- 2.97e-01%
            Group 8 [0.0        - 0.058     eV]:	1.44e+03 +/- 2.91e-01%

	Nuclide        =	U238
	Cross Sections [barns]:
            Group 1 [821000.0   - 20000000.0eV]:	1.06e+00 +/- 2.56e-01%
            Group 2 [5530.0     - 821000.0  eV]:	1.21e-03 +/- 2.55e-01%
            Group 3 [4.0        - 5530.0    eV]:	5.77e-04 +/- 3.67e+00%
            Group 4 [0.625      - 4.0       eV]:	6.54e-06 +/- 2.74e-01%
            Group 5 [0.28       - 0.625     eV]:	1.07e-05 +/- 4.55e-01%
            Group 6 [0.14       - 0.28      eV]:	1.55e-05 +/- 4.25e-01%
            Group 7 [0.058      - 0.14      eV]:	2.30e-05 +/- 2.97e-01%
            Group 8 [0.0        - 0.058     eV]:	4.24e-05 +/- 2.90e-01%



/home/nelsonag/git/openmc/openmc/tallies.py:1974: 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.44e-01%
            Group 2 [5530.0     - 821000.0  eV]:	1.51e-03 +/- 1.30e-01%
            Group 3 [4.0        - 5530.0    eV]:	2.07e-02 +/- 2.31e-01%
            Group 4 [0.625      - 4.0       eV]:	3.31e-02 +/- 2.96e-01%
            Group 5 [0.28       - 0.625     eV]:	1.09e-01 +/- 4.64e-01%
            Group 6 [0.14       - 0.28      eV]:	1.69e-01 +/- 4.22e-01%
            Group 7 [0.058      - 0.14      eV]:	2.58e-01 +/- 2.97e-01%
            Group 8 [0.0        - 0.058     eV]:	5.40e-01 +/- 2.91e-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/nelsonag/git/openmc/openmc/tallies.py:1974: RuntimeWarning: invalid value encountered in true_divide
  self_rel_err = data['self']['std. dev.'] / data['self']['mean']
/usr/lib/python3.5/site-packages/numpy/lib/shape_base.py:873: VisibleDeprecationWarning: using a non-integer number instead of an integer will result in an error in the future
  return c.reshape(shape_out)
Out[19]:
cell group in group out nuclide mean std. dev.
126 10002 1 1 H1 0.234115 0.003568
127 10002 1 1 O16 1.563707 0.005953
124 10002 1 2 H1 1.594129 0.002369
125 10002 1 2 O16 0.285761 0.001676
122 10002 1 3 H1 0.011089 0.000248
123 10002 1 3 O16 0.000000 0.000000
120 10002 1 4 H1 0.000000 0.000000
121 10002 1 4 O16 0.000000 0.000000
118 10002 1 5 H1 0.000000 0.000000
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.73e-03 +/- 5.06e-01%
            Group 2 [0.0        - 0.625     eV]:	1.82e-01 +/- 2.05e-01%

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

	Nuclide        =	O16
	Cross Sections [cm^-1]:
            Group 1 [0.625      - 20000000.0eV]:	1.46e-01 +/- 1.60e-01%
            Group 2 [0.0        - 0.625     eV]:	1.75e-01 +/- 2.94e-01%




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


/usr/lib/python3.5/site-packages/numpy/lib/shape_base.py:873: VisibleDeprecationWarning: using a non-integer number instead of an integer will result in an error in the future
  return c.reshape(shape_out)
Out[22]:
cell group in nuclide mean std. dev.
3 10000 1 U235 20.611692 0.104237
4 10000 1 U238 9.585358 0.013808
5 10000 1 O16 3.164190 0.005049
0 10000 2 U235 485.413426 0.996410
1 10000 2 U238 11.190386 0.028731
2 10000 2 O16 3.794859 0.011139

Verification with OpenMOC

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


In [23]:
# Create an OpenMOC Geometry from the OpenCG Geometry
openmoc_geometry = get_openmoc_geometry(sp.summary.opencg_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/nelsonag/git/openmc/openmc/tallies.py:1974: RuntimeWarning: invalid value encountered in true_divide
  self_rel_err = data['self']['std. dev.'] / data['self']['mean']
/home/nelsonag/git/openmc/openmc/tallies.py:1975: RuntimeWarning: invalid value encountered in true_divide
  other_rel_err = data['other']['std. dev.'] / data['other']['mean']
/home/nelsonag/git/openmc/openmc/tallies.py:1976: 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.423123	res = 0.000E+00
[  NORMAL ]  Iteration 1:	k_eff = 0.475922	res = 5.769E-01
[  NORMAL ]  Iteration 2:	k_eff = 0.491444	res = 1.248E-01
[  NORMAL ]  Iteration 3:	k_eff = 0.487441	res = 3.261E-02
[  NORMAL ]  Iteration 4:	k_eff = 0.483949	res = 8.144E-03
[  NORMAL ]  Iteration 5:	k_eff = 0.477326	res = 7.164E-03
[  NORMAL ]  Iteration 6:	k_eff = 0.469012	res = 1.369E-02
[  NORMAL ]  Iteration 7:	k_eff = 0.460422	res = 1.742E-02
[  NORMAL ]  Iteration 8:	k_eff = 0.450721	res = 1.832E-02
[  NORMAL ]  Iteration 9:	k_eff = 0.441532	res = 2.107E-02
[  NORMAL ]  Iteration 10:	k_eff = 0.432168	res = 2.039E-02
[  NORMAL ]  Iteration 11:	k_eff = 0.423131	res = 2.121E-02
[  NORMAL ]  Iteration 12:	k_eff = 0.414705	res = 2.091E-02
[  NORMAL ]  Iteration 13:	k_eff = 0.406943	res = 1.991E-02
[  NORMAL ]  Iteration 14:	k_eff = 0.399627	res = 1.872E-02
[  NORMAL ]  Iteration 15:	k_eff = 0.393329	res = 1.798E-02
[  NORMAL ]  Iteration 16:	k_eff = 0.387699	res = 1.576E-02
[  NORMAL ]  Iteration 17:	k_eff = 0.382949	res = 1.431E-02
[  NORMAL ]  Iteration 18:	k_eff = 0.379028	res = 1.225E-02
[  NORMAL ]  Iteration 19:	k_eff = 0.375935	res = 1.024E-02
[  NORMAL ]  Iteration 20:	k_eff = 0.373785	res = 8.161E-03
[  NORMAL ]  Iteration 21:	k_eff = 0.372655	res = 5.719E-03
[  NORMAL ]  Iteration 22:	k_eff = 0.372273	res = 3.023E-03
[  NORMAL ]  Iteration 23:	k_eff = 0.372879	res = 1.024E-03
[  NORMAL ]  Iteration 24:	k_eff = 0.374353	res = 1.629E-03
[  NORMAL ]  Iteration 25:	k_eff = 0.376678	res = 3.952E-03
[  NORMAL ]  Iteration 26:	k_eff = 0.379854	res = 6.211E-03
[  NORMAL ]  Iteration 27:	k_eff = 0.383870	res = 8.433E-03
[  NORMAL ]  Iteration 28:	k_eff = 0.388664	res = 1.057E-02
[  NORMAL ]  Iteration 29:	k_eff = 0.394216	res = 1.249E-02
[  NORMAL ]  Iteration 30:	k_eff = 0.400506	res = 1.429E-02
[  NORMAL ]  Iteration 31:	k_eff = 0.407502	res = 1.596E-02
[  NORMAL ]  Iteration 32:	k_eff = 0.415145	res = 1.747E-02
[  NORMAL ]  Iteration 33:	k_eff = 0.423426	res = 1.876E-02
[  NORMAL ]  Iteration 34:	k_eff = 0.432299	res = 1.995E-02
[  NORMAL ]  Iteration 35:	k_eff = 0.441713	res = 2.095E-02
[  NORMAL ]  Iteration 36:	k_eff = 0.451665	res = 2.178E-02
[  NORMAL ]  Iteration 37:	k_eff = 0.462081	res = 2.253E-02
[  NORMAL ]  Iteration 38:	k_eff = 0.472952	res = 2.306E-02
[  NORMAL ]  Iteration 39:	k_eff = 0.484221	res = 2.352E-02
[  NORMAL ]  Iteration 40:	k_eff = 0.495862	res = 2.383E-02
[  NORMAL ]  Iteration 41:	k_eff = 0.507836	res = 2.404E-02
[  NORMAL ]  Iteration 42:	k_eff = 0.520110	res = 2.415E-02
[  NORMAL ]  Iteration 43:	k_eff = 0.532648	res = 2.417E-02
[  NORMAL ]  Iteration 44:	k_eff = 0.545419	res = 2.411E-02
[  NORMAL ]  Iteration 45:	k_eff = 0.558389	res = 2.398E-02
[  NORMAL ]  Iteration 46:	k_eff = 0.571526	res = 2.378E-02
[  NORMAL ]  Iteration 47:	k_eff = 0.584803	res = 2.353E-02
[  NORMAL ]  Iteration 48:	k_eff = 0.598190	res = 2.323E-02
[  NORMAL ]  Iteration 49:	k_eff = 0.611658	res = 2.289E-02
[  NORMAL ]  Iteration 50:	k_eff = 0.625182	res = 2.252E-02
[  NORMAL ]  Iteration 51:	k_eff = 0.638739	res = 2.211E-02
[  NORMAL ]  Iteration 52:	k_eff = 0.652303	res = 2.168E-02
[  NORMAL ]  Iteration 53:	k_eff = 0.665851	res = 2.124E-02
[  NORMAL ]  Iteration 54:	k_eff = 0.679365	res = 2.077E-02
[  NORMAL ]  Iteration 55:	k_eff = 0.692822	res = 2.030E-02
[  NORMAL ]  Iteration 56:	k_eff = 0.706205	res = 1.981E-02
[  NORMAL ]  Iteration 57:	k_eff = 0.719497	res = 1.932E-02
[  NORMAL ]  Iteration 58:	k_eff = 0.732680	res = 1.882E-02
[  NORMAL ]  Iteration 59:	k_eff = 0.745741	res = 1.832E-02
[  NORMAL ]  Iteration 60:	k_eff = 0.758665	res = 1.783E-02
[  NORMAL ]  Iteration 61:	k_eff = 0.771440	res = 1.733E-02
[  NORMAL ]  Iteration 62:	k_eff = 0.784054	res = 1.684E-02
[  NORMAL ]  Iteration 63:	k_eff = 0.796496	res = 1.635E-02
[  NORMAL ]  Iteration 64:	k_eff = 0.808757	res = 1.587E-02
[  NORMAL ]  Iteration 65:	k_eff = 0.820828	res = 1.539E-02
[  NORMAL ]  Iteration 66:	k_eff = 0.832701	res = 1.493E-02
[  NORMAL ]  Iteration 67:	k_eff = 0.844370	res = 1.446E-02
[  NORMAL ]  Iteration 68:	k_eff = 0.855828	res = 1.401E-02
[  NORMAL ]  Iteration 69:	k_eff = 0.867071	res = 1.357E-02
[  NORMAL ]  Iteration 70:	k_eff = 0.878094	res = 1.314E-02
[  NORMAL ]  Iteration 71:	k_eff = 0.888893	res = 1.271E-02
[  NORMAL ]  Iteration 72:	k_eff = 0.899465	res = 1.230E-02
[  NORMAL ]  Iteration 73:	k_eff = 0.909808	res = 1.189E-02
[  NORMAL ]  Iteration 74:	k_eff = 0.919919	res = 1.150E-02
[  NORMAL ]  Iteration 75:	k_eff = 0.929799	res = 1.111E-02
[  NORMAL ]  Iteration 76:	k_eff = 0.939445	res = 1.074E-02
[  NORMAL ]  Iteration 77:	k_eff = 0.948857	res = 1.037E-02
[  NORMAL ]  Iteration 78:	k_eff = 0.958037	res = 1.002E-02
[  NORMAL ]  Iteration 79:	k_eff = 0.966984	res = 9.675E-03
[  NORMAL ]  Iteration 80:	k_eff = 0.975699	res = 9.339E-03
[  NORMAL ]  Iteration 81:	k_eff = 0.984185	res = 9.012E-03
[  NORMAL ]  Iteration 82:	k_eff = 0.992442	res = 8.697E-03
[  NORMAL ]  Iteration 83:	k_eff = 1.000473	res = 8.390E-03
[  NORMAL ]  Iteration 84:	k_eff = 1.008281	res = 8.092E-03
[  NORMAL ]  Iteration 85:	k_eff = 1.015867	res = 7.804E-03
[  NORMAL ]  Iteration 86:	k_eff = 1.023234	res = 7.524E-03
[  NORMAL ]  Iteration 87:	k_eff = 1.030387	res = 7.253E-03
[  NORMAL ]  Iteration 88:	k_eff = 1.037327	res = 6.990E-03
[  NORMAL ]  Iteration 89:	k_eff = 1.044059	res = 6.736E-03
[  NORMAL ]  Iteration 90:	k_eff = 1.050586	res = 6.489E-03
[  NORMAL ]  Iteration 91:	k_eff = 1.056911	res = 6.251E-03
[  NORMAL ]  Iteration 92:	k_eff = 1.063039	res = 6.021E-03
[  NORMAL ]  Iteration 93:	k_eff = 1.068972	res = 5.798E-03
[  NORMAL ]  Iteration 94:	k_eff = 1.074717	res = 5.582E-03
[  NORMAL ]  Iteration 95:	k_eff = 1.080275	res = 5.373E-03
[  NORMAL ]  Iteration 96:	k_eff = 1.085652	res = 5.172E-03
[  NORMAL ]  Iteration 97:	k_eff = 1.090851	res = 4.977E-03
[  NORMAL ]  Iteration 98:	k_eff = 1.095877	res = 4.789E-03
[  NORMAL ]  Iteration 99:	k_eff = 1.100733	res = 4.607E-03
[  NORMAL ]  Iteration 100:	k_eff = 1.105424	res = 4.432E-03
[  NORMAL ]  Iteration 101:	k_eff = 1.109955	res = 4.262E-03
[  NORMAL ]  Iteration 102:	k_eff = 1.114329	res = 4.098E-03
[  NORMAL ]  Iteration 103:	k_eff = 1.118550	res = 3.941E-03
[  NORMAL ]  Iteration 104:	k_eff = 1.122623	res = 3.789E-03
[  NORMAL ]  Iteration 105:	k_eff = 1.126552	res = 3.641E-03
[  NORMAL ]  Iteration 106:	k_eff = 1.130340	res = 3.499E-03
[  NORMAL ]  Iteration 107:	k_eff = 1.133992	res = 3.362E-03
[  NORMAL ]  Iteration 108:	k_eff = 1.137511	res = 3.231E-03
[  NORMAL ]  Iteration 109:	k_eff = 1.140902	res = 3.103E-03
[  NORMAL ]  Iteration 110:	k_eff = 1.144169	res = 2.981E-03
[  NORMAL ]  Iteration 111:	k_eff = 1.147314	res = 2.863E-03
[  NORMAL ]  Iteration 112:	k_eff = 1.150342	res = 2.750E-03
[  NORMAL ]  Iteration 113:	k_eff = 1.153257	res = 2.639E-03
[  NORMAL ]  Iteration 114:	k_eff = 1.156062	res = 2.534E-03
[  NORMAL ]  Iteration 115:	k_eff = 1.158761	res = 2.432E-03
[  NORMAL ]  Iteration 116:	k_eff = 1.161357	res = 2.334E-03
[  NORMAL ]  Iteration 117:	k_eff = 1.163854	res = 2.240E-03
[  NORMAL ]  Iteration 118:	k_eff = 1.166253	res = 2.150E-03
[  NORMAL ]  Iteration 119:	k_eff = 1.168560	res = 2.062E-03
[  NORMAL ]  Iteration 120:	k_eff = 1.170777	res = 1.978E-03
[  NORMAL ]  Iteration 121:	k_eff = 1.172907	res = 1.897E-03
[  NORMAL ]  Iteration 122:	k_eff = 1.174953	res = 1.819E-03
[  NORMAL ]  Iteration 123:	k_eff = 1.176918	res = 1.745E-03
[  NORMAL ]  Iteration 124:	k_eff = 1.178805	res = 1.672E-03
[  NORMAL ]  Iteration 125:	k_eff = 1.180617	res = 1.603E-03
[  NORMAL ]  Iteration 126:	k_eff = 1.182356	res = 1.537E-03
[  NORMAL ]  Iteration 127:	k_eff = 1.184025	res = 1.473E-03
[  NORMAL ]  Iteration 128:	k_eff = 1.185626	res = 1.412E-03
[  NORMAL ]  Iteration 129:	k_eff = 1.187163	res = 1.352E-03
[  NORMAL ]  Iteration 130:	k_eff = 1.188637	res = 1.296E-03
[  NORMAL ]  Iteration 131:	k_eff = 1.190050	res = 1.241E-03
[  NORMAL ]  Iteration 132:	k_eff = 1.191406	res = 1.189E-03
[  NORMAL ]  Iteration 133:	k_eff = 1.192704	res = 1.139E-03
[  NORMAL ]  Iteration 134:	k_eff = 1.193949	res = 1.090E-03
[  NORMAL ]  Iteration 135:	k_eff = 1.195144	res = 1.044E-03
[  NORMAL ]  Iteration 136:	k_eff = 1.196287	res = 1.001E-03
[  NORMAL ]  Iteration 137:	k_eff = 1.197383	res = 9.567E-04
[  NORMAL ]  Iteration 138:	k_eff = 1.198433	res = 9.157E-04
[  NORMAL ]  Iteration 139:	k_eff = 1.199438	res = 8.775E-04
[  NORMAL ]  Iteration 140:	k_eff = 1.200401	res = 8.388E-04
[  NORMAL ]  Iteration 141:	k_eff = 1.201324	res = 8.030E-04
[  NORMAL ]  Iteration 142:	k_eff = 1.202206	res = 7.682E-04
[  NORMAL ]  Iteration 143:	k_eff = 1.203051	res = 7.348E-04
[  NORMAL ]  Iteration 144:	k_eff = 1.203860	res = 7.028E-04
[  NORMAL ]  Iteration 145:	k_eff = 1.204634	res = 6.722E-04
[  NORMAL ]  Iteration 146:	k_eff = 1.205375	res = 6.429E-04
[  NORMAL ]  Iteration 147:	k_eff = 1.206084	res = 6.153E-04
[  NORMAL ]  Iteration 148:	k_eff = 1.206762	res = 5.883E-04
[  NORMAL ]  Iteration 149:	k_eff = 1.207411	res = 5.617E-04
[  NORMAL ]  Iteration 150:	k_eff = 1.208031	res = 5.377E-04
[  NORMAL ]  Iteration 151:	k_eff = 1.208623	res = 5.137E-04
[  NORMAL ]  Iteration 152:	k_eff = 1.209191	res = 4.906E-04
[  NORMAL ]  Iteration 153:	k_eff = 1.209733	res = 4.694E-04
[  NORMAL ]  Iteration 154:	k_eff = 1.210251	res = 4.486E-04
[  NORMAL ]  Iteration 155:	k_eff = 1.210747	res = 4.280E-04
[  NORMAL ]  Iteration 156:	k_eff = 1.211220	res = 4.098E-04
[  NORMAL ]  Iteration 157:	k_eff = 1.211673	res = 3.908E-04
[  NORMAL ]  Iteration 158:	k_eff = 1.212105	res = 3.738E-04
[  NORMAL ]  Iteration 159:	k_eff = 1.212518	res = 3.567E-04
[  NORMAL ]  Iteration 160:	k_eff = 1.212913	res = 3.409E-04
[  NORMAL ]  Iteration 161:	k_eff = 1.213290	res = 3.260E-04
[  NORMAL ]  Iteration 162:	k_eff = 1.213650	res = 3.104E-04
[  NORMAL ]  Iteration 163:	k_eff = 1.213995	res = 2.965E-04
[  NORMAL ]  Iteration 164:	k_eff = 1.214322	res = 2.838E-04
[  NORMAL ]  Iteration 165:	k_eff = 1.214637	res = 2.701E-04
[  NORMAL ]  Iteration 166:	k_eff = 1.214937	res = 2.587E-04
[  NORMAL ]  Iteration 167:	k_eff = 1.215222	res = 2.469E-04
[  NORMAL ]  Iteration 168:	k_eff = 1.215494	res = 2.348E-04
[  NORMAL ]  Iteration 169:	k_eff = 1.215755	res = 2.242E-04
[  NORMAL ]  Iteration 170:	k_eff = 1.216004	res = 2.144E-04
[  NORMAL ]  Iteration 171:	k_eff = 1.216241	res = 2.048E-04
[  NORMAL ]  Iteration 172:	k_eff = 1.216467	res = 1.950E-04
[  NORMAL ]  Iteration 173:	k_eff = 1.216683	res = 1.857E-04
[  NORMAL ]  Iteration 174:	k_eff = 1.216889	res = 1.778E-04
[  NORMAL ]  Iteration 175:	k_eff = 1.217085	res = 1.696E-04
[  NORMAL ]  Iteration 176:	k_eff = 1.217273	res = 1.614E-04
[  NORMAL ]  Iteration 177:	k_eff = 1.217452	res = 1.543E-04
[  NORMAL ]  Iteration 178:	k_eff = 1.217623	res = 1.465E-04
[  NORMAL ]  Iteration 179:	k_eff = 1.217785	res = 1.405E-04
[  NORMAL ]  Iteration 180:	k_eff = 1.217940	res = 1.335E-04
[  NORMAL ]  Iteration 181:	k_eff = 1.218088	res = 1.269E-04
[  NORMAL ]  Iteration 182:	k_eff = 1.218229	res = 1.218E-04
[  NORMAL ]  Iteration 183:	k_eff = 1.218363	res = 1.157E-04
[  NORMAL ]  Iteration 184:	k_eff = 1.218492	res = 1.101E-04
[  NORMAL ]  Iteration 185:	k_eff = 1.218615	res = 1.056E-04
[  NORMAL ]  Iteration 186:	k_eff = 1.218731	res = 1.007E-04
[  NORMAL ]  Iteration 187:	k_eff = 1.218841	res = 9.536E-05
[  NORMAL ]  Iteration 188:	k_eff = 1.218947	res = 9.039E-05
[  NORMAL ]  Iteration 189:	k_eff = 1.219048	res = 8.671E-05
[  NORMAL ]  Iteration 190:	k_eff = 1.219144	res = 8.281E-05
[  NORMAL ]  Iteration 191:	k_eff = 1.219236	res = 7.903E-05
[  NORMAL ]  Iteration 192:	k_eff = 1.219323	res = 7.535E-05
[  NORMAL ]  Iteration 193:	k_eff = 1.219406	res = 7.153E-05
[  NORMAL ]  Iteration 194:	k_eff = 1.219485	res = 6.803E-05
[  NORMAL ]  Iteration 195:	k_eff = 1.219561	res = 6.458E-05
[  NORMAL ]  Iteration 196:	k_eff = 1.219633	res = 6.195E-05
[  NORMAL ]  Iteration 197:	k_eff = 1.219701	res = 5.920E-05
[  NORMAL ]  Iteration 198:	k_eff = 1.219766	res = 5.593E-05
[  NORMAL ]  Iteration 199:	k_eff = 1.219829	res = 5.350E-05
[  NORMAL ]  Iteration 200:	k_eff = 1.219887	res = 5.127E-05
[  NORMAL ]  Iteration 201:	k_eff = 1.219944	res = 4.821E-05
[  NORMAL ]  Iteration 202:	k_eff = 1.219998	res = 4.617E-05
[  NORMAL ]  Iteration 203:	k_eff = 1.220048	res = 4.406E-05
[  NORMAL ]  Iteration 204:	k_eff = 1.220097	res = 4.167E-05
[  NORMAL ]  Iteration 205:	k_eff = 1.220143	res = 4.017E-05
[  NORMAL ]  Iteration 206:	k_eff = 1.220188	res = 3.759E-05
[  NORMAL ]  Iteration 207:	k_eff = 1.220230	res = 3.628E-05
[  NORMAL ]  Iteration 208:	k_eff = 1.220270	res = 3.429E-05
[  NORMAL ]  Iteration 209:	k_eff = 1.220307	res = 3.268E-05
[  NORMAL ]  Iteration 210:	k_eff = 1.220343	res = 3.102E-05
[  NORMAL ]  Iteration 211:	k_eff = 1.220377	res = 2.945E-05
[  NORMAL ]  Iteration 212:	k_eff = 1.220410	res = 2.801E-05
[  NORMAL ]  Iteration 213:	k_eff = 1.220441	res = 2.693E-05
[  NORMAL ]  Iteration 214:	k_eff = 1.220470	res = 2.516E-05
[  NORMAL ]  Iteration 215:	k_eff = 1.220498	res = 2.414E-05
[  NORMAL ]  Iteration 216:	k_eff = 1.220525	res = 2.300E-05
[  NORMAL ]  Iteration 217:	k_eff = 1.220550	res = 2.205E-05
[  NORMAL ]  Iteration 218:	k_eff = 1.220575	res = 2.056E-05
[  NORMAL ]  Iteration 219:	k_eff = 1.220598	res = 2.005E-05
[  NORMAL ]  Iteration 220:	k_eff = 1.220620	res = 1.878E-05
[  NORMAL ]  Iteration 221:	k_eff = 1.220640	res = 1.785E-05
[  NORMAL ]  Iteration 222:	k_eff = 1.220660	res = 1.689E-05
[  NORMAL ]  Iteration 223:	k_eff = 1.220679	res = 1.624E-05
[  NORMAL ]  Iteration 224:	k_eff = 1.220697	res = 1.546E-05
[  NORMAL ]  Iteration 225:	k_eff = 1.220714	res = 1.473E-05
[  NORMAL ]  Iteration 226:	k_eff = 1.220731	res = 1.431E-05
[  NORMAL ]  Iteration 227:	k_eff = 1.220747	res = 1.359E-05
[  NORMAL ]  Iteration 228:	k_eff = 1.220762	res = 1.274E-05
[  NORMAL ]  Iteration 229:	k_eff = 1.220776	res = 1.210E-05
[  NORMAL ]  Iteration 230:	k_eff = 1.220789	res = 1.159E-05
[  NORMAL ]  Iteration 231:	k_eff = 1.220801	res = 1.069E-05
[  NORMAL ]  Iteration 232:	k_eff = 1.220813	res = 1.043E-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.223474
openmoc keff = 1.220813
bias [pcm]: -266.0

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.opencg_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/nelsonag/git/openmc/openmc/tallies.py:1974: RuntimeWarning: invalid value encountered in true_divide
  self_rel_err = data['self']['std. dev.'] / data['self']['mean']
/home/nelsonag/git/openmc/openmc/tallies.py:1975: RuntimeWarning: invalid value encountered in true_divide
  other_rel_err = data['other']['std. dev.'] / data['other']['mean']
/home/nelsonag/git/openmc/openmc/tallies.py:1976: 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.366907	res = 0.000E+00
[  NORMAL ]  Iteration 1:	k_eff = 0.391217	res = 6.331E-01
[  NORMAL ]  Iteration 2:	k_eff = 0.393027	res = 6.626E-02
[  NORMAL ]  Iteration 3:	k_eff = 0.381142	res = 4.627E-03
[  NORMAL ]  Iteration 4:	k_eff = 0.375065	res = 3.024E-02
[  NORMAL ]  Iteration 5:	k_eff = 0.369644	res = 1.594E-02
[  NORMAL ]  Iteration 6:	k_eff = 0.365597	res = 1.445E-02
[  NORMAL ]  Iteration 7:	k_eff = 0.363111	res = 1.095E-02
[  NORMAL ]  Iteration 8:	k_eff = 0.361532	res = 6.802E-03
[  NORMAL ]  Iteration 9:	k_eff = 0.361339	res = 4.349E-03
[  NORMAL ]  Iteration 10:	k_eff = 0.362062	res = 5.320E-04
[  NORMAL ]  Iteration 11:	k_eff = 0.363777	res = 2.001E-03
[  NORMAL ]  Iteration 12:	k_eff = 0.366396	res = 4.735E-03
[  NORMAL ]  Iteration 13:	k_eff = 0.369859	res = 7.199E-03
[  NORMAL ]  Iteration 14:	k_eff = 0.374042	res = 9.454E-03
[  NORMAL ]  Iteration 15:	k_eff = 0.378972	res = 1.131E-02
[  NORMAL ]  Iteration 16:	k_eff = 0.384524	res = 1.318E-02
[  NORMAL ]  Iteration 17:	k_eff = 0.390678	res = 1.465E-02
[  NORMAL ]  Iteration 18:	k_eff = 0.397373	res = 1.600E-02
[  NORMAL ]  Iteration 19:	k_eff = 0.404563	res = 1.714E-02
[  NORMAL ]  Iteration 20:	k_eff = 0.412208	res = 1.809E-02
[  NORMAL ]  Iteration 21:	k_eff = 0.420270	res = 1.890E-02
[  NORMAL ]  Iteration 22:	k_eff = 0.428695	res = 1.956E-02
[  NORMAL ]  Iteration 23:	k_eff = 0.437463	res = 2.005E-02
[  NORMAL ]  Iteration 24:	k_eff = 0.446530	res = 2.045E-02
[  NORMAL ]  Iteration 25:	k_eff = 0.455867	res = 2.073E-02
[  NORMAL ]  Iteration 26:	k_eff = 0.465443	res = 2.091E-02
[  NORMAL ]  Iteration 27:	k_eff = 0.475229	res = 2.101E-02
[  NORMAL ]  Iteration 28:	k_eff = 0.485199	res = 2.103E-02
[  NORMAL ]  Iteration 29:	k_eff = 0.495328	res = 2.098E-02
[  NORMAL ]  Iteration 30:	k_eff = 0.505592	res = 2.088E-02
[  NORMAL ]  Iteration 31:	k_eff = 0.515970	res = 2.072E-02
[  NORMAL ]  Iteration 32:	k_eff = 0.526441	res = 2.053E-02
[  NORMAL ]  Iteration 33:	k_eff = 0.536986	res = 2.029E-02
[  NORMAL ]  Iteration 34:	k_eff = 0.547587	res = 2.003E-02
[  NORMAL ]  Iteration 35:	k_eff = 0.558228	res = 1.974E-02
[  NORMAL ]  Iteration 36:	k_eff = 0.568894	res = 1.943E-02
[  NORMAL ]  Iteration 37:	k_eff = 0.579570	res = 1.911E-02
[  NORMAL ]  Iteration 38:	k_eff = 0.590242	res = 1.877E-02
[  NORMAL ]  Iteration 39:	k_eff = 0.600898	res = 1.841E-02
[  NORMAL ]  Iteration 40:	k_eff = 0.611527	res = 1.805E-02
[  NORMAL ]  Iteration 41:	k_eff = 0.622119	res = 1.769E-02
[  NORMAL ]  Iteration 42:	k_eff = 0.632663	res = 1.732E-02
[  NORMAL ]  Iteration 43:	k_eff = 0.643149	res = 1.695E-02
[  NORMAL ]  Iteration 44:	k_eff = 0.653571	res = 1.658E-02
[  NORMAL ]  Iteration 45:	k_eff = 0.663920	res = 1.620E-02
[  NORMAL ]  Iteration 46:	k_eff = 0.674190	res = 1.583E-02
[  NORMAL ]  Iteration 47:	k_eff = 0.684373	res = 1.547E-02
[  NORMAL ]  Iteration 48:	k_eff = 0.694464	res = 1.510E-02
[  NORMAL ]  Iteration 49:	k_eff = 0.704458	res = 1.475E-02
[  NORMAL ]  Iteration 50:	k_eff = 0.714349	res = 1.439E-02
[  NORMAL ]  Iteration 51:	k_eff = 0.724134	res = 1.404E-02
[  NORMAL ]  Iteration 52:	k_eff = 0.733809	res = 1.370E-02
[  NORMAL ]  Iteration 53:	k_eff = 0.743369	res = 1.336E-02
[  NORMAL ]  Iteration 54:	k_eff = 0.752812	res = 1.303E-02
[  NORMAL ]  Iteration 55:	k_eff = 0.762135	res = 1.270E-02
[  NORMAL ]  Iteration 56:	k_eff = 0.771336	res = 1.238E-02
[  NORMAL ]  Iteration 57:	k_eff = 0.780412	res = 1.207E-02
[  NORMAL ]  Iteration 58:	k_eff = 0.789363	res = 1.177E-02
[  NORMAL ]  Iteration 59:	k_eff = 0.798184	res = 1.147E-02
[  NORMAL ]  Iteration 60:	k_eff = 0.806878	res = 1.118E-02
[  NORMAL ]  Iteration 61:	k_eff = 0.815440	res = 1.089E-02
[  NORMAL ]  Iteration 62:	k_eff = 0.823872	res = 1.061E-02
[  NORMAL ]  Iteration 63:	k_eff = 0.832173	res = 1.034E-02
[  NORMAL ]  Iteration 64:	k_eff = 0.840341	res = 1.007E-02
[  NORMAL ]  Iteration 65:	k_eff = 0.848378	res = 9.816E-03
[  NORMAL ]  Iteration 66:	k_eff = 0.856281	res = 9.563E-03
[  NORMAL ]  Iteration 67:	k_eff = 0.864053	res = 9.316E-03
[  NORMAL ]  Iteration 68:	k_eff = 0.871694	res = 9.076E-03
[  NORMAL ]  Iteration 69:	k_eff = 0.879202	res = 8.842E-03
[  NORMAL ]  Iteration 70:	k_eff = 0.886580	res = 8.614E-03
[  NORMAL ]  Iteration 71:	k_eff = 0.893828	res = 8.392E-03
[  NORMAL ]  Iteration 72:	k_eff = 0.900946	res = 8.175E-03
[  NORMAL ]  Iteration 73:	k_eff = 0.907936	res = 7.964E-03
[  NORMAL ]  Iteration 74:	k_eff = 0.914798	res = 7.758E-03
[  NORMAL ]  Iteration 75:	k_eff = 0.921534	res = 7.558E-03
[  NORMAL ]  Iteration 76:	k_eff = 0.928144	res = 7.363E-03
[  NORMAL ]  Iteration 77:	k_eff = 0.934630	res = 7.173E-03
[  NORMAL ]  Iteration 78:	k_eff = 0.940992	res = 6.988E-03
[  NORMAL ]  Iteration 79:	k_eff = 0.947233	res = 6.807E-03
[  NORMAL ]  Iteration 80:	k_eff = 0.953353	res = 6.633E-03
[  NORMAL ]  Iteration 81:	k_eff = 0.959355	res = 6.461E-03
[  NORMAL ]  Iteration 82:	k_eff = 0.965239	res = 6.295E-03
[  NORMAL ]  Iteration 83:	k_eff = 0.971007	res = 6.133E-03
[  NORMAL ]  Iteration 84:	k_eff = 0.976660	res = 5.975E-03
[  NORMAL ]  Iteration 85:	k_eff = 0.982199	res = 5.822E-03
[  NORMAL ]  Iteration 86:	k_eff = 0.987627	res = 5.672E-03
[  NORMAL ]  Iteration 87:	k_eff = 0.992946	res = 5.526E-03
[  NORMAL ]  Iteration 88:	k_eff = 0.998156	res = 5.385E-03
[  NORMAL ]  Iteration 89:	k_eff = 1.003259	res = 5.247E-03
[  NORMAL ]  Iteration 90:	k_eff = 1.008257	res = 5.113E-03
[  NORMAL ]  Iteration 91:	k_eff = 1.013151	res = 4.982E-03
[  NORMAL ]  Iteration 92:	k_eff = 1.017944	res = 4.854E-03
[  NORMAL ]  Iteration 93:	k_eff = 1.022636	res = 4.730E-03
[  NORMAL ]  Iteration 94:	k_eff = 1.027230	res = 4.609E-03
[  NORMAL ]  Iteration 95:	k_eff = 1.031726	res = 4.492E-03
[  NORMAL ]  Iteration 96:	k_eff = 1.036126	res = 4.377E-03
[  NORMAL ]  Iteration 97:	k_eff = 1.040434	res = 4.265E-03
[  NORMAL ]  Iteration 98:	k_eff = 1.044649	res = 4.157E-03
[  NORMAL ]  Iteration 99:	k_eff = 1.048774	res = 4.052E-03
[  NORMAL ]  Iteration 100:	k_eff = 1.052810	res = 3.949E-03
[  NORMAL ]  Iteration 101:	k_eff = 1.056758	res = 3.848E-03
[  NORMAL ]  Iteration 102:	k_eff = 1.060621	res = 3.751E-03
[  NORMAL ]  Iteration 103:	k_eff = 1.064400	res = 3.655E-03
[  NORMAL ]  Iteration 104:	k_eff = 1.068096	res = 3.563E-03
[  NORMAL ]  Iteration 105:	k_eff = 1.071711	res = 3.472E-03
[  NORMAL ]  Iteration 106:	k_eff = 1.075247	res = 3.384E-03
[  NORMAL ]  Iteration 107:	k_eff = 1.078705	res = 3.299E-03
[  NORMAL ]  Iteration 108:	k_eff = 1.082086	res = 3.216E-03
[  NORMAL ]  Iteration 109:	k_eff = 1.085392	res = 3.135E-03
[  NORMAL ]  Iteration 110:	k_eff = 1.088624	res = 3.056E-03
[  NORMAL ]  Iteration 111:	k_eff = 1.091784	res = 2.977E-03
[  NORMAL ]  Iteration 112:	k_eff = 1.094875	res = 2.903E-03
[  NORMAL ]  Iteration 113:	k_eff = 1.097895	res = 2.831E-03
[  NORMAL ]  Iteration 114:	k_eff = 1.100847	res = 2.759E-03
[  NORMAL ]  Iteration 115:	k_eff = 1.103734	res = 2.689E-03
[  NORMAL ]  Iteration 116:	k_eff = 1.106555	res = 2.622E-03
[  NORMAL ]  Iteration 117:	k_eff = 1.109312	res = 2.556E-03
[  NORMAL ]  Iteration 118:	k_eff = 1.112007	res = 2.492E-03
[  NORMAL ]  Iteration 119:	k_eff = 1.114640	res = 2.429E-03
[  NORMAL ]  Iteration 120:	k_eff = 1.117214	res = 2.368E-03
[  NORMAL ]  Iteration 121:	k_eff = 1.119728	res = 2.309E-03
[  NORMAL ]  Iteration 122:	k_eff = 1.122186	res = 2.251E-03
[  NORMAL ]  Iteration 123:	k_eff = 1.124587	res = 2.195E-03
[  NORMAL ]  Iteration 124:	k_eff = 1.126934	res = 2.140E-03
[  NORMAL ]  Iteration 125:	k_eff = 1.129226	res = 2.086E-03
[  NORMAL ]  Iteration 126:	k_eff = 1.131465	res = 2.034E-03
[  NORMAL ]  Iteration 127:	k_eff = 1.133653	res = 1.983E-03
[  NORMAL ]  Iteration 128:	k_eff = 1.135791	res = 1.934E-03
[  NORMAL ]  Iteration 129:	k_eff = 1.137879	res = 1.886E-03
[  NORMAL ]  Iteration 130:	k_eff = 1.139918	res = 1.839E-03
[  NORMAL ]  Iteration 131:	k_eff = 1.141911	res = 1.792E-03
[  NORMAL ]  Iteration 132:	k_eff = 1.143857	res = 1.748E-03
[  NORMAL ]  Iteration 133:	k_eff = 1.145758	res = 1.704E-03
[  NORMAL ]  Iteration 134:	k_eff = 1.147615	res = 1.662E-03
[  NORMAL ]  Iteration 135:	k_eff = 1.149428	res = 1.621E-03
[  NORMAL ]  Iteration 136:	k_eff = 1.151199	res = 1.580E-03
[  NORMAL ]  Iteration 137:	k_eff = 1.152929	res = 1.541E-03
[  NORMAL ]  Iteration 138:	k_eff = 1.154618	res = 1.503E-03
[  NORMAL ]  Iteration 139:	k_eff = 1.156268	res = 1.465E-03
[  NORMAL ]  Iteration 140:	k_eff = 1.157878	res = 1.429E-03
[  NORMAL ]  Iteration 141:	k_eff = 1.159452	res = 1.393E-03
[  NORMAL ]  Iteration 142:	k_eff = 1.160988	res = 1.359E-03
[  NORMAL ]  Iteration 143:	k_eff = 1.162488	res = 1.325E-03
[  NORMAL ]  Iteration 144:	k_eff = 1.163953	res = 1.292E-03
[  NORMAL ]  Iteration 145:	k_eff = 1.165384	res = 1.261E-03
[  NORMAL ]  Iteration 146:	k_eff = 1.166780	res = 1.229E-03
[  NORMAL ]  Iteration 147:	k_eff = 1.168144	res = 1.198E-03
[  NORMAL ]  Iteration 148:	k_eff = 1.169476	res = 1.169E-03
[  NORMAL ]  Iteration 149:	k_eff = 1.170776	res = 1.140E-03
[  NORMAL ]  Iteration 150:	k_eff = 1.172045	res = 1.111E-03
[  NORMAL ]  Iteration 151:	k_eff = 1.173284	res = 1.084E-03
[  NORMAL ]  Iteration 152:	k_eff = 1.174493	res = 1.057E-03
[  NORMAL ]  Iteration 153:	k_eff = 1.175674	res = 1.031E-03
[  NORMAL ]  Iteration 154:	k_eff = 1.176828	res = 1.005E-03
[  NORMAL ]  Iteration 155:	k_eff = 1.177953	res = 9.813E-04
[  NORMAL ]  Iteration 156:	k_eff = 1.179052	res = 9.563E-04
[  NORMAL ]  Iteration 157:	k_eff = 1.180125	res = 9.324E-04
[  NORMAL ]  Iteration 158:	k_eff = 1.181172	res = 9.100E-04
[  NORMAL ]  Iteration 159:	k_eff = 1.182194	res = 8.877E-04
[  NORMAL ]  Iteration 160:	k_eff = 1.183192	res = 8.650E-04
[  NORMAL ]  Iteration 161:	k_eff = 1.184167	res = 8.445E-04
[  NORMAL ]  Iteration 162:	k_eff = 1.185117	res = 8.233E-04
[  NORMAL ]  Iteration 163:	k_eff = 1.186045	res = 8.028E-04
[  NORMAL ]  Iteration 164:	k_eff = 1.186951	res = 7.831E-04
[  NORMAL ]  Iteration 165:	k_eff = 1.187836	res = 7.636E-04
[  NORMAL ]  Iteration 166:	k_eff = 1.188699	res = 7.452E-04
[  NORMAL ]  Iteration 167:	k_eff = 1.189541	res = 7.265E-04
[  NORMAL ]  Iteration 168:	k_eff = 1.190363	res = 7.087E-04
[  NORMAL ]  Iteration 169:	k_eff = 1.191166	res = 6.911E-04
[  NORMAL ]  Iteration 170:	k_eff = 1.191949	res = 6.742E-04
[  NORMAL ]  Iteration 171:	k_eff = 1.192714	res = 6.578E-04
[  NORMAL ]  Iteration 172:	k_eff = 1.193460	res = 6.414E-04
[  NORMAL ]  Iteration 173:	k_eff = 1.194188	res = 6.255E-04
[  NORMAL ]  Iteration 174:	k_eff = 1.194899	res = 6.097E-04
[  NORMAL ]  Iteration 175:	k_eff = 1.195593	res = 5.957E-04
[  NORMAL ]  Iteration 176:	k_eff = 1.196270	res = 5.807E-04
[  NORMAL ]  Iteration 177:	k_eff = 1.196931	res = 5.660E-04
[  NORMAL ]  Iteration 178:	k_eff = 1.197576	res = 5.523E-04
[  NORMAL ]  Iteration 179:	k_eff = 1.198204	res = 5.389E-04
[  NORMAL ]  Iteration 180:	k_eff = 1.198819	res = 5.250E-04
[  NORMAL ]  Iteration 181:	k_eff = 1.199418	res = 5.125E-04
[  NORMAL ]  Iteration 182:	k_eff = 1.200003	res = 5.002E-04
[  NORMAL ]  Iteration 183:	k_eff = 1.200574	res = 4.878E-04
[  NORMAL ]  Iteration 184:	k_eff = 1.201131	res = 4.760E-04
[  NORMAL ]  Iteration 185:	k_eff = 1.201674	res = 4.637E-04
[  NORMAL ]  Iteration 186:	k_eff = 1.202206	res = 4.523E-04
[  NORMAL ]  Iteration 187:	k_eff = 1.202724	res = 4.421E-04
[  NORMAL ]  Iteration 188:	k_eff = 1.203229	res = 4.306E-04
[  NORMAL ]  Iteration 189:	k_eff = 1.203722	res = 4.200E-04
[  NORMAL ]  Iteration 190:	k_eff = 1.204203	res = 4.099E-04
[  NORMAL ]  Iteration 191:	k_eff = 1.204673	res = 3.998E-04
[  NORMAL ]  Iteration 192:	k_eff = 1.205131	res = 3.903E-04
[  NORMAL ]  Iteration 193:	k_eff = 1.205578	res = 3.802E-04
[  NORMAL ]  Iteration 194:	k_eff = 1.206014	res = 3.706E-04
[  NORMAL ]  Iteration 195:	k_eff = 1.206440	res = 3.618E-04
[  NORMAL ]  Iteration 196:	k_eff = 1.206855	res = 3.530E-04
[  NORMAL ]  Iteration 197:	k_eff = 1.207261	res = 3.443E-04
[  NORMAL ]  Iteration 198:	k_eff = 1.207657	res = 3.359E-04
[  NORMAL ]  Iteration 199:	k_eff = 1.208043	res = 3.282E-04
[  NORMAL ]  Iteration 200:	k_eff = 1.208419	res = 3.196E-04
[  NORMAL ]  Iteration 201:	k_eff = 1.208787	res = 3.116E-04
[  NORMAL ]  Iteration 202:	k_eff = 1.209145	res = 3.039E-04
[  NORMAL ]  Iteration 203:	k_eff = 1.209495	res = 2.962E-04
[  NORMAL ]  Iteration 204:	k_eff = 1.209836	res = 2.895E-04
[  NORMAL ]  Iteration 205:	k_eff = 1.210170	res = 2.824E-04
[  NORMAL ]  Iteration 206:	k_eff = 1.210495	res = 2.756E-04
[  NORMAL ]  Iteration 207:	k_eff = 1.210812	res = 2.687E-04
[  NORMAL ]  Iteration 208:	k_eff = 1.211122	res = 2.619E-04
[  NORMAL ]  Iteration 209:	k_eff = 1.211423	res = 2.559E-04
[  NORMAL ]  Iteration 210:	k_eff = 1.211718	res = 2.491E-04
[  NORMAL ]  Iteration 211:	k_eff = 1.212006	res = 2.430E-04
[  NORMAL ]  Iteration 212:	k_eff = 1.212286	res = 2.376E-04
[  NORMAL ]  Iteration 213:	k_eff = 1.212560	res = 2.313E-04
[  NORMAL ]  Iteration 214:	k_eff = 1.212827	res = 2.257E-04
[  NORMAL ]  Iteration 215:	k_eff = 1.213088	res = 2.203E-04
[  NORMAL ]  Iteration 216:	k_eff = 1.213341	res = 2.149E-04
[  NORMAL ]  Iteration 217:	k_eff = 1.213590	res = 2.092E-04
[  NORMAL ]  Iteration 218:	k_eff = 1.213831	res = 2.047E-04
[  NORMAL ]  Iteration 219:	k_eff = 1.214068	res = 1.990E-04
[  NORMAL ]  Iteration 220:	k_eff = 1.214298	res = 1.945E-04
[  NORMAL ]  Iteration 221:	k_eff = 1.214523	res = 1.900E-04
[  NORMAL ]  Iteration 222:	k_eff = 1.214743	res = 1.850E-04
[  NORMAL ]  Iteration 223:	k_eff = 1.214956	res = 1.807E-04
[  NORMAL ]  Iteration 224:	k_eff = 1.215166	res = 1.760E-04
[  NORMAL ]  Iteration 225:	k_eff = 1.215370	res = 1.724E-04
[  NORMAL ]  Iteration 226:	k_eff = 1.215569	res = 1.677E-04
[  NORMAL ]  Iteration 227:	k_eff = 1.215762	res = 1.637E-04
[  NORMAL ]  Iteration 228:	k_eff = 1.215951	res = 1.595E-04
[  NORMAL ]  Iteration 229:	k_eff = 1.216136	res = 1.554E-04
[  NORMAL ]  Iteration 230:	k_eff = 1.216316	res = 1.518E-04
[  NORMAL ]  Iteration 231:	k_eff = 1.216492	res = 1.479E-04
[  NORMAL ]  Iteration 232:	k_eff = 1.216663	res = 1.446E-04
[  NORMAL ]  Iteration 233:	k_eff = 1.216831	res = 1.411E-04
[  NORMAL ]  Iteration 234:	k_eff = 1.216994	res = 1.377E-04
[  NORMAL ]  Iteration 235:	k_eff = 1.217153	res = 1.341E-04
[  NORMAL ]  Iteration 236:	k_eff = 1.217309	res = 1.307E-04
[  NORMAL ]  Iteration 237:	k_eff = 1.217461	res = 1.279E-04
[  NORMAL ]  Iteration 238:	k_eff = 1.217608	res = 1.246E-04
[  NORMAL ]  Iteration 239:	k_eff = 1.217752	res = 1.215E-04
[  NORMAL ]  Iteration 240:	k_eff = 1.217893	res = 1.183E-04
[  NORMAL ]  Iteration 241:	k_eff = 1.218031	res = 1.156E-04
[  NORMAL ]  Iteration 242:	k_eff = 1.218165	res = 1.129E-04
[  NORMAL ]  Iteration 243:	k_eff = 1.218296	res = 1.104E-04
[  NORMAL ]  Iteration 244:	k_eff = 1.218423	res = 1.072E-04
[  NORMAL ]  Iteration 245:	k_eff = 1.218548	res = 1.045E-04
[  NORMAL ]  Iteration 246:	k_eff = 1.218669	res = 1.024E-04
[  NORMAL ]  Iteration 247:	k_eff = 1.218788	res = 9.969E-05
[  NORMAL ]  Iteration 248:	k_eff = 1.218903	res = 9.716E-05
[  NORMAL ]  Iteration 249:	k_eff = 1.219016	res = 9.478E-05
[  NORMAL ]  Iteration 250:	k_eff = 1.219126	res = 9.241E-05
[  NORMAL ]  Iteration 251:	k_eff = 1.219233	res = 9.028E-05
[  NORMAL ]  Iteration 252:	k_eff = 1.219338	res = 8.820E-05
[  NORMAL ]  Iteration 253:	k_eff = 1.219440	res = 8.585E-05
[  NORMAL ]  Iteration 254:	k_eff = 1.219540	res = 8.383E-05
[  NORMAL ]  Iteration 255:	k_eff = 1.219638	res = 8.191E-05
[  NORMAL ]  Iteration 256:	k_eff = 1.219732	res = 8.000E-05
[  NORMAL ]  Iteration 257:	k_eff = 1.219825	res = 7.789E-05
[  NORMAL ]  Iteration 258:	k_eff = 1.219915	res = 7.582E-05
[  NORMAL ]  Iteration 259:	k_eff = 1.220003	res = 7.393E-05
[  NORMAL ]  Iteration 260:	k_eff = 1.220089	res = 7.210E-05
[  NORMAL ]  Iteration 261:	k_eff = 1.220173	res = 7.026E-05
[  NORMAL ]  Iteration 262:	k_eff = 1.220255	res = 6.882E-05
[  NORMAL ]  Iteration 263:	k_eff = 1.220335	res = 6.737E-05
[  NORMAL ]  Iteration 264:	k_eff = 1.220412	res = 6.552E-05
[  NORMAL ]  Iteration 265:	k_eff = 1.220488	res = 6.380E-05
[  NORMAL ]  Iteration 266:	k_eff = 1.220562	res = 6.221E-05
[  NORMAL ]  Iteration 267:	k_eff = 1.220635	res = 6.069E-05
[  NORMAL ]  Iteration 268:	k_eff = 1.220705	res = 5.922E-05
[  NORMAL ]  Iteration 269:	k_eff = 1.220774	res = 5.778E-05
[  NORMAL ]  Iteration 270:	k_eff = 1.220842	res = 5.661E-05
[  NORMAL ]  Iteration 271:	k_eff = 1.220907	res = 5.519E-05
[  NORMAL ]  Iteration 272:	k_eff = 1.220971	res = 5.373E-05
[  NORMAL ]  Iteration 273:	k_eff = 1.221033	res = 5.234E-05
[  NORMAL ]  Iteration 274:	k_eff = 1.221094	res = 5.116E-05
[  NORMAL ]  Iteration 275:	k_eff = 1.221153	res = 4.958E-05
[  NORMAL ]  Iteration 276:	k_eff = 1.221211	res = 4.859E-05
[  NORMAL ]  Iteration 277:	k_eff = 1.221268	res = 4.726E-05
[  NORMAL ]  Iteration 278:	k_eff = 1.221323	res = 4.630E-05
[  NORMAL ]  Iteration 279:	k_eff = 1.221377	res = 4.510E-05
[  NORMAL ]  Iteration 280:	k_eff = 1.221429	res = 4.409E-05
[  NORMAL ]  Iteration 281:	k_eff = 1.221481	res = 4.282E-05
[  NORMAL ]  Iteration 282:	k_eff = 1.221531	res = 4.223E-05
[  NORMAL ]  Iteration 283:	k_eff = 1.221579	res = 4.097E-05
[  NORMAL ]  Iteration 284:	k_eff = 1.221627	res = 3.991E-05
[  NORMAL ]  Iteration 285:	k_eff = 1.221673	res = 3.900E-05
[  NORMAL ]  Iteration 286:	k_eff = 1.221719	res = 3.805E-05
[  NORMAL ]  Iteration 287:	k_eff = 1.221763	res = 3.705E-05
[  NORMAL ]  Iteration 288:	k_eff = 1.221806	res = 3.605E-05
[  NORMAL ]  Iteration 289:	k_eff = 1.221848	res = 3.540E-05
[  NORMAL ]  Iteration 290:	k_eff = 1.221889	res = 3.451E-05
[  NORMAL ]  Iteration 291:	k_eff = 1.221929	res = 3.361E-05
[  NORMAL ]  Iteration 292:	k_eff = 1.221968	res = 3.264E-05
[  NORMAL ]  Iteration 293:	k_eff = 1.222006	res = 3.194E-05
[  NORMAL ]  Iteration 294:	k_eff = 1.222043	res = 3.100E-05
[  NORMAL ]  Iteration 295:	k_eff = 1.222079	res = 3.021E-05
[  NORMAL ]  Iteration 296:	k_eff = 1.222114	res = 2.963E-05
[  NORMAL ]  Iteration 297:	k_eff = 1.222149	res = 2.899E-05
[  NORMAL ]  Iteration 298:	k_eff = 1.222183	res = 2.802E-05
[  NORMAL ]  Iteration 299:	k_eff = 1.222216	res = 2.767E-05
[  NORMAL ]  Iteration 300:	k_eff = 1.222248	res = 2.667E-05
[  NORMAL ]  Iteration 301:	k_eff = 1.222279	res = 2.625E-05
[  NORMAL ]  Iteration 302:	k_eff = 1.222309	res = 2.557E-05
[  NORMAL ]  Iteration 303:	k_eff = 1.222339	res = 2.475E-05
[  NORMAL ]  Iteration 304:	k_eff = 1.222368	res = 2.429E-05
[  NORMAL ]  Iteration 305:	k_eff = 1.222396	res = 2.362E-05
[  NORMAL ]  Iteration 306:	k_eff = 1.222423	res = 2.316E-05
[  NORMAL ]  Iteration 307:	k_eff = 1.222450	res = 2.258E-05
[  NORMAL ]  Iteration 308:	k_eff = 1.222476	res = 2.210E-05
[  NORMAL ]  Iteration 309:	k_eff = 1.222502	res = 2.143E-05
[  NORMAL ]  Iteration 310:	k_eff = 1.222527	res = 2.108E-05
[  NORMAL ]  Iteration 311:	k_eff = 1.222551	res = 2.047E-05
[  NORMAL ]  Iteration 312:	k_eff = 1.222575	res = 1.989E-05
[  NORMAL ]  Iteration 313:	k_eff = 1.222598	res = 1.935E-05
[  NORMAL ]  Iteration 314:	k_eff = 1.222621	res = 1.921E-05
[  NORMAL ]  Iteration 315:	k_eff = 1.222643	res = 1.851E-05
[  NORMAL ]  Iteration 316:	k_eff = 1.222665	res = 1.815E-05
[  NORMAL ]  Iteration 317:	k_eff = 1.222686	res = 1.771E-05
[  NORMAL ]  Iteration 318:	k_eff = 1.222707	res = 1.734E-05
[  NORMAL ]  Iteration 319:	k_eff = 1.222727	res = 1.689E-05
[  NORMAL ]  Iteration 320:	k_eff = 1.222746	res = 1.648E-05
[  NORMAL ]  Iteration 321:	k_eff = 1.222766	res = 1.591E-05
[  NORMAL ]  Iteration 322:	k_eff = 1.222784	res = 1.559E-05
[  NORMAL ]  Iteration 323:	k_eff = 1.222802	res = 1.522E-05
[  NORMAL ]  Iteration 324:	k_eff = 1.222820	res = 1.491E-05
[  NORMAL ]  Iteration 325:	k_eff = 1.222837	res = 1.449E-05
[  NORMAL ]  Iteration 326:	k_eff = 1.222854	res = 1.405E-05
[  NORMAL ]  Iteration 327:	k_eff = 1.222870	res = 1.371E-05
[  NORMAL ]  Iteration 328:	k_eff = 1.222886	res = 1.337E-05
[  NORMAL ]  Iteration 329:	k_eff = 1.222902	res = 1.321E-05
[  NORMAL ]  Iteration 330:	k_eff = 1.222917	res = 1.281E-05
[  NORMAL ]  Iteration 331:	k_eff = 1.222932	res = 1.247E-05
[  NORMAL ]  Iteration 332:	k_eff = 1.222947	res = 1.215E-05
[  NORMAL ]  Iteration 333:	k_eff = 1.222961	res = 1.201E-05
[  NORMAL ]  Iteration 334:	k_eff = 1.222975	res = 1.163E-05
[  NORMAL ]  Iteration 335:	k_eff = 1.222988	res = 1.122E-05
[  NORMAL ]  Iteration 336:	k_eff = 1.223001	res = 1.090E-05
[  NORMAL ]  Iteration 337:	k_eff = 1.223014	res = 1.070E-05
[  NORMAL ]  Iteration 338:	k_eff = 1.223027	res = 1.047E-05
[  NORMAL ]  Iteration 339:	k_eff = 1.223039	res = 1.015E-05
[  NORMAL ]  Iteration 340:	k_eff = 1.223051	res = 1.002E-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.223474
openmoc keff = 1.223051
bias [pcm]: -42.3

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/nelsonag/git/openmc/openmc/tallies.py:1974: 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)


/usr/lib/python3.5/site-packages/numpy/lib/shape_base.py:873: VisibleDeprecationWarning: using a non-integer number instead of an integer will result in an error in the future
  return c.reshape(shape_out)

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')
plt.grid()

# 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')
plt.grid()

# Show the plot on screen
plt.show()