inactive = 2 particles = 1000 #Fuel material settings: """ fuel_material = openmc.Material(11, name='Thorium fuel') fuel_material.set_density('g/cm3', 10.062) fuel_material.add_nuclide("Th232", 94) fuel_material.add_nuclide("U235", 5) fuel_material.add_nuclide("U238", 0.33) fuel_material.add_nuclide("Xe135", 0.001) fuel_material.add_nuclide("O16", 0.33) fuel_material.depletable = True """ fuel_material = openmc.Material(11, name='Thorium fuel') fuel_material.set_density('g/cm3', 10.062) fuel_material.add_element("Th", 0.9) fuel_material.add_nuclide('Pu239', 0.092) #weaponsgrade ref: fuel_material.add_nuclide('Pu240', 0.008) #https://www.world-nuclear.org/information-library/nuclear-fuel-cycle/fuel-recycling/plutonium.aspx fuel_material.add_element("O", 2.0) fuel_material.depletable = True """ fuel_material = openmc.Material(11, name='Thorium fuel') fuel_material.set_density('g/cm3', 10.062) fuel_material.add_element("Th", 0.96) fuel_material.add_element("O", 2.0) fuel_material.add_nuclide('U233', 0.04) fuel_material.depletable = True """
def build_default_materials_and_geometry(self): # Define materials needed for 1D/1G slab problem uo2_data = openmc.Macroscopic('uo2_iso', '71c') uo2 = openmc.Material(name='UO2', material_id=1) uo2.set_density('macro', 1.0) uo2.add_macroscopic(uo2_data) clad_data = openmc.Macroscopic('clad_iso', '71c') clad = openmc.Material(name='Clad', material_id=2) clad.set_density('macro', 1.0) clad.add_macroscopic(clad_data) water_data = openmc.Macroscopic('lwtr_iso', '71c') water = openmc.Material(name='LWTR', material_id=3) water.set_density('macro', 1.0) water.add_macroscopic(water_data) # Define the materials file. self.materials.default_xs = '71c' self.materials += (uo2, clad, water) # Define surfaces. # Assembly/Problem Boundary left = openmc.XPlane(x0=0.0, surface_id=200, boundary_type='reflective') right = openmc.XPlane(x0=10.0, surface_id=201, boundary_type='reflective') bottom = openmc.YPlane(y0=0.0, surface_id=300, boundary_type='reflective') top = openmc.YPlane(y0=10.0, surface_id=301, boundary_type='reflective') down = openmc.ZPlane(z0=0.0, surface_id=0, boundary_type='reflective') fuel_clad_intfc = openmc.ZPlane(z0=2.0, surface_id=1) clad_lwtr_intfc = openmc.ZPlane(z0=2.4, surface_id=2) up = openmc.ZPlane(z0=5.0, surface_id=3, boundary_type='reflective') # Define cells c1 = openmc.Cell(cell_id=1) c1.region = +left & -right & +bottom & -top & +down & -fuel_clad_intfc c1.fill = uo2 c2 = openmc.Cell(cell_id=2) c2.region = +left & -right & +bottom & -top & +fuel_clad_intfc & -clad_lwtr_intfc c2.fill = clad c3 = openmc.Cell(cell_id=3) c3.region = +left & -right & +bottom & -top & +clad_lwtr_intfc & -up c3.fill = water # Define root universe. root = openmc.Universe(universe_id=0, name='root universe') root.add_cells((c1,c2,c3)) # Define the geometry file. geometry = openmc.Geometry() geometry.root_universe = root self.geometry = geometry
import openmc mats = openmc.Materials() mat = openmc.Material(1) mat.name = "Plutonium" mat.set_density('sum') mat.add_nuclide('Pu239', 4.4422e-02) mat.add_nuclide('Pu240', 2.1326e-03) mat.add_nuclide('Pu241', 9.2538e-05) mat.add_element('C', 1.9515e-04) mat.add_element('Fe', 8.1943e-05) mats.append(mat) mat = openmc.Material(2) mat.name = "Berylium Reflector" mat.set_density('sum') mat.add_element('Be', 1.2099e-01) mat.add_element('O', 1.0449e-03) mat.add_s_alpha_beta('c_Be') mats.append(mat) mat = openmc.Material(3) mat.name = "Steel Cover" mat.set_density('sum') mat.add_element('Fe', 5.1280e-02) mat.add_element('C', 3.4757e-04) mat.add_element('Si', 8.9185e-03) mat.add_element('Ti', 6.1034e-04) mat.add_element('Cr', 1.4452e-02) mat.add_element('Mn', 1.5198e-03)
import openmc import numpy as np # set wall material wall = openmc.Material(1, "wall") wall.add_nuclide('Pb205', 1) # which pb to use wall.set_density('g/cm3', 1) # ??? # set observation point detector = openmc.Material(2, "detector") detector.add_nuclide('Xe135', 1) detector.set_density('g/cm3', 1) # ? # set source material source = openmc.Material(3, "source") source.add_nuclide('Pt196', 1) # which pt to use? source.set_density('atom/cm3', 10**4) class Start_point: def __init__(self, x_, y_, z_): self.x = x_ self.y = y_ self.z = z_ def truncation_create(plane_list): #list[][0] pos plane list[][1] neg plane shape = (-plane_list[0][0]) & (+plane_list[0][1]) for oppo_planes in plane_list: shape = shape & ((-oppo_planes[0]) & (+oppo_planes[1]))
#!/usr/bin/env python3 """example_material_plot.py: plots cross sections for materials.""" import openmc import plotly.graph_objects as go natural_Li4SiO4 = openmc.Material() natural_Li4SiO4.add_element('Li', 4.0, percent_type='ao') natural_Li4SiO4.add_element('Si', 1.0, percent_type='ao') natural_Li4SiO4.add_element('O', 4.0, percent_type='ao') natural_Li4SiO4.set_density('g/cm3', 1.877) #Li4SiO4 density 1.8770150075137564 g/cm3 enrichment_fraction = 0.6 enriched_Li4SiO4 = openmc.Material() enriched_Li4SiO4.add_nuclide('Li6', 4.0 * enrichment_fraction, percent_type='ao') enriched_Li4SiO4.add_nuclide('Li7', 4.0 * (1 - enrichment_fraction), percent_type='ao') enriched_Li4SiO4.add_element('Si', 1.0, percent_type='ao') enriched_Li4SiO4.add_element('O', 4.0, percent_type='ao') enriched_Li4SiO4.set_density( 'g/cm3', 1.844) # this density is lower as there is more Li6 and less Li7 #Li4SiO4 density 1.8441466011318948 g/cm3 with 60% Li6 # Try adding another candidate breeder material (e.g. Li2SiO3, Li2ZrO3 or Li2TiO3) to the plot #Li2SiO3 density 2.619497078021483 g/cm3 #Li2ZrO3 density 2.5288596326567134 g/cm3 #Li2TiO3 density 2.8994147653592983 g/cm3
import openmc from plotly import __version__ from plotly.offline import download_plotlyjs, plot from plotly.graph_objs import Scatter, Layout def calculate_crystal_structure_density(material, atoms_per_unit_cell, volume_of_unit_cell_cm3): molar_mass = material.average_molar_mass * len(material.nuclides) atomic_mass_unit_in_g = 1.660539040e-24 density_g_per_cm3 = molar_mass * atomic_mass_unit_in_g * atoms_per_unit_cell / volume_of_unit_cell_cm3 #print('density =',density_g_per_cm3) return density_g_per_cm3 natural_Li4SiO4 = openmc.Material() natural_Li4SiO4.add_element('Li', 4.0, percent_type='ao') natural_Li4SiO4.add_element('Si', 1.0, percent_type='ao') natural_Li4SiO4.add_element('O', 4.0, percent_type='ao') natural_Li4SiO4.set_density( 'g/cm3', calculate_crystal_structure_density(natural_Li4SiO4, 14, 1.1543e-21)) print('natural_Li4SiO4 density', natural_Li4SiO4.density, natural_Li4SiO4.density_units) enrichment_fraction = 0.6 enriched_Li4SiO4 = openmc.Material() enriched_Li4SiO4.add_nuclide('Li6', 4.0 * enrichment_fraction, percent_type='ao') enriched_Li4SiO4.add_nuclide('Li7',
def _build_inputs(self): # Instantiate some Materials and register the appropriate Nuclides uo2 = openmc.Material(name='UO2 fuel at 2.4% wt enrichment') uo2.set_density('g/cc', 10.0) uo2.add_nuclide('U238', 1.0) uo2.add_nuclide('U235', 0.02) uo2.add_nuclide('O16', 2.0) borated_water = openmc.Material(name='Borated water') borated_water.set_density('g/cm3', 1) borated_water.add_nuclide('B10', 10e-5) borated_water.add_nuclide('H1', 2.0) borated_water.add_nuclide('O16', 1.0) # Instantiate a Materials collection and export to XML materials_file = openmc.Materials([uo2, borated_water]) materials_file.export_to_xml() # Instantiate ZCylinder surfaces fuel_or = openmc.ZCylinder(surface_id=1, x0=0, y0=0, r=1, name='Fuel OR') left = openmc.XPlane(surface_id=2, x0=-2, name='left') right = openmc.XPlane(surface_id=3, x0=2, name='right') bottom = openmc.YPlane(y0=-2, name='bottom') top = openmc.YPlane(y0=2, name='top') left.boundary_type = 'vacuum' right.boundary_type = 'reflective' top.boundary_type = 'reflective' bottom.boundary_type = 'reflective' # Instantiate Cells fuel = openmc.Cell(name='fuel') water = openmc.Cell(name='water') # Use surface half-spaces to define regions fuel.region = -fuel_or water.region = +fuel_or & -right & +bottom & -top # Register Materials with Cells fuel.fill = uo2 water.fill = borated_water # Instantiate pin cell Universe pin_cell = openmc.Universe(name='pin cell') pin_cell.add_cells([fuel, water]) # Instantiate root Cell and Universe root_cell = openmc.Cell(name='root cell') root_cell.region = +left & -right & +bottom & -top root_cell.fill = pin_cell root_univ = openmc.Universe(universe_id=0, name='root universe') root_univ.add_cell(root_cell) # Instantiate a Geometry, register the root Universe geometry = openmc.Geometry(root_univ) geometry.export_to_xml() # Instantiate a Settings object, set all runtime parameters settings_file = openmc.Settings() settings_file.batches = 10 settings_file.inactive = 0 settings_file.particles = 1000 #settings_file.output = {'tallies': True} # Create an initial uniform spatial source distribution bounds = [-0.62992, -0.62992, -1, 0.62992, 0.62992, 1] uniform_dist = openmc.stats.Box(bounds[:3], bounds[3:],\ only_fissionable=True) settings_file.source = openmc.source.Source(space=uniform_dist) settings_file.export_to_xml() # Tallies file tallies_file = openmc.Tallies() # Create partial current tallies from fuel to water # Filters two_groups = [0., 4e6, 20e6] energy_filter = openmc.EnergyFilter(two_groups) polar_filter = openmc.PolarFilter([0, np.pi / 4, np.pi]) azimuthal_filter = openmc.AzimuthalFilter([0, np.pi / 4, np.pi]) surface_filter = openmc.SurfaceFilter([1]) cell_from_filter = openmc.CellFromFilter(fuel) cell_filter = openmc.CellFilter(water) # Use Cell to cell filters for partial current cell_to_cell_tally = openmc.Tally(name=str('fuel_to_water_1')) cell_to_cell_tally.filters = [cell_from_filter, cell_filter, \ energy_filter, polar_filter, azimuthal_filter] cell_to_cell_tally.scores = ['current'] tallies_file.append(cell_to_cell_tally) # Use a Cell from + surface filters for partial current cell_to_cell_tally = openmc.Tally(name=str('fuel_to_water_2')) cell_to_cell_tally.filters = [cell_from_filter, surface_filter, \ energy_filter, polar_filter, azimuthal_filter] cell_to_cell_tally.scores = ['current'] tallies_file.append(cell_to_cell_tally) # Create partial current tallies from water to fuel # Filters cell_from_filter = openmc.CellFromFilter(water) cell_filter = openmc.CellFilter(fuel) # Cell to cell filters for partial current cell_to_cell_tally = openmc.Tally(name=str('water_to_fuel_1')) cell_to_cell_tally.filters = [cell_from_filter, cell_filter, \ energy_filter, polar_filter, azimuthal_filter] cell_to_cell_tally.scores = ['current'] tallies_file.append(cell_to_cell_tally) # Cell from + surface filters for partial current cell_to_cell_tally = openmc.Tally(name=str('water_to_fuel_2')) cell_to_cell_tally.filters = [cell_from_filter, surface_filter, \ energy_filter, polar_filter, azimuthal_filter] cell_to_cell_tally.scores = ['current'] tallies_file.append(cell_to_cell_tally) # Create a net current tally on inner surface using a surface filter surface_filter = openmc.SurfaceFilter([1]) surf_tally1 = openmc.Tally(name='net_cylinder') surf_tally1.filters = [surface_filter, energy_filter, polar_filter, \ azimuthal_filter] surf_tally1.scores = ['current'] tallies_file.append(surf_tally1) # Create a net current tally on left surface using a surface filter # This surface has a vacuum boundary condition, so leakage is tallied surface_filter = openmc.SurfaceFilter([2]) surf_tally2 = openmc.Tally(name='leakage_left') surf_tally2.filters = [surface_filter, energy_filter, polar_filter, \ azimuthal_filter] surf_tally2.scores = ['current'] tallies_file.append(surf_tally2) # Create a net current tally on right surface using a surface filter # This surface has a reflective boundary condition, so the net current # should be zero. surface_filter = openmc.SurfaceFilter([3]) surf_tally3 = openmc.Tally(name='net_right') surf_tally3.filters = [surface_filter, energy_filter] surf_tally3.scores = ['current'] tallies_file.append(surf_tally3) surface_filter = openmc.SurfaceFilter([3]) surf_tally3 = openmc.Tally(name='net_right') surf_tally3.filters = [surface_filter, energy_filter] surf_tally3.scores = ['current'] tallies_file.append(surf_tally3) tallies_file.export_to_xml()
#!/usr/bin/env python3 """example_isotope_plot.py: plots few 2D views of a simple geometry .""" __author__ = "Jonathan Shimwell" import openmc import matplotlib.pyplot as plt import os mats = openmc.Materials() natural_lead = openmc.Material(1, "natural_lead") natural_lead.add_element('Pb', 1, 'ao') mats.append(natural_lead) mats.export_to_xml() #example surfaces surface_sph1 = openmc.Sphere(r=500) surface_sph2 = openmc.Sphere(r=600) volume_sph1 = +surface_sph1 & -surface_sph2 # above (+) surface_sph and below (-) surface_sph2 #add surfaces here using https://openmc.readthedocs.io/en/stable/usersguide/geometry.html#surfaces-and-regions #example cell cell1 = openmc.Cell(region=volume_sph1) cell1.fill = natural_lead #add another cell here universe = openmc.Universe(
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 = 0 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' ] # 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(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') df = tbr_tally.get_pandas_dataframe() tbr_tally_result = df['mean'].sum() tbr_tally_std_dev = df['std. dev.'].sum() return { 'enrichment_fraction': enrichment_fraction, 'tbr_tally_result': tbr_tally_result, 'tbr_tally_std_dev': tbr_tally_std_dev }
#!/usr/bin/env python3 import openmc import openmc.model import os import matplotlib.pyplot as plt #MATERIALS# mats = openmc.Materials() copper = openmc.Material(name='Copper') copper.set_density('g/cm3', 8.5) copper.add_element('Cu', 1.0) mats.append(copper) eurofer = openmc.Material(name='EUROFER97') eurofer.set_density('g/cm3', 7.75) eurofer.add_element('Fe', 89.067, percent_type='wo') eurofer.add_element('C', 0.11, percent_type='wo') eurofer.add_element('Mn', 0.4, percent_type='wo') eurofer.add_element('Cr', 9.0, percent_type='wo') eurofer.add_element('Ta', 0.12, percent_type='wo') eurofer.add_element('W', 1.1, percent_type='wo') eurofer.add_element('N', 0.003, percent_type='wo') eurofer.add_element('V', 0.2, percent_type='wo') mats.append(eurofer) #GEOMETRY#
import openmc steel = openmc.Material(1, 'steel') steel.add_element('Si', 1.3603E-03) steel.add_element('Ti', 5.9844E-04) steel.add_element('Ni', 8.1369E-03) steel.add_element('Cr', 1.6532E-02) steel.add_element('Fe', 5.9088E-02) steel.add_nuclide('Mn55', 1.3039E-03) steel.set_density('atom/b-cm', 8.701954E-02) steel.temperature = 293 water = openmc.Material(2, 'water') water.add_nuclide('H1', 6.6742E-02) water.add_nuclide('O16', 3.3371E-02) water.set_density('atom/b-cm', 1.001130E-01) water.add_s_alpha_beta('c_H_in_H2O') water.temperature = 293 clad = openmc.Material(4, 'cladding') clad.add_nuclide('B10', 1.0844E-02) clad.add_nuclide('B11', 4.3649E-02) clad.add_element('C', 1.3623E-02) clad.set_density('atom/b-cm', 6.811600E-02) clad.temperature = 293 fuel = openmc.Material(3, 'fuel') fuel.add_nuclide('H1', 5.6221E-02) fuel.add_nuclide('O16', 3.8624E-02) fuel.add_nuclide('N14', 2.9898E-03) fuel.add_nuclide('U234', 3.0893E-07)
#!/usr/bin/env python3 """example_isotope_plot.py: plots few 2D views of a simple tokamak geometry .""" __author__ = "Jonathan Shimwell" import openmc import matplotlib.pyplot as plt import os mats = openmc.Materials() copper = openmc.Material(name='Copper') copper.set_density('g/cm3', 8.5) copper.add_element('Cu', 1.0) mats.append(copper) eurofer = openmc.Material(name='EUROFER97') eurofer.set_density('g/cm3', 7.75) eurofer.add_element('Fe', 89.067, percent_type='wo') eurofer.add_element('C', 0.11, percent_type='wo') eurofer.add_element('Mn', 0.4, percent_type='wo') eurofer.add_element('Cr', 9.0, percent_type='wo') eurofer.add_element('Ta', 0.12, percent_type='wo') eurofer.add_element('W', 1.1, percent_type='wo') eurofer.add_element('N', 0.003, percent_type='wo') eurofer.add_element('V', 0.2, percent_type='wo') mats.append(eurofer) breeder_material = openmc.Material(name='breeder_material') breeder_material.set_density('g/cm3', 9.1) breeder_material.add_element('Pb', 84.2, percent_type='ao')
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on Wed Aug 9 09:43:36 2017 @author: stu """ import openmc # define the model materials # define fuel: 3% (atom percent) enriched UO2 uo2 = openmc.Material() uo2.add_nuclide('U235', 0.03) uo2.add_nuclide('U238', 0.97) uo2.add_element('O', 2.0) uo2.set_density('g/cm3', 10.0) # define zirconium zirconium = openmc.Material() zirconium.add_element('Zr', 1.0) zirconium.set_density('g/cm3', 6.6) # define water water = openmc.Material() water.add_element('H', 2.0) water.add_element('O', 1.0) water.set_density('g/cm3', 0.7) water.add_s_alpha_beta('c_H_in_H2O') mf = openmc.Materials((uo2, zirconium, water))
def zr(): zr = openmc.Material() zr.add_element('Zr', 1.0) zr.set_density('g/cm3', 1.0) return zr
import openmc import numpy as np fuel=openmc.Material(1,'fuel') fuel.add_nuclide('O16',4.1202e-2) fuel.add_nuclide('U234',2.8563e-6) fuel.add_nuclide('U235',4.8785e-4) fuel.add_nuclide('U236',3.5348e-6) fuel.add_nuclide('U238',2.0009e-2) fuel.set_density('g/cm3',9.8) water=openmc.Material(2,'water') water.add_nuclide('H1',6.6706e-2) water.add_nuclide('O16',3.3353e-2) water.add_nuclide('Gd152',7.9656e-11) water.add_nuclide('Gd154',8.6825e-10) water.add_nuclide('Gd155',5.8946e-9) water.add_nuclide('Gd156',8.1528e-9) water.add_nuclide('Gd157',6.2331e-9) water.add_nuclide('Gd158',9.8933e-9) water.add_nuclide('Gd160',8.7064e-9) water.set_density('g/cm3',0.997766) water.add_s_alpha_beta('c_H_in_H2O') clad6061=openmc.Material(3,'clad6061') clad6061.add_element('Mg',6.6651e-4) clad6061.add_nuclide('Al27',5.8433e-2) clad6061.add_element('Si',3.4607e-4) clad6061.add_element('Ti',2.5375e-5)
from math import pi import openmc import openmc.deplete import matplotlib.pyplot as plt ############################################################################### # Define materials ############################################################################### # Instantiate some Materials and register the appropriate Nuclides uo2 = openmc.Material(name='UO2 fuel at 2.4% wt enrichment') uo2.set_density('g/cm3', 10.29769) uo2.add_element('U', 1., enrichment=2.4) uo2.add_element('O', 2.) helium = openmc.Material(name='Helium for gap') helium.set_density('g/cm3', 0.001598) helium.add_element('He', 2.4044e-4) 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)
inactive = 5 particles = 10000 ############################################################################### # Exporting to OpenMC materials.xml File ############################################################################### # Instantiate some Nuclides h1 = openmc.Nuclide('H-1') o16 = openmc.Nuclide('O-16') u235 = openmc.Nuclide('U-235') u238 = openmc.Nuclide('U-238') # Instantiate some Materials and register the appropriate Nuclides 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_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([fuel1, fuel2, moderator])
def test_unstructured_mesh(test_opts): openmc.reset_auto_ids() # skip the test if the library is not enabled if test_opts['library'] == 'moab' and not openmc.lib._dagmc_enabled(): pytest.skip("DAGMC (and MOAB) mesh not enbaled in this build.") if test_opts['library'] == 'libmesh' and not openmc.lib._libmesh_enabled(): pytest.skip("LibMesh is not enabled in this build.") # skip the tracklength test for libmesh if test_opts['library'] == 'libmesh' and \ test_opts['estimator'] == 'tracklength': pytest.skip("Tracklength tallies are not supported using libmesh.") ### Materials ### materials = openmc.Materials() fuel_mat = openmc.Material(name="fuel") fuel_mat.add_nuclide("U235", 1.0) fuel_mat.set_density('g/cc', 4.5) materials.append(fuel_mat) zirc_mat = openmc.Material(name="zircaloy") zirc_mat.add_element("Zr", 1.0) zirc_mat.set_density("g/cc", 5.77) materials.append(zirc_mat) water_mat = openmc.Material(name="water") water_mat.add_nuclide("H1", 2.0) water_mat.add_nuclide("O16", 1.0) water_mat.set_density("atom/b-cm", 0.07416) materials.append(water_mat) materials.export_to_xml() ### Geometry ### fuel_min_x = openmc.XPlane(-5.0, name="minimum x") fuel_max_x = openmc.XPlane(5.0, name="maximum x") fuel_min_y = openmc.YPlane(-5.0, name="minimum y") fuel_max_y = openmc.YPlane(5.0, name="maximum y") fuel_min_z = openmc.ZPlane(-5.0, name="minimum z") fuel_max_z = openmc.ZPlane(5.0, name="maximum z") fuel_cell = openmc.Cell(name="fuel") fuel_cell.region = +fuel_min_x & -fuel_max_x & \ +fuel_min_y & -fuel_max_y & \ +fuel_min_z & -fuel_max_z fuel_cell.fill = fuel_mat clad_min_x = openmc.XPlane(-6.0, name="minimum x") clad_max_x = openmc.XPlane(6.0, name="maximum x") clad_min_y = openmc.YPlane(-6.0, name="minimum y") clad_max_y = openmc.YPlane(6.0, name="maximum y") clad_min_z = openmc.ZPlane(-6.0, name="minimum z") clad_max_z = openmc.ZPlane(6.0, name="maximum z") clad_cell = openmc.Cell(name="clad") clad_cell.region = (-fuel_min_x | +fuel_max_x | -fuel_min_y | +fuel_max_y | -fuel_min_z | +fuel_max_z) & \ (+clad_min_x & -clad_max_x & +clad_min_y & -clad_max_y & +clad_min_z & -clad_max_z) clad_cell.fill = zirc_mat if test_opts['external_geom']: bounds = (15, 15, 15) else: bounds = (10, 10, 10) water_min_x = openmc.XPlane(x0=-bounds[0], name="minimum x", boundary_type='vacuum') water_max_x = openmc.XPlane(x0=bounds[0], name="maximum x", boundary_type='vacuum') water_min_y = openmc.YPlane(y0=-bounds[1], name="minimum y", boundary_type='vacuum') water_max_y = openmc.YPlane(y0=bounds[1], name="maximum y", boundary_type='vacuum') water_min_z = openmc.ZPlane(z0=-bounds[2], name="minimum z", boundary_type='vacuum') water_max_z = openmc.ZPlane(z0=bounds[2], name="maximum z", boundary_type='vacuum') water_cell = openmc.Cell(name="water") water_cell.region = (-clad_min_x | +clad_max_x | -clad_min_y | +clad_max_y | -clad_min_z | +clad_max_z) & \ (+water_min_x & -water_max_x & +water_min_y & -water_max_y & +water_min_z & -water_max_z) water_cell.fill = water_mat # create a containing universe geometry = openmc.Geometry([fuel_cell, clad_cell, water_cell]) ### Tallies ### # create meshes and mesh filters regular_mesh = openmc.RegularMesh() regular_mesh.dimension = (10, 10, 10) regular_mesh.lower_left = (-10.0, -10.0, -10.0) regular_mesh.upper_right = (10.0, 10.0, 10.0) regular_mesh_filter = openmc.MeshFilter(mesh=regular_mesh) if test_opts['holes']: mesh_filename = "test_mesh_tets_w_holes.e" else: mesh_filename = "test_mesh_tets.e" uscd_mesh = openmc.UnstructuredMesh(mesh_filename, test_opts['library']) uscd_filter = openmc.MeshFilter(mesh=uscd_mesh) # create tallies tallies = openmc.Tallies() regular_mesh_tally = openmc.Tally(name="regular mesh tally") regular_mesh_tally.filters = [regular_mesh_filter] regular_mesh_tally.scores = ['flux'] regular_mesh_tally.estimator = test_opts['estimator'] tallies.append(regular_mesh_tally) uscd_tally = openmc.Tally(name="unstructured mesh tally") uscd_tally.filters = [uscd_filter] uscd_tally.scores = ['flux'] uscd_tally.estimator = test_opts['estimator'] tallies.append(uscd_tally) ### Settings ### settings = openmc.Settings() settings.run_mode = 'fixed source' settings.particles = 1000 settings.batches = 10 # source setup r = openmc.stats.Uniform(a=0.0, b=0.0) theta = openmc.stats.Discrete(x=[0.0], p=[1.0]) phi = openmc.stats.Discrete(x=[0.0], p=[1.0]) space = openmc.stats.SphericalIndependent(r, theta, phi) energy = openmc.stats.Discrete(x=[15.e+06], p=[1.0]) source = openmc.Source(space=space, energy=energy) settings.source = source model = openmc.model.Model(geometry=geometry, materials=materials, tallies=tallies, settings=settings) harness = UnstructuredMeshTest('statepoint.10.h5', model, test_opts['inputs_true'], test_opts['holes']) harness.main()
############################################################################### # Simulation Input File Parameters ############################################################################### # OpenMC simulation parameters batches = 20 inactive = 10 particles = 10000 ############################################################################### # 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
import openmc mats = openmc.Materials() mat = openmc.Material(1) mat.name = "Inner Core 1" mat.set_density('sum') mat.add_nuclide('Pu240', 1.17624E-04) mat.add_nuclide('Pu241', 1.33836E-05) mat.add_nuclide('U235', 1.26065E-05) mat.add_nuclide('U238', 5.79290E-03) mat.add_nuclide('Pu239', 8.86528E-04) mat.add_nuclide('Pu238', 3.33696E-07) mat.add_nuclide('Pu242', 1.40289E-06) mat.add_nuclide('Am241', 2.95925E-06) mat.add_element('Cr', 2.69344E-03) mat.add_element('Ni', 1.19793E-03) mat.add_element('Fe', 1.28611E-02) mat.add_element('Al', 4.02385E-06) mat.add_element('Na', 9.27752E-03) mat.add_element('O', 1.37526E-02) mat.add_element('C', 3.66446E-05) mat.add_element('Mo', 2.36059E-04) mat.add_element('Mn', 2.25651E-04) mat.add_element('Cu', 2.46789E-05) mat.add_element('Si', 1.62374E-04) mat.add_element('Cl', 2.98410E-07) mat.add_element('Co', 8.32631E-07) mats.append(mat) mat = openmc.Material(2)
# 12.5, 12.5, 12.5, 12.5, 12.5, 12.5, 12.5, 12.5, # CASMO4 time step # 12.5, 12.5, 12.5, 12.5, 12.5, 12.5, 12.5, 12.5, # 12.5, 12.5, 12.5, 12.5, 12.5, 12.5, 12.5, 12.5, # 12.5, 25.0, 25.0, 25.0, 25.0, 25.0, 25.0, 25.0, # 62.5, 62.5, 62.5, 62.5, 62.5, 62.5, 62.5, 62.5, # 62.5, 62.5, 62.5, 62.5, 62.5, 62.5, 62.5, 62.5 ])*24*60*60 #chain_file = './chain_casl.xml' power_den = 40.0 # W/cm, for 2D simulations only (use W for 3D) 40.0 W/gU ############################################################################### # Define materials ############################################################################### # Instantiate some Materials and register the appropriate Nuclides fuel_21 = openmc.Material(material_id=1, name='UO2 fuel at 2.1% wt enrichment') fuel_21.set_density('g/cm3', 10.257) fuel_21.add_nuclide('U234', 4.02487E-06) fuel_21.add_nuclide('U235', 4.86484E-04) fuel_21.add_nuclide('U236', 2.23756E-06) fuel_21.add_nuclide('U238', 2.23868E-02) fuel_21.add_nuclide('O16', 4.57590E-02) fuel_21.depletable = True fuel_31 = openmc.Material(material_id=2, name='UO2 fuel at 3.1% wt enrichment') fuel_31.set_density('g/cm3', 10.257) fuel_31.add_nuclide('U234', 6.11864E-06) fuel_31.add_nuclide('U235', 7.18132E-04) fuel_31.add_nuclide('U236', 3.29861E-06) fuel_31.add_nuclide('U238', 2.21546E-02) fuel_31.add_nuclide('O16', 4.57642E-02)
def _build_inputs(self): model = openmc.model.Model() ### MATERIALS ### fuel = openmc.Material(name='no-void fuel') fuel.set_density('g/cc', 10.29769) fuel.add_nuclide('U234', 0.93120485) fuel.add_nuclide('U235', 0.00055815) fuel.add_nuclide('U238', 0.022408) fuel.add_nuclide('O16', 0.045829) cladding = openmc.Material(name='clad') cladding.set_density('g/cc', 6.55) cladding.add_nuclide('Zr90', 0.021827) cladding.add_nuclide('Zr91', 0.00476) cladding.add_nuclide('Zr92', 0.0072758) cladding.add_nuclide('Zr94', 0.0073734) cladding.add_nuclide('Zr96', 0.0011879) water = openmc.Material(name='water') water.set_density('g/cc', 0.740582) water.add_nuclide('H1', 0.049457) water.add_nuclide('O16', 0.024672) water.add_nuclide('B10', 8.0042e-06) water.add_nuclide('B11', 3.2218e-05) water.add_s_alpha_beta('c_H_in_H2O') model.materials = openmc.Materials([fuel, cladding, water]) ### GEOMETRY ### # create the DAGMC universe pincell_univ = openmc.DAGMCUniverse(filename='dagmc.h5m', auto_geom_ids=True) # create a 2 x 2 lattice using the DAGMC pincell pitch = np.asarray((24.0, 24.0)) lattice = openmc.RectLattice() lattice.pitch = pitch lattice.universes = [[pincell_univ] * 2] * 2 lattice.lower_left = -pitch left = openmc.XPlane(x0=-pitch[0], name='left', boundary_type='reflective') right = openmc.XPlane(x0=pitch[0], name='right', boundary_type='reflective') front = openmc.YPlane(y0=-pitch[1], name='front', boundary_type='reflective') back = openmc.YPlane(y0=pitch[1], name='back', boundary_type='reflective') # clip the DAGMC geometry at +/- 10 cm w/ CSG planes bottom = openmc.ZPlane(z0=-10.0, name='bottom', boundary_type='reflective') top = openmc.ZPlane(z0=10.0, name='top', boundary_type='reflective') bounding_region = +left & -right & +front & -back & +bottom & -top bounding_cell = openmc.Cell(fill=lattice, region=bounding_region) model.geometry = openmc.Geometry([bounding_cell]) # settings model.settings.particles = 100 model.settings.batches = 10 model.settings.inactive = 2 model.settings.output = {'summary': False} model.export_to_xml()
import openmc mats = openmc.Materials() mat = openmc.Material(1) mat.name = "Plutonium nitrate solution" mat.set_density('sum') mat.add_nuclide('Pu239', 1.2164e-04) mat.add_nuclide('Pu240', 3.9010e-06) mat.add_nuclide('N14', 1.3452e-03) mat.add_nuclide('H1', 6.3772e-02) mat.add_nuclide('O16', 3.5500e-02) mat.add_element('Fe', 2.0380e-06) mats.append(mat) mat = openmc.Material(2) mat.name = "347 stainless steel" mat.set_density('sum') mat.add_element('Fe', 6.0386e-02) mat.add_element('Cr', 1.6678e-02) mat.add_element('Ni', 9.8504e-03) mats.append(mat) mat = openmc.Material(3) mat.name = "Water at 27 C" mat.set_density('sum') mat.add_nuclide('H1', 6.6622e-02) mat.add_nuclide('O16', 3.3311e-02) mats.append(mat) mats.export_to_xml()
import openmc import numpy as np fuel = openmc.Material(1, 'fuel') fuel.add_nuclide('O16', 4.6753e-2) fuel.add_nuclide('U234', 5.1835e-6) fuel.add_nuclide('U235', 1.0102e-3) fuel.add_nuclide('U236', 5.1395e-6) fuel.add_nuclide('U238', 2.2157e-2) fuel.set_density('g/cm3', 10.4) water = openmc.Material(2, 'water') water.add_nuclide('H1', 6.6675e-2) water.add_nuclide('O16', 3.3338e-2) water.set_density('g/cm3', .997297) water.add_s_alpha_beta('c_H_in_H2O') clad6061 = openmc.Material(3, 'clad6061') clad6061.add_element('Mg', 6.6651e-4) clad6061.add_nuclide('Al27', 5.8433e-2) clad6061.add_element('Si', 3.4607e-4) clad6061.add_element('Ti', 2.5375e-5) clad6061.add_element('Cu', 6.3731e-5) clad6061.add_element('Zn', 3.0967e-5) clad6061.add_element('Ni', 8.3403e-3) clad6061.add_element('Cr', 6.2310e-5) clad6061.add_element('Fe', 1.0152e-4) clad6061.add_nuclide('Mn55', 2.2115e-5) clad6061.set_density('g/cm3', 2.69) rubber = openmc.Material(4, 'rubber')
def build_model(ppm_Boron): # Create the pin materials fuel = openmc.Material(name='1.6% Fuel') fuel.set_density('g/cm3', 10.31341) fuel.add_element('U', 1., enrichment=1.6) fuel.add_element('O', 2.) zircaloy = openmc.Material(name='Zircaloy') zircaloy.set_density('g/cm3', 6.55) zircaloy.add_element('Zr', 1.) water = openmc.Material(name='Borated Water') water.set_density('g/cm3', 0.741) water.add_element('H', 2.) water.add_element('O', 1.) # Include the amount of boron in the water based on the ppm, # neglecting the other constituents of boric acid water.add_element('B', ppm_Boron * 1e-6) # Instantiate a Materials object materials = openmc.Materials([fuel, zircaloy, water]) # Create cylinders for the fuel and clad fuel_outer_radius = openmc.ZCylinder(r=0.39218) clad_outer_radius = openmc.ZCylinder(r=0.45720) # Create boundary planes to surround the geometry 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') # Create fuel Cell fuel_cell = openmc.Cell(name='1.6% Fuel') fuel_cell.fill = fuel fuel_cell.region = -fuel_outer_radius # 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 # 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) # Create root Universe root_universe = openmc.Universe(name='root universe', universe_id=0) root_universe.add_cells([fuel_cell, clad_cell, moderator_cell]) # Create Geometry and set root universe geometry = openmc.Geometry(root_universe) # Finish with the settings file settings = openmc.Settings() settings.batches = 300 settings.inactive = 200 settings.particles = 10000 settings.run_mode = 'eigenvalue' # Create an initial uniform spatial source distribution over fissionable zones bounds = [-0.63, -0.63, -10, 0.63, 0.63, 10.] uniform_dist = openmc.stats.Box(bounds[:3], bounds[3:], only_fissionable=True) settings.source = openmc.source.Source(space=uniform_dist) # We dont need a tallies file so dont waste the disk input/output time settings.output = {'tallies': False} model = openmc.model.Model(geometry, materials, settings) return model
def test_external_mesh(cpp_driver): # Materials materials = openmc.Materials() fuel_mat = openmc.Material(name="fuel") fuel_mat.add_nuclide("U235", 1.0) fuel_mat.set_density('g/cc', 4.5) materials.append(fuel_mat) zirc_mat = openmc.Material(name="zircaloy") zirc_mat.add_element("Zr", 1.0) zirc_mat.set_density("g/cc", 5.77) materials.append(zirc_mat) water_mat = openmc.Material(name="water") water_mat.add_nuclide("H1", 2.0) water_mat.add_nuclide("O16", 1.0) water_mat.set_density("atom/b-cm", 0.07416) materials.append(water_mat) materials.export_to_xml() # Geometry fuel_min_x = openmc.XPlane(-5.0, name="minimum x") fuel_max_x = openmc.XPlane(5.0, name="maximum x") fuel_min_y = openmc.YPlane(-5.0, name="minimum y") fuel_max_y = openmc.YPlane(5.0, name="maximum y") fuel_min_z = openmc.ZPlane(-5.0, name="minimum z") fuel_max_z = openmc.ZPlane(5.0, name="maximum z") fuel_cell = openmc.Cell(name="fuel") fuel_cell.region = +fuel_min_x & -fuel_max_x & \ +fuel_min_y & -fuel_max_y & \ +fuel_min_z & -fuel_max_z fuel_cell.fill = fuel_mat clad_min_x = openmc.XPlane(-6.0, name="minimum x") clad_max_x = openmc.XPlane(6.0, name="maximum x") clad_min_y = openmc.YPlane(-6.0, name="minimum y") clad_max_y = openmc.YPlane(6.0, name="maximum y") clad_min_z = openmc.ZPlane(-6.0, name="minimum z") clad_max_z = openmc.ZPlane(6.0, name="maximum z") clad_cell = openmc.Cell(name="clad") clad_cell.region = (-fuel_min_x | +fuel_max_x | -fuel_min_y | +fuel_max_y | -fuel_min_z | +fuel_max_z) & \ (+clad_min_x & -clad_max_x & +clad_min_y & -clad_max_y & +clad_min_z & -clad_max_z) clad_cell.fill = zirc_mat bounds = (10, 10, 10) water_min_x = openmc.XPlane(x0=-bounds[0], name="minimum x", boundary_type='vacuum') water_max_x = openmc.XPlane(x0=bounds[0], name="maximum x", boundary_type='vacuum') water_min_y = openmc.YPlane(y0=-bounds[1], name="minimum y", boundary_type='vacuum') water_max_y = openmc.YPlane(y0=bounds[1], name="maximum y", boundary_type='vacuum') water_min_z = openmc.ZPlane(z0=-bounds[2], name="minimum z", boundary_type='vacuum') water_max_z = openmc.ZPlane(z0=bounds[2], name="maximum z", boundary_type='vacuum') water_cell = openmc.Cell(name="water") water_cell.region = (-clad_min_x | +clad_max_x | -clad_min_y | +clad_max_y | -clad_min_z | +clad_max_z) & \ (+water_min_x & -water_max_x & +water_min_y & -water_max_y & +water_min_z & -water_max_z) water_cell.fill = water_mat # create a containing universe geometry = openmc.Geometry([fuel_cell, clad_cell, water_cell]) # Meshes mesh_filename = "test_mesh_tets.h5m" # Create a normal unstructured mesh to compare to uscd_mesh = openmc.UnstructuredMesh(mesh_filename, 'moab') # Create filters uscd_filter = openmc.MeshFilter(mesh=uscd_mesh) # Tallies tallies = openmc.Tallies() uscd_tally = openmc.Tally(name="unstructured mesh tally") uscd_tally.filters = [uscd_filter] uscd_tally.scores = ['flux'] uscd_tally.estimator = 'tracklength' tallies.append(uscd_tally) # Settings settings = openmc.Settings() settings.run_mode = 'fixed source' settings.particles = 100 settings.batches = 10 # Source setup space = openmc.stats.Point() angle = openmc.stats.Monodirectional((-1.0, 0.0, 0.0)) energy = openmc.stats.Discrete(x=[15.e+06], p=[1.0]) source = openmc.Source(space=space, energy=energy, angle=angle) settings.source = source model = openmc.model.Model(geometry=geometry, materials=materials, tallies=tallies, settings=settings) harness = ExternalMoabTest(cpp_driver, 'statepoint.10.h5', model) # Run open MC and check results harness.main()
import openmc mats = openmc.Materials() mat = openmc.Material(1) mat.name = "HEU" mat.set_density('sum') mat.add_nuclide('U234', 5.2111e-04) mat.add_nuclide('U235', 4.2064e-02) mat.add_nuclide('U238', 4.3626e-03) mat.add_element('C', 1.1074e-03) mat.add_element('Fe', 1.9320e-04) mat.add_element('W', 5.3798e-05) mats.append(mat) mats.export_to_xml()
import openmc clad = openmc.Material(1, 'cladding') clad.add_element('C', 4.3736e-5) clad.add_element('Si', 1.0627e-3) clad.add_element('S', 2.9782e-6) clad.add_element('Ni', 8.3403e-3) clad.add_element('Cr', 1.6775e-2) clad.add_nuclide('P31', 4.3170e-5) clad.add_element('Fe', 5.9421e-2) clad.add_nuclide('Mn55', 1.1561e-3) clad.set_density('atom/b-cm', 8.68449842E-02) air = openmc.Material(2, 'water') air.add_nuclide('N14', 3.9016e-5) air.add_nuclide('O16', 1.0409e-5) air.set_density('atom/b-cm', 4.94250000E-05) fuel = openmc.Material(3, 'fuel') fuel.add_nuclide('H1', 5.7176E-02) fuel.add_nuclide('N14', 2.8156E-03) fuel.add_nuclide('O16', 3.7836E-02) fuel.add_nuclide('U234', 5.9840E-07) fuel.add_nuclide('U235', 7.4257E-05) fuel.add_nuclide('U236', 7.4165E-08) fuel.add_nuclide('U238', 6.6142E-04) fuel.set_density('atom/b-cm', 9.85636637E-02) fuel.add_s_alpha_beta('c_H_in_H2O') mats = openmc.Materials([clad, air, fuel]) mats.cross_sections = '/home/tang/nndc_hdf5/cross_sections.xml'
# OpenMC simulation parameters batches = 15 inactive = 5 particles = 10000 ############################################################################### # Exporting to OpenMC materials.xml file ############################################################################### # Instantiate some Nuclides h1 = openmc.Nuclide('H-1') o16 = openmc.Nuclide('O-16') u235 = openmc.Nuclide('U-235') # Instantiate some Materials and register the appropriate Nuclides moderator = openmc.Material(material_id=41, 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') fuel = openmc.Material(material_id=40, name='fuel') fuel.set_density('g/cc', 4.5) fuel.add_nuclide(u235, 1.) # Instantiate a Materials collection and export to XML materials_file = openmc.Materials([moderator, fuel]) materials_file.default_xs = '71c' materials_file.export_to_xml() ###############################################################################
#!/usr/bin/env python3 """example_isotope_plot.py: plots few 2D views of a simple tokamak geometry with neutron flux.""" __author__ = "Jonathan Shimwell" import openmc import matplotlib.pyplot as plt import os #MATERIALS# breeder_material = openmc.Material(1, "PbLi") #Pb84.2Li15.8 with natural enrichment of Li6 enrichment_fraction = 0.97 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='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')