No boundary conditions were applied to any surfaces

Hello,

I am currently writing a program in order to calculate and visualize the flux through a bronze cylinder.

However when I run the program it tells me there are no boundary conditions applied to any surfaces. If I assign transmission to all surfaces the error still occurs. If I assign reflective the program runs, but I don’t want my surfaces to reflect the neutrons I want them to be transmissive and to tally the amount that goes through the cylinder.

The exact error is:
RuntimeError: No boundary conditions were applied to any surfaces!

%matplotlib inline
from IPython.display import Image
import numpy as np
import matplotlib.pyplot as plt
import openmc
import os

#MATERIALS
castBronze = openmc.Material(1, “castBronze”)
castBronze.add_element(“Cu”, 0.89)
castBronze.add_element(“Sn”, 0.11)
castBronze.temperature = 293 #K
castBronze.set_density(“g/cm3”, 8.77)

nitrogen = openmc.Material(2, “nitrogen”)
nitrogen.set_density(“g/cm3”, 0.0012506)
nitrogen.add_element(‘N’, 2.0)
nitrogen.temperature = 293 #K

mats = openmc.Materials([castBronze, nitrogen])
mats.export_to_xml()

#GEOMETRY
cylinderSurface = openmc.XCylinder(r=1.2, boundary_type=‘transmission’)
upperSurface = openmc.XPlane(x0=2, boundary_type=‘transmission’)
lowerSurface = openmc.XPlane(x0=1, boundary_type=‘transmission’)

cylinderInside = -cylinderSurface & -upperSurface & +lowerSurface

#Create cells, mapping materials to cells
cylinder = openmc.Cell(name=‘cylinder’)
cylinder.fill = castBronze
cylinder.region = cylinderInside

box = openmc.rectangular_prism(width=10, height=10, boundary_type=‘transmission’)
air_region = box & +cylinderSurface & +upperSurface & -lowerSurface
air = openmc.Cell(name=‘air’)
air.fill = nitrogen

#Create a geometry and export to XML
root_universe = openmc.Universe(cells=[cylinder, air])
geom = openmc.Geometry(root_universe)
geom.export_to_xml()

root_universe.plot(width=(5,5))
root_universe.plot(width=(5,5), basis=‘yz’)

#SETTINGS
settings = openmc.Settings()
settings.particles = 10000
settings.batches = 10
settings.inactive = 0

source = openmc.Source()
source.space = openmc.stats.Point()
source.angle = openmc.stats.Monodirectional()
settings.source = source
settings.run_mode = ‘fixed source’
settings.export_to_xml()

#TALLIES
cell_filter = openmc.CellFilter([cylinder])
tally = openmc.Tally(name=“Neutron Flux”)
tally.filters = [cell_filter]

tally.scores = [“flux”]

tallies = openmc.Tallies([tally])
tallies.export_to_xml()

model=openmc.model.Model(geom, mats, settings, tallies)
openmc.run()

#POST PROCESSING
sp = openmc.StatePoint(‘statepoint.10.h5’)
tally = sp.get_tally(scores=[‘flux’])
flux = tally.get_slice(scores=[‘flux’])
#flux.std_dev.shape = (100, 100)
#flux.mean.shape = (100, 100)
fig = plt.subplot(121)
fig.imshow(flux.mean)

hi @cjd1113 ;

In your case, I think you should put your surface type at “vacuum”, since you are considering only the bronze cylinder and you are interested by neutrons passing through this cylinder.

But if you want to keep them as transmissive surfaces, you need to define another volume (e.g. another big cylinder) containing this cylinder (filled with air or only void) with vacuum surfaces.

1 Like