Esempio n. 1
0
def create_openmc_2mg_libs(names):
    """Built a micro/macro two group openmc MGXS libraries"""
    # Initialized library params
    group_edges = [0.0, 0.625, 20.0e6]
    groups = openmc.mgxs.EnergyGroups(group_edges=group_edges)
    mg_cross_sections_file_micro = openmc.MGXSLibrary(groups)
    mg_cross_sections_file_macro = openmc.MGXSLibrary(groups)
    # Building a micro mg library
    micro_cs = create_micro_xs_dict()
    for name in names:
        mg_cross_sections_file_micro.add_xsdata(build_openmc_xs_lib(name,
                                                                    groups,
                                                                    [t for t in
                                                                     micro_cs],
                                                                    micro_cs))
    # Building a macro mg library
    macro_xs = create_macro_dict(micro_cs)
    mg_cross_sections_file_macro.add_xsdata(build_openmc_xs_lib('macro',
                                                                groups,
                                                                [t for t in
                                                                 macro_xs],
                                                                macro_xs))
    # Exporting library to hdf5 files
    mg_cross_sections_file_micro.export_to_hdf5('micro_2g.h5')
    mg_cross_sections_file_macro.export_to_hdf5('macro_2g.h5')
    # Returning the macro_xs dict is needed for analytical solution
    return macro_xs
Esempio n. 2
0
def create_6g():
    # Instantiate the energy group data and file object
    groups = GROUP_STRUCT[6]

    mg_cross_sections_file = openmc.MGXSLibrary(groups)

    ###########################################################################
    # 7 URR
    nu = [3.0, 2.5, 2.0, 2.0, 2.50, 3.0]
    fiss = np.array([0.006, 0.060, 0.90, 0.90, 0.060, 0.006])
    capture = [0.006, 0.040, 0.20, 0.2, 0.04, 0.006]
    absorption = np.add(capture, fiss)
    scatter = np.array([[[0.024, 0.171, 0.033, 0.00, 0.00, 0.00],
                         [0.000, 0.600, 0.275, 0.00, 0.00, 0.00],
                         [0.000, 0.000, 2.000, 0.00, 0.00, 0.00],
                         [0.000, 0.000, 0.000, 2.00, 0.00, 0.00],
                         [0.000, 0.000, 0.000, 0.275, 0.60, 0.00],
                         [0.000, 0.000, 2.000, 0.033, 0.171, 0.024]]])
    scatter = np.rollaxis(scatter, 0, 3)
    total = [0.240, 0.975, 3.10, 3.10, 0.975, 0.240]
    chi = [0.48, 0.02, 0.0, 0.0, 0.02, 0.048]

    URR = set_it('URR', groups, 0, fiss, nu, absorption, scatter, total, chi)
    mg_cross_sections_file.add_xsdata(URR)

    mg_cross_sections_file.export_to_hdf5('6g.h5')
Esempio n. 3
0
def create_library():
    # Instantiate the energy group data and file object
    groups = openmc.mgxs.EnergyGroups(group_edges=[0.0, 0.625, 20.0e6])

    mg_cross_sections_file = openmc.MGXSLibrary(groups)

    # Make the base, isotropic data
    nu = [2.50, 2.50]
    fiss = np.array([0.002817, 0.097])
    capture = [0.008708, 0.02518]
    absorption = np.add(capture, fiss)
    scatter = np.array([[[0.31980, 0.06694, 0.003],
                         [0.004555, -0.0003972, 0.00002]],
                        [[0.00000, 0.00000, 0.000],
                         [0.424100, 0.05439000, 0.0025]]])
    total = [0.33588, 0.54628]
    chi = [1., 0.]

    mat_1 = openmc.XSdata('mat_1', groups)
    mat_1.order = 2
    mat_1.set_nu_fission(np.multiply(nu, fiss))
    mat_1.set_absorption(absorption)
    mat_1.set_scatter_matrix(scatter)
    mat_1.set_total(total)
    mat_1.set_chi(chi)
    mg_cross_sections_file.add_xsdata(mat_1)

    # Write the file
    mg_cross_sections_file.export_to_hdf5('2g.h5')
Esempio n. 4
0
def make_libgroup_micro(nameoflib):
    libgroup = temp_libgroup(tempdata)
    openmclib = {}
    for tt in tempdata:
        for n in libgroup[tt]:
            scatter = np.zeros((len(ENERGIES) - 1, len(ENERGIES) - 1, 2), dtype=np.double)
            if (n in openmclib):
                openmclib[n].set_total(libgroup[tt][n].stot, temperature=tt)
                openmclib[n].set_absorption(libgroup[tt][n].sabs, temperature=tt)
                scatter += libgroup[tt][n].xsmatrix*1.0
                openmclib[n].set_scatter_matrix(scatter, temperature=tt)
                openmclib[n].set_fission(libgroup[tt][n].sf, temperature=tt)
                openmclib[n].set_nu_fission(libgroup[tt][n].nusf, temperature=tt)
                openmclib[n].set_chi(libgroup[tt][n].schi, temperature=tt)
            else:
                openmclib[n] = openmc.XSdata(n, groups, temperatures=tempdata)
                if (libgroup[tt][n].xsmatrix.shape[-1] < 2):
                    openmclib[n].order = 0
                else:
                    openmclib[n].order = 1
                openmclib[n].order = 1
                openmclib[n].set_total(libgroup[tt][n].stot, temperature=tt)
                openmclib[n].set_absorption(libgroup[tt][n].sabs, temperature=tt)
                scatter += libgroup[tt][n].xsmatrix*1.0
                openmclib[n].set_scatter_matrix(scatter, temperature=tt)
                openmclib[n].set_fission(libgroup[tt][n].sf, temperature=tt)
                openmclib[n].set_nu_fission(libgroup[tt][n].nusf, temperature=tt)
                openmclib[n].set_chi(libgroup[tt][n].schi, temperature=tt)
    mg_cross_sections_file = openmc.MGXSLibrary(groups)
    mg_cross_sections_file.add_xsdatas([openmclib[o] for o in openmclib])
    mg_cross_sections_file.export_to_hdf5(nameoflib)
Esempio n. 5
0
def build_mgxs_library(convert):
    # Instantiate the energy group data
    groups = openmc.mgxs.EnergyGroups(group_edges=[1e-5, 0.625, 20.0e6])

    # Instantiate the 2-group (C5G7) cross section data
    uo2_xsdata = openmc.XSdata('UO2', groups)
    uo2_xsdata.order = 2
    uo2_xsdata.set_total([2., 2.])
    uo2_xsdata.set_absorption([1., 1.])
    scatter_matrix = np.array([[[0.75, 0.25],
                                [0.00, 1.00]],
                               [[0.75 / 3., 0.25 / 3.],
                                [0.00 / 3., 1.00 / 3.]],
                               [[0.75 / 4., 0.25 / 4.],
                                [0.00 / 4., 1.00 / 4.]]])
    scatter_matrix = np.rollaxis(scatter_matrix, 0, 3)
    uo2_xsdata.set_scatter_matrix(scatter_matrix)
    uo2_xsdata.set_fission([0.5, 0.5])
    uo2_xsdata.set_nu_fission([1., 1.])
    uo2_xsdata.set_chi([1., 0.])

    mg_cross_sections_file = openmc.MGXSLibrary(groups)
    mg_cross_sections_file.add_xsdatas([uo2_xsdata])

    if convert is not None:
        if isinstance(convert[0], list):
            for conv in convert:
                if conv[0] in ['legendre', 'tabular', 'histogram']:
                    mg_cross_sections_file = \
                        mg_cross_sections_file.convert_scatter_format(
                            conv[0], conv[1])
                elif conv[0] in ['angle', 'isotropic']:
                    mg_cross_sections_file = \
                        mg_cross_sections_file.convert_representation(
                            conv[0], conv[1], conv[1])
        elif convert[0] in ['legendre', 'tabular', 'histogram']:
            mg_cross_sections_file = \
                mg_cross_sections_file.convert_scatter_format(
                    convert[0], convert[1])
        elif convert[0] in ['angle', 'isotropic']:
            mg_cross_sections_file = \
                mg_cross_sections_file.convert_representation(
                    convert[0], convert[1], convert[1])

    mg_cross_sections_file.export_to_hdf5()
Esempio n. 6
0
def make_libgroup_macro(nameoflib):
   res,resl, dicel, el, rodel, dolna = make_model()
   libgroup = temp_libgroup(tempdata)
   nuclval = len(resl)
   indexNa = el.index("Na")
   for key, value in dicel.items():
       value[indexNa] = densna(600.0) * 0.6022 / 23 * dolna[key[0]][key[1]]
   for key, value in rodel.items():
       value[indexNa] = densna(600.0) * 0.6022 / 23 * dolna[key[0]][key[1]]
   nuclist, element_from, element_ind, element_val = get_unite_list(resl, el)
   concentration = np.zeros(len(nuclist))
   conc = {}
   temp = {}
   for key,value in res.items():
       t0 = time.time()
       concentration[:nuclval] = value
       for f, i, v in zip(element_from, element_ind, element_val):
           concentration[i] += dicel[key][f] * v
       key_1 = ''+str(key)+''
       conc[key_1] = concentration
       temp[key_1] = 600.0  # for all zones a temperature the same : 600.0
       concentration = 0.0*concentration[:]
       print("Estimated time is {} min".format((time.time() - t0)))
   rodnuclist, element_from, element_ind, element_val = get_unite_list([], el)
   concentration = np.zeros(len(rodnuclist))
   concrod = {}
   temprod = {}
   for key,value in rodel.items():
       t0 = time.time()
       for f, i, v in zip(element_from, element_ind, element_val):
           concentration[i] += rodel[key][f] * v
       key_1 = ''+str(key)+''
       concrod[key_1] = concentration
       temprod[key_1] = 600.0  # for all zones a temperature the same : 600.0
       concentration = 0.0*concentration[:]
       print("Estimated time is {} min".format((time.time() - t0)))
   openmclib = prepare_mg(libgroup, conc, resl, tempdata,
                             groups, temp)
   openmclib.update(prepare_mg(libgroup, concrod, rodnuclist, tempdata,
                                 groups, temprod))
   mg_cross_sections_file = openmc.MGXSLibrary(groups)
   mg_cross_sections_file.add_xsdatas([openmclib[o] for o in openmclib])
   mg_cross_sections_file.export_to_hdf5(nameoflib)
Esempio n. 7
0
def create_library():
    # Instantiate the energy group data and file object
    groups = openmc.mgxs.EnergyGroups(group_edges=[0.0, 0.625, 20.0e6])

    mg_cross_sections_file = openmc.MGXSLibrary(groups, 6)

    # Make the base, isotropic data
    nu = np.array([2.50, 2.50])
    fiss = np.array([0.002817, 0.097])
    capture = np.array([0.008708, 0.02518])
    absorption = capture + fiss
    scatter = np.array([[[0.31980, 0.06694], [0.004555, -0.0003972]],
                        [[0.00000, 0.00000], [0.424100, 0.05439000]]])
    total = np.array([0.33588, 0.54628])
    chi = np.array([1., 0.])
    decay_rate = np.array(
        [0.013336, 0.032739, 0.12078, 0.30278, 0.84949, 2.853])
    delayed_yield = np.array([
        0.00055487, 0.00286407, 0.00273429, 0.0061305, 0.00251342, 0.00105286
    ])
    inv_vel = 1.0 / np.array([1.4e9, 4.4e5])

    mat_1 = openmc.XSdata('mat_1', groups, num_delayed_groups=6)
    mat_1.order = 1
    mat_1.set_fission(fiss)
    mat_1.set_kappa_fission(fiss * 200e6)
    mat_1.set_nu_fission(nu * fiss)
    mat_1.set_beta(delayed_yield / 2.5)
    mat_1.set_decay_rate(decay_rate)
    mat_1.set_absorption(absorption)
    mat_1.set_scatter_matrix(scatter)
    mat_1.set_total(total)
    mat_1.set_chi(chi)
    mat_1.set_inverse_velocity(inv_vel)
    mg_cross_sections_file.add_xsdata(mat_1)

    # Write the file
    mg_cross_sections_file.export_to_hdf5('2g.h5')
Esempio n. 8
0
    0.0000000, 0.2823340, 0.1299400, 0.0006234, 0.0000480, 0.0000074, 0.0000010
], [
    0.0000000, 0.0000000, 0.3452560, 0.2245700, 0.0169990, 0.0026443, 0.0005034
], [
    0.0000000, 0.0000000, 0.0000000, 0.0910284, 0.4155100, 0.0637320, 0.0121390
], [
    0.0000000, 0.0000000, 0.0000000, 0.0000714, 0.1391380, 0.5118200, 0.0612290
], [
    0.0000000, 0.0000000, 0.0000000, 0.0000000, 0.0022157, 0.6999130, 0.5373200
], [
    0.0000000, 0.0000000, 0.0000000, 0.0000000, 0.0000000, 0.1324400, 2.4807000
]]])
scatter_matrix = np.rollaxis(scatter_matrix, 0, 3)
h2o_xsdata.set_scatter_matrix(scatter_matrix)

mg_cross_sections_file = openmc.MGXSLibrary(groups)
mg_cross_sections_file.add_xsdatas([uo2_xsdata, h2o_xsdata])
mg_cross_sections_file.export_to_hdf5()

###############################################################################
# Create materials for the problem

# Instantiate some Macroscopic Data
uo2_data = openmc.Macroscopic('UO2')
h2o_data = openmc.Macroscopic('LWTR')

# Instantiate some Materials and register the appropriate Macroscopic objects
uo2 = openmc.Material(name='UO2 fuel')
uo2.set_density('macro', 1.0)
uo2.add_macroscopic(uo2_data)
Esempio n. 9
0
def create_library():
    # Instantiate the energy group data and file object
    groups = openmc.mgxs.EnergyGroups(group_edges=[0.0, 0.625, 20.0e6])

    mg_cross_sections_file = openmc.MGXSLibrary(groups)

    # Make the base, isotropic data
    nu = [2.50, 2.50]
    fiss = np.array([0.002817, 0.097])
    capture = [0.008708, 0.02518]
    absorption = np.add(capture, fiss)
    scatter = np.array([[[0.31980, 0.06694], [0.004555, -0.0003972]],
                        [[0.00000, 0.00000], [0.424100, 0.05439000]]])
    total = [0.33588, 0.54628]
    chi = [1., 0.]

    mat_1 = openmc.XSdata('mat_1', groups)
    mat_1.order = 1
    mat_1.set_nu_fission(np.multiply(nu, fiss))
    mat_1.set_absorption(absorption)
    mat_1.set_scatter_matrix(scatter)
    mat_1.set_total(total)
    mat_1.set_chi(chi)
    mg_cross_sections_file.add_xsdata(mat_1)

    # Make a version of mat-1 which has a tabular representation of the
    # scattering vice Legendre with 33 points
    mat_2 = mat_1.convert_scatter_format('tabular', 33)
    mat_2.name = 'mat_2'
    mg_cross_sections_file.add_xsdata(mat_2)

    # Make a version of mat-1 which has a histogram representation of the
    # scattering vice Legendre with 33 bins
    mat_3 = mat_1.convert_scatter_format('histogram', 33)
    mat_3.name = 'mat_3'
    mg_cross_sections_file.add_xsdata(mat_3)

    # Make a version which uses a fission matrix vice chi & nu-fission
    mat_4 = openmc.XSdata('mat_4', groups)
    mat_4.order = 1
    mat_4.set_nu_fission(np.outer(np.multiply(nu, fiss), chi))
    mat_4.set_absorption(absorption)
    mat_4.set_scatter_matrix(scatter)
    mat_4.set_total(total)
    mg_cross_sections_file.add_xsdata(mat_4)

    # Make an angle-dependent version of mat_1 with 2 polar and 2 azim. angles
    mat_5 = mat_1.convert_representation('angle', 2, 2)
    mat_5.name = 'mat_5'
    mg_cross_sections_file.add_xsdata(mat_5)

    # Make a copy of mat_1 for testing microscopic cross sections
    mat_6 = openmc.XSdata('mat_6', groups)
    mat_6.order = 1
    mat_6.set_nu_fission(np.multiply(nu, fiss))
    mat_6.set_absorption(absorption)
    mat_6.set_scatter_matrix(scatter)
    mat_6.set_total(total)
    mat_6.set_chi(chi)
    mg_cross_sections_file.add_xsdata(mat_6)

    # Write the file
    mg_cross_sections_file.export_to_hdf5('2g.h5')
Esempio n. 10
0
    def _build_inputs(self):
        # Define materials
        water = openmc.Material(1)
        water.add_nuclide('H1', 2.0)
        water.add_nuclide('O16', 1.0)
        water.add_nuclide('B10', 0.0001)
        if self.is_ce:
            water.add_s_alpha_beta('c_H_in_H2O')
        water.set_density('g/cc', 1.0)

        fuel = openmc.Material(2)
        fuel.add_nuclide('U235', 1.0)
        fuel.add_nuclide('Mo99', 0.1)
        fuel.set_density('g/cc', 4.5)

        materials = openmc.Materials((water, fuel))
        if not self.is_ce:
            materials.cross_sections = 'mg_lib.h5'
        materials.export_to_xml()

        cyl = openmc.ZCylinder(surface_id=1, r=1.0, boundary_type='vacuum')
        top_sphere = openmc.Sphere(surface_id=2,
                                   z0=5.,
                                   r=1.,
                                   boundary_type='vacuum')
        top_plane = openmc.ZPlane(surface_id=3, z0=5.)
        bottom_sphere = openmc.Sphere(surface_id=4,
                                      z0=-5.,
                                      r=1.,
                                      boundary_type='vacuum')
        bottom_plane = openmc.ZPlane(surface_id=5, z0=-5.)

        # Define geometry
        inside_cyl = openmc.Cell(1,
                                 fill=fuel,
                                 region=-cyl & -top_plane & +bottom_plane)
        top_hemisphere = openmc.Cell(2,
                                     fill=water,
                                     region=-top_sphere & +top_plane)
        bottom_hemisphere = openmc.Cell(3,
                                        fill=water,
                                        region=-bottom_sphere & -top_plane)
        root = openmc.Universe(0,
                               cells=(inside_cyl, top_hemisphere,
                                      bottom_hemisphere))

        geometry = openmc.Geometry(root)
        geometry.export_to_xml()

        # Set up stochastic volume calculation
        ll, ur = root.bounding_box
        vol_calcs = [
            openmc.VolumeCalculation(list(root.cells.values()), 100000),
            openmc.VolumeCalculation([water, fuel], 100000, ll, ur),
            openmc.VolumeCalculation([root], 100000, ll, ur),
            openmc.VolumeCalculation(list(root.cells.values()), 100),
            openmc.VolumeCalculation([water, fuel], 100, ll, ur),
            openmc.VolumeCalculation(list(root.cells.values()), 100)
        ]

        vol_calcs[3].set_trigger(self.exp_std_dev, 'std_dev')

        vol_calcs[4].set_trigger(self.exp_rel_err, 'rel_err')

        vol_calcs[5].set_trigger(self.exp_variance, 'variance')

        # Define settings
        settings = openmc.Settings()
        settings.run_mode = 'volume'
        if not self.is_ce:
            settings.energy_mode = 'multi-group'
        settings.volume_calculations = vol_calcs
        settings.export_to_xml()

        # Create the MGXS file if necessary
        if not self.is_ce:
            groups = openmc.mgxs.EnergyGroups(group_edges=[0., 20.e6])
            mg_xs_file = openmc.MGXSLibrary(groups)

            nu = [2.]
            fiss = [1.]
            capture = [1.]
            absorption_fissile = np.add(fiss, capture)
            absorption_other = capture
            scatter = np.array([[[1.]]])
            total_fissile = np.add(absorption_fissile,
                                   np.sum(scatter[:, :, 0], axis=1))
            total_other = np.add(absorption_other,
                                 np.sum(scatter[:, :, 0], axis=1))
            chi = [1.]

            for iso in ['H1', 'O16', 'B10', 'Mo99', 'U235']:
                mat = openmc.XSdata(iso, groups)
                mat.order = 0
                mat.atomic_weight_ratio = \
                    openmc.data.atomic_mass(iso) / openmc.data.NEUTRON_MASS
                mat.set_scatter_matrix(scatter)
                if iso == 'U235':
                    mat.set_nu_fission(np.multiply(nu, fiss))
                    mat.set_absorption(absorption_fissile)
                    mat.set_total(total_fissile)
                    mat.set_chi(chi)
                else:
                    mat.set_absorption(absorption_other)
                    mat.set_total(total_other)
                mg_xs_file.add_xsdata(mat)
            mg_xs_file.export_to_hdf5('mg_lib.h5')
Esempio n. 11
0
def create_1g():
    # Instantiate the energy group data and file object
    groups = GROUP_STRUCT[1]

    mg_cross_sections_file = openmc.MGXSLibrary(groups)

    ###########################################################################
    # PUa, Sec 4.1.1
    nu = 3.24
    fiss = [0.0816]
    capture = [0.019584]
    absorption = np.add(capture, fiss)
    scatter = np.array([[[0.225216]]])
    total = [0.32640]
    chi = [1.]

    PUa = set_it('PUa', groups, 0, fiss, nu, absorption, scatter, total, chi)
    mg_cross_sections_file.add_xsdata(PUa)

    ###########################################################################
    # PUb, Sec 4.1.1
    nu = 2.84
    PUb = set_it('PUb', groups, 0, fiss, nu, absorption, scatter, total, chi)
    mg_cross_sections_file.add_xsdata(PUb)

    ###########################################################################
    # H2O, Sec 4.1.1
    nu = 0.
    fiss = None
    capture = [0.032640]
    absorption = capture
    scatter = np.array([[[0.293760]]])
    total = [0.32640]
    chi = None

    H2O = set_it('H2O', groups, 0, fiss, nu, absorption, scatter, total, chi)
    mg_cross_sections_file.add_xsdata(H2O)

    ###########################################################################
    # Ua, Sec 4.1.2
    nu = 2.70
    fiss = [0.065280]
    capture = [0.013056]
    absorption = np.add(capture, fiss)
    scatter = np.array([[[0.248064]]])
    total = [0.32640]
    chi = [1.]

    Ua = set_it('Ua', groups, 0, fiss, nu, absorption, scatter, total, chi)
    mg_cross_sections_file.add_xsdata(Ua)

    ###########################################################################
    # Ub, Sec 4.1.2
    nu = 2.797101
    Ub = set_it('Ub', groups, 0, fiss, nu, absorption, scatter, total, chi)
    mg_cross_sections_file.add_xsdata(Ub)

    ###########################################################################
    # Uc, Sec 4.1.2
    nu = 2.707308
    Uc = set_it('Uc', groups, 0, fiss, nu, absorption, scatter, total, chi)
    mg_cross_sections_file.add_xsdata(Uc)

    ###########################################################################
    # Ud, Sec 4.1.2
    nu = 2.679198
    Ud = set_it('Ud', groups, 0, fiss, nu, absorption, scatter, total, chi)
    mg_cross_sections_file.add_xsdata(Ud)

    ###########################################################################
    # UD2O, Sec 4.1.3
    nu = 1.70
    fiss = [0.054628]
    capture = [0.027314]
    absorption = np.add(capture, fiss)
    scatter = np.array([[[0.464338]]])
    total = [0.54628]
    chi = [1.]

    UD2O = set_it('UD2O', groups, 0, fiss, nu, absorption, scatter, total, chi)
    mg_cross_sections_file.add_xsdata(UD2O)

    ###########################################################################
    # H2O, Sec 4.1.3
    nu = 0.
    fiss = None
    capture = [0.054628]
    absorption = capture
    scatter = np.array([[[0.491652]]])
    total = [0.54628]
    chi = None

    H2O_2 = set_it('H2O_2', groups, 0, fiss, nu, absorption, scatter, total,
                   chi)
    mg_cross_sections_file.add_xsdata(H2O_2)

    ###########################################################################
    # Ue, Sec 4.1.4
    nu = 2.50
    fiss = [0.06922744]
    capture = [0.01013756]
    absorption = np.add(capture, fiss)
    scatter = np.array([[[0.328042]]])
    total = [0.407407]
    chi = [1.]

    Ue = set_it('Ue', groups, 0, fiss, nu, absorption, scatter, total, chi)
    mg_cross_sections_file.add_xsdata(Ue)

    ###########################################################################
    # Fe, Sec 4.1.4
    nu = 0.
    fiss = None
    capture = [0.00046512]
    absorption = capture
    scatter = np.array([[[0.23209488]]])
    total = [0.23256]
    chi = None

    Fe = set_it('Fe', groups, 0, fiss, nu, absorption, scatter, total, chi)
    mg_cross_sections_file.add_xsdata(Fe)

    ###########################################################################
    # Na, Sec 4.1.4
    nu = 0.
    fiss = None
    capture = [0.0]
    absorption = capture
    scatter = np.array([[[0.086368032]]])
    total = [0.086368032]
    chi = None

    Na = set_it('Na', groups, 0, fiss, nu, absorption, scatter, total, chi)
    mg_cross_sections_file.add_xsdata(Na)

    ###########################################################################
    # PUa-1, Sec 4.1.4
    nu = 2.5
    fiss = [0.266667]
    capture = [0.0]
    absorption = np.add(capture, fiss)
    scatter = np.array([[[0.733333, 0.2]]])
    total = [1.]
    chi = [1.]

    PUa_1 = set_it('PUa1', groups, 1, fiss, nu, absorption, scatter, total,
                   chi)
    mg_cross_sections_file.add_xsdata(PUa_1)

    ###########################################################################
    # PUb-2, Sec 4.2.1
    scatter = np.array([[[0.733333, 0.333333]]])
    PUb_1 = set_it('PUb1', groups, 1, fiss, nu, absorption, scatter, total,
                   chi)
    mg_cross_sections_file.add_xsdata(PUb_1)

    ###########################################################################
    # PUa-2, Sec 4.1.4
    nu = 2.5
    fiss = [0.266667]
    capture = [0.0]
    absorption = np.add(capture, fiss)
    scatter = np.array([[[0.733333, 0.2, 0.075]]])
    total = [1.]
    chi = [1.]

    PUa_2 = set_it('PUa2', groups, 2, fiss, nu, absorption, scatter, total,
                   chi)
    mg_cross_sections_file.add_xsdata(PUa_2)

    ###########################################################################
    # PUb-2, Sec 4.2.1
    scatter = np.array([[[0.733333, 0.333333, 0.125]]])
    PUb_2 = set_it('PUb2', groups, 2, fiss, nu, absorption, scatter, total,
                   chi)
    mg_cross_sections_file.add_xsdata(PUb_2)

    ###########################################################################
    # Ua-1, Sec 4.1.4
    nu = 2.70
    fiss = [0.065280]
    capture = [0.013056]
    absorption = np.add(capture, fiss)
    scatter = np.array([[[0.248064, 0.042432]]])
    total = [0.32640]
    chi = [1.]

    Ua_1 = set_it('Ua1', groups, 1, fiss, nu, absorption, scatter, total, chi)
    mg_cross_sections_file.add_xsdata(Ua_1)

    ###########################################################################
    # Ub-1, Sec 4.2.1
    scatter = np.array([[[0.248064, 0.212160]]])
    Ub_1 = set_it('Ub1', groups, 1, fiss, nu, absorption, scatter, total, chi)
    mg_cross_sections_file.add_xsdata(Ub_1)

    ###########################################################################
    # UD2Oa-1, Sec 4.2.3
    nu = 1.808381
    fiss = [0.054628]
    capture = [0.027314]
    absorption = np.add(capture, fiss)
    scatter = np.array([[[0.464338, 0.056312624]]])
    total = [0.54628]
    chi = [1.]

    UD2Oa = set_it('UD2Oa', groups, 1, fiss, nu, absorption, scatter, total,
                   chi)
    mg_cross_sections_file.add_xsdata(UD2Oa)

    ###########################################################################
    # UD2Ob-1, Sec 4.2.3
    nu = 1.841086
    scatter = np.array([[[0.464338, 0.112982569]]])
    UD2Ob = set_it('UD2Ob', groups, 1, fiss, nu, absorption, scatter, total,
                   chi)
    mg_cross_sections_file.add_xsdata(UD2Ob)

    ###########################################################################
    # UD2Oc-1, Sec 4.2.3
    nu = 1.6964
    scatter = np.array([[[0.464338, -0.27850447]]])
    UD2Oc = set_it('UD2Oc', groups, 1, fiss, nu, absorption, scatter, total,
                   chi)
    mg_cross_sections_file.add_xsdata(UD2Oc)

    mg_cross_sections_file.export_to_hdf5('1g.h5')
Esempio n. 12
0
def create_2g():
    # Instantiate the energy group data and file object
    groups = GROUP_STRUCT[2]

    mg_cross_sections_file = openmc.MGXSLibrary(groups)

    ###########################################################################
    # 5.1.1 Pu
    nu = [3.10, 2.93]
    fiss = np.array([0.0936, 0.08544])
    capture = [0.00480, 0.0144]
    absorption = np.add(capture, fiss)
    scatter = np.array([[[0.0792, 0.0432], [0.00000, 0.23616]]])
    scatter = np.rollaxis(scatter, 0, 3)
    total = [0.2208, 0.3360]
    chi = [0.575, 0.425]

    Pu = set_it('Pu', groups, 0, fiss, nu, absorption, scatter, total, chi)
    mg_cross_sections_file.add_xsdata(Pu)

    ###########################################################################
    # 5.1.2 U
    nu = [2.70, 2.5]
    fiss = np.array([0.06192, 0.06912])
    capture = [0.00384, 0.01344]
    absorption = np.add(capture, fiss)
    scatter = np.array([[[0.078240, 0.0720], [0.00000, 0.26304]]])
    scatter = np.rollaxis(scatter, 0, 3)
    total = [0.2160, 0.3456]
    chi = [0.575, 0.425]

    U = set_it('U', groups, 0, fiss, nu, absorption, scatter, total, chi)
    mg_cross_sections_file.add_xsdata(U)

    ###########################################################################
    # 5.1.3 UAl
    nu = [0.0, 2.830023]
    fiss = np.array([0.0, 0.060706])
    capture = [0.000217, 0.003143]
    absorption = np.add(capture, fiss)
    scatter = np.array([[[0.247516, 0.020432], [0.000000, 1.213127]]])
    scatter = np.rollaxis(scatter, 0, 3)
    total = [0.268165, 1.276976]
    chi = [1.0, 0.0]

    UAl = set_it('UAl', groups, 0, fiss, nu, absorption, scatter, total, chi)
    mg_cross_sections_file.add_xsdata(UAl)

    ###########################################################################
    # 5.1.4 URRa-0
    nu = [2.5, 2.5]
    fiss = np.array([0.0010484, 0.050632])
    capture = [0.0010046, 0.025788]
    absorption = np.add(capture, fiss)
    scatter = np.array([[[0.62568, 0.029227], [0.00000, 2.443830]]])
    scatter = np.rollaxis(scatter, 0, 3)
    total = [0.65696, 2.52025]
    chi = [1., 0.]

    URRa_0 = set_it('URRa0', groups, 0, fiss, nu, absorption, scatter, total,
                    chi)
    mg_cross_sections_file.add_xsdata(URRa_0)

    ###########################################################################
    # 5.1.4 URRb-0
    fiss = np.array([0.000836, 0.029564])
    capture = [0.001104, 0.024069]
    absorption = np.add(capture, fiss)
    scatter = np.array([[[0.838920, 0.046350], [0.000767, 2.918300]]])
    scatter = np.rollaxis(scatter, 0, 3)
    total = [0.88721, 2.9727]
    chi = [1., 0.]

    URRb_0 = set_it('URRb0', groups, 0, fiss, nu, absorption, scatter, total,
                    chi)
    mg_cross_sections_file.add_xsdata(URRb_0)

    ###########################################################################
    # 5.1.4 URRc-0
    fiss = np.array([0.001648, 0.057296])
    capture = [0.001472, 0.029244]
    absorption = np.add(capture, fiss)
    scatter = np.array([[[0.838070, 0.045360], [0.001160, 2.8751]]])
    scatter = np.rollaxis(scatter, 0, 3)
    total = [0.88655, 2.9628]
    chi = [1., 0.]

    URRc_0 = set_it('URRc0', groups, 0, fiss, nu, absorption, scatter, total,
                    chi)
    mg_cross_sections_file.add_xsdata(URRc_0)

    ###########################################################################
    # 5.1.4 H2Oa
    nu = None
    fiss = None
    capture = [0.00074, 0.018564]
    absorption = capture
    scatter = np.array([[[0.839750, 0.04749], [0.000336, 2.96760]]])
    scatter = np.rollaxis(scatter, 0, 3)
    total = [0.88798, 2.9865]
    chi = None

    H2Oa = set_it('H2Oa', groups, 0, fiss, nu, absorption, scatter, total, chi)
    mg_cross_sections_file.add_xsdata(H2Oa)

    ###########################################################################
    # 5.1.4 URRd-0
    nu = [1.004, 2.50]
    fiss = np.array([0.61475, 0.045704])
    capture = [0.0019662, 0.023496]
    absorption = np.add(capture, fiss)
    scatter = np.array([[[0.000000, 0.0342008], [0.000000, 2.0688000]]])
    scatter = np.rollaxis(scatter, 0, 3)
    total = [0.650917, 2.13800]
    chi = [1., 0.]

    URRd_0 = set_it('URRd0', groups, 0, fiss, nu, absorption, scatter, total,
                    chi)
    mg_cross_sections_file.add_xsdata(URRd_0)

    ###########################################################################
    # 5.1.4 H2Ob
    nu = None
    fiss = None
    capture = [8.480293E-6, 0.00016]
    absorption = capture
    scatter = np.array([[[0.1096742149, 0.001000595707],
                         [0.0000000000, 0.363390000000]]])
    scatter = np.rollaxis(scatter, 0, 3)
    total = [0.1106832906, 0.36355]
    chi = None

    H2Ob = set_it('H2Ob', groups, 0, fiss, nu, absorption, scatter, total, chi)
    mg_cross_sections_file.add_xsdata(H2Ob)

    ###########################################################################
    # 5.1.4 H2Oc
    nu = None
    fiss = None
    capture = [4.97229E-4, 0.0188]
    absorption = capture
    scatter = np.array([[[1.226381244, 0.1046395340], [0.0000000000,
                                                       4.35470]]])
    scatter = np.rollaxis(scatter, 0, 3)
    total = [1.331518007, 4.37350]
    chi = None

    H2Oc = set_it('H2Oc', groups, 0, fiss, nu, absorption, scatter, total, chi)
    mg_cross_sections_file.add_xsdata(H2Oc)

    ###########################################################################
    # 5.1.5 UD2O
    nu = [2.50, 2.50]
    fiss = np.array([0.002817, 0.097])
    capture = [0.0087078, 0.02518]
    absorption = np.add(capture, fiss)
    scatter = np.array([[[0.31980, 0.0045552], [0.000000, 0.42410]]])
    scatter = np.rollaxis(scatter, 0, 3)
    total = [0.33588, 0.54628]
    chi = [1., 0.]

    UD2O = set_it('UD2O', groups, 0, fiss, nu, absorption, scatter, total, chi)
    mg_cross_sections_file.add_xsdata(UD2O)

    ###########################################################################
    # 5.2.1 URR-1
    nu = [2.5, 2.5]
    fiss = np.array([0.0010484, 0.050632])
    capture = [0.0010046, 0.025788]
    absorption = np.add(capture, fiss)
    scatter = np.array([[[0.62568, 0.27459], [0.029227, 0.0075737]],
                        [[0.00000, 0.00000], [2.443830, 0.8331800]]])
    total = [0.65696, 2.52025]
    chi = [1., 0.]

    URR_1 = set_it('URR1', groups, 1, fiss, nu, absorption, scatter, total,
                   chi)
    mg_cross_sections_file.add_xsdata(URR_1)

    ###########################################################################
    # 5.2.2 UD2O-1
    nu = [2.50, 2.50]
    fiss = np.array([0.0028172, 0.097])
    capture = [0.0087078, 0.02518]
    absorption = np.add(capture, fiss)
    scatter = np.array([[[0.31980, 0.06694], [0.004555, -0.0003972]],
                        [[0.00000, 0.00000], [0.424100, 0.05439000]]])
    total = [0.33588, 0.54628]
    chi = [1., 0.]

    UD2O_1 = set_it('UD2O1', groups, 1, fiss, nu, absorption, scatter, total,
                    chi)
    mg_cross_sections_file.add_xsdata(UD2O_1)

    # Write the file
    mg_cross_sections_file.export_to_hdf5('2g.h5')
Esempio n. 13
0
            Et = x + y + z + 1.0
            Ec = 0.3*Et
            Es = 0.7*Et
            # assign XSs
            xs.set_total([Et,Et], temperature=294.)
            xs.set_absorption([Ec,Ec], temperature=294.)
            xs.set_nu_fission([0.0,0.0], temperature=294.)
            sct_matrx = [[[0.5*Es, 0.5*Es],
                          [0.0, Es]]]
            sct_matrx = np.array(sct_matrx)
            sct_matrx = np.rollaxis(sct_matrx, 0, 3)
            xs.set_scatter_matrix(sct_matrx, temperature=294.)
            # Add xs to XSDATAS
            XSDATAS.append(xs)

mg_xs_file = openmc.MGXSLibrary(groups)
for i in range(len(XSDATAS)):
    mg_xs_file.add_xsdata(XSDATAS[i])
mg_xs_file.export_to_hdf5('mgxsd.h5')

# Make Materials
materials = {}
for i in range(nxbins):
    for j in range(nybins):
        for k in range(nzbins):
            xsname = str(i)+"."+str(j)+"."+str(k)
            materials[xsname] = openmc.Material(name=xsname)
            materials[xsname].set_density('macro', 1.)
            materials[xsname].add_macroscopic(xsname)

mat_file = openmc.Materials(materials.values())
Esempio n. 14
0
def create_library():
    # Instantiate the energy group data and file object
    groups = openmc.mgxs.EnergyGroups(group_edges=[0.0, 0.625, 20.0e6])
    n_dg = 2

    mg_cross_sections_file = openmc.MGXSLibrary(groups)
    mg_cross_sections_file.num_delayed_groups = n_dg

    beta = np.array([0.003, 0.003])
    one_m_beta = 1. - np.sum(beta)
    nu = [2.50, 2.50]
    fiss = np.array([0.002817, 0.097])
    capture = [0.008708, 0.02518]
    absorption = np.add(capture, fiss)
    scatter = np.array([[[0.31980, 0.06694], [0.004555, -0.0003972]],
                        [[0.00000, 0.00000], [0.424100, 0.05439000]]])
    total = [0.33588, 0.54628]
    chi = [1., 0.]

    # Make the base data that uses chi & nu-fission vectors with a beta
    mat_1 = openmc.XSdata('mat_1', groups)
    mat_1.order = 1
    mat_1.num_delayed_groups = 2
    mat_1.set_beta(beta)
    mat_1.set_nu_fission(np.multiply(nu, fiss))
    mat_1.set_absorption(absorption)
    mat_1.set_scatter_matrix(scatter)
    mat_1.set_total(total)
    mat_1.set_chi(chi)
    mg_cross_sections_file.add_xsdata(mat_1)

    # Make a version that uses prompt and delayed version of nufiss and chi
    mat_2 = openmc.XSdata('mat_2', groups)
    mat_2.order = 1
    mat_2.num_delayed_groups = 2
    mat_2.set_prompt_nu_fission(one_m_beta * np.multiply(nu, fiss))
    delay_nu_fiss = np.zeros((n_dg, groups.num_groups))
    for dg in range(n_dg):
        for g in range(groups.num_groups):
            delay_nu_fiss[dg, g] = beta[dg] * nu[g] * fiss[g]
    mat_2.set_delayed_nu_fission(delay_nu_fiss)
    mat_2.set_absorption(absorption)
    mat_2.set_scatter_matrix(scatter)
    mat_2.set_total(total)
    mat_2.set_chi_prompt(chi)
    mat_2.set_chi_delayed(np.stack([chi] * n_dg))
    mg_cross_sections_file.add_xsdata(mat_2)

    # Make a version that uses a nu-fission matrix with a beta
    mat_3 = openmc.XSdata('mat_3', groups)
    mat_3.order = 1
    mat_3.num_delayed_groups = 2
    mat_3.set_beta(beta)
    mat_3.set_nu_fission(np.outer(np.multiply(nu, fiss), chi))
    mat_3.set_absorption(absorption)
    mat_3.set_scatter_matrix(scatter)
    mat_3.set_total(total)
    mg_cross_sections_file.add_xsdata(mat_3)

    # Make a version that uses prompt and delayed version of the nufiss matrix
    mat_4 = openmc.XSdata('mat_4', groups)
    mat_4.order = 1
    mat_4.num_delayed_groups = 2
    mat_4.set_prompt_nu_fission(one_m_beta *
                                np.outer(np.multiply(nu, fiss), chi))
    delay_nu_fiss = np.zeros((n_dg, groups.num_groups, groups.num_groups))
    for dg in range(n_dg):
        for g in range(groups.num_groups):
            for go in range(groups.num_groups):
                delay_nu_fiss[dg, g, go] = beta[dg] * nu[g] * fiss[g] * chi[go]
    mat_4.set_delayed_nu_fission(delay_nu_fiss)
    mat_4.set_absorption(absorption)
    mat_4.set_scatter_matrix(scatter)
    mat_4.set_total(total)
    mg_cross_sections_file.add_xsdata(mat_4)

    # Make the base data that uses chi & nu-fiss vectors with a group-wise beta
    mat_5 = openmc.XSdata('mat_5', groups)
    mat_5.order = 1
    mat_5.num_delayed_groups = 2
    mat_5.set_beta(np.stack([beta] * groups.num_groups))
    mat_5.set_nu_fission(np.multiply(nu, fiss))
    mat_5.set_absorption(absorption)
    mat_5.set_scatter_matrix(scatter)
    mat_5.set_total(total)
    mat_5.set_chi(chi)
    mg_cross_sections_file.add_xsdata(mat_5)

    # Make a version that uses a nu-fission matrix with a group-wise beta
    mat_6 = openmc.XSdata('mat_6', groups)
    mat_6.order = 1
    mat_6.num_delayed_groups = 2
    mat_6.set_beta(np.stack([beta] * groups.num_groups))
    mat_6.set_nu_fission(np.outer(np.multiply(nu, fiss), chi))
    mat_6.set_absorption(absorption)
    mat_6.set_scatter_matrix(scatter)
    mat_6.set_total(total)
    mg_cross_sections_file.add_xsdata(mat_6)

    # Write the file
    mg_cross_sections_file.export_to_hdf5('2g.h5')
Esempio n. 15
0
    def create_mg_library(self, xs_type='macro', xsdata_names=None,
                          xs_ids=None, tabular_legendre=None,
                          tabular_points=33):
        """Creates an openmc.MGXSLibrary object to contain the MGXS data for the
        Multi-Group mode of OpenMC.

        Parameters
        ----------
        xs_type: {'macro', 'micro'}
            Provide the macro or micro cross section in units of cm^-1 or
            barns. Defaults to 'macro'. If the Library object is not tallied by
            nuclide this will be set to 'macro' regardless.
        xsdata_names : Iterable of str
            List of names to apply to the "xsdata" entries in the
            resultant mgxs data file. Defaults to 'set1', 'set2', ...
        xs_ids : str or Iterable of str
            Cross section set identifier (i.e., '71c') for all
            data sets (if only str) or for each individual one
            (if iterable of str). Defaults to '1m'.
        tabular_legendre : None or bool
            Flag to denote whether or not the Legendre expansion of the
            scattering angular distribution is to be converted to a tabular
            representation by OpenMC.  A value of `True` means that it is to be
            converted while a value of `False` means that it will not be.
            Defaults to `None` which leaves the default behavior of OpenMC in
            place (the distribution is converted to a tabular representation).
        tabular_points : int
            This parameter is not used unless the ``tabular_legendre``
            parameter is set to `True`.  In this case, this parameter sets the
            number of equally-spaced points in the domain of [-1,1] to be used
            in building the tabular distribution. Default is `33`.

        Returns
        -------
        mgxs_file : openmc.MGXSLibrary
            Multi-Group Cross Section File that is ready to be printed to the
            file of choice by the user.

        Raises
        ------
        ValueError
            When the Library object is initialized with insufficient types of
            cross sections for the Library.

        See also
        --------
        Library.dump_to_file()
        Library.create_mg_mode()

        """

        # Check to ensure the Library contains the correct
        # multi-group cross section types
        self.check_library_for_openmc_mgxs()

        cv.check_value('xs_type', xs_type, ['macro', 'micro'])
        if xsdata_names is not None:
            cv.check_iterable_type('xsdata_names', xsdata_names, basestring)
        if xs_ids is not None:
            if isinstance(xs_ids, basestring):
                # If we only have a string lets convert it now to a list
                # of strings.
                xs_ids = [xs_ids for i in range(len(self.domains))]
            else:
                cv.check_iterable_type('xs_ids', xs_ids, basestring)
        else:
            xs_ids = ['1m' for i in range(len(self.domains))]

        # If gathering material-specific data, set the xs_type to macro
        if not self.by_nuclide:
            xs_type = 'macro'

        # Initialize file
        mgxs_file = openmc.MGXSLibrary(self.energy_groups)

        # Create the xsdata object and add it to the mgxs_file
        for i, domain in enumerate(self.domains):
            if self.by_nuclide:
                nuclides = list(domain.get_all_nuclides().keys())
            else:
                nuclides = ['total']
            for nuclide in nuclides:
                # Build & add metadata to XSdata object
                if xsdata_names is None:
                    xsdata_name = 'set' + str(i + 1)
                else:
                    xsdata_name = xsdata_names[i]
                if nuclide is not 'total':
                    xsdata_name += '_' + nuclide

                xsdata = self.get_xsdata(domain, xsdata_name, nuclide=nuclide,
                                         xs_type=xs_type, xs_id=xs_ids[i],
                                         tabular_legendre=tabular_legendre,
                                         tabular_points=tabular_points)

                mgxs_file.add_xsdata(xsdata)

        return mgxs_file
Esempio n. 16
0
    def create_mg_mode(self, xsdata_names=None, xs_ids=None,
                       tabular_legendre=None, tabular_points=33):
        """Creates an openmc.MGXSLibrary object to contain the MGXS data for the
        Multi-Group mode of OpenMC as well as the associated openmc.Materials
        and openmc.Geometry objects. The created Geometry is the same as that
        used to generate the MGXS data, with the only differences being
        modifications to point to newly-created Materials which point to the
        multi-group data. This method only creates a macroscopic
        MGXS Library even if nuclidic tallies are specified in the Library.

        Parameters
        ----------
        xsdata_names : Iterable of str
            List of names to apply to the "xsdata" entries in the
            resultant mgxs data file. Defaults to 'set1', 'set2', ...
        xs_ids : str or Iterable of str
            Cross section set identifier (i.e., '71c') for all
            data sets (if only str) or for each individual one
            (if iterable of str). Defaults to '1m'.
        tabular_legendre : None or bool
            Flag to denote whether or not the Legendre expansion of the
            scattering angular distribution is to be converted to a tabular
            representation by OpenMC.  A value of `True` means that it is to be
            converted while a value of `False` means that it will not be.
            Defaults to `None` which leaves the default behavior of OpenMC in
            place (the distribution is converted to a tabular representation).
        tabular_points : int
            This parameter is not used unless the ``tabular_legendre``
            parameter is set to `True`.  In this case, this parameter sets the
            number of equally-spaced points in the domain of [-1,1] to be used
            in building the tabular distribution. Default is `33`.

        Returns
        -------
        mgxs_file : openmc.MGXSLibrary
            Multi-Group Cross Section File that is ready to be printed to the
            file of choice by the user.
        materials : openmc.Materials
            Materials file ready to be printed with all the macroscopic data
            present within this Library.
        geometry : openmc.Geometry
            Materials file ready to be printed with all the macroscopic data
            present within this Library.

        Raises
        ------
        ValueError
            When the Library object is initialized with insufficient types of
            cross sections for the Library.

        See also
        --------
        Library.create_mg_library()
        Library.dump_to_file()

        """

        # Check to ensure the Library contains the correct
        # multi-group cross section types
        self.check_library_for_openmc_mgxs()

        if xsdata_names is not None:
            cv.check_iterable_type('xsdata_names', xsdata_names, basestring)
        if xs_ids is not None:
            if isinstance(xs_ids, basestring):
                # If we only have a string lets convert it now to a list
                # of strings.
                xs_ids = [xs_ids for i in range(len(self.domains))]
            else:
                cv.check_iterable_type('xs_ids', xs_ids, basestring)
        else:
            xs_ids = ['1m' for i in range(len(self.domains))]
        xs_type = 'macro'

        # Initialize MGXS File
        mgxs_file = openmc.MGXSLibrary(self.energy_groups)

        # Create a copy of the Geometry to differentiate for these Macroscopics
        geometry = copy.deepcopy(self.openmc_geometry)
        materials = openmc.Materials()

        # Get all Cells from the Geometry for differentiation
        all_cells = geometry.get_all_material_cells()

        # Create the xsdata object and add it to the mgxs_file
        for i, domain in enumerate(self.domains):

            # Build & add metadata to XSdata object
            if xsdata_names is None:
                xsdata_name = 'set' + str(i + 1)
            else:
                xsdata_name = xsdata_names[i]

            # Create XSdata and Macroscopic for this domain
            xsdata = self.get_xsdata(domain, xsdata_name, nuclide='total',
                                     xs_type=xs_type, xs_id=xs_ids[i],
                                     tabular_legendre=tabular_legendre,
                                     tabular_points=tabular_points)
            mgxs_file.add_xsdata(xsdata)
            macroscopic = openmc.Macroscopic(name=xsdata_name, xs=xs_ids[i])

            # Create Material and add to collection
            material = openmc.Material(name=xsdata_name + '.' + xs_ids[i])
            material.add_macroscopic(macroscopic)
            materials.append(material)

            # Differentiate Geometry with new Material
            if self.domain_type == 'material':
                # Fill all appropriate Cells with new Material
                for cell in all_cells:
                    if cell.fill.id == domain.id:
                        cell.fill = material

            elif self.domain_type == 'cell':
                for cell in all_cells:
                    if cell.id == domain.id:
                        cell.fill = material

        return mgxs_file, materials, geometry