From c1a2dd2db11ce98c1a468bef52473b5a07312ce8 Mon Sep 17 00:00:00 2001 From: yardasol Date: Mon, 5 Dec 2022 15:24:13 -0600 Subject: [PATCH] add machinery to obtain fission-q and depletion chain data files from their sources --- examples/msbr/openmc_msbr_model.py | 121 +++++++++-------------------- 1 file changed, 38 insertions(+), 83 deletions(-) diff --git a/examples/msbr/openmc_msbr_model.py b/examples/msbr/openmc_msbr_model.py index e806a7c2b..dfd052bcc 100644 --- a/examples/msbr/openmc_msbr_model.py +++ b/examples/msbr/openmc_msbr_model.py @@ -1,7 +1,10 @@ -import openmc -import numpy as np import argparse +import json +import subprocess +from pathlib import Path +import numpy as np +import openmc from openmc.deplete import CoupledOperator, PredictorIntegrator, CELIIntegrator import core_elements as ce @@ -558,87 +561,39 @@ def plot_geometry(name, plots.export_to_xml() if deplete: - # Serpent fission q values - fiss_q = { - "Am243": 212952778.98135212, - "Cm246": 220179493.9541502, - "U239": 196182721.4907133, - "Np239": 198519429.0542043, - "Th233": 185840570.73897627, - "Cf251": 223166396.6983342, - "Am242": 215146730.16368726, - "Cm245": 214624022.18345505, - "Cf254": 230600814.3619568, - "Am241": 211216798.63643932, - "Th232": 197108389.42449385, - "Cm240": 219583368.40646642, - "Th231": 186918512.14598972, - "Bk246": 224446497.874413, - "Cm247": 218956599.9139631, - "U238": 206851381.70909396, - "Bk250": 225432928.78068554, - "U230": 198841127.68309468, - "Cf249": 221434495.10716867, - "U234": 200632850.9958874, - "Cm250": 219425761.1783332, - "Th229": 192235847.44789958, - "Cm241": 219075406.6897822, - "Pu237": 210593272.23024797, - "Am240": 215272544.02927735, - "Cm249": 218622037.52325428, - "Ac226": 183632605.3770991, - "Cf250": 229685291.02082983, - "Th228": 189488754.50737157, - "Cf248": 229015120.40511796, - "Ac227": 183458264.80025893, - "Pu241": 211237715.32232296, - "Pu240": 208612566.66049656, - "Cf252": 230239896.94703457, - "U231": 197643438.24939737, - "Cm242": 212786491.32857716, - "Bk245": 225023484.65451327, - "Np235": 199435370.72904894, - "Pu243": 207499380.63776916, - "Pu239": 208018532.78140113, - "Am242_m1": 215145370.5791048, - "Pu236": 208679081.72160652, - "Bk249": 224740691.06136644, - "Np236": 198952718.20228392, - "Np234": 200175925.99275926, - "U237": 196429642.96756968, - "Cf253": 231148831.53210822, - "U236": 203404311.87546986, - "Es254": 232527659.46555784, - "Ac225": 183891658.531768, - "Cm243": 213375296.0362017, - "Bk248": 224456537.88363716, - "Cm244": 217926766.88448203, - "Pu242": 212072186.50565082, - "U241": 198266755.4887299, - "Np237": 205370480.34853214, - "Th234": 186385345.82281572, - "Pa231": 194099942.4938497, - "Pa230": 194744699.33621296, - "Pa233": 194162901.71835947, - "U240": 207137940.30569986, - "U233": 199796183.56054175, - "Pu246": 208860847.72193536, - "Pa232": 193654730.8348164, - "U232": 193044277.35730234, - "Am244_m1": 213894761.9301219, - "Pu244": 208427244.82356748, - "Np238": 208699370.90691367, - "Bk247": 224883761.19281054, - "Am244": 213894761.9301219, - "Pa229": 194955644.11334947, - "Cm248": 221723145.3723629, - "Fm255": 238051756.2074275, - "Cf246": 229074942.12674516, - "Th230": 188666101.25156796, - "Pu238": 209540012.5125772, - "U235": 202270000.0, - "Th227": 190640950.14927194 - } + # Get Serpent fission q values + def get_web_file(url, fname=None): + if fname is None: + fname = url.split('/')[-1] + if not(Path(fname).exists()): + args = ('wget', + '-q', + '-O', + f'{fname}', + f'{url}') + try: + subprocess.check_output( + args, + cwd=str(Path(__file__).parents[0]), + stderr=subprocess.STDOUT) + except subprocess.CalledProcessError as error: + print(error.output.decode("utf-8")) + raise RuntimeError(f'Failed to get file {fname} from URL {url}.' + '\n see error message above') + + # Serpent fission-Q values + url = ('https://raw.githubusercontent.com/' + 'openmc-dev/data/master/depletion/serpent_fissq.json') + get_web_file(url) + + # ENDF/B VII.1 Chain + url = ('https://anl.box.com/shared/static/' + 'os1u896bwsbopurpgas72bi6aij2zzdc.xml') + get_web_file(url, fname='chain_endfb71_pwr.xml') + + with open('serpent_fissq.json') as f: + fiss_q = json.load(f) + model = openmc.Model.from_xml() op = CoupledOperator(model, chain_file='chain_endfb71_pwr.xml',