I have a box with layers of different materials. Then 5 cm from said box i have a source of 14 MeV neutrons in the shape of a cone. Between the 2 i have a vacuum. For this reason the box has vacuum boundaries on its outside surfaces.
I created a source but doesnt matter where i place it (even inside the box) i get the error More than 95% of external source sites sampled were rejected. Please check your external source’s spatial definition.
What’s wrong?
Thanks a lot i just started with openmc. Below is my code
import openmc
import numpy as np
Cu = openmc.Material()
Cu.set_density(‘g/cm3’, 8.96)
Cu.add_element(‘Cu’, 1)
Pb = openmc.Material()
Pb.set_density(‘g/cm3’, 11.35)
Pb.add_element(‘Pb’, 1)
Cd = openmc.Material()
Cd.set_density(‘g/cm3’ 8.65)
Cd.add_element(‘Cd’, 1)
SS = openmc.Material()
SS.set_density(‘g/cm3’, 7.87)
SS.add_element(‘Cr’, 18, ‘wo’)
SS.add_element(‘Ni’, 10, ‘wo’)
SS.add_element(‘Fe’, 66.97, wo’)
SS.add_element(‘C’, 0.03, ‘wo’)
SS.add_element(‘Mo’, 2, ‘wo’)
SS.add_element(‘Mn’, 2, ‘wo’)
PP = openmc.Material()
PP.set_density(‘g/cm3’, 1.19)
PP.add_element(‘H’, 8, ‘wo’)
PP.add_element(‘O’, 32, ‘wo’)
PP.add_element(‘C’, 60, ‘wo’)
Air = openmc.Material()
Air.set_density(‘g/cm3’, 0.0012)
Air.add_element(‘O’, 80, ‘wo’)
Air.add_element(‘N’, 20, ‘wo’)
materials = openmc.Materials([Cu, Pb, Cd, SS, PP, Air])
materials.export_to_xml()
import openmc.geometry
air_front = openmc.YPlane(y0=100)
front = openmc.YPlane(y0=80, boundary_type=‘vacuum’)
Cu_back = openmc.YPlane(y0=72)
Pb_back = openmc.YPlane(y0=70)
PP_back = openmc.YPlane(y0=69)
SS1_back = openmc.YPlane(y0=51)
Cd1_back = openmc.YPlane(y0=50)
SS2_back = openmc.YPlane(y0=20)
PP_back2 = openmc.YPlane(y0=18.3)
Cd_back = openmc.YPlane(y0=18.29)
back = openmc.YPlane(y0=0, boundary_type=‘vacuum’)
side1 = openmc.XPlane(x0=-30, boundary_type=‘vacuum’)
side2 = openmc.XPlane(x0=30, boundary_type=‘vacuum’)
top = openmc.ZPlane(z0=30, boundary_type=‘vacuum’)
bottom = openmc.ZPlane(z0=-30, boundary_type=‘vacuum’)
cavity_front = openmc.YPlane(y0=50)
cavity_back = openmc.YPlane(y0=20)
cavity_side1 = openmc.XPlane(x0=-10)
cavity_side2 = openmc.XPlane(x0=10)
cavity_bottom = openmc.ZPlane(z0=10)
Layer_Cu = openmc.Cell(fill=Cu, region= -front & +Cu_back & +side1 & -side2 & -top & +bottom)
Layer_Pb = openmc.Cell(fill=Pb, region= -Cu_back & +Pb_back & +side1 & -side2 & -top & +bottom)
Layer_PP = openmc.Cell(fill=PP, region= -Pb_back & +PP_back & +side1 & -side2 & -top & +bottom)
Layer_SS = openmc.Cell(fill=SS, region= -PP_back & +SS1_back & +side1 & -side2 & -top & +bottom)
Layer_Cd1 = openmc.Cell(fill=Cd, region= -SS1_back & +Cd1_back & +cavity_side1 & -cavity_side2 & -top & +cavity_bottom)
cavity = openmc.Cell(fill=Air, region= -Cd1_back & +SS2_back & +cavity_side1 & -cavity_side2 & -top & +cavity_bottom)
Layer_SS1 = openmc.Cell(fill=SS, region= -PP_back & +SS2_back & +side1 & -side2 & -cavity_bottom & +bottom)
Layer_SS_lat_1 = openmc.Cell(fill=SS, region= -SS1_back & + SS2_back & -top & +bottom & +side1 & -cavity_side1)
Layer_SS_lat_2 = openmc.Cell(fill=SS, region= -SS1_back & + SS2_back & -top & +bottom & -side2 & +cavity_side2)
Layer_PP2 = openmc.Cell(fill=PP, region= -SS2_back & +PP_back2 & +side1 & -side2 & -top & +bottom)
Layer_Cd2 = openmc.Cell(fill=Cd, region= -PP_back2 & +Cd_back & +side1 & -side2 & -top & +bottom)
Layer_SS2 = openmc.Cell(fill=Pb, region= -Cd_back & +back & +side1 & -side2 & -top & +bottom)
block = openmc.Universe(cells=[Layer_Cu, Layer_Pb, Layer_PP, Layer_SS, cavity, Layer_SS1, Layer_Cd1, Layer_SS_lat_1 , Layer_SS_lat_2, Layer_PP2, Layer_Cd2, Layer_SS2])
block.plot()
geom = openmc.Geometry()
geom.root_universe = block
geom.export_to_xml()
source = openmc.IndependentSource()
source.space = openmc.stats.Point((70, 0, 0))
source.angle = openmc.stats.Isotropic()
source.energy = openmc.stats.Discrete([14.0e6], [1.0])
settings = openmc.Settings()
settings.run_mode = ‘fixed source’
settings.batches = 1
settings.inactive = 0
settings.particles = 1
settings.source = source
settings.export_to_xml()