Evaluation of the absorption properties of the material

Hello, everyone,

I’m a beginner to OpenMC, and now I’ve built a model of my own.But an error occurred while I was running it.

I want to evaluate the absorbing properties of a new material with boron for different (discrete) neutron energies. When compiling the source with, open the openmc.Source() and openmp.statistics.Discrete () error: “There are no division points tilted by MPI of rank 0”.

When using fixed source, another error is “Could not find the cell containing particle 5001”.

How to correctly set the source for such a task? I think that using a openmc.Source() is wrong. In my opinion, it is correct to use custom source . But how can I fix a compilation error?

Sincerely hope to get your help.
Thanks!
Nikita

Hi @markin.ns and welcome to the forum. If you want to create a monoenergetic neutron source, you are on the right track. You should be using the Source and Discrete classes:

# For example, neutrons at 1 MeV
E = 1.0e6
energy_dist = openmc.stats.Discrete([E], [1.0])
space_dist = openmc.stats.Point()  # <-- point source at the origin, change as needed
source = openmc.Source(space=space_dist, energy=energy_dist)

settings = openmc.Settings()
settings.source = source
...

Regarding the errors you are seeing: the first error looks to be related to MPI, which is used for distributed-memory parallelism, and seems unrelated to the source definition. The second error regarding not being able to find a cell means that the code is sampling source particles, but based on their location it can’t find a corresponding cell. Take a close look at your geometry definition to see if there are any issues with it. Note that if you have a void region that you expect particles to be sourced in or travel through, you still need to have a cell assigned to it.

Hello @paulromano! Thank you for your answer! I created the source as you advised and corrected the geometry - I created an empty cell in which I placed the source. But the same error appears again.

The code of the current problem is shown below:

box1 = openmc.model.RectangularParallelepiped(-0.1, 0.1, -1.0, 1.0, -1.0, 1.0, boundary_type=‘vacuum’)
inside_box = -box1
box_Mg = openmc.Cell(fill = MA8, region = inside_box)

a = 0.1005
b = 1.0005
box2 = openmc.model.RectangularParallelepiped(-a, a, -b, b, -b, b, boundary_type=‘vacuum’)
box_PEO = openmc.Cell(fill = PEO, region = -box2 & +box1)

c = 3
box3 = openmc.model.RectangularParallelepiped(-c, c, -c, c, -c, c, boundary_type=‘reflective’)
World_box= openmc.Cell(fill = None, region = -box3 & +box2)

geometry = openmc.Geometry([box_PEO, box_Mg, World_box])
geometry.export_to_xml()

settings = openmc.Settings()
E = 1.0
energy_dist = openmc.stats.Discrete([E], [1.0])
space_dist = openmc.stats.Point((-1.5, 0.0, 0.0))
source = openmc.Source(space=space_dist, energy=energy_dist)
settings = openmc.Settings()

settings.source = source
settings.batches = 100
settings.inactive = 10
settings.particles = 1e+4

settings.export_to_xml()

cell_filter = openmc.CellFilter([box_Mg, box_PEO])
tally = openmc.Tally()
tally.filters = [cell_filter]
tally.scores = [‘absorption’]
tallies = openmc.Tallies([tally])
tallies.export_to_xml()

Error text:

I am very grateful for your help! Thanks!
Nikita

@markin.ns Did you set run_mode = 'fixed source' while running openmc?

settings = openmc.Settings()
settings.run_mode = 'fixed source'