Exemplo n.º 1
0
    def _build_inputs(self):
        model = openmc.model.Model()

        # settings
        model.settings.batches = 5
        model.settings.inactive = 0
        model.settings.particles = 100

        source = openmc.Source(space=Box([-4, -4, -4], [4, 4, 4]))
        model.settings.source = source

        model.settings.dagmc = True

        model.settings.export_to_xml()

        # geometry
        dag_univ = openmc.DAGMCUniverse("dagmc.h5m", auto_geom_ids=True)
        model.geometry = openmc.Geometry(dag_univ)

        # tally
        tally = openmc.Tally()
        tally.scores = ['total']
        tally.filters = [openmc.CellFilter(2)]
        model.tallies = [tally]

        model.tallies.export_to_xml()
        model.export_to_xml()
Exemplo n.º 2
0
def dagmc_model(request):

    model = openmc.model.Model()

    # settings
    model.settings.batches = 5
    model.settings.inactive = 0
    model.settings.particles = 100
    model.settings.temperature = {'tolerance': 50.0}
    model.settings.verbosity = 1
    source_box = openmc.stats.Box([-4, -4, -4], [4, 4, 4])
    source = openmc.Source(space=source_box)
    model.settings.source = source

    # geometry
    dagmc_universe = openmc.DAGMCUniverse('dagmc.h5m')
    model.geometry = openmc.Geometry(dagmc_universe)

    # tally
    tally = openmc.Tally()
    tally.scores = ['total']
    tally.filters = [openmc.CellFilter(1)]
    model.tallies = [tally]

    # materials
    u235 = openmc.Material(name="no-void fuel")
    u235.add_nuclide('U235', 1.0, 'ao')
    u235.set_density('g/cc', 11)
    u235.id = 40
    u235.temperature = 320

    water = openmc.Material(name="water")
    water.add_nuclide('H1', 2.0, 'ao')
    water.add_nuclide('O16', 1.0, 'ao')
    water.set_density('g/cc', 1.0)
    water.add_s_alpha_beta('c_H_in_H2O')
    water.id = 41

    mats = openmc.Materials([u235, water])
    model.materials = mats

    # location of  dagmc file in test directory
    dagmc_file = request.fspath.dirpath() + "/dagmc.h5m"
    # move to a temporary directory
    with cdtemp():
        shutil.copyfile(dagmc_file, "./dagmc.h5m")
        model.export_to_xml()
        openmc.lib.init()
        yield

    openmc.lib.finalize()
Exemplo n.º 3
0
def model():

    model = openmc.model.Model()

    # settings
    model.settings.batches = 5
    model.settings.inactive = 0
    model.settings.particles = 100

    source_box = openmc.stats.Box([-4, -4, -4], [4, 4, 4])
    source = openmc.Source(space=source_box)

    model.settings.source = source

    model.settings.dagmc = True

    # geometry
    dag_univ = openmc.DAGMCUniverse("dagmc.h5m")
    model.geometry = openmc.Geometry(dag_univ)

    # tally
    tally = openmc.Tally()
    tally.scores = ['total']
    tally.filters = [openmc.CellFilter(1)]
    model.tallies = [tally]

    # materials
    u235 = openmc.Material(name="no-void fuel")
    u235.add_nuclide('U235', 1.0, 'ao')
    u235.set_density('g/cc', 11)
    u235.id = 40

    water = openmc.Material(name="water")
    water.add_nuclide('H1', 2.0, 'ao')
    water.add_nuclide('O16', 1.0, 'ao')
    water.set_density('g/cc', 1.0)
    water.add_s_alpha_beta('c_H_in_H2O')
    water.id = 41

    mats = openmc.Materials([u235, water])
    model.materials = mats

    return model
Exemplo n.º 4
0
    def _build_inputs(self):
        model = openmc.model.Model()

        ### MATERIALS ###
        fuel = openmc.Material(name='no-void fuel')
        fuel.set_density('g/cc', 10.29769)
        fuel.add_nuclide('U234', 0.93120485)
        fuel.add_nuclide('U235', 0.00055815)
        fuel.add_nuclide('U238', 0.022408)
        fuel.add_nuclide('O16', 0.045829)

        cladding = openmc.Material(name='clad')
        cladding.set_density('g/cc', 6.55)
        cladding.add_nuclide('Zr90', 0.021827)
        cladding.add_nuclide('Zr91', 0.00476)
        cladding.add_nuclide('Zr92', 0.0072758)
        cladding.add_nuclide('Zr94', 0.0073734)
        cladding.add_nuclide('Zr96', 0.0011879)

        water = openmc.Material(name='water')
        water.set_density('g/cc', 0.740582)
        water.add_nuclide('H1', 0.049457)
        water.add_nuclide('O16', 0.024672)
        water.add_nuclide('B10', 8.0042e-06)
        water.add_nuclide('B11', 3.2218e-05)
        water.add_s_alpha_beta('c_H_in_H2O')

        model.materials = openmc.Materials([fuel, cladding, water])

        ### GEOMETRY ###
        # create the DAGMC universe
        pincell_univ = openmc.DAGMCUniverse(filename='dagmc.h5m',
                                            auto_geom_ids=True)

        # create a 2 x 2 lattice using the DAGMC pincell
        pitch = np.asarray((24.0, 24.0))
        lattice = openmc.RectLattice()
        lattice.pitch = pitch
        lattice.universes = [[pincell_univ] * 2] * 2
        lattice.lower_left = -pitch

        left = openmc.XPlane(x0=-pitch[0],
                             name='left',
                             boundary_type='reflective')
        right = openmc.XPlane(x0=pitch[0],
                              name='right',
                              boundary_type='reflective')
        front = openmc.YPlane(y0=-pitch[1],
                              name='front',
                              boundary_type='reflective')
        back = openmc.YPlane(y0=pitch[1],
                             name='back',
                             boundary_type='reflective')
        # clip the DAGMC geometry at +/- 10 cm w/ CSG planes
        bottom = openmc.ZPlane(z0=-10.0,
                               name='bottom',
                               boundary_type='reflective')
        top = openmc.ZPlane(z0=10.0, name='top', boundary_type='reflective')

        bounding_region = +left & -right & +front & -back & +bottom & -top
        bounding_cell = openmc.Cell(fill=lattice, region=bounding_region)

        model.geometry = openmc.Geometry([bounding_cell])

        # settings
        model.settings.particles = 100
        model.settings.batches = 10
        model.settings.inactive = 2
        model.settings.output = {'summary': False}

        model.export_to_xml()