mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 06:05:58 -04:00
Improvements in scripts, remove append argument of DataLibrary.export_to_xml
This commit is contained in:
parent
92d951e080
commit
cb0ebe62fb
5 changed files with 29 additions and 22 deletions
|
|
@ -32,11 +32,10 @@ parser = argparse.ArgumentParser(
|
|||
)
|
||||
parser.add_argument('-b', '--batch', action='store_true',
|
||||
help='supresses standard in')
|
||||
parser.add_argument('-n', '--neutron-only', action='store_false',
|
||||
parser.add_argument('-n', '--neutron-only', action='store_true',
|
||||
help='Whether to exclude photon interaction/atomic data')
|
||||
args = parser.parse_args()
|
||||
|
||||
|
||||
base_url = 'http://www.nndc.bnl.gov/endf/b7.1/aceFiles/'
|
||||
files = ['ENDF-B-VII.1-neutron-293.6K.tar.gz',
|
||||
'ENDF-B-VII.1-tsl.tar.gz']
|
||||
|
|
@ -163,5 +162,6 @@ subprocess.call([ace2hdf5, '-d', 'nndc_hdf5', '--fission_energy_release',
|
|||
# Generate photo interaction library files
|
||||
if not args.neutron_only:
|
||||
pwd = os.path.dirname(os.path.realpath(__file__))
|
||||
photo_endf = os.path.join(pwd, 'openmc-get-photo-endf71')
|
||||
subprocess.call([photo_endf, '-c', 'nndc_hdf5/cross_sections.xml'])
|
||||
photo_endf = os.path.join(pwd, 'openmc-get-photon-data')
|
||||
subprocess.call([photo_endf, '-c', 'cross_sections.xml'],
|
||||
cwd='nndc_hdf5')
|
||||
|
|
|
|||
|
|
@ -40,7 +40,6 @@ files = ['ENDF-B-VII.1-photoat.zip', 'ENDF-B-VII.1-atomic_relax.zip']
|
|||
if not os.path.exists('photon_hdf5'):
|
||||
os.mkdir('photon_hdf5')
|
||||
|
||||
library = openmc.data.DataLibrary()
|
||||
|
||||
for f in files:
|
||||
# Establish connection to URL
|
||||
|
|
@ -50,7 +49,15 @@ for f in files:
|
|||
zipfile.ZipFile(BytesIO(r.content)).extractall()
|
||||
|
||||
# ==============================================================================
|
||||
# GENERATE HDF5 LIBRARY
|
||||
# GENERATE HDF5 DATA LIBRARY
|
||||
|
||||
# If previous cross_sections.xml was specified, load it in
|
||||
if args.cross_sections is not None:
|
||||
lib_path = args.cross_sections
|
||||
library = openmc.data.DataLibrary.from_xml(lib_path)
|
||||
else:
|
||||
lib_path = os.path.join('photon_hdf5', 'cross_sections.xml')
|
||||
library = openmc.data.DataLibrary()
|
||||
|
||||
for z in range(1, 101):
|
||||
element = openmc.data.ATOMIC_SYMBOL[z]
|
||||
|
|
@ -66,9 +73,4 @@ for z in range(1, 101):
|
|||
f.export_to_hdf5(hdf5_file, 'w')
|
||||
library.register_file(hdf5_file)
|
||||
|
||||
if args.cross_sections_file is not None:
|
||||
path = args.cross_sections_file
|
||||
library.export_to_xml(path, True)
|
||||
else:
|
||||
path = os.path.join('photon_hdf5', 'cross_sections.xml')
|
||||
library.export_to_xml(path)
|
||||
library.export_to_xml(lib_path)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue