Exemplo n.º 1
0
    def __init__(self, *args, **kwargs):
        super(FilterMeshTestHarness, self).__init__(*args, **kwargs)

        # Initialize Meshes
        mesh_1d = openmc.Mesh(mesh_id=1)
        mesh_1d.type = 'regular'
        mesh_1d.dimension = [17]
        mesh_1d.lower_left = [-182.07]
        mesh_1d.upper_right = [182.07]

        mesh_2d = openmc.Mesh(mesh_id=2)
        mesh_2d.type = 'regular'
        mesh_2d.dimension = [17, 17]
        mesh_2d.lower_left = [-182.07, -182.07]
        mesh_2d.upper_right = [182.07, 182.07]

        mesh_3d = openmc.Mesh(mesh_id=3)
        mesh_3d.type = 'regular'
        mesh_3d.dimension = [17, 17, 17]
        mesh_3d.lower_left = [-182.07, -182.07, -183.00]
        mesh_3d.upper_right = [182.07, 182.07, 183.00]

        # Initialize the filters
        mesh_1d_filter = openmc.MeshFilter(mesh_1d)
        mesh_2d_filter = openmc.MeshFilter(mesh_2d)
        mesh_3d_filter = openmc.MeshFilter(mesh_3d)

        # Initialized the tallies
        tally = openmc.Tally(name='tally 1')
        tally.filters = [mesh_1d_filter]
        tally.scores = ['total']
        self._model.tallies.append(tally)

        tally = openmc.Tally(name='tally 2')
        tally.filters = [mesh_1d_filter]
        tally.scores = ['current']
        self._model.tallies.append(tally)

        tally = openmc.Tally(name='tally 3')
        tally.filters = [mesh_2d_filter]
        tally.scores = ['total']
        self._model.tallies.append(tally)

        tally = openmc.Tally(name='tally 4')
        tally.filters = [mesh_2d_filter]
        tally.scores = ['current']
        self._model.tallies.append(tally)

        tally = openmc.Tally(name='tally 5')
        tally.filters = [mesh_3d_filter]
        tally.scores = ['total']
        self._model.tallies.append(tally)

        tally = openmc.Tally(name='tally 6')
        tally.filters = [mesh_3d_filter]
        tally.scores = ['current']
        self._model.tallies.append(tally)
Exemplo n.º 2
0
    def __init__(self, *args, **kwargs):
        super(TallyArithmeticTestHarness, self).__init__(*args, **kwargs)

        # Initialize Mesh
        mesh = openmc.Mesh(mesh_id=1)
        mesh.type = 'regular'
        mesh.dimension = [2, 2, 2]
        mesh.lower_left = [-160.0, -160.0, -183.0]
        mesh.upper_right = [160.0, 160.0, 183.0]

        # Initialize the filters
        energy_filter = openmc.EnergyFilter((0.0, 0.253e-6, 1.0e-3, 1.0, 20.0))
        material_filter = openmc.MaterialFilter((1, 3))
        distrib_filter = openmc.DistribcellFilter(60)
        mesh_filter = openmc.MeshFilter(mesh)

        # Initialized the tallies
        tally = openmc.Tally(name='tally 1')
        tally.filters = [material_filter, energy_filter, distrib_filter]
        tally.scores = ['nu-fission', 'total']
        tally.nuclides = ['U234', 'U235']
        self._model.tallies.append(tally)

        tally = openmc.Tally(name='tally 2')
        tally.filters = [energy_filter, mesh_filter]
        tally.scores = ['total', 'fission']
        tally.nuclides = ['U238', 'U235']
        self._model.tallies.append(tally)
Exemplo n.º 3
0
    def make_tallies(self, r=None):
        if not self.tally:
            return None

        if self.geom == 'IN':
            return None

        # Instantiate a tally mesh
        mesh = openmc.Mesh(mesh_id=1)
        mesh.type = 'regular'
        mesh.dimension = self.mesh_dim
        if self.geom == 'SL' or self.geom == 'ISLC':
            mesh.lower_left = [-r, -INF, -INF]
            mesh.upper_right = [r, INF, INF]

        # Instantiate some tally Filters
        energy_filter = openmc.EnergyFilter(
            GROUP_STRUCT[self.groups].group_edges)
        mesh_filter = openmc.MeshFilter(mesh)

        # Instantiate the Tally
        tally = openmc.Tally(tally_id=1, name='tally 1')
        tally.filters = [energy_filter, mesh_filter]
        tally.scores = ['flux', 'fission', 'nu-fission']

        # Instantiate a Tallies collection, register all Tallies
        tallies_file = openmc.Tallies([tally])

        return tallies_file
Exemplo n.º 4
0
def createTallies(meshname, create=True, load=True):

    # Filters

    # Unstructured mesh to calculate tallies upon
    umesh = openmc.UnstructuredMesh(meshname, create, load)
    mesh_filter = openmc.MeshFilter(umesh)

    # Tallies
    tally = openmc.Tally()
    tally.filters = [mesh_filter]
    tally.scores = ['heating-local', 'flux']
    tally.estimator = 'tracklength'
    tallies = openmc.Tallies([tally])
    tallies.export_to_xml()
    print("Created tallies.xml")
Exemplo n.º 5
0
def model():
    model = openmc.model.Model()

    fuel = openmc.Material()
    fuel.set_density('g/cm3', 10.0)
    fuel.add_nuclide('U234', 1.0)
    fuel.add_nuclide('U235', 4.0)
    fuel.add_nuclide('U238', 95.0)
    water = openmc.Material(name='light water')
    water.add_nuclide('H1', 2.0)
    water.add_nuclide('O16', 1.0)
    water.set_density('g/cm3', 1.0)
    water.add_s_alpha_beta('c_H_in_H2O')
    model.materials.extend([fuel, water])

    cyl1 = openmc.ZCylinder(r=5.0)
    cyl2 = openmc.ZCylinder(r=10.0, boundary_type='vacuum')
    cell1 = openmc.Cell(fill=fuel, region=-cyl1)
    cell2 = openmc.Cell(fill=water, region=+cyl1 & -cyl2)
    model.geometry = openmc.Geometry([cell1, cell2])

    model.settings.batches = 5
    model.settings.inactive = 0
    model.settings.particles = 1000

    mesh = openmc.RegularMesh()
    mesh.dimension = (2, 2)
    mesh.lower_left = (-10.0, -10.0)
    mesh.upper_right = (10.0, 10.0)
    energy_filter = openmc.EnergyFilter((0.0, 10.0, 20.0e6))
    material_filter = openmc.MaterialFilter((fuel, water))
    mesh_filter = openmc.MeshFilter(mesh)

    tally = openmc.Tally(name='tally 1')
    tally.filters = [material_filter, energy_filter]
    tally.scores = ['nu-fission', 'total']
    tally.nuclides = ['U234', 'U235']
    model.tallies.append(tally)
    tally = openmc.Tally(name='tally 2')
    tally.filters = [energy_filter, mesh_filter]
    tally.scores = ['total', 'fission']
    tally.nuclides = ['U238', 'U235']
    model.tallies.append(tally)

    return model
Exemplo n.º 6
0
def create_tally(radius):
    """Create tally mesh???
    """

    tallies_file = openmc.Tallies()

    mesh = openmc.Mesh()
    mesh.dimension = [100, 100]
    mesh.lower_left = [-radius, -radius]
    mesh.upper_right = [radius, radius]

    mesh_filter = openmc.MeshFilter(mesh)
    mesh_filter.mesh = mesh

    tally = openmc.Tally(name='flux')
    tally.filters = [mesh_filter]
    tally.scores = ['flux', 'fission']
    tallies_file.append(tally)
    tallies_file.export_to_xml()
Exemplo n.º 7
0
def test_xml_roundtrip(run_in_tmpdir):
    # Create a tally with all possible gizmos
    mesh = openmc.RegularMesh()
    mesh.lower_left = (-10., -10., -10.)
    mesh.upper_right = (
        10.,
        10.,
        10.,
    )
    mesh.dimension = (5, 5, 5)
    mesh_filter = openmc.MeshFilter(mesh)
    tally = openmc.Tally()
    tally.filters = [mesh_filter]
    tally.nuclides = ['U235', 'I135', 'Li6']
    tally.scores = ['total', 'fission', 'heating']
    tally.derivative = openmc.TallyDerivative(variable='nuclide_density',
                                              material=1,
                                              nuclide='Li6')
    tally.triggers = [openmc.Trigger('rel_err', 0.025)]
    tally.triggers[0].scores = ['total', 'fission']
    tallies = openmc.Tallies([tally])

    # Roundtrip through XML and make sure we get what we started with
    tallies.export_to_xml()
    new_tallies = openmc.Tallies.from_xml()
    assert len(new_tallies) == 1
    new_tally = new_tallies[0]
    assert new_tally.id == tally.id
    assert len(new_tally.filters) == 1
    assert isinstance(new_tally.filters[0], openmc.MeshFilter)
    assert np.allclose(new_tally.filters[0].mesh.lower_left, mesh.lower_left)
    assert new_tally.nuclides == tally.nuclides
    assert new_tally.scores == tally.scores
    assert new_tally.derivative.variable == tally.derivative.variable
    assert new_tally.derivative.material == tally.derivative.material
    assert new_tally.derivative.nuclide == tally.derivative.nuclide
    assert len(new_tally.triggers) == 1
    assert new_tally.triggers[0].trigger_type == tally.triggers[0].trigger_type
    assert new_tally.triggers[0].threshold == tally.triggers[0].threshold
    assert new_tally.triggers[0].scores == tally.triggers[0].scores
Exemplo n.º 8
0
def test_unstructured_mesh(test_opts):

    ### Materials ###
    materials = openmc.Materials()

    fuel_mat = openmc.Material(name="fuel")
    fuel_mat.add_nuclide("U235", 1.0)
    fuel_mat.set_density('g/cc', 4.5)
    materials.append(fuel_mat)

    zirc_mat = openmc.Material(name="zircaloy")
    zirc_mat.add_element("Zr", 1.0)
    zirc_mat.set_density("g/cc", 5.77)
    materials.append(zirc_mat)

    water_mat = openmc.Material(name="water")
    water_mat.add_nuclide("H1", 2.0)
    water_mat.add_nuclide("O16", 1.0)
    water_mat.set_density("atom/b-cm", 0.07416)
    materials.append(water_mat)

    materials.export_to_xml()

    ### Geometry ###
    fuel_min_x = openmc.XPlane(-5.0, name="minimum x")
    fuel_max_x = openmc.XPlane(5.0, name="maximum x")

    fuel_min_y = openmc.YPlane(-5.0, name="minimum y")
    fuel_max_y = openmc.YPlane(5.0, name="maximum y")

    fuel_min_z = openmc.ZPlane(-5.0, name="minimum z")
    fuel_max_z = openmc.ZPlane(5.0, name="maximum z")

    fuel_cell = openmc.Cell(name="fuel")
    fuel_cell.region = +fuel_min_x & -fuel_max_x & \
                       +fuel_min_y & -fuel_max_y & \
                       +fuel_min_z & -fuel_max_z
    fuel_cell.fill = fuel_mat

    clad_min_x = openmc.XPlane(-6.0, name="minimum x")
    clad_max_x = openmc.XPlane(6.0, name="maximum x")

    clad_min_y = openmc.YPlane(-6.0, name="minimum y")
    clad_max_y = openmc.YPlane(6.0, name="maximum y")

    clad_min_z = openmc.ZPlane(-6.0, name="minimum z")
    clad_max_z = openmc.ZPlane(6.0, name="maximum z")

    clad_cell = openmc.Cell(name="clad")
    clad_cell.region = (-fuel_min_x | +fuel_max_x |
                        -fuel_min_y | +fuel_max_y |
                        -fuel_min_z | +fuel_max_z) & \
                        (+clad_min_x & -clad_max_x &
                         +clad_min_y & -clad_max_y &
                         +clad_min_z & -clad_max_z)
    clad_cell.fill = zirc_mat

    if test_opts['external_geom']:
        bounds = (15, 15, 15)
    else:
        bounds = (10, 10, 10)

    water_min_x = openmc.XPlane(x0=-bounds[0],
                                name="minimum x",
                                boundary_type='vacuum')
    water_max_x = openmc.XPlane(x0=bounds[0],
                                name="maximum x",
                                boundary_type='vacuum')

    water_min_y = openmc.YPlane(y0=-bounds[1],
                                name="minimum y",
                                boundary_type='vacuum')
    water_max_y = openmc.YPlane(y0=bounds[1],
                                name="maximum y",
                                boundary_type='vacuum')

    water_min_z = openmc.ZPlane(z0=-bounds[2],
                                name="minimum z",
                                boundary_type='vacuum')
    water_max_z = openmc.ZPlane(z0=bounds[2],
                                name="maximum z",
                                boundary_type='vacuum')

    water_cell = openmc.Cell(name="water")
    water_cell.region = (-clad_min_x | +clad_max_x |
                         -clad_min_y | +clad_max_y |
                         -clad_min_z | +clad_max_z) & \
                         (+water_min_x & -water_max_x &
                          +water_min_y & -water_max_y &
                          +water_min_z & -water_max_z)
    water_cell.fill = water_mat

    # create a containing universe
    geometry = openmc.Geometry([fuel_cell, clad_cell, water_cell])

    ### Tallies ###

    # create meshes
    regular_mesh = openmc.RegularMesh()
    regular_mesh.dimension = (10, 10, 10)
    regular_mesh.lower_left = (-10.0, -10.0, -10.0)
    regular_mesh.upper_right = (10.0, 10.0, 10.0)

    regular_mesh_filter = openmc.MeshFilter(mesh=regular_mesh)

    if test_opts['holes']:
        mesh_filename = "test_mesh_tets_w_holes.h5m"
    else:
        mesh_filename = "test_mesh_tets.h5m"

    uscd_mesh = openmc.UnstructuredMesh(mesh_filename)
    uscd_mesh.mesh_lib = 'moab'
    uscd_filter = openmc.MeshFilter(mesh=uscd_mesh)

    # create tallies
    tallies = openmc.Tallies()

    regular_mesh_tally = openmc.Tally(name="regular mesh tally")
    regular_mesh_tally.filters = [regular_mesh_filter]
    regular_mesh_tally.scores = ['flux']
    regular_mesh_tally.estimator = test_opts['estimator']
    tallies.append(regular_mesh_tally)

    uscd_tally = openmc.Tally(name="unstructured mesh tally")
    uscd_tally.filters = [uscd_filter]
    uscd_tally.scores = ['flux']
    uscd_tally.estimator = test_opts['estimator']
    tallies.append(uscd_tally)

    ### Settings ###
    settings = openmc.Settings()
    settings.run_mode = 'fixed source'
    settings.particles = 100
    settings.batches = 10

    # source setup
    r = openmc.stats.Uniform(a=0.0, b=0.0)
    theta = openmc.stats.Discrete(x=[0.0], p=[1.0])
    phi = openmc.stats.Discrete(x=[0.0], p=[1.0])

    space = openmc.stats.SphericalIndependent(r, theta, phi)
    angle = openmc.stats.Monodirectional((-1.0, 0.0, 0.0))
    energy = openmc.stats.Discrete(x=[15.e+06], p=[1.0])
    source = openmc.Source(space=space, energy=energy, angle=angle)
    settings.source = source

    model = openmc.model.Model(geometry=geometry,
                               materials=materials,
                               tallies=tallies,
                               settings=settings)

    harness = UnstructuredMeshTest('statepoint.10.h5', model,
                                   test_opts['inputs_true'],
                                   test_opts['holes'])
    harness.main()
Exemplo n.º 9
0
def model():

    model = openmc.model.Model()

    fuel = openmc.Material()
    fuel.set_density('g/cm3', 10.0)
    fuel.add_nuclide('U235', 1.0)
    zr = openmc.Material()
    zr.set_density('g/cm3', 1.0)
    zr.add_nuclide('Zr90', 1.0)
    model.materials.extend([fuel, zr])

    box1 = openmc.model.rectangular_prism(10.0, 10.0)
    box2 = openmc.model.rectangular_prism(20.0, 20.0, boundary_type='reflective')
    top = openmc.ZPlane(z0=10.0, boundary_type='vacuum')
    bottom = openmc.ZPlane(z0=-10.0, boundary_type='vacuum')
    cell1 = openmc.Cell(fill=fuel, region=box1 & +bottom & -top)
    cell2 = openmc.Cell(fill=zr, region=~box1 & box2 & +bottom & -top)
    model.geometry = openmc.Geometry([cell1, cell2])

    model.settings.batches = 5
    model.settings.inactive = 0
    model.settings.particles = 1000

    translation = np.array((10, -5, 0))

    llc = np.array([-9, -9, -9])
    urc = np.array([9, 9, 9])

    mesh_dims = (3, 4, 5)

    filters = []

    # un-translated meshes
    reg_mesh = openmc.RegularMesh()
    reg_mesh.dimension = mesh_dims
    reg_mesh.lower_left = llc
    reg_mesh.upper_right = urc

    filters.append(openmc.MeshFilter(reg_mesh))

    recti_mesh = openmc.RectilinearMesh()
    recti_mesh.x_grid = np.linspace(llc[0], urc[0], mesh_dims[0])
    recti_mesh.y_grid = np.linspace(llc[1], urc[1], mesh_dims[1])
    recti_mesh.z_grid = np.linspace(llc[2], urc[2], mesh_dims[2])

    filters.append(openmc.MeshFilter(recti_mesh))

    llc = np.array(llc - translation)
    urc = np.array(urc - translation)

    # translated meshes
    translated_reg_mesh = openmc.RegularMesh()
    translated_reg_mesh.dimension = mesh_dims
    translated_reg_mesh.lower_left = llc
    translated_reg_mesh.upper_right = urc

    filters.append(openmc.MeshFilter(translated_reg_mesh))
    filters[-1].translation = translation

    translated_recti_mesh = openmc.RectilinearMesh()
    translated_recti_mesh.x_grid = np.linspace(llc[0], urc[0], mesh_dims[0])
    translated_recti_mesh.y_grid = np.linspace(llc[1], urc[1], mesh_dims[1])
    translated_recti_mesh.z_grid = np.linspace(llc[2], urc[2], mesh_dims[2])

    filters.append(openmc.MeshFilter(translated_recti_mesh))
    filters[-1].translation = translation

    # Create tallies
    for f in filters:
        tally = openmc.Tally()
        tally.filters = [f]
        tally.scores = ['total']
        model.tallies.append(tally)

    return model
Exemplo n.º 10
0
def test_external_mesh(cpp_driver):

    # Materials
    materials = openmc.Materials()

    fuel_mat = openmc.Material(name="fuel")
    fuel_mat.add_nuclide("U235", 1.0)
    fuel_mat.set_density('g/cc', 4.5)
    materials.append(fuel_mat)

    zirc_mat = openmc.Material(name="zircaloy")
    zirc_mat.add_element("Zr", 1.0)
    zirc_mat.set_density("g/cc", 5.77)
    materials.append(zirc_mat)

    water_mat = openmc.Material(name="water")
    water_mat.add_nuclide("H1", 2.0)
    water_mat.add_nuclide("O16", 1.0)
    water_mat.set_density("atom/b-cm", 0.07416)
    materials.append(water_mat)

    materials.export_to_xml()

    # Geometry
    fuel_min_x = openmc.XPlane(-5.0, name="minimum x")
    fuel_max_x = openmc.XPlane(5.0, name="maximum x")

    fuel_min_y = openmc.YPlane(-5.0, name="minimum y")
    fuel_max_y = openmc.YPlane(5.0, name="maximum y")

    fuel_min_z = openmc.ZPlane(-5.0, name="minimum z")
    fuel_max_z = openmc.ZPlane(5.0, name="maximum z")

    fuel_cell = openmc.Cell(name="fuel")
    fuel_cell.region = +fuel_min_x & -fuel_max_x & \
                       +fuel_min_y & -fuel_max_y & \
                       +fuel_min_z & -fuel_max_z
    fuel_cell.fill = fuel_mat

    clad_min_x = openmc.XPlane(-6.0, name="minimum x")
    clad_max_x = openmc.XPlane(6.0, name="maximum x")

    clad_min_y = openmc.YPlane(-6.0, name="minimum y")
    clad_max_y = openmc.YPlane(6.0, name="maximum y")

    clad_min_z = openmc.ZPlane(-6.0, name="minimum z")
    clad_max_z = openmc.ZPlane(6.0, name="maximum z")

    clad_cell = openmc.Cell(name="clad")
    clad_cell.region = (-fuel_min_x | +fuel_max_x |
                        -fuel_min_y | +fuel_max_y |
                        -fuel_min_z | +fuel_max_z) & \
        (+clad_min_x & -clad_max_x &
         +clad_min_y & -clad_max_y &
         +clad_min_z & -clad_max_z)
    clad_cell.fill = zirc_mat

    bounds = (10, 10, 10)

    water_min_x = openmc.XPlane(x0=-bounds[0],
                                name="minimum x",
                                boundary_type='vacuum')
    water_max_x = openmc.XPlane(x0=bounds[0],
                                name="maximum x",
                                boundary_type='vacuum')

    water_min_y = openmc.YPlane(y0=-bounds[1],
                                name="minimum y",
                                boundary_type='vacuum')
    water_max_y = openmc.YPlane(y0=bounds[1],
                                name="maximum y",
                                boundary_type='vacuum')

    water_min_z = openmc.ZPlane(z0=-bounds[2],
                                name="minimum z",
                                boundary_type='vacuum')
    water_max_z = openmc.ZPlane(z0=bounds[2],
                                name="maximum z",
                                boundary_type='vacuum')

    water_cell = openmc.Cell(name="water")
    water_cell.region = (-clad_min_x | +clad_max_x |
                         -clad_min_y | +clad_max_y |
                         -clad_min_z | +clad_max_z) & \
        (+water_min_x & -water_max_x &
         +water_min_y & -water_max_y &
         +water_min_z & -water_max_z)
    water_cell.fill = water_mat

    # create a containing universe
    geometry = openmc.Geometry([fuel_cell, clad_cell, water_cell])

    # Meshes
    mesh_filename = "test_mesh_tets.h5m"

    # Create a normal unstructured mesh to compare to
    uscd_mesh = openmc.UnstructuredMesh(mesh_filename, 'moab')

    # Create filters
    uscd_filter = openmc.MeshFilter(mesh=uscd_mesh)

    # Tallies
    tallies = openmc.Tallies()
    uscd_tally = openmc.Tally(name="unstructured mesh tally")
    uscd_tally.filters = [uscd_filter]
    uscd_tally.scores = ['flux']
    uscd_tally.estimator = 'tracklength'
    tallies.append(uscd_tally)

    # Settings
    settings = openmc.Settings()
    settings.run_mode = 'fixed source'
    settings.particles = 100
    settings.batches = 10

    # Source setup
    space = openmc.stats.Point()
    angle = openmc.stats.Monodirectional((-1.0, 0.0, 0.0))
    energy = openmc.stats.Discrete(x=[15.e+06], p=[1.0])
    source = openmc.Source(space=space, energy=energy, angle=angle)
    settings.source = source

    model = openmc.model.Model(geometry=geometry,
                               materials=materials,
                               tallies=tallies,
                               settings=settings)

    harness = ExternalMoabTest(cpp_driver, 'statepoint.10.h5', model)

    # Run open MC and check results
    harness.main()
Exemplo n.º 11
0
def model():
    model = openmc.model.Model()

    fuel = openmc.Material()
    fuel.set_density('g/cm3', 10.0)
    fuel.add_nuclide('U235', 1.0)
    zr = openmc.Material()
    zr.set_density('g/cm3', 1.0)
    zr.add_nuclide('Zr90', 1.0)
    model.materials.extend([fuel, zr])

    box1 = openmc.model.rectangular_prism(10.0, 10.0)
    box2 = openmc.model.rectangular_prism(20.0,
                                          20.0,
                                          boundary_type='reflective')
    top = openmc.ZPlane(z0=10.0, boundary_type='vacuum')
    bottom = openmc.ZPlane(z0=-10.0, boundary_type='vacuum')
    cell1 = openmc.Cell(fill=fuel, region=box1 & +bottom & -top)
    cell2 = openmc.Cell(fill=zr, region=~box1 & box2 & +bottom & -top)
    model.geometry = openmc.Geometry([cell1, cell2])

    model.settings.batches = 5
    model.settings.inactive = 0
    model.settings.particles = 1000

    # Create meshes
    mesh_1d = openmc.RegularMesh()
    mesh_1d.dimension = [5]
    mesh_1d.lower_left = [-7.5]
    mesh_1d.upper_right = [7.5]

    mesh_2d = openmc.RegularMesh()
    mesh_2d.dimension = [5, 5]
    mesh_2d.lower_left = [-7.5, -7.5]
    mesh_2d.upper_right = [7.5, 7.5]

    mesh_3d = openmc.RegularMesh()
    mesh_3d.dimension = [5, 5, 5]
    mesh_3d.lower_left = [-7.5, -7.5, -7.5]
    mesh_3d.upper_right = [7.5, 7.5, 7.5]

    recti_mesh = openmc.RectilinearMesh()
    recti_mesh.x_grid = np.linspace(-7.5, 7.5, 18)
    recti_mesh.y_grid = np.linspace(-7.5, 7.5, 18)
    recti_mesh.z_grid = np.logspace(0, np.log10(7.5), 11)

    # Create filters
    reg_filters = [
        openmc.MeshFilter(mesh_1d),
        openmc.MeshFilter(mesh_2d),
        openmc.MeshFilter(mesh_3d),
        openmc.MeshFilter(recti_mesh)
    ]
    surf_filters = [
        openmc.MeshSurfaceFilter(mesh_1d),
        openmc.MeshSurfaceFilter(mesh_2d),
        openmc.MeshSurfaceFilter(mesh_3d),
        openmc.MeshSurfaceFilter(recti_mesh)
    ]

    # Create tallies
    for f1, f2 in zip(reg_filters, surf_filters):
        tally = openmc.Tally()
        tally.filters = [f1]
        tally.scores = ['total']
        model.tallies.append(tally)
        tally = openmc.Tally()
        tally.filters = [f2]
        tally.scores = ['current']
        model.tallies.append(tally)

    return model
Exemplo n.º 12
0
# Set materials volume for depletion. Set to an area for 2D simulations
fuel_material.volume = volume[fuel_material] #+ volume[fuel_hot];

print("Volume:", volume[fuel_material])
###############################################################################

tallies_file = openmc.Tallies()

# XY-MESH
#Creating mesh and mesh filter
mesh_xy = openmc.RegularMesh(mesh_id=1)
mesh_xy.dimension = [200,200,1]
mesh_xy.lower_left = [-100,-100,-1.e50]
mesh_xy.upper_right = [100,100,1.e50]

mesh_filter_xy = openmc.MeshFilter(mesh_xy)
particle_filter = openmc.ParticleFilter(['neutron','photon'], filter_id=2)

#Creating mesh tally
tally_xy = openmc.Tally(name='flux_xy',tally_id=1)
tally_xy.filters = [mesh_filter_xy,particle_filter]
tally_xy.scores = ['flux','fission','nu-fission']
tallies_file.append(tally_xy)


# XZ-MESH
#Creating mesh and mesh filter
mesh_xz = openmc.RegularMesh(mesh_id=2)
mesh_xz.dimension = [200,1,200]
mesh_xz.lower_left = [-100,-1.e50,-100]
mesh_xz.upper_right = [100,1.e50,100]
Exemplo n.º 13
0
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        # Define nuclides and scores to add to both tallies
        self.nuclides = ['U235', 'U238']
        self.scores = ['fission', 'nu-fission']

        # Define filters for energy and spatial domain

        low_energy = openmc.EnergyFilter([0., 0.625])
        high_energy = openmc.EnergyFilter([0.625, 20.e6])
        merged_energies = low_energy.merge(high_energy)

        cell_21 = openmc.CellFilter(21)
        cell_27 = openmc.CellFilter(27)
        distribcell_filter = openmc.DistribcellFilter(21)

        mesh = openmc.RegularMesh(name='mesh')
        mesh.dimension = [2, 2]
        mesh.lower_left = [-50., -50.]
        mesh.upper_right = [+50., +50.]
        mesh_filter = openmc.MeshFilter(mesh)

        self.cell_filters = [cell_21, cell_27]
        self.energy_filters = [low_energy, high_energy]

        # Initialize cell tallies with filters, nuclides and scores
        tallies = []
        for energy_filter in self.energy_filters:
            for cell_filter in self.cell_filters:
                for nuclide in self.nuclides:
                    for score in self.scores:
                        tally = openmc.Tally()
                        tally.estimator = 'tracklength'
                        tally.scores.append(score)
                        tally.nuclides.append(nuclide)
                        tally.filters.append(cell_filter)
                        tally.filters.append(energy_filter)
                        tallies.append(tally)

        # Merge all cell tallies together
        while len(tallies) != 1:
            halfway = len(tallies) // 2
            zip_split = zip(tallies[:halfway], tallies[halfway:])
            tallies = list(map(lambda xy: xy[0].merge(xy[1]), zip_split))

        # Specify a name for the tally
        tallies[0].name = 'cell tally'

        # Initialize a distribcell tally
        distribcell_tally = openmc.Tally(name='distribcell tally')
        distribcell_tally.estimator = 'tracklength'
        distribcell_tally.filters = [distribcell_filter, merged_energies]
        for score in self.scores:
            distribcell_tally.scores.append(score)
        for nuclide in self.nuclides:
            distribcell_tally.nuclides.append(nuclide)

        mesh_tally = openmc.Tally(name='mesh tally')
        mesh_tally.estimator = 'tracklength'
        mesh_tally.filters = [mesh_filter, merged_energies]
        mesh_tally.scores = self.scores
        mesh_tally.nuclides = self.nuclides

        # Add tallies to a Tallies object
        self._model.tallies = [tallies[0], distribcell_tally, mesh_tally]
Exemplo n.º 14
0
entropy_mesh.lower_left = [-0.39218, -0.39218, -1.e50]
entropy_mesh.upper_right = [0.39218, 0.39218, 1.e50]
entropy_mesh.dimension = [10, 10, 1]
settings_file.entropy_mesh = entropy_mesh
settings_file.export_to_xml()


###############################################################################
#                   Exporting to OpenMC tallies.xml file
###############################################################################

# Instantiate a tally mesh
mesh = openmc.Mesh(mesh_id=1)
mesh.type = 'regular'
mesh.dimension = [100, 100, 1]
mesh.lower_left = [-0.62992, -0.62992, -1.e50]
mesh.upper_right = [0.62992, 0.62992, 1.e50]

# Instantiate some tally Filters
energy_filter = openmc.EnergyFilter([0., 4., 20.e6])
mesh_filter = openmc.MeshFilter(mesh)

# Instantiate the Tally
tally = openmc.Tally(tally_id=1, name='tally 1')
tally.filters = [energy_filter, mesh_filter]
tally.scores = ['flux', 'fission', 'nu-fission']

# Instantiate a Tallies collection and export to XML
tallies_file = openmc.Tallies([tally])
tallies_file.export_to_xml()
Exemplo n.º 15
0
mats.export_to_xml()

# Create a 5 cm x 5 cm box filled with iron
box = openmc.model.rectangular_prism(10.0, 10.0, boundary_type='vacuum')
cell = openmc.Cell(fill=iron, region=box)
geometry = openmc.Geometry([cell])
geometry.export_to_xml()

# Tell OpenMC we're going to use our custom source
settings = openmc.Settings()
settings.run_mode = 'fixed source'
settings.batches = 10
settings.particles = 1000
source = openmc.Source()
source.library = 'build/libparameterized_source.so'
source.parameters = 'radius=3.0, energy=14.08e6'
settings.source = source
settings.export_to_xml()

# Finally, define a mesh tally so that we can see the resulting flux
mesh = openmc.RegularMesh()
mesh.lower_left = (-5.0, -5.0)
mesh.upper_right = (5.0, 5.0)
mesh.dimension = (50, 50)

tally = openmc.Tally()
tally.filters = [openmc.MeshFilter(mesh)]
tally.scores = ['flux']
tallies = openmc.Tallies([tally])
tallies.export_to_xml()
Exemplo n.º 16
0
    def create_neutronics_model(self, method: str = None):
        """Uses OpenMC python API to make a neutronics model, including tallies
        (cell_tallies and mesh_tally_2d), simulation settings (batches,
        particles per batch).

        Arguments:
            method: (str): The method to use when making the imprinted and
                merged geometry. Options are "ppp", "trelis", "pymoab".
                Defaults to None.
        """

        self.create_materials()

        self.create_neutronics_geometry(method=method)

        # this is the underlying geometry container that is filled with the
        # faceteted DGAMC CAD model
        self.universe = openmc.Universe()
        geom = openmc.Geometry(self.universe)

        # settings for the number of neutrons to simulate
        settings = openmc.Settings()
        settings.batches = self.simulation_batches
        settings.inactive = 0
        settings.particles = self.simulation_particles_per_batch
        settings.run_mode = "fixed source"
        settings.dagmc = True
        settings.photon_transport = True
        settings.source = self.source
        settings.max_lost_particles = self.max_lost_particles

        # details about what neutrons interactions to keep track of (tally)
        self.tallies = openmc.Tallies()

        if self.mesh_tally_3d is not None:
            mesh_xyz = openmc.RegularMesh(mesh_id=1, name='3d_mesh')
            mesh_xyz.dimension = self.mesh_3D_resolution
            mesh_xyz.lower_left = [
                -self.geometry.largest_dimension,
                -self.geometry.largest_dimension,
                -self.geometry.largest_dimension
            ]

            mesh_xyz.upper_right = [
                self.geometry.largest_dimension,
                self.geometry.largest_dimension,
                self.geometry.largest_dimension
            ]

            for standard_tally in self.mesh_tally_3d:
                if standard_tally == 'tritium_production':
                    score = '(n,Xt)'  # where X is a wild card
                    prefix = 'tritium_production'
                else:
                    score = standard_tally
                    prefix = standard_tally

                mesh_filter = openmc.MeshFilter(mesh_xyz)
                tally = openmc.Tally(name=prefix + '_on_3D_mesh')
                tally.filters = [mesh_filter]
                tally.scores = [score]
                self.tallies.append(tally)

        if self.mesh_tally_2d is not None:

            # Create mesh which will be used for tally
            mesh_xz = openmc.RegularMesh(mesh_id=2, name='2d_mesh_xz')

            mesh_xz.dimension = [
                self.mesh_2D_resolution[1],
                1,
                self.mesh_2D_resolution[0]
            ]

            mesh_xz.lower_left = [
                -self.geometry.largest_dimension,
                -1,
                -self.geometry.largest_dimension
            ]

            mesh_xz.upper_right = [
                self.geometry.largest_dimension,
                1,
                self.geometry.largest_dimension
            ]

            mesh_xy = openmc.RegularMesh(mesh_id=3, name='2d_mesh_xy')
            mesh_xy.dimension = [
                self.mesh_2D_resolution[1],
                self.mesh_2D_resolution[0],
                1
            ]

            mesh_xy.lower_left = [
                -self.geometry.largest_dimension,
                -self.geometry.largest_dimension,
                -1
            ]

            mesh_xy.upper_right = [
                self.geometry.largest_dimension,
                self.geometry.largest_dimension,
                1
            ]

            mesh_yz = openmc.RegularMesh(mesh_id=4, name='2d_mesh_yz')
            mesh_yz.dimension = [
                1,
                self.mesh_2D_resolution[1],
                self.mesh_2D_resolution[0]
            ]

            mesh_yz.lower_left = [
                -1,
                -self.geometry.largest_dimension,
                -self.geometry.largest_dimension
            ]

            mesh_yz.upper_right = [
                1,
                self.geometry.largest_dimension,
                self.geometry.largest_dimension
            ]

            for standard_tally in self.mesh_tally_2d:
                if standard_tally == 'tritium_production':
                    score = '(n,Xt)'  # where X is a wild card
                    prefix = 'tritium_production'
                else:
                    score = standard_tally
                    prefix = standard_tally

                for mesh_filter, plane in zip(
                        [mesh_xz, mesh_xy, mesh_yz], ['xz', 'xy', 'yz']):
                    mesh_filter = openmc.MeshFilter(mesh_filter)
                    tally = openmc.Tally(name=prefix + '_on_2D_mesh_' + plane)
                    tally.filters = [mesh_filter]
                    tally.scores = [score]
                    self.tallies.append(tally)

        if self.cell_tallies is not None:

            for standard_tally in self.cell_tallies:
                if standard_tally == 'TBR':
                    score = '(n,Xt)'  # where X is a wild card
                    sufix = 'TBR'
                    tally = openmc.Tally(name='TBR')
                    tally.scores = [score]
                    self.tallies.append(tally)
                    self._add_tally_for_every_material(sufix, score)

                elif standard_tally == 'spectra':
                    neutron_particle_filter = openmc.ParticleFilter([
                                                                    'neutron'])
                    photon_particle_filter = openmc.ParticleFilter(['photon'])
                    energy_bins = openmc.mgxs.GROUP_STRUCTURES['CCFE-709']
                    energy_filter = openmc.EnergyFilter(energy_bins)

                    self._add_tally_for_every_material(
                        'neutron_spectra',
                        'flux',
                        [neutron_particle_filter, energy_filter]
                    )

                    self._add_tally_for_every_material(
                        'photon_spectra',
                        'flux',
                        [photon_particle_filter, energy_filter]
                    )
                else:
                    score = standard_tally
                    sufix = standard_tally
                    self._add_tally_for_every_material(sufix, score)

        # make the model from gemonetry, materials, settings and tallies
        self.model = openmc.model.Model(
            geom, self.mats, settings, self.tallies)
Exemplo n.º 17
0
def model():
    openmc.reset_auto_ids()
    model = openmc.Model()

    # materials (M4 steel alloy)
    m4 = openmc.Material()
    m4.set_density('g/cc', 2.3)
    m4.add_nuclide('H1', 0.168018676)
    m4.add_nuclide("H2", 1.93244e-05)
    m4.add_nuclide("O16", 0.561814465)
    m4.add_nuclide("O17", 0.00021401)
    m4.add_nuclide("Na23", 0.021365)
    m4.add_nuclide("Al27", 0.021343)
    m4.add_nuclide("Si28", 0.187439342)
    m4.add_nuclide("Si29", 0.009517714)
    m4.add_nuclide("Si30", 0.006273944)
    m4.add_nuclide("Ca40", 0.018026179)
    m4.add_nuclide("Ca42", 0.00012031)
    m4.add_nuclide("Ca43", 2.51033e-05)
    m4.add_nuclide("Ca44", 0.000387892)
    m4.add_nuclide("Ca46", 7.438e-07)
    m4.add_nuclide("Ca48", 3.47727e-05)
    m4.add_nuclide("Fe54", 0.000248179)
    m4.add_nuclide("Fe56", 0.003895875)
    m4.add_nuclide("Fe57", 8.99727e-05)
    m4.add_nuclide("Fe58", 1.19737e-05)

    s0 = openmc.Sphere(r=240)
    s1 = openmc.Sphere(r=250, boundary_type='vacuum')

    c0 = openmc.Cell(fill=m4, region=-s0)
    c1 = openmc.Cell(region=+s0 & -s1)

    model.geometry = openmc.Geometry([c0, c1])

    # settings
    settings = model.settings
    settings.run_mode = 'fixed source'
    settings.particles = 500
    settings.batches = 2
    settings.max_splits = 100
    settings.photon_transport = True
    space = Point((0.001, 0.001, 0.001))
    energy = Discrete([14E6], [1.0])

    settings.source = openmc.Source(space=space, energy=energy)

    # tally
    mesh = openmc.RegularMesh()
    mesh.lower_left = (-240, -240, -240)
    mesh.upper_right = (240, 240, 240)
    mesh.dimension = (3, 5, 7)

    mesh_filter = openmc.MeshFilter(mesh)

    e_bnds = [0.0, 0.5, 2E7]
    energy_filter = openmc.EnergyFilter(e_bnds)

    particle_filter = openmc.ParticleFilter(['neutron', 'photon'])

    tally = openmc.Tally()
    tally.filters = [mesh_filter, energy_filter, particle_filter]
    tally.scores = ['flux']

    model.tallies.append(tally)

    return model
Exemplo n.º 18
0
def model():
    model = openmc.Model()

    # materials (M4 steel alloy)
    m4 = openmc.Material()
    m4.set_density('g/cc', 2.3)
    m4.add_nuclide('H1', 0.168018676)
    m4.add_nuclide("H2", 1.93244e-05)
    m4.add_nuclide("O16", 0.561814465)
    m4.add_nuclide("O17", 0.00021401)
    m4.add_nuclide("Na23", 0.021365)
    m4.add_nuclide("Al27", 0.021343)
    m4.add_nuclide("Si28", 0.187439342)
    m4.add_nuclide("Si29", 0.009517714)
    m4.add_nuclide("Si30", 0.006273944)
    m4.add_nuclide("Ca40", 0.018026179)
    m4.add_nuclide("Ca42", 0.00012031)
    m4.add_nuclide("Ca43", 2.51033e-05)
    m4.add_nuclide("Ca44", 0.000387892)
    m4.add_nuclide("Ca46", 7.438e-07)
    m4.add_nuclide("Ca48", 3.47727e-05)
    m4.add_nuclide("Fe54", 0.000248179)
    m4.add_nuclide("Fe56", 0.003895875)
    m4.add_nuclide("Fe57", 8.99727e-05)
    m4.add_nuclide("Fe58", 1.19737e-05)

    s0 = openmc.Sphere(r=240)
    s1 = openmc.Sphere(r=250, boundary_type='vacuum')

    c0 = openmc.Cell(fill=m4, region=-s0)
    c1 = openmc.Cell(region=+s0 & -s1)

    model.geometry = openmc.Geometry([c0, c1])

    # settings
    settings = model.settings
    settings.run_mode = 'fixed source'
    settings.particles = 200
    settings.batches = 2
    settings.max_splits = 200
    settings.photon_transport = True
    space = Point((0.001, 0.001, 0.001))
    energy = Discrete([14E6], [1.0])

    settings.source = openmc.Source(space=space, energy=energy)

    # tally
    mesh = openmc.RegularMesh()
    mesh.lower_left = (-240, -240, -240)
    mesh.upper_right = (240, 240, 240)
    mesh.dimension = (5, 10, 15)

    mesh_filter = openmc.MeshFilter(mesh)

    e_bnds = [0.0, 0.5, 2E7]
    energy_filter = openmc.EnergyFilter(e_bnds)

    particle_filter = openmc.ParticleFilter(['neutron', 'photon'])

    tally = openmc.Tally()
    tally.filters = [mesh_filter, energy_filter, particle_filter]
    tally.scores = ['flux']

    model.tallies.append(tally)

    # weight windows

    # load pre-generated weight windows
    # (created using the same tally as above)
    ww_n_lower_bnds = np.loadtxt('ww_n.txt')
    ww_p_lower_bnds = np.loadtxt('ww_p.txt')

    # create a mesh matching the one used
    # to generate the weight windows
    ww_mesh = openmc.RegularMesh()
    ww_mesh.lower_left = (-240, -240, -240)
    ww_mesh.upper_right = (240, 240, 240)
    ww_mesh.dimension = (5, 6, 7)

    ww_n = openmc.WeightWindows(ww_mesh,
                                ww_n_lower_bnds,
                                None,
                                10.0,
                                e_bnds,
                                max_lower_bound_ratio=1.5)

    ww_p = openmc.WeightWindows(ww_mesh,
                                ww_p_lower_bnds,
                                None,
                                10.0,
                                e_bnds,
                                max_lower_bound_ratio=1.5)

    model.settings.weight_windows = [ww_n, ww_p]

    return model
Exemplo n.º 19
0
def test_mg_tallies():
    create_library()
    model = slab_mg()

    # Instantiate a tally mesh
    mesh = openmc.RegularMesh(mesh_id=1)
    mesh.dimension = [10, 1, 1]
    mesh.lower_left = [0.0, 0.0, 0.0]
    mesh.upper_right = [929.45, 1000, 1000]

    # Instantiate some tally filters
    energy_filter = openmc.EnergyFilter([0.0, 20.0e6])
    energyout_filter = openmc.EnergyoutFilter([0.0, 20.0e6])
    energies = [0.0, 0.625, 20.0e6]
    matching_energy_filter = openmc.EnergyFilter(energies)
    matching_eout_filter = openmc.EnergyoutFilter(energies)
    mesh_filter = openmc.MeshFilter(mesh)

    mat_filter = openmc.MaterialFilter(model.materials)

    nuclides = model.xs_data

    scores_with_nuclides = [
        'total', 'absorption', 'fission', 'nu-fission', 'inverse-velocity',
        'prompt-nu-fission', 'delayed-nu-fission', 'kappa-fission', 'events',
        'decay-rate'
    ]
    scores_without_nuclides = scores_with_nuclides + ['flux']

    for do_nuclides, scores in ((False, scores_without_nuclides),
                                (True, scores_with_nuclides)):
        t = openmc.Tally()
        t.filters = [mesh_filter]
        t.estimator = 'analog'
        t.scores = scores
        if do_nuclides:
            t.nuclides = nuclides
        model.tallies.append(t)

        t = openmc.Tally()
        t.filters = [mesh_filter]
        t.estimator = 'tracklength'
        t.scores = scores
        if do_nuclides:
            t.nuclides = nuclides
        model.tallies.append(t)

        # Impose energy bins that dont match the MG structure and those
        # that do
        for match_energy_bins in [False, True]:
            if match_energy_bins:
                e_filter = matching_energy_filter
                eout_filter = matching_eout_filter
            else:
                e_filter = energy_filter
                eout_filter = energyout_filter

            t = openmc.Tally()
            t.filters = [mat_filter, e_filter]
            t.estimator = 'analog'
            t.scores = scores + ['scatter', 'nu-scatter']
            if do_nuclides:
                t.nuclides = nuclides
            model.tallies.append(t)

            t = openmc.Tally()
            t.filters = [mat_filter, e_filter]
            t.estimator = 'collision'
            t.scores = scores
            if do_nuclides:
                t.nuclides = nuclides
            model.tallies.append(t)

            t = openmc.Tally()
            t.filters = [mat_filter, e_filter]
            t.estimator = 'tracklength'
            t.scores = scores
            if do_nuclides:
                t.nuclides = nuclides
            model.tallies.append(t)

            t = openmc.Tally()
            t.filters = [mat_filter, e_filter, eout_filter]
            t.scores = ['scatter', 'nu-scatter', 'nu-fission']
            if do_nuclides:
                t.nuclides = nuclides
            model.tallies.append(t)

    harness = MGXSTestHarness('statepoint.10.h5', model)
    harness.main()
Exemplo n.º 20
0
plots = openmc.Plots([p])
plots.export_to_xml()

openmc.plot_geometry()

get_ipython().system('convert coreplot.ppm core1.png')

tallies = openmc.Tallies()
# Create mesh which will be used for tally
mesh_core = openmc.Mesh()
mesh_core.dimension = [21, 1, 1]
mesh_core.lower_left = (-100, -100, 0)
mesh_core.upper_right = (100, 100, 160)
# Create filter for tally
mesh_filtercore = openmc.MeshFilter(mesh_core)
core_filter = openmc.UniverseFilter([a1, a2, a3, a4, ba])
energy_filter = openmc.EnergyFilter([0.0, 1.0, 1.0e5, 2.0e7])
# Create mesh tally to score flux and fission rate
tally_core = openmc.Tally(name='flux')
tally_core.filters = [mesh_filtercore]
tally_core.scores = ['fission-q-prompt']

tallies.append(tally_core)
tallies.export_to_xml()

coretest = openmc.Settings()
coretest.batches = 40
coretest.inactive = 10
coretest.particles = 10000
Exemplo n.º 21
0
def tallies_generation(root):
    """ Creates tallies.xml file

    Parameters
    ----------
    root: openmc.Universe with all the relevant cells for the geometry.

    Returns
    -------
    This function generates the tallies.xml file.
    """
    tallies_file = openmc.Tallies()
    # phase1a-b
    energy_filter_b = openmc.EnergyFilter([1e-6, 20.0e6])
    mesh_b = openmc.RegularMesh(mesh_id=16)
    mesh_b.dimension = [1, 1]
    L = 27.02
    mesh_b.lower_left = [-L, -L]
    mesh_b.upper_right = [L, L]
    mesh_filter_b = openmc.MeshFilter(mesh_b)
    tally_b = openmc.Tally(name='mesh tally b')
    tally_b.filters = [mesh_filter_b, energy_filter_b]
    tally_b.scores = ['delayed-nu-fission', 'nu-fission']
    tallies_file.append(tally_b)
    # phase1a-c
    mesh_no = 0
    for t in range(6):
        mesh_no += 1
        for x in range(2):
            x_trans = t * T['A1']['P']['x']
            y_trans = t * T['A1']['P']['y']
            if x == 1:
                mesh_no += 1
                x_trans += T['A1']['F']['x']
                y_trans += T['A1']['F']['y']
            mesh_c = openmc.RegularMesh(mesh_id=mesh_no)
            mesh_c.dimension = [1, 5]
            mesh_c.lower_left = [
                V['A1']['F']['L']['x'] + x_trans,
                V['A1']['F']['B']['y'] + y_trans
            ]
            mesh_c.upper_right = [
                V['A1']['F']['R']['x'] + x_trans,
                V['A1']['F']['T']['y'] + y_trans
            ]
            mesh_filter_c = openmc.MeshFilter(mesh_c)
            tally_c = openmc.Tally(name='mesh tally c' + str(mesh_no))
            tally_c.filters = [mesh_filter_c]
            tally_c.scores = ['fission']
            tallies_file.append(tally_c)
    # phase 1a-d
    energy_filter_d = openmc.EnergyFilter([1e-5, 3, 1.0e5, 20.0e6])
    mesh_d = openmc.RegularMesh(mesh_id=13)
    mesh_d.dimension = [1, 1]
    L = 27.02
    mesh_d.lower_left = [-L, -L]
    mesh_d.upper_right = [L, L]
    mesh_filter_d = openmc.MeshFilter(mesh_d)
    tally_d = openmc.Tally(name='mesh tally d')
    tally_d.filters = [mesh_filter_d, energy_filter_d]
    tally_d.scores = ['flux', 'nu-fission', 'fission']
    tallies_file.append(tally_d)
    # phase 1a-e
    energy_filter_e = openmc.EnergyFilter([1e-5, 3, 0.1e6, 20.0e6])
    mesh_e = openmc.RegularMesh(mesh_id=14)
    mesh_e.dimension = [100, 100]
    L = 27.02
    mesh_e.lower_left = [-L, -L]
    mesh_e.upper_right = [L, L]
    mesh_filter_e = openmc.MeshFilter(mesh_e)
    tally_e = openmc.Tally(name='mesh tally e')
    tally_e.filters = [mesh_filter_e, energy_filter_e]
    tally_e.scores = ['flux', 'nu-fission', 'fission']
    tallies_file.append(tally_e)
    # phase 1a-f
    energy_filter_f = openmc.EnergyFilter(engs)
    mesh_f = openmc.RegularMesh(mesh_id=15)
    mesh_f.dimension = [1, 1]
    L = 27.02
    mesh_f.lower_left = [-L, -L]
    mesh_f.upper_right = [L, L]
    mesh_filter_f = openmc.MeshFilter(mesh_f)
    tally_f = openmc.Tally(name='mesh tally f')
    tally_f.filters = [mesh_filter_f, energy_filter_f]
    tally_f.scores = ['flux', 'nu-fission', 'fission']
    tallies_file.append(tally_f)

    tallies_file.export_to_xml()
    return