-
Notifications
You must be signed in to change notification settings - Fork 51
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
add more advanced nuclear data processing examples #272
Comments
this can help find pathways to a specific isotope. It shows the isotopes and reactions that result in the target import os
from pathlib import Path
import openmc
import openmc.deplete
import openmc_depletion_plotter
from openmc.data import DADZ
chain_file = Path(os.environ['OPENMC_CHAIN_FILE'])
chain = openmc.deplete.Chain.from_xml(chain_file)
pathways_to_target = {}
for nuclide in chain.nuclides:
atomics_number, mass_number, metastable_state = openmc.data.zam(nuclide.name)
if len(nuclide.reactions)>2:
print(nuclide.reactions)
reactions=nuclide.reactions
for reaction in reactions:
if reaction.type in DADZ.keys():
delta_mass_number, delta_atomics_number = DADZ[reaction.type]
target_mass_number = mass_number + delta_mass_number
target_atomics_number = atomics_number + delta_atomics_number
target = openmc.data.gnds_name(
Z=target_atomics_number,
A=target_mass_number
)
print(f'{nuclide.name}{reaction.type}{target}')
pathways_to_target.setdefault(target, []).append((nuclide.name, reaction.type)) |
These code above can be improved to account for targets that are metastable and made more concise import os
from pathlib import Path
import openmc
import openmc.deplete
from openmc.data import DADZ
chain_file = Path(os.environ['OPENMC_CHAIN_FILE'])
chain = openmc.deplete.Chain.from_xml(chain_file)
pathways_to_target = {}
for nuclide in chain.nuclides:
if len(nuclide.reactions)>0:
for reaction in nuclide.reactions:
# if the reaction changes the A or Z number
if reaction.type in DADZ.keys():
pathways_to_target.setdefault(reaction.target, []).append((nuclide.name, reaction.type)) |
This example searches the chain file and gets the energy release for each reaction (Q value) then sorts them from high to low from pathlib import Path
import openmc
import openmc.deplete
import pandas as pd
chain_file = Path('chain_endf_b8.0_sfr.xml')
chain = openmc.deplete.Chain.from_xml(chain_file)
q_vals = []
targets = []
reactions = []
for nuclide in chain.nuclides:
if len(nuclide.reactions)>0:
for reaction in nuclide.reactions:
targets.append(nuclide.name)
reactions.append(reaction.type)
q_vals.append(reaction.Q/1e6)
df=pd.DataFrame.from_dict({'targets':targets, 'reactions':reactions, 'Q [MeV]':q_vals})
df=df.sort_values(by=['Q [MeV]'], ascending=False) the resulting Q values are available here |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
we have cross section processing examples but no chain file examples
something like this could help find reactions only available via threshold reactions
The text was updated successfully, but these errors were encountered: