diff --git a/BEAVRS/beavrs/builder.py b/BEAVRS/beavrs/builder.py index 1cb5d71..2564da8 100644 --- a/BEAVRS/beavrs/builder.py +++ b/BEAVRS/beavrs/builder.py @@ -73,11 +73,11 @@ class BEAVRS(object): # These were not chosen with any application in mind: tailor them to your needs! self.depletion_nuclides = [ - 'Ag107', 'Ag109', 'Ag111', 'Am241', 'Am243', 'As75', + 'Ac225', 'Ag107', 'Ag109', 'Ag111', 'Am241', 'Am243', 'As75', 'Au197', 'Ba134', 'Ba135', 'Ba136', 'Ba137', 'Ba138', - 'Ba140', 'Br79', 'Br81', 'Cd108', 'Cd110', 'Cd111', + 'Ba140', 'Bk245', 'Bk246', 'Br79', 'Br81', 'Cd108', 'Cd110', 'Cd111', 'Cd112', 'Cd113', 'Cd114', 'Cd116', 'Ce140', - 'Ce141', 'Ce142', 'Ce143', 'Ce144', 'Cm244', 'Co59', + 'Ce141', 'Ce142', 'Ce143', 'Ce144', 'Cf246', 'Cm240', 'Cm244', 'Co59', 'Cs133', 'Cs134', 'Cs135', 'Cs136', 'Cs137', 'Dy160', 'Dy161', 'Dy162', 'Dy163', 'Dy164', 'Er166', 'Er167', 'Eu151', 'Eu152', 'Eu153', 'Eu154', 'Eu155', 'Eu156', @@ -88,8 +88,8 @@ class BEAVRS(object): 'Kr86', 'La139', 'La140', 'Lu175', 'Lu176', 'Mo100', 'Mo94', 'Mo95', 'Mo96', 'Mo97', 'Mo98', 'Mo99', 'Nb93', 'Nb94', 'Nb95', 'Nd142', 'Nd143', 'Nd144', - 'Nd145', 'Nd146', 'Nd147', 'Nd148', 'Nd150', 'Np237', - 'Pa233', 'Pd104', 'Pd105', 'Pd106', 'Pd107', 'Pd108', + 'Nd145', 'Nd146', 'Nd147', 'Nd148', 'Nd150', 'Np234', 'Np237', + 'Pa230', 'Pa231', 'Pa232', 'Pa233', 'Pb208', 'Pd104', 'Pd105', 'Pd106', 'Pd107', 'Pd108', 'Pd110', 'Pm147', 'Pm148', 'Pm149', 'Pm151', 'Pr141', 'Pr142', 'Pr143', 'Pu238', 'Pu239', 'Pu240', 'Pu241', 'Pu242', 'Rb85', 'Rb86', 'Rb87', 'Re185', 'Re187', @@ -102,7 +102,7 @@ class BEAVRS(object): 'Sn124', 'Sn125', 'Sn126', 'Sr86', 'Sr87', 'Sr88', 'Sr89', 'Sr90', 'Ta181', 'Tb159', 'Tb160', 'Tc99', 'Te122', 'Te123', 'Te124', 'Te125', 'Te126', - 'Te128', 'Te130', 'Te132', 'Th232', 'U233', 'W182', + 'Te128', 'Te130', 'Te132', 'Th232', 'U231', 'U232', 'U233', 'W182', 'W183', 'W184', 'W186', 'Xe128', 'Xe129', 'Xe130', 'Xe131', 'Xe132', 'Xe133', 'Xe134', 'Xe135', 'Xe136', 'Y89', 'Y90', 'Y91', 'Zr90', 'Zr91', 'Zr92', 'Zr93', 'Zr94', @@ -156,6 +156,9 @@ class BEAVRS(object): output = {'tallies': self.settings_output_tallies, 'summary': self.settings_summary} settings_file.output = output + settings_file.keff_trigger = {'type': 'std_dev', + 'threshold': 6e-4} + # settings_file.create_delayed_neutrons = True settings_file.confidence_intervals = self.settings_confidence settings_file.seed = np.random.randint(1e14, dtype=np.uint64) return settings_file @@ -276,7 +279,7 @@ class BEAVRS(object): # Distribute fuel materials for enr in self.pincells.enrichments: - self.openmc_mats['Fuel %s' % enr].set_as_distrib_comp() + self.mats['Fuel %s' % enr].set_as_distrib_comp() # TODO: distribute other regions as necessary (bpra pins, rcca pins, etc) @@ -302,6 +305,7 @@ class BEAVRS(object): for enr in self.pincells.enrichments[:3]: fuel_pin = self.pincells.u_fuel_active_pin[enr] name = "Fuel rod active region - {0} enr radial 0: Fuel {0}".format(enr) + # cells.append(fuel_pin.cells) cells.append(fuel_pin.get_cell_by_name(name)) universes.append(fuel_pin) return zip(cells, universes) @@ -353,5 +357,5 @@ class BEAVRS(object): for name,mat in self.mats.items(): if not name in ['Fuel 1.6%', 'Fuel 2.4%', 'Fuel 3.1%', 'Fuel 3.2%', 'Fuel 3.4%']: continue for nuc in self.depletion_nuclides: - if not nuc._name in mat._nuclides: + if not nuc.name in mat._nuclides: mat.add_nuclide(nuc, 1e-14) diff --git a/BEAVRS/beavrs/serpent_fissq.json b/BEAVRS/beavrs/serpent_fissq.json new file mode 100644 index 0000000..29aa6ed --- /dev/null +++ b/BEAVRS/beavrs/serpent_fissq.json @@ -0,0 +1,80 @@ +{ + "Ac225": 183891658.531768, + "Ac226": 183632605.3770991, + "Ac227": 183458264.80025893, + "Th227": 190640950.14927194, + "Th228": 189488754.50737157, + "Th229": 192235847.44789958, + "Th230": 188666101.25156796, + "Th231": 186918512.14598972, + "Th232": 197108389.42449385, + "Th233": 185840570.73897627, + "Th234": 186385345.82281572, + "Pa229": 194955644.11334947, + "Pa230": 194744699.33621296, + "Pa231": 194099942.4938497, + "Pa232": 193654730.8348164, + "Pa233": 194162901.71835947, + "U230": 198841127.68309468, + "U231": 197643438.24939737, + "U232": 193044277.35730234, + "U233": 199796183.56054175, + "U234": 200632850.9958874, + "U235": 202270000.0, + "U236": 203404311.87546986, + "U237": 196429642.96756968, + "U238": 206851381.70909396, + "U239": 196182721.4907133, + "U240": 207137940.30569986, + "U241": 198266755.4887299, + "Np234": 200175925.99275926, + "Np235": 199435370.72904894, + "Np236": 198952718.20228392, + "Np237": 205370480.34853214, + "Np238": 208699370.90691367, + "Np239": 198519429.0542043, + "Pu236": 208679081.72160652, + "Pu237": 210593272.23024797, + "Pu238": 209540012.5125772, + "Pu239": 208018532.78140113, + "Pu240": 208612566.66049656, + "Pu241": 211237715.32232296, + "Pu242": 212072186.50565082, + "Pu243": 207499380.63776916, + "Pu244": 208427244.82356748, + "Pu246": 208860847.72193536, + "Am240": 215272544.02927735, + "Am241": 211216798.63643932, + "Am242": 215146730.16368726, + "Am242_m1": 215145370.5791048, + "Am243": 212952778.98135212, + "Am244": 213894761.9301219, + "Am244_m1": 213894761.9301219, + "Cm240": 219583368.40646642, + "Cm241": 219075406.6897822, + "Cm242": 212786491.32857716, + "Cm243": 213375296.0362017, + "Cm244": 217926766.88448203, + "Cm245": 214624022.18345505, + "Cm246": 220179493.9541502, + "Cm247": 218956599.9139631, + "Cm248": 221723145.3723629, + "Cm249": 218622037.52325428, + "Cm250": 219425761.1783332, + "Bk245": 225023484.65451327, + "Bk246": 224446497.874413, + "Bk247": 224883761.19281054, + "Bk248": 224456537.88363716, + "Bk249": 224740691.06136644, + "Bk250": 225432928.78068554, + "Cf246": 229074942.12674516, + "Cf248": 229015120.40511796, + "Cf249": 221434495.10716867, + "Cf250": 229685291.02082983, + "Cf251": 223166396.6983342, + "Cf252": 230239896.94703457, + "Cf253": 231148831.53210822, + "Cf254": 230600814.3619568, + "Es254": 232527659.46555784, + "Fm255": 238051756.2074275 +} \ No newline at end of file diff --git a/BEAVRS/make_beavrs.py b/BEAVRS/make_beavrs.py index aa23dbc..ee781da 100755 --- a/BEAVRS/make_beavrs.py +++ b/BEAVRS/make_beavrs.py @@ -1,12 +1,29 @@ #!/usr/bin/env python3 -import json, openmc, os, sys import numpy as np import openmc.deplete from beavrs.builder import BEAVRS -from optparse import OptionParser +import argparse, json, openmc, os, shutil, sys import matplotlib.pyplot as plt +parser = argparse.ArgumentParser(description="Program to make BEAVRS reactor and run" \ + " simulations with resulting geometry") +parser.add_argument('-d', '--2d', action='store_true', dest='is_2d', + default=False, help='Create 2D BEAVRS input files, 3D by default') +parser.add_argument('-s', '--symmetric', action='store_true', dest='is_symmetric', + default=False, help='Create octant-symmetric input files, not symmetric by default') +parser.add_argument('-e', '--deplete', action='store_true', dest='run_deplete', default=False, + help='Run the depletion code for this setup') +parser.add_argument('-i', '--insert', action='store', type=int, dest='rod_loc', default=200, + help='Set where the control rods should be. Acceptable values are 15-573') +parser.add_argument('-o', '--optimal', action='store_true', default=False, + help='Find the best combination of particles, inactive and active batches to run') +parser.add_argument('-r', '--run', action='store_true', default=False, + help='Run the model once after building it') +parser.add_argument('--shutdown', action='store_true', default=False, + help='Set reactor to be in shutdown, all control rods fully inserted.') +args = parser.parse_args() + try: os.mkdir(os.path.dirname(os.path.realpath(__file__)) + '/build') except OSError: pass @@ -30,34 +47,19 @@ def no_overwrite(filename): print(f"Backed up file {filename} to {new_filepath}") os.replace(filename, new_filepath) -usage = """usage: %prog [options]""" -p = OptionParser(usage=usage) -p.add_option('-d', '--2d', action='store_true', dest='is_2d', - default=False, help='Create 2D BEAVRS input files,' \ - + ' 3D by default') -p.add_option('-s', '--symmetric', action='store_true', dest='is_symmetric', - default=False, help='Create octant-symmetric input files,' \ - + ' not symmetric by default') -p.add_option('-e', '--deplete', action='store_true', dest='run_deplete', default=False, - help='Run the depletion code for this setup') -p.add_option('-i', '--insert', action='store', type='int', dest='S', default=200, - help='Set where the control rods should be. Acceptable values are 15-574') -p.add_option('-o', '--optimal', action='store_true', default=False, - help='Find the best combination of particles, inactive and active batches to run') -p.add_option('-r', '--run', action='store_true', default=False, - help='Run the model once after building it') -(options, args) = p.parse_args() +def run_loop(val): + b.set_S(val) + return b.export_model() -if not len(args) == 0: - p.print_help() - -b = BEAVRS(25, 0, is_symmetric=options.is_symmetric, is_2d=options.is_2d) -# b.export_xml() +if args.shutdown: + b = BEAVRS(573, 228, is_symmetric=args.is_symmetric, is_2d=args.is_2d) +else: + b = BEAVRS(args.rod_loc, 0, is_symmetric=args.is_symmetric, is_2d=args.is_2d) # openmc.calculate_volumes() # openmc.plot_geometry() -if options.optimal: +if args.optimal: particles = [5000, 10000, 20000, 50000, 100000] inactive = [10, 20, 50, 100, 150] @@ -77,10 +79,15 @@ if options.optimal: # Depletion Settings ############################################################################### -elif options.run_deplete: +elif args.run_deplete: b.set_params(batches=350,inactive=50,particles=20000) + b.set_full_depletion_mats() + # b.set_fuel_otf_files() + # b.set_distributed_materials() + # b.set_fuel_distrib_tallies() + # b.set_fuel_depletion_tallies() - # Get fission Q values from JSON file generated by get_fission_qvals.py + ## Get fission Q values from JSON file generated by get_fission_qvals.py with open('../beavrs/serpent_fissq.json', 'r') as f: serpent_fission_q = json.load(f) @@ -96,29 +103,29 @@ elif options.run_deplete: time_steps = [8640.00,8640.00,8640.00,8640.00,8640.00,8640.00,4268160.00,45792000.00,1728000.00,46915200.00,8640.00,8640.00,8640.00,8640.00,8640.00]""" ## cumulative steps in days - time_steps_cum = np.array([3/24, 6/24, 9/24, 12/24, 15/24, 18/24, 21/24, 1, 10, 30, 60, 90, 365, 548]) + # time_steps_cum = np.array([3/24, 6/24, 9/24, 12/24, 15/24, 18/24, 21/24, 1, 10, 30, 60, 90, 365, 548]) + # i = 298 300 300 300 300 300 300 300 300 300 300 300 300 300 + time_steps_cum = np.array([12/24, 24/24, 36/24, 48/24, 60/24, 72/24, 84/24, 4, 10, 30, 60, 90, 365, 548]) time_steps = np.diff(time_steps_cum, prepend=0.0) - ## Power in Watts full_power = 3411e6 - powers = [full_power if x > 1 else full_power*x for x in time_steps_cum] - - time_step = 10 - power = int(3.411e9) + powers = [full_power if x > 4 else full_power*x/4 for x in time_steps_cum] ## setting the transport operator model = b.export_model() + openmc.plot_geometry() operator = openmc.deplete.CoupledOperator(model, chain_file, #diff_burnable_mats=False, normalization_mode='fission-q', - fission_q=serpent_fission_q, - fission_yield_mode="average") + fission_q=serpent_fission_q, fission_yield_mode="average") ## depleting using a first-order predictor algorithm - integrator = openmc.deplete.PredictorIntegrator(operator, [time_step], [power], timestep_units='d') + ## Working algorithms: CELI, CECM, SILEQI + integrator = openmc.deplete.SILEQIIntegrator(operator, time_steps, powers, timestep_units='d') integrator.integrate() - openmc.deplete.Results('depletion_results.h5').export_to_materials(len(time_steps)) + model.materials = openmc.deplete.Results('depletion_results.h5').export_to_materials(1) + model.export_to_xml() """ print(time_steps) @@ -155,19 +162,18 @@ elif options.run_deplete: model.materials = results.export_to_materials(len(time_steps)) """ -elif options.run: +elif args.run: b.set_params(batches=350,inactive=50,particles=20000) - # b.set_S(20) + """rod_loc, guess_list, result = openmc.search_for_keff(run_loop, initial_guess=10, target=1.0, + tol=6e-4, print_iterations=True)""" - - """openmc.search_for_keff(b.set_S,initial_guess=15,target=1.0,bracket=[15,574],tol=6e-4, - bracketed_method='ridder',print_iterations=True,model_args={'particles': 20000, - 'inactive': 50,'batches': 350})""" - - b.export_xml(as_model=True) + b.export_xml() openmc.run() +else: + b.set_params(batches=350,inactive=50,particles=20000) + b.export_xml()