Exemple #1
0
def buildRectangUni(modSetting, pitch, diameter,boron,modT,fuelT,DyFrac,enrich):
    uo2=getU(fuelT,DyFrac,enrich)
    mod=getMod(modSetting,boron,modT) #loads the moderator
    mats = openmc.Materials([uo2, mod])
    mats.export_to_xml()
       
    ####################build the surfaces################################
    fuel_or = openmc.ZCylinder(R=diameter/2)
    box = openmc.get_rectangular_prism(width=pitch, height=pitch,boundary_type='reflective')
        
    #################Build the Cells #######################################
    fuel_region = -fuel_or   #beautiful abuse of operator overloading
    mod_region = box & +fuel_or
    # c
    # c Fuel 
    # c
    # c throwback to MCNP
    fuel = openmc.Cell(1, 'fuel')
    fuel.fill = uo2
    fuel.region = fuel_region
    #
    # Moderator 
    #
    moderator = openmc.Cell(4, 'moderator')
    moderator.fill = mod
    moderator.region = mod_region
       
    #I am groot!
    groot = openmc.Universe(cells=(fuel, moderator))
    geom = openmc.Geometry(groot)
    geom.export_to_xml()
    cell_filter = openmc.CellFilter([fuel, moderator])
    # tallies
    buildTallies(cell_filter)
    return (fuel,moderator)
Exemple #2
0
    def _add_grid_pincells(self):
        """ Adds BEAVRS pincellgrid and assembly gridsleeve pincells """

        # Rectangular prisms for grid spacers
        grid_surfs_tb = \
            openmc.get_rectangular_prism(c.rodGridSide_tb, c.rodGridSide_tb)
        grid_surfs_i = \
            openmc.get_rectangular_prism(c.rodGridSide_i, c.rodGridSide_i)

        # Rectangular prisms for lattice grid sleeves
        grid_surfs_ass = \
            openmc.get_rectangular_prism(c.gridstrapSide, c.gridstrapSide)

        # Grids axial surfaces

        self.s_grid1_bot = openmc.ZPlane(name='Bottom of grid 1',
                                         z0=c.grid1_bot)
        self.s_grid1_top = openmc.ZPlane(name='Top of grid 1', z0=c.grid1_top)
        self.s_grid2_bot = openmc.ZPlane(name='Bottom of grid 2',
                                         z0=c.grid2_bot)
        self.s_grid2_top = openmc.ZPlane(name='Top of grid 2', z0=c.grid2_top)
        self.s_grid3_bot = openmc.ZPlane(name='Bottom of grid 3',
                                         z0=c.grid3_bot)
        self.s_grid3_top = openmc.ZPlane(name='Top of grid 3', z0=c.grid3_top)
        self.s_grid4_bot = openmc.ZPlane(name='Bottom of grid 4',
                                         z0=c.grid4_bot)
        self.s_grid4_top = openmc.ZPlane(name='Top of grid 4', z0=c.grid4_top)
        self.s_grid5_bot = openmc.ZPlane(name='Bottom of grid 5',
                                         z0=c.grid5_bot)
        self.s_grid5_top = openmc.ZPlane(name='Top of grid 5', z0=c.grid5_top)
        self.s_grid6_bot = openmc.ZPlane(name='Bottom of grid 6',
                                         z0=c.grid6_bot)
        self.s_grid6_top = openmc.ZPlane(name='Top of grid 6', z0=c.grid6_top)
        self.s_grid7_bot = openmc.ZPlane(name='Bottom of grid 7',
                                         z0=c.grid7_bot)
        self.s_grid7_top = openmc.ZPlane(name='Top of grid 7', z0=c.grid7_top)
        self.s_grid8_bot = openmc.ZPlane(name='Bottom of grid 8',
                                         z0=c.grid8_bot)
        self.s_grid8_top = openmc.ZPlane(name='Top of grid 8', z0=c.grid8_top)

        # Grids pincell universes

        self.u_grid_i = InfinitePinCell(name='Intermediate grid pincell')
        self.u_grid_i.add_ring(self.mats['Borated Water'],
                               grid_surfs_i,
                               box=True)
        self.u_grid_i.add_last_ring(self.mats['Zircaloy 4'])
        self.u_grid_i.finalize()

        self.u_grid_tb = InfinitePinCell(name='Top/Bottom grid pincell')
        self.u_grid_tb.add_ring(self.mats['Borated Water'],
                                grid_surfs_tb,
                                box=True)
        self.u_grid_tb.add_last_ring(self.mats['Inconel 718'])
        self.u_grid_tb.finalize()

        self.u_grid_sleeve_i = InfinitePinCell(
            name='Intermediate grid sleeve pincell')
        self.u_grid_sleeve_i.add_ring(self.mats['Zircaloy 4'],
                                      grid_surfs_ass,
                                      box=True)
        self.u_grid_sleeve_i.add_last_ring(self.mats['Borated Water'])
        self.u_grid_sleeve_i.finalize()

        self.u_grid_sleeve_tb = InfinitePinCell(
            name='Top/Bottom grid sleeve pincell')
        self.u_grid_sleeve_tb.add_ring(self.mats['Inconel 718'],
                                       grid_surfs_ass,
                                       box=True)
        self.u_grid_sleeve_tb.add_last_ring(self.mats['Borated Water'])
        self.u_grid_sleeve_tb.finalize()

        # Grids axial stack

        self.u_grids = AxialPinCell(name='Grids axial universe')
        self.u_grids.add_axial_section(self.s_struct_supportPlate_bot,
                                       self.mats['Borated Water'])
        self.u_grids.add_axial_section(self.s_struct_lowerNozzle_top,
                                       self.mats['Water SPN'])
        self.u_grids.add_axial_section(self.s_grid1_bot,
                                       self.mats['Borated Water'])
        self.u_grids.add_axial_section(self.s_grid1_top, self.u_grid_tb)
        self.u_grids.add_axial_section(self.s_grid2_bot,
                                       self.mats['Borated Water'])
        self.u_grids.add_axial_section(self.s_grid2_top, self.u_grid_i)
        self.u_grids.add_axial_section(self.s_grid3_bot,
                                       self.mats['Borated Water'])
        self.u_grids.add_axial_section(self.s_grid3_top, self.u_grid_i)
        self.u_grids.add_axial_section(self.s_grid4_bot,
                                       self.mats['Borated Water'])
        self.u_grids.add_axial_section(self.s_grid4_top, self.u_grid_i)
        self.u_grids.add_axial_section(self.s_grid5_bot,
                                       self.mats['Borated Water'])
        self.u_grids.add_axial_section(self.s_grid5_top, self.u_grid_i)
        self.u_grids.add_axial_section(self.s_grid6_bot,
                                       self.mats['Borated Water'])
        self.u_grids.add_axial_section(self.s_grid6_top, self.u_grid_i)
        self.u_grids.add_axial_section(self.s_grid7_bot,
                                       self.mats['Borated Water'])
        self.u_grids.add_axial_section(self.s_grid7_top, self.u_grid_i)
        self.u_grids.add_axial_section(self.s_grid8_bot,
                                       self.mats['Borated Water'])
        self.u_grids.add_axial_section(self.s_grid8_top, self.u_grid_tb)
        self.u_grids.add_axial_section(self.s_struct_upperNozzle_bot,
                                       self.mats['Borated Water'])
        self.u_grids.add_axial_section(self.s_struct_upperNozzle_top,
                                       self.mats['Water SPN'])
        self.u_grids.add_last_axial_section(self.mats['Borated Water'])
        self.u_grids.finalize()

        self.u_gridsleeve = AxialPinCell(name='Grid sleeve axial universe')
        self.u_gridsleeve.add_axial_section(self.s_struct_supportPlate_bot,
                                            self.mats['Borated Water'])
        self.u_gridsleeve.add_axial_section(self.s_struct_lowerNozzle_top,
                                            self.mats['Water SPN'])
        self.u_gridsleeve.add_axial_section(self.s_grid1_bot,
                                            self.mats['Borated Water'])
        self.u_gridsleeve.add_axial_section(self.s_grid1_top,
                                            self.u_grid_sleeve_tb)
        self.u_gridsleeve.add_axial_section(self.s_grid2_bot,
                                            self.mats['Borated Water'])
        self.u_gridsleeve.add_axial_section(self.s_grid2_top,
                                            self.u_grid_sleeve_i)
        self.u_gridsleeve.add_axial_section(self.s_grid3_bot,
                                            self.mats['Borated Water'])
        self.u_gridsleeve.add_axial_section(self.s_grid3_top,
                                            self.u_grid_sleeve_i)
        self.u_gridsleeve.add_axial_section(self.s_grid4_bot,
                                            self.mats['Borated Water'])
        self.u_gridsleeve.add_axial_section(self.s_grid4_top,
                                            self.u_grid_sleeve_i)
        self.u_gridsleeve.add_axial_section(self.s_grid5_bot,
                                            self.mats['Borated Water'])
        self.u_gridsleeve.add_axial_section(self.s_grid5_top,
                                            self.u_grid_sleeve_i)
        self.u_gridsleeve.add_axial_section(self.s_grid6_bot,
                                            self.mats['Borated Water'])
        self.u_gridsleeve.add_axial_section(self.s_grid6_top,
                                            self.u_grid_sleeve_i)
        self.u_gridsleeve.add_axial_section(self.s_grid7_bot,
                                            self.mats['Borated Water'])
        self.u_gridsleeve.add_axial_section(self.s_grid7_top,
                                            self.u_grid_sleeve_i)
        self.u_gridsleeve.add_axial_section(self.s_grid8_bot,
                                            self.mats['Borated Water'])
        self.u_gridsleeve.add_axial_section(self.s_grid8_top,
                                            self.u_grid_sleeve_tb)
        self.u_gridsleeve.add_axial_section(self.s_struct_upperNozzle_bot,
                                            self.mats['Borated Water'])
        self.u_gridsleeve.add_axial_section(self.s_struct_upperNozzle_top,
                                            self.mats['Water SPN'])
        self.u_gridsleeve.add_last_axial_section(self.mats['Borated Water'])
        self.u_gridsleeve.finalize()
Exemple #3
0
def pincellfunction(pitch, enrichment):

    settings = openmc.Settings()
    # Set high tolerance to allow use of lower temperature xs
    settings.temperature['tolerance'] = 10000
    settings.temperature['method'] = 'nearest'
    settings.temperature['multipole'] = True
    settings.cutoff = {'energy': 1e-8}  #energy cutoff in eV

    #############################
    ###       MATERIALS       ###
    #############################
    uo2 = openmc.Material(1, "uo2")
    uo2.add_element('U', 1.0, enrichment=enrichment)
    uo2.add_element('O', 2.0)
    uo2.set_density('g/cm3', 10.97)
    uo2.temperature = 900  #kelvin

    graphite = openmc.Material(2, "graphite")
    graphite.set_density('g/cm3', 1.1995)
    graphite.add_element('C', 1.0)
    graphite.add_s_alpha_beta('c_Graphite')
    graphite.temperature = 600  #kelvin

    mats = openmc.Materials([uo2, graphite])
    mats.export_to_xml()

    #############################
    ###       GEOMETRY        ###
    #############################
    universe = openmc.Universe()

    fuel_or = openmc.ZCylinder(R=0.5)
    fuel_region = -fuel_or
    fuel_cell = openmc.Cell(1, 'fuel')
    fuel_cell.fill = uo2
    fuel_cell.region = fuel_region

    box = openmc.get_rectangular_prism(width=pitch,
                                       height=pitch,
                                       boundary_type='reflective')
    water_region = box & +fuel_or
    moderator = openmc.Cell(2, 'moderator')
    moderator.fill = graphite
    moderator.region = water_region

    root = openmc.Universe(cells=(fuel_cell, moderator))
    geom = openmc.Geometry(root)
    geom.export_to_xml()

    #####################################
    ###        SOURCE/BATCHES         ###
    #####################################
    point = openmc.stats.Point((0, 0, 0))
    src = openmc.Source(space=point)

    settings.source = src
    settings.batches = 100
    settings.inactive = 10
    settings.particles = 1000

    settings.export_to_xml()

    #############################
    ###       TALLIES         ###
    #############################
    # Instantiate an empty Tallies object
    tallies_file = openmc.Tallies()

    # K-Eigenvalue (infinity) tallies
    fiss_rate = openmc.Tally(name='fiss. rate')
    fiss_rate.scores = ['nu-fission']
    tallies_file.append(fiss_rate)

    abs_rate = openmc.Tally(name='abs. rate')
    abs_rate.scores = ['absorption']
    tallies_file.append(abs_rate)

    # Resonance Escape Probability tallies
    therm_abs_rate = openmc.Tally(name='therm. abs. rate')
    therm_abs_rate.scores = ['absorption']
    therm_abs_rate.filters = [openmc.EnergyFilter([0., 0.625])]
    tallies_file.append(therm_abs_rate)

    # Thermal Flux Utilization tallies
    fuel_therm_abs_rate = openmc.Tally(name='fuel therm. abs. rate')
    fuel_therm_abs_rate.scores = ['absorption']
    fuel_therm_abs_rate.filters = [
        openmc.EnergyFilter([0., 0.625]),
        openmc.CellFilter([fuel_cell])
    ]
    tallies_file.append(fuel_therm_abs_rate)

    # Fast Fission Factor tallies
    therm_fiss_rate = openmc.Tally(name='therm. fiss. rate')
    therm_fiss_rate.scores = ['nu-fission']
    therm_fiss_rate.filters = [openmc.EnergyFilter([0., 0.625])]
    tallies_file.append(therm_fiss_rate)

    tallies_file.export_to_xml()

    #############################
    ###       PLOTTING        ###
    #############################
    p = openmc.Plot()
    p.filename = 'pinplot'
    p.width = (pitch, pitch)
    p.pixels = (200, 200)
    p.color_by = 'material'
    p.colors = {uo2: 'yellow', graphite: 'grey'}

    plots = openmc.Plots([p])
    plots.export_to_xml()

    openmc.plot_geometry(output=False)
    pngstring = 'pinplot{}.png'.format(str(pitch))
    subprocess.call(['convert', 'pinplot.ppm', pngstring])
    subprocess.call(['mv', pngstring, 'figures/' + pngstring])

    #############################
    ###       EXECUTION       ###
    #############################
    openmc.run(output=False)
    sp = openmc.StatePoint('statepoint.{}.h5'.format(settings.batches))
    # Collect all the tallies
    fiss_rate = sp.get_tally(name='fiss. rate')
    fiss_rate_df = fiss_rate.get_pandas_dataframe()
    abs_rate = sp.get_tally(name='abs. rate')
    abs_rate_df = abs_rate.get_pandas_dataframe()
    therm_abs_rate = sp.get_tally(name='therm. abs. rate')
    therm_abs_rate_df = therm_abs_rate.get_pandas_dataframe()
    fuel_therm_abs_rate = sp.get_tally(name='fuel therm. abs. rate')
    fuel_therm_abs_rate_df = fuel_therm_abs_rate.get_pandas_dataframe()
    therm_fiss_rate = sp.get_tally(name='therm. fiss. rate')
    therm_fiss_rate_df = therm_fiss_rate.get_pandas_dataframe()

    # Compute k-infinity
    kinf = fiss_rate / abs_rate
    kinf_df = kinf.get_pandas_dataframe()

    # Compute resonance escape probability
    res_esc = (therm_abs_rate) / (abs_rate)
    res_esc_df = res_esc.get_pandas_dataframe()

    # Compute fast fission factor
    fast_fiss = fiss_rate / therm_fiss_rate
    fast_fiss_df = fast_fiss.get_pandas_dataframe()

    # Compute thermal flux utilization
    therm_util = fuel_therm_abs_rate / therm_abs_rate
    therm_util_df = therm_util.get_pandas_dataframe()

    # Compute neutrons produced per absorption
    eta = therm_fiss_rate / fuel_therm_abs_rate
    eta_df = eta.get_pandas_dataframe()

    columns = [
        'pitch', 'enrichment', 'kinf mean', 'kinf sd', 'res_esc mean',
        'res_esc sd', 'fast_fiss mean', 'fast_fiss sd', 'therm_util mean',
        'therm_util sd', 'eta mean', 'eta sd'
    ]
    data = [[
        pitch, enrichment, kinf_df['mean'][0], kinf_df['std. dev.'][0],
        res_esc_df['mean'][0], res_esc_df['std. dev.'][0],
        fast_fiss_df['mean'][0], fast_fiss_df['std. dev.'][0],
        therm_util_df['mean'][0], therm_util_df['std. dev.'][0],
        eta_df['mean'][0], eta_df['std. dev.'][0]
    ]]
    all_tallies = pd.DataFrame(data, columns=columns)

    return all_tallies
Exemple #4
0
fuel_outer_radius = openmc.ZCylinder(x0=0.0, y0=0.0, R=0.39218)
pin_cell_universe = openmc.Universe(name='Fuel Pin')

fuel_cell = openmc.Cell(name='Fuel')
fuel_cell.fill = fuel
fuel_cell.region = -fuel_outer_radius
pin_cell_universe.add_cell(fuel_cell)

moderator_cell = openmc.Cell(name='Moderator')
moderator_cell.fill = water
moderator_cell.region = +fuel_outer_radius
pin_cell_universe.add_cell(moderator_cell)

root_cell = openmc.Cell(name='root cell')
box = openmc.get_rectangular_prism(width=1.26, height=1.26,
                                   boundary_type='reflective')
root_cell.region = box
root_cell.fill = pin_cell_universe

root_universe = openmc.Universe(universe_id=0, name='root universe')
root_universe.add_cell(root_cell)

openmc_geometry = openmc.Geometry(root_universe)
openmc_geometry.export_to_xml()



# ----------------------------------------------------------------------------
# Settings 
# ----------------------------------------------------------------------------
Exemple #5
0
fuel_or = openmc.ZCylinder(R=0.54)
clad_ir = openmc.ZCylinder(R=0.56)
clad_or = openmc.ZCylinder(R=0.60)
z1 = openmc.ZPlane(z0=0)
z2 = openmc.ZPlane(z0=60)
z3 = openmc.ZPlane(z0=150)
z4 = openmc.ZPlane(z0=165)
z5 = openmc.ZPlane(z0=-0.4)
z6 = openmc.ZPlane(z0=165.4)
z7 = openmc.ZPlane(z0=82.5)
z8 = openmc.ZPlane(z0=123.95)
z9 = openmc.ZPlane(z0=41.05)
top = openmc.ZPlane(z0=200, boundary_type='vacuum')
bottom = openmc.ZPlane(z0=-200, boundary_type='vacuum')
box = openmc.get_rectangular_prism(width=400,
                                   height=400,
                                   boundary_type='vacuum')
type(box)

#region
fuel_region = -fuel_or & +z2 & -z3
gap_region = +fuel_or & -clad_ir & +z2 & -z3
clad_region = +clad_ir & -clad_or & +z1 & -z4 | -clad_or & -z1 & +z5 | -clad_or & -z6 & +z4
gas_region = -clad_ir & +z1 & -z2 | -clad_ir & -z4 & +z3
pin_region = -clad_or & +z5 & -z6
coolant_region = ~pin_region & -top & +bottom & box
control_region = -clad_or & -z6 & +z5
steel_region = -z6 & +z5
controlvoid_region = ~control_region

#cell
Exemple #6
0
    def _add_assembly_surfs(self):
        """ Adds BEAVRS assebly surfaces - these include the assembly pitch"""

        # Rectangular prism around the edge of the pinlattice
        self.assem_surfs = \
            openmc.get_rectangular_prism(c.latticePitch, c.latticePitch)
Exemple #7
0
    def _add_lattice_surfs(self):
        """ Adds BEAVRS lattice surfaces """

        # Rectangular prism around the edge of the pinlattice
        self.lattice_surfs = \
            openmc.get_rectangular_prism(17*c.pinPitch, 17*c.pinPitch)