Hi all,In this example, I want to draw this graph for two sources. However, when I add the 2nd source in this way, the graph does not change. How can I add the 2nd source? Could you help me?
import openmc
MATERIALS
Tungsten is a very good photon shield, partly due to its high Z number and electrons
my_material = openmc.Material(name=‘tungsten’)
my_material.add_element(‘W’, 1, percent_type=‘ao’)
my_material.set_density(‘g/cm3’, 19)
mats = openmc.Materials([my_material])
GEOMETRY
surfaces
vessel_inner_surface = openmc.Sphere(r=500)
vessel_rear_surface = openmc.Sphere(r=530)
Currently it is not possible to tally on boundary_type=‘vacuum’ surfaces
outer_surface = openmc.Sphere(r=550, boundary_type=‘vacuum’)
cells
inner_vessel_cell = openmc.Cell(region=-vessel_inner_surface)
inner_vessel_cell is filled with a void / vacuum by default
blanket_cell = openmc.Cell(region=-vessel_rear_surface & +vessel_inner_surface)
blanket_cell.fill = my_material
outer_vessel_cell = openmc.Cell(region=+vessel_rear_surface & -outer_surface)
this is filled with a void / vacuum by default
universe = openmc.Universe(cells=[inner_vessel_cell,blanket_cell, outer_vessel_cell])
geom = openmc.Geometry(universe)
SIMULATION SETTINGS
Instantiate a Settings object
sett = openmc.Settings()
sett.batches = 100
sett.inactive = 0 # the default is 10, which would be wasted computing for us
sett.particles = 1000
sett.run_mode = ‘fixed source’
sett.photon_transport = True # This line is required to switch on photons tracking
Create a DT point source
source = openmc.Source()
source.space = openmc.stats.Point((0, 0, 0))
source.angle = openmc.stats.Isotropic()
source.energy = openmc.stats.Discrete([14e6], [1])
sett.source = source
source2 = openmc.Source()
source2.space = openmc.stats.Point((0, 0, 0))
source2.angle = openmc.stats.Isotropic()
source2.energy = openmc.stats.Discrete([20e6], [1])
combine all the required parts to make a model
model = openmc.model.Model(geom, mats, sett, tallies)
remove old files and runs OpenMC
!rm *.h5
results_filename = model.run()
from plotting_utils import create_plotly_figure, add_trace_to_figure
open the results file
results = openmc.StatePoint(results_filename)
#extracts the tally values from the simulation results
cell_tally = results.get_tally(name=‘cell_spectra_tally’)
cell_tally = cell_tally.get_pandas_dataframe()
fig = create_plotly_figure(y_axis_label=‘Neutrons per cm2 per source neutron’)
add_trace_to_figure(
figure=fig,
energy_bins=energy_bins,
values=cell_tally[‘mean’],
std_dev=cell_tally[‘std. dev.’]
)