Tracking transmission and back scattered neutrons

Hi Everyone,

In my simulation I have a rock wall stacked with a water wall. I am interested in calculating the number of neutrons that was transmitted and the number of neutrons that was scattered and get their energies as well. I have collected the flux but unsure how to get the transmitted neutron, backscattered neutrons with their energies. I am still learning how to use Openmc. I will be happy for your help. this is my code now.

“”
import openmc
import numpy as np
import openmc.data
from pathlib import Path
import matplotlib.pyplot as plt

import os

os.environ[“OPENMC_CROSS_SECTIONS”] = “/home/harriet/OPENMC/mcnp_endfb70/cross_sections.xml”

###############################################################################

Simulation Input File Parameters

###############################################################################

OpenMC simulation parameters

batches = 30
inactive = 10
particles = 100

statepoints_folder = Path(‘statepoints_folder’)

###############################################################################

Exporting to OpenMC materials.xml file

###############################################################################

Create materials

rock = openmc.Material(material_id=1, name=‘Rock’)
rock.add_element(‘Si’, 0.0085514332)
rock.add_nuclide(‘O16’, 0.622)
rock.add_element(‘Al’, 0.101)
rock.add_nuclide(‘Fe56’,1.0)

rock.set_density(‘g/cm3’, 2.65)

water = openmc.Material(material_id=2,name=‘Water’)
water.add_element(‘H’, 2)
water.add_nuclide(‘O16’, 1)
water.set_density(‘g/cm3’, 1.0)
water.add_s_alpha_beta(‘c_H_in_H2O’)

Instantiate a Materials collection and export to XML

materials_file = openmc.Materials([water, rock])
materials_file.export_to_xml()

###############################################################################

Exporting to OpenMC geometry.xml file

###############################################################################

Create surfaces

wall_thickness = 0.5
water_thickness = 0.5
wall_length= 2.0
water_length= 1.5

Create surfaces for rock wall

left_surface_rock = openmc.XPlane(surface_id=1,x0=-wall_length/2, boundary_type=‘vacuum’)
right_surface_rock = openmc.XPlane(surface_id=2,x0=wall_length/2, boundary_type=‘vacuum’)
bottom_surface_rock = openmc.YPlane(surface_id=3,y0=-wall_length/2, boundary_type=‘vacuum’)
top_surface_rock = openmc.YPlane(surface_id=4,y0=wall_length/2, boundary_type=‘vacuum’)
front_surface_rock = openmc.ZPlane(surface_id=5,z0=-wall_thickness/2, boundary_type=‘vacuum’)
back_surface_rock = openmc.ZPlane(surface_id=6,z0=wall_thickness/2, boundary_type=‘vacuum’)

Create surfaces for water wall

left_surface_water = openmc.XPlane(surface_id=7,x0=-water_length/2, boundary_type=‘vacuum’)
right_surface_water = openmc.XPlane(surface_id=8,x0=water_length/2, boundary_type=‘vacuum’)
bottom_surface_water = openmc.YPlane(surface_id=9,y0=-water_length/2, boundary_type=‘vacuun’)
top_surface_water = openmc.YPlane(surface_id=10,y0=water_length/2, boundary_type=‘vacuun’)
front_surface_water = openmc.ZPlane(surface_id=11,z0=-water_thickness/2, boundary_type=‘vacuum’)
back_surface_water = openmc.ZPlane(surface_id=12,z0=water_thickness/2, boundary_type=‘vacuum’)

Instantiate Cells_for rock wall and water wall.

cell1 = openmc.Cell(cell_id=1, name=‘Cell 1’)
cell2 = openmc.Cell(cell_id=2, name=‘Cell 2’)
cell1.region = +left_surface_rock & -right_surface_rock & +bottom_surface_rock & -top_surface_rock & +front_surface_rock & -back_surface_rock
cell2.region = +left_surface_water & -right_surface_water & +bottom_surface_water & -top_surface_water & +front_surface_water & -back_surface_water

Register Materials with Cells

cell1.fill = rock
cell2.fill = water

Create universe

root = openmc.Universe(universe_id=0, name=‘root universe’)
root.add_cell(cell1)
root.add_cell(cell2)

Instantiate a Geometry, register the root Universe, and export to XML

geometry = openmc.Geometry(root)
geometry.export_to_xml()

###############################################################################

Exporting to OpenMC settings.xml file

###############################################################################

Create settings

settings = openmc.Settings()
settings.run_mode = ‘fixed source’
settings.particles = particles
settings.batches = batches
settings.inactive = inactive

Define energy distribution

energy = openmc.stats.Discrete([14e6], [1.0]) # Single energy of 14 MeV

source = openmc.IndependentSource(space=openmc.stats.Point(), energy=energy)
source.particle=“neutron”
settings.source = source

Export to “settings.xml”

settings.export_to_xml()

###############################################################################

Exporting to OpenMC tallies.xml file

###############################################################################

Instantiate an empty Tallies object

tallies = openmc.Tallies()

Create mesh which will be used for tally

mesh = openmc.RegularMesh(mesh_id=1)
mesh.dimension = [10, 10,5 ]
mesh.lower_left= [-10,-10,-5]
mesh.upper_right=[10,10,5]

Create mesh filter for tally

mesh_filter = openmc.MeshFilter(mesh)

Create mesh tally to score flux and fission rate

tally = openmc.Tally(tally_id=1,name=‘flux’)
tally.filters = [mesh_filter]
tally.scores = [‘flux’, ‘fission’]
tallies.append(tally)

Export to “tallies.xml”

tallies.export_to_xml()

deletes old statepoint and summary files

!rm s*.h5

Create a simulation model

model = openmc.Model(geometry, materials_file,settings, tallies)

Run the simulation

output = model.run()

###############################################################################

Exporting to OpenMC plots.xml file

###############################################################################

plot = openmc.Plot(plot_id=1)
plot.origin = [0, 0, 0]
plot.width = [4, 4]
plot.pixels = [400, 400]
plot.color_by = ‘material’

Instantiate a Plots collection and export to XML

plot_file = openmc.Plots([plot])
plot.geometry=geometry
openmc.plot_inline(plot)
plot_file.export_to_xml()

Load the statepoint file

sp = openmc.StatePoint(‘/home/harriet/OPENMC/openmc/examples/my_work/statepoint.30.h5’)
tally = sp.get_tally(scores=[‘flux’])
tally1 =tally.sum
print(tally1)

“”