Ejemplo n.º 1
0
            F_cell_new.translation = (x_trans, y_trans, 0)
            all_F_univ.add_cell(F_cell_new)
            all_F_regions |= F_region_new
            P_areas.region &= ~F_region_new
            D_areas.region &= ~F_region_new
            H_cell.region &= ~F_region_new
F_areas = openmc.Cell(
    fill=all_F_univ,
    region=all_F_regions & -
    top_surface & +
    bot_surface)

# Spacer
all_S_univ = openmc.Universe()
S_small_spacer_surf = openmc.ZCylinder(
    r=S_small_r,
    x0=-D_to_center_width - S_A1_D_gap,
    y0=-D_to_center - P_small_gap)  # initialize
all_S_regions = -S_small_spacer_surf & + \
    plane(V['A1']['P']['T']['m'], V['A1']['P']['T']['x'], V['A1']['P']['T']['y'])

# outer loop is for 3 types of spacers, small top, big middle, small bottom
rad = [S_small_r, S_large_r, S_small_r]
start = [0, 1, 5]
end = [1, 6, 6]
C = ['C', 'C', 'Cb']
for y in range(3):
    for area in range(3):
        area_str = 'A{}'.format(area + 1)
        S_cylinder = openmc.ZCylinder(r=rad[y],
                                      x0=V[area_str]['S'][C[y]]['x0'],
                                      y0=V[area_str]['S'][C[y]]['y0'])
Ejemplo n.º 2
0
zirc4.add_nuclide('Hf178', 6.03806E-07)
zirc4.add_nuclide('Hf179', 3.01460E-07)
zirc4.add_nuclide('Hf180', 7.76449E-07)

water_600 = openmc.Material(name='Borated water at 600 K with 1300 ppm')
water_600.add_nuclide('O16', 2.20729E-02)
water_600.add_nuclide('H1', 4.41459E-02)
water_600.add_nuclide('B10', 9.52537E-06)
water_600.add_nuclide('B11', 3.83408E-05)
water_600.add_s_alpha_beta('c_H_in_H2O')

###############################################################################
# Geometry

# Instantiate zCylinder surfaces
fuel_or = openmc.ZCylinder(r=0.4096, name='Fuel OR')
clad_ir = openmc.ZCylinder(r=0.4180, name='Clad IR')
clad_or = openmc.ZCylinder(r=0.4750, name='Clad OR')
gt_ir = openmc.ZCylinder(r=0.5610, name='Guide Tube IR')
gt_or = openmc.ZCylinder(r=0.6020, name='Guide Tube OR')

assembly_left = openmc.XPlane(x0=-10.75, boundary_type='reflective')
assembly_right = openmc.XPlane(x0=10.75, boundary_type='reflective')
assembly_back = openmc.YPlane(y0=-10.75, boundary_type='reflective')
assembly_front = openmc.YPlane(y0=10.75, boundary_type='reflective')
assembly_bottom = openmc.ZPlane(z0=-200.0, boundary_type='reflective')
assembly_top = openmc.ZPlane(z0=200.0, boundary_type='reflective')

lattice_left = openmc.XPlane(x0=-10.71)
lattice_right = openmc.XPlane(x0=10.71)
lattice_back = openmc.YPlane(y0=-10.71)
Ejemplo n.º 3
0
def simulate(n_particles, seed, e_min=1E-03, plot=False, verbose=False):

    # set random number seed
    np.random.seed(seed)

    particle_generator = ParticleGenerator()

    # materials
    uo2 = openmc.Material(name='UO2 fuel at 2.4% wt enrichment')
    uo2.set_density('g/cm3', 5.29769)
    uo2.add_element('U', 1., enrichment=2.4)
    uo2.add_element('O', 2.)

    zircaloy = openmc.Material(name='Zircaloy 4')
    zircaloy.set_density('g/cm3', 6.55)
    zircaloy.add_element('Sn', 0.014, 'wo')
    zircaloy.add_element('Fe', 0.00165, 'wo')
    zircaloy.add_element('Cr', 0.001, 'wo')
    zircaloy.add_element('Zr', 0.98335, 'wo')

    borated_water = openmc.Material(name='Borated water')
    borated_water.set_density('g/cm3', 0.740582)
    borated_water.add_element('B', 4.0e-5)
    borated_water.add_element('H', 5.0e-2)
    borated_water.add_element('O', 2.4e-2)

    # simple pincell geometry
    fuel_cyl = openmc.ZCylinder(r=1.5)
    clad_cyl = openmc.ZCylinder(r=1.7)
    boundary = openmc.ZCylinder(r=2.0)

    fuel_cell = openmc.Cell(region=-fuel_cyl, fill=uo2)
    clad_cell = openmc.Cell(region=+fuel_cyl & -clad_cyl, fill=zircaloy)
    water_cell = openmc.Cell(region=+clad_cyl & -boundary, fill=borated_water)

    geom = openmc.Geometry([fuel_cell, clad_cell, water_cell])

    print("Computing material cross-sections...")
    xs_dict = {}
    for material in geom.get_all_materials().values():
        e_grid, xs = calculate_cexs(material, 'material', ('total', ))
        xs_dict[material] = CEXS(e_grid, xs[0])

    print("Computing majorant cross-section...")
    e_grid, majorants = majorants_from_geometry(geom)

    if plot:
        plot_majorant(e_grid, majorants)

    majorant = Majorant.from_others(e_grid, majorants)

    print("Running particles...")

    # transport loop
    for _ in atpbar(range(n_particles)):
        p = particle_generator()
        while p.e > e_min:
            maj_xs = majorant.calculate_xs(p.e)
            p.advance(maj_xs)
            p.locate(geom)

            if not p.cell:
                print('Particle left geometry')
                break

            p.calculate_xs(xs_dict)

            if p.xs > maj_xs:
                raise RuntimeError("Total XS value {} b is greater than the "
                                   "majorant value ({} b).".format(
                                       p.xs, maj_xs))

            if rand() < p.xs / maj_xs:
                p.scatter()

        if verbose:
            print(p)
Ejemplo n.º 4
0
    def _read_surfaces(self):
        self.n_surfaces = self._f['geometry/n_surfaces'].value

        # Initialize dictionary for each Surface
        # Keys     - Surface keys
        # Values   - Surfacee objects
        self.surfaces = {}

        for key in self._f['geometry/surfaces'].keys():
            if key == 'n_surfaces':
                continue

            surface_id = int(key.lstrip('surface '))
            index = self._f['geometry/surfaces'][key]['index'].value
            name = self._f['geometry/surfaces'][key]['name'].value.decode()
            surf_type = self._f['geometry/surfaces'][key]['type'].value.decode(
            )
            bc = self._f['geometry/surfaces'][key][
                'boundary_condition'].value.decode()
            coeffs = self._f['geometry/surfaces'][key]['coefficients'][...]

            # Create the Surface based on its type
            if surf_type == 'x-plane':
                x0 = coeffs[0]
                surface = openmc.XPlane(surface_id, bc, x0, name)

            elif surf_type == 'y-plane':
                y0 = coeffs[0]
                surface = openmc.YPlane(surface_id, bc, y0, name)

            elif surf_type == 'z-plane':
                z0 = coeffs[0]
                surface = openmc.ZPlane(surface_id, bc, z0, name)

            elif surf_type == 'plane':
                A = coeffs[0]
                B = coeffs[1]
                C = coeffs[2]
                D = coeffs[3]
                surface = openmc.Plane(surface_id, bc, A, B, C, D, name)

            elif surf_type == 'x-cylinder':
                y0 = coeffs[0]
                z0 = coeffs[1]
                R = coeffs[2]
                surface = openmc.XCylinder(surface_id, bc, y0, z0, R, name)

            elif surf_type == 'y-cylinder':
                x0 = coeffs[0]
                z0 = coeffs[1]
                R = coeffs[2]
                surface = openmc.YCylinder(surface_id, bc, x0, z0, R, name)

            elif surf_type == 'z-cylinder':
                x0 = coeffs[0]
                y0 = coeffs[1]
                R = coeffs[2]
                surface = openmc.ZCylinder(surface_id, bc, x0, y0, R, name)

            elif surf_type == 'sphere':
                x0 = coeffs[0]
                y0 = coeffs[1]
                z0 = coeffs[2]
                R = coeffs[3]
                surface = openmc.Sphere(surface_id, bc, x0, y0, z0, R, name)

            elif surf_type in ['x-cone', 'y-cone', 'z-cone']:
                x0 = coeffs[0]
                y0 = coeffs[1]
                z0 = coeffs[2]
                R2 = coeffs[3]

                if surf_type == 'x-cone':
                    surface = openmc.XCone(surface_id, bc, x0, y0, z0, R2,
                                           name)
                if surf_type == 'y-cone':
                    surface = openmc.YCone(surface_id, bc, x0, y0, z0, R2,
                                           name)
                if surf_type == 'z-cone':
                    surface = openmc.ZCone(surface_id, bc, x0, y0, z0, R2,
                                           name)

            elif surf_type == 'quadric':
                a, b, c, d, e, f, g, h, j, k = coeffs
                surface = openmc.Quadric(surface_id, bc, a, b, c, d, e, f, g,
                                         h, j, k, name)

            # Add Surface to global dictionary of all Surfaces
            self.surfaces[index] = surface
Ejemplo n.º 5
0
borated_water = openmc.Material(name='Borated Water')
borated_water.set_density('g/cm3', 0.740582)
borated_water.add_nuclide('B10', 8.0042e-6)
borated_water.add_nuclide('B11', 3.2218e-5)
borated_water.add_nuclide('H1', 4.9457e-2)
borated_water.add_nuclide('O16', 2.4672e-2)
borated_water.add_s_alpha_beta('HH2O')

# Instantiate a MaterialsFile, register all Materials, and export to XML
materials_file = openmc.Materials([uo2, helium, zircaloy, borated_water])
materials_file.default_xs = '71c'

###################   Exporting to OpenMC geometry.xml File  ###################

# Instantiate ZCylinder surfaces
fuel_or = openmc.ZCylinder(x0=0, y0=0, R=0.39218, name='Fuel OR')
clad_ir = openmc.ZCylinder(x0=0, y0=0, R=0.40005, name='Clad IR')
clad_or = openmc.ZCylinder(x0=0, y0=0, R=0.45720, name='Clad OR')
min_x = openmc.XPlane(x0=-0.62992, name='min x')
max_x = openmc.XPlane(x0=+0.62992, name='max x')
min_y = openmc.YPlane(y0=-0.62992, name='min y')
max_y = openmc.YPlane(y0=+0.62992, name='max y')
min_z = openmc.ZPlane(z0=-0.62992, name='min z')
max_z = openmc.ZPlane(z0=+0.62992, name='max z')

min_x.boundary_type = 'reflective'
max_x.boundary_type = 'reflective'
min_y.boundary_type = 'reflective'
max_y.boundary_type = 'reflective'
min_z.boundary_type = 'reflective'
max_z.boundary_type = 'reflective'
Ejemplo n.º 6
0
# Instantiate a MaterialsFile, register all Materials, and export to XML
materials_file = openmc.MaterialsFile()
materials_file.default_xs = '71c'
materials_file.add_materials([moderator, fuel])
materials_file.export_to_xml()

###############################################################################
#                 Exporting to OpenMC geometry.xml File
###############################################################################

# Instantiate Surfaces
left = openmc.XPlane(surface_id=1, x0=-2, name='left')
right = openmc.XPlane(surface_id=2, x0=2, name='right')
bottom = openmc.YPlane(surface_id=3, y0=-2, name='bottom')
top = openmc.YPlane(surface_id=4, y0=2, name='top')
fuel1 = openmc.ZCylinder(surface_id=5, x0=0, y0=0, R=0.4)
fuel2 = openmc.ZCylinder(surface_id=6, x0=0, y0=0, R=0.3)
fuel3 = openmc.ZCylinder(surface_id=7, x0=0, y0=0, R=0.2)

left.boundary_type = 'vacuum'
right.boundary_type = 'vacuum'
top.boundary_type = 'vacuum'
bottom.boundary_type = 'vacuum'

# Instantiate Cells
cell1 = openmc.Cell(cell_id=1, name='Cell 1')
cell2 = openmc.Cell(cell_id=101, name='cell 2')
cell3 = openmc.Cell(cell_id=102, name='cell 3')
cell4 = openmc.Cell(cell_id=201, name='cell 4')
cell5 = openmc.Cell(cell_id=202, name='cell 5')
cell6 = openmc.Cell(cell_id=301, name='cell 6')
Ejemplo n.º 7
0
    def initial(self, opt, Mesh):  #, nthreads):

        #####################################
        # Create OpenMC geometry
        #####################################

        FuelOR = opt.FuelOR * 100  #[cm]
        CladIR = opt.CladIR * 100  #[cm]
        CladOR = opt.CladOR * 100  #[cm]
        # ExtraCladOR = opt.ExtraCladOR*100 #[cm]
        Pitch = opt.PinPitch * 100  #[cm]

        # Construct uniform initial source distribution over fissionable zones
        lower_left = [-Pitch / 2, -Pitch / 2, 0]
        upper_right = [+Pitch / 2, +Pitch / 2, +365.76]
        uniform_dist = openmc.stats.Box(lower_left,
                                        upper_right,
                                        only_fissionable=True)

        # Settings file
        self.settings_file = openmc.Settings()
        self.settings_file.batches = 1100
        self.settings_file.inactive = 100
        self.settings_file.particles = 20000
        self.settings_file.generations_per_batch = 5
        self.settings_file.output = {'tallies': False}
        self.settings_file.temperature = {'multipole': True, 'tolerance': 3000}
        self.settings_file.source = openmc.source.Source(space=uniform_dist)
        self.settings_file.seed = np.random.randint(1, 100)  # for correlation

        self.settings_file.export_to_xml()  #Removed for correlation

        # Materials file
        uo2 = openmc.Material(material_id=1,
                              name='UO2 fuel at 2.4% wt enrichment')
        uo2.temperature = 900.  #opt.Tin
        uo2.set_density('g/cm3', 10.29769)
        uo2.add_element('U', 1., enrichment=2.4)
        uo2.add_element('O', 2.)

        # helium = openmc.Material(material_id=2, name='Helium for gap')
        # helium.temperature = opt.Tin
        # helium.set_density('g/cm3', 0.001598)
        # helium.add_element('He', 2.4044e-4)

        zircaloy = openmc.Material(material_id=3, name='Zircaloy 4')
        zircaloy.temperature = opt.Tin
        zircaloy.set_density('g/cm3', 6.55)
        zircaloy.add_element('Sn', 0.014, 'wo')
        zircaloy.add_element('Fe', 0.00165, 'wo')
        zircaloy.add_element('Cr', 0.001, 'wo')
        zircaloy.add_element('Zr', 0.98335, 'wo')

        # borated_water = openmc.Material()
        # borated_water.temperature = opt.Tin
        # borated_water.set_density('g/cm3', 0.7406)
        # borated_water.add_element('B', 4.0e-5)
        # borated_water.add_element('H', 5.0e-2)
        # borated_water.add_element('O', 2.4e-2)
        # borated_water.add_s_alpha_beta('c_H_in_H2O')
        borated_water = openmc.model.borated_water(boron_ppm=432.473,
                                                   temperature=opt.Tin,
                                                   pressure=15)

        self.materials_file = openmc.Materials([uo2, zircaloy,
                                                borated_water])  #helium
        self.materials_file.export_to_xml()  #Removed for correlation

        # Geometry file
        fuel_or = openmc.ZCylinder(x0=0, y0=0, R=FuelOR)
        # clad_ir = openmc.ZCylinder(x0=0, y0=0, R=CladIR)
        clad_or = openmc.ZCylinder(x0=0, y0=0, R=CladOR)
        # extra_clad_or = openmc.ZCylinder(x0=0, y0=0, R=ExtraCladOR)
        left = openmc.XPlane(x0=-Pitch / 2)
        right = openmc.XPlane(x0=Pitch / 2)
        back = openmc.YPlane(y0=-Pitch / 2)
        front = openmc.YPlane(y0=Pitch / 2)
        top = openmc.ZPlane(z0=396.24)
        bottom = openmc.ZPlane(z0=-30.48)
        z_list = []
        for i in range(0, len(Mesh)):
            z_list.append(openmc.ZPlane(z0=Mesh[i]))

        left.boundary_type = 'reflective'
        right.boundary_type = 'reflective'
        front.boundary_type = 'reflective'
        back.boundary_type = 'reflective'
        top.boundary_type = 'vacuum'
        bottom.boundary_type = 'vacuum'
        # z_list[-1].boundary_type = 'vacuum'
        # z_list[0].boundary_type = 'vacuum'

        self.reflectTOP = openmc.Cell()
        self.reflectBOT = openmc.Cell()
        self.fuel_list = []
        # self.gap_list = []
        self.clad_list = []
        # self.extra_clad_list = []
        self.water_list = []
        for i in range(0, len(Mesh) - 1):
            self.fuel_list.append(openmc.Cell())
            # self.gap_list.append(openmc.Cell())
            self.clad_list.append(openmc.Cell())
            # self.extra_clad_list.append(openmc.Cell())
            self.water_list.append(openmc.Cell())

        self.reflectTOP.region = +left & -right & +back & -front & +z_list[
            -1] & -top
        self.reflectBOT.region = +left & -right & +back & -front & +bottom & -z_list[
            0]

        self.reflectTOP.fill = borated_water
        self.reflectBOT.fill = borated_water

        j = 0
        for fuels in self.fuel_list:
            fuels.region = -fuel_or & +z_list[j] & -z_list[j + 1]
            fuels.fill = uo2
            j = j + 1
        # j = 0
        # for gaps in self.gap_list:
        # 	gaps.region = +fuel_or & -clad_ir & +z_list[j] & -z_list[j+1]
        # 	gaps.fill = helium
        # 	j = j+1
        j = 0
        for clads in self.clad_list:
            clads.region = +fuel_or & -clad_or & +z_list[j] & -z_list[
                j + 1]  #clad_ir instead of fuel_or
            clads.fill = zircaloy
            j = j + 1
        # j = 0
        # for extra_clads in self.extra_clad_list:
        # 	extra_clads.region = +clad_or & -extra_clad_or & +left & -right & +back & -front & +z_list[j] & -z_list[j+1]
        # 	grid_flag = 0
        # 	for i in range(0,len(opt.GridBot_z)):
        # 		if z_list[j].z0 == opt.GridBot_z[i]:
        # 			extra_clads.fill = zircaloy
        # 			grid_flag = 1
        # 	if grid_flag == 1:
        # 		extra_clads.fill = zircaloy
        # 	else:
        # 		extra_clads.fill = borated_water
        # 	extra_clads.fill = borated_water
        # 	j = j+1
        j = 0
        for waters in self.water_list:
            waters.region = +clad_or & +left & -right & +back & -front & +z_list[
                j] & -z_list[j + 1]
            waters.fill = borated_water
            j = j + 1

        self.root = openmc.Universe(universe_id=0, name='root universe')
        self.root.add_cells(self.fuel_list)
        # self.root.add_cells(self.gap_list)
        self.root.add_cells(self.clad_list)
        # self.root.add_cells(self.extra_clad_list)
        self.root.add_cells(self.water_list)
        self.root.add_cells([self.reflectTOP, self.reflectBOT])
        self.geometry_file = openmc.Geometry(self.root)
        self.geometry_file.export_to_xml()  #Removed for correlation

        # Tallies
        # power distribution: fission q recoverable (Sterling's note: starts 0, might be data pb)
        # openmc accounts for incoming neutron energy and isotope
        cell_filter = openmc.CellFilter(self.fuel_list)
        t = openmc.Tally(tally_id=1)
        t.filters.append(cell_filter)
        t.scores = ['fission-q-recoverable']
        tallies = openmc.Tallies([t])
        tallies.export_to_xml()  #Removed for correlation

        # Plots
        plot = openmc.Plot()
        plot.width = [Pitch + 45, Pitch + 45]
        plot.origin = [0., 0., -20]
        plot.color_by = 'material'
        plot.filename = 'fuel-pin'
        plot.pixels = [1000, 1000]
        plot.basis = 'yz'
        # openmc.plot_inline(plot)

        # Move Files to PinGeo folder #Removed for correlation
        shutil.move('settings.xml', 'PinGeo/settings.xml')
        shutil.move('materials.xml', 'PinGeo/materials.xml')
        shutil.move('geometry.xml', 'PinGeo/geometry.xml')
        shutil.move('tallies.xml', 'PinGeo/tallies.xml')
        # shutil.move('plots.xml', 'PinGeo/plots.xml')

        openmc.run(
            cwd='PinGeo')  #, threads=nthreads, mpi_args=['mpiexec','-n','2'])
        sp = openmc.StatePoint('PinGeo/statepoint.' +
                               str(self.settings_file.batches) + '.h5')
        tally = sp.get_tally(scores=['fission-q-recoverable'])

        self.Tally = np.ndarray.flatten(tally.sum)
        Pfactor = 66945.4 / sum(np.ndarray.flatten(tally.sum))
        # print("Pfactor: ", Pfactor)
        self.Tally = np.ndarray.flatten(tally.sum) * Pfactor
        self.Var = np.divide(np.ndarray.flatten(tally.std_dev),
                             np.ndarray.flatten(tally.mean))
Ejemplo n.º 8
0
def define_Geo_Mat_Set(cells_num_dic,parameters_dic,settings_dic,temp_phy_mat,controlRod_deep,empty_reflector_height):
    # Check file
    if os.path.exists('geometry.xml'):
        os.remove('geometry.xml')
    if os.path.exists('materials.xml'):
        os.remove('materials.xml')
    if os.path.exists('settings.xml'):
        os.remove('settings.xml')
    if os.path.exists('tallies.xml'):
        os.remove('tallies.xml')

    # defualt temperature: 1073.5K
    if settings_dic['temperature_update']== True:
        temp_defualt = temp_phy_mat.min()
    else:
        temp_defualt = 1073.5

    # Structural Material HAYNES230
    structure_HAY = openmc.Material(name='HAYNES230')
    structure_HAY.set_density('g/cm3',8.97)
    structure_HAY.add_element('Ni',0.57,'wo')
    structure_HAY.add_element('Cr',0.22,'wo')
    structure_HAY.add_element('W',0.14,'wo')
    structure_HAY.add_element('Mo',0.02,'wo')
    structure_HAY.add_element('Fe',0.01875,'wo')
    structure_HAY.add_element('Co',0.03125,'wo')

    # Structural Material SS316
    structure_SS = openmc.Material(name='SS316')
    structure_SS.set_density('g/cm3',7.99)
    structure_SS.add_element('Ni',0.12,'wo')
    structure_SS.add_element('Cr',0.17,'wo')
    structure_SS.add_element('Mo',0.025,'wo')
    structure_SS.add_element('Mn',0.02,'wo')
    structure_SS.add_element('Fe',0.665,'wo')

    #Control Rod Material B4C
    ControlRod_B4C = openmc.Material(name='B4C')
    ControlRod_B4C.set_density('g/cm3',2.52)
    ControlRod_B4C.add_nuclide('B10',4,'ao')
    ControlRod_B4C.add_element('C',1,'ao')

    #Reflector Material BeO
    Reflector_BeO = openmc.Material(name='BeO')
    Reflector_BeO.set_density('g/cm3',3.025)
    Reflector_BeO.add_element('Be',1,'ao')
    Reflector_BeO.add_element('O',1,'ao')

    #Coolant Na
    Coolant_Na = openmc.Material(name='Na')
    Coolant_Na.set_density('g/cm3',0.76)
    Coolant_Na.add_element('Na',1,'ao')

    # Instantiate a Materials collection
    materials_file = openmc.Materials([structure_HAY, structure_SS, ControlRod_B4C, Reflector_BeO, Coolant_Na])


    # Number of cells
    n_r = cells_num_dic['n_r']
    n_r_outer = cells_num_dic['n_r_outer']
    n_h = cells_num_dic['n_h']
    

    # Effect of Temperature on density of fuel
    fuel_list = []
    density_mat = calUMoDensity(temp_phy_mat)

    # Fuel U-10Mo
    for j in range(n_h):
        for i in range(n_r):
            fuel_name = str((j+1)*10000+(i + 1)*100)
            fuel = openmc.Material(name='U-10Mo '+ fuel_name)
            fuel.set_density('g/cm3',density_mat[j,i])
            fuel.add_element('Mo',0.1,'wo')
            # fuel.add_nuclide('U235',0.1773,'wo') # for LEU (19.7%)
            # fuel.add_nuclide('U238',0.7227,'wo')
            fuel.add_nuclide('U235',0.837,'wo') # for HEU (93.0%)
            fuel.add_nuclide('U238',0.063,'wo')
            fuel_list.append(fuel)
            materials_file.append(fuel)

        for i in range(n_r_outer):
            fuel_name = str((j+1)*10000+(i + n_r + 1)*100)
            fuel = openmc.Material(name='U-10Mo '+ fuel_name)
            fuel.set_density('g/cm3',density_mat[j,i+n_r])
            fuel.add_element('Mo',0.1,'wo')
            # fuel.add_nuclide('U235',0.1773,'wo') # for LEU (19.7%)
            # fuel.add_nuclide('U238',0.7227,'wo')
            fuel.add_nuclide('U235',0.837,'wo') # for HEU (93.0%)
            fuel.add_nuclide('U238',0.063,'wo')
            fuel_list.append(fuel)
            materials_file.append(fuel)

    # Export to "materials.xml"
    materials_file.export_to_xml()

    num_heat_pipe = 8

    # Parameters of reactor
    # Unit:cm

    fuel_r = parameters_dic['fuel_r']
    fuel_h = parameters_dic['fuel_h']

    controlRod_r = parameters_dic['controlRod_r']
    controlRod_h_max = parameters_dic['controlRod_h_max']
    controlRod_l = parameters_dic['controlRod_l']

    reflector_r = parameters_dic['reflector_r']
    reflector_h = parameters_dic['reflector_h']

    heat_pipe_R = parameters_dic['heat_pipe_R']
    heat_pipe_r = parameters_dic['heat_pipe_r']

    top_distance = parameters_dic['top_distance']
    bottom_distance = parameters_dic['bottom_distance']

    # Create cylinders for the fuel control rod and reflector
    fuel_OD = openmc.ZCylinder(x0=0.0, y0=0.0, r=fuel_r)
    controlRod_OD = openmc.ZCylinder(x0=0.0, y0=0.0, r=controlRod_r)
    reflector_OD = openmc.ZCylinder(x0=0.0, y0=0.0, r=reflector_r, boundary_type='vacuum')

    # Create planes for fuel control rod and reflector
    reflector_TOP = openmc.ZPlane(z0 = (top_distance+fuel_h/2),boundary_type='vacuum')
    reflector_BOTTOM = openmc.ZPlane(z0 = -(bottom_distance+fuel_h/2),boundary_type='vacuum')
    reflector_empty_TOP = openmc.ZPlane(z0 = -(bottom_distance+fuel_h/2-empty_reflector_height))


    fuel_TOP = openmc.ZPlane(z0 = fuel_h/2)
    fuel_BOTTOM = openmc.ZPlane(z0 = -fuel_h/2)

    controlRodSpace_TOP = openmc.ZPlane(z0 = (controlRod_h_max-bottom_distance-fuel_h/2))

    # Create cylinders for heat pipes
    heat_pipe_OD = openmc.ZCylinder(x0=fuel_r, y0=0, r=heat_pipe_R)

    n_ang = num_heat_pipe
    ang_mesh = np.pi/n_ang


    r_mesh = np.linspace(controlRod_r,(fuel_r-heat_pipe_R),n_r+1)
    r_outer_mesh = np.linspace(fuel_r-heat_pipe_R,fuel_r,n_r_outer+1)
    h_mesh = np.linspace(-fuel_h/2,fuel_h/2,n_h+1)

    line_1 = openmc.Plane(a=np.tan(-ang_mesh),b=-1.0,c=0.0,d=0.0,boundary_type='reflective')
    line_2 = openmc.Plane(a=np.tan(ang_mesh),b=-1.0,c=0.0,d=0.0,boundary_type='reflective')

    # Create volume vector and matrix
    volume_vec = np.zeros(n_r+n_r_outer)
    d_h = fuel_h/n_h

    for i in range(n_r+n_r_outer):
        if i >= n_r:
            d = heat_pipe_R*(i-n_r)/n_r_outer
            x_i = np.sqrt(2*heat_pipe_R*d-d*d)
            d = heat_pipe_R*(i-n_r+1)/n_r_outer
            x_i1 = np.sqrt(2*heat_pipe_R*d-d*d)
            s = (x_i+x_i1)*heat_pipe_R/n_r_outer
            volume_vec[i] = d_h*np.pi*(r_outer_mesh[i+1-n_r]*r_outer_mesh[i+1-n_r]-r_outer_mesh[i-n_r]*r_outer_mesh[i-n_r])/8-s
        else:
            volume_vec[i] = d_h*np.pi*(r_mesh[i+1]*r_mesh[i+1]-r_mesh[i]*r_mesh[i])/8

    volume_mat = np.zeros((n_h,(n_r+n_r_outer)))
    for i in range(n_h):
        volume_mat[i,:] = volume_vec

    # Create heat_pipe universe
    heat_pipe_Inner = openmc.ZCylinder(r=heat_pipe_r)

    coolant_cell = openmc.Cell(fill=Coolant_Na, region=(-heat_pipe_Inner & -reflector_TOP & +reflector_BOTTOM))
    pipe_cell = openmc.Cell(fill=structure_HAY, region=(+heat_pipe_Inner & -reflector_TOP & +reflector_BOTTOM))

    heat_pipe_universe = openmc.Universe(cells=(coolant_cell, pipe_cell))

    # Create a Universe to encapsulate a fuel pin
    pin_cell_universe = openmc.Universe(name='U-10Mo Pin')

    # Create fine-fuel-cell (num of cells: n_r + n_r_outer)
    fuel_cell_list = []
    fuel_cell_ID_list = []


    k = 0
    for j in range(n_h):
        cir_top = openmc.ZPlane(z0 = h_mesh[j+1])
        cir_bottom = openmc.ZPlane(z0 = h_mesh[j])
        for i in range(n_r):
            cir_in = openmc.ZCylinder(r=r_mesh[i])
            cir_out = openmc.ZCylinder(r=r_mesh[i+1])
            fuel_cell = openmc.Cell()
            fuel_cell.fill = fuel_list[k]
            k = k+1
            fuel_cell.region = +cir_in & -cir_out & +cir_bottom &-cir_top
            fuel_cell.temperature = temp_phy_mat[j,i]
            fuel_cell.id = (j+1)*10000+(i + 1)*100
            fuel_cell_ID_list.append((j+1)*10000+(i + 1)*100)
            fuel_cell_list.append(fuel_cell)
            pin_cell_universe.add_cell(fuel_cell)

        for i in range(n_r_outer):
            cir_in = openmc.ZCylinder(r=r_outer_mesh[i])
            cir_out = openmc.ZCylinder(r=r_outer_mesh[i+1])
            fuel_cell = openmc.Cell()
            fuel_cell.fill = fuel_list[k]
            k = k+1
            fuel_cell.region = +cir_in & -cir_out & +heat_pipe_OD & +cir_bottom &-cir_top
            fuel_cell.temperature = temp_phy_mat[j,i+n_r]
            fuel_cell.id = (j+1)*10000+(n_r + i + 1)*100
            fuel_cell_ID_list.append((j+1)*10000+(n_r + i + 1)*100)
            fuel_cell_list.append(fuel_cell)
            pin_cell_universe.add_cell(fuel_cell)

    # Create control rod Cell
    controlRod_TOP = openmc.ZPlane(z0 = (controlRod_deep-fuel_h/2-bottom_distance))
    controlRod_TOP.name = 'controlRod_TOP'
    if controlRod_deep < controlRod_h_max:
        controlRod_empty_cell = openmc.Cell(name='Control Rod Empty')
        controlRod_empty_cell.region = -controlRod_OD & +controlRod_TOP & -controlRodSpace_TOP
        pin_cell_universe.add_cell(controlRod_empty_cell)


    if controlRod_deep > 0:
        controlRod_cell = openmc.Cell(name='Control Rod')
        controlRod_cell.fill = ControlRod_B4C
        controlRod_cell.region = -controlRod_OD & +reflector_BOTTOM & -controlRod_TOP
        controlRod_cell.tempearture = temp_defualt
        pin_cell_universe.add_cell(controlRod_cell)

    # Create heat pipe Cell
    heat_pipe_cell = openmc.Cell(name='Heat Pipe')
    heat_pipe_cell.fill = heat_pipe_universe
    heat_pipe_cell.region = -heat_pipe_OD & +reflector_BOTTOM & -reflector_TOP
    heat_pipe_cell.temperature = temp_defualt
    heat_pipe_cell.translation = (fuel_r,0,0)
    pin_cell_universe.add_cell(heat_pipe_cell)

    # To be edited
    # Create reflector Cell

    if empty_reflector_height >0:
        reflector_radial_empty_cell = openmc.Cell(name='Radial Reflector Empty')
        reflector_radial_empty_cell.region = +fuel_OD & +heat_pipe_OD & +reflector_BOTTOM & -reflector_empty_TOP
        pin_cell_universe.add_cell(reflector_radial_empty_cell)

        reflector_radial_cell = openmc.Cell(name='Radial Reflector')
        reflector_radial_cell.fill = Reflector_BeO
        reflector_radial_cell.region = +fuel_OD & +heat_pipe_OD & +reflector_empty_TOP & -reflector_TOP
        reflector_radial_cell.temperature = temp_defualt
        pin_cell_universe.add_cell(reflector_radial_cell)
    else:
        reflector_radial_cell = openmc.Cell(name='Radial Reflector')
        reflector_radial_cell.fill = Reflector_BeO
        reflector_radial_cell.region = +fuel_OD & +heat_pipe_OD & +reflector_BOTTOM & -reflector_TOP
        reflector_radial_cell.temperature = temp_defualt
        pin_cell_universe.add_cell(reflector_radial_cell)


    reflector_bottom_cell = openmc.Cell(name='Bottom Reflector')
    reflector_bottom_cell.fill = Reflector_BeO
    reflector_bottom_cell.region = +controlRod_OD & +heat_pipe_OD & -fuel_OD  & -fuel_BOTTOM & +reflector_BOTTOM
    reflector_bottom_cell.temperature = temp_defualt
    pin_cell_universe.add_cell(reflector_bottom_cell)

    reflector_top_cell = openmc.Cell(name='Top Reflector')
    reflector_top_cell.fill = Reflector_BeO
    reflector_top_cell.region = +heat_pipe_OD & -fuel_OD  & +controlRodSpace_TOP & -reflector_TOP
    reflector_top_cell.region = reflector_top_cell.region | (+controlRod_OD & +heat_pipe_OD & -fuel_OD & +fuel_TOP & -controlRodSpace_TOP)
    reflector_top_cell.temperature = temp_defualt
    pin_cell_universe.add_cell(reflector_top_cell)

    # Create root Cell
    root_cell = openmc.Cell(name='root cell')
    root_cell.fill = pin_cell_universe

    # Add boundary planes
    root_cell.region = -reflector_OD & +line_2 & -line_1 & +reflector_BOTTOM & -reflector_TOP

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

    # Create Geometry and set root Universe
    geometry = openmc.Geometry(root_universe)

    # Export to "geometry.xml"
    geometry.export_to_xml()

    # Instantiate a Settings object
    settings_file = openmc.Settings()
    settings_file.batches = settings_dic['batches']
    settings_file.inactive = settings_dic['inactive']
    settings_file.particles = settings_dic['particles']
    settings_file.temperature['multipole']= True
    settings_file.temperature['method']= 'interpolation'

    settings_file.source = openmc.Source(space=openmc.stats.Point((15,0,0)))
    # Export to "settings.xml"
    settings_file.export_to_xml()

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

    for i in range(len(fuel_cell_ID_list)):
        tally = openmc.Tally(name='cell tally '+str(fuel_cell_ID_list[i]))
        tally.filters = [openmc.DistribcellFilter(fuel_cell_ID_list[i])]
        tally.scores = ['heating','flux']
        tallies_file.append(tally)


    # Export to "tallies.xml"
    tallies_file.export_to_xml()
    
    return volume_mat,fuel_cell_ID_list
Ejemplo n.º 9
0
waba.add_nuclide('B11', 1.21192E-02)
waba.add_element('C', 3.77001E-03)
waba.add_nuclide('O16', 5.85563E-02)
waba.add_nuclide('Al27', 3.90223E-02)

materials_file = openmc.Materials([
    fuel_21, fuel_31, fuel_36, fuel_46, helium, water_565, water_600, pyrex,
    zirc4, gad, ifba, ss304, agincd, b4c, waba
])
materials_file.export_to_xml()
###############################################################################
#                             Create geometry
###############################################################################

# Instantiate zCylinder surfaces
fuel_or = openmc.ZCylinder(surface_id=1, x0=0, y0=0, r=0.4096, name='Fuel OR')
clad_ir = openmc.ZCylinder(surface_id=2, x0=0, y0=0, r=0.4180, name='Clad IR')
clad_or = openmc.ZCylinder(surface_id=3, x0=0, y0=0, r=0.4750, name='Clad OR')
gt_ir = openmc.ZCylinder(surface_id=4,
                         x0=0,
                         y0=0,
                         r=0.5610,
                         name='Guide Tube IR')
gt_or = openmc.ZCylinder(surface_id=5,
                         x0=0,
                         y0=0,
                         r=0.6020,
                         name='Guide Tube OR')
it_ir = openmc.ZCylinder(surface_id=6,
                         x0=0,
                         y0=0,
Ejemplo n.º 10
0
    def _add_rcca_pincells(self):
        """ Adds BEAVRS RCCA pincells """
    
        # RCCA rod radial surfaces

        self.s_rcca_clad_IR = openmc.ZCylinder(name='RCCA rod clad IR', R=c.rcca_clad_IR)
        self.s_rcca_clad_OR = openmc.ZCylinder(name='RCCA rod clad OR', R=c.rcca_clad_OR)
        self.s_rcca_b4c_OR = openmc.ZCylinder(name='RCCA rod B4C OR', R=c.rcca_b4c_OR)
        self.s_rcca_aic_OR = openmc.ZCylinder(name='RCCA rod AIC OR', R=c.rcca_aic_OR)
        self.s_rcca_spacer_OR = openmc.ZCylinder(name='RCCA rod spacer OR', R=c.rcca_spacer_OR)
        self.s_rcca_spring_OR = openmc.ZCylinder(name='RCCA rod plenum spring OR', R=c.rcca_spring_OR)

        # RCCA rod axial surfaces

        self.s_rcca_rod_bot = {}
        self.s_rcca_lowerFitting_top = {}
        self.s_rcca_aic_top = {}
        self.s_rcca_b4c_top = {}
        self.s_rcca_spacer_top = {}
        self.s_rcca_plenum_top = {}
        for b in c.rcca_banks:
            d = c.rcca_bank_steps_withdrawn[b]*c.rcca_StepWidth
            self.s_rcca_rod_bot[b] = openmc.ZPlane(name='Bottom of RCCA rod bank {0}'.format(b), z0=c.rcca_Rod_bot + d)
            self.s_rcca_lowerFitting_top[b] = openmc.ZPlane(name='Top of RCCA rod lower fitting bank {0}'.format(b), z0=c.rcca_LowerFitting_top + d)
            self.s_rcca_aic_top[b] = openmc.ZPlane(name='Top of RCCA rod AIC bank {0}'.format(b), z0=c.rcca_AIC_top + d)
            self.s_rcca_b4c_top[b] = openmc.ZPlane(name='Top of RCCA rod B4C bank {0}'.format(b), z0=c.rcca_B4C_top + d)
            self.s_rcca_spacer_top[b] = openmc.ZPlane(name='Top of RCCA rod spacer bank {0}'.format(b), z0=c.rcca_Spacer_top + d)
            self.s_rcca_plenum_top[b] = openmc.ZPlane(name='Top of RCCA rod plenum bank {0}'.format(b), z0=c.rcca_Plenum_top + d)

        # RCCA pincell universes

        self.u_rcca_plenum = InfinitePinCell(name='RCCA plenum')
        self.u_rcca_plenum.add_ring(self.mats['Inconel 718'], self.s_rcca_spring_OR)
        self.u_rcca_plenum.add_ring(self.mats['Air'], self.s_rcca_clad_IR)
        self.u_rcca_plenum.add_last_ring(self.mats['Zircaloy 4'])
        self.u_rcca_plenum.finalize()

        self.u_rcca_aic = InfinitePinCell(name='RCCA AIC')
        self.u_rcca_aic.add_ring(self.mats['Ag-In-Cd'], self.s_rcca_aic_OR)
        self.u_rcca_aic.add_ring(self.mats['Air'], self.s_rcca_clad_IR)
        self.u_rcca_aic.add_last_ring( self.mats['Zircaloy 4'])
        self.u_rcca_aic.finalize()
    
        self.u_rcca_b4c = InfinitePinCell(name='RCCA B4C')
        self.u_rcca_b4c.add_ring(self.mats['B4C'], self.s_rcca_b4c_OR)
        self.u_rcca_b4c.add_ring(self.mats['Air'], self.s_rcca_clad_IR)
        self.u_rcca_b4c.add_last_ring(self.mats['Zircaloy 4'])
        self.u_rcca_b4c.finalize()
    
        self.u_rcca_spacer = InfinitePinCell(name='RCCA Spacer')
        self.u_rcca_spacer.add_ring(self.mats['SS304'], self.s_rcca_spacer_OR)
        self.u_rcca_spacer.add_ring(self.mats['Air'], self.s_rcca_clad_IR)
        self.u_rcca_spacer.add_last_ring(self.mats['Zircaloy 4'])
        self.u_rcca_spacer.finalize()
    
        # RCCA rod axial stack

        self.u_rcca = {}
        for b in c.rcca_banks:
            self.u_rcca[b] = AxialPinCell(name='RCCA bank {0}'.format(b))
            self.u_rcca[b].add_axial_section(self.s_struct_supportPlate_bot, self.mats['Borated Water'])
            self.u_rcca[b].add_axial_section(self.s_struct_lowerNozzle_top, self.mats['Water SPN'])
            self.u_rcca[b].add_axial_section(self.s_rcca_rod_bot[b], self.mats['Borated Water'])
            self.u_rcca[b].add_axial_section(self.s_rcca_lowerFitting_top[b], self.mats['SS304'])
            self.u_rcca[b].add_axial_section(self.s_rcca_aic_top[b], self.u_rcca_aic)
            self.u_rcca[b].add_axial_section(self.s_rcca_b4c_top[b], self.u_rcca_b4c)
            self.u_rcca[b].add_axial_section(self.s_rcca_spacer_top[b], self.u_rcca_spacer)
            self.u_rcca[b].add_axial_section(self.s_rcca_plenum_top[b], self.u_rcca_plenum)
            self.u_rcca[b].add_last_axial_section(self.mats['SS304'])
            self.u_rcca[b] = self.u_rcca[b].add_wrapper(self.u_gt, self.s_rcca_clad_OR)
            self.u_rcca[b].finalize()
Ejemplo n.º 11
0
def build_inputs(n_mesh_bins, energy_bins, n_azim_bins, **kwargs):
    """Build OpenMC input XML files for a pincell with detailed flux tallying"""
    if n_azim_bins % 8 != 0:
        raise ValueError("The number of azimuthal bins "
                         "must be divisible by eight")
    pitch = 0.62992 * 2

    ####################
    # Define materials
    ####################

    uo2 = openmc.Material(material_id=9201,
                          name='UO2 fuel at 2.4% wt enrichment')
    uo2.set_density('g/cm3', 10.29769)
    uo2.add_nuclide('U-234', 4.4842e-06)
    uo2.add_nuclide('U-235', 5.5814e-04)
    uo2.add_nuclide('U-238', 2.2407e-02)
    uo2.add_nuclide('O-16', 4.5828e-02)
    uo2.add_nuclide('O-17', 1.7457e-05 + 9.4176e-05)

    borated_water = openmc.Material(material_id=101,
                                    name='Borated water at 975 ppm')
    borated_water.set_density('g/cm3', 0.740582)
    borated_water.add_nuclide('B-10', 8.0042e-6)
    borated_water.add_nuclide('B-11', 3.2218e-5)
    borated_water.add_nuclide('H-1', 4.9457e-2)
    borated_water.add_nuclide('H-2', 7.4196e-6)
    borated_water.add_nuclide('O-16', 2.4672e-2)
    borated_water.add_nuclide('O-17', 9.3982e-06 + 5.0701e-05)
    borated_water.add_s_alpha_beta('HH2O', '71t')

    helium = openmc.Material(material_id=201, name='Helium for gap')
    helium.set_density('g/cm3', 0.001598)
    helium.add_nuclide('He-4', 2.4044e-4)

    zircaloy = openmc.Material(material_id=4001, name='Zircaloy 4')
    zircaloy.set_density('g/cm3', 6.55)
    zircaloy.add_nuclide('O-16', 3.0743e-04)
    zircaloy.add_nuclide('O-17', 1.1711e-07 + 6.3176e-07)
    zircaloy.add_nuclide('Cr-50', 3.2962e-06)
    zircaloy.add_nuclide('Cr-52', 6.3564e-05)
    zircaloy.add_nuclide('Cr-53', 7.2076e-06)
    zircaloy.add_nuclide('Cr-54', 1.7941e-06)
    zircaloy.add_nuclide('Fe-54', 8.6699e-06)
    zircaloy.add_nuclide('Fe-56', 1.3610e-04)
    zircaloy.add_nuclide('Fe-57', 3.1431e-06)
    zircaloy.add_nuclide('Fe-58', 4.1829e-07)
    zircaloy.add_nuclide('Zr-90', 2.1827e-02)
    zircaloy.add_nuclide('Zr-91', 4.7600e-03)
    zircaloy.add_nuclide('Zr-92', 7.2758e-03)
    zircaloy.add_nuclide('Zr-94', 7.3734e-03)
    zircaloy.add_nuclide('Zr-96', 1.1879e-03)
    zircaloy.add_nuclide('Sn-112', 4.6735e-06)
    zircaloy.add_nuclide('Sn-114', 3.1799e-06)
    zircaloy.add_nuclide('Sn-115', 1.6381e-06)
    zircaloy.add_nuclide('Sn-116', 7.0055e-05)
    zircaloy.add_nuclide('Sn-117', 3.7003e-05)
    zircaloy.add_nuclide('Sn-118', 1.1669e-04)
    zircaloy.add_nuclide('Sn-119', 4.1387e-05)
    zircaloy.add_nuclide('Sn-120', 1.5697e-04)
    zircaloy.add_nuclide('Sn-122', 2.2308e-05)
    zircaloy.add_nuclide('Sn-124', 2.7897e-05)

    materials_file = openmc.MaterialsFile()
    materials_file.default_xs = '71c'
    materials_file.add_materials([uo2, helium, zircaloy, borated_water])
    materials_file.export_to_xml()

    ####################
    # Define geometry
    ####################

    # Surfaces.
    fuel_or = openmc.ZCylinder(R=0.39218, name='Fuel OR')
    clad_ir = openmc.ZCylinder(R=0.40005, name='Clad IR')
    clad_or = openmc.ZCylinder(R=0.45720, name='Clad OR')

    bottom = openmc.YPlane(y0=0.0, name='bottom')
    right = openmc.XPlane(x0=pitch / 2.0, name='right')
    top = openmc.Plane(A=1, B=-1, name='top')  # 45 degree angle
    lower = openmc.ZPlane(z0=-10, name='lower')
    upper = openmc.ZPlane(z0=10, name='upper')
    for s in (bottom, right, top, lower, upper):
        s.boundary_type = 'reflective'

    # Cells.
    fuel_cell = openmc.Cell()
    gap_cell = openmc.Cell()
    clad_cell = openmc.Cell()
    water_cell = openmc.Cell()

    # Cell regions.
    fuel_cell.region = -fuel_or
    gap_cell.region = +fuel_or & -clad_ir
    clad_cell.region = +clad_ir & -clad_or
    water_cell.region = +clad_or & -right
    for c in (fuel_cell, gap_cell, clad_cell, water_cell):
        c.region = c.region & +bottom & +top & +lower & -upper

    # Cell fills.
    fuel_cell.fill = uo2
    gap_cell.fill = helium
    clad_cell.fill = zircaloy
    water_cell.fill = borated_water

    # Universe, geometry, and XML.
    root = openmc.Universe(universe_id=0, name='Root universe')
    root.add_cells([fuel_cell, gap_cell, clad_cell, water_cell])

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

    geometry_file = openmc.GeometryFile()
    geometry_file.geometry = geometry
    geometry_file.export_to_xml()

    ####################
    # Define settings
    ####################

    settings_file = openmc.SettingsFile()
    settings_file.batches = kwargs.setdefault('batches', 25)
    settings_file.inactive = kwargs.setdefault('inactive', 5)
    settings_file.particles = kwargs.setdefault('particles', 1000)
    settings_file.source = openmc.source.Source(
        openmc.stats.Point((0.2, 0.1, 0.0)))
    settings_file.export_to_xml()

    ####################
    # Define tallies
    ####################

    mesh = openmc.Mesh(mesh_id=1)
    delta = pitch / 2.0 / (n_mesh_bins + 1)
    mesh.dimension = [n_mesh_bins, n_mesh_bins, 1]
    mesh.lower_left = [-delta / 2.0, -delta / 2.0, -1.e50]
    mesh.upper_right = [
        pitch / 2.0 + delta / 2.0, pitch / 2.0 + delta / 2.0, 1.e50
    ]

    energy_filter = openmc.Filter(type='energy', bins=energy_bins)
    mesh_filter = openmc.Filter()
    mesh_filter.mesh = mesh
    azim_filter = openmc.Filter(type='azimuthal', bins=n_azim_bins)

    tally = openmc.Tally(tally_id=1)
    tally.add_filter(energy_filter)
    tally.add_filter(mesh_filter)
    tally.add_filter(azim_filter)
    tally.add_score('flux')

    tallies_file = openmc.TalliesFile()
    tallies_file.add_mesh(mesh)
    tallies_file.add_tally(tally)
    tallies_file.export_to_xml()

    ####################
    # Define plots
    ####################

    plotfile = openmc.PlotsFile()

    plot = openmc.Plot()
    plot.filename = 'matplot'
    plot.origin = (pitch / 4.0, pitch / 4.0, 0)
    plot.width = (0.5 * pitch, 0.5 * pitch)
    plot.pixels = (400, 400)
    plot.color = 'mat'
    plot.col_spec = {
        101: (100, 200, 200),
        201: (220, 220, 220),
        4001: (150, 150, 150),
        9201: (255, 50, 50)
    }
    plotfile.add_plot(plot)

    plot = openmc.Plot()
    plot.filename = 'cellplot'
    plot.origin = (pitch / 4.0, pitch / 4.0, 0)
    plot.width = (0.5 * pitch, 0.5 * pitch)
    plot.pixels = (400, 400)
    plot.color = 'cell'
    plotfile.add_plot(plot)

    plotfile.export_to_xml()
eurofer = openmc.Material(name='EUROFER97')
eurofer.set_density('g/cm3', 7.75)
eurofer.add_element('Fe', 89.067, percent_type='wo')
eurofer.add_element('C', 0.11, percent_type='wo')
eurofer.add_element('Mn', 0.4, percent_type='wo')
eurofer.add_element('Cr', 9.0, percent_type='wo')
eurofer.add_element('Ta', 0.12, percent_type='wo')
eurofer.add_element('W', 1.1, percent_type='wo')
eurofer.add_element('N', 0.003, percent_type='wo')
eurofer.add_element('V', 0.2, percent_type='wo')
mats.append(eurofer)

# GEOMETRY

central_sol_surface = openmc.ZCylinder(r=100, boundary_type='vacuum')
vessel_inner = openmc.Sphere(r=500, boundary_type='vacuum')
first_wall_outer_surface = openmc.Sphere(r=510)
breeder_blanket_outer_surface = openmc.Sphere(r=610)

central_sol_region = -central_sol_surface & -breeder_blanket_outer_surface
central_sol_cell = openmc.Cell(region=central_sol_region)
central_sol_cell.fill = copper

first_wall_region = -first_wall_outer_surface & +vessel_inner & +central_sol_surface
first_wall_cell = openmc.Cell(region=first_wall_region)
first_wall_cell.fill = eurofer

breeder_blanket_region = +first_wall_outer_surface & -breeder_blanket_outer_surface & +central_sol_surface
breeder_blanket_cell = openmc.Cell(region=breeder_blanket_region)
breeder_blanket_cell.fill = eurofer
Ejemplo n.º 13
0
def segment_pin(n_rings, n_wedges, r_fuel, r_gap, r_clad):
    """ Calculates a segmented pin.

    Separates a pin with n_rings and n_wedges.  All cells have equal volume.
    Pin is centered at origin.
    """

    # Calculate all the volumes of interest
    v_fuel = math.pi * r_fuel**2
    v_gap = math.pi * r_gap**2 - v_fuel
    v_clad = math.pi * r_clad**2 - v_fuel - v_gap
    v_ring = v_fuel / n_rings
    v_segment = v_ring / n_wedges

    # Compute ring radiuses
    r_rings = np.zeros(n_rings)

    for i in range(n_rings):
        r_rings[i] = math.sqrt(1.0/(math.pi) * v_ring * (i+1))

    # Compute thetas
    theta = np.linspace(0, 2*math.pi, n_wedges + 1)

    # Compute surfaces
    fuel_rings = [openmc.ZCylinder(x0=0, y0=0, R=r_rings[i])
                  for i in range(n_rings)]

    fuel_wedges = [openmc.Plane(A=math.cos(theta[i]), B=math.sin(theta[i]))
                   for i in range(n_wedges)]

    gap_ring = openmc.ZCylinder(x0=0, y0=0, R=r_gap)
    clad_ring = openmc.ZCylinder(x0=0, y0=0, R=r_clad)

    # Create cells
    fuel_cells = []
    if n_wedges == 1:
        for i in range(n_rings):
            cell = openmc.Cell(name='fuel')
            if i == 0:
                cell.region = -fuel_rings[0]
            else:
                cell.region = +fuel_rings[i-1] & -fuel_rings[i]
            fuel_cells.append(cell)
    else:
        for i in range(n_rings):
            for j in range(n_wedges):
                cell = openmc.Cell(name='fuel')
                if i == 0:
                    if j != n_wedges-1:
                        cell.region = (-fuel_rings[0]
                                       & +fuel_wedges[j]
                                       & -fuel_wedges[j+1])
                    else:
                        cell.region = (-fuel_rings[0]
                                       & +fuel_wedges[j]
                                       & -fuel_wedges[0])
                else:
                    if j != n_wedges-1:
                        cell.region = (+fuel_rings[i-1]
                                       & -fuel_rings[i]
                                       & +fuel_wedges[j]
                                       & -fuel_wedges[j+1])
                    else:
                        cell.region = (+fuel_rings[i-1]
                                       & -fuel_rings[i]
                                       & +fuel_wedges[j]
                                       & -fuel_wedges[0])
                fuel_cells.append(cell)

    # Gap ring
    gap_cell = openmc.Cell(name='gap')
    gap_cell.region = +fuel_rings[-1] & -gap_ring
    fuel_cells.append(gap_cell)

    # Clad ring
    clad_cell = openmc.Cell(name='clad')
    clad_cell.region = +gap_ring & -clad_ring
    fuel_cells.append(clad_cell)

    # Moderator
    mod_cell = openmc.Cell(name='cool')
    mod_cell.region = +clad_ring
    fuel_cells.append(mod_cell)

    # Form universe
    fuel_u = openmc.Universe()
    fuel_u.add_cells(fuel_cells)

    return fuel_u, v_segment, v_gap, v_clad
Ejemplo n.º 14
0
overall model is built by an `assembly` function. This script also demonstrates
the use of the `Model` class, which provides some extra convenience over using
`Geometry`, `Materials`, and `Settings` classes directly. Finally, the script
takes two command-line flags that indicate whether to build and/or run the
model.

"""

import argparse
from math import log10

import numpy as np
import openmc

# Define surfaces
fuel_or = openmc.ZCylinder(r=0.39218, name='Fuel OR')
clad_or = openmc.ZCylinder(r=0.45720, name='Clad OR')

# Define materials
fuel = openmc.Material(name='Fuel')
fuel.set_density('g/cm3', 10.29769)
fuel.add_nuclide('U234', 4.4843e-6)
fuel.add_nuclide('U235', 5.5815e-4)
fuel.add_nuclide('U238', 2.2408e-2)
fuel.add_nuclide('O16', 4.5829e-2)

clad = openmc.Material(name='Cladding')
clad.set_density('g/cm3', 6.55)
clad.add_nuclide('Zr90', 2.1827e-2)
clad.add_nuclide('Zr91', 4.7600e-3)
clad.add_nuclide('Zr92', 7.2758e-3)
Ejemplo n.º 15
0
fuel = openmc.Material(material_id=40, name='fuel')
fuel.set_density('g/cc', 4.5)
fuel.add_nuclide('U235', 1.)

# Instantiate a Materials collection and export to XML
materials_file = openmc.Materials([moderator, fuel])
materials_file.export_to_xml()


###############################################################################
#                 Exporting to OpenMC geometry.xml file
###############################################################################

# Instantiate ZCylinder surfaces
surf1 = openmc.ZCylinder(surface_id=1, x0=0, y0=0, R=7, name='surf 1')
surf2 = openmc.ZCylinder(surface_id=2, x0=0, y0=0, R=9, name='surf 2')
surf3 = openmc.ZCylinder(surface_id=3, x0=0, y0=0, R=11, name='surf 3')
surf3.boundary_type = 'vacuum'

# Instantiate Cells
cell1 = openmc.Cell(cell_id=1, name='cell 1')
cell2 = openmc.Cell(cell_id=100, name='cell 2')
cell3 = openmc.Cell(cell_id=101, name='cell 3')
cell4 = openmc.Cell(cell_id=2, name='cell 4')

# Use surface half-spaces to define regions
cell1.region = -surf2
cell2.region = -surf1
cell3.region = +surf1
cell4.region = +surf2 & -surf3
Ejemplo n.º 16
0
bot_fa.add_nuclide("Zr-91", 0.0824858164, 'wo')
bot_fa.add_nuclide("Zr-92", 0.1274914944, 'wo')
bot_fa.add_nuclide("Zr-94", 0.1319920622, 'wo')
bot_fa.add_nuclide("Zr-96", 0.0216912612, 'wo')
bot_fa.add_s_alpha_beta('HH2O', '71t')

# Define the materials file.
materials = openmc.Materials()
materials.default_xs = '71c'
materials += [fuel, clad, cold_water, hot_water, rpv_steel,
              lower_rad_ref, upper_rad_ref, bot_plate,
              bot_nozzle, top_nozzle, top_fa, bot_fa]
materials.export_to_xml()

# Define surfaces.
s1 = openmc.ZCylinder(R=0.41, surface_id=1)
s2 = openmc.ZCylinder(R=0.475, surface_id=2)
s3 = openmc.ZCylinder(R=0.56, surface_id=3)
s4 = openmc.ZCylinder(R=0.62, surface_id=4)
s5 = openmc.ZCylinder(R=187.6, surface_id=5)
s6 = openmc.ZCylinder(R=209.0, surface_id=6)
s7 = openmc.ZCylinder(R=229.0, surface_id=7)
s8 = openmc.ZCylinder(R=249.0, surface_id=8)
s8.boundary_type = 'vacuum'

s31 = openmc.ZPlane(z0=-229.0, surface_id=31)
s31.boundary_type = 'vacuum'
s32 = openmc.ZPlane(z0=-199.0, surface_id=32)
s33 = openmc.ZPlane(z0=-193.0, surface_id=33)
s34 = openmc.ZPlane(z0=-183.0, surface_id=34)
s35 = openmc.ZPlane(z0=0.0, surface_id=35)
Ejemplo n.º 17
0
#                 Exporting to OpenMC geometry.xml file
###############################################################################

# Instantiate ZCylinder surfaces
factor = 1.0
factor_p = 1.0

entropy_mesh_value = 0.39218			    # 0.39218

fuel_r = 0.39218*factor						# 0.39218
clad_ir = 0.40005*factor					# 0.40005
clar_or = 0.45720*factor					# 0.45720
void_r = 0.5772*factor                     # 0.57720
plane_value = 0.62992*factor_p		        # 0.62992

fuel_or = openmc.ZCylinder(surface_id=1, x0=0, y0=0, r=fuel_r, name='Fuel OR')
clad_ir = openmc.ZCylinder(surface_id=2, x0=0, y0=0, r=clad_ir, name='Clad IR')
clad_or = openmc.ZCylinder(surface_id=3, x0=0, y0=0, r=clar_or, name='Clad OR')
void_r= openmc.ZCylinder(surface_id=4, x0=0, y0=0, r=void_r, name='Clad OR')

left = openmc.XPlane(surface_id=5, x0=-plane_value, name='left')
right = openmc.XPlane(surface_id=6, x0=plane_value, name='right')
bottom = openmc.YPlane(surface_id=7, y0=-plane_value, name='bottom')
top = openmc.YPlane(surface_id=8, y0=plane_value, name='top')

left.boundary_type = 'reflective'
right.boundary_type = 'reflective'
top.boundary_type = 'reflective'
bottom.boundary_type = 'reflective'

# Instantiate Cells
Ejemplo n.º 18
0
eurofer.add_element('Fe', 89.067, percent_type='wo')
eurofer.add_element('C', 0.11, percent_type='wo')
eurofer.add_element('Mn', 0.4, percent_type='wo')
eurofer.add_element('Cr', 9.0, percent_type='wo')
eurofer.add_element('Ta', 0.12, percent_type='wo')
eurofer.add_element('W', 1.1, percent_type='wo')
eurofer.add_element('N', 0.003, percent_type='wo')
eurofer.add_element('V', 0.2, percent_type='wo')

mats = openmc.Materials([breeder_material, eurofer, copper])


# GEOMETRY

# surfaces
central_sol_surface = openmc.ZCylinder(r=100)
central_shield_outer_surface = openmc.ZCylinder(r=110)
vessel_inner_surface = openmc.Sphere(r=500)
first_wall_outer_surface = openmc.Sphere(r=510)
breeder_blanket_outer_surface = openmc.Sphere(r=610, boundary_type='vacuum')

# cells
central_sol_region = -central_sol_surface & -breeder_blanket_outer_surface
central_sol_cell = openmc.Cell(region=central_sol_region)
central_sol_cell.fill = copper

central_shield_region = +central_sol_surface & -central_shield_outer_surface & -breeder_blanket_outer_surface
central_shield_cell = openmc.Cell(region=central_shield_region)
central_shield_cell.fill = eurofer

inner_vessel_region = -vessel_inner_surface & +central_shield_outer_surface
Ejemplo n.º 19
0
water = openmc.Material(material_id=2, name='Water')
water.set_density('macro', 1.0)
water.add_macroscopic(h2o_data)

# Instantiate a Materials collection and export to XML
materials_file = openmc.Materials([uo2, water])
materials_file.default_xs = '300K'
materials_file.export_to_xml()


###############################################################################
#                 Exporting to OpenMC geometry.xml file
###############################################################################

# Instantiate ZCylinder surfaces
fuel_or = openmc.ZCylinder(surface_id=1, x0=0, y0=0, R=0.54, name='Fuel OR')
left = openmc.XPlane(surface_id=4, x0=-0.63, name='left')
right = openmc.XPlane(surface_id=5, x0=0.63, name='right')
bottom = openmc.YPlane(surface_id=6, y0=-0.63, name='bottom')
top = openmc.YPlane(surface_id=7, y0=0.63, name='top')

left.boundary_type = 'reflective'
right.boundary_type = 'reflective'
top.boundary_type = 'reflective'
bottom.boundary_type = 'reflective'

# Instantiate Cells
fuel = openmc.Cell(cell_id=1, name='cell 1')
moderator = openmc.Cell(cell_id=2, name='cell 2')

# Use surface half-spaces to define regions
acrylic=openmc.Material(5,'acrylic')
acrylic.add_nuclide('H1',5.6642e-2)
acrylic.add_nuclide('O16',1.4273e-2)
acrylic.add_nuclide('C0',3.5648e-2)
acrylic.add_s_alpha_beta('c_H_in_CH2')
acrylic.set_density('g/cm3',1.185)



mats=openmc.Materials([fuel,water,clad6061,rubber,acrylic])
mats.cross_sections='/home/tang/nndc_hdf5/cross_sections.xml'
mats.export_to_xml()


#fuel cylinder
zc1=openmc.ZCylinder(x0=0,y0=0,R=0.6325)
zc2=openmc.ZCylinder(x0=0,y0=0,R=0.6415)
xp3=openmc.XPlane(x0= -1.27)
xp4=openmc.XPlane(x0=1.27)
yp5=openmc.YPlane(y0=-1.27)
yp6=openmc.YPlane(y0=1.27)
zp7=openmc.ZPlane(z0= 0.0)
zp8=openmc.ZPlane(z0=92.075)
zp9=openmc.ZPlane(z0= 94.2975) #top 0f clad


xp10=openmc.XPlane(x0=22.86 )
xp11=openmc.XPlane(x0= 0.)
zc12=openmc.ZCylinder(x0=0,y0=0,R=0.7075)#clad outer surface
xp13=openmc.XPlane(x0=7.62)
ss_plate = openmc.Material(7, 'ss_plate')
ss_plate.add_element('Cr', 1.7046e-2)
ss_plate.add_nuclide('Mn55', 1.3734e-3)
ss_plate.add_element('Cu', 2.0291e-4)
ss_plate.add_element('Fe', 5.8353e-2)
ss_plate.add_element('Ni', 9.0238e-3)
ss_plate.add_element('Mo', 1.2942e-4)
ss_plate.set_density('g/cm3', 7.93)

mats = openmc.Materials(
    [fuel, water, clad6061, clad5052, acrylic, clad1100, ss_plate])
mats.cross_sections = '/home/tang/nndc_hdf5/cross_sections.xml'
mats.export_to_xml()

#fuel cylinder
zc1 = openmc.ZCylinder(x0=0, y0=0, R=0.5588)
zc2 = openmc.ZCylinder(x0=0, y0=0, R=0.635)

zp7 = openmc.ZPlane(z0=0.0)
zp8 = openmc.ZPlane(z0=91.44)
zp9 = openmc.ZPlane(z0=91.92)  #top 0f clad

xp10 = openmc.XPlane(x0=40.64)
xp11 = openmc.XPlane(x0=0.0)
xp15 = openmc.XPlane(x0=48.28)
xp14 = openmc.XPlane(x0=88.92)
xp17 = openmc.XPlane(x0=96.56)
xp16 = openmc.XPlane(x0=137.2)

yp20 = openmc.YPlane(y0=32.512)
yp19 = openmc.YPlane(y0=0.0)
Ejemplo n.º 22
0
for name, frac in (zirc.get_nuclide_atom_densities().values()):
    homogenized.add_nuclide(name, frac * area_clad / area_homog)

for name, frac in (water.get_nuclide_atom_densities().values()):
    homogenized.add_nuclide(name, frac * area_channel / area_homog)

# In[8]:

materials = openmc.Materials([uo2, homogenized])

# ## Surfaces

# In[9]:

rfo = openmc.ZCylinder(R=radius_fuel)
xy_box = openmc.model.get_rectangular_prism(pitch,
                                            pitch,
                                            boundary_type='reflective')
z0 = openmc.ZPlane(z0=-10, boundary_type='reflective')
z1 = openmc.ZPlane(z0=10, boundary_type='reflective')

# ## Cells, etc.

# In[10]:

fuel = openmc.Cell(name='fuel', fill=uo2)
fuel.region = -rfo & +z0 & -z1
mod = openmc.Cell(name='moderator', fill=homogenized)
mod.region = +rfo & xy_box & +z0 & -z1
root = openmc.Universe(cells=(fuel, mod))
Ejemplo n.º 23
0
    def _build_inputs(self):
        # Instantiate some Materials and register the appropriate Nuclides
        uo2 = openmc.Material(name='UO2 fuel at 2.4% wt enrichment')
        uo2.set_density('g/cc', 10.0)
        uo2.add_nuclide('U238', 1.0)
        uo2.add_nuclide('U235', 0.02)
        uo2.add_nuclide('O16', 2.0)

        borated_water = openmc.Material(name='Borated water')
        borated_water.set_density('g/cm3', 1)
        borated_water.add_nuclide('B10', 10e-5)
        borated_water.add_nuclide('H1', 2.0)
        borated_water.add_nuclide('O16', 1.0)

        # Instantiate a Materials collection and export to XML
        materials_file = openmc.Materials([uo2, borated_water])
        materials_file.export_to_xml()

        # Instantiate ZCylinder surfaces
        fuel_or = openmc.ZCylinder(surface_id=1, x0=0, y0=0, R=1, \
             name='Fuel OR')
        left = openmc.XPlane(surface_id=2, x0=-2, name='left')
        right = openmc.XPlane(surface_id=3, x0=2, name='right')
        bottom = openmc.YPlane(y0=-2, name='bottom')
        top = openmc.YPlane(y0=2, name='top')

        left.boundary_type = 'vacuum'
        right.boundary_type = 'reflective'
        top.boundary_type = 'reflective'
        bottom.boundary_type = 'reflective'

        # Instantiate Cells
        fuel = openmc.Cell(name='fuel')
        water = openmc.Cell(name='water')

        # Use surface half-spaces to define regions
        fuel.region = -fuel_or
        water.region = +fuel_or & -right & +bottom & -top

        # Register Materials with Cells
        fuel.fill = uo2
        water.fill = borated_water

        # Instantiate pin cell Universe
        pin_cell = openmc.Universe(name='pin cell')
        pin_cell.add_cells([fuel, water])

        # Instantiate root Cell and Universe
        root_cell = openmc.Cell(name='root cell')
        root_cell.region = +left & -right & +bottom & -top
        root_cell.fill = pin_cell
        root_univ = openmc.Universe(universe_id=0, name='root universe')
        root_univ.add_cell(root_cell)

        # Instantiate a Geometry, register the root Universe
        geometry = openmc.Geometry(root_univ)
        geometry.export_to_xml()

        # Instantiate a Settings object, set all runtime parameters
        settings_file = openmc.Settings()
        settings_file.batches = 10
        settings_file.inactive = 0
        settings_file.particles = 1000
        #settings_file.output = {'tallies': True}

        # Create an initial uniform spatial source distribution
        bounds = [-0.62992, -0.62992, -1, 0.62992, 0.62992, 1]
        uniform_dist = openmc.stats.Box(bounds[:3], bounds[3:],\
             only_fissionable=True)
        settings_file.source = openmc.source.Source(space=uniform_dist)
        settings_file.export_to_xml()

        # Tallies file
        tallies_file = openmc.Tallies()

        # Create partial current tallies from fuel to water
        # Filters
        two_groups = [0., 4e6, 20e6]
        energy_filter = openmc.EnergyFilter(two_groups)
        polar_filter = openmc.PolarFilter([0, np.pi / 4, np.pi])
        azimuthal_filter = openmc.AzimuthalFilter([0, np.pi / 4, np.pi])
        surface_filter = openmc.SurfaceFilter([1])
        cell_from_filter = openmc.CellFromFilter(fuel)
        cell_filter = openmc.CellFilter(water)

        # Use Cell to cell filters for partial current
        cell_to_cell_tally = openmc.Tally(name=str('fuel_to_water_1'))
        cell_to_cell_tally.filters = [cell_from_filter, cell_filter, \
             energy_filter, polar_filter, azimuthal_filter]
        cell_to_cell_tally.scores = ['current']
        tallies_file.append(cell_to_cell_tally)

        # Use a Cell from + surface filters for partial current
        cell_to_cell_tally = openmc.Tally(name=str('fuel_to_water_2'))
        cell_to_cell_tally.filters = [cell_from_filter, surface_filter, \
             energy_filter, polar_filter, azimuthal_filter]
        cell_to_cell_tally.scores = ['current']
        tallies_file.append(cell_to_cell_tally)

        # Create partial current tallies from water to fuel
        # Filters
        cell_from_filter = openmc.CellFromFilter(water)
        cell_filter = openmc.CellFilter(fuel)

        # Cell to cell filters for partial current
        cell_to_cell_tally = openmc.Tally(name=str('water_to_fuel_1'))
        cell_to_cell_tally.filters = [cell_from_filter, cell_filter, \
             energy_filter, polar_filter, azimuthal_filter]
        cell_to_cell_tally.scores = ['current']
        tallies_file.append(cell_to_cell_tally)

        # Cell from + surface filters for partial current
        cell_to_cell_tally = openmc.Tally(name=str('water_to_fuel_2'))
        cell_to_cell_tally.filters = [cell_from_filter, surface_filter, \
             energy_filter, polar_filter, azimuthal_filter]
        cell_to_cell_tally.scores = ['current']
        tallies_file.append(cell_to_cell_tally)

        # Create a net current tally on inner surface using a surface filter
        surface_filter = openmc.SurfaceFilter([1])
        surf_tally1 = openmc.Tally(name='net_cylinder')
        surf_tally1.filters = [surface_filter, energy_filter, polar_filter, \
             azimuthal_filter]
        surf_tally1.scores = ['current']
        tallies_file.append(surf_tally1)

        # Create a net current tally on left surface using a surface filter
        # This surface has a vacuum boundary condition, so leakage is tallied
        surface_filter = openmc.SurfaceFilter([2])
        surf_tally2 = openmc.Tally(name='leakage_left')
        surf_tally2.filters = [surface_filter, energy_filter, polar_filter, \
            azimuthal_filter]
        surf_tally2.scores = ['current']
        tallies_file.append(surf_tally2)

        # Create a net current tally on right surface using a surface filter
        # This surface has a reflective boundary condition, but the zero
        # net current is not picked up because particles are only tallied once
        surface_filter = openmc.SurfaceFilter([3])
        surf_tally3 = openmc.Tally(name='net_right')
        surf_tally3.filters = [surface_filter, energy_filter]
        surf_tally3.scores = ['current']
        tallies_file.append(surf_tally3)

        surface_filter = openmc.SurfaceFilter([3])
        surf_tally3 = openmc.Tally(name='net_right')
        surf_tally3.filters = [surface_filter, energy_filter]
        surf_tally3.scores = ['current']
        tallies_file.append(surf_tally3)

        tallies_file.export_to_xml()
fuel.add_nuclide('U236', 6.4776E-08)
fuel.add_nuclide('U238', 5.7769E-04)
fuel.set_density('atom/b-cm', 9.89471078E-02)
fuel.add_s_alpha_beta('c_H_in_H2O')

mats = openmc.Materials([clad, air, fuel])
mats.cross_sections = '/home/tang/nndc_hdf5/cross_sections.xml'
mats.export_to_xml()

zp1 = openmc.ZPlane(z0=0.0)
zp2 = openmc.ZPlane(z0=83.55)
zp3 = openmc.ZPlane(z0=150.0)
zp4 = openmc.ZPlane(z0=152.5, boundary_type='vacuum')
zp5 = openmc.ZPlane(z0=-2.0, boundary_type='vacuum')

zc10 = openmc.ZCylinder(x0=0, y0=0, R=29.5)
zc20 = openmc.ZCylinder(x0=0, y0=0, R=29.8, boundary_type='vacuum')

cell1 = openmc.Cell()
region1 = +zp1 & -zp2 & -zc10
cell1.region = region1
cell1.fill = fuel

cell2 = openmc.Cell()
region2 = +zp2 & -zp3 & -zc10
cell2.region = region2
cell2.fill = air

cell3 = openmc.Cell()
cell3.region = -zp1 | +zp3 | +zc10
cell3.fill = clad
Ejemplo n.º 25
0
pyrex.set_density('g/cm3', 2.26)

mf = openmc.Materials((uo2, zirconium, water, pyrex))
mf.export_to_xml()

# color stuff
colors = {}
colors[water] = (100, 200, 200)
colors[zirconium] = (150, 150, 150)
colors[pyrex] = (100, 255, 100)
colors[uo2] = (255, 50, 50)

#fuel pin

pitch = 1.26
fuel_or = openmc.ZCylinder(R=0.39)
clad_ir = openmc.ZCylinder(R=0.40)
clad_or = openmc.ZCylinder(R=0.46)

fuel = openmc.Cell(1, 'fuel')
fuel.fill = uo2
fuel.region = -fuel_or

gap = openmc.Cell(2, 'air gap')
gap.fill = 'void'
gap.region = +fuel_or & -clad_ir

clad = openmc.Cell(3, 'clad')
clad.fill = zirconium
clad.region = +clad_ir & -clad_or
Ejemplo n.º 26
0
# Instantiate a Materials collection and export to XML
materials_file = openmc.Materials([moderator, fuel, iron])
materials_file.default_xs = '71c'
materials_file.export_to_xml()

###############################################################################
#                 Exporting to OpenMC geometry.xml file
###############################################################################

# Instantiate Surfaces
left = openmc.XPlane(surface_id=1, x0=-3, name='left')
right = openmc.XPlane(surface_id=2, x0=3, name='right')
bottom = openmc.YPlane(surface_id=3, y0=-4, name='bottom')
top = openmc.YPlane(surface_id=4, y0=4, name='top')
fuel_surf = openmc.ZCylinder(surface_id=5, x0=0, y0=0, R=0.4)

left.boundary_type = 'vacuum'
right.boundary_type = 'vacuum'
top.boundary_type = 'vacuum'
bottom.boundary_type = 'vacuum'

# Instantiate Cells
cell1 = openmc.Cell(cell_id=1, name='Cell 1')
cell2 = openmc.Cell(cell_id=101, name='cell 2')
cell3 = openmc.Cell(cell_id=102, name='cell 3')
cell4 = openmc.Cell(cell_id=500, name='cell 4')
cell5 = openmc.Cell(cell_id=600, name='cell 5')
cell6 = openmc.Cell(cell_id=601, name='cell 6')

# Use surface half-spaces to define regions
Ejemplo n.º 27
0
    def _build_inputs(self):
        ####################
        # Materials
        ####################

        moderator = openmc.Material(material_id=1)
        moderator.set_density('g/cc', 1.0)
        moderator.add_nuclide('H1', 2.0)
        moderator.add_nuclide('O16', 1.0)

        dense_fuel = openmc.Material(material_id=2)
        dense_fuel.set_density('g/cc', 4.5)
        dense_fuel.add_nuclide('U235', 1.0)

        light_fuel = openmc.Material(material_id=3)
        light_fuel.set_density('g/cc', 2.0)
        light_fuel.add_nuclide('U235', 1.0)

        mats_file = openmc.Materials([moderator, dense_fuel, light_fuel])
        mats_file.export_to_xml()

        ####################
        # Geometry
        ####################

        c1 = openmc.Cell(cell_id=1, fill=moderator)
        mod_univ = openmc.Universe(universe_id=1, cells=[c1])

        r0 = openmc.ZCylinder(r=0.3)
        c11 = openmc.Cell(cell_id=11, region=-r0)
        c11.fill = [dense_fuel, None, light_fuel, dense_fuel]
        c12 = openmc.Cell(cell_id=12, region=+r0, fill=moderator)
        fuel_univ = openmc.Universe(universe_id=11, cells=[c11, c12])

        lat = openmc.RectLattice(lattice_id=101)
        lat.lower_left = [-2.0, -2.0]
        lat.pitch = [2.0, 2.0]
        lat.universes = [[fuel_univ]*2]*2
        lat.outer = mod_univ

        x0 = openmc.XPlane(x0=-3.0)
        x1 = openmc.XPlane(x0=3.0)
        y0 = openmc.YPlane(y0=-3.0)
        y1 = openmc.YPlane(y0=3.0)
        for s in [x0, x1, y0, y1]:
            s.boundary_type = 'reflective'
        c101 = openmc.Cell(cell_id=101, fill=lat)
        c101.region = +x0 & -x1 & +y0 & -y1
        root_univ = openmc.Universe(universe_id=0, cells=[c101])

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

        ####################
        # Settings
        ####################

        sets_file = openmc.Settings()
        sets_file.batches = 5
        sets_file.inactive = 0
        sets_file.particles = 1000
        sets_file.source = openmc.Source(space=openmc.stats.Box(
            [-1, -1, -1], [1, 1, 1]))
        sets_file.export_to_xml()

        ####################
        # Plots
        ####################

        plot1 = openmc.Plot(plot_id=1)
        plot1.basis = 'xy'
        plot1.color_by = 'cell'
        plot1.filename = 'cellplot'
        plot1.origin = (0, 0, 0)
        plot1.width = (7, 7)
        plot1.pixels = (400, 400)

        plot2 = openmc.Plot(plot_id=2)
        plot2.basis = 'xy'
        plot2.color_by = 'material'
        plot2.filename = 'matplot'
        plot2.origin = (0, 0, 0)
        plot2.width = (7, 7)
        plot2.pixels = (400, 400)

        plots = openmc.Plots([plot1, plot2])
        plots.export_to_xml()
Ejemplo n.º 28
0
def hexfunction(pitch, pack_frac):

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

    #############################
    ###       MATERIALS       ###
    #############################
    mat_list = []
    enrichment = 20.0

    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
    mat_list.append(uo2)

    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 = 900  #kelvin
    mat_list.append(graphite)

    # sodium = openmc.Material(3, "sodium")
    sodium = openmc.Material()
    sodium.set_density('g/cm3', 0.8017)  # 900 K
    sodium.add_element('Na', 1.0)
    # sodium.add_s_alpha_beta('c_Graphite')
    sodium.temperature = 900  #kelvin
    mat_list.append(sodium)

    # naoh = openmc.Material(6, "naoh")
    naoh = openmc.Material()
    naoh.set_density('g/cm3', 1.5)  # 900 K
    naoh.add_element('Na', 1.0)
    naoh.add_element('O', 1.0)
    naoh.add_element('H', 1.0)
    # sodium.add_s_alpha_beta('c_Graphite')
    naoh.temperature = 900  #kelvin
    mat_list.append(naoh)

    # TRISO Materials
    fuel = openmc.Material(name='Fuel')
    fuel.set_density('g/cm3', 10.5)
    # fuel.add_nuclide('U235', 4.6716e-02)
    fuel.add_nuclide('U235', 0.0667372)
    # fuel.add_nuclide('U238', 2.8697e-01)
    fuel.add_nuclide('U238', 0.2669488)
    fuel.add_nuclide('O16', 5.0000e-01)
    fuel.add_element('C', 1.6667e-01)
    mat_list.append(fuel)

    buff = openmc.Material(name='Buffer')
    buff.set_density('g/cm3', 1.0)
    buff.add_element('C', 1.0)
    buff.add_s_alpha_beta('c_Graphite')
    mat_list.append(buff)

    PyC1 = openmc.Material(name='PyC1')
    PyC1.set_density('g/cm3', 1.9)
    PyC1.add_element('C', 1.0)
    PyC1.add_s_alpha_beta('c_Graphite')
    mat_list.append(PyC1)

    PyC2 = openmc.Material(name='PyC2')
    PyC2.set_density('g/cm3', 1.87)
    PyC2.add_element('C', 1.0)
    PyC2.add_s_alpha_beta('c_Graphite')
    mat_list.append(PyC2)

    SiC = openmc.Material(name='SiC')
    SiC.set_density('g/cm3', 3.2)
    SiC.add_element('C', 0.5)
    SiC.add_element('Si', 0.5)
    mat_list.append(SiC)

    fuel_temp = 900
    homogeneous_fuel = build_fuel_material(fuel_temp, pack_frac)
    mat_list.append(homogeneous_fuel)

    mats = openmc.Materials(mat_list)
    mats.export_to_xml()

    #############################
    ###       GEOMETRY        ###
    #############################
    pitch = 17.4
    fuel_bottom = -pitch / 2
    fuel_top = pitch / 2
    coolant_r = 4
    # fuel_r = (pitch/2 - coolant_r)/2
    fuel_r = (pitch / (3**(1 / 2)) - coolant_r) / 2

    hex_universe = openmc.Universe()

    top = openmc.ZPlane(z0=fuel_top, boundary_type='reflective')
    bottom = openmc.ZPlane(z0=fuel_bottom, boundary_type='reflective')
    surf_fuel = openmc.ZCylinder(r=fuel_r)

    # Make TRISOS to be filled in fuel cylinders by chopping up
    # fuel cylinder into segments
    n_cyls = 40
    fuel_segment_heights = np.linspace(fuel_bottom, fuel_top, n_cyls)
    segment_height = fuel_segment_heights[1] - fuel_segment_heights[0]
    fuel_planes = [bottom]
    fuel_cells = []
    for i, height in enumerate(fuel_segment_heights[1:-1]):
        this_plane = openmc.ZPlane(z0=height)
        fuel_planes.append(this_plane)
        this_cell = openmc.Cell()
        this_cell.region = +fuel_planes[i] & -fuel_planes[i + 1] & -surf_fuel
        fuel_cells.append(copy.deepcopy(this_cell))
    # last cell
    fuel_planes.append(top)
    this_cell = openmc.Cell()
    this_cell.region = +fuel_planes[-2] & -fuel_planes[-1] & -surf_fuel
    fuel_cells.append(copy.deepcopy(this_cell))

    # Make fuel cylinder
    fuel_cyl_top = openmc.ZPlane(z0=segment_height / 2)
    fuel_cyl_bottom = openmc.ZPlane(z0=-segment_height / 2)
    fuel_triso_region = -surf_fuel & +fuel_cyl_bottom & -fuel_cyl_top
    outer_radius = 425. * 1e-4
    # openmc.model.triso._Cylinder.from_region(fuel_region, outer_radius)

    spheres = [openmc.Sphere(r=r * 1e-4) for r in [215., 315., 350., 385.]]
    cells = [
        openmc.Cell(fill=fuel, region=-spheres[0]),
        openmc.Cell(fill=buff, region=+spheres[0] & -spheres[1]),
        openmc.Cell(fill=PyC1, region=+spheres[1] & -spheres[2]),
        openmc.Cell(fill=SiC, region=+spheres[2] & -spheres[3]),
        openmc.Cell(fill=PyC2, region=+spheres[3])
    ]
    triso_univ = openmc.Universe(cells=cells)
    outer_radius = 425. * 1e-4
    centers = openmc.model.pack_spheres(radius=outer_radius,
                                        region=fuel_triso_region,
                                        pf=pack_frac)
    trisos = [openmc.model.TRISO(outer_radius, triso_univ, c) for c in centers]
    outside_trisos = openmc.Intersection(~t.region for t in trisos)
    # background_region = outside_trisos & +fuel_cyl_bottom & \
    # -fuel_cyl_top & -surf_fuel
    background_region = outside_trisos
    background_cell = openmc.Cell(fill=graphite, region=background_region)

    fuel_triso_univ = openmc.Universe()
    fuel_triso_univ.add_cell(background_cell)
    for idx, triso in enumerate(trisos):
        fuel_triso_univ.add_cell(triso)

    # Fill in fuel cells with triso cells and translate to location
    for i, cell in enumerate(fuel_cells):
        cell_height = segment_height * (i + 1 / 2) + fuel_bottom
        cell.translation = [0, 0, cell_height]
        cell.fill = fuel_triso_univ
    fuel_cell_univ = openmc.Universe(cells=fuel_cells)

    # For testing solid fuel
    # test_region = +bottom & -top & -surf_fuel
    # fuel_cell = openmc.Cell(region=test_region, fill=fuel)
    # fuel_cell_univ = openmc.Universe(cells=[fuel_cell])

    coolant_cyl = openmc.ZCylinder(r=coolant_r)
    coolant_region = -coolant_cyl
    coolant_cell = openmc.Cell()
    coolant_cell.fill = naoh
    coolant_cell.region = coolant_region
    hex_universe.add_cell(coolant_cell)

    hex_prism = openmc.get_hexagonal_prism(edge_length=pitch / (3**1 / 2),
                                           boundary_type='reflective')

    graphite_region = hex_prism & +coolant_cyl & -top & +bottom
    graphite_cell = openmc.Cell()
    graphite_cell.fill = graphite
    graphite_cell.region = graphite_region
    hex_universe.add_cell(graphite_cell)

    fuel_cells = []
    root3 = 3**(1 / 2)
    half_to_vertex = pitch / root3 / 2
    half_to_edge = pitch / 4

    # fuel_id = 100
    offset_angle = 30
    n_pins = 6
    for i in range(n_pins):
        theta = (offset_angle + i / n_pins * 360) * pi / 180
        r = coolant_r + fuel_r + 0.01
        x = r * np.cos(theta)
        y = r * np.sin(theta)

        fuel_cyl_bound = openmc.ZCylinder(x0=x, y0=y, r=fuel_r)
        graphite_cell.region &= +fuel_cyl_bound

        fuel_cell = openmc.Cell()
        fuel_cell.fill = copy.deepcopy(fuel_cell_univ)
        fuel_cell.translation = [x, y, 0]
        fuel_cell.region = -fuel_cyl_bound & -top & +bottom
        # fuel_cell.id = fuel_id
        # fuel_id += 1

        fuel_cells.append(fuel_cell)
        hex_universe.add_cell(fuel_cell)

    geom = openmc.Geometry(hex_universe)
    # geom = openmc.Geometry(fuel_cell_univ)
    geom.export_to_xml()

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

    settings.source = src
    settings.batches = 50
    settings.inactive = 10
    settings.particles = 200

    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        ###
    #############################
    zs = np.linspace(0, 1, 2)
    plots = []
    for z in zs:
        p = openmc.Plot()
        p.filename = 'pinplot' + str(z)
        p.width = (1.4 * pitch, 1.4 * pitch)
        p.pixels = (2000, 2000)
        p.color_by = 'material'
        p.origin = [0, 0, z]
        # p.color_by = 'cell'
        # p.colors = {homogeneous_fuel: 'yellow', naoh: 'grey', graphite: 'black'}
        p.colors = {fuel: 'yellow', naoh: 'grey', graphite: 'black'}
        plots.append(copy.deepcopy(p))

    plots = openmc.Plots(plots)
    plots.export_to_xml()

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

    #############################
    ###       EXECUTION       ###
    #############################
    # openmc.run(output=False)
    openmc.run()
    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
Ejemplo n.º 29
0
## Universes and in-line plotting

universe = openmc.Universe()
universe.add_cell(cell)

# universe.plot(width=(2.0, 2.0))
# universe.plot(width=(2.0, 2.0), basis='xz')
# universe.plot(width=(2.0, 2.0), basis='xz', colors={cell: 'fuchsia'})

## Pin cell geometry

# Modifications
z_top = openmc.ZPlane(z0=0.5, boundary_type='reflective')
z_bot = openmc.ZPlane(z0=-0.5, boundary_type='reflective')

fuel_or = openmc.ZCylinder(R=0.39)
clad_ir = openmc.ZCylinder(R=0.40)
clad_or = openmc.ZCylinder(R=0.46)

fuel_region = -fuel_or & +z_bot & -z_top
gap_region = +fuel_or & -clad_ir & +z_bot & -z_top
clad_region = +clad_ir & -clad_or & +z_bot & -z_top

fuel = openmc.Cell(1, 'fuel')
fuel.fill = uo2
fuel.region = fuel_region

gap = openmc.Cell(2, 'air gap')
gap.region = gap_region

clad = openmc.Cell(3, 'clad')
Ejemplo n.º 30
0
borated_water.add_nuclide(o16, 2.4672e-2)
borated_water.add_nuclide(o17, 6.0099e-5)
borated_water.add_s_alpha_beta('HH2O', '71t')

# Instantiate a MaterialsFile, register all Materials, and export to XML
materials_file = openmc.MaterialsFile()
materials_file.default_xs = '71c'
materials_file.add_materials([uo2, helium, zircaloy, borated_water])
materials_file.export_to_xml()

###############################################################################
#                 Exporting to OpenMC geometry.xml File
###############################################################################

# Instantiate ZCylinder surfaces
fuel_or = openmc.ZCylinder(surface_id=1, x0=0, y0=0, R=0.39218, name='Fuel OR')
clad_ir = openmc.ZCylinder(surface_id=2, x0=0, y0=0, R=0.40005, name='Clad IR')
clad_or = openmc.ZCylinder(surface_id=3, x0=0, y0=0, R=0.45720, name='Clad OR')
left = openmc.XPlane(surface_id=4, x0=-0.62992, name='left')
right = openmc.XPlane(surface_id=5, x0=0.62992, name='right')
bottom = openmc.YPlane(surface_id=6, y0=-0.62992, name='bottom')
top = openmc.YPlane(surface_id=7, y0=0.62992, name='top')

left.boundary_type = 'reflective'
right.boundary_type = 'reflective'
top.boundary_type = 'reflective'
bottom.boundary_type = 'reflective'

# Instantiate Cells
fuel = openmc.Cell(cell_id=1, name='cell 1')
gap = openmc.Cell(cell_id=2, name='cell 2')