Exemplo n.º 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
def make_other_aspects_of_neutronics_model():
    """
    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
    """

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

    mat1 = Material(
        material_name="Li4SiO4", material_tag="blanket_material"
    ).openmc_material

    mat2 = Material(
        material_name="copper", material_tag="pf_coil_material"
    ).openmc_material

    mats = openmc.Materials([mat1, mat2])

    settings = openmc.Settings()
    settings.batches = 10
    settings.inactive = 0
    settings.particles = 100
    settings.run_mode = "fixed source"
    settings.dagmc = True

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

    tallies = openmc.Tallies()
    tbr_tally = openmc.Tally(name="TBR")
    tbr_tally.scores = ["(n,Xt)"]  # where X is a wild card
    tallies.append(tbr_tally)

    model = openmc.model.Model(geom, mats, settings, tallies)

    output_filename = model.run()

    return output_filename
Exemplo n.º 3
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
#!/usr/bin/env python3

"""example_CAD_simulation.py: uses a dagmc.h5m file for the geometry."""

__author__ = "Jonathan Shimwell"

import openmc
import json
import os
from neutronics_material_maker import Material
from parametric_plasma_source import PlasmaSource, SOURCE_SAMPLING_PATH

# MATERIALS using the neutronics material maker

breeder_material = Material(material_name='Li4SiO4',
                            enrichment=90,
                            material_tag='blanket_material'
                            ).openmc_material

copper = Material(material_name="copper",
                  material_tag="copper"
                  ).openmc_material

eurofer = Material(material_name='eurofer',
                   material_tag="eurofer").openmc_material

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


# GEOMETRY using dagmc doesn't contain any CSG geometry

universe = openmc.Universe()
def make_materials_geometry_tallies(v):
    enrichment_fraction, thickness = v
    inner_radius = 500
    breeder_material_name = 'Li'
    temperature_in_C = 500

    print('simulating enrichment,', enrichment_fraction, 'thickness ',
          thickness)

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

    eurofer = Material(material_name='eurofer').neutronics_material

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

    # GEOMETRY

    breeder_blanket_inner_surface = openmc.Sphere(r=inner_radius)
    breeder_blanket_outer_surface = openmc.Sphere(r=inner_radius + thickness)

    vessel_inner_surface = openmc.Sphere(r=inner_radius + thickness + 10)
    vessel_outer_surface = openmc.Sphere(r=inner_radius + thickness + 20,
                                         boundary_type='vacuum')

    breeder_blanket_region = -breeder_blanket_outer_surface & +breeder_blanket_inner_surface
    breeder_blanket_cell = openmc.Cell(region=breeder_blanket_region)
    breeder_blanket_cell.fill = breeder_material
    breeder_blanket_cell.name = 'breeder_blanket'

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

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

    blanket_vessel_gap_region = -vessel_inner_surface & +breeder_blanket_outer_surface
    blanket_vessel_gap_cell = openmc.Cell(region=blanket_vessel_gap_region)
    blanket_vessel_gap_cell.name = 'blanket_vessel_gap'

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

    geom = openmc.Geometry(universe)

    # SIMULATION SETTINGS

    sett = openmc.Settings()
    # batches = 3 # this is parsed as an argument
    sett.batches = batches
    sett.inactive = 0
    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)
    cell_filter_vessel = openmc.CellFilter(vessel_cell)
    particle_filter = openmc.ParticleFilter([1])  # 1 is neutron, 2 is photon
    surface_filter_rear_blanket = openmc.SurfaceFilter(
        breeder_blanket_outer_surface)
    surface_filter_rear_vessel = openmc.SurfaceFilter(vessel_outer_surface)
    energy_bins = openmc.mgxs.GROUP_STRUCTURES['VITAMIN-J-175']
    energy_filter = openmc.EnergyFilter(energy_bins)

    tally = openmc.Tally(name='TBR')
    tally.filters = [cell_filter_breeder, particle_filter]
    tally.scores = [
        '(n,Xt)'
    ]  # MT 205 is the (n,Xt) reaction 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
    tallies.append(tally)

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

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

    json_output = {
        'enrichment_fraction': enrichment_fraction,
        '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
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
Exemplo n.º 7
0
import numpy as np
import plotly.graph_objs as go
from plotly.subplots import make_subplots

from neutronics_material_maker import Material

# Because the neutronics_material_maker makes it easy to adjust material properties, we can easily perform parameter studies


# Water density as a function of temperature (at constant pressure)
# Based on WCLL, pressure = 15.5 MPa, inlet and outlet temperatures = 285 and 325 degrees C
# We will show density as a function of temperature over a larger range, but at correct pressure

temperatures = np.linspace(0.1, 600., 200)
water_densities = [Material('H2O', temperature_in_C=temperature, pressure_in_Pa=15500000).neutronics_material.density for temperature in temperatures]

fig = make_subplots(rows=2, cols=2,
                    subplot_titles=("Water density as a function of temperature (at constant pressure)", "Helium density as a function of temperature (at constant pressure)", "Helium density as a function of pressure (at constant temperature)", ""))

fig.add_trace(go.Scatter(x=temperatures,
                         y=water_densities,
                         mode='lines+markers',
                         showlegend=False),
              row=1, col=1)

fig.update_xaxes({'title': 'Temperature in C'}, row=1, col=1)
fig.update_yaxes({'title': 'Density (g/cm3)'}, row=1, col=1)


# Helium density as a function of temperature (at constant pressure)
Exemplo n.º 8
0
def make_other_aspects_of_neutronics_model(my_reactor):
    """
    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
    """

    # these materials are overly simplified to keep the example short
    firstwall_mat = Material(material_name='eurofer',
                             material_tag='firstwall_mat').openmc_material

    inboard_tf_coils_mat = Material(
        material_name='WC',
        material_tag='inboard_tf_coils_mat').openmc_material

    center_column_mat = Material(
        material_name='WC',
        material_tag='center_column_shield_mat').openmc_material

    divertor_mat = Material(material_name='eurofer',
                            material_tag='divertor_mat').openmc_material

    blanket_mat = Material(material_name='Li4SiO4',
                           enrichment=60,
                           material_tag='blanket_mat').openmc_material

    blanket_rear_wall_mat = Material(
        material_name='eurofer',
        material_tag='blanket_rear_wall_mat').openmc_material

    mats = openmc.Materials([
        firstwall_mat,
        inboard_tf_coils_mat,
        center_column_mat,
        divertor_mat,
        blanket_mat,
        blanket_rear_wall_mat,
    ])

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

    # settings for the number of neutrons to simulate
    settings = openmc.Settings()
    settings.batches = 10
    settings.inactive = 0
    settings.particles = 100
    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((my_reactor.major_radius, 0, 0))
    source.angle = openmc.stats.Isotropic()
    source.energy = openmc.stats.Discrete([14e6], [1])
    settings.source = source

    # details about what neutrons interactions to keep track of (called a tally)
    tallies = openmc.Tallies()
    material_filter = openmc.MaterialFilter(blanket_mat)
    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)

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

    # run the simulation
    output_filename = model.run()

    return output_filename
#!/usr/bin/env python3
"""example_CAD_simulation.py: uses a dagmc.h5m file for the geometry."""

__author__ = "Jonathan Shimwell"

import openmc
import json
import os
from neutronics_material_maker import Material
from parametric_plasma_source import Plasma

# MATERIALS using the neutronics material maker

breeder_material = Material(material_name='Li4SiO4',
                            enrichment=90).openmc_material

copper = Material(material_name="copper").openmc_material

eurofer = Material(material_name='eurofer').openmc_material

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

# GEOMETRY using dagmc doesn't contain any CSG geometry

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

# SIMULATION SETTINGS

# Instantiate a Settings object
sett = openmc.Settings()
Exemplo n.º 10
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()
Exemplo n.º 11
0
#!/usr/bin/env python3
"""example_CAD_simulation.py: uses a dagmc.h5m file for the geometry."""

__author__ = "Jonathan Shimwell"

import openmc
import json
import os
from neutronics_material_maker import Material

# MATERIALS using the neutronics material maker

breeder_material = Material(material_name='Li4SiO4',
                            enrichment=90).neutronics_material

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

eurofer = Material(material_name='eurofer').neutronics_material

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

# GEOMETRY using dagmc doesn't contain any CSG geometry

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

# SIMULATION SETTINGS

# Instantiate a Settings object
sett = openmc.Settings()
batches = 10
Exemplo 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
Exemplo n.º 13
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
import numpy as np
import plotly.graph_objs as go
from plotly.subplots import make_subplots

from neutronics_material_maker import Material

# Because the neutronics_material_maker makes it easy to adjust material properties, we can easily perform parameter studies

# Water density as a function of temperature (at constant pressure)
# Based on WCLL, pressure = 15.5 MPa, inlet and outlet temperatures = 285 and 325 degrees C
# We will show density as a function of temperature over a larger range, but at correct pressure

temperatures = np.linspace(0.1, 600., 200)
water_densities = [
    Material('H2O', temperature_in_C=temperature,
             pressure_in_Pa=15500000).openmc_material.density
    for temperature in temperatures
]

fig = make_subplots(
    rows=2,
    cols=2,
    subplot_titles=(
        "Water density as a function of temperature (at constant pressure)",
        "Helium density as a function of temperature (at constant pressure)",
        "Helium density as a function of pressure (at constant temperature)",
        ""))

fig.add_trace(go.Scatter(x=temperatures,
                         y=water_densities,
                         mode='lines+markers',
Exemplo n.º 15
0
from neutronics_material_maker import Material

# Some materials require arguments to correctly calculate material properties

# Water requires 'temperature' and 'pressure' arguments to be passed

# the following command creates a Material() object using the neutronics_material_maker

water = Material('H2O', temperature_in_C=25,
                 pressure_in_Pa=100000)  # atmospheric

print(type(water))
print(water)

# the following command converts Material() objects into neutronics materials which can be used in OpenMC

water_openmc_material_object = water.openmc_material
# this is equivalent to:

# water_openmc_material_object = Material('H2O', temperature_in_C=25, pressure_in_Pa=100000).openmc_material

print(type(water_openmc_material_object))
print(water_openmc_material_object)

# Some materials can also take arguments which adjust material properties

# Lithium Orthosilicate (Li4SiO4) can take arguments of 'enrichment', 'enrichment_target', 'enrichment_type' and 'packing_fraction'
# Note: for some lithium crystals, 'enrichment_target' and 'enrichment_type' are defined by default, but can be changed

default_Li4SiO4 = Material('Li4SiO4').openmc_material
print(default_Li4SiO4)
Exemplo n.º 16
0
def simulate_model(enrichment,
                   blanket_thickness=200,
                   firstwall_thickness=5,
                   breeder_material_name="Li4SiO4",
                   temperature_in_C=500,
                   threshold=0.0005,
                   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

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

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

    # GEOMETRY#

    first_wall_inner_surface = openmc.Sphere(r=inner_radius)
    first_wall_outer_surface = openmc.Sphere(r=inner_radius +
                                             firstwall_thickness)
    breeder_blanket_outer_surface = openmc.Sphere(
        r=inner_radius + firstwall_thickness + blanket_thickness)
    vessel_outer_surface = openmc.Sphere(r=inner_radius + firstwall_thickness +
                                         blanket_thickness + 10.,
                                         boundary_type="vacuum")

    inner_void_region = -first_wall_inner_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)
    first_wall_cell = openmc.Cell(region=first_wall_region)
    first_wall_cell.fill = SS316

    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

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

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

    geom = openmc.Geometry(universe)

    # SIMULATION SETTINGS#

    sett = openmc.Settings()
    sett.batches = 2  # this is minimum number of batches that will be run
    sett.trigger_active = True
    sett.trigger_max_batches = 2000  # this is maximum number of batches that will be run
    sett.inactive = 0
    sett.particles = 1000
    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)"]
    tally.triggers = [
        openmc.Trigger(trigger_type='rel_err', threshold=threshold)
    ]  # This stops the simulation if the threshold is meet
    tallies.append(tally)

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

    # RETRIEVING TALLY RESULTS

    sp = openmc.StatePoint(sp_filename)

    json_output = {
        "enrichment": enrichment,
        "inner_radius": inner_radius,
        "firstwall_thickness": firstwall_thickness,
        "blanket_thickness": blanket_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()

    os.system('rm *.h5')

    return json_output
Exemplo n.º 17
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,
        }
    }
Exemplo n.º 18
0
        firstwall_materials.append(fw_material)

if st.button('Simulate model'):

    for material in breeder_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(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 [