Skip to content

Heating tally and nuclides does not match tally without nuclides #3317

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jon-proximafusion opened this issue Feb 23, 2025 · 3 comments · Fixed by #3416
Closed

Heating tally and nuclides does not match tally without nuclides #3317

jon-proximafusion opened this issue Feb 23, 2025 · 3 comments · Fixed by #3416
Labels

Comments

@jon-proximafusion
Copy link
Contributor

When running a simulation with a heating score split by nuclides or not split by nuclides I am seeing different results in the total heat in the tally

I would expect the heat deposited in the tally is equal to the sum of the heat on all nuclides, this is what I see when I split up a score like '(n,Xt)' across nuclides. They sum to the same value as when there is no splitting by nuclides.

I notice this bug only when photon transport is enabled settings.photon_transport = True

Bug Description

minimal example, run this script, I have two tallies one with nuclides being split and the other without. The tally results are printed as a pandas dataframe and you can see that they don't have the same total heat

import openmc

material = openmc.Material()
material.add_nuclide('Cu63', 1.0)
material.add_nuclide('Cu65', 1.0)
material.set_density('g/cm3', 8.96)
materials = openmc.Materials([material])

sphere = openmc.Sphere(r=10, boundary_type='vacuum')
region = -sphere
cell = openmc.Cell(region=region, fill=material)
geometry = openmc.Geometry([cell])

settings = openmc.Settings()
settings.particles = 1000
settings.batches = 10
settings.inactive = 0
settings.photon_transport = True  # if this is set to False, then the heating tallies match
settings.run_mode = 'fixed source'

my_source = openmc.IndependentSource()
my_source.space = openmc.stats.Point((0, 0, 0))
my_source.angle = openmc.stats.Isotropic()

settings.source = my_source

heat_tally = openmc.Tally(name='heating-with-nuclides')
heat_tally.filters = [openmc.CellFilter(cell)]
heat_tally.scores = ['heating'] 
heat_tally.nuclides = ['Cu63', 'Cu65']

heat_tally2 = openmc.Tally(name='heating-without-nuclides')
heat_tally2.filters = [openmc.CellFilter(cell)]
heat_tally2.scores = ['heating']

my_tallies = openmc.Tallies([heat_tally, heat_tally2])

model = openmc.Model(geometry, materials, settings, my_tallies)
sp_filename = model.run()#apply_tally_results = True)

sp_tally = openmc.StatePoint(sp_filename).get_tally(name='heating-with-nuclides')

df = sp_tally.get_pandas_dataframe()
print(df)

print()
sp_tally = openmc.StatePoint(sp_filename).get_tally(name='heating-without-nuclides')

df = sp_tally.get_pandas_dataframe()
print(df)

Environment

openmc develop, also tried with last stable release
ubuntu 24.04

@shimwell
Copy link
Member

Ah I just realised this is perhaps because photon cross sections are by element not per nuclide. This makes it a bit harder to divide up the heating deposited by a photon to nuclides. Assuming we can find the element that gets the heat deposited then perhaps we could just divide up the heat according to the relative nuclide number density within the element.

@GuySten
Copy link
Contributor

GuySten commented May 25, 2025

The bug turned out to be because charged particles deposit energy without distinction about in which nuclide the energy is deposited. I opened pull request #3416 to fix this issue. @shimwell, maybe you can review it?

@shimwell
Copy link
Member

shimwell commented May 27, 2025

Yes happy to review that PR. Should be done by early next week

Thanks for fixing this. Much appreciated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants