Run Time Error while running a benchmark problem

I am trying to run a benchmark problem available here on source convergence (Three Thick slab 1D problem) and this run time error is coming again and again.
Although I tried to model it into 3D problem instead of 1D.

Calculations should be performed using the following parameters:

2000 neutrons per generation

50 generations skipped before tallying

550 active generations

Initial source distribution: flat

settings = openmc.Settings()

settings.source = source
settings.particles = 2000 #2000 neutron particles per generation
settings.nskip = 50 #how many generations to be skipped before we are going to run
settings.generations_per_batch = 10 #assuming no. of generations per batch
settings.batches=60 #we run total of 60 batches given total no of active generations being 550, i.e. total generations = 550+50 skipped generations?
#and total batches = total generation/generation_per_batch
settings.run_mode = ‘eigenvalue’

settings.export_to_xml() #export to xml

openmc.run()

Sorry I’ve not got an answer to the issue but just wanted to mention that I don’t think nskip is an attribute of openmc.settings

Should this be settings.inactive

Can you provide more details about your python model generation script? There could be geometry, material, or nuclear data issues that we can’t identify from the settings alone. You could try running in debug mode openmc -g to see if anything is wrong with your geometry

This is the geometry xml

I tried running in debug mode: it is showing the following:

nskip is an attribute of the settings. although i tried to change it to inactive, error is still the same.

For initial source distribution to be taken as flat, I have used the following input:

space = openmc.stats.Spatial
source = openmc.IndependentSource(space = None)
source.particle = ‘neutron’

Can this create an issue with the code?

try to plot your source using (from openmc_source_plotter import plot_source_position) or try a point source at actual source location.

nskip is not an openmc attribute at all. Are you using some kind of LLM like ChatGPT to make your XML or model generation script?

That source definition is not quite right either. There’s lots of examples of making source distributions in the openmc-dev/openmc-notebooks repo.

If you are using an LLM, I highly recommend just reading the documentation or looking on the repo for existing examples of correct syntax.

I agree nskip is not the attribute.from the document itself i tried. not using any chatgpt. using help command to understand the related attributes and their uses. I provided a source point and this time, it worked.

Can anyone help me to write in settings xml for a flat source distribution?

For the record, I don’t think there’s anything necessarily wrong with chat gpt but there are a wealth of resources in the discourse forum, example notebooks, documentation, and github worth checking first.

You’ll want to use openmc.stats.Box to define a uniform spatial distribution. There are multiple examples of this in the notebooks repo. FYI the only_fissionable parameter is deprecated, so make sure not to include it if you’re using a version 0.15.0 or beyond

1 Like

Thanks a lot for the information. I have been trying it on my own for a while.

Hey Ritu,

Welcome to the community, here are a couple of tips. For inactive batches (not generations) you are right that it defines the ones that will not be counted towards the final result, so if you want 50 counted batches you need to assign batches to 50+inactive batches. You are correct for the overall generations being a sum of gen/batch and # of batches, same as the # of total counted particles being #particles/gensgens/batch# of batches. I have found that generally you want gens/batches to be equal to # of batches for most sims, though there might be situations where it differs.
First thing you should do once you get your code running openmc.run is to run it in geometry debug mode like others suggested. First increase you particle amount to a higher amount (1 or 2 magnitudes higher usually) to make sure that every cell gets particles within it, and check that geometry debug doesn’t come up with any issues. Your inactive batches shouldn’t be arbitrary and you should run a simulation searching for Shannon entropy once you get your geometry and everything situated. Here are resources for that,

there is a section on Shannon entropy in this documentation, and here is an example of it,

It is easier than you might expect when first reading into it, you’re just plotting a graph and selecting where you think it becomes flat (converged) and that is your inactive batches. It will be given in generations so you will have to convert it back to batches.

For source definition you can just use a point source and use more inactive batches as the source will always adjust and converge to the actual source distribution as the transport runs continue,

# Create a point source
point = openmc.stats.Point((0, 0, 0))
source = openmc.IndependentSource(space=point)
settings = openmc.Settings()
settings.source = source
settings.batches = 100
settings.inactive = 10
settings.particles = 1000
settings.export_to_xml()

but if you want to do it correctly the following code will give you a simplistic source defined evenly over your geometry,

bounds = [-10, -10, -10, 10, 10, 10]
uniform_dist = openmc.stats.Box(bounds[:3], bounds[3:])
source = openmc.IndependentSource(space=uniform_dist)
settings.source = source
settings.batches = 100
settings.inactive = 10
settings.particles = 1000
settings.export_to_xml()

The bounds here are the lower and upper coordinates of a rectangular prism surrounding your geometry preferably only the section that includes fuel but that is not really necessary. Lastly for your error with OpenMC aborting unexpectedly, I can’t tell based on the code you have provided as of now, but I would expect it to be something fundamental like you’re not properly exporting an XML (Geometry, Settings, and Materials are required), or because your settings don’t actually work. I think this because it doesn’t give you a specific error and just aborts suddenly, which usually if its an error within either the material definition or geometry definition you get a specific error.

1 Like

Thank you for this elaborate explanation. I tried this stats.box to define my source distribution as flat. following seems to be working for my case.

bounds = [0.0, 0.0, 0.0, slab2.x0, 0.0, 0.0]
uniform_dist = openmc.stats.Box([0.0, 0, 0], [slab2.x0, 0, 0], only_fissionable=True)
source = openmc.IndependentSource(space=uniform_dist)