Merge pull request #1476 from paulromano/remove-chain-scripts

Remove depletion chain generation scripts
This commit is contained in:
Andrew Johnson 2020-02-10 07:10:46 -05:00 committed by GitHub
commit 110d034457
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 0 additions and 573 deletions

View file

@ -1,280 +0,0 @@
# This dictionary contains the 255-nuclides, simplified burnup chain used in
# CASL-ORIGEN, which can be found in Appendix A of Kang Seog Kim, "Specification
# for the VERA Depletion Benchmark Suite", CASL-U-2015-1014-000, Rev. 0,
# ORNL/TM-2016/53, 2016.
#
# Note 32 of the 255 nuclides appear twice as they are both activation
# nuclides (category 1) and fission product nuclides (category 3).
# Te129 has been added due to its link to I129 production.
CASL_CHAIN = {
# Nuclide: (Stable, CAT, IFPY, Special yield treatment)
# Stable: True if nuclide has no decay reactions
# CAT: Category of nuclides
# 1-Activation nuclides
# 2-Heavy metal nuclides
# 3-Fission product nuclides
# IFPY: Indicator of fission product yield
# 0-Non FPY
# 1-Direct FPY (-1 indicates (stable+metastable) direct FPY)
# 2-Cumulative FPY
# 3-Special treatment with weight fractions
# Special yield: (nuclide_i/weight_i/IFPY_i)
'B10': (True, 1, 0, None),
'B11': (True, 1, 0, None),
'O16': (True, 1, 0, None),
'Ag107': (True, 1, 0, None),
'Ag109': (True, 1, 0, None), # redundant as FP
'Ag110': (False, 1, 0, None), # redundant as FP
'Cd110': (True, 1, 0, None), # redundant as FP
'Cd111': (True, 1, 0, None), # redundant as FP
'Cd112': (True, 1, 0, None),
'Cd113': (True, 1, 0, None), # redundant as FP
'Cd114': (True, 1, 0, None),
'Cd115': (False, 1, 0, None),
'In113': (True, 1, 0, None),
'In115': (True, 1, 0, None), # redundant as FP
'Sm152': (True, 1, 0, None), # redundant as FP
'Sm153': (False, 1, 0, None), # redundant as FP
'Eu151': (True, 1, 0, None), # redundant as FP
'Eu152': (False, 1, 0, None),
'Eu152_m1': (False, 1, 0, None),
'Eu153': (True, 1, 0, None), # redundant as FP
'Eu154': (False, 1, 0, None), # redundant as FP
'Eu155': (False, 1, 0, None), # redundant as FP
'Eu156': (False, 1, 0, None), # redundant as FP
'Eu157': (False, 1, 0, None), # redundant as FP
'Gd152': (True, 1, 0, None),
'Gd154': (True, 1, 0, None), # redundant as FP
'Gd155': (True, 1, 0, None), # redundant as FP
'Gd156': (True, 1, 0, None), # redundant as FP
'Gd157': (True, 1, 0, None), # redundant as FP
'Gd158': (True, 1, 0, None), # redundant as FP
'Gd159': (False, 1, 0, None), # redundant as FP
'Gd160': (True, 1, 0, None), # redundant as FP
'Gd161': (False, 1, 0, None), # redundant as FP
'Tb159': (True, 1, 0, None), # redundant as FP
'Tb160': (False, 1, 0, None), # redundant as FP
'Tb161': (False, 1, 0, None), # redundant as FP
'Dy160': (True, 1, 0, None), # redundant as FP
'Dy161': (True, 1, 0, None), # redundant as FP
'Dy162': (True, 1, 0, None), # redundant as FP
'Dy163': (True, 1, 0, None), # redundant as FP
'Dy164': (True, 1, 0, None), # redundant as FP
'Dy165': (False, 1, 0, None), # redundant as FP
'Ho165': (True, 1, 0, None), # redundant as FP
'Er162': (True, 1, 0, None),
'Er164': (True, 1, 0, None),
'Er166': (True, 1, 0, None),
'Er167': (True, 1, 0, None),
'Er168': (True, 1, 0, None),
'Er169': (False, 1, 0, None),
'Er170': (True, 1, 0, None),
'Er171': (False, 1, 0, None),
'Tm169': (True, 1, 0, None),
'Tm170': (False, 1, 0, None),
'Tm171': (False, 1, 0, None),
'Hf174': (True, 1, 0, None),
'Hf176': (True, 1, 0, None),
'Hf177': (True, 1, 0, None),
'Hf178': (True, 1, 0, None),
'Hf179': (True, 1, 0, None),
'Hf180': (True, 1, 0, None),
'Hf181': (False, 1, 0, None),
'Ta181': (True, 1, 0, None),
'Ta182': (False, 1, 0, None),
'Th230': (False, 2, 0, None),
'Th231': (False, 2, 0, None),
'Th232': (False, 2, 0, None),
'Th233': (False, 2, 0, None),
'Th234': (False, 2, 0, None),
'Pa231': (False, 2, 0, None),
'Pa232': (False, 2, 0, None),
'Pa233': (False, 2, 0, None),
'Pa234': (False, 2, 0, None),
'U232': (False, 2, 0, None),
'U233': (False, 2, 0, None),
'U234': (False, 2, 0, None),
'U235': (False, 2, 0, None),
'U236': (False, 2, 0, None),
'U237': (False, 2, 0, None),
'U238': (False, 2, 0, None),
'U239': (False, 2, 0, None),
'Np236': (False, 2, 0, None),
'Np237': (False, 2, 0, None),
'Np238': (False, 2, 0, None),
'Np239': (False, 2, 0, None),
'Np240': (False, 2, 0, None),
'Np240_m1': (False, 2, 0, None),
'Pu236': (False, 2, 0, None),
'Pu237': (False, 2, 0, None),
'Pu238': (False, 2, 0, None),
'Pu239': (False, 2, 0, None),
'Pu240': (False, 2, 0, None),
'Pu241': (False, 2, 0, None),
'Pu242': (False, 2, 0, None),
'Pu243': (False, 2, 0, None),
'Am241': (False, 2, 0, None),
'Am242': (False, 2, 0, None),
'Am242_m1': (False, 2, 0, None),
'Am243': (False, 2, 0, None),
'Am244': (False, 2, 0, None),
'Am244_m1': (False, 2, 0, None),
'Cm242': (False, 2, 0, None),
'Cm243': (False, 2, 0, None),
'Cm244': (False, 2, 0, None),
'Cm245': (False, 2, 0, None),
'Cm246': (False, 2, 0, None),
'Br81': (True, 3, 2, None),
'Br82': (False, 3, 2, None),
'Kr82': (True, 3, 3, [('Br82_m1', 0.024, 1), ('Kr82', 1.000, 1)]),
'Kr83': (True, 3, 2, None),
'Kr84': (True, 3, 2, None),
'Kr85': (False, 3, 2, None),
'Kr86': (True, 3, 2, None),
'Sr89': (False, 3, 2, None),
'Sr90': (False, 3, 2, None),
'Y89': (True, 3, 1, None),
'Y90': (False, 3, 1, None),
'Y91': (False, 3, 2, None),
'Zr91': (True, 3, 1, None),
'Zr93': (False, 3, 2, None),
'Zr95': (False, 3, 2, None),
'Zr96': (True, 3, 2, None),
'Nb95': (False, 3, 3, [('Nb95',1.000, 1), ('Nb95_m1', 0.944, 1)]),
'Mo95': (True, 3, 3, [('Nb95_m1',0.056, 1), ('Mo95', 1.000, 1)]),
'Mo96': (True, 3, 3, [('Nb96',1.000, 1), ('Mo96', 1.000, 1)]),
'Mo97': (True, 3, 2, None),
'Mo98': (True, 3, 2, None),
'Mo99': (False, 3, 2, None),
'Mo100': (True, 3, 2, None),
'Tc99': (False, 3, 1, None),
'Tc99_m1': (False, 3, 1, None),
'Tc100': (False, 3, 1, None),
'Ru100': (True, 3, 1, None),
'Ru101': (True, 3, 2, None),
'Ru102': (True, 3, 2, None),
'Ru103': (False, 3, 2, None),
'Ru104': (True, 3, 2, None),
'Ru105': (False, 3, 2, None),
'Ru106': (False, 3, 2, None),
'Rh102': (False, 3, 1, None),
'Rh102_m1': (False, 3, 1, None),
'Rh103': (True, 3, 1, None),
'Rh103_m1': (False, 3, 1, None),
'Rh104': (False, 3, 1, None),
'Rh105': (False, 3, 1, None),
'Rh105_m1': (False, 3, 1, None),
'Rh106': (False, 3, 1, None),
'Rh106_m1': (False, 3, 1, None),
'Pd104': (True, 3, 1, None),
'Pd105': (True, 3, 1, None),
'Pd106': (True, 3, 1, None),
'Pd107': (False, 3, 2, None),
'Pd108': (True, 3, 2, None),
'Pd109': (False, 3, 2, None),
'Ag109': (True, 3, 1, None),
'Ag109_m1': (False, 3, 1, None),
'Ag110': (False, 3, 2, None),
'Ag110_m1': (False, 3, 2, None),
'Ag111': (False, 3, 2, None),
'Cd110': (True, 3, 1, None),
'Cd111': (True, 3, 3, [('Ag110', -1.000, 2), ('Cd110', 1.000, 2), ('Cd111', 1.000, 1)]),
'Cd113': (True, 3, 2, None),
'In115': (True, 3, 2, None),
'Sb121': (True, 3, 2, None),
'Sb123': (False, 3, 2, None),
'Sb125': (False, 3, 2, None),
'Sb127': (False, 3, 2, None),
'Te127': (False, 3, -1, None),
'Te127_m1': (False, 3, -1, None),
'Te129': (False, 3, 1, None),
'Te129_m1': (False, 3, 2, None),
'Te132': (False, 3, 2, None),
'I127': (True, 3, 1, None),
'I128': (False, 3, 3, [('I128', 0.931, 2)]),
'I129': (False, 3, 3, [('I129', 1.000, 2), ('I129', -1.000, 2)]),
'I130': (False, 3, 2, None),
'I131': (False, 3, 2, None),
'I132': (False, 3, 1, None),
'I135': (False, 3, 2, None),
'Xe128': (True, 3, 1, None),
'Xe130': (True, 3, 1, None),
'Xe131': (True, 3, 1, None),
'Xe132': (True, 3, 1, None),
'Xe133': (False, 3, 2, None),
'Xe134': (True, 3, 2, None),
'Xe135': (False, 3, 1, None),
'Xe135_m1': (False, 3, 1, None),
'Xe136': (True, 3, 2, None),
'Xe137': (False, 3, 2, None),
'Cs133': (True, 3, 1, None),
'Cs134': (False, 3, 1, None),
'Cs135': (False, 3, 1, None),
'Cs136': (False, 3, 1, None),
'Cs137': (False, 3, 1, None),
'Ba134': (True, 3, 1, None),
'Ba137': (True, 3, 1, None),
'Ba140': (False, 3, 2, None),
'La139': (True, 3, 2, None),
'La140': (False, 3, 1, None),
'Ce140': (True, 3, 1, None),
'Ce141': (False, 3, 2, None),
'Ce142': (True, 3, 2, None),
'Ce143': (False, 3, 2, None),
'Ce144': (False, 3, 2, None),
'Pr141': (True, 3, 1, None),
'Pr142': (False, 3, 1, None),
'Pr143': (False, 3, 1, None),
'Pr144': (False, 3, 1, None),
'Nd142': (True, 3, 1, None),
'Nd143': (True, 3, 1, None),
'Nd144': (False, 3, 1, None),
'Nd145': (True, 3, 2, None),
'Nd146': (True, 3, 2, None),
'Nd147': (False, 3, 2, None),
'Nd148': (True, 3, 2, None),
'Nd149': (False, 3, 2, None),
'Nd150': (True, 3, 2, None),
'Nd151': (False, 3, 2, None),
'Pm147': (False, 3, 1, None),
'Pm148': (False, 3, -1, None),
'Pm148_m1': (False, 3, -1, None),
'Pm149': (False, 3, 1, None),
'Pm150': (False, 3, 1, None),
'Pm151': (False, 3, 1, None),
'Sm147': (False, 3, 1, None),
'Sm148': (False, 3, 1, None),
'Sm149': (False, 3, 1, None),
'Sm150': (True, 3, 1, None),
'Sm151': (False, 3, 1, None),
'Sm152': (True, 3, 2, None),
'Sm153': (False, 3, 2, None),
'Sm154': (True, 3, 2, None),
'Sm155': (False, 3, 2, None),
'Eu151': (True, 3, 1, None),
'Eu153': (True, 3, 1, None),
'Eu154': (False, 3, 1, None),
'Eu155': (False, 3, 1, None),
'Eu156': (False, 3, 2, None),
'Eu157': (False, 3, 2, None),
'Gd154': (True, 3, 1, None),
'Gd155': (True, 3, 1, None),
'Gd156': (True, 3, 1, None),
'Gd157': (True, 3, 1, None),
'Gd158': (True, 3, 2, None),
'Gd159': (False, 3, 2, None),
'Gd160': (True, 3, 2, None),
'Gd161': (False, 3, 2, None),
'Tb159': (True, 3, 1, None),
'Tb160': (False, 3, 1, None),
'Tb161': (False, 3, 1, None),
'Dy160': (True, 3, 1, None),
'Dy161': (True, 3, 1, None),
'Dy162': (True, 3, 2, None),
'Dy163': (True, 3, 2, None),
'Dy164': (True, 3, 2, None),
'Dy165': (False, 3, 2, None),
'Ho165': (True, 3, 3, [('Dy165_m1', 0.022, 2), ('Ho165', 1.000, 1)])
}

View file

@ -1,46 +0,0 @@
#!/usr/bin/env python3
import os
from pathlib import Path
from zipfile import ZipFile
from openmc._utils import download
import openmc.deplete
URLS = [
'https://www.nndc.bnl.gov/endf/b7.1/zips/ENDF-B-VII.1-neutrons.zip',
'https://www.nndc.bnl.gov/endf/b7.1/zips/ENDF-B-VII.1-decay.zip',
'https://www.nndc.bnl.gov/endf/b7.1/zips/ENDF-B-VII.1-nfy.zip'
]
def main():
endf_dir = os.environ.get("OPENMC_ENDF_DATA")
if endf_dir is not None:
endf_dir = Path(endf_dir)
elif all(os.path.isdir(lib) for lib in ("neutrons", "decay", "nfy")):
endf_dir = Path(".")
else:
for url in URLS:
basename = download(url)
with ZipFile(basename, 'r') as zf:
print('Extracting {}...'.format(basename))
zf.extractall()
endf_dir = Path(".")
decay_files = tuple((endf_dir / "decay").glob("*endf"))
neutron_files = tuple((endf_dir / "neutrons").glob("*endf"))
nfy_files = tuple((endf_dir / "nfy").glob("*endf"))
# check files exist
for flist, ftype in [(decay_files, "decay"), (neutron_files, "neutron"),
(nfy_files, "neutron fission product yield")]:
if not flist:
raise IOError("No {} endf files found in {}".format(ftype, endf_dir))
chain = openmc.deplete.Chain.from_endf(decay_files, nfy_files, neutron_files)
chain.export_to_xml('chain_endfb71.xml')
if __name__ == '__main__':
main()

View file

@ -1,247 +0,0 @@
#!/usr/bin/env python3
import glob
import os
from zipfile import ZipFile
from collections import OrderedDict, defaultdict
from io import StringIO
from itertools import chain
try:
import lxml.etree as ET
_have_lxml = True
except ImportError:
import xml.etree.ElementTree as ET
_have_lxml = False
import openmc.data
import openmc.deplete
from openmc._xml import clean_indentation
from openmc.deplete.chain import _REACTIONS
from openmc.deplete.nuclide import Nuclide, DecayTuple, ReactionTuple, \
FissionYieldDistribution
from openmc._utils import download
from casl_chain import CASL_CHAIN
URLS = [
'https://www.nndc.bnl.gov/endf/b7.1/zips/ENDF-B-VII.1-neutrons.zip',
'https://www.nndc.bnl.gov/endf/b7.1/zips/ENDF-B-VII.1-decay.zip',
'https://www.nndc.bnl.gov/endf/b7.1/zips/ENDF-B-VII.1-nfy.zip'
]
def main():
if os.path.isdir('./decay') and os.path.isdir('./nfy') and os.path.isdir('./neutrons'):
endf_dir = '.'
elif 'OPENMC_ENDF_DATA' in os.environ:
endf_dir = os.environ['OPENMC_ENDF_DATA']
else:
for url in URLS:
basename = download(url)
with ZipFile(basename, 'r') as zf:
print('Extracting {}...'.format(basename))
zf.extractall()
endf_dir = '.'
decay_files = glob.glob(os.path.join(endf_dir, 'decay', '*.endf'))
fpy_files = glob.glob(os.path.join(endf_dir, 'nfy', '*.endf'))
neutron_files = glob.glob(os.path.join(endf_dir, 'neutrons', '*.endf'))
# Create a Chain
chain = openmc.deplete.Chain()
print('Reading ENDF nuclear data from "{}"...'.format(os.path.abspath(endf_dir)))
# Create dictionary mapping target to filename
print('Processing neutron sub-library files...')
reactions = {}
for f in neutron_files:
evaluation = openmc.data.endf.Evaluation(f)
nuc_name = evaluation.gnd_name
if nuc_name in CASL_CHAIN:
reactions[nuc_name] = {}
for mf, mt, nc, mod in evaluation.reaction_list:
# Q value for each reaction is given in MF=3
if mf == 3:
file_obj = StringIO(evaluation.section[3, mt])
openmc.data.endf.get_head_record(file_obj)
q_value = openmc.data.endf.get_cont_record(file_obj)[1]
reactions[nuc_name][mt] = q_value
# Determine what decay and FPY nuclides are available
print('Processing decay sub-library files...')
decay_data = {}
for f in decay_files:
decay_obj = openmc.data.Decay(f)
nuc_name = decay_obj.nuclide['name']
if nuc_name in CASL_CHAIN:
decay_data[nuc_name] = decay_obj
for nuc_name in CASL_CHAIN:
if nuc_name not in decay_data:
print('WARNING: {} has no decay data!'.format(nuc_name))
print('Processing fission product yield sub-library files...')
fpy_data = {}
for f in fpy_files:
fpy_obj = openmc.data.FissionProductYields(f)
name = fpy_obj.nuclide['name']
if name in CASL_CHAIN:
fpy_data[name] = fpy_obj
print('Creating depletion_chain...')
missing_daughter = []
missing_rx_product = []
missing_fpy = []
for idx, parent in enumerate(sorted(decay_data, key=openmc.data.zam)):
data = decay_data[parent]
nuclide = Nuclide()
nuclide.name = parent
chain.nuclides.append(nuclide)
chain.nuclide_dict[parent] = idx
if not CASL_CHAIN[parent][0] and \
not data.nuclide['stable'] and data.half_life.nominal_value != 0.0:
nuclide.half_life = data.half_life.nominal_value
nuclide.decay_energy = sum(E.nominal_value for E in
data.average_energies.values())
sum_br = 0.0
for i, mode in enumerate(data.modes):
decay_type = ','.join(mode.modes)
if mode.daughter in decay_data:
target = mode.daughter
else:
missing_daughter.append((parent, mode))
continue
# Write branching ratio, taking care to ensure sum is unity by
# slightly modifying last value if necessary
br = mode.branching_ratio.nominal_value
sum_br += br
if i == len(data.modes) - 1 and sum_br != 1.0:
br = 1.0 - sum(m.branching_ratio.nominal_value
for m in data.modes[:-1])
# Append decay mode
nuclide.decay_modes.append(DecayTuple(decay_type, target, br))
# If nuclide has incident neutron data, we need to list what
# transmutation reactions are possible
if parent in reactions:
reactions_available = reactions[parent].keys()
for name, mts, changes in _REACTIONS:
if mts & reactions_available:
delta_A, delta_Z = changes
A = data.nuclide['mass_number'] + delta_A
Z = data.nuclide['atomic_number'] + delta_Z
daughter = '{}{}'.format(openmc.data.ATOMIC_SYMBOL[Z], A)
if name not in chain.reactions:
chain.reactions.append(name)
if daughter not in decay_data:
missing_rx_product.append((parent, name, daughter))
daughter = 'Nothing'
# Store Q value -- use sorted order so we get summation
# reactions (e.g., MT=103) first
for mt in sorted(mts):
if mt in reactions[parent]:
q_value = reactions[parent][mt]
break
else:
q_value = 0.0
nuclide.reactions.append(ReactionTuple(
name, daughter, q_value, 1.0))
# Check for fission reactions
if any(mt in reactions_available for mt in [18, 19, 20, 21, 38]):
if parent in fpy_data:
q_value = reactions[parent][18]
nuclide.reactions.append(
ReactionTuple('fission', 0, q_value, 1.0))
if 'fission' not in chain.reactions:
chain.reactions.append('fission')
else:
missing_fpy.append(parent)
if parent in fpy_data:
fpy = fpy_data[parent]
if fpy.energies is not None:
yield_energies = fpy.energies
else:
yield_energies = [0.0]
yield_data = {}
for E, table_yd, table_yc in zip(yield_energies, fpy.independent, fpy.cumulative):
yields = defaultdict(float)
for product in table_yd:
if product in decay_data:
# identifier
ifpy = CASL_CHAIN[product][2]
# 1 for independent
if ifpy == 1:
if product not in table_yd:
print('No independent fission yields found for {} in {}'.format(product, parent))
else:
yields[product] += table_yd[product].nominal_value
# 2 for cumulative
elif ifpy == 2:
if product not in table_yc:
print('No cumulative fission yields found for {} in {}'.format(product, parent))
else:
yields[product] += table_yc[product].nominal_value
# -1 for independent (stable + metastable)
elif ifpy == -1:
if product not in table_yd:
print('No independent fission yields found for {} in {}'.format(product, parent))
else:
yields[product] += table_yc[product].nominal_value
product_meta = '{}_m1'.format(product)
if product_meta in table_yd:
yields[product] += table_yc[product_meta].nominal_value
# 3 for special treatment with weight fractions
elif ifpy == 3:
for name_i, weight_i, ifpy_i in CASL_CHAIN[product][3]:
if name_i not in table_yd:
print('No fission yields found for {} in {}'.format(name_i, parent))
else:
if ifpy_i == 1:
yields[product] += weight_i * table_yd[name_i].nominal_value
elif ifpy_i == 2:
yields[product] += weight_i * table_yc[name_i].nominal_value
yield_data[E] = yields
nuclide.yield_data = FissionYieldDistribution(yield_data)
# Display warnings
if missing_daughter:
print('The following decay modes have daughters with no decay data:')
for parent, mode in missing_daughter:
print(' {} -> {} ({})'.format(parent, mode.daughter, ','.join(mode.modes)))
print('')
if missing_rx_product:
print('The following reaction products have no decay data:')
for vals in missing_rx_product:
print('{} {} -> {}'.format(*vals))
print('')
if missing_fpy:
print('The following fissionable nuclides have no fission product yields:')
for parent in missing_fpy:
print(' ' + parent)
print('')
chain.export_to_xml('chain_casl.xml')
if __name__ == '__main__':
main()