This repository has been archived by the owner on Oct 1, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
28 changed files
with
1,277 additions
and
606 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from critops.constants import * | ||
from critops.iterator import * | ||
from critops.outputs import * | ||
from critops.readinputs import * | ||
from critops.utils import * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
""" | ||
______ _ __ ____ _____ _ _________ ________ | ||
/ ____/____(_) /_/ __ \____ / ___/ / | / / ____/ | / /_ __/ | ||
/ / / ___/ / __/ / / / __ \\__ \_____/ |/ / __/ | | /| / / / / | ||
/ /___/ / / / /_/ /_/ / /_/ /__/ /____/ /| / /___ | |/ |/ / / / | ||
\____/_/ /_/\__/\____/ .___/____/ /_/ |_/_____/ |__/|__/ /_/ | ||
/_/ | ||
CritOpS | ||
A Critical Optimization Search tool for NEWT[1] | ||
Andrew Johnson | ||
Objective: Iteratively update a parameter in a template NEWT file in | ||
order to obtain a critical system. | ||
[1]: M. D. DeHart, and S. Bowman, "Reactor Physics Methods and Analysis | ||
Capabilities in SCALE," Nuclear Technology, Technical Paper | ||
vol. 174, no.2, pp. 196-213, 2011. | ||
""" | ||
|
||
import argparse | ||
import os | ||
import sys | ||
|
||
from critops import utils | ||
from critops.constants import header, default_params | ||
from critops.iterator import itermain | ||
from critops.outputs import output_landing | ||
from critops.readinputs import readmain | ||
|
||
# Input parameters | ||
parser = argparse.ArgumentParser(description=header, formatter_class=argparse.RawDescriptionHelpFormatter, | ||
usage='critops inp_file param_file [-v] [-o OUTPUT]') | ||
parser.add_argument('inp_file', type=str, help='template SCALE input file') | ||
parser.add_argument('param_file', type=str, help='file containing parameters for operation') | ||
parser.add_argument('-v', '--verbose', help='reveal more of the mystery behind the operation', action='store_true') | ||
parser.add_argument('-o', '--output', help="write status to output file", type=str) | ||
|
||
if __name__ == '__main__': | ||
|
||
if int(sys.version_info[0]) < 3: | ||
raise SystemError('Need python 3 >') | ||
|
||
kwargs = {} | ||
for key in default_params: | ||
kwargs[key] = default_params[key] | ||
|
||
args = vars(parser.parse_args()) | ||
kwargs['verbose'] = args.pop('verbose') | ||
kwargs['output'] = args.pop('output') | ||
|
||
if kwargs['output'] is None: | ||
print(header) | ||
else: | ||
with open(kwargs['output'], 'w') as outobj: | ||
outobj.write(header) | ||
|
||
# Update files to be absolute references | ||
for file in ('inp_file', 'param_file'): | ||
args[file] = os.path.join(os.getcwd(), args[file]) | ||
if not os.path.exists(args[file]): | ||
utils.error('File {} does not exist'.format(args[file]), 'CritOps __main__', args) | ||
|
||
# Read the input files | ||
template, iter_vars = readmain(args['inp_file'], args['param_file'], kwargs) | ||
|
||
# Start the iteration | ||
iter_vecs, k_vec, conv_type = itermain(template, args['inp_file'], iter_vars, kwargs) | ||
|
||
# Output | ||
output_landing(iter_vecs, k_vec, conv_type, **kwargs) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
""" | ||
NRE6401 - Molten Salt Reactor | ||
CritOpS | ||
constants | ||
Objective: Header file for some useful constants | ||
""" | ||
lineBreakShort = '-' * 10 + '\n' | ||
lineBreakLong = "*" * 70 + '\n' | ||
|
||
default_params = { | ||
'eps_k': 1E-4, 'k_target': 1.0, 'iter_lim': 50, | ||
'inf': 1E30, 'tiny': 1E-16, 'var_char': '$', 'exe_str': 'C:\\SCALE-6.2.1\\bin\\scalerte.exe' | ||
} | ||
|
||
pName = "CritOpS-NEWT v2.0.0dev5" | ||
asciiHeader = r""" | ||
______ _ __ ____ _____ _ _________ ________ | ||
/ ____/____(_) /_/ __ \____ / ___/ / | / / ____/ | / /_ __/ | ||
/ / / ___/ / __/ / / / __ \\__ \_____/ |/ / __/ | | /| / / / / | ||
/ /___/ / / / /_/ /_/ / /_/ /__/ /____/ /| / /___ | |/ |/ / / / | ||
\____/_/ /_/\__/\____/ .___/____/ /_/ |_/_____/ |__/|__/ /_/ | ||
/_/ | ||
""" # http://patorjk.com/software/taag/#p=display&f=Slant&t=CritOpS-NEWT | ||
|
||
header = lineBreakLong + asciiHeader + pName.center(len(lineBreakLong)) + """ | ||
A Critical Optimization Search tool for NEWT[1] | ||
A. Johnson | ||
Objective: Iteratively update a parameter in a template NEWT file in | ||
order to obtain a critical system. | ||
[1]: M. D. DeHart, and S. Bowman, "Reactor Physics Methods and Analysis | ||
\tCapabilities in SCALE," Nuclear Technology, Technical Paper | ||
\tvol. 174, no.2, pp. 196-213, 2011. | ||
""" + lineBreakLong | ||
|
||
supVarChars = ('$',) |
Oops, something went wrong.