Ejemplo n.º 1
0
# Instantiate some Macroscopic Data
uo2_data = openmc.Macroscopic('UO2')
h2o_data = openmc.Macroscopic('LWTR')

# Instantiate some Materials and register the appropriate Macroscopic objects
uo2 = openmc.Material(material_id=1, name='UO2 fuel')
uo2.set_density('macro', 1.0)
uo2.add_macroscopic(uo2_data)

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.cross_sections = "./mgxs.h5"
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'
rubber.add_nuclide('H1', 5.8178e-2)
rubber.add_element('Si', 9.6360e-5)
rubber.add_nuclide('C0', 4.3562e-2)
rubber.add_element('Ca', 2.5660e-3)
rubber.add_nuclide('S32', 4.7820e-4)
rubber.add_nuclide('O16', 1.2461e-2)
rubber.set_density('g/cm3', 1.498)

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=25.4)
Ejemplo n.º 3
0
import openmc

mats = openmc.Materials()

mat = openmc.Material(1)
mat.name = "Uranium Oxyfluoride Solution"
mat.set_density('sum')
mat.add_nuclide('U234', 5.8643e-07)
mat.add_nuclide('U235', 4.7739e-05)
mat.add_nuclide('U238', 2.8625e-06)
mat.add_nuclide('F19', 1.0238e-04)
mat.add_element('O', 3.3332e-02)
mat.add_nuclide('H1', 6.6459e-02)
mats.append(mat)

mat = openmc.Material(2)
mat.name = "1100 Aluminum"
mat.set_density('sum')
mat.add_element('Al', 5.9699e-02)
mat.add_element('Si', 5.5202e-04)
mat.add_element('Cu', 5.1364e-05)
mat.add_element('Zn', 2.4958e-05)
mat.add_element('Mn', 1.4853e-05)
mats.append(mat)

mats.export_to_xml()
Ejemplo n.º 4
0
import openmc

# Create plutonium metal material
pu = openmc.Material()
pu.set_density('sum')
pu.add_nuclide('Pu239', 3.7047e-02)
pu.add_nuclide('Pu240', 1.7512e-03)
pu.add_nuclide('Pu241', 1.1674e-04)
pu.add_element('Ga', 1.3752e-03)
mats = openmc.Materials([pu])
mats.export_to_xml()

# Create a single cell filled with the Pu metal
sphere = openmc.Sphere(r=6.3849, boundary_type='vacuum')
cell = openmc.Cell(fill=pu, region=-sphere)
geom = openmc.Geometry([cell])
geom.export_to_xml()

# Finally, define some run settings
settings = openmc.Settings()
settings.batches = 200
settings.inactive = 10
settings.particles = 10000
settings.export_to_xml()

# Run the simulation
openmc.run()

# Get the resulting k-effective value
n = settings.batches
with openmc.StatePoint(f'statepoint.{n}.h5') as sp:
Ejemplo n.º 5
0
copper = openmc.Material(name='Copper')
copper.set_density('g/cm3', 8.5)
copper.add_element('Cu', 1.0)

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 = 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 = 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
Ejemplo n.º 6
0
clad5052.add_nuclide('Mn55',1.4743e-5)
clad5052.set_density('g/cm3',2.69)




acrylic=openmc.Material(6,'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,clad5052,clad1100,clad6061,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.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)#first
Ejemplo n.º 7
0
def make_materials_geometry_tallies(enrichment_fraction):

    #MATERIALS#

    breeder_material = openmc.Material(
        1, "breeder_material")  #Pb84.2Li15.8 with natural enrichment of Li6
    breeder_material.add_element('Pb', 84.2, 'ao')
    breeder_material.add_nuclide('Li6', enrichment_fraction * 15.8, 'ao')
    breeder_material.add_nuclide('Li7', (1.0 - enrichment_fraction) * 15.8,
                                 'ao')
    breeder_material.set_density('atom/b-cm', 3.2720171e-2)  # around 11 g/cm3

    copper = openmc.Material(name='copper')
    copper.set_density('g/cm3', 8.5)
    copper.add_element('Cu', 1.0)

    eurofer = openmc.Material(name='eurofer')
    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 = openmc.Materials([breeder_material, eurofer, copper])

    #GEOMETRY#

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

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

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

    inner_vessel_region = -vessel_inner & +central_shield_outer_surface
    inner_vessel_cell = openmc.Cell(region=inner_vessel_region)

    first_wall_region = -first_wall_outer_surface & +vessel_inner
    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
    breeder_blanket_cell = openmc.Cell(region=breeder_blanket_region)
    breeder_blanket_cell.fill = breeder_material
    breeder_blanket_cell.name = 'breeder_blanket'

    universe = openmc.Universe(cells=[
        central_sol_cell, central_shield_cell, inner_vessel_cell,
        first_wall_cell, breeder_blanket_cell
    ])
    geom = openmc.Geometry(universe)

    #SIMULATION SETTINGS#

    sett = openmc.Settings()
    batches = 3
    sett.batches = batches
    sett.inactive = 50
    sett.particles = 5000
    sett.run_mode = 'fixed source'

    source = openmc.Source()
    source.space = openmc.stats.Point((350, 0, 0))
    source.angle = openmc.stats.Isotropic()
    source.energy = openmc.stats.Discrete([14e6], [1])
    sett.source = source

    #TALLIES#

    tallies = openmc.Tallies()

    cell_filter = openmc.CellFilter(breeder_blanket_cell)
    tbr_tally = openmc.Tally(2, name='TBR')
    tbr_tally.filters = [cell_filter]
    tbr_tally.scores = ['205']
    tallies.append(tbr_tally)

    #RUN OPENMC #
    model = openmc.model.Model(geom, mats, sett, tallies)
    model.run()
    sp = openmc.StatePoint('statepoint.' + str(batches) + '.h5')

    tbr_tally = sp.get_tally(name='TBR')
    tbr_tally_result = tbr_tally.sum[0][0][
        0] / batches  #for some reason the tally sum is a nested list
    tbr_tally_std_dev = tbr_tally.std_dev[0][0][
        0] / batches  #for some reason the tally std_dev is a nested list

    return {
        'enrichment_fraction': enrichment_fraction,
        'tbr_tally_result': tbr_tally_result,
        'tbr_tally_std_dev': tbr_tally_std_dev
    }
Ejemplo n.º 8
0
o16 = openmc.Nuclide('O-16')
u235 = openmc.Nuclide('U-235')

# Instantiate some Materials and register the appropriate Nuclides
fuel = openmc.Material(material_id=1, name='fuel')
fuel.set_density('g/cc', 4.5)
fuel.add_nuclide(u235, 1.)

moderator = openmc.Material(material_id=2, name='moderator')
moderator.set_density('g/cc', 1.0)
moderator.add_nuclide(h1, 2.)
moderator.add_nuclide(o16, 1.)
moderator.add_s_alpha_beta('HH2O', '71t')

# Instantiate a Materials collection and export to XML
materials_file = openmc.Materials([moderator, fuel])
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=-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)
clad5052 = openmc.Material(5, 'clad5052')
clad5052.add_element('Mg', 1.6663e-3)
clad5052.add_nuclide('Al27', 5.8028e-2)
clad5052.add_element('Si', 1.2978e-4)
clad5052.add_element('Cu', 1.2746e-5)
clad5052.add_element('Zn', 1.2387e-5)
clad5052.add_element('Cr', 7.7888e-5)
clad5052.add_element('Fe', 6.5265e-5)
clad5052.add_nuclide('Mn55', 1.4743e-5)
clad5052.set_density('g/cm3', 2.69)

lead = openmc.Material(7, 'lead')
lead.add_element('Pb', 3.2132e-2)
lead.set_density('g/cm3', 11.07)

mats = openmc.Materials(
    [fuel, water, clad6061, clad5052, acrylic, clad1100, lead])
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=38.608)
xp11 = openmc.XPlane(x0=0.0)
xp15 = openmc.XPlane(x0=51.708)
xp14 = openmc.XPlane(x0=90.316)
Ejemplo n.º 10
0
    def __init__(self,
                 model,
                 chain_file=None,
                 prev_results=None,
                 diff_burnable_mats=False,
                 normalization_mode="fission-q",
                 fission_q=None,
                 dilute_initial=1.0e3,
                 fission_yield_mode="constant",
                 fission_yield_opts=None,
                 reaction_rate_mode="direct",
                 reaction_rate_opts=None,
                 reduce_chain=False,
                 reduce_chain_level=None):
        # check for old call to constructor
        if isinstance(model, openmc.Geometry):
            msg = "As of version 0.13.0 openmc.deplete.Operator requires an " \
                "openmc.Model object rather than the openmc.Geometry and " \
                "openmc.Settings parameters. Please use the geometry and " \
                "settings objects passed here to create a model with which " \
                "to generate the depletion Operator."
            raise TypeError(msg)

        # Determine cross sections / depletion chain
        cross_sections = _find_cross_sections(model)
        if chain_file is None:
            chain_file = _find_chain_file(cross_sections)

        check_value('fission yield mode', fission_yield_mode,
                    self._fission_helpers.keys())
        check_value('normalization mode', normalization_mode,
                    ('energy-deposition', 'fission-q', 'source-rate'))
        if normalization_mode != "fission-q":
            if fission_q is not None:
                warn("Fission Q dictionary will not be used")
                fission_q = None
        super().__init__(chain_file, fission_q, dilute_initial, prev_results)
        self.round_number = False
        self.model = model
        self.settings = model.settings
        self.geometry = model.geometry

        # determine set of materials in the model
        if not model.materials:
            model.materials = openmc.Materials(
                model.geometry.get_all_materials().values())
        self.materials = model.materials

        self.diff_burnable_mats = diff_burnable_mats
        self.cleanup_when_done = True

        # Reduce the chain before we create more materials
        if reduce_chain:
            all_isotopes = set()
            for material in self.materials:
                if not material.depletable:
                    continue
                for name, _dens_percent, _dens_type in material.nuclides:
                    all_isotopes.add(name)
            self.chain = self.chain.reduce(all_isotopes, reduce_chain_level)

        # Differentiate burnable materials with multiple instances
        if self.diff_burnable_mats:
            self._differentiate_burnable_mats()

        # Clear out OpenMC, create task lists, distribute
        openmc.reset_auto_ids()
        self.burnable_mats, volume, nuclides = self._get_burnable_mats()
        self.local_mats = _distribute(self.burnable_mats)

        # Generate map from local materials => material index
        self._mat_index_map = {
            lm: self.burnable_mats.index(lm)
            for lm in self.local_mats
        }

        if self.prev_res is not None:
            # Reload volumes into geometry
            prev_results[-1].transfer_volumes(self.model)

            # Store previous results in operator
            # Distribute reaction rates according to those tracked
            # on this process
            if comm.size == 1:
                self.prev_res = prev_results
            else:
                self.prev_res = ResultsList()
                mat_indexes = _distribute(range(len(self.burnable_mats)))
                for res_obj in prev_results:
                    new_res = res_obj.distribute(self.local_mats, mat_indexes)
                    self.prev_res.append(new_res)

        # Determine which nuclides have incident neutron data
        self.nuclides_with_data = self._get_nuclides_with_data(cross_sections)

        # Select nuclides with data that are also in the chain
        self._burnable_nucs = [
            nuc.name for nuc in self.chain.nuclides
            if nuc.name in self.nuclides_with_data
        ]

        # Extract number densities from the geometry / previous depletion run
        self._extract_number(self.local_mats, volume, nuclides, self.prev_res)

        # Create reaction rates array
        self.reaction_rates = ReactionRates(self.local_mats,
                                            self._burnable_nucs,
                                            self.chain.reactions)

        # Get classes to assist working with tallies
        if reaction_rate_mode == "direct":
            self._rate_helper = DirectReactionRateHelper(
                self.reaction_rates.n_nuc, self.reaction_rates.n_react)
        elif reaction_rate_mode == "flux":
            if reaction_rate_opts is None:
                reaction_rate_opts = {}

            # Ensure energy group boundaries were specified
            if 'energies' not in reaction_rate_opts:
                raise ValueError(
                    "Energy group boundaries must be specified in the "
                    "reaction_rate_opts argument when reaction_rate_mode is"
                    "set to 'flux'.")

            self._rate_helper = FluxCollapseHelper(self.reaction_rates.n_nuc,
                                                   self.reaction_rates.n_react,
                                                   **reaction_rate_opts)
        else:
            raise ValueError("Invalid reaction rate mode.")

        if normalization_mode == "fission-q":
            self._normalization_helper = ChainFissionHelper()
        elif normalization_mode == "energy-deposition":
            score = "heating" if self.settings.photon_transport else "heating-local"
            self._normalization_helper = EnergyScoreHelper(score)
        else:
            self._normalization_helper = SourceRateHelper()

        # Select and create fission yield helper
        fission_helper = self._fission_helpers[fission_yield_mode]
        fission_yield_opts = ({} if fission_yield_opts is None else
                              fission_yield_opts)
        self._yield_helper = fission_helper.from_operator(
            self, **fission_yield_opts)
Ejemplo n.º 11
0
zirconium = openmc.Material(name='clad')
zirconium.add_element('Zr', 4.2300e-2)
zirconium.set_density('sum')
zirconium.temperature = 300

water = openmc.Material(name='Borated')
water.add_nuclide('H1', 6.694e-2)
water.add_nuclide('O16', 3.347e-2)
water.add_nuclide('B10', 6.6262e-6)
water.add_nuclide('B11', 2.6839e-5)
water.add_s_alpha_beta('c_H_in_H2O')
water.set_density('sum')
water.temperature = 323.6

mat = openmc.Materials([fuel, water, zirconium])
mat.export_to_xml()

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

fuel_or = openmc.ZCylinder(x0=0.0, y0=0.0, r=0.386)
clad_ir = openmc.ZCylinder(x0=0.0, y0=0.0, r=0.45)

min_z = openmc.ZPlane(z0=-137.413, boundary_type='vacuum')
max_z = openmc.ZPlane(z0=+137.413, boundary_type='vacuum')

pin_cell_universe = openmc.Universe(name='Fuel Pin')

fuel_re = openmc.Cell(name='fuel region', region=-fuel_or, fill=fuel)
pin_cell_universe.add_cell(fuel_re)
Ejemplo n.º 12
0
def sphere_with_firstwall_model(
        material_for_structure,
        blanket_breeder_material,
        blanket_coolant_material,
        firstwall_coolant_material,
        blanket_breeder_li6_enrichment,  # this is a percentage
        coolant_pressure,  # this is in Pa
        blanket_coolant_temperature_in_C,
        firstwall_coolant_temperature_in_C,
        blanket_breeder_fraction,
        blanket_coolant_fraction,
        blanket_structural_fraction,
        blanket_breeder_temperature_in_C = None, #needed for liquid breeders like lithium lead
        firstwall_thickness = 2.7,  # this is in cm
        blanket_thickness = 200,  # this is in cm
        inner_radius = 1000,
        firstwall_armour_fraction = 0.106305, # equivilent to 3mm and based on https://doi.org/10.1016/j.fusengdes.2017.02.008
        firstwall_coolant_fraction= 0.333507, # based on https://doi.org/10.1016/j.fusengdes.2017.02.008
        firstwall_structural_fraction = 0.560188, # based on https://doi.org/10.1016/j.fusengdes.2017.02.008
        blanket_multipler_material = None, #used for combined breeder multiplier options
        blanket_multiplier_fraction = None, #used for combined breeder multiplier options
        blanket_breeder_material_packing_fraction = None, #used for combined breeder multiplier options
        blanket_multiplier_packing_fraction = None, #used for combined breeder multiplier options
        blanket_multiplier_material = None #used for combined breeder multiplier options
        ):

    breeder_percent_in_breeder_plus_multiplier_ratio = 100 * (blanket_breeder_fraction / (blanket_breeder_fraction + blanket_multiplier_fraction))

    inputs = locals()

    """ 
    This function builds materials for the homogenised blanket material, homogenised firstwall material
    The creates a simple sphere geometry with a simple point source and TBR tally on the blanket
    The function also carries out the simulation and writes the results to a JSON file
    """

    # creates homogensied blanket material using a single breeder / multiplier material (e.g lithium lead)
    if blanket_breeder_material == 'Pb842Li158':
        blanket_material =  MultiMaterial(material_tag = 'blanket_material',
                            materials = [
                                        Material(material_name = material_for_structure),
                                        Material(material_name = blanket_coolant_material,
                                                 temperature_in_C = blanket_coolant_temperature_in_C,
                                                 pressure_in_Pa = coolant_pressure),
                                        Material(material_name = blanket_breeder_material, 
                                                 enrichment = blanket_breeder_li6_enrichment,
                                                 temperature_in_C = blanket_breeder_temperature_in_C),
                                        ],
                            fracs = [blanket_structural_fraction,
                                    blanket_coolant_fraction,
                                    blanket_breeder_fraction],
                            percent_type='vo'
                            ).openmc_material

    # creates homogensied blanket material using a combined breeder multiplier material (e.g lithium ceramic with be multiplier)
    else:

        blanket_material =  MultiMaterial(
                                material_tag = 'blanket_material',
                                materials = [
                                            Material(material_name = material_for_structure),
                                            Material(material_name = blanket_coolant_material,
                                                    temperature_in_C = blanket_coolant_temperature_in_C,
                                                    pressure_in_Pa = coolant_pressure),
                                            Material(material_name = blanket_breeder_material, 
                                                    enrichment = blanket_breeder_li6_enrichment,
                                                    packing_fraction = blanket_breeder_material_packing_fraction),
                                            Material(material_name = blanket_multipler_material,
                                                    packing_fraction = blanket_multiplier_packing_fraction),
                                            ],
                                fracs = [blanket_structural_fraction,
                                        blanket_coolant_fraction,
                                        blanket_breeder_fraction,
                                        blanket_multiplier_fraction],
                                percent_type='vo'
                                ).openmc_material


    # creates homogensied firstwall material with eurofer, tungsten and a coolant
    firstwall_material = MultiMaterial(material_tag = 'firstwall_material',
                                        materials = [
                                            Material(material_name = 'tungsten'),
                                            Material(material_name = firstwall_coolant_material,
                                                        temperature_in_C = firstwall_coolant_temperature_in_C,
                                                        pressure_in_Pa = coolant_pressure),
                                            Material(material_name = 'eurofer')],
                                        fracs = [firstwall_armour_fraction,
                                                 firstwall_coolant_fraction,
                                                 firstwall_structural_fraction]
                                        ).openmc_material

    mats = openmc.Materials([blanket_material, firstwall_material]) 

    # creates surfaces
    breeder_blanket_inner_surface = openmc.Sphere(r=inner_radius+firstwall_thickness)
    firstwall_outer_surface = openmc.Sphere(r=inner_radius)  

    inner_void_region = -firstwall_outer_surface 
    inner_void_cell = openmc.Cell(region=inner_void_region) 
    inner_void_cell.name = 'inner_void'

    firstwall_region = +firstwall_outer_surface & -breeder_blanket_inner_surface 
    firstwall_cell = openmc.Cell(name='firstwall', region=firstwall_region)
    firstwall_cell.fill = firstwall_material

    breeder_blanket_outer_surface = openmc.Sphere(r=inner_radius+firstwall_thickness+blanket_thickness, boundary_type='vacuum')
    breeder_blanket_region = -breeder_blanket_outer_surface & +breeder_blanket_inner_surface
    breeder_blanket_cell = openmc.Cell(name = 'breeder_blanket', region=breeder_blanket_region) 
    breeder_blanket_cell.fill = blanket_material

    universe = openmc.Universe(cells=[inner_void_cell, 
                                      firstwall_cell,
                                      breeder_blanket_cell])

    geom = openmc.Geometry(universe)

    # assigns simulation settings
    sett = openmc.Settings()
    sett.batches = 200  # this is minimum number of batches that will be run
    sett.trigger_active = True
    sett.trigger_max_batches =  1500  # this is maximum number of batches that will be run
    sett.particles = 300
    sett.verbosity = 1
    sett.run_mode = 'fixed source'

    # sets a 14MeV (distributuion) point source
    source = openmc.Source()
    source.space = openmc.stats.Point((0,0,0))
    source.angle = openmc.stats.Isotropic()
    source.energy = openmc.stats.Muir(e0=14080000.0, m_rat=5.0, kt=20000.0) #neutron energy = 14.08MeV, AMU for D + T = 5, temperature is 20KeV
    sett.source = source

    # this is the tally set up
    tallies = openmc.Tallies()

    # define filters
    cell_filter_breeder = openmc.CellFilter(breeder_blanket_cell)
    particle_filter = openmc.ParticleFilter(['neutron'])

    # creates the TBR tally using the filters and sets a completion trigger
    tally = openmc.Tally(name='TBR')
    tally.filters = [cell_filter_breeder, particle_filter]
    tally.scores = ['(n,Xt)'] # where X is a wildcard, if MT 105 or (n,t) then some tritium production will be missed, for example (n,nt) which happens in Li7 would be missed
    tally.triggers = [openmc.Trigger(trigger_type='rel_err', threshold=0.0001)]  # This stops the simulation if the threshold is meet
    tallies.append(tally)

    # collects all the model parts and runs the model
    model = openmc.model.Model(geom, mats, sett, tallies)
    sp_filename = model.run(output=False)

    # opens the output file and retrieves the tally results
    sp = openmc.StatePoint(sp_filename)

    tally = sp.get_tally(name='TBR')

    df = tally.get_pandas_dataframe()

    tally_result = df['mean'].sum()
    tally_std_dev = df['std. dev.'].sum()

    # combines the tally results with the input data
    inputs.update({'tbr': tally_result})
    inputs.update({'tbr_error': tally_std_dev})

    return inputs
Ejemplo n.º 13
0
#                 Exporting to OpenMC materials.xml file
###############################################################################

# Instantiate some Materials and register the appropriate Nuclides
fuel = openmc.Material(material_id=1, name='fuel')
fuel.set_density('g/cc', 4.5)
fuel.add_nuclide('U235', 1.)

moderator = openmc.Material(material_id=2, name='moderator')
moderator.set_density('g/cc', 1.0)
moderator.add_element('H', 2.)
moderator.add_element('O', 1.)
moderator.add_s_alpha_beta('c_H_in_H2O')

# 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 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)
Ejemplo n.º 14
0
        spheres.append(openmc.Cell(region=-sphere, name=cell_name))

# setup the three larger spheres
sphere1 = openmc.Sphere(0, 1, 0, 1.0, boundary_type='vacuum')
spheres.append(openmc.Cell(region=-sphere1, name='Dielectric'))

sphere2 = openmc.Sphere(-4, 1, 0, 1.0, boundary_type='vacuum')
spheres.append(openmc.Cell(region=-sphere2, name='Lambertian'))

sphere3 = openmc.Sphere(4, 1, 0, 1.0, boundary_type='vacuum')
spheres.append(openmc.Cell(region=-sphere3, name='Metal'))

model = openmc.model.Model()

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

# Placeholder materials file
openmc.Materials().export_to_xml()

settings = openmc.Settings()
settings.particles = 500
settings.batches = 10
settings.inactive = 1

settings.export_to_xml()



Ejemplo n.º 15
0
def generate_mat_and_geom(pln_num):
    # 1.6 enriched fuel
    fuel = openmc.Material(name='1.6% Fuel')
    fuel.set_density('g/cm3', 10.31341)
    fuel.add_nuclide('U235', 3.7503e-4)
    fuel.add_nuclide('U238', 2.2625e-2)
    fuel.add_nuclide('O16', 4.6007e-2)
    # borated water
    water = openmc.Material(name='Borated Water')
    water.set_density('g/cm3', 0.740582)
    water.add_nuclide('H1', 4.9457e-2)
    water.add_nuclide('O16', 2.4732e-2)
    water.add_nuclide('B10', 8.0042e-6)
    # zircaloy
    zircaloy = openmc.Material(name='Zircaloy')
    zircaloy.set_density('g/cm3', 6.55)
    zircaloy.add_nuclide('Zr90', 7.2758e-3)

    # Instantiate a Materials collection
    materials_file = openmc.Materials([fuel, water, zircaloy])
    # Export to "materials.xml"
    materials_file.export_to_xml()

    # Create cylinders for the fuel and clad
    NumPln = pln_num
    fuel_radius = []
    Rout = 0.392
    Cout = 0.457
    # darea = np.pi*Rout**2/NumRad
    # area = 0
    # Rlist = []
    # for i in range(0,NumRad):
    #     area += darea
    #     r = np.sqrt(area/np.pi)
    #     Rlist.append(r)
    #     fuel_radius.append(openmc.ZCylinder(x0=0.0, y0=0.0, R=r))

    clad_outer_radius = openmc.ZCylinder(x0=0.0, y0=0.0, R=Cout)
    fuel_outer_radius = openmc.ZCylinder(x0=0.0, y0=0.0, R=Rout)
    # Create a Universe to encapsulate a fuel pin
    min_x = openmc.XPlane(x0=-0.63, boundary_type='reflective')
    max_x = openmc.XPlane(x0=+0.63, boundary_type='reflective')
    min_y = openmc.YPlane(y0=-0.63, boundary_type='reflective')
    max_y = openmc.YPlane(y0=+0.63, boundary_type='reflective')
    min_z = openmc.ZPlane(z0=-100., boundary_type='vacuum')
    max_z = openmc.ZPlane(z0=+100., boundary_type='vacuum')

    zmin = -100
    zmax = 100
    dx = (zmax - zmin) / pln_num
    planes = []
    for i in range(1, NumPln):
        planes.append(openmc.ZPlane(z0=dx * i - 100))
    # top = openmc.ZPlane(z0=zmax, boundary_type='reflective')

    fuelcelllist = []
    for i in range(0, len(planes) + 1):
        if i == 0:
            fuel_cell = openmc.Cell(name='fuel',
                                    fill=fuel,
                                    region=-fuel_outer_radius & +min_z
                                    & -planes[0])
        elif i == pln_num - 1:
            fuel_cell = openmc.Cell(name='fuel',
                                    fill=fuel,
                                    region=-fuel_outer_radius
                                    & +planes[pln_num - 2] & -max_z)
        else:
            fuel_cell = openmc.Cell(name='fuel',
                                    fill=fuel,
                                    region=-fuel_outer_radius & +planes[i - 1]
                                    & -planes[i])
        fuelcelllist.append(fuel_cell)

    fuel_cell_universe = openmc.Universe(name='Total Fuel Cell')
    for j in range(0, len(fuelcelllist)):
        fuel_cell_universe.add_cell(fuelcelllist[j])

    #Create total fuel cell
    total_fuel_cell = openmc.Cell(name='totalfuelcell')
    total_fuel_cell.fill = fuel_cell_universe
    total_fuel_cell.region = -fuel_outer_radius & +min_z & -max_z

    # Create a clad Cell
    clad_cell = openmc.Cell(name='1.6% Clad')
    clad_cell.fill = zircaloy
    clad_cell.region = +fuel_outer_radius & -clad_outer_radius & +min_x & -max_x & +min_y & -max_y & +min_z & -max_z

    # Create a moderator Cell
    moderator_cell = openmc.Cell(name='1.6% Moderator')
    moderator_cell.fill = water
    moderator_cell.region = +clad_outer_radius & +min_x & -max_x & +min_y & -max_y & +min_z & -max_z

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

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

    # Export to "geometry.xml"
    geometry.export_to_xml()
    # openmc.plot_geometry(output=False)
    return fuelcelllist, total_fuel_cell
fuel_material.add_nuclide('Li7', 0.1090, 'wo')
fuel_material.add_nuclide('Li6', 5e-6, 'wo')
fuel_material.add_nuclide('F19', 0.6680, 'wo')
fuel_material.add_nuclide('Be9', 0.0627, 'wo')
fuel_material.add_nuclide('U235', 0.0167, 'wo')
fuel_material.add_nuclide('U238', 0.0344, 'wo')
fuel_material.set_density('g/cm3', 2.146)  # see Moltres paper

# Create the moderator Material
moderator_material = openmc.Material(2, "moderator")
moderator_material.add_element('C', 1, 'wo')
moderator_material.set_density('g/cm3', 1.86)  # see Moltres paper
moderator_material.add_s_alpha_beta('c_Graphite')

# Create the Materials and export to XML
msre_materials = openmc.Materials([fuel_material, moderator_material])
msre_materials.export_to_xml()

##################
#### GEOMETRY ####
##################

# Reactor_core parameters
R = 72.5  # [cm], radius of the reactor reactor_core
H = 151.75  # [cm], height of the reactor reactor_core
num_segments = 14  # fuel and moderator segments
pitch = R / num_segments
x = 0.2379522  # what is this???
fuel_radius = x * pitch
moderator_radius = pitch - fuel_radius
Ejemplo n.º 17
0
fuel1 = openmc.Material(material_id=1, name='fuel')
fuel1.set_density('g/cc', 4.5)
fuel1.add_nuclide('U235', 1.)

fuel2 = openmc.Material(material_id=2, name='depleted fuel')
fuel2.set_density('g/cc', 4.5)
fuel2.add_nuclide('U238', 1.)

moderator = openmc.Material(material_id=3, name='moderator')
moderator.set_density('g/cc', 1.0)
moderator.add_element('H', 2.)
moderator.add_element('O', 1.)
moderator.add_s_alpha_beta('c_H_in_H2O')

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

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

# Instantiate planar surfaces
x1 = openmc.XPlane(surface_id=1, x0=-10)
x2 = openmc.XPlane(surface_id=2, x0=-7)
x3 = openmc.XPlane(surface_id=3, x0=-4)
x4 = openmc.XPlane(surface_id=4, x0=4)
x5 = openmc.XPlane(surface_id=5, x0=7)
x6 = openmc.XPlane(surface_id=6, x0=10)
y1 = openmc.YPlane(surface_id=11, y0=-10)
y2 = openmc.YPlane(surface_id=12, y0=-7)
Ejemplo n.º 18
0
clad.add_element('C', 1.3623E-02)
clad.set_density('atom/b-cm', 6.811600E-02)
clad.temperature = 300

fuel = openmc.Material(3, 'fuel')
fuel.add_nuclide('H1', 5.7694E-02)
fuel.add_nuclide('O16', 3.7970E-02)
fuel.add_nuclide('N14', 2.3712E-03)
fuel.add_nuclide('U234', 9.5863E-07)
fuel.add_nuclide('U235', 1.0854E-04)
fuel.add_nuclide('U238', 9.5565E-04)
fuel.set_density('atom/b-cm', 9.910035E-02)
fuel.add_s_alpha_beta('c_H_in_H2O')
fuel.temperature = 300

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

#Geometry
zc1 = openmc.ZCylinder(x0=0, y0=0, R=55.)
zc2 = openmc.ZCylinder(x0=0, y0=0, R=55.6)
zc3 = openmc.ZCylinder(x0=0, y0=0, R=99.2)
zc4 = openmc.ZCylinder(x0=0, y0=0, R=100., boundary_type='vacuum')

zp5 = openmc.ZPlane(z0=-38.5, boundary_type='vacuum')
zp6 = openmc.ZPlane(z0=-37.5)
zp7 = openmc.ZPlane(z0=-1.5)
zp8 = openmc.ZPlane(z0=0.)
zp9 = openmc.ZPlane(z0=108.)  #water level
zp10 = openmc.ZPlane(z0=248.5, boundary_type='vacuum')
Ejemplo n.º 19
0

normal_water = openmc.Material(material_id=5, name='Normal water')
normal_water.set_density('g/cm3', 0.9998396)
normal_water.add_element('H', 2)
normal_water.add_element('O', 1)
normal_water.add_s_alpha_beta('c_H_in_H2O')

heavy_water = openmc.Material(material_id=6, name='Heavy water')
heavy_water.set_density('g/cm3', 1.107 )
heavy_water.add_nuclide('H2', 2)
heavy_water.add_element('O', 1)
heavy_water.add_s_alpha_beta('c_D_in_D2O')

# Instantiate a Materials collection and export to XML
materials_file = openmc.Materials([uo2, helium, zircaloy, borated_water,normal_water,heavy_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')
Ejemplo n.º 20
0
mhc.add_nuclide('Mo94', 5.850533e-3)
mhc.add_nuclide('Mo95', 1.010836e-2)
mhc.add_nuclide('Mo96', 1.061782e-2)
mhc.add_nuclide('Mo97', 6.102080e-3)
mhc.add_nuclide('Mo98', 1.546981e-2)
mhc.add_nuclide('Mo100', 6.205246e-3)
mhc.add_nuclide('Hf174', 6.659530e-7)
mhc.add_nuclide('Hf176', 2.189321e-5)
mhc.add_nuclide('Hf177', 7.741704e-5)
mhc.add_nuclide('Hf178', 1.135450e-4)
mhc.add_nuclide('Hf179', 5.668925e-5)
mhc.add_nuclide('Hf180', 1.460102e-4)
mhc.add_nuclide('C0', 5.154371e-4)
mhc.temperature = 948

mats = openmc.Materials((uoc_9, por_c, si_c, graphite, p_graphite, lm_graphite,
                         flibe, mhc, s_graphite))
mats.export_to_xml()

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

# top and bottom surfaces (dz)
top_surface = openmc.ZPlane(z0=T_pitch / 2 + (z_thickness - 1) / 2 * T_pitch,
                            boundary_type='reflective')
bot_surface = openmc.ZPlane(z0=-(T_pitch / 2 +
                                 (z_thickness - 1) / 2 * T_pitch),
                            boundary_type='reflective')

# Outermost Hexagon
Ejemplo n.º 21
0
#na and k 1
nak1 = openmc.Material(17)
nak1.add_element('Na', 0.44)
nak1.add_element('K', 0.56)
nak1.set_density('g/cm3', 0.9084)

#na and k 2
nak2 = openmc.Material(18)
nak2.add_element('Na', 0.228)
nak2.add_element('K', 0.772)
nak2.set_density('g/cm3', 0.88508)

#create materials file
mats = openmc.Materials([
    uo2, stainless, He, water, na, lead, boron, uo2_2, uo2_3, uo2_4, uranium,
    be, beo, gc, ss, k, nak1, nak2
])
mats.export_to_xml()
# !cat materials.xml

#define geometry
#plane
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)
Ejemplo n.º 22
0
    # Place pin-cell inside the box
    box_cell = openmc.Cell(fill=pincell, region=box)

    for model in ['uo2', 'reactor-mox', 'weapons-mox']:
        for enrich in enrichments[model]:
            # Create fuel material for given model/enrichment
            fuel_mat = openmc.Material(temperature=T)
            comp = composition[model]
            for nuc, density in zip(comp['nuclides'], comp['densities'][T][enrich]):
                fuel_mat.add_nuclide(nuc, density)
            fuel_mat.set_density(units='sum')

            # Assign fuel material to corresponding cell
            fuel.fill = fuel_mat

            # Create materials collection and overall geometry
            materials = openmc.Materials([water, zircaloy, fuel_mat])
            root_univ = openmc.Universe(0, cells=(box_cell,))
            geometry = openmc.Geometry(root_univ)

            # Create directory if it doesn't exist
            dirname = '{}-{}{}{}K'.format(model, enrich, os.path.sep, T)
            if not os.path.isdir(dirname):
                os.makedirs(dirname)

            # Export XML input files
            geometry.export_to_xml(os.path.join(dirname, 'geometry.xml'))
            materials.export_to_xml(os.path.join(dirname, 'materials.xml'))
            settings.export_to_xml(os.path.join(dirname, 'settings.xml'))
Ejemplo n.º 23
0
# ----------------------------------------------------------------------------
# Materials
# ----------------------------------------------------------------------------

fuel = openmc.Material(name='Fuel')
fuel.add_element('U', 1.0, enrichment=3.0)
fuel.add_element('O', 2.0)
fuel.set_density('g/cc', 10.31341)

water = openmc.Material(name='Water')
water.set_density('g/cm3', 0.740582)
water.add_element('H', 2.0)
water.add_element('O', 1.0)
water.add_s_alpha_beta('c_H_in_H2O')

materials_file = openmc.Materials([fuel, water])
materials_file.export_to_xml()



# ----------------------------------------------------------------------------
# Geometry 
# ----------------------------------------------------------------------------

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)
Ejemplo n.º 24
0
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)
borated_water.add_s_alpha_beta('c_H_in_H2O')

# Collect the materials together and export to XML
materials = openmc.Materials([uo2, helium, zircaloy, borated_water])
materials.export_to_xml()

###############################################################################
# Define problem geometry

# Create cylindrical 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')

# Create a region represented as the inside of a rectangular prism
pitch = 1.25984
box = openmc.rectangular_prism(pitch, pitch, boundary_type='reflective')

# Create cells, mapping materials to regions
fuel.add_nuclide('O16',3.6535E-02)
fuel.add_nuclide('U234',5.0042E-07)
fuel.add_nuclide('U235',6.2098E-05)
fuel.add_nuclide('U236',6.2021E-08)
fuel.add_nuclide('U238',5.5312E-04)
fuel.set_density('atom/b-cm',9.92630348E-02)
fuel.add_s_alpha_beta('c_H_in_H2O')
fuel.temperature=300

air=openmc.Material(4,'air')
air.add_nuclide('N14',3.9016e-5)
air.add_nuclide('O16',1.0409e-5)
air.set_density('atom/b-cm',4.94510000E-05)
air.temperature=300

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

zp1=openmc.ZPlane(z0=0.0)
zp2=openmc.ZPlane(z0=41.46)
zp3=openmc.ZPlane(z0=149.71)
zp4=openmc.ZPlane(z0=152.64)
zp5=openmc.ZPlane(z0=-2.06)
zp6=openmc.ZPlane(z0=172.64,boundary_type='vacuum')
zp7=openmc.ZPlane(z0=-34.5,boundary_type='vacuum')

zc10=openmc.ZCylinder(R=39.505)
zc20=openmc.ZCylinder(R=39.815)
zc30=openmc.ZCylinder(R=69.8,boundary_type='vacuum')
Ejemplo n.º 26
0
# Basic materials
uo2 = openmc.Material(name='fuel')
uo2.add_element('U', 1, enrichment=3.2)
uo2.add_element('O', 2)
#uo2.add_element('Gd', 0.0007)
uo2.set_density('g/cc', 10.341)
x = uo2.get_nuclide_atom_densities()
#for d in x:
#    print(d,x[d],x[d][1]*1E24)

water = openmc.Material(3, "h2o")
water.add_element('H', 2.0)
water.add_element('O', 1.0)
water.set_density('g/cm3', 1.0)

materials = openmc.Materials([uo2, water])
materials.export_to_xml()

L = pitch

fCylinders = [
    openmc.ZCylinder(R=radius_fuel, x0=0.5 * L + i * L, y0=0.5 * L + j * L)
    for j in range(3) for i in range(3)
]

x1 = openmc.XPlane(x0=0.0, boundary_type='reflective')
x2 = openmc.XPlane(x0=1 * L)
x3 = openmc.XPlane(x0=2 * L)
x4 = openmc.XPlane(x0=3 * L, boundary_type='reflective')

y1 = openmc.YPlane(y0=0.0, boundary_type='reflective')
Ejemplo n.º 27
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

    water = openmc.Material(3, "h2o")
    water.add_nuclide('H1', 2.0)
    water.add_nuclide('O16', 1.0)
    #Using P = 15.5 Mpa
    water.set_density('g/cm3', 0.66)
    water.add_s_alpha_beta('c_H_in_H2O')
    water.temperature = 600  #kelvin

    mats = openmc.Materials([uo2, water])
    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

    hexagon = openmc.get_hexagonal_prism(edge_length=1 / 3**(1 / 2) * pitch,
                                         orientation='y',
                                         boundary_type='reflective')
    bottom = openmc.ZPlane(z0=-pitch / 2, boundary_type='reflective')
    top = openmc.ZPlane(z0=pitch / 2, boundary_type='reflective')

    water_region = hexagon & +fuel_or
    moderator = openmc.Cell(2, 'moderator')
    moderator.fill = water
    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 = (1.5 * pitch, 1.5 * pitch)
    p.pixels = (200, 200)
    p.color_by = 'material'
    p.colors = {uo2: 'yellow', water: 'blue'}

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

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

    #############################
    ###       EXECUTION       ###
    #############################
    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.º 28
0
#                      Simulation Input File Parameters
###############################################################################

# OpenMC simulation parameters
batches = 20000
inactive = 500
particles = 10000

###############################################################################
#                 Exporting to OpenMC materials.xml File
###############################################################################

from materials import materials

# Instantiate a Materials collection, register all Materials, and export to XML
materials_file = openmc.Materials(materials.values())
materials_file.default_xs = '300k'
materials_file.export_to_xml()

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

# Instantiate Core boundaries
cells['Core'].region = +surfaces['Core x-min'] & +surfaces['Core y-min'] & \
                       -surfaces['Core x-max'] & -surfaces['Core y-max']

lattices['Core'] = openmc.RectLattice(lattice_id=201, name='3x3 core lattice')
lattices['Core'].dimension = [3, 3]
lattices['Core'].lower_left = [-32.13, -32.13]
lattices['Core'].pitch = [21.42, 21.42]
Ejemplo n.º 29
0
b4c = openmc.Material(material_id=14, name='B4C')
b4c.set_density('g/cm3', 1.76)
b4c.add_nuclide('B10', 1.52689E-02)
b4c.add_nuclide('B11', 6.14591E-02)
b4c.add_element('C', 1.91820E-02)

waba = openmc.Material(material_id=15, name='WABA B4C-Al2O3')
waba.set_density('g/cm3', 3.65)
waba.add_nuclide('B10', 2.98553E-03)
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_1_or = openmc.ZCylinder(surface_id=101,
                             x0=0,
                             y0=0,
                             r=0.2365,
                             name='Ring 1 OR')
fuel_2_or = openmc.ZCylinder(surface_id=102,
                             x0=0,
                             y0=0,
Ejemplo n.º 30
0
def simulate_model(
    enrichment,
    thickness,
    breeder_material_name="Li4SiO4",
    temperature_in_C=500,
    batches=10,
    nps=1000,
    inner_radius=500,
):

    # MATERIALS from library of materials in neutronics_material_maker package
    breeder_material = Material(
        material_name=breeder_material_name,
        enrichment=enrichment,
        temperature_in_C=temperature_in_C,
    ).neutronics_material

    eurofer = Material(material_name="eurofer").neutronics_material
    copper = Material(material_name="copper").neutronics_material

    mats = openmc.Materials([breeder_material, eurofer, copper])
    mats.export_to_xml("materials.xml")

    # GEOMETRY#

    central_sol_surface = openmc.ZCylinder(r=100)
    central_shield_outer_surface = openmc.ZCylinder(r=110)
    first_wall_inner_surface = openmc.Sphere(r=inner_radius)
    first_wall_outer_surface = openmc.Sphere(r=inner_radius + 10)
    breeder_blanket_outer_surface = openmc.Sphere(r=inner_radius + 10.0 +
                                                  thickness)
    vessel_outer_surface = openmc.Sphere(r=inner_radius + 10.0 + thickness +
                                         10.0,
                                         boundary_type="vacuum")

    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_void_region = -first_wall_inner_surface & +central_shield_outer_surface
    inner_void_cell = openmc.Cell(region=inner_void_region)
    inner_void_cell.name = "inner_void"

    first_wall_region = (-first_wall_outer_surface
                         & +first_wall_inner_surface
                         & +central_shield_outer_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_shield_outer_surface)
    breeder_blanket_cell = openmc.Cell(region=breeder_blanket_region)
    breeder_blanket_cell.fill = breeder_material

    vessel_region = +breeder_blanket_outer_surface & -vessel_outer_surface
    vessel_cell = openmc.Cell(region=vessel_region)
    vessel_cell.name = "vessel"
    vessel_cell.fill = eurofer

    universe = openmc.Universe(cells=[
        central_sol_cell,
        central_shield_cell,
        inner_void_cell,
        first_wall_cell,
        breeder_blanket_cell,
        vessel_cell,
    ])

    geom = openmc.Geometry(universe)

    # SIMULATION SETTINGS#

    sett = openmc.Settings()
    sett.batches = batches
    sett.inactive = 0
    sett.particles = nps
    sett.run_mode = "fixed source"

    source = openmc.Source()
    source.space = openmc.stats.Point((150, 0, 0))
    source.angle = openmc.stats.Isotropic()
    source.energy = openmc.stats.Discrete([14.08e6], [1])
    sett.source = source

    # sett.export_to_xml("settings.xml")

    # tally filters
    particle_filter = openmc.ParticleFilter("neutron")
    cell_filter_breeder = openmc.CellFilter(breeder_blanket_cell)

    # TALLIES#
    tallies = openmc.Tallies()

    tally = openmc.Tally(name="TBR")
    tally.filters = [cell_filter_breeder, particle_filter]
    tally.scores = ["(n,Xt)"]
    tallies.append(tally)

    # RUN OPENMC #
    model = openmc.model.Model(geom, mats, sett, tallies)
    model.run(output=False)

    # RETRIEVING TALLY RESULTS

    sp = openmc.StatePoint("statepoint." + str(batches) + ".h5")

    json_output = {
        "batches": batches,
        "nps": nps,
        "enrichment": enrichment,
        "inner_radius": inner_radius,
        "thickness": thickness,
        "breeder_material_name": breeder_material_name,
        "temperature_in_C": temperature_in_C,
    }

    tally = sp.get_tally(name="TBR")

    df = tally.get_pandas_dataframe()

    json_output["TBR"] = df["mean"].sum()
    json_output["TBR_std_dev"] = df["std. dev."].sum()

    return json_output