Problem with cross section

Hello everyone.
I am a new user of OpenMC, and I use this method to have cross sections GitHub - openmc-data-storage/openmc_data_downloader: A Python package for downloading h5 cross section files for use in OpenMC.. I mean
import openmc
import openmc_data_downloader as odd

mat1 = openmc.Material()
mat1.add_element(‘U235’, 0.03)
mat1.add_element(‘U238’, 0.97)
mat1.add_element(‘O16’, 10)

mats = openmc.Materials([mat1])

mats.download_cross_section_data(
libraries=[‘ENDFB-7.1-NNDC’, ‘TENDL-2019’],
set_OPENMC_CROSS_SECTIONS=True,
particles=[“neutron”],
)

and I face an error:

Nuclear data library does not support contain cross sections for U235 at or near 500 K.

Nice python package you found there :grinning:

This error is saying the temperature of the cross section does not match the temperature required.

Have you assigned the cell a temperature?

No I haven’t. Was I suppose to do that? :face_with_monocle:

Interesting, are you able to provide the whole python script. I shall take a better look.

In the meantime you can download data from here if you like. It has temperatures stated for each version.

https://openmc.org/official-data-libraries/

The settings object is the other thing i would look at

settings.temperature = {‘method’: ‘interpolation’}

All the best

Yes. Sure.
Please Consider I am just working with openmc for 1 week :melting_face:

this code is like the pincell example in openmc website.

import openmc
import openmc_data_downloader as odd
uo2 = openmc.Material(name= “uo2”)
uo2.add_nuclide(‘U235’, 0.03)
uo2.add_nuclide(‘U238’, 0.97)
uo2.add_nuclide(‘O16’, 2.0)
uo2.set_density(‘g/cm3’, 10.0)

zirconium = openmc.Material(name=“zirconium”)
zirconium.add_element(‘Zr’, 1.0)
zirconium.set_density(‘g/cm3’, 6.6)

water = openmc.Material(name=“h2o”)
water.add_nuclide(‘H1’, 2.0)
water.add_nuclide(‘O16’, 1.0)
water.set_density(‘g/cm3’, 1.0)

mats = openmc.Materials([uo2, zirconium, water])

mats.download_cross_section_data(
libraries=[“FENDL-3.1d”],
set_OPENMC_CROSS_SECTIONS=True,
particles=[“neutron”],
)

mats.export_to_xml()

fuel_outer_radius = openmc.ZCylinder(r=0.36)
clad_inner_radius = openmc.ZCylinder(r=0.40)
clad_outer_radius = openmc.ZCylinder(r=0.46)

fuel_region = -fuel_outer_radius
gap_region = +fuel_outer_radius & -clad_inner_radius
clad_region = +clad_inner_radius & -clad_outer_radius

fuel = openmc.Cell(name=‘fuel’)
fuel.fill = uo2
fuel.region = fuel_region

gap = openmc.Cell(name=‘air gap’)
gap.region = gap_region

clad = openmc.Cell(name=‘clad’)
clad.fill = zirconium
clad.region = clad_region

pitch = 1.26
left = openmc.XPlane(x0=-pitch/2, boundary_type=‘reflective’)
right = openmc.XPlane(x0=pitch/2, boundary_type=‘reflective’)
bottom = openmc.YPlane(y0=-pitch/2, boundary_type=‘reflective’)
top = openmc.YPlane(y0=pitch/2, boundary_type=‘reflective’)

water_region = +left & -right & +bottom & -top & +clad_outer_radius

moderator = openmc.Cell(name=‘moderator’)
moderator.fill = water
moderator.region = water_region

root_universe = openmc.Universe()
root_universe.add_cells([fuel, clad, gap, moderator])
root_universe.plot()

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

space = openmc.stats.Point((0.0, 0.1, 0.0))

source = openmc.IndependentSource(space = space)

for m in mats:
m.temperature = 500 #K

settings = openmc.Settings()
settings.source = source
settings.batches = 50
settings.inactive = 10
settings.particles = 1000

settings.temperature[‘tolerance’] = 100 #K
settings.temperature = {‘method’: ‘interpolation’}

settings = openmc.Settings()

settings.export_to_xml()

openmc.run()

Right I think I’ve got it. Looks like you need newer cross sections such as ENDF 8.

Here is a modified script that works

import openmc
import openmc_data_downloader as odd

uo2 = openmc.Material(name="uo2")
uo2.add_nuclide("U235", 0.03)
uo2.add_nuclide("U238", 0.97)
uo2.add_nuclide("O16", 2.0)
uo2.set_density("g/cm3", 10.0)

zirconium = openmc.Material(name="zirconium")
zirconium.add_element("Zr", 1.0)
zirconium.set_density("g/cm3", 6.6)

water = openmc.Material(name="h2o")
water.add_nuclide("H1", 2.0)
water.add_nuclide("O16", 1.0)
water.set_density("g/cm3", 1.0)

mats = openmc.Materials([uo2, zirconium, water])

# lib= "FENDL-3.1d" # does not contain cross sections at the right energy
# lib="ENDFB-7.1-NNDC" # does not contain cross sections at the right energy
# lib="TENDL-2019" # does not contain cross sections at the right energy
lib = "ENDFB-8.0-NNDC"  # this one works :-)

mats.download_cross_section_data(
    libraries=[lib],
    set_OPENMC_CROSS_SECTIONS=True,
    particles=["neutron"],
)

fuel_outer_radius = openmc.ZCylinder(r=0.36)
clad_inner_radius = openmc.ZCylinder(r=0.40)
clad_outer_radius = openmc.ZCylinder(r=0.46)

fuel_region = -fuel_outer_radius
gap_region = +fuel_outer_radius & -clad_inner_radius
clad_region = +clad_inner_radius & -clad_outer_radius

fuel = openmc.Cell(name="fuel")
fuel.fill = uo2
fuel.region = fuel_region

gap = openmc.Cell(name="air gap")
gap.region = gap_region

clad = openmc.Cell(name="clad")
clad.fill = zirconium
clad.region = clad_region

pitch = 1.26
left = openmc.XPlane(x0=-pitch / 2, boundary_type="reflective")
right = openmc.XPlane(x0=pitch / 2, boundary_type="reflective")
bottom = openmc.YPlane(y0=-pitch / 2, boundary_type="reflective")
top = openmc.YPlane(y0=pitch / 2, boundary_type="reflective")

water_region = +left & -right & +bottom & -top & +clad_outer_radius

moderator = openmc.Cell(name="moderator")
moderator.fill = water
moderator.region = water_region

root_universe = openmc.Universe()
root_universe.add_cells([fuel, clad, gap, moderator])
root_universe.plot()

geometry = openmc.Geometry(root=root_universe)

space = openmc.stats.Point((0.0, 0.1, 0.0))

source = openmc.IndependentSource(space=space)

for m in mats:
    m.temperature = 500  # K

settings = openmc.Settings()
settings.source = source
settings.batches = 50
settings.inactive = 10
settings.particles = 1000

settings.temperature["tolerance"] = 100  # K
settings.temperature = {"method": "interpolation"}

model = openmc.Model(geometry, mats, settings)

model.run()

I don’t know how can I express my thanks for everything. You’ve been super helpful and it’s really appreciated.
honestly I have another issue with installing openmc plotter. The error I get is there is no version of plotter matched with my openmc. My openmc version is 0.14.1.
Is there any solution or I just have to use its website. (using website is not easy for me as I have to use vpn and it keeps being disconnected.)

Sure if you can just send a screen shot of the install command and the error then we can get started fixing that.

Sure . Thake you in advance

It looks like you have an old version of openmc installed and the openmc-plotter is wanted a newer version.

You might have to install a newer version of openmc first

https://docs.openmc.org/en/stable/quickinstall.html

Thank you for your response. My openmc version is 0.14.1.

That is a new one. Perhaps try the dev version just in case it contains a bug fix.

pip install git+https://github.com/openmc-dev/plotter.git@develop

Editted to correct the url

Thank you so much for your assistance! Your help has been invaluable, and I truly appreciate your time and expertise. Grateful for your support! :hibiscus:

Another package for plotting that might be easier to install GitHub - fusion-energy/openmc_plot: A Python package that plots OpenMC geometry using web based technologies

1 Like

Thanks again. I installed and it works. :slightly_smiling_face:

1 Like