コード例 #1
0
def make_firstwall_material(firstwall_armour_material,
                            firstwall_armour_fraction,
                            firstwall_coolant_material,
                            firstwall_coolant_fraction,
                            firstwall_structural_material,
                            firstwall_structural_fraction):

    if firstwall_coolant_material == 'He':
        temperature_in_C = 400
        pressure_in_Pa = 8e6
    elif firstwall_coolant_material in ['H2O', 'D2O']:
        temperature_in_C = 305
        pressure_in_Pa = 15.5e6

    firstwall_material = MultiMaterial(
        material_name='firstwall_material',
        materials=[
            Material(material_name=firstwall_armour_material),
            Material(material_name=firstwall_coolant_material,
                     temperature_in_C=temperature_in_C,
                     pressure_in_Pa=pressure_in_Pa),
            Material(material_name=firstwall_structural_material)
        ],
        fracs=[
            firstwall_armour_fraction, firstwall_coolant_fraction,
            firstwall_structural_fraction
        ]).neutronics_material

    return firstwall_material
コード例 #2
0
def make_blanket_material(
        blanket_structural_material, blanket_structural_fraction,
        blanket_coolant_material, blanket_coolant_fraction,
        blanket_multiplier_material, blanket_multiplier_fraction,
        blanket_breeder_material, blanket_breeder_fraction,
        blanket_breeder_li6_enrichment_fraction,
        blanket_breeder_packing_fraction, blanket_multiplier_packing_fraction):

    if blanket_coolant_material == 'He':
        temperature_in_C = 400
        pressure_in_Pa = 8e6
    elif blanket_coolant_material in ['H2O', 'D2O']:
        temperature_in_C = 305
        pressure_in_Pa = 15.5e6

    blanket_material = MultiMaterial(
        material_name='blanket_material',
        materials=[
            Material(material_name=blanket_structural_material),
            Material(material_name=blanket_coolant_material,
                     temperature_in_C=temperature_in_C,
                     pressure_in_Pa=pressure_in_Pa),
            Material(material_name=blanket_multiplier_material,
                     packing_fraction=blanket_multiplier_packing_fraction),
            Material(
                material_name=blanket_breeder_material,
                enrichment_fraction=blanket_breeder_li6_enrichment_fraction,
                temperature_in_C=500,
                packing_fraction=blanket_breeder_packing_fraction),
        ],
        fracs=[
            blanket_structural_fraction, blanket_coolant_fraction,
            blanket_multiplier_fraction, blanket_breeder_fraction
        ],
        percent_type='vo').neutronics_material

    return blanket_material
コード例 #3
0
def make_neutronics_model(
    reactor,
    firstwall_radial_thickness,
    firstwall_armour_material,
    firstwall_coolant_material,
    firstwall_structural_material,
    firstwall_armour_fraction,
    firstwall_coolant_fraction,
    firstwall_coolant_temperature_C,
    firstwall_coolant_pressure_Pa,
    firstwall_structural_fraction,
    blanket_rear_wall_coolant_material,
    blanket_rear_wall_structural_material,
    blanket_rear_wall_coolant_fraction,
    blanket_rear_wall_structural_fraction,
    blanket_rear_wall_coolant_temperature_C,
    blanket_rear_wall_coolant_pressure_Pa,
    blanket_lithium6_enrichment_percent,
    blanket_breeder_material,
    blanket_coolant_material,
    blanket_multiplier_material,
    blanket_structural_material,
    blanket_breeder_fraction,
    blanket_coolant_fraction,
    blanket_multiplier_fraction,
    blanket_structural_fraction,
    blanket_breeder_packing_fraction,
    blanket_multiplier_packing_fraction,
    blanket_coolant_temperature_C,
    blanket_coolant_pressure_Pa,
    blanket_breeder_temperature_C,
    blanket_breeder_pressure_Pa,
    divertor_coolant_fraction,
    divertor_structural_fraction,
    divertor_coolant_material,
    divertor_structural_material,
    divertor_coolant_temperature_C,
    divertor_coolant_pressure_Pa,
    center_column_shield_coolant_fraction,
    center_column_shield_structural_fraction,
    center_column_shield_coolant_material,
    center_column_shield_structural_material,
    center_column_shield_coolant_temperature_C,
    center_column_shield_coolant_pressure_Pa,
    inboard_tf_coils_conductor_fraction,
    inboard_tf_coils_coolant_fraction,
    inboard_tf_coils_structure_fraction,
    inboard_tf_coils_conductor_material,
    inboard_tf_coils_coolant_material,
    inboard_tf_coils_structure_material,
    inboard_tf_coils_coolant_temperature_C,
    inboard_tf_coils_coolant_pressure_Pa,
):
    """
    Makes and runs a simple OpenMC neutronics model with
    the materials with the same tags as the DAGMC neutronics
    geometry. The model also specifies the computational
    intensity (particles and batches) and the tally to record
    """
    input_parameters = locals()

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

    center_column_shield_material = MultiMaterial(
        material_tag='center_column_shield_mat',
        materials=[
            Material(
                material_name=center_column_shield_coolant_material,
                temperature_in_C=center_column_shield_coolant_temperature_C,
                pressure_in_Pa=center_column_shield_coolant_pressure_Pa),
            Material(material_name=center_column_shield_structural_material)
        ],
        fracs=[
            center_column_shield_coolant_fraction,
            center_column_shield_structural_fraction
        ],
        percent_type='vo',
        packing_fraction=1.0).openmc_material

    firstwall_material = MultiMaterial(
        material_tag='firstwall_mat',
        materials=[
            Material(material_name=firstwall_coolant_material,
                     temperature_in_C=firstwall_coolant_temperature_C,
                     pressure_in_Pa=firstwall_coolant_pressure_Pa),
            Material(material_name=firstwall_structural_material),
            Material(material_name=firstwall_armour_material)
        ],
        fracs=[
            firstwall_coolant_fraction, firstwall_structural_fraction,
            firstwall_armour_fraction
        ],
        percent_type='vo',
        packing_fraction=1.0).openmc_material

    if blanket_multiplier_material == None and blanket_multiplier_fraction == None and blanket_multiplier_packing_fraction == None:

        blanket_material = MultiMaterial(
            material_tag='blanket_mat',
            materials=[
                Material(material_name=blanket_coolant_material,
                         temperature_in_C=blanket_coolant_temperature_C,
                         pressure_in_Pa=blanket_coolant_pressure_Pa),
                Material(material_name=blanket_structural_material),
                Material(material_name=blanket_breeder_material,
                         enrichment=blanket_lithium6_enrichment_percent,
                         packing_fraction=blanket_breeder_packing_fraction,
                         temperature_in_C=blanket_breeder_temperature_C,
                         pressure_in_Pa=blanket_breeder_pressure_Pa)
            ],
            fracs=[
                blanket_coolant_fraction, blanket_structural_fraction,
                blanket_breeder_fraction
            ],
            percent_type='vo',
            packing_fraction=1.0).openmc_material
    else:
        blanket_material = MultiMaterial(
            material_tag='blanket_mat',
            materials=[
                Material(material_name=blanket_coolant_material,
                         temperature_in_C=blanket_coolant_temperature_C,
                         pressure_in_Pa=blanket_coolant_pressure_Pa),
                Material(material_name=blanket_structural_material),
                Material(material_name=blanket_multiplier_material,
                         packing_fraction=blanket_multiplier_packing_fraction),
                Material(material_name=blanket_breeder_material,
                         enrichment=blanket_lithium6_enrichment_percent,
                         packing_fraction=blanket_breeder_packing_fraction,
                         temperature_in_C=blanket_breeder_temperature_C,
                         pressure_in_Pa=blanket_breeder_pressure_Pa)
            ],
            fracs=[
                blanket_coolant_fraction, blanket_structural_fraction,
                blanket_multiplier_fraction, blanket_breeder_fraction
            ],
            percent_type='vo',
            packing_fraction=1.0).openmc_material

    divertor_material = MultiMaterial(
        material_tag='divertor_mat',
        materials=[
            Material(material_name=divertor_coolant_material,
                     temperature_in_C=divertor_coolant_temperature_C,
                     pressure_in_Pa=divertor_coolant_pressure_Pa),
            Material(material_name=divertor_structural_material)
        ],
        fracs=[divertor_coolant_fraction, divertor_structural_fraction],
        percent_type='vo',
        packing_fraction=1.0).openmc_material

    inboard_tf_coils_material = MultiMaterial(
        material_tag='inboard_tf_coils_mat',
        materials=[
            Material(material_name=inboard_tf_coils_coolant_material,
                     temperature_in_C=inboard_tf_coils_coolant_temperature_C,
                     pressure_in_Pa=inboard_tf_coils_coolant_pressure_Pa),
            Material(material_name=inboard_tf_coils_conductor_material),
            Material(material_name=inboard_tf_coils_structure_material)
        ],
        fracs=[
            inboard_tf_coils_coolant_fraction,
            inboard_tf_coils_conductor_fraction,
            inboard_tf_coils_structure_fraction
        ],
        percent_type='vo',
        packing_fraction=1.0).openmc_material

    blanket_rear_wall_material = MultiMaterial(
        material_tag='blanket_rear_wall_mat',
        materials=[
            Material(material_name=blanket_rear_wall_coolant_material,
                     temperature_in_C=blanket_rear_wall_coolant_temperature_C,
                     pressure_in_Pa=blanket_rear_wall_coolant_pressure_Pa),
            Material(material_name=blanket_rear_wall_structural_material)
        ],
        fracs=[
            blanket_rear_wall_coolant_fraction,
            blanket_rear_wall_structural_fraction
        ],
        percent_type='vo',
        packing_fraction=1.0).openmc_material

    mats = openmc.Materials([
        center_column_shield_material, firstwall_material, blanket_material,
        divertor_material, inboard_tf_coils_material,
        blanket_rear_wall_material
    ])

    # settings for the number of neutrons to simulate
    settings = openmc.Settings()
    settings.batches = 10
    settings.inactive = 0
    settings.particles = 1000
    settings.run_mode = 'fixed source'
    settings.dagmc = True

    # details of the birth locations and energy of the neutronis
    source = openmc.Source()
    source.space = openmc.stats.Point((reactor['major_radius'], 0, 0))
    source.angle = openmc.stats.Isotropic()
    source.energy = openmc.stats.Discrete([14e6], [1])
    settings.source = source
    settings.photon_transport = True  # This line is required to switch on photons tracking

    # details about what neutrons interactions to keep track of (called a tally)
    tallies = openmc.Tallies()
    material_filter = openmc.MaterialFilter(blanket_material)
    tbr_tally = openmc.Tally(name='TBR')
    tbr_tally.filters = [material_filter]
    tbr_tally.scores = ['(n,Xt)']  # where X is a wild card
    tallies.append(tbr_tally)

    material_filter = openmc.MaterialFilter(
        [blanket_material, firstwall_material, blanket_rear_wall_material])
    blanket_heating_tally = openmc.Tally(name='blanket_heating')
    blanket_heating_tally.filters = [material_filter]
    blanket_heating_tally.scores = ['heating']
    tallies.append(blanket_heating_tally)

    # make the model from gemonetry, materials, settings and tallies
    model = openmc.model.Model(geom, mats, settings, tallies)

    # run the simulation
    output_filename = model.run()
    """
    Reads the output file from the neutronics simulation
    and prints the TBR tally result to screen
    """

    # open the results file
    sp = openmc.StatePoint(output_filename)

    # access TBR tally
    tbr_tally = sp.get_tally(name='TBR')
    df = tbr_tally.get_pandas_dataframe()
    tbr_tally_result = df['mean'].sum()
    tbr_tally_std_dev = df['std. dev.'].sum()

    # access heating tally
    blanket_heating_tally = sp.get_tally(name='blanket_heating')
    df = blanket_heating_tally.get_pandas_dataframe()
    blanket_heating_tally_result = df['mean'].sum() / 1e6
    blanket_heating_tally_std_dev = df['std. dev.'].sum() / 1e6

    # returns all the inputs and some extra reactor attributes, merged into a single dictionary
    return {
        **input_parameters,
        **{
            'tbr': tbr_tally_result,
            'tbr_std_dev': tbr_tally_std_dev,
            'blanket_heating': blanket_heating_tally_result,
            'blanket_heating_std_dev': blanket_heating_tally_std_dev,
        }
    }
コード例 #4
0
import openmc
import numpy as np
import plotly.graph_objs as go
from neutronics_material_maker import Material, MultiMaterial

# Homogeneous mixture of helium and Li4SiO4 using MultiMaterial class

# MultiMaterial class requires list of Material objects to be passed
helium = Material('He', temperature_in_C=500, pressure_in_Pa=100000)
Li4SiO4 = Material('Li4SiO4', enrichment=60)

mixed_helium_Li4SiO4 = MultiMaterial(
    material_name='mixed_helium_Li4SiO4',  # name of homogeneous material
    materials=[helium,
               Li4SiO4],  # list of material objects (NOT neutronics materials)
    fracs=[0.36,
           0.64],  # list of combination fractions for each material object
    percent_type='vo')  # combination fraction type
# print(mixed_helium_Li4SiO4.neutronics_material)

# Homogenous mixture of tungsten carbide and water using mix_materials function

mixed_water_WC = openmc.Material.mix_materials(
    name='mixed_water_WC',  # name of homogeneous material
    materials=[  # list of neutronics materials
        Material('WC').neutronics_material,
        Material('H2O', temperature_in_C=25,
                 pressure_in_Pa=100000).neutronics_material
    ],
    fracs=[0.8,
           0.2],  # list of combination fractions for each neutronics material
コード例 #5
0
def find_tbr_from_graded_blanket(
        number_of_layers, layer_thickness_fractions, layer_li6_enrichments,
        layer_breeder_fractions, layer_multiplier_fractions,
        blanket_structural_material, blanket_multiplier_material,
        blanket_breeder_material, firstwall_coolant,
        blanket_structural_fraction, inner_radius, thickness,
        firstwall_thickness):

    batches = 10

    thickness_fraction_scaler = thickness / sum(layer_thickness_fractions)
    print('thickness_fraction_scaler', thickness_fraction_scaler)

    if firstwall_coolant == 'no firstwall':

        breeder_blanket_inner_surface = openmc.Sphere(r=inner_radius)
        inner_void_region = -breeder_blanket_inner_surface
        inner_void_cell = openmc.Cell(region=inner_void_region)
        inner_void_cell.name = 'inner_void'
        surfaces = [breeder_blanket_inner_surface]

        additional_thickness = 0
        all_layers_materials = []
        all_cells = [inner_void_cell]
        for i, (layer_thickness, layer_enrichment, layer_breeder_fraction,
                layer_multiplier_fraction) in enumerate(
                    zip(layer_thickness_fractions, layer_li6_enrichments,
                        layer_breeder_fractions, layer_multiplier_fractions)):
            print(i, layer_thickness, layer_enrichment, layer_breeder_fraction)

            layer_material = MultiMaterial(
                material_name='layer_' + str(i) + '_material',
                materials=[
                    Material(blanket_breeder_material,
                             enrichment_fraction=layer_enrichment),
                    Material(blanket_multiplier_material),
                    Material(blanket_structural_material)
                ],
                fracs=[
                    layer_breeder_fraction, layer_multiplier_fraction,
                    blanket_structural_fraction
                ]).neutronics_material
            all_layers_materials.append(layer_material)

            additional_thickness = additional_thickness + (
                layer_thickness * thickness_fraction_scaler)
            print('additional_thickness', additional_thickness)

            if i == number_of_layers - 1:
                layer_outer_surface = openmc.Sphere(r=inner_radius +
                                                    additional_thickness,
                                                    boundary_type='vacuum')
            else:
                layer_outer_surface = openmc.Sphere(r=inner_radius +
                                                    additional_thickness)

            layer_inner_surface = surfaces[-1]

            layer_region = -layer_outer_surface & +layer_inner_surface
            layer_cell = openmc.Cell(region=layer_region)
            layer_cell.fill = layer_material
            layer_cell.name = 'layer_' + str(i) + '_cell'

            surfaces.append(layer_outer_surface)
            all_cells.append(layer_cell)
    else:
        #firstwall is present

        firstwall_material = MultiMaterial(
            material_name='firstwall_material',
            materials=[
                Material('tungsten'),
                Material(firstwall_coolant),
                Material(blanket_structural_material)
            ],
            fracs=[0.055262, 0.253962,
                   0.690776]  #based on HCPB paper with 2mm W firstwall
        ).neutronics_material

        breeder_blanket_inner_surface = openmc.Sphere(r=inner_radius +
                                                      firstwall_thickness)
        firstwall_outer_surface = openmc.Sphere(r=inner_radius)
        surfaces = [firstwall_outer_surface, breeder_blanket_inner_surface]

        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(region=firstwall_region)
        firstwall_cell.fill = firstwall_material
        firstwall_cell.name = 'firstwall'

        additional_thickness = 0
        all_layers_materials = [firstwall_material]
        all_cells = [inner_void_cell, firstwall_cell]

        for i, (layer_thickness, layer_enrichment, layer_breeder_fraction,
                layer_multiplier_fraction) in enumerate(
                    zip(layer_thickness_fractions, layer_li6_enrichments,
                        layer_breeder_fractions, layer_multiplier_fractions)):
            print(i, layer_thickness, layer_enrichment, layer_breeder_fraction)

            layer_material = MultiMaterial(
                'layer_' + str(i) + '_material',
                materials=[
                    Material(blanket_breeder_material,
                             enrichment_fraction=layer_enrichment),
                    Material(blanket_multiplier_material),
                    Material(blanket_structural_material)
                ],
                volume_fractions=[
                    layer_breeder_fraction, layer_multiplier_fraction,
                    blanket_structural_fraction
                ])
            all_layers_materials.append(layer_material)

            additional_thickness = additional_thickness + (
                layer_thickness * thickness_fraction_scaler)
            print('additional_thickness', additional_thickness)

            if i == number_of_layers - 1:
                layer_outer_surface = openmc.Sphere(r=inner_radius +
                                                    firstwall_thickness +
                                                    additional_thickness,
                                                    boundary_type='vacuum')
            else:
                layer_outer_surface = openmc.Sphere(r=inner_radius +
                                                    firstwall_thickness +
                                                    additional_thickness)

            layer_inner_surface = surfaces[-1]

            layer_region = -layer_outer_surface & +layer_inner_surface
            layer_cell = openmc.Cell(region=layer_region)
            layer_cell.fill = layer_material
            layer_cell.name = 'layer_' + str(i) + '_cell'

            surfaces.append(layer_outer_surface)
            all_cells.append(layer_cell)

    universe = openmc.Universe(cells=all_cells)
    geom = openmc.Geometry(universe)

    mats = openmc.Materials(all_layers_materials)

    sett = openmc.Settings()
    # batches = 3 # this is parsed as an argument
    sett.batches = batches
    sett.inactive = 10
    sett.particles = 500
    sett.run_mode = 'fixed 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

    #TALLIES#

    tallies = openmc.Tallies()

    # define filters
    # cell_filter_breeder = openmc.CellFilter(breeder_blanket_cell)
    particle_filter = openmc.ParticleFilter(['neutron'
                                             ])  #1 is neutron, 2 is photon

    tally = openmc.Tally(name='TBR')
    tally.filters = [particle_filter]
    tally.scores = ['(n,Xt)']  #could be (n,Xt)
    tallies.append(tally)

    model = openmc.model.Model(geom, mats, sett, tallies)
    model.export_to_xml()
    # model.run()
    openmc.lib.run()

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

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

    df = tally.get_pandas_dataframe()

    return df['mean'].sum()
コード例 #6
0
ファイル: openmc_model.py プロジェクト: ukaea/openmc_workshop
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
コード例 #7
0
        ]:
            if float_key in material.keys():
                material[float_key] = float(material[float_key])

    if len(materials) == 1:
        for material in breeder_materials:
            breeder_material = Material(**material).neutronics_material

    else:
        multimaterials = []
        volume_fractions = []
        for material in breeder_materials:
            multimaterials.append(Material(**material))
            volume_fractions.append(material['volume_fraction'])
        breeder_material = MultiMaterial(
            material_name='breeder_material',
            materials=multimaterials,
            volume_fractions=volume_fractions).neutronics_material

    if model == 'sphere with firstwall':
        for material in firstwall_materials:
            for float_key in [
                    'enrichment_fraction', 'packing_fraction',
                    'volume_fraction', 'temperature_in_C'
            ]:
                if float_key in material.keys():
                    material[float_key] = float(material[float_key])

        if len(firstwall_materials) == 1:
            for material in firstwall_materials:
                firstwall_material = Material(**material).neutronics_material
        else: