Hello everyone,
I’m trying to get the tritium production and the code runs sucessfully but I can’t read the result, I try to print it using this line: print('The tritium breeding by lithium 6 is ', tally.scores), it gives a result of zero.
But it doesn’t give me the value. Here’s my script and a screenshot of the result:
import openmc
%matplotlib inline
from IPython.display import Image
import numpy as np
import matplotlib.pyplot as plt
!rm summary.h5
!rm statepoint..h5
settings = openmc.Settings()
settings.particles = 500
settings.batches = 10
settings.inactive = 0
energy_dist = openmc.stats.Discrete([14.5e6], [1.0]) # energies, probabilities
source = openmc.Source(energy=energy_dist)
source = openmc.Source()
source.space = openmc.stats.Point((0, 0, 0))
source.angle = openmc.stats.Isotropic()
source.energy = openmc.stats.Discrete([14.5e6], [1.0])
settings.source = source
settings.source = source
settings.run_mode = ‘fixed source’
settings.export_to_xml()
lithium = openmc.Material(1, “lithium”)
lithium.add_element(‘Li’, 6.0)
lithium.set_density(‘g/cm3’, 0.534)
mats = openmc.Materials([lithium])
mats.export_to_xml()
sph = openmc.Sphere(r=16, boundary_type=‘reflective’)
inside_sph = -sph
outside_sph = +sph
sph_2 = openmc.Sphere(r=15, boundary_type=‘reflective’)
inside_sph_2 = -sph_2
outside_sph_2 = +sph_2
spherical_shell = -sph & +sph_2
cell = openmc.Cell(region=spherical_shell)
cell.fill = lithium
outside_sph = openmc.Sphere(r=17, boundary_type=‘vacuum’)
universe = openmc.Universe(cells=[cell, empty_cell])
empty_cell = openmc.Cell(region=-sph_2)
universe.plot(width = (40.0, 40.0), colors={cell: ‘green’})
geometry = openmc.Geometry(universe)
geometry.export_to_xml()
cell_filter = openmc.CellFilter([cell])
energy_filter = openmc.EnergyFilter([14.5e6])
tally = openmc.Tally(name=‘breeding’)
tally.filters = [cell_filter, energy_filter]
tallies_file = openmc.Tallies()
tallies_file.append(tally)
tally.scores = [‘H3-production’]
tallies_file.export_to_xml()
model = openmc.model.Model(geometry, mats, settings, tallies_file)
!rm summary.h5
!rm statepoint..h5
sp_filename = model.run()
print('The tritium breeding by lithium 6 is ', tally.scores)
with openmc.StatePoint(“statepoint.10.h5”) as sp:
k_eff = sp.keff
Thank you so much for your help!