mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 14:15:42 -04:00
Merge branch 'develop' into photon-alund
This commit is contained in:
commit
460452d4f7
746 changed files with 17707 additions and 10855 deletions
|
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import argparse
|
||||
import os
|
||||
|
|
@ -46,7 +46,8 @@ parser.add_argument('libraries', nargs='*',
|
|||
help='ACE libraries to convert to HDF5')
|
||||
parser.add_argument('-d', '--destination', default='.',
|
||||
help='Directory to create new library in')
|
||||
parser.add_argument('-m', '--metastable', choices=['mcnp', 'nndc'], default='nndc',
|
||||
parser.add_argument('-m', '--metastable', choices=['mcnp', 'nndc'],
|
||||
default='nndc',
|
||||
help='How to interpret ZAIDs for metastable nuclides')
|
||||
parser.add_argument('--xml', help='Old-style cross_sections.xml that '
|
||||
'lists ACE libraries')
|
||||
|
|
@ -56,6 +57,10 @@ parser.add_argument('--xsdata', help='Serpent xsdata file that lists '
|
|||
'ACE libraries')
|
||||
parser.add_argument('--fission_energy_release', help='HDF5 file containing '
|
||||
'fission energy release data')
|
||||
parser.add_argument('--libver', choices=['earliest', 'latest'],
|
||||
default='earliest', help="Output HDF5 versioning. Use "
|
||||
"'earliest' for backwards compatibility or 'latest' for "
|
||||
"performance")
|
||||
args = parser.parse_args()
|
||||
|
||||
if not os.path.isdir(args.destination):
|
||||
|
|
@ -150,7 +155,7 @@ for filename in ace_libraries:
|
|||
# Determine filename
|
||||
outfile = os.path.join(args.destination,
|
||||
neutron.name.replace('.', '_') + '.h5')
|
||||
neutron.export_to_hdf5(outfile, 'w')
|
||||
neutron.export_to_hdf5(outfile, 'w', libver=args.libver)
|
||||
|
||||
# Register with library
|
||||
library.register_file(outfile)
|
||||
|
|
@ -162,10 +167,11 @@ for filename in ace_libraries:
|
|||
try:
|
||||
neutron = \
|
||||
openmc.data.IncidentNeutron.from_hdf5(nuclides[name])
|
||||
print('Converting {} (ACE) to {} (HDF5)'.format(table.name,
|
||||
neutron.name))
|
||||
print('Converting {} (ACE) to {} (HDF5)'
|
||||
.format(table.name, neutron.name))
|
||||
neutron.add_temperature_from_ace(table, args.metastable)
|
||||
neutron.export_to_hdf5(nuclides[name] + '_1', 'w')
|
||||
neutron.export_to_hdf5(nuclides[name] + '_1', 'w',
|
||||
libver=args.libver)
|
||||
os.rename(nuclides[name] + '_1', nuclides[name])
|
||||
except Exception as e:
|
||||
print('Failed to convert {}: {}'.format(table.name, e))
|
||||
|
|
@ -187,7 +193,7 @@ for filename in ace_libraries:
|
|||
# Determine filename
|
||||
outfile = os.path.join(args.destination,
|
||||
thermal.name.replace('.', '_') + '.h5')
|
||||
thermal.export_to_hdf5(outfile, 'w')
|
||||
thermal.export_to_hdf5(outfile, 'w', libver=args.libver)
|
||||
|
||||
# Register with library
|
||||
library.register_file(outfile)
|
||||
|
|
@ -198,11 +204,13 @@ for filename in ace_libraries:
|
|||
else:
|
||||
# Then we only need to append the data
|
||||
try:
|
||||
thermal = openmc.data.ThermalScattering.from_hdf5(nuclides[name])
|
||||
print('Converting {} (ACE) to {} (HDF5)'.format(table.name,
|
||||
thermal.name))
|
||||
thermal = openmc.data.ThermalScattering.from_hdf5(
|
||||
nuclides[name])
|
||||
print('Converting {} (ACE) to {} (HDF5)'
|
||||
.format(table.name,thermal.name))
|
||||
thermal.add_temperature_from_ace(table)
|
||||
thermal.export_to_hdf5(nuclides[name] + '_1', 'w')
|
||||
thermal.export_to_hdf5(nuclides[name] + '_1', 'w',
|
||||
libver=args.libver)
|
||||
os.rename(nuclides[name] + '_1', nuclides[name])
|
||||
except Exception as e:
|
||||
print('Failed to convert {}: {}'.format(table.name, e))
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
|
||||
from __future__ import print_function
|
||||
import argparse
|
||||
from collections import defaultdict
|
||||
import glob
|
||||
|
|
@ -26,6 +25,10 @@ parser = argparse.ArgumentParser(
|
|||
)
|
||||
parser.add_argument('-d', '--destination', default='mcnp_endfb70',
|
||||
help='Directory to create new library in')
|
||||
parser.add_argument('--libver', choices=['earliest', 'latest'],
|
||||
default='earliest', help="Output HDF5 versioning. Use "
|
||||
"'earliest' for backwards compatibility or 'latest' for "
|
||||
"performance")
|
||||
parser.add_argument('mcnpdata', help='Directory containing endf70[a-k] and endf70sab')
|
||||
args = parser.parse_args()
|
||||
assert os.path.isdir(args.mcnpdata)
|
||||
|
|
@ -62,7 +65,7 @@ for path in sorted(endf70):
|
|||
# Export HDF5 file
|
||||
h5_file = os.path.join(args.destination, data.name + '.h5')
|
||||
print('Writing {}...'.format(h5_file))
|
||||
data.export_to_hdf5(h5_file, 'w')
|
||||
data.export_to_hdf5(h5_file, 'w', libver=args.libver)
|
||||
|
||||
# Register with library
|
||||
library.register_file(h5_file)
|
||||
|
|
@ -91,7 +94,7 @@ if os.path.exists(endf70sab):
|
|||
# Export HDF5 file
|
||||
h5_file = os.path.join(args.destination, data.name + '.h5')
|
||||
print('Writing {}...'.format(h5_file))
|
||||
data.export_to_hdf5(h5_file, 'w')
|
||||
data.export_to_hdf5(h5_file, 'w', libver=args.libver)
|
||||
|
||||
# Register with library
|
||||
library.register_file(h5_file)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
|
||||
from __future__ import print_function
|
||||
import argparse
|
||||
from collections import defaultdict
|
||||
import glob
|
||||
|
|
@ -28,6 +27,10 @@ parser.add_argument('-d', '--destination', default='mcnp_endfb71',
|
|||
help='Directory to create new library in')
|
||||
parser.add_argument('-f', '--fission_energy_release',
|
||||
help='HDF5 file containing fission energy release data')
|
||||
parser.add_argument('--libver', choices=['earliest', 'latest'],
|
||||
default='earliest', help="Output HDF5 versioning. Use "
|
||||
"'earliest' for backwards compatibility or 'latest' for "
|
||||
"performance")
|
||||
parser.add_argument('mcnpdata', help='Directory containing endf71x and ENDF71SaB')
|
||||
args = parser.parse_args()
|
||||
assert os.path.isdir(args.mcnpdata)
|
||||
|
|
@ -80,7 +83,7 @@ for basename, xs_list in sorted(suffixes.items()):
|
|||
# Export HDF5 file
|
||||
h5_file = os.path.join(args.destination, data.name + '.h5')
|
||||
print('Writing {}...'.format(h5_file))
|
||||
data.export_to_hdf5(h5_file, 'w')
|
||||
data.export_to_hdf5(h5_file, 'w', libver=args.libver)
|
||||
|
||||
# Register with library
|
||||
library.register_file(h5_file)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
|
||||
from __future__ import print_function
|
||||
import os
|
||||
from collections import defaultdict
|
||||
import sys
|
||||
|
|
@ -9,9 +8,7 @@ import zipfile
|
|||
import glob
|
||||
import argparse
|
||||
from string import digits
|
||||
|
||||
from six.moves import input
|
||||
from six.moves.urllib.request import urlopen
|
||||
from urllib.request import urlopen
|
||||
|
||||
import openmc.data
|
||||
|
||||
|
|
@ -43,6 +40,10 @@ parser.add_argument('-b', '--batch', action='store_true',
|
|||
help='supresses standard in')
|
||||
parser.add_argument('-d', '--destination', default='jeff-3.2-hdf5',
|
||||
help='Directory to create new library in')
|
||||
parser.add_argument('--libver', choices=['earliest', 'latest'],
|
||||
default='earliest', help="Output HDF5 versioning. Use "
|
||||
"'earliest' for backwards compatibility or 'latest' for "
|
||||
"performance")
|
||||
args = parser.parse_args()
|
||||
|
||||
response = input(download_warning) if not args.batch else 'y'
|
||||
|
|
@ -179,7 +180,7 @@ for name, filenames in sorted(tables.items()):
|
|||
# Export HDF5 file
|
||||
h5_file = os.path.join(args.destination, data.name + '.h5')
|
||||
print('Writing {}...'.format(h5_file))
|
||||
data.export_to_hdf5(h5_file, 'w')
|
||||
data.export_to_hdf5(h5_file, 'w', libver=args.libver)
|
||||
|
||||
# Register with library
|
||||
library.register_file(h5_file)
|
||||
|
|
@ -222,7 +223,7 @@ for name, filenames in sorted(tables.items()):
|
|||
# Export HDF5 file
|
||||
h5_file = os.path.join(args.destination, data.name + '.h5')
|
||||
print('Writing {}...'.format(h5_file))
|
||||
data.export_to_hdf5(h5_file, 'w')
|
||||
data.export_to_hdf5(h5_file, 'w', libver=args.libver)
|
||||
|
||||
# Register with library
|
||||
library.register_file(h5_file)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
|
||||
from __future__ import print_function
|
||||
import os
|
||||
import shutil
|
||||
import subprocess
|
||||
|
|
@ -9,9 +8,7 @@ import tarfile
|
|||
import glob
|
||||
import hashlib
|
||||
import argparse
|
||||
|
||||
from six.moves import input
|
||||
from six.moves.urllib.request import urlopen
|
||||
from urllib.request import urlopen
|
||||
|
||||
|
||||
description = """
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ from NNDC and convert it to an HDF5 library for use with OpenMC. This data is
|
|||
used for OpenMC's regression test suite.
|
||||
"""
|
||||
|
||||
from __future__ import print_function
|
||||
import os
|
||||
import shutil
|
||||
import subprocess
|
||||
|
|
@ -15,9 +14,7 @@ import tarfile
|
|||
import glob
|
||||
import hashlib
|
||||
import argparse
|
||||
|
||||
from six.moves import input
|
||||
from six.moves.urllib.request import urlopen
|
||||
from urllib.request import urlopen
|
||||
|
||||
import openmc.data
|
||||
|
||||
|
|
@ -34,6 +31,10 @@ parser.add_argument('-b', '--batch', action='store_true',
|
|||
help='supresses standard in')
|
||||
parser.add_argument('-n', '--neutron-only', action='store_true',
|
||||
help='Whether to exclude photon interaction/atomic data')
|
||||
parser.add_argument('--libver', choices=['earliest', 'latest'],
|
||||
default='earliest', help="Output HDF5 versioning. Use "
|
||||
"'earliest' for backwards compatibility or 'latest' for "
|
||||
"performance")
|
||||
args = parser.parse_args()
|
||||
|
||||
base_url = 'http://www.nndc.bnl.gov/endf/b7.1/aceFiles/'
|
||||
|
|
@ -154,10 +155,13 @@ ace_files = sorted(glob.glob(os.path.join('nndc', '**', '*.ace*')))
|
|||
data_dir = os.path.dirname(sys.modules['openmc.data'].__file__)
|
||||
fer_file = os.path.join(data_dir, 'fission_Q_data_endfb71.h5')
|
||||
|
||||
# Call the ace-to-hdf5 conversion script
|
||||
pwd = os.path.dirname(os.path.realpath(__file__))
|
||||
ace2hdf5 = os.path.join(pwd, 'openmc-ace-to-hdf5')
|
||||
subprocess.call([ace2hdf5, '-d', 'nndc_hdf5', '--fission_energy_release',
|
||||
fer_file] + ace_files)
|
||||
subprocess.call([ace2hdf5,
|
||||
'-d', 'nndc_hdf5',
|
||||
'--fission_energy_release', fer_file,
|
||||
'--libver', args.libver] + ace_files)
|
||||
|
||||
# Generate photo interaction library files
|
||||
if not args.neutron_only:
|
||||
|
|
|
|||
33
scripts/openmc-make-depletion-chain
Executable file
33
scripts/openmc-make-depletion-chain
Executable file
|
|
@ -0,0 +1,33 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
import glob
|
||||
import os
|
||||
from zipfile import ZipFile
|
||||
|
||||
from openmc._utils import download
|
||||
import openmc.deplete
|
||||
|
||||
|
||||
URLS = [
|
||||
'http://www.nndc.bnl.gov/endf/b7.1/zips/ENDF-B-VII.1-neutrons.zip',
|
||||
'http://www.nndc.bnl.gov/endf/b7.1/zips/ENDF-B-VII.1-decay.zip',
|
||||
'http://www.nndc.bnl.gov/endf/b7.1/zips/ENDF-B-VII.1-nfy.zip'
|
||||
]
|
||||
|
||||
def main():
|
||||
for url in URLS:
|
||||
basename = download(url)
|
||||
with ZipFile(basename, 'r') as zf:
|
||||
print('Extracting {}...'.format(basename))
|
||||
zf.extractall()
|
||||
|
||||
decay_files = glob.glob(os.path.join('decay', '*.endf'))
|
||||
nfy_files = glob.glob(os.path.join('nfy', '*.endf'))
|
||||
neutron_files = glob.glob(os.path.join('neutrons', '*.endf'))
|
||||
|
||||
chain = openmc.deplete.Chain.from_endf(decay_files, nfy_files, neutron_files)
|
||||
chain.export_to_xml('chain_endfb71.xml')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
@ -1,16 +1,16 @@
|
|||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
|
||||
"""Python script to plot tally data generated by OpenMC."""
|
||||
|
||||
import os
|
||||
import sys
|
||||
import argparse
|
||||
import tkinter as tk
|
||||
import tkinter.filedialog as filedialog
|
||||
import tkinter.font as font
|
||||
import tkinter.messagebox as messagebox
|
||||
import tkinter.ttk as ttk
|
||||
|
||||
import six.moves.tkinter as tk
|
||||
import six.moves.tkinter_filedialog as filedialog
|
||||
import six.moves.tkinter_font as font
|
||||
import six.moves.tkinter_messagebox as messagebox
|
||||
import six.moves.tkinter_ttk as ttk
|
||||
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg
|
||||
from matplotlib.backends.backend_tkagg import NavigationToolbar2TkAgg
|
||||
from matplotlib.figure import Figure
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
|
||||
"""Convert HDF5 particle track to VTK poly data.
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,8 @@
|
|||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
"""Update OpenMC's input XML files to the latest format.
|
||||
|
||||
"""
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
import argparse
|
||||
from difflib import get_close_matches
|
||||
from itertools import chain
|
||||
|
|
|
|||
|
|
@ -1,10 +1,9 @@
|
|||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
"""Update OpenMC's deprecated multi-group cross section XML files to the latest
|
||||
HDF5-based format.
|
||||
|
||||
"""
|
||||
|
||||
from __future__ import print_function
|
||||
import os
|
||||
import warnings
|
||||
import xml.etree.ElementTree as ET
|
||||
|
|
|
|||
|
|
@ -1,6 +1,4 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
from __future__ import print_function
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
|
||||
from __future__ import division, print_function
|
||||
import struct
|
||||
import sys
|
||||
from argparse import ArgumentParser
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue