From ec4b4510852b68f3bd9d6cbfad93eafb63f28bfc Mon Sep 17 00:00:00 2001 From: Stauff Date: Fri, 11 Nov 2022 16:14:13 -0600 Subject: [PATCH 01/18] initial watts input structure and logic for extracting it --- src/pywatts/etc/templates/param.tmpl | 1 + src/pywatts/etc/templates/watts.tmpl | 8 ++ src/pywatts/etc/watts.py | 90 ++++++++++++ src/pywatts/etc/watts.sch | 139 +++++++++++++++++++ src/pywatts/etc/watts.wbg | 11 ++ src/pywatts/etc/watts.wbh | 70 ++++++++++ src/pywatts/examples/watts_comprehensive.son | 21 +++ src/pywatts/examples/watts_workbench_V3.son | 119 ++++++++++++++++ src/pywatts/pywatts.py | 30 ++++ 9 files changed, 489 insertions(+) create mode 100644 src/pywatts/etc/templates/param.tmpl create mode 100644 src/pywatts/etc/templates/watts.tmpl create mode 100644 src/pywatts/etc/watts.py create mode 100644 src/pywatts/etc/watts.sch create mode 100644 src/pywatts/etc/watts.wbg create mode 100644 src/pywatts/etc/watts.wbh create mode 100644 src/pywatts/examples/watts_comprehensive.son create mode 100644 src/pywatts/examples/watts_workbench_V3.son create mode 100644 src/pywatts/pywatts.py diff --git a/src/pywatts/etc/templates/param.tmpl b/src/pywatts/etc/templates/param.tmpl new file mode 100644 index 00000000..d2eb4f8f --- /dev/null +++ b/src/pywatts/etc/templates/param.tmpl @@ -0,0 +1 @@ +params( id ){value = 0 unit= m range = [ 0 0 ]} \ No newline at end of file diff --git a/src/pywatts/etc/templates/watts.tmpl b/src/pywatts/etc/templates/watts.tmpl new file mode 100644 index 00000000..c08627e4 --- /dev/null +++ b/src/pywatts/etc/templates/watts.tmpl @@ -0,0 +1,8 @@ +watts{ + workflow_level1{ + % define workflows + } + plugins{ + % define plugins + } +} \ No newline at end of file diff --git a/src/pywatts/etc/watts.py b/src/pywatts/etc/watts.py new file mode 100644 index 00000000..7c9934dc --- /dev/null +++ b/src/pywatts/etc/watts.py @@ -0,0 +1,90 @@ +#!/usr/bin/python +"""watts runtime environment""" + +# standard imports +import os +import sys + +# super import +import workbench + +class wattsRuntimeEnvironment(workbench.WorkbenchRuntimeEnvironment): + """watts-specific runtime environment""" + def __init__(self): + """constructor""" + + # call super class constructor + super(wattsRuntimeEnvironment, self).__init__() + + def update_and_print_grammar(self, grammar_path): + if self.executable == None: + import argparse + # if the -grammar flag appears earlier in the arg list than the -e, it won't have been set + # so, we must parse the argv for that case + parser_for_grammar = argparse.ArgumentParser() + parser_for_grammar.add_argument("-e", type=str) + known, unknown = parser_for_grammar.parse_known_args(sys.argv) + self.executable = known.e + + if self.executable == None: + sys.stderr.write("***Error: The -grammar option requires -e argument!\n") + sys.exit(1) + + watts_bin_dir = os.path.dirname(self.executable) + watts_dir = watts_bin_dir + + watts_grammar_path = watts_dir+"/etc/watts.wbg" + + watts_grammar_mtime = os.path.getmtime(watts_grammar_path) + try: + workbench_grammar_mtime = os.path.getmtime(grammar_path) + except OSError: + # indicate grammar file is 'way old' + # which will indicate it needs to be updated + workbench_grammar_mtime = 0 + + # Update Workbench's grammar status file + if watts_grammar_mtime > workbench_grammar_mtime: + watts_grammar_name = os.path.basename(grammar_path).replace(".wbg","") + with open(grammar_path,"w") as workbench_grammar_file: + workbench_grammar_file.write("name='{0}' redirect='{1}'".format(watts_grammar_name, watts_grammar_path)) + print (grammar_path) + + + return + def app_name(self): + """returns the app's self-designated name""" + return "watts" + + def app_options(self): + """list of app-specific options""" + opts = [] + + # TODO add application unique arguments + return opts + + def prerun(self, options): + """actions to perform before the run starts""" + # override values + options.working_directory = os.path.dirname(options.input) + + # build argument list + options.input = options.input.replace(options.working_directory + "/", "") + + # call default implementation + super(wattsRuntimeEnvironment, self).prerun(options) + + # override the working directory removal - dont do it + self.cleanup = False + + def run_args(self, options): + """returns a list of arguments to pass to the given executable""" + # build argument list + args = ["-i", options.input] + + # TODO add application unique arguments + return args + +if __name__ == "__main__": + # execute runtime, ignoring first argument (the python script itself) + wattsRuntimeEnvironment().execute(sys.argv[1:]) diff --git a/src/pywatts/etc/watts.sch b/src/pywatts/etc/watts.sch new file mode 100644 index 00000000..0cee9440 --- /dev/null +++ b/src/pywatts/etc/watts.sch @@ -0,0 +1,139 @@ +ChildExactlyOne = [ watts ] +watts{ + Description = "[optional] for watts calculations" + MinOccurs = 0 + MaxOccurs = 1 + InputTmpl = "watts" + workflow_level1{ + Description = "[required] Workflow definition - first level" + InputTmpl="sonobject" + MinOccurs=1 + MaxOccurs=1 + + ChildAtLeastOne = [plugin workflow_level2] % we need at least to do a plugin calc or define a sub-workflow + + iterations{ + Description = "[optional] definition of iterations workflow" + InputTmpl="sonobject" + MinOccurs=0 + MaxOccurs=1 + } + parametric{ + Description = "[optional] definition of parametric workflow" + InputTmpl="sonobject" + MinOccurs=0 + MaxOccurs=1 + } + optimization{ + Description = "[optional] definition of optimization workflow" + InputTmpl="sonobject" + MinOccurs=0 + MaxOccurs=1 + } + plugin{ + Description = "[optional] plugin specification" + InputTmpl="flagtypes" + MinOccurs=0 + MaxOccurs=NoLimit + ValType=String + ExistsIn = ["../../plugins/plugin/id"] + } + variables{ + Description = "[optional] Variables definition" + InputTmpl="sonobject" + MinOccurs=0 + MaxOccurs=1 + ChildUniqueness = [ "param/id"] + param{ + Description = "[optional] Parameter definition" + InputTmpl="param" + MinOccurs=1 + MaxOccurs=NoLimit + id{ + MinOccurs=1 + MaxOccurs=1 + ValType=String + } + value{ + Description = "[required] reference value" + ValType=Real + InputTmpl="flagtypes" + MinOccurs=1 + MaxOccurs=1 + } + unit{ + Description = "[required] reference value" + ValType=String + InputTmpl="flagtypes" + InputDefault= codename + ValEnums=[ K m s ] + MinOccurs=0 + MaxOccurs=1 + } + range{ + Description = "[required] range of the value (for optimization)" + InputTmpl="sonarray" + MinOccurs=0 + MaxOccurs=1 + value{ + MinOccurs=2 + MaxOccurs=2 + ValType=Real + } + } + } + } + workflow_level2{ + Description = "[optional] Workflow definition - second level" + InputTmpl="sonobject" + MinOccurs=0 + MaxOccurs=NoLimit + } + } + plugins{ + Description = "[required] Plugins definition" + InputTmpl="sonobject" + MinOccurs=1 + MaxOccurs=1 + ChildUniqueness = [ "plugin/id"] + + plugin{ + Description = "[required] Plugins definition" + InputTmpl="sonobject" + MinOccurs=1 + MaxOccurs=NoLimit + id{ + MinOccurs=1 + MaxOccurs=1 + ValType=String + } + code{ + Description = "Code name" + MaxOccurs=1 + MinOccurs=1 + ValType=String + InputTmpl="flagtypes" + InputDefault= codename + ValEnums=[ PyARC OpenMC SERPENT ABCE MCNP ] + } + template{ + Description = "Template name" + MaxOccurs=1 + MinOccurs=1 + ValType=String + InputTmpl="flagtypes" + InputDefault= "path-to-template" + } + extra_inputs{ + InputTmpl="sonarray" + MinOccurs=0 + MaxOccurs=1 + value{ + MinOccurs=0 + MaxOccurs=NoLimit + ValType=String + } + } + } + } +} diff --git a/src/pywatts/etc/watts.wbg b/src/pywatts/etc/watts.wbg new file mode 100644 index 00000000..56cd8d2d --- /dev/null +++ b/src/pywatts/etc/watts.wbg @@ -0,0 +1,11 @@ +commentDelimiter = "%" +enabled = true +extensions = [son] +highlighter = "watts.wbh" +maxDepth = 4 +name = watts +nav = watts % indicates navigation logic for watts documents +parser = waspson +schema = "watts.sch" +templates = "templates" +validator = wasp diff --git a/src/pywatts/etc/watts.wbh b/src/pywatts/etc/watts.wbh new file mode 100644 index 00000000..6ac7d279 --- /dev/null +++ b/src/pywatts/etc/watts.wbh @@ -0,0 +1,70 @@ +rule("Comment") { + foreground { + red = 0 + green = 128 + blue = 0 + } + italic = true + pattern = "(^'|%|//).*" +} +rule("Double-quoted string") { + foreground { + red = 128 + green = 0 + blue = 0 + } + pattern = '"[^"]*"' +} +rule("Single-quoted string") { + foreground { + red = 128 + green = 0 + blue = 0 + } + pattern = "'[^']*'" +} +rule("Sequence") { + bold = true + foreground { + red = 0 + green = 0 + blue = 0 + } + pattern = "^(=\S+|end\s*$)" +} +%rule("Keyword") { +% bold = true +% foreground { +% red = 0 +% green = 0 +% blue = 128 +% } +% pattern = "\s*((read|end)\s+\S+|end\s*$)" +%} +rule("Number") { + bold = true + foreground { + red = 128 + green = 0 + blue = 0 + } + pattern = "\b[-+]?(\d+\.?\d*|\.\d+)([eE][-+]?\d+)?\b" +} +rule("Keyword") { + bold = true + foreground { + red = 0 + green = 0 + blue = 128 + } + pattern = "\([^)]+\)" +} +rule("List Elements") { + bold = true + foreground { + red = 0 + green = 128 + blue = 128 + } + pattern = "\[[^]]+\]" +} diff --git a/src/pywatts/examples/watts_comprehensive.son b/src/pywatts/examples/watts_comprehensive.son new file mode 100644 index 00000000..543992d7 --- /dev/null +++ b/src/pywatts/examples/watts_comprehensive.son @@ -0,0 +1,21 @@ +watts{ + workflow_level1{ + + plugin = ID1 + + workflow_level2{ + } + } + plugins{ + plugin(ID1){ + code = MCNP + template = "my_template.tmpl" + extra_inputs = [input1 input2] + } + plugin(ID2){ + code = openmc + template = "my_template.tmpl" + extra_inputs = [input1 input2] + } + } +} \ No newline at end of file diff --git a/src/pywatts/examples/watts_workbench_V3.son b/src/pywatts/examples/watts_workbench_V3.son new file mode 100644 index 00000000..331d3aca --- /dev/null +++ b/src/pywatts/examples/watts_workbench_V3.son @@ -0,0 +1,119 @@ +The input file consists of multiple 'blocks' where each block contains user-input +information. Currently, only the 'application' block is necessary and the others +are optional. Users can choose to input values of variable with the 'variables' +block. The 'loop' block allows user to build loops (nested if necessary) where +the applications are executed which allows users to loop through variables with +different values. The 'application' block is where the information of the application +that is to be executed is inputted. Multiple 'application' blocks are acceptable +to allow for the coupling of different applications. The order of execution is +determine by the 'order' option in the block. The 'output' option allows users to +select the results that they wish to extract for postprocessing or use as inputs +to the next application. The 'operation' block allows simple operations to be +carried out for postprocessing. The 'plot' blocks allows simple plotting and +visualization of the results. + +watts{ + database_path = 'path-to-databse'[optional] + + workflow_level0 { # required - has "optimize" [optional] "iterate" [optional] "parametric" [optional] - postprocess [optional] + # workflow bock requires [variable and plugin] OR [sub-workflow]. + variables { # set of variables - we can define several sets - but need to be defined in each set + params(Initial_Temp){value = 1500 , unit=optional, bonds=[1000, 1800]} % value = required - unit = optional [m, K, C, etc.] - ID = unique - bonds: required if optimization! + params(Swelling_Coefficient){value = 3000 , unit=optional} + params(Core_Diameter){value = 12 , unit=ft} + } + + workflow_level1{ # optional + + optimize{ # this is for single criteria optimization? + objective_functions = 'ID1[var1][0]' # variable to optimize + method = 'SLSQP' # optimizatio algorithm - maybe different options (pymoo, etc.) + tolerance = '1e-4' # convergence criteria + options = '' # additional options + } + + variables { # set of variables - we can define several sets - but need to be defined in each set + params(Swelling_Coefficient){value = 3000 , unit=optional} + } + + plugin(ID1) + + workflow_level2{ # optional + iterate { + nmax = 3 # required + convergence ('ID1[var1][0]') = 1e-4 + } + variables(VAR2) { # set of variables - we can define several sets - but need to be defined in each set + params(Initial_Temp){value = 'ID1[var1][0]+ID2[var3][0]' , unit=optional} % value = required - unit = optional [m, K, C, etc.] - ID = unique + params(Swelling_Coefficient){value = 'op2[0]' , unit=optional} + params(Core_Diameter){value = 'ID2[var3][0]' , unit=ft} + } + plugin(ID1) + plugin(ID2) + postprocessor (post_process_2){ + value = 'ID1[var4] + ID2[var7]' + } + } + plugin(ID2) + + } + workflow_level1{ # optional + parametric{ + changing_params = Initial_Temp + values_changin = [1000, 1500] + } + variables { # set of variables - we can define several sets - but need to be defined in each set + params(Initial_Temp){value = '1000' , unit=optional} % value = required - unit = optional [m, K, C, etc.] - ID = unique + params(Swelling_Coefficient){value = 'op2[0]' , unit=optional} + params(Core_Diameter){value = 'ID2[var3][0]' , unit=ft} + } + plugin(ID1) + plugin(ID2) + } + + } + + + + # For executing applications + plugins{ + plugin(ID1) { # ID is unique + code = 'SAM' # required + template = 'template.tmpl' # required + executable = './sam-opt' # optional if provided in bashrc + extra_input = ['main_in.e', 'sub.i'] # optional + output = ['var1', 'list_var2'] # optional - Save the outputs to something + like dictionary that can accept + different data types. The saved + outputs can be accessed in a + hierarchical manner like how values + in Python dictionary are accessed. + show_stderr = 'False' # optional + show_stdout = 'False' # optional + postprocessing = 'Name_of_operation' # optional - Allows users to postprocess extracted results + # and store them in 'params' as input for the + # next application. The name of operation must + # match one of the operations in the 'operation' block. + ... + } + + # For executing applications + plugin (ID2){ + code = 'PyARC' # required + template = 'template.tmpl' # required + executable = './PyARC.py' # optional if provided in bashrc + extra_input = ['main_in.e', 'sub.i'] # optional + output = ['var1', 'var2'] # optional - names of variables to be extracted + #this won't be straightforward! # post processing added to 'params' to + # be used as input for the next application. + show_stderr = 'False' # optional + show_stdout = 'False' # optional + postprocessing = 'Name_of_operation' # optional - Allows users to postprocess extracted results + # and store them in 'params' as input for the + # next application. The name of operation must + # match one of the operations in the 'operation' block. + ... + } + } + +} diff --git a/src/pywatts/pywatts.py b/src/pywatts/pywatts.py new file mode 100644 index 00000000..cbb05192 --- /dev/null +++ b/src/pywatts/pywatts.py @@ -0,0 +1,30 @@ + +import os + +### +#etc nstauff$ cp watts.py /Applications/Workbench-5.0.0.app/Contents/rte/ +#pywatts nstauff$ mkdir bin +#pywatts nstauff$ ln -s /Applications/Workbench-5.0.0.app/Contents/bin/sonvalidxml bin/sonvalidxml +#pywatts nstauff$ ln -s /Applications/Workbench-5.0.0.app/Contents/wasppy ./ +### + +def load_obj(input_path, watts_path): + '''convert son file to xml stream and create python data structure''' + import subprocess + sonvalidxml = watts_path + "/bin/sonvalidxml" + schema = watts_path + "/etc/watts.sch" + cmd = ' '.join([sonvalidxml, schema, input_path]) + xmlresult = subprocess.check_output(cmd, shell=True) + ### obtain pieces of input by name for convenience + from wasppy import xml2obj + return xml2obj.xml2obj(xmlresult) + +watts_path = os.getcwd() +input_path = os.getcwd() + "/examples/watts_comprehensive.son" + +watts = load_obj(input_path, watts_path).watts + +if watts.workflow_level1 is not None: + print ("here - workflow_level1") +if watts.plugins is not None: + print ("here - plugin") From ccafae034e52db5f8fe1bbabd011d077c550afd5 Mon Sep 17 00:00:00 2001 From: Stauff Date: Fri, 11 Nov 2022 19:10:47 -0600 Subject: [PATCH 02/18] add fix and additional logic to extract results --- src/pywatts/pywatts.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/pywatts/pywatts.py b/src/pywatts/pywatts.py index cbb05192..06cf8ed9 100644 --- a/src/pywatts/pywatts.py +++ b/src/pywatts/pywatts.py @@ -6,6 +6,7 @@ #pywatts nstauff$ mkdir bin #pywatts nstauff$ ln -s /Applications/Workbench-5.0.0.app/Contents/bin/sonvalidxml bin/sonvalidxml #pywatts nstauff$ ln -s /Applications/Workbench-5.0.0.app/Contents/wasppy ./ +# if needed - change wasppy/xml2obj.py line 89 - if isinstance(src, (str,bytes)): ### def load_obj(input_path, watts_path): @@ -27,4 +28,5 @@ def load_obj(input_path, watts_path): if watts.workflow_level1 is not None: print ("here - workflow_level1") if watts.plugins is not None: - print ("here - plugin") + for it, plg in enumerate(watts.plugins.plugin): + print ("plugin ", str(plg.id), " code ", str(plg.code.value)) From 02a74987a40acf84e92ecfbf7fdd92916a4f9cb1 Mon Sep 17 00:00:00 2001 From: Stauff Date: Sat, 12 Nov 2022 09:53:37 -0600 Subject: [PATCH 03/18] renamed GUI --- src/pywatts/examples/watts_workbench_V3.son | 119 ------------------ .../etc/templates/param.tmpl | 0 .../etc/templates/watts.tmpl | 0 src/{pywatts => watts_ui}/etc/watts.py | 0 src/{pywatts => watts_ui}/etc/watts.sch | 0 src/{pywatts => watts_ui}/etc/watts.wbg | 0 src/{pywatts => watts_ui}/etc/watts.wbh | 0 .../examples/watts_comprehensive.son | 0 .../pywatts.py => watts_ui/watts_ui.py} | 0 9 files changed, 119 deletions(-) delete mode 100644 src/pywatts/examples/watts_workbench_V3.son rename src/{pywatts => watts_ui}/etc/templates/param.tmpl (100%) rename src/{pywatts => watts_ui}/etc/templates/watts.tmpl (100%) rename src/{pywatts => watts_ui}/etc/watts.py (100%) rename src/{pywatts => watts_ui}/etc/watts.sch (100%) rename src/{pywatts => watts_ui}/etc/watts.wbg (100%) rename src/{pywatts => watts_ui}/etc/watts.wbh (100%) rename src/{pywatts => watts_ui}/examples/watts_comprehensive.son (100%) rename src/{pywatts/pywatts.py => watts_ui/watts_ui.py} (100%) diff --git a/src/pywatts/examples/watts_workbench_V3.son b/src/pywatts/examples/watts_workbench_V3.son deleted file mode 100644 index 331d3aca..00000000 --- a/src/pywatts/examples/watts_workbench_V3.son +++ /dev/null @@ -1,119 +0,0 @@ -The input file consists of multiple 'blocks' where each block contains user-input -information. Currently, only the 'application' block is necessary and the others -are optional. Users can choose to input values of variable with the 'variables' -block. The 'loop' block allows user to build loops (nested if necessary) where -the applications are executed which allows users to loop through variables with -different values. The 'application' block is where the information of the application -that is to be executed is inputted. Multiple 'application' blocks are acceptable -to allow for the coupling of different applications. The order of execution is -determine by the 'order' option in the block. The 'output' option allows users to -select the results that they wish to extract for postprocessing or use as inputs -to the next application. The 'operation' block allows simple operations to be -carried out for postprocessing. The 'plot' blocks allows simple plotting and -visualization of the results. - -watts{ - database_path = 'path-to-databse'[optional] - - workflow_level0 { # required - has "optimize" [optional] "iterate" [optional] "parametric" [optional] - postprocess [optional] - # workflow bock requires [variable and plugin] OR [sub-workflow]. - variables { # set of variables - we can define several sets - but need to be defined in each set - params(Initial_Temp){value = 1500 , unit=optional, bonds=[1000, 1800]} % value = required - unit = optional [m, K, C, etc.] - ID = unique - bonds: required if optimization! - params(Swelling_Coefficient){value = 3000 , unit=optional} - params(Core_Diameter){value = 12 , unit=ft} - } - - workflow_level1{ # optional - - optimize{ # this is for single criteria optimization? - objective_functions = 'ID1[var1][0]' # variable to optimize - method = 'SLSQP' # optimizatio algorithm - maybe different options (pymoo, etc.) - tolerance = '1e-4' # convergence criteria - options = '' # additional options - } - - variables { # set of variables - we can define several sets - but need to be defined in each set - params(Swelling_Coefficient){value = 3000 , unit=optional} - } - - plugin(ID1) - - workflow_level2{ # optional - iterate { - nmax = 3 # required - convergence ('ID1[var1][0]') = 1e-4 - } - variables(VAR2) { # set of variables - we can define several sets - but need to be defined in each set - params(Initial_Temp){value = 'ID1[var1][0]+ID2[var3][0]' , unit=optional} % value = required - unit = optional [m, K, C, etc.] - ID = unique - params(Swelling_Coefficient){value = 'op2[0]' , unit=optional} - params(Core_Diameter){value = 'ID2[var3][0]' , unit=ft} - } - plugin(ID1) - plugin(ID2) - postprocessor (post_process_2){ - value = 'ID1[var4] + ID2[var7]' - } - } - plugin(ID2) - - } - workflow_level1{ # optional - parametric{ - changing_params = Initial_Temp - values_changin = [1000, 1500] - } - variables { # set of variables - we can define several sets - but need to be defined in each set - params(Initial_Temp){value = '1000' , unit=optional} % value = required - unit = optional [m, K, C, etc.] - ID = unique - params(Swelling_Coefficient){value = 'op2[0]' , unit=optional} - params(Core_Diameter){value = 'ID2[var3][0]' , unit=ft} - } - plugin(ID1) - plugin(ID2) - } - - } - - - - # For executing applications - plugins{ - plugin(ID1) { # ID is unique - code = 'SAM' # required - template = 'template.tmpl' # required - executable = './sam-opt' # optional if provided in bashrc - extra_input = ['main_in.e', 'sub.i'] # optional - output = ['var1', 'list_var2'] # optional - Save the outputs to something - like dictionary that can accept - different data types. The saved - outputs can be accessed in a - hierarchical manner like how values - in Python dictionary are accessed. - show_stderr = 'False' # optional - show_stdout = 'False' # optional - postprocessing = 'Name_of_operation' # optional - Allows users to postprocess extracted results - # and store them in 'params' as input for the - # next application. The name of operation must - # match one of the operations in the 'operation' block. - ... - } - - # For executing applications - plugin (ID2){ - code = 'PyARC' # required - template = 'template.tmpl' # required - executable = './PyARC.py' # optional if provided in bashrc - extra_input = ['main_in.e', 'sub.i'] # optional - output = ['var1', 'var2'] # optional - names of variables to be extracted - #this won't be straightforward! # post processing added to 'params' to - # be used as input for the next application. - show_stderr = 'False' # optional - show_stdout = 'False' # optional - postprocessing = 'Name_of_operation' # optional - Allows users to postprocess extracted results - # and store them in 'params' as input for the - # next application. The name of operation must - # match one of the operations in the 'operation' block. - ... - } - } - -} diff --git a/src/pywatts/etc/templates/param.tmpl b/src/watts_ui/etc/templates/param.tmpl similarity index 100% rename from src/pywatts/etc/templates/param.tmpl rename to src/watts_ui/etc/templates/param.tmpl diff --git a/src/pywatts/etc/templates/watts.tmpl b/src/watts_ui/etc/templates/watts.tmpl similarity index 100% rename from src/pywatts/etc/templates/watts.tmpl rename to src/watts_ui/etc/templates/watts.tmpl diff --git a/src/pywatts/etc/watts.py b/src/watts_ui/etc/watts.py similarity index 100% rename from src/pywatts/etc/watts.py rename to src/watts_ui/etc/watts.py diff --git a/src/pywatts/etc/watts.sch b/src/watts_ui/etc/watts.sch similarity index 100% rename from src/pywatts/etc/watts.sch rename to src/watts_ui/etc/watts.sch diff --git a/src/pywatts/etc/watts.wbg b/src/watts_ui/etc/watts.wbg similarity index 100% rename from src/pywatts/etc/watts.wbg rename to src/watts_ui/etc/watts.wbg diff --git a/src/pywatts/etc/watts.wbh b/src/watts_ui/etc/watts.wbh similarity index 100% rename from src/pywatts/etc/watts.wbh rename to src/watts_ui/etc/watts.wbh diff --git a/src/pywatts/examples/watts_comprehensive.son b/src/watts_ui/examples/watts_comprehensive.son similarity index 100% rename from src/pywatts/examples/watts_comprehensive.son rename to src/watts_ui/examples/watts_comprehensive.son diff --git a/src/pywatts/pywatts.py b/src/watts_ui/watts_ui.py similarity index 100% rename from src/pywatts/pywatts.py rename to src/watts_ui/watts_ui.py From 14f047e8fe45fd6c9db5cab63041bcdfd2e1d3c7 Mon Sep 17 00:00:00 2001 From: Stauff Date: Mon, 14 Nov 2022 09:44:38 -0600 Subject: [PATCH 04/18] minor documentation updates --- src/watts_ui/examples/watts_comprehensive.son | 33 +++++++++---------- src/watts_ui/watts_ui.py | 13 ++++++-- 2 files changed, 25 insertions(+), 21 deletions(-) mode change 100644 => 100755 src/watts_ui/watts_ui.py diff --git a/src/watts_ui/examples/watts_comprehensive.son b/src/watts_ui/examples/watts_comprehensive.son index 543992d7..a7dd1ed5 100644 --- a/src/watts_ui/examples/watts_comprehensive.son +++ b/src/watts_ui/examples/watts_comprehensive.son @@ -1,21 +1,18 @@ watts{ - workflow_level1{ - - plugin = ID1 - - workflow_level2{ + workflow_level1{ + plugin = ID1 + workflow_level2{} + } + plugins{ + plugin(ID1){ + code = MCNP + template = "my_template.tmpl" + extra_inputs = [input1 input2] } - } - plugins{ - plugin(ID1){ - code = MCNP - template = "my_template.tmpl" - extra_inputs = [input1 input2] - } - plugin(ID2){ - code = openmc - template = "my_template.tmpl" - extra_inputs = [input1 input2] - } - } + plugin(ID2){ + code = openmc + template = "my_template.tmpl" + extra_inputs = [input1 input2] + } + } } \ No newline at end of file diff --git a/src/watts_ui/watts_ui.py b/src/watts_ui/watts_ui.py old mode 100644 new mode 100755 index 06cf8ed9..9032a96f --- a/src/watts_ui/watts_ui.py +++ b/src/watts_ui/watts_ui.py @@ -1,12 +1,15 @@ import os - +import sys, getopt +# import watts # this needs to be installed in Workbench environment (follow example from setup_openmc or setup_dassh) ### #etc nstauff$ cp watts.py /Applications/Workbench-5.0.0.app/Contents/rte/ #pywatts nstauff$ mkdir bin #pywatts nstauff$ ln -s /Applications/Workbench-5.0.0.app/Contents/bin/sonvalidxml bin/sonvalidxml #pywatts nstauff$ ln -s /Applications/Workbench-5.0.0.app/Contents/wasppy ./ # if needed - change wasppy/xml2obj.py line 89 - if isinstance(src, (str,bytes)): +# chmod 777 watts_ui.py +# execute with command: `python watts_ui.py -i examples/watts_comprehensive.son` ### def load_obj(input_path, watts_path): @@ -20,8 +23,12 @@ def load_obj(input_path, watts_path): from wasppy import xml2obj return xml2obj.xml2obj(xmlresult) -watts_path = os.getcwd() -input_path = os.getcwd() + "/examples/watts_comprehensive.son" +# Need to update and get properly from workbench the executable path and the argument +watts_path = "/Users/nstauff/Documents/CODES/WATTS/src/watts_ui/" +opts, args = getopt.getopt(sys.argv[1:],"hi:o:",["ifile=","ofile="]) +for opt, arg in opts: + if opt == "-i": + input_path = os.getcwd() +"/"+ str(arg) watts = load_obj(input_path, watts_path).watts From 3edd6955803b17b0832add9ae2c00ea6840d3a0f Mon Sep 17 00:00:00 2001 From: Stauff Date: Mon, 14 Nov 2022 18:47:07 -0600 Subject: [PATCH 05/18] updating input and logic --- src/watts_ui/examples/watts_comprehensive.son | 3 + src/watts_ui/examples/watts_workbench_V3.son | 119 ++++++++++++++++++ src/watts_ui/watts_ui.py | 3 + 3 files changed, 125 insertions(+) create mode 100644 src/watts_ui/examples/watts_workbench_V3.son diff --git a/src/watts_ui/examples/watts_comprehensive.son b/src/watts_ui/examples/watts_comprehensive.son index a7dd1ed5..d0ba25ce 100644 --- a/src/watts_ui/examples/watts_comprehensive.son +++ b/src/watts_ui/examples/watts_comprehensive.son @@ -2,6 +2,9 @@ watts{ workflow_level1{ plugin = ID1 workflow_level2{} + variables{ + param(temp) {value = 100 range = [100 200]} + } } plugins{ plugin(ID1){ diff --git a/src/watts_ui/examples/watts_workbench_V3.son b/src/watts_ui/examples/watts_workbench_V3.son new file mode 100644 index 00000000..331d3aca --- /dev/null +++ b/src/watts_ui/examples/watts_workbench_V3.son @@ -0,0 +1,119 @@ +The input file consists of multiple 'blocks' where each block contains user-input +information. Currently, only the 'application' block is necessary and the others +are optional. Users can choose to input values of variable with the 'variables' +block. The 'loop' block allows user to build loops (nested if necessary) where +the applications are executed which allows users to loop through variables with +different values. The 'application' block is where the information of the application +that is to be executed is inputted. Multiple 'application' blocks are acceptable +to allow for the coupling of different applications. The order of execution is +determine by the 'order' option in the block. The 'output' option allows users to +select the results that they wish to extract for postprocessing or use as inputs +to the next application. The 'operation' block allows simple operations to be +carried out for postprocessing. The 'plot' blocks allows simple plotting and +visualization of the results. + +watts{ + database_path = 'path-to-databse'[optional] + + workflow_level0 { # required - has "optimize" [optional] "iterate" [optional] "parametric" [optional] - postprocess [optional] + # workflow bock requires [variable and plugin] OR [sub-workflow]. + variables { # set of variables - we can define several sets - but need to be defined in each set + params(Initial_Temp){value = 1500 , unit=optional, bonds=[1000, 1800]} % value = required - unit = optional [m, K, C, etc.] - ID = unique - bonds: required if optimization! + params(Swelling_Coefficient){value = 3000 , unit=optional} + params(Core_Diameter){value = 12 , unit=ft} + } + + workflow_level1{ # optional + + optimize{ # this is for single criteria optimization? + objective_functions = 'ID1[var1][0]' # variable to optimize + method = 'SLSQP' # optimizatio algorithm - maybe different options (pymoo, etc.) + tolerance = '1e-4' # convergence criteria + options = '' # additional options + } + + variables { # set of variables - we can define several sets - but need to be defined in each set + params(Swelling_Coefficient){value = 3000 , unit=optional} + } + + plugin(ID1) + + workflow_level2{ # optional + iterate { + nmax = 3 # required + convergence ('ID1[var1][0]') = 1e-4 + } + variables(VAR2) { # set of variables - we can define several sets - but need to be defined in each set + params(Initial_Temp){value = 'ID1[var1][0]+ID2[var3][0]' , unit=optional} % value = required - unit = optional [m, K, C, etc.] - ID = unique + params(Swelling_Coefficient){value = 'op2[0]' , unit=optional} + params(Core_Diameter){value = 'ID2[var3][0]' , unit=ft} + } + plugin(ID1) + plugin(ID2) + postprocessor (post_process_2){ + value = 'ID1[var4] + ID2[var7]' + } + } + plugin(ID2) + + } + workflow_level1{ # optional + parametric{ + changing_params = Initial_Temp + values_changin = [1000, 1500] + } + variables { # set of variables - we can define several sets - but need to be defined in each set + params(Initial_Temp){value = '1000' , unit=optional} % value = required - unit = optional [m, K, C, etc.] - ID = unique + params(Swelling_Coefficient){value = 'op2[0]' , unit=optional} + params(Core_Diameter){value = 'ID2[var3][0]' , unit=ft} + } + plugin(ID1) + plugin(ID2) + } + + } + + + + # For executing applications + plugins{ + plugin(ID1) { # ID is unique + code = 'SAM' # required + template = 'template.tmpl' # required + executable = './sam-opt' # optional if provided in bashrc + extra_input = ['main_in.e', 'sub.i'] # optional + output = ['var1', 'list_var2'] # optional - Save the outputs to something + like dictionary that can accept + different data types. The saved + outputs can be accessed in a + hierarchical manner like how values + in Python dictionary are accessed. + show_stderr = 'False' # optional + show_stdout = 'False' # optional + postprocessing = 'Name_of_operation' # optional - Allows users to postprocess extracted results + # and store them in 'params' as input for the + # next application. The name of operation must + # match one of the operations in the 'operation' block. + ... + } + + # For executing applications + plugin (ID2){ + code = 'PyARC' # required + template = 'template.tmpl' # required + executable = './PyARC.py' # optional if provided in bashrc + extra_input = ['main_in.e', 'sub.i'] # optional + output = ['var1', 'var2'] # optional - names of variables to be extracted + #this won't be straightforward! # post processing added to 'params' to + # be used as input for the next application. + show_stderr = 'False' # optional + show_stdout = 'False' # optional + postprocessing = 'Name_of_operation' # optional - Allows users to postprocess extracted results + # and store them in 'params' as input for the + # next application. The name of operation must + # match one of the operations in the 'operation' block. + ... + } + } + +} diff --git a/src/watts_ui/watts_ui.py b/src/watts_ui/watts_ui.py index 9032a96f..cd4a15f7 100755 --- a/src/watts_ui/watts_ui.py +++ b/src/watts_ui/watts_ui.py @@ -34,6 +34,9 @@ def load_obj(input_path, watts_path): if watts.workflow_level1 is not None: print ("here - workflow_level1") + if watts.workflow_level1.variables is not None: + for it, param in enumerate(watts.workflow_level1.variables.param): + print (str(param.id), str(param.value.value), str(param.unit.value)) if watts.plugins is not None: for it, plg in enumerate(watts.plugins.plugin): print ("plugin ", str(plg.id), " code ", str(plg.code.value)) From 7e983aa7b5b0ef479123ad730cda021ca5f99aa8 Mon Sep 17 00:00:00 2001 From: Zhiee Jhia Ooi Date: Sat, 17 Dec 2022 17:52:58 -0600 Subject: [PATCH 06/18] Created initial WB workflow --- src/watts_ui/bin/sonvalidxml | 1 + src/watts_ui/etc/watts.sch | 218 ++++++- .../examples/1App_OpenMC_VHTR/README.md | 21 + .../1App_OpenMC_VHTR/openmc_template.py | 355 +++++++++++ .../1App_OpenMC_VHTR/watts_comprehensive.son | 60 ++ .../examples/1App_OpenMC_VHTR/watts_exec.py | 82 +++ .../1App_SAM_VHTR/sam_junction_template | 144 +++++ .../examples/1App_SAM_VHTR/sam_template | 149 +++++ .../1App_SAM_VHTR/watts_comprehensive.son | 46 ++ .../examples/1App_SAM_VHTR/watts_exec.py | 65 ++ .../Parametric_SAM_VHTR/sam_junction_template | 144 +++++ .../examples/Parametric_SAM_VHTR/sam_template | 149 +++++ .../watts_comprehensive.son | 49 ++ .../Parametric_SAM_VHTR/watts_exec.py | 65 ++ .../README.md | 20 + .../openmc_template.py | 355 +++++++++++ .../sam_template | 574 ++++++++++++++++++ .../watts_comprehensive.son | 76 +++ .../watts_exec.py | 103 ++++ src/watts_ui/examples/watts_comprehensive.son | 21 - src/watts_ui/examples/watts_workbench_V3.son | 119 ---- src/watts_ui/wasppy | 1 + src/watts_ui/watts_ui.py | 486 ++++++++++++++- 23 files changed, 3127 insertions(+), 176 deletions(-) create mode 120000 src/watts_ui/bin/sonvalidxml create mode 100644 src/watts_ui/examples/1App_OpenMC_VHTR/README.md create mode 100644 src/watts_ui/examples/1App_OpenMC_VHTR/openmc_template.py create mode 100644 src/watts_ui/examples/1App_OpenMC_VHTR/watts_comprehensive.son create mode 100644 src/watts_ui/examples/1App_OpenMC_VHTR/watts_exec.py create mode 100644 src/watts_ui/examples/1App_SAM_VHTR/sam_junction_template create mode 100644 src/watts_ui/examples/1App_SAM_VHTR/sam_template create mode 100644 src/watts_ui/examples/1App_SAM_VHTR/watts_comprehensive.son create mode 100644 src/watts_ui/examples/1App_SAM_VHTR/watts_exec.py create mode 100644 src/watts_ui/examples/Parametric_SAM_VHTR/sam_junction_template create mode 100644 src/watts_ui/examples/Parametric_SAM_VHTR/sam_template create mode 100644 src/watts_ui/examples/Parametric_SAM_VHTR/watts_comprehensive.son create mode 100644 src/watts_ui/examples/Parametric_SAM_VHTR/watts_exec.py create mode 100644 src/watts_ui/examples/PicardIterations_SAM-OpenMC_VHTR/README.md create mode 100644 src/watts_ui/examples/PicardIterations_SAM-OpenMC_VHTR/openmc_template.py create mode 100644 src/watts_ui/examples/PicardIterations_SAM-OpenMC_VHTR/sam_template create mode 100644 src/watts_ui/examples/PicardIterations_SAM-OpenMC_VHTR/watts_comprehensive.son create mode 100644 src/watts_ui/examples/PicardIterations_SAM-OpenMC_VHTR/watts_exec.py delete mode 100644 src/watts_ui/examples/watts_comprehensive.son delete mode 100644 src/watts_ui/examples/watts_workbench_V3.son create mode 120000 src/watts_ui/wasppy diff --git a/src/watts_ui/bin/sonvalidxml b/src/watts_ui/bin/sonvalidxml new file mode 120000 index 00000000..66a857f9 --- /dev/null +++ b/src/watts_ui/bin/sonvalidxml @@ -0,0 +1 @@ +/Applications/Workbench-5.0.1.app/Contents/bin/sonvalidxml \ No newline at end of file diff --git a/src/watts_ui/etc/watts.sch b/src/watts_ui/etc/watts.sch index 0cee9440..c79da0eb 100644 --- a/src/watts_ui/etc/watts.sch +++ b/src/watts_ui/etc/watts.sch @@ -10,25 +10,111 @@ watts{ MinOccurs=1 MaxOccurs=1 - ChildAtLeastOne = [plugin workflow_level2] % we need at least to do a plugin calc or define a sub-workflow - - iterations{ + % ChildAtLeastOne = [plugin workflow_level2] % we need at least to do a plugin calc or define a sub-workflow + + iteration{ Description = "[optional] definition of iterations workflow" InputTmpl="sonobject" MinOccurs=0 MaxOccurs=1 + plugin_main{ + Description = "[required] ID of the first plugin" + MinOccurs=1 + MaxOccurs=1 + ValType=String + } + plugin_sub{ + Description = "[required] ID of the second plugin" + MinOccurs=1 + MaxOccurs=1 + ValType=String + } + nmax{ + Description = "[required] Maximum number of iterations" + MinOccurs=1 + MaxOccurs=1 + ValType=Real + } + convergence_criteria{ + Description = "[required] Convergence criteria" + MinOccurs=1 + MaxOccurs=1 + InputTmpl="flagtypes" + ValType=Real + } + convergence_params{ + Description = "[required] Parameter to compare for convergence" + MinOccurs=1 + MaxOccurs=1 + ValType=String + } + to_sub_params{ + Description = "[required] Parameter(s) to send from plugin_1 to plugin_2" + InputTmpl="sonarray" + MinOccurs=0 + MaxOccurs=1 + value{ + MinOccurs=0 + MaxOccurs=NoLimit + } + } + to_main_params{ + Description = "[required] Parameter(s) to send from plugin_2 to plugin_1" + InputTmpl="sonarray" + MinOccurs=0 + MaxOccurs=1 + value{ + MinOccurs=0 + MaxOccurs=NoLimit + } + } + } parametric{ Description = "[optional] definition of parametric workflow" InputTmpl="sonobject" MinOccurs=0 MaxOccurs=1 + changing_params{ + Description = "[required] the parameter to perform parametric study" + MinOccurs=1 + MaxOccurs=1 + ValType=String + } + changing_values{ + Description = "[required] values for parametric study" + InputTmpl="sonarray" + MinOccurs=1 + MaxOccurs=1 + value{ + MinOccurs=1 + MaxOccurs=NoLimit + } + } } optimization{ Description = "[optional] definition of optimization workflow" InputTmpl="sonobject" MinOccurs=0 MaxOccurs=1 + objective_functions{ + Description = "[required] the parameter to optimize" + MinOccurs=1 + MaxOccurs=1 + ValType=String + } + method{ + Description = "[required] optimization parameter" + MinOccurs=1 + MaxOccurs=1 + ValType=String + } + tolerance{ + Description = "[required] convergence criteria" + MinOccurs=1 + MaxOccurs=1 + ValType=Real + } } plugin{ Description = "[optional] plugin specification" @@ -55,23 +141,22 @@ watts{ ValType=String } value{ - Description = "[required] reference value" - ValType=Real + Description = "[optional] reference value" InputTmpl="flagtypes" - MinOccurs=1 + MinOccurs=0 MaxOccurs=1 } unit{ - Description = "[required] reference value" + Description = "[optional] reference value" ValType=String InputTmpl="flagtypes" InputDefault= codename - ValEnums=[ K m s ] + ValEnums=[ K m s kg mm] MinOccurs=0 MaxOccurs=1 } range{ - Description = "[required] range of the value (for optimization)" + Description = "[optional] range of the value (for optimization)" InputTmpl="sonarray" MinOccurs=0 MaxOccurs=1 @@ -81,6 +166,33 @@ watts{ ValType=Real } } + bool{ + Description = "[optional] boolean" + InputTmpl="flagtypes" + MinOccurs=0 + MaxOccurs=1 + } + list{ + Description = "[optional] list of real or string" + InputTmpl="sonarray" + MinOccurs=0 + MaxOccurs=1 + value{ + MinOccurs=1 + MaxOccurs=NoLimit + } + } + func{ + Description = "[optional] operation" + InputTmpl="sonarray" + MinOccurs=0 + MaxOccurs=1 + value{ + MinOccurs=1 + MaxOccurs=NoLimit + ValType=String + } + } } } workflow_level2{ @@ -89,6 +201,25 @@ watts{ MinOccurs=0 MaxOccurs=NoLimit } + postprocessors{ + Description = "[optional] postprocessor " + InputTmpl="sonobject" + MinOccurs=0 + MaxOccurs=NoLimit + ChildUniqueness = ["id"] + value{ + Description = "[required] operation of the postprocessor" + MinOccurs=1 + MaxOccurs=1 + ValType=String + } + id{ + Description = "[required] ID of postprocessor" + MinOccurs=1 + MaxOccurs=1 + ValType=String + } + } } plugins{ Description = "[required] Plugins definition" @@ -103,7 +234,7 @@ watts{ MinOccurs=1 MaxOccurs=NoLimit id{ - MinOccurs=1 + MinOccurs=0 MaxOccurs=1 ValType=String } @@ -114,7 +245,7 @@ watts{ ValType=String InputTmpl="flagtypes" InputDefault= codename - ValEnums=[ PyARC OpenMC SERPENT ABCE MCNP ] + ValEnums=[ PyARC OpenMC SERPENT ABCE MCNP MOOSE] } template{ Description = "Template name" @@ -124,7 +255,62 @@ watts{ InputTmpl="flagtypes" InputDefault= "path-to-template" } + module_dir{ + MinOccurs=0 + MaxOccurs=1 + ValType=String + } + exec_dir{ + MinOccurs=0 + MaxOccurs=1 + ValType=String + } + exec_name{ + MinOccurs=0 + MaxOccurs=1 + ValType=String + } extra_inputs{ + Description = "[optional] List of extra (non-templated) input files that are needed" + InputTmpl="sonarray" + MinOccurs=0 + MaxOccurs=1 + value{ + MinOccurs=0 + MaxOccurs=NoLimit + } + } + extra_template_inputs{ + Description = "[optional] List of extra templated input files that are needed" + InputTmpl="sonarray" + MinOccurs=0 + MaxOccurs=1 + value{ + MinOccurs=0 + MaxOccurs=NoLimit + } + } + scores{ + Description = "[optional] List of scores for OpenMC tallies" + InputTmpl="sonarray" + MinOccurs=0 + MaxOccurs=1 + value{ + MinOccurs=0 + MaxOccurs=NoLimit + } + } + score_names{ + Description = "[optional] List of representative names for scores" + InputTmpl="sonarray" + MinOccurs=0 + MaxOccurs=1 + value{ + MinOccurs=0 + MaxOccurs=NoLimit + } + } + output{ InputTmpl="sonarray" MinOccurs=0 MaxOccurs=1 @@ -134,6 +320,16 @@ watts{ ValType=String } } + show_stderr{ + MinOccurs=0 + MaxOccurs=1 + ValType=String + } + show_stdout{ + MinOccurs=0 + MaxOccurs=1 + ValType=String + } } } } diff --git a/src/watts_ui/examples/1App_OpenMC_VHTR/README.md b/src/watts_ui/examples/1App_OpenMC_VHTR/README.md new file mode 100644 index 00000000..7bedcac0 --- /dev/null +++ b/src/watts_ui/examples/1App_OpenMC_VHTR/README.md @@ -0,0 +1,21 @@ +# MultiApp_SAM-OpenMC_VHTR + +## Purpose + +This example provides a demonstration on how to use WATTS to perform a single SAM run followed by OpenMC, where temperature results from SAM are input to OpenMC. + +## Code(s) + +- SAM +- OpenMC + +## Keywords + +- Information transfer from SAM to OpenMC +- simple VHTR model + +## File descriptions + +- [__watts_exec.py__](watts_exec.py): WATTS workflow for this example. This is the file to execute to run the problem described above. +- [__openmc_template__](openmc_template.py): OpenMC templated model. + diff --git a/src/watts_ui/examples/1App_OpenMC_VHTR/openmc_template.py b/src/watts_ui/examples/1App_OpenMC_VHTR/openmc_template.py new file mode 100644 index 00000000..771885a5 --- /dev/null +++ b/src/watts_ui/examples/1App_OpenMC_VHTR/openmc_template.py @@ -0,0 +1,355 @@ +# SPDX-FileCopyrightText: 2022 UChicago Argonne, LLC +# SPDX-License-Identifier: MIT + +from math import sqrt + +import openmc +import openmc.model + + +def build_openmc_model(params): + """ OpenMC Model """ + + materials = [] + + homfuel1 = openmc.Material(name="homfuel_1", temperature=params['temp_F1']) + homfuel1.set_density('g/cm3', 2.2767E+00) + homfuel1.add_nuclide('U235', 4.0841E-02, 'wo') + homfuel1.add_nuclide('U238', 1.6597E-01, 'wo') + homfuel1.add_nuclide('O16', 7.0029E-01, 'wo') + homfuel1.add_element('C', 2.0896E-02, 'wo') + homfuel1.add_nuclide('Si28', 6.6155E-02, 'wo') + homfuel1.add_nuclide('Si29', 3.4772E-03, 'wo') + homfuel1.add_nuclide('Si30', 2.3671E-03, 'wo') + materials.append(homfuel1) + + homfuel2 = openmc.Material(name="homfuel_2", temperature=params['temp_F2']) + homfuel2.set_density('g/cm3', 2.2767E+00) + homfuel2.add_nuclide('U235', 4.0841E-02, 'wo') + homfuel2.add_nuclide('U238', 1.6597E-01, 'wo') + homfuel2.add_nuclide('O16', 7.0029E-01, 'wo') + homfuel2.add_element('C', 2.0896E-02, 'wo') + homfuel2.add_nuclide('Si28', 6.6155E-02, 'wo') + homfuel2.add_nuclide('Si29', 3.4772E-03, 'wo') + homfuel2.add_nuclide('Si30', 2.3671E-03, 'wo') + materials.append(homfuel2) + + homfuel3 = openmc.Material(name="homfuel_1", temperature=params['temp_F3']) + homfuel3.set_density('g/cm3', 2.2767E+00) + homfuel3.add_nuclide('U235', 4.0841E-02, 'wo') + homfuel3.add_nuclide('U238', 1.6597E-01, 'wo') + homfuel3.add_nuclide('O16', 7.0029E-01, 'wo') + homfuel3.add_element('C', 2.0896E-02, 'wo') + homfuel3.add_nuclide('Si28', 6.6155E-02, 'wo') + homfuel3.add_nuclide('Si29', 3.4772E-03, 'wo') + homfuel3.add_nuclide('Si30', 2.3671E-03, 'wo') + materials.append(homfuel3) + + homfuel4 = openmc.Material(name="homfuel_1", temperature=params['temp_F4']) + homfuel4.set_density('g/cm3', 2.2767E+00) + homfuel4.add_nuclide('U235', 4.0841E-02, 'wo') + homfuel4.add_nuclide('U238', 1.6597E-01, 'wo') + homfuel4.add_nuclide('O16', 7.0029E-01, 'wo') + homfuel4.add_element('C', 2.0896E-02, 'wo') + homfuel4.add_nuclide('Si28', 6.6155E-02, 'wo') + homfuel4.add_nuclide('Si29', 3.4772E-03, 'wo') + homfuel4.add_nuclide('Si30', 2.3671E-03, 'wo') + materials.append(homfuel4) + + homfuel5 = openmc.Material(name="homfuel_1", temperature=params['temp_F5']) + homfuel5.set_density('g/cm3', 2.2767E+00) + homfuel5.add_nuclide('U235', 4.0841E-02, 'wo') + homfuel5.add_nuclide('U238', 1.6597E-01, 'wo') + homfuel5.add_nuclide('O16', 7.0029E-01, 'wo') + homfuel5.add_element('C', 2.0896E-02, 'wo') + homfuel5.add_nuclide('Si28', 6.6155E-02, 'wo') + homfuel5.add_nuclide('Si29', 3.4772E-03, 'wo') + homfuel5.add_nuclide('Si30', 2.3671E-03, 'wo') + materials.append(homfuel5) + + boro_ctr = openmc.Material(name="B4C-CTR", temperature=params['temp']) + boro_ctr.set_density('g/cm3', 2.47) + boro_ctr.add_nuclide('B10', 0.16, 'ao') + boro_ctr.add_nuclide('B11', 0.64, 'ao') + boro_ctr.add_element('C', 0.20, 'ao') + materials.append(boro_ctr) + + matrix = openmc.Material(name="matrix", temperature=params['temp']) + matrix.set_density('g/cm3', 1.806) + matrix.add_element('C', 1.0 - 0.0000003, 'ao') + matrix.add_nuclide('B10', 0.0000003, 'ao') + if params['use_sab']: + matrix.add_s_alpha_beta('c_Graphite') + materials.append(matrix) + + refl = openmc.Material(name="BeO", temperature=params['temp']) + refl.set_density('g/cm3', 2.7987) + refl.add_nuclide('Be9', 0.50, 'ao') + refl.add_nuclide('O16', 0.50, 'ao') + if params['use_sab_BeO']: + refl.add_s_alpha_beta('c_Be_in_BeO') + refl.add_s_alpha_beta('c_O_in_BeO') + materials.append(refl) + + yh2 = openmc.Material(name="moderator", temperature=params['temp']) + yh2.set_density('g/cm3', 4.30*0.95) + yh2.add_nuclide('Y89', 0.357142857, 'ao') + yh2.add_nuclide('H1', 0.642857143, 'ao') + if params['use_sab'] and params['use_sab_YH2']: + yh2.add_s_alpha_beta('c_H_in_YH2') + yh2.add_s_alpha_beta('c_Y_in_YH2') + materials.append(yh2) + + coolant = openmc.Material(name="coolant", temperature=params['temp']) + coolant.set_density('g/cm3', 0.00365) + coolant.add_nuclide('He4', 1, 'ao') + materials.append(coolant) + + Cr = openmc.Material(name="Cr", temperature=params['temp']) + Cr.set_density('g/cm3', 7.19) + Cr.add_nuclide('Cr50', -4.345e-2, 'ao') + Cr.add_nuclide('Cr52', -83.789e-2, 'ao') + Cr.add_nuclide('Cr53', -9.501e-2, 'ao') + Cr.add_nuclide('Cr54', -2.365e-2, 'ao') + materials.append(Cr) + + shell_mod = openmc.Material(name="shell_mod", temperature=params['temp']) + shell_mod.set_density('g/cm3', 7.055) # FeCrAl + shell_mod.add_nuclide('Cr50', 20.0e-2 * 4.340E-02,'ao') + shell_mod.add_nuclide('Cr52', 20.0e-2 * 8.381E-01,'ao') + shell_mod.add_nuclide('Cr53', 20.0e-2 * 9.490E-02,'ao') + shell_mod.add_nuclide('Cr54', 20.0e-2 * 2.360E-02,'ao') + shell_mod.add_nuclide('Fe54', 75.5e-2 * 5.800E-02,'ao') + shell_mod.add_nuclide('Fe56', 75.5e-2 * 9.172E-01,'ao') + shell_mod.add_nuclide('Fe57', 75.5e-2 * 2.200E-02,'ao') + shell_mod.add_nuclide('Fe58', 75.5e-2 * 2.800E-03,'ao') + shell_mod.add_nuclide('Al27', 4.5e-2 * 1.000 ,'ao') + materials.append(shell_mod) + + mat_dict = {} + for k,v in list(locals().items()): + if v in materials: + mat_dict[k] = v + + materials_file = openmc.Materials() + for mat in materials: + materials_file.append(mat) + materials_file.export_to_xml() + + Z_min = 0 + Z_cl = params['ax_ref'] + Z_cl_out = params['ax_ref'] - params['shell_thick'] + Z_up = params['ax_ref'] + params['cl'] + Z_up_out = params['ax_ref'] + params['cl'] + params['shell_thick'] + Z_max = params['cl'] + 2 * params['ax_ref'] + + # Create cylinder for fuel and coolant + + fuel_radius = openmc.ZCylinder(x0=0.0, y0=0.0, r=params['FuelPin_rad']) + mod_rad_0 = openmc.ZCylinder(x0=0.0, y0=0.0, r=params['mod_ext_rad'] - params['shell_thick'] - params['liner_thick']) + mod_rad_1a = openmc.ZCylinder(x0=0.0, y0=0.0, r=params['mod_ext_rad'] - params['shell_thick']) + mod_rad_1b = openmc.ZCylinder(x0=0.0, y0=0.0, r=params['mod_ext_rad']) + cool_radius = openmc.ZCylinder(x0=0.0, y0=0.0, r=params['cool_hole_rad']) + ctr_radius = openmc.ZCylinder(x0=0.0, y0=0.0, r=params['control_pin_rad']) + lbp_radius = openmc.ZCylinder(x0=0.0, y0=0.0, r=params['lbp_rad']) + + pin_pitch = params['Lattice_pitch'] + + min_z=openmc.ZPlane(z0=Z_min, boundary_type='vacuum') + max_z=openmc.ZPlane(z0=Z_max, boundary_type='vacuum') + sz_cl=openmc.ZPlane(z0=Z_cl) + + sz_cor1=openmc.ZPlane(z0= Z_cl + 1 * params['cl']/5) + sz_cor2=openmc.ZPlane(z0= Z_cl + 2 * params['cl']/5) + sz_cor3=openmc.ZPlane(z0= Z_cl + 3 * params['cl']/5) + sz_cor4=openmc.ZPlane(z0= Z_cl + 4 * params['cl']/5) + + sz_cl_out=openmc.ZPlane(z0=Z_cl_out) + sz_up=openmc.ZPlane(z0=Z_up) + sz_up_out=openmc.ZPlane(z0=Z_up_out) + cpin_low =openmc.ZPlane(z0=Z_up) + + Hex_Pitch = openmc.model.hexagonal_prism(orientation='x',edge_length=params['Assembly_pitch']/sqrt(3),origin=(0.0, 0.0), + boundary_type = 'reflective') # THIS SHOULD BE REFLECTIVE BONDARY + + + fuel_cell_1_1 = openmc.Cell(name='Fuel Pin', fill=homfuel1 , region=-fuel_radius & +sz_cl & -sz_cor1) + fuel_cell_1_2 = openmc.Cell(name='Fuel Pin', fill=homfuel2 , region=-fuel_radius & +sz_cor1 & -sz_cor2) + fuel_cell_1_3 = openmc.Cell(name='Fuel Pin', fill=homfuel3 , region=-fuel_radius & +sz_cor2 & -sz_cor3) + fuel_cell_1_4 = openmc.Cell(name='Fuel Pin', fill=homfuel4 , region=-fuel_radius & +sz_cor3 & -sz_cor4) + fuel_cell_1_5 = openmc.Cell(name='Fuel Pin', fill=homfuel5 , region=-fuel_radius & +sz_cor4 & -sz_up) + fuel_cell_2 = openmc.Cell(name='matrix', fill=matrix , region=+fuel_radius & +sz_cl & -sz_up) + fuel_cell_3 = openmc.Cell(name='reflL', fill=refl , region=-sz_cl) + fuel_cell_4 = openmc.Cell(name='reflO', fill=refl , region=+sz_up) + fuel_universe= openmc.Universe(cells=(fuel_cell_1_1, fuel_cell_1_2,fuel_cell_1_3,fuel_cell_1_4,fuel_cell_1_5,fuel_cell_2,fuel_cell_3,fuel_cell_4)) + TALLY_REGIONS=[fuel_cell_1_1, fuel_cell_1_2,fuel_cell_1_3,fuel_cell_1_4,fuel_cell_1_5] + + mod_cell_1 = openmc.Cell(name='YH2', fill=yh2, region=-mod_rad_0 & +sz_cl & -sz_up ) + mod_cell_2a = openmc.Cell(name='Liner', fill=Cr , region=+mod_rad_0 & -mod_rad_1a & +sz_cl & -sz_up) + mod_cell_2b = openmc.Cell(name='steel', fill=shell_mod , region=+mod_rad_1a & -mod_rad_1b & +sz_cl & -sz_up) + mod_cell_3 = openmc.Cell(name='matrix', fill=matrix , region=+mod_rad_1b & +sz_cl & -sz_up) + mod_cell_5 = openmc.Cell(name='Plug_L', fill=shell_mod , region=-mod_rad_1b & +sz_cl_out & -sz_cl) + mod_cell_6 = openmc.Cell(name='Plug_LR', fill=refl , region=+mod_rad_1b & +sz_cl_out & -sz_cl) + mod_cell_7 = openmc.Cell(name='Plug_U', fill=shell_mod , region=-mod_rad_1b & +sz_up & -sz_up_out) + mod_cell_8 = openmc.Cell(name='Plug_UR', fill=refl , region=+mod_rad_1b & +sz_up & -sz_up_out) + mod_cell_9 = openmc.Cell(name='LowRef', fill=refl , region=-sz_cl_out) + mod_cell_10 = openmc.Cell(name='UpRef', fill=refl , region=+sz_up) + mod_universe= openmc.Universe(cells=(mod_cell_1,mod_cell_2a, mod_cell_2b,mod_cell_3,mod_cell_5,mod_cell_6,mod_cell_7,mod_cell_8,mod_cell_9,mod_cell_10)) + + coolant_cell_1 = openmc.Cell(name='coolant', fill=coolant , region=-cool_radius) + coolant_cell_2 = openmc.Cell(name='matrix', fill=matrix , region=+cool_radius & +sz_cl & -sz_up) + coolant_cell_3 = openmc.Cell(name='reflL', fill=refl , region=+cool_radius & -sz_cl) + coolant_cell_4 = openmc.Cell(name='reflO', fill=refl , region=+cool_radius & +sz_up) + coolant_universe= openmc.Universe(cells=(coolant_cell_1,coolant_cell_2,coolant_cell_3,coolant_cell_4)) + + ctr_cell_1a = openmc.Cell(name='coolant', fill=coolant , region=-ctr_radius & +sz_cl & -cpin_low) + ctr_cell_1b = openmc.Cell(name='abs', fill=boro_ctr , region=-ctr_radius & +cpin_low) + ctr_cell_1c = openmc.Cell(name='refl', fill=refl , region=-ctr_radius & -sz_cl) + ctr_cell_2 = openmc.Cell(name='matrix', fill=matrix , region=+ctr_radius & +sz_cl & -sz_up) + ctr_cell_3 = openmc.Cell(name='reflL', fill=refl , region=+ctr_radius & -sz_cl) + ctr_cell_4 = openmc.Cell(name='reflO', fill=refl , region=+ctr_radius & +sz_up) + ctr_universe= openmc.Universe(cells=(ctr_cell_1a,ctr_cell_1b,ctr_cell_1c, ctr_cell_2,ctr_cell_3,ctr_cell_4)) + + Graph_cell_1= openmc.Cell(name='Graph cell', fill=matrix) + Graph_universe= openmc.Universe(cells=(Graph_cell_1,)) + + # Fill the hexagone with fuel and coolant cells + + assembly_description=[[]]*6 + assembly_description[5]=([ctr_universe]) + assembly_description[4] =([fuel_universe])*6 + assembly_description[3] =([fuel_universe]+[coolant_universe])*6 + assembly_description[2] =([coolant_universe] + [fuel_universe] + [mod_universe] + [coolant_universe] + [fuel_universe] + [mod_universe])*3 + assembly_description[1] =([fuel_universe]+[fuel_universe]+[coolant_universe]+[fuel_universe])*6 + assembly_description[0] =([fuel_universe]+[coolant_universe]+[fuel_universe]+[fuel_universe]+[coolant_universe])*6 + #print(assembly_description) + + lat_core = openmc.HexLattice() + lat_core.center=(0,0) + lat_core.pitch=[pin_pitch] + lat_core.outer=Graph_universe + lat_core.universes=assembly_description + # print(lat_core) + rotated_lat_core = openmc.Cell(fill=lat_core) + rotated_universe_lat_core = openmc.Universe(cells=(rotated_lat_core,)) + new_cell_lat_core=openmc.Cell() + new_cell_lat_core.fill=rotated_universe_lat_core + new_cell_lat_core.rotation=(0.,0.,90.) + new_universe_lat_core = openmc.Universe(cells=(new_cell_lat_core,)) + + main_cell = openmc.Cell(name="MainCell",fill=new_universe_lat_core, region=Hex_Pitch & +min_z & -max_z ) + + + # OpenMC expects that there is a root universe assigned number zero. Here we + # assign our three cells to this root universe. + root_universe = openmc.Universe(name='root universe', cells=(main_cell,)) + + # Finally we must create a geometry and assign the root universe + geometry = openmc.Geometry() + geometry.root_universe = root_universe + geometry.export_to_xml() + + # Now let's define our simulation parameters. These will go into our + # settings.xml via the SettingsFile object. + batches = 100 + inactive = 30 + particles = 5000 + + # Instantiate a SettingsFile + settings_file = openmc.Settings() + settings_file.run_mode = 'eigenvalue' + settings_file.cross_sections = '/software/openmc/data/v0.12pre-3/lanl_endfb80/cross_sections.xml' + settings_file.batches = batches + settings_file.inactive = inactive + settings_file.particles = particles + settings_file.material_cell_offsets = False + settings_file.temperature = {'method' : 'interpolation'} + + source = openmc.Source() + ll = [-params['Assembly_pitch']/4, -params['Assembly_pitch']/4, Z_min] + ur = [params['Assembly_pitch']/4, params['Assembly_pitch']/4, Z_max] + source.space = openmc.stats.Box(ll, ur) + source.strength = 1.0 + settings_file.source = source + + #lower_left, upper_right = main_cell.region.bounding_box + + list_tally_cell = [cell.id for cell in TALLY_REGIONS] + list_tally_scores = ['flux', 'nu-fission'] + cell_filter = openmc.CellFilter(list_tally_cell) + tally_file = openmc.Tally() + tally_file.filters.append(cell_filter) + tally_file.scores = list_tally_scores + tallies = openmc.Tallies() + tallies.append(tally_file) + tallies.export_to_xml() + + settings_file.export_to_xml() + + # Create a plots.xml file + radius = params['Assembly_pitch']/sqrt(3) + p1 = openmc.Plot() + p1.origin = (0, 0, (Z_max-Z_min)/2) + p1.width = (radius*2, radius*2) + p1.pixels = (2000, 2000) + p1.color = 'mat' + p1.basis = 'xy' + p1.color_by = 'material' + p1.col_spec = { + homfuel1.id: (255, 0, 0), + homfuel2.id: (255, 0, 0), + homfuel3.id: (255, 0, 0), + homfuel4.id: (255, 0, 0), + homfuel5.id: (255, 0, 0), + matrix.id: (100, 100, 100), + yh2.id: (20, 200, 50), + boro_ctr.id: (200, 20, 50), + shell_mod.id: (150,150,150), + coolant.id: (180,110,150), + refl.id: (80,210,50) + } + p2 = openmc.Plot() + p2.origin = (0, 0, (Z_max-Z_min)/2) + p2.width = (radius*2, Z_max) + p2.pixels = (200, 2000) + p2.color = 'mat' + p2.basis ='yz' + p2.color_by = 'material' + p2.col_spec = { + homfuel1.id: (255, 0, 0), + homfuel2.id: (255, 0, 0), + homfuel3.id: (255, 0, 0), + homfuel4.id: (255, 0, 0), + homfuel5.id: (255, 0, 0), + matrix.id: (100, 100, 100), + yh2.id: (20, 200, 50), + boro_ctr.id: (200, 20, 50), + shell_mod.id: (150,150,150), + coolant.id: (180,110,150), + refl.id: (80,210,50) + } + p3 = openmc.Plot() + p3.origin = (0, 0, (Z_max-1)) + p3.width = (radius*2, radius*2) + p3.pixels = (2000, 2000) + p3.color = 'mat' + p3.basis = 'xy' + p3.color_by = 'material' + p3.col_spec = { + homfuel1.id: (255, 0, 0), + homfuel2.id: (255, 0, 0), + homfuel3.id: (255, 0, 0), + homfuel4.id: (255, 0, 0), + homfuel5.id: (255, 0, 0), + matrix.id: (100, 100, 100), + yh2.id: (20, 200, 50), + boro_ctr.id: (200, 20, 50), + shell_mod.id: (150,150,150), + coolant.id: (180,110,150), + refl.id: (80,210,50) + } + plots = openmc.Plots() + plots.append(p1) + plots.append(p2) + plots.append(p3) + plots.export_to_xml() diff --git a/src/watts_ui/examples/1App_OpenMC_VHTR/watts_comprehensive.son b/src/watts_ui/examples/1App_OpenMC_VHTR/watts_comprehensive.son new file mode 100644 index 00000000..be8869bb --- /dev/null +++ b/src/watts_ui/examples/1App_OpenMC_VHTR/watts_comprehensive.son @@ -0,0 +1,60 @@ +watts{ + plugins{ + plugin(ID1){ + code = moose +% template = sam_junction_template + template = "/Users/zhieejhiaooi/Documents/ANL/watts-devel/watts/src/watts_ui/examples/1App_SAM_VHTR/sam_junction_template" +% extra_inputs = [input1 input2] + exec_dir= SAM_DIR + exec_name = "sam-opt" + show_stderr = False + show_stdout = False + output = "out.txt" + } + plugin(ID2){ + code = openmc + module_dir = "/Users/zhieejhiaooi/Documents/ANL/watts-devel/watts/src/watts_ui/examples/1App_OpenMC_VHTR" + template = "/Users/zhieejhiaooi/Documents/ANL/watts-devel/watts/src/watts_ui/examples/1App_OpenMC_VHTR/openmc_template.py" + scores = ["nu-fission"] % Name of scores for OpenMC tallies. This will be the base name used for saving the tallies. + score_names = ["power"] % A more representative name for the scores + } + plugin(ID3){ + code = MCNP + template = "my_template.tmpl" + extra_inputs = [input1 input2] + } + } + + workflow_level1{ + plugin = ID2 + variables{ + param(ax_ref) {value = 2.0} + param(num_cool_pins) {value = 24} + param(num_fuel_pins) {value = 44} + param(Height_FC) {value = 2.0} + param(Lattice_pitch) {value = 2.0} + param(FuelPin_rad) {value = 0.9} + param(cool_hole_rad) {value = 0.6} + param(Coolant_channel_diam) {value = 0.012} + param(Graphite_thickness) {value = 0.5} + param(Assembly_pitch) {value = 17.3205080756887} + param(lbp_rad) {value = 0.25} + param(mod_ext_rad) {value = 0.90} + param(shell_thick) {value = 0.05} + param(liner_thick) {value = 0.007} + param(control_pin_rad) {value = 9.9, unit = mm} + param(cl) {value = 160.0} + param(pf) {value = 40.0} + param(temp) {value = 725.0} + param(temp_F1) {value = 725.0} + param(temp_F2) {value = 725.0} + param(temp_F3) {value = 725.0} + param(temp_F4) {value = 725.0} + param(temp_F5) {value = 725.0} + param(use_sab) = {bool = True} + param(use_sab_BeO) = {bool = True} + param(use_sab_YH2) = {bool = False} + } + } + +} \ No newline at end of file diff --git a/src/watts_ui/examples/1App_OpenMC_VHTR/watts_exec.py b/src/watts_ui/examples/1App_OpenMC_VHTR/watts_exec.py new file mode 100644 index 00000000..9ab5b595 --- /dev/null +++ b/src/watts_ui/examples/1App_OpenMC_VHTR/watts_exec.py @@ -0,0 +1,82 @@ +# SPDX-FileCopyrightText: 2022 UChicago Argonne, LLC +# SPDX-License-Identifier: MIT + +""" +This example demonstrates how to use WATTS to perform +OpenMC calculation. This example uses a simple VHTR unit-cell +model with 1 coolant channel surrounded by graphite and fuel. +The demonstration includes the application of unit-conversion +approach in WATTS. OpenMC is executed and the main results are +printed out and stored in the params database. +""" + +from math import cos, pi +import os +import watts +from statistics import mean +from openmc_template import build_openmc_model +import openmc +from astropy.units import Quantity + + +params = watts.Parameters() + +# Core design params +params['ax_ref'] = 20 # cm +params['num_cool_pins'] = 1*6+2*6+6*2/2 +params['num_fuel_pins'] = 6+6+6+3*6+2*6/2+6/3 +params['Height_FC'] = 2.0 # m +params['Lattice_pitch'] = 2.0 +params['FuelPin_rad'] = 0.90 # cm +params['cool_hole_rad'] = 0.60 # cm +params['Coolant_channel_diam'] = (params['cool_hole_rad'] * 2)/100 # in m +params['Graphite_thickness'] = (params['Lattice_pitch'] - params['FuelPin_rad'] - params['cool_hole_rad']) # cm +params['Assembly_pitch'] = 7.5 * 2 * params['Lattice_pitch'] / (cos(pi/6) * 2) +params['lbp_rad'] = 0.25 # cm +params['mod_ext_rad'] = 0.90 # cm +params['shell_thick'] = 0.05 # FeCrAl +params['liner_thick'] = 0.007 # Cr +params['control_pin_rad'] = Quantity(9.9, "mm") # Automatically converts to 'm' for MOOSE and 'cm' for openmc + +# Control use of S(a,b) tables +params['use_sab'] = True +params['use_sab_BeO'] = True +params['use_sab_YH2'] = False + +# OpenMC params +params['cl'] = params['Height_FC']*100 - 2 * params['ax_ref'] # cm +params['pf'] = 40 # percent + +# get temperature from SAM results +params['temp'] = Quantity(725, "Celsius") +for i in range(1, 6): + params[f'temp_F{i}'] = Quantity(725, "Celsius") + +params.show_summary(show_metadata=False, sort_by='time') + +# Create OpenMC plugin +openmc_plugin = watts.PluginOpenMC(build_openmc_model, show_stderr=True) # show only error + +# Run OpenMC plugin, instructing it to plot the geometry and run a simulation +# def run_func(): +# openmc.plot_geometry() +# openmc.run() +# openmc_result = openmc_plugin(params, function=run_func) +openmc_result = openmc_plugin(params) +print("KEFF = ", openmc_result.keff) +print(openmc_result.inputs) +print(openmc_result.outputs) +print(openmc_result.tallies[0].get_pandas_dataframe()) + +# Open folder in order to view plot images that were produced +# openmc_result.open_folder() + +# Set power fractions in parameters +print(type(openmc_result.tallies[0].get_values(scores=['nu-fission']))) +print(len(openmc_result.tallies[0].get_values(scores=['nu-fission']))) +power_fractions = openmc_result.tallies[0].get_values(scores=['nu-fission']).ravel() +print(power_fractions) +for i, power_frac in enumerate(power_fractions): + params[f'Init_P_{i+1}'] = power_frac + +params.show_summary(show_metadata=True, sort_by='time') diff --git a/src/watts_ui/examples/1App_SAM_VHTR/sam_junction_template b/src/watts_ui/examples/1App_SAM_VHTR/sam_junction_template new file mode 100644 index 00000000..f6866344 --- /dev/null +++ b/src/watts_ui/examples/1App_SAM_VHTR/sam_junction_template @@ -0,0 +1,144 @@ +[GlobalParams] + global_init_P = 1.2e5 + global_init_V = 1 + global_init_T = 628.15 + scaling_factor_var = '1 1e-3 1e-6' +[] + +[EOS] + [./eos] + type = PBSodiumEquationOfState + [../] +[] + +[Functions] + [./time_stepper] + type = PiecewiseLinear + x = ' 0 20 21 100 101 1e5' + y = '0.1 0.1 0.5 0.5 1 1' + [../] +[] + +[Components] + [./pipe1] + type = PBOneDFluidComponent + eos = eos + position = '0 0 0' + orientation = '0 0 1' + heat_source = {{ heat_source }} + f= {{ friction_factor }} + Dh = {{ Dh }} + length = 1 + # A = 3.14e-4 + A = {{ flow_area }} + n_elems = 10 + [../] + + [./pipe2] + type = PBOneDFluidComponent + eos = eos + position = '0 0 1' + orientation = '0 0 1' + f=0.1 + Dh = 0.01 + length = 1 + heat_source = 1e7 + A = 3.14e-4 + n_elems = 10 + [../] + + [./joint] + type = PBSingleJunction + eos = eos + inputs='pipe1(out)' + outputs='pipe2(in)' + weak_constraint = true + [../] + [./inlet] + type = PBTDJ + input = 'pipe1(in)' + eos = eos + v_bc = {{ velocity_inlet }} + T_bc = {{ temperature_inlet }} + [../] + + [./outlet] + type = PBTDV + input = 'pipe2(out)' + eos = eos + p_bc = '1.0e5' + T_bc = 728.15 + [../] +[] + +[Postprocessors] + [./TotalMassFlowRateInlet_2] + type = ComponentBoundaryFlow + input = 'pipe2(out)' + [../] + [./Outlet_Temperature_2] + type = ComponentBoundaryVariableValue + variable = temperature + input = 'pipe2(out)' + [../] +[] + +[Preconditioning] + active = 'SMP_PJFNK' + + [./SMP_PJFNK] + type = SMP + full = true + solve_type = 'PJFNK' + petsc_options_iname = '-pc_type' + petsc_options_value = 'lu' + [../] +[] # End preconditioning block + + +[Executioner] + type = Transient + + dt = 1e-1 + dtmin = 1e-5 + + # setting time step range + [./TimeStepper] + type = FunctionDT + function = time_stepper + [../] + + petsc_options_iname = '-ksp_gmres_restart' + petsc_options_value = '100' + + nl_rel_tol = 1e-8 + nl_abs_tol = 1e-7 + nl_max_its = 20 + + l_tol = 1e-5 # Relative linear tolerance for each Krylov solve + l_max_its = 100 # Number of linear iterations for each Krylov solve + + start_time = 0.0 + end_time = 100. + + [./Quadrature] + type = TRAP + order = FIRST + [../] +[] # close Executioner section + +[Outputs] + perf_graph = true + [./out_displaced] + type = Exodus + use_displaced = true + execute_on = 'initial timestep_end' + sequence = false + [../] + [./csv] + type = CSV + [../] + [./console] + type = Console + [../] +[] diff --git a/src/watts_ui/examples/1App_SAM_VHTR/sam_template b/src/watts_ui/examples/1App_SAM_VHTR/sam_template new file mode 100644 index 00000000..34178bcf --- /dev/null +++ b/src/watts_ui/examples/1App_SAM_VHTR/sam_template @@ -0,0 +1,149 @@ +## Component functional requirement test case: PBOneDFluidComponent +## Requirement: Model simplified 1D single phase flow +## with user-specified flow geometry (A and Dh). + +## Acceptance criteria: The inlet mass flow rate (determined by A) +## must match the hand-calculated value within a tolerance of 1e-12. +## The pressure drop for a given constant friction (determined by Dh) +## must match the hand-calculated value within a tolerance of 1e-3. + +A = 3.14e-4 +v = {{ velocity }} +rho = 865.51 +mu = 2.6216e-4 +Dh = {{ Dh }} +# The friction factor is +f = 0.01 +# The inlet flow rate is +m_dot = ${fparse rho*v*A} +# The pressure drop is +dP = ${fparse f/Dh*rho*v*v/2} + +[GlobalParams] + global_init_P = 1.0e5 + global_init_V = ${v} + global_init_T = 628.15 +[] + +[EOS] + [eos] # Simple linearized Sodium approximation + type = PTConstantEOS + p_0 = 1e5 # Pa + rho_0 = ${rho} # kg/m^3 + beta = 2.7524e-4 # K^{-1} + cp = 1272.0 # at Tavg; + h_0 = 7.9898e5 # J/kg + T_0 = 628.15 # K + mu = ${mu} # Pa-s + k = 72 # W/m-K + [] +[] + + +[Components] + [pipe1] + type = PBOneDFluidComponent + eos = eos + position = '0 0 0' + orientation = '0 1 0' + + A = ${A} # Check cross-sectional flow area is used + Dh = ${Dh} # Check hydraulic diameter is used + length = 1.0 + n_elems = 10 + + f = ${f} + [] + + [inlet] + type = PBTDJ + input = 'pipe1(in)' + eos = eos + v_bc = ${v} + T_bc = 628.15 + [] + + [outlet] + type = PBTDV + input = 'pipe1(out)' + eos = eos + p_bc = '1.0e5' + [] +[] + +[Preconditioning] + [SMP_PJFNK] + type = SMP + full = true + solve_type = 'PJFNK' + petsc_options_iname = '-pc_type' + petsc_options_value = 'lu' + [] +[] + +[Postprocessors] + [m_dot_inlet] + type = ComponentBoundaryFlow + input = pipe1(in) + outputs = none + [] + [P_outlet] + type = ComponentBoundaryVariableValue + input = pipe1(out) + variable = pressure + outputs = none + [] + [P_inlet] + type = ComponentBoundaryVariableValue + input = pipe1(in) + variable = pressure + outputs = none + [] + [DeltaP] + type = DifferencePostprocessor + value1 = P_inlet + value2 = P_outlet + outputs = none + [] + [check_requirement_A] + type = PostprocessorComparison + comparison_type = equals + value_a = ${m_dot} + value_b = 'm_dot_inlet' + [] + [check_requirement_Dh] + type = PostprocessorComparison + comparison_type = equals + value_a = ${dP} + value_b = 'DeltaP' + absolute_tolerance = 1e-3 + [] +[] + +[Executioner] + type = Steady + + petsc_options_iname = '-ksp_gmres_restart' + petsc_options_value = '100' + + nl_rel_tol = 1e-8 + nl_abs_tol = 1e-7 + nl_max_its = 20 + l_tol = 1e-4 + l_max_its = 100 + + [Quadrature] + type = TRAP + order = FIRST + [] +[] + +[Outputs] + print_linear_residuals = false + [csv] + type = CSV + [] + [console] + type = Console + [] +[] diff --git a/src/watts_ui/examples/1App_SAM_VHTR/watts_comprehensive.son b/src/watts_ui/examples/1App_SAM_VHTR/watts_comprehensive.son new file mode 100644 index 00000000..34f82645 --- /dev/null +++ b/src/watts_ui/examples/1App_SAM_VHTR/watts_comprehensive.son @@ -0,0 +1,46 @@ +watts{ + plugins{ + plugin(ID1){ + code = moose +% template = sam_junction_template + template = "/Users/zhieejhiaooi/Documents/ANL/watts-devel/watts/src/watts_ui/examples/1App_SAM_VHTR/sam_junction_template" +% extra_inputs = [input1 input2] + exec_dir= SAM_DIR + exec_name = "sam-opt" + show_stderr = False + show_stdout = False + output = "out.txt" + } + plugin(ID2){ + code = openmc + template = "my_template.tmpl" + extra_inputs = [input1 input2] + } + plugin(ID3){ + code = MCNP + template = "my_template.tmpl" + extra_inputs = [input1 input2] + } + } + + workflow_level1{ + plugin = ID1 + variables{ + param(temperature_inlet) {value = 2.0} + param(friction_factor) {value = 0.1} + param(flow_area) {value = 3.14e-4} + param(country) {value = USA} + param(Dh) {value = 1 unit = m} + param(velocity_inlet) {value = 1} + param(name) {list = [ANL INL ORNL LANL]} + param(size) {list = [30.0 50.4 -60.6 1e-5]} + param(velocity_outlet) {func = "2 * temperature_inlet ** 3"} + param(velocity_outlet_2) {func = "friction_factor + 2 + temperature_inlet ** 3"} + param(wall_bc) {bool = "True"} + param(heat_source) {value = 1e5} + } +% iterations{nmax = 10 convergence_criteria = 0.0001 iter_params = var1} +% workflow_level2{} + } + +} \ No newline at end of file diff --git a/src/watts_ui/examples/1App_SAM_VHTR/watts_exec.py b/src/watts_ui/examples/1App_SAM_VHTR/watts_exec.py new file mode 100644 index 00000000..6f090991 --- /dev/null +++ b/src/watts_ui/examples/1App_SAM_VHTR/watts_exec.py @@ -0,0 +1,65 @@ +# SPDX-FileCopyrightText: 2022 UChicago Argonne, LLC +# SPDX-License-Identifier: MIT + +""" +This example demonstrates how to use WATTS to perform +SAM calculations. This example uses a simple VHTR unit-cell +model with 1 coolant channel surrounded by graphite and fuel. +The demonstration includes the application of unit-conversion +approach in WATTS. After execution of SAM using the MOOSE plugin, +the results stored in CSV files are displayed to the user. +""" + +from math import cos, pi +import os +from pathlib import Path + +import watts +from astropy.units import Quantity + + +params = watts.Parameters() + +# TH params + +params['He_inlet_temp'] = Quantity(600, "Celsius") # 873.15 K +params['He_outlet_temp'] = Quantity(850, "Celsius") # 1123.15 K +params['He_cp'] = Quantity(4.9184126, "BTU/(kg*K)") # 5189.2 J/kg-K +params['He_K'] = 0.32802 # W/m-K +params['He_density'] = 3.8815 # kg/m3 +params['He_viscosity'] = 4.16e-5 # Pa.s +params['He_Pressure'] = Quantity(1015.264164, "psi") # 7e6 Pa +params['Tot_assembly_power'] = 250000 # W + +for i in range(1, 6): + params[f'Init_P_{i}'] = 1 # Fraction + +# Core design params - some are not used in SAM model +params['ax_ref'] = 20 # cm +params['num_cool_pins'] = 1*6+2*6+6*2/2 +params['num_fuel_pins'] = 6+6+6+3*6+2*6/2+6/3 +params['Height_FC'] = Quantity(2000, "mm") # Automatically converts to 'm' for MOOSE and 'cm' for openmc +params['Lattice_pitch'] = 2.0 +params['FuelPin_rad'] = 0.90 # cm +params['cool_hole_rad'] = 0.60 # cm +params['Coolant_channel_diam'] = (params['cool_hole_rad'] * 2)/100 # in m +params['Graphite_thickness'] = (params['Lattice_pitch'] - params['FuelPin_rad'] - params['cool_hole_rad']) # cm +params['Assembly_pitch'] = 7.5 * 2 * params['Lattice_pitch'] / (cos(pi/6) * 2) +params['lbp_rad'] = 0.25 # cm +params['mod_ext_rad'] = 0.90 # cm +params['shell_thick'] = 0.05 # FeCrAl +params['liner_thick'] = 0.007 # Cr +params['control_pin_rad'] = Quantity(9.9, "mm") # Automatically converts to 'm' for MOOSE and 'cm' for openmc + +params.show_summary(show_metadata=False, sort_by='key') + +# MOOSE Workflow +# set your SAM directory as SAM_DIR + +app_dir = Path(os.environ["SAM_DIR"]) +moose_plugin = watts.PluginMOOSE('sam_template', executable=app_dir / 'sam-opt') +moose_result = moose_plugin(params) +for key in moose_result.csv_data: + print(key, moose_result.csv_data[key]) +print(moose_result.inputs) +print(moose_result.outputs) diff --git a/src/watts_ui/examples/Parametric_SAM_VHTR/sam_junction_template b/src/watts_ui/examples/Parametric_SAM_VHTR/sam_junction_template new file mode 100644 index 00000000..f6866344 --- /dev/null +++ b/src/watts_ui/examples/Parametric_SAM_VHTR/sam_junction_template @@ -0,0 +1,144 @@ +[GlobalParams] + global_init_P = 1.2e5 + global_init_V = 1 + global_init_T = 628.15 + scaling_factor_var = '1 1e-3 1e-6' +[] + +[EOS] + [./eos] + type = PBSodiumEquationOfState + [../] +[] + +[Functions] + [./time_stepper] + type = PiecewiseLinear + x = ' 0 20 21 100 101 1e5' + y = '0.1 0.1 0.5 0.5 1 1' + [../] +[] + +[Components] + [./pipe1] + type = PBOneDFluidComponent + eos = eos + position = '0 0 0' + orientation = '0 0 1' + heat_source = {{ heat_source }} + f= {{ friction_factor }} + Dh = {{ Dh }} + length = 1 + # A = 3.14e-4 + A = {{ flow_area }} + n_elems = 10 + [../] + + [./pipe2] + type = PBOneDFluidComponent + eos = eos + position = '0 0 1' + orientation = '0 0 1' + f=0.1 + Dh = 0.01 + length = 1 + heat_source = 1e7 + A = 3.14e-4 + n_elems = 10 + [../] + + [./joint] + type = PBSingleJunction + eos = eos + inputs='pipe1(out)' + outputs='pipe2(in)' + weak_constraint = true + [../] + [./inlet] + type = PBTDJ + input = 'pipe1(in)' + eos = eos + v_bc = {{ velocity_inlet }} + T_bc = {{ temperature_inlet }} + [../] + + [./outlet] + type = PBTDV + input = 'pipe2(out)' + eos = eos + p_bc = '1.0e5' + T_bc = 728.15 + [../] +[] + +[Postprocessors] + [./TotalMassFlowRateInlet_2] + type = ComponentBoundaryFlow + input = 'pipe2(out)' + [../] + [./Outlet_Temperature_2] + type = ComponentBoundaryVariableValue + variable = temperature + input = 'pipe2(out)' + [../] +[] + +[Preconditioning] + active = 'SMP_PJFNK' + + [./SMP_PJFNK] + type = SMP + full = true + solve_type = 'PJFNK' + petsc_options_iname = '-pc_type' + petsc_options_value = 'lu' + [../] +[] # End preconditioning block + + +[Executioner] + type = Transient + + dt = 1e-1 + dtmin = 1e-5 + + # setting time step range + [./TimeStepper] + type = FunctionDT + function = time_stepper + [../] + + petsc_options_iname = '-ksp_gmres_restart' + petsc_options_value = '100' + + nl_rel_tol = 1e-8 + nl_abs_tol = 1e-7 + nl_max_its = 20 + + l_tol = 1e-5 # Relative linear tolerance for each Krylov solve + l_max_its = 100 # Number of linear iterations for each Krylov solve + + start_time = 0.0 + end_time = 100. + + [./Quadrature] + type = TRAP + order = FIRST + [../] +[] # close Executioner section + +[Outputs] + perf_graph = true + [./out_displaced] + type = Exodus + use_displaced = true + execute_on = 'initial timestep_end' + sequence = false + [../] + [./csv] + type = CSV + [../] + [./console] + type = Console + [../] +[] diff --git a/src/watts_ui/examples/Parametric_SAM_VHTR/sam_template b/src/watts_ui/examples/Parametric_SAM_VHTR/sam_template new file mode 100644 index 00000000..34178bcf --- /dev/null +++ b/src/watts_ui/examples/Parametric_SAM_VHTR/sam_template @@ -0,0 +1,149 @@ +## Component functional requirement test case: PBOneDFluidComponent +## Requirement: Model simplified 1D single phase flow +## with user-specified flow geometry (A and Dh). + +## Acceptance criteria: The inlet mass flow rate (determined by A) +## must match the hand-calculated value within a tolerance of 1e-12. +## The pressure drop for a given constant friction (determined by Dh) +## must match the hand-calculated value within a tolerance of 1e-3. + +A = 3.14e-4 +v = {{ velocity }} +rho = 865.51 +mu = 2.6216e-4 +Dh = {{ Dh }} +# The friction factor is +f = 0.01 +# The inlet flow rate is +m_dot = ${fparse rho*v*A} +# The pressure drop is +dP = ${fparse f/Dh*rho*v*v/2} + +[GlobalParams] + global_init_P = 1.0e5 + global_init_V = ${v} + global_init_T = 628.15 +[] + +[EOS] + [eos] # Simple linearized Sodium approximation + type = PTConstantEOS + p_0 = 1e5 # Pa + rho_0 = ${rho} # kg/m^3 + beta = 2.7524e-4 # K^{-1} + cp = 1272.0 # at Tavg; + h_0 = 7.9898e5 # J/kg + T_0 = 628.15 # K + mu = ${mu} # Pa-s + k = 72 # W/m-K + [] +[] + + +[Components] + [pipe1] + type = PBOneDFluidComponent + eos = eos + position = '0 0 0' + orientation = '0 1 0' + + A = ${A} # Check cross-sectional flow area is used + Dh = ${Dh} # Check hydraulic diameter is used + length = 1.0 + n_elems = 10 + + f = ${f} + [] + + [inlet] + type = PBTDJ + input = 'pipe1(in)' + eos = eos + v_bc = ${v} + T_bc = 628.15 + [] + + [outlet] + type = PBTDV + input = 'pipe1(out)' + eos = eos + p_bc = '1.0e5' + [] +[] + +[Preconditioning] + [SMP_PJFNK] + type = SMP + full = true + solve_type = 'PJFNK' + petsc_options_iname = '-pc_type' + petsc_options_value = 'lu' + [] +[] + +[Postprocessors] + [m_dot_inlet] + type = ComponentBoundaryFlow + input = pipe1(in) + outputs = none + [] + [P_outlet] + type = ComponentBoundaryVariableValue + input = pipe1(out) + variable = pressure + outputs = none + [] + [P_inlet] + type = ComponentBoundaryVariableValue + input = pipe1(in) + variable = pressure + outputs = none + [] + [DeltaP] + type = DifferencePostprocessor + value1 = P_inlet + value2 = P_outlet + outputs = none + [] + [check_requirement_A] + type = PostprocessorComparison + comparison_type = equals + value_a = ${m_dot} + value_b = 'm_dot_inlet' + [] + [check_requirement_Dh] + type = PostprocessorComparison + comparison_type = equals + value_a = ${dP} + value_b = 'DeltaP' + absolute_tolerance = 1e-3 + [] +[] + +[Executioner] + type = Steady + + petsc_options_iname = '-ksp_gmres_restart' + petsc_options_value = '100' + + nl_rel_tol = 1e-8 + nl_abs_tol = 1e-7 + nl_max_its = 20 + l_tol = 1e-4 + l_max_its = 100 + + [Quadrature] + type = TRAP + order = FIRST + [] +[] + +[Outputs] + print_linear_residuals = false + [csv] + type = CSV + [] + [console] + type = Console + [] +[] diff --git a/src/watts_ui/examples/Parametric_SAM_VHTR/watts_comprehensive.son b/src/watts_ui/examples/Parametric_SAM_VHTR/watts_comprehensive.son new file mode 100644 index 00000000..d7545cfa --- /dev/null +++ b/src/watts_ui/examples/Parametric_SAM_VHTR/watts_comprehensive.son @@ -0,0 +1,49 @@ +watts{ + plugins{ + plugin(ID1){ + code = moose +% template = sam_junction_template + template = "/Users/zhieejhiaooi/Documents/ANL/watts-devel/watts/src/watts_ui/examples/1App_SAM_VHTR/sam_junction_template" +% extra_inputs = [input1 input2] + exec_dir= SAM_DIR + exec_name = "sam-opt" + show_stderr = False + show_stdout = False + output = "out.txt" + } + plugin(ID2){ + code = openmc + template = "my_template.tmpl" + extra_inputs = [input1 input2] + } + plugin(ID3){ + code = MCNP + template = "my_template.tmpl" + extra_inputs = [input1 input2] + } + } + + workflow_level1{ + plugin = ID1 + variables{ + param(temperature_inlet) {value = 2.0} + param(friction_factor) {value = 0.1} + param(flow_area) {value = 3.14e-4} + param(country) {value = USA} + param(Dh) {value = 1 unit = m} + param(velocity_inlet) {value = 1} + param(name) {list = [ANL INL ORNL LANL]} + param(size) {list = [30.0 50.4 -60.6 1e-5]} + param(velocity_outlet) {func = "2 * temperature_inlet ** 3"} + param(velocity_outlet_2) {func = "friction_factor + 2 + temperature_inlet ** 3"} + param(wall_bc) {bool = "True"} + } + + parametric{ + changing_params = "heat_source" + changing_values = [0, 1e5, 2e5, 3e5] + + } + } + +} \ No newline at end of file diff --git a/src/watts_ui/examples/Parametric_SAM_VHTR/watts_exec.py b/src/watts_ui/examples/Parametric_SAM_VHTR/watts_exec.py new file mode 100644 index 00000000..6f090991 --- /dev/null +++ b/src/watts_ui/examples/Parametric_SAM_VHTR/watts_exec.py @@ -0,0 +1,65 @@ +# SPDX-FileCopyrightText: 2022 UChicago Argonne, LLC +# SPDX-License-Identifier: MIT + +""" +This example demonstrates how to use WATTS to perform +SAM calculations. This example uses a simple VHTR unit-cell +model with 1 coolant channel surrounded by graphite and fuel. +The demonstration includes the application of unit-conversion +approach in WATTS. After execution of SAM using the MOOSE plugin, +the results stored in CSV files are displayed to the user. +""" + +from math import cos, pi +import os +from pathlib import Path + +import watts +from astropy.units import Quantity + + +params = watts.Parameters() + +# TH params + +params['He_inlet_temp'] = Quantity(600, "Celsius") # 873.15 K +params['He_outlet_temp'] = Quantity(850, "Celsius") # 1123.15 K +params['He_cp'] = Quantity(4.9184126, "BTU/(kg*K)") # 5189.2 J/kg-K +params['He_K'] = 0.32802 # W/m-K +params['He_density'] = 3.8815 # kg/m3 +params['He_viscosity'] = 4.16e-5 # Pa.s +params['He_Pressure'] = Quantity(1015.264164, "psi") # 7e6 Pa +params['Tot_assembly_power'] = 250000 # W + +for i in range(1, 6): + params[f'Init_P_{i}'] = 1 # Fraction + +# Core design params - some are not used in SAM model +params['ax_ref'] = 20 # cm +params['num_cool_pins'] = 1*6+2*6+6*2/2 +params['num_fuel_pins'] = 6+6+6+3*6+2*6/2+6/3 +params['Height_FC'] = Quantity(2000, "mm") # Automatically converts to 'm' for MOOSE and 'cm' for openmc +params['Lattice_pitch'] = 2.0 +params['FuelPin_rad'] = 0.90 # cm +params['cool_hole_rad'] = 0.60 # cm +params['Coolant_channel_diam'] = (params['cool_hole_rad'] * 2)/100 # in m +params['Graphite_thickness'] = (params['Lattice_pitch'] - params['FuelPin_rad'] - params['cool_hole_rad']) # cm +params['Assembly_pitch'] = 7.5 * 2 * params['Lattice_pitch'] / (cos(pi/6) * 2) +params['lbp_rad'] = 0.25 # cm +params['mod_ext_rad'] = 0.90 # cm +params['shell_thick'] = 0.05 # FeCrAl +params['liner_thick'] = 0.007 # Cr +params['control_pin_rad'] = Quantity(9.9, "mm") # Automatically converts to 'm' for MOOSE and 'cm' for openmc + +params.show_summary(show_metadata=False, sort_by='key') + +# MOOSE Workflow +# set your SAM directory as SAM_DIR + +app_dir = Path(os.environ["SAM_DIR"]) +moose_plugin = watts.PluginMOOSE('sam_template', executable=app_dir / 'sam-opt') +moose_result = moose_plugin(params) +for key in moose_result.csv_data: + print(key, moose_result.csv_data[key]) +print(moose_result.inputs) +print(moose_result.outputs) diff --git a/src/watts_ui/examples/PicardIterations_SAM-OpenMC_VHTR/README.md b/src/watts_ui/examples/PicardIterations_SAM-OpenMC_VHTR/README.md new file mode 100644 index 00000000..26177572 --- /dev/null +++ b/src/watts_ui/examples/PicardIterations_SAM-OpenMC_VHTR/README.md @@ -0,0 +1,20 @@ +# PicardIterations_SAM-OpenMC_VHTR + +## Purpose + +This example demonstrates how to use WATTS to perform several iterations where SAM calculations are followed by OpenMC calculation and temperature/power information are exchanged until convergence. + +## Code(s) + +- SAM +- OpenMC + +## Keywords + +- Information transfer from SAM to OpenMC +- Picard iterations until convergence + +## File descriptions + +- [__watts_exec.py__](watts_exec.py): WATTS workflow for this example. This is the file to execute to run the problem described above. +- [__openmc_template__](openmc_template.py): Link to OpenMC templated model. \ No newline at end of file diff --git a/src/watts_ui/examples/PicardIterations_SAM-OpenMC_VHTR/openmc_template.py b/src/watts_ui/examples/PicardIterations_SAM-OpenMC_VHTR/openmc_template.py new file mode 100644 index 00000000..bee18f80 --- /dev/null +++ b/src/watts_ui/examples/PicardIterations_SAM-OpenMC_VHTR/openmc_template.py @@ -0,0 +1,355 @@ +# SPDX-FileCopyrightText: 2022 UChicago Argonne, LLC +# SPDX-License-Identifier: MIT + +from math import sqrt + +import openmc +import openmc.model + + +def build_openmc_model(params): + """ OpenMC Model """ + + materials = [] + + homfuel1 = openmc.Material(name="homfuel_1", temperature=params['avg_Tf_1']) + homfuel1.set_density('g/cm3', 2.2767E+00) + homfuel1.add_nuclide('U235', 4.0841E-02, 'wo') + homfuel1.add_nuclide('U238', 1.6597E-01, 'wo') + homfuel1.add_nuclide('O16', 7.0029E-01, 'wo') + homfuel1.add_element('C', 2.0896E-02, 'wo') + homfuel1.add_nuclide('Si28', 6.6155E-02, 'wo') + homfuel1.add_nuclide('Si29', 3.4772E-03, 'wo') + homfuel1.add_nuclide('Si30', 2.3671E-03, 'wo') + materials.append(homfuel1) + + homfuel2 = openmc.Material(name="homfuel_2", temperature=params['avg_Tf_2']) + homfuel2.set_density('g/cm3', 2.2767E+00) + homfuel2.add_nuclide('U235', 4.0841E-02, 'wo') + homfuel2.add_nuclide('U238', 1.6597E-01, 'wo') + homfuel2.add_nuclide('O16', 7.0029E-01, 'wo') + homfuel2.add_element('C', 2.0896E-02, 'wo') + homfuel2.add_nuclide('Si28', 6.6155E-02, 'wo') + homfuel2.add_nuclide('Si29', 3.4772E-03, 'wo') + homfuel2.add_nuclide('Si30', 2.3671E-03, 'wo') + materials.append(homfuel2) + + homfuel3 = openmc.Material(name="homfuel_1", temperature=params['avg_Tf_3']) + homfuel3.set_density('g/cm3', 2.2767E+00) + homfuel3.add_nuclide('U235', 4.0841E-02, 'wo') + homfuel3.add_nuclide('U238', 1.6597E-01, 'wo') + homfuel3.add_nuclide('O16', 7.0029E-01, 'wo') + homfuel3.add_element('C', 2.0896E-02, 'wo') + homfuel3.add_nuclide('Si28', 6.6155E-02, 'wo') + homfuel3.add_nuclide('Si29', 3.4772E-03, 'wo') + homfuel3.add_nuclide('Si30', 2.3671E-03, 'wo') + materials.append(homfuel3) + + homfuel4 = openmc.Material(name="homfuel_1", temperature=params['avg_Tf_4']) + homfuel4.set_density('g/cm3', 2.2767E+00) + homfuel4.add_nuclide('U235', 4.0841E-02, 'wo') + homfuel4.add_nuclide('U238', 1.6597E-01, 'wo') + homfuel4.add_nuclide('O16', 7.0029E-01, 'wo') + homfuel4.add_element('C', 2.0896E-02, 'wo') + homfuel4.add_nuclide('Si28', 6.6155E-02, 'wo') + homfuel4.add_nuclide('Si29', 3.4772E-03, 'wo') + homfuel4.add_nuclide('Si30', 2.3671E-03, 'wo') + materials.append(homfuel4) + + homfuel5 = openmc.Material(name="homfuel_1", temperature=params['avg_Tf_5']) + homfuel5.set_density('g/cm3', 2.2767E+00) + homfuel5.add_nuclide('U235', 4.0841E-02, 'wo') + homfuel5.add_nuclide('U238', 1.6597E-01, 'wo') + homfuel5.add_nuclide('O16', 7.0029E-01, 'wo') + homfuel5.add_element('C', 2.0896E-02, 'wo') + homfuel5.add_nuclide('Si28', 6.6155E-02, 'wo') + homfuel5.add_nuclide('Si29', 3.4772E-03, 'wo') + homfuel5.add_nuclide('Si30', 2.3671E-03, 'wo') + materials.append(homfuel5) + + boro_ctr = openmc.Material(name="B4C-CTR", temperature=params['temp']) + boro_ctr.set_density('g/cm3', 2.47) + boro_ctr.add_nuclide('B10', 0.16, 'ao') + boro_ctr.add_nuclide('B11', 0.64, 'ao') + boro_ctr.add_element('C', 0.20, 'ao') + materials.append(boro_ctr) + + matrix = openmc.Material(name="matrix", temperature=params['temp']) + matrix.set_density('g/cm3', 1.806) + matrix.add_element('C', 1.0 - 0.0000003, 'ao') + matrix.add_nuclide('B10', 0.0000003, 'ao') + if params['use_sab']: + matrix.add_s_alpha_beta('c_Graphite') + materials.append(matrix) + + refl = openmc.Material(name="BeO", temperature=params['temp']) + refl.set_density('g/cm3', 2.7987) + refl.add_nuclide('Be9', 0.50, 'ao') + refl.add_nuclide('O16', 0.50, 'ao') + if params['use_sab_BeO']: + refl.add_s_alpha_beta('c_Be_in_BeO') + refl.add_s_alpha_beta('c_O_in_BeO') + materials.append(refl) + + yh2 = openmc.Material(name="moderator", temperature=params['temp']) + yh2.set_density('g/cm3', 4.30*0.95) + yh2.add_nuclide('Y89', 0.357142857, 'ao') + yh2.add_nuclide('H1', 0.642857143, 'ao') + if params['use_sab'] and params['use_sab_YH2']: + yh2.add_s_alpha_beta('c_H_in_YH2') + yh2.add_s_alpha_beta('c_Y_in_YH2') + materials.append(yh2) + + coolant = openmc.Material(name="coolant", temperature=params['temp']) + coolant.set_density('g/cm3', 0.00365) + coolant.add_nuclide('He4', 1, 'ao') + materials.append(coolant) + + Cr = openmc.Material(name="Cr", temperature=params['temp']) + Cr.set_density('g/cm3', 7.19) + Cr.add_nuclide('Cr50', -4.345e-2, 'ao') + Cr.add_nuclide('Cr52', -83.789e-2, 'ao') + Cr.add_nuclide('Cr53', -9.501e-2, 'ao') + Cr.add_nuclide('Cr54', -2.365e-2, 'ao') + materials.append(Cr) + + shell_mod = openmc.Material(name="shell_mod", temperature=params['temp']) + shell_mod.set_density('g/cm3', 7.055) # FeCrAl + shell_mod.add_nuclide('Cr50', 20.0e-2 * 4.340E-02,'ao') + shell_mod.add_nuclide('Cr52', 20.0e-2 * 8.381E-01,'ao') + shell_mod.add_nuclide('Cr53', 20.0e-2 * 9.490E-02,'ao') + shell_mod.add_nuclide('Cr54', 20.0e-2 * 2.360E-02,'ao') + shell_mod.add_nuclide('Fe54', 75.5e-2 * 5.800E-02,'ao') + shell_mod.add_nuclide('Fe56', 75.5e-2 * 9.172E-01,'ao') + shell_mod.add_nuclide('Fe57', 75.5e-2 * 2.200E-02,'ao') + shell_mod.add_nuclide('Fe58', 75.5e-2 * 2.800E-03,'ao') + shell_mod.add_nuclide('Al27', 4.5e-2 * 1.000 ,'ao') + materials.append(shell_mod) + + mat_dict = {} + for k,v in list(locals().items()): + if v in materials: + mat_dict[k] = v + + materials_file = openmc.Materials() + for mat in materials: + materials_file.append(mat) + materials_file.export_to_xml() + + Z_min = 0 + Z_cl = params['ax_ref'] + Z_cl_out = params['ax_ref'] - params['shell_thick'] + Z_up = params['ax_ref'] + params['cl'] + Z_up_out = params['ax_ref'] + params['cl'] + params['shell_thick'] + Z_max = params['cl'] + 2 * params['ax_ref'] + + # Create cylinder for fuel and coolant + + fuel_radius = openmc.ZCylinder(x0=0.0, y0=0.0, r=params['FuelPin_rad']) + mod_rad_0 = openmc.ZCylinder(x0=0.0, y0=0.0, r=params['mod_ext_rad'] - params['shell_thick'] - params['liner_thick']) + mod_rad_1a = openmc.ZCylinder(x0=0.0, y0=0.0, r=params['mod_ext_rad'] - params['shell_thick']) + mod_rad_1b = openmc.ZCylinder(x0=0.0, y0=0.0, r=params['mod_ext_rad']) + cool_radius = openmc.ZCylinder(x0=0.0, y0=0.0, r=params['cool_hole_rad']) + ctr_radius = openmc.ZCylinder(x0=0.0, y0=0.0, r=params['control_pin_rad']) + lbp_radius = openmc.ZCylinder(x0=0.0, y0=0.0, r=params['lbp_rad']) + + pin_pitch = params['Lattice_pitch'] + + min_z=openmc.ZPlane(z0=Z_min, boundary_type='vacuum') + max_z=openmc.ZPlane(z0=Z_max, boundary_type='vacuum') + sz_cl=openmc.ZPlane(z0=Z_cl) + + sz_cor1=openmc.ZPlane(z0= Z_cl + 1 * params['cl']/5) + sz_cor2=openmc.ZPlane(z0= Z_cl + 2 * params['cl']/5) + sz_cor3=openmc.ZPlane(z0= Z_cl + 3 * params['cl']/5) + sz_cor4=openmc.ZPlane(z0= Z_cl + 4 * params['cl']/5) + + sz_cl_out=openmc.ZPlane(z0=Z_cl_out) + sz_up=openmc.ZPlane(z0=Z_up) + sz_up_out=openmc.ZPlane(z0=Z_up_out) + cpin_low =openmc.ZPlane(z0=Z_up) + + Hex_Pitch = openmc.model.hexagonal_prism(orientation='x',edge_length=params['Assembly_pitch']/sqrt(3),origin=(0.0, 0.0), + boundary_type = 'reflective') # THIS SHOULD BE REFLECTIVE BONDARY + + + fuel_cell_1_1 = openmc.Cell(name='Fuel Pin', fill=homfuel1 , region=-fuel_radius & +sz_cl & -sz_cor1) + fuel_cell_1_2 = openmc.Cell(name='Fuel Pin', fill=homfuel2 , region=-fuel_radius & +sz_cor1 & -sz_cor2) + fuel_cell_1_3 = openmc.Cell(name='Fuel Pin', fill=homfuel3 , region=-fuel_radius & +sz_cor2 & -sz_cor3) + fuel_cell_1_4 = openmc.Cell(name='Fuel Pin', fill=homfuel4 , region=-fuel_radius & +sz_cor3 & -sz_cor4) + fuel_cell_1_5 = openmc.Cell(name='Fuel Pin', fill=homfuel5 , region=-fuel_radius & +sz_cor4 & -sz_up) + fuel_cell_2 = openmc.Cell(name='matrix', fill=matrix , region=+fuel_radius & +sz_cl & -sz_up) + fuel_cell_3 = openmc.Cell(name='reflL', fill=refl , region=-sz_cl) + fuel_cell_4 = openmc.Cell(name='reflO', fill=refl , region=+sz_up) + fuel_universe= openmc.Universe(cells=(fuel_cell_1_1, fuel_cell_1_2,fuel_cell_1_3,fuel_cell_1_4,fuel_cell_1_5,fuel_cell_2,fuel_cell_3,fuel_cell_4)) + TALLY_REGIONS=[fuel_cell_1_1, fuel_cell_1_2,fuel_cell_1_3,fuel_cell_1_4,fuel_cell_1_5] + + mod_cell_1 = openmc.Cell(name='YH2', fill=yh2, region=-mod_rad_0 & +sz_cl & -sz_up ) + mod_cell_2a = openmc.Cell(name='Liner', fill=Cr , region=+mod_rad_0 & -mod_rad_1a & +sz_cl & -sz_up) + mod_cell_2b = openmc.Cell(name='steel', fill=shell_mod , region=+mod_rad_1a & -mod_rad_1b & +sz_cl & -sz_up) + mod_cell_3 = openmc.Cell(name='matrix', fill=matrix , region=+mod_rad_1b & +sz_cl & -sz_up) + mod_cell_5 = openmc.Cell(name='Plug_L', fill=shell_mod , region=-mod_rad_1b & +sz_cl_out & -sz_cl) + mod_cell_6 = openmc.Cell(name='Plug_LR', fill=refl , region=+mod_rad_1b & +sz_cl_out & -sz_cl) + mod_cell_7 = openmc.Cell(name='Plug_U', fill=shell_mod , region=-mod_rad_1b & +sz_up & -sz_up_out) + mod_cell_8 = openmc.Cell(name='Plug_UR', fill=refl , region=+mod_rad_1b & +sz_up & -sz_up_out) + mod_cell_9 = openmc.Cell(name='LowRef', fill=refl , region=-sz_cl_out) + mod_cell_10 = openmc.Cell(name='UpRef', fill=refl , region=+sz_up) + mod_universe= openmc.Universe(cells=(mod_cell_1,mod_cell_2a, mod_cell_2b,mod_cell_3,mod_cell_5,mod_cell_6,mod_cell_7,mod_cell_8,mod_cell_9,mod_cell_10)) + + coolant_cell_1 = openmc.Cell(name='coolant', fill=coolant , region=-cool_radius) + coolant_cell_2 = openmc.Cell(name='matrix', fill=matrix , region=+cool_radius & +sz_cl & -sz_up) + coolant_cell_3 = openmc.Cell(name='reflL', fill=refl , region=+cool_radius & -sz_cl) + coolant_cell_4 = openmc.Cell(name='reflO', fill=refl , region=+cool_radius & +sz_up) + coolant_universe= openmc.Universe(cells=(coolant_cell_1,coolant_cell_2,coolant_cell_3,coolant_cell_4)) + + ctr_cell_1a = openmc.Cell(name='coolant', fill=coolant , region=-ctr_radius & +sz_cl & -cpin_low) + ctr_cell_1b = openmc.Cell(name='abs', fill=boro_ctr , region=-ctr_radius & +cpin_low) + ctr_cell_1c = openmc.Cell(name='refl', fill=refl , region=-ctr_radius & -sz_cl) + ctr_cell_2 = openmc.Cell(name='matrix', fill=matrix , region=+ctr_radius & +sz_cl & -sz_up) + ctr_cell_3 = openmc.Cell(name='reflL', fill=refl , region=+ctr_radius & -sz_cl) + ctr_cell_4 = openmc.Cell(name='reflO', fill=refl , region=+ctr_radius & +sz_up) + ctr_universe= openmc.Universe(cells=(ctr_cell_1a,ctr_cell_1b,ctr_cell_1c, ctr_cell_2,ctr_cell_3,ctr_cell_4)) + + Graph_cell_1= openmc.Cell(name='Graph cell', fill=matrix) + Graph_universe= openmc.Universe(cells=(Graph_cell_1,)) + + # Fill the hexagone with fuel and coolant cells + + assembly_description=[[]]*6 + assembly_description[5]=([ctr_universe]) + assembly_description[4] =([fuel_universe])*6 + assembly_description[3] =([fuel_universe]+[coolant_universe])*6 + assembly_description[2] =([coolant_universe] + [fuel_universe] + [mod_universe] + [coolant_universe] + [fuel_universe] + [mod_universe])*3 + assembly_description[1] =([fuel_universe]+[fuel_universe]+[coolant_universe]+[fuel_universe])*6 + assembly_description[0] =([fuel_universe]+[coolant_universe]+[fuel_universe]+[fuel_universe]+[coolant_universe])*6 + #print(assembly_description) + + lat_core = openmc.HexLattice() + lat_core.center=(0,0) + lat_core.pitch=[pin_pitch] + lat_core.outer=Graph_universe + lat_core.universes=assembly_description + # print(lat_core) + rotated_lat_core = openmc.Cell(fill=lat_core) + rotated_universe_lat_core = openmc.Universe(cells=(rotated_lat_core,)) + new_cell_lat_core=openmc.Cell() + new_cell_lat_core.fill=rotated_universe_lat_core + new_cell_lat_core.rotation=(0.,0.,90.) + new_universe_lat_core = openmc.Universe(cells=(new_cell_lat_core,)) + + main_cell = openmc.Cell(name="MainCell",fill=new_universe_lat_core, region=Hex_Pitch & +min_z & -max_z ) + + + # OpenMC expects that there is a root universe assigned number zero. Here we + # assign our three cells to this root universe. + root_universe = openmc.Universe(name='root universe', cells=(main_cell,)) + + # Finally we must create a geometry and assign the root universe + geometry = openmc.Geometry() + geometry.root_universe = root_universe + geometry.export_to_xml() + + # Now let's define our simulation parameters. These will go into our + # settings.xml via the SettingsFile object. + batches = 100 + inactive = 30 + particles = 5000 + + # Instantiate a SettingsFile + settings_file = openmc.Settings() + settings_file.run_mode = 'eigenvalue' + settings_file.cross_sections = '/software/openmc/data/v0.12pre-3/lanl_endfb80/cross_sections.xml' + settings_file.batches = batches + settings_file.inactive = inactive + settings_file.particles = particles + settings_file.material_cell_offsets = False + settings_file.temperature = {'method' : 'interpolation'} + + source = openmc.Source() + ll = [-params['Assembly_pitch']/4, -params['Assembly_pitch']/4, Z_min] + ur = [params['Assembly_pitch']/4, params['Assembly_pitch']/4, Z_max] + source.space = openmc.stats.Box(ll, ur) + source.strength = 1.0 + settings_file.source = source + + #lower_left, upper_right = main_cell.region.bounding_box + + list_tally_cell = [cell.id for cell in TALLY_REGIONS] + list_tally_scores = ['flux', 'nu-fission'] + cell_filter = openmc.CellFilter(list_tally_cell) + tally_file = openmc.Tally() + tally_file.filters.append(cell_filter) + tally_file.scores = list_tally_scores + tallies = openmc.Tallies() + tallies.append(tally_file) + tallies.export_to_xml() + + settings_file.export_to_xml() + + # Create a plots.xml file + radius = params['Assembly_pitch']/sqrt(3) + p1 = openmc.Plot() + p1.origin = (0, 0, (Z_max-Z_min)/2) + p1.width = (radius*2, radius*2) + p1.pixels = (2000, 2000) + p1.color = 'mat' + p1.basis = 'xy' + p1.color_by = 'material' + p1.col_spec = { + homfuel1.id: (255, 0, 0), + homfuel2.id: (255, 0, 0), + homfuel3.id: (255, 0, 0), + homfuel4.id: (255, 0, 0), + homfuel5.id: (255, 0, 0), + matrix.id: (100, 100, 100), + yh2.id: (20, 200, 50), + boro_ctr.id: (200, 20, 50), + shell_mod.id: (150,150,150), + coolant.id: (180,110,150), + refl.id: (80,210,50) + } + p2 = openmc.Plot() + p2.origin = (0, 0, (Z_max-Z_min)/2) + p2.width = (radius*2, Z_max) + p2.pixels = (200, 2000) + p2.color = 'mat' + p2.basis ='yz' + p2.color_by = 'material' + p2.col_spec = { + homfuel1.id: (255, 0, 0), + homfuel2.id: (255, 0, 0), + homfuel3.id: (255, 0, 0), + homfuel4.id: (255, 0, 0), + homfuel5.id: (255, 0, 0), + matrix.id: (100, 100, 100), + yh2.id: (20, 200, 50), + boro_ctr.id: (200, 20, 50), + shell_mod.id: (150,150,150), + coolant.id: (180,110,150), + refl.id: (80,210,50) + } + p3 = openmc.Plot() + p3.origin = (0, 0, (Z_max-1)) + p3.width = (radius*2, radius*2) + p3.pixels = (2000, 2000) + p3.color = 'mat' + p3.basis = 'xy' + p3.color_by = 'material' + p3.col_spec = { + homfuel1.id: (255, 0, 0), + homfuel2.id: (255, 0, 0), + homfuel3.id: (255, 0, 0), + homfuel4.id: (255, 0, 0), + homfuel5.id: (255, 0, 0), + matrix.id: (100, 100, 100), + yh2.id: (20, 200, 50), + boro_ctr.id: (200, 20, 50), + shell_mod.id: (150,150,150), + coolant.id: (180,110,150), + refl.id: (80,210,50) + } + plots = openmc.Plots() + plots.append(p1) + plots.append(p2) + plots.append(p3) + plots.export_to_xml() diff --git a/src/watts_ui/examples/PicardIterations_SAM-OpenMC_VHTR/sam_template b/src/watts_ui/examples/PicardIterations_SAM-OpenMC_VHTR/sam_template new file mode 100644 index 00000000..6742c196 --- /dev/null +++ b/src/watts_ui/examples/PicardIterations_SAM-OpenMC_VHTR/sam_template @@ -0,0 +1,574 @@ + + {#- + Create variables + #} + {%- set Mass_flow_rate = Tot_assembly_power / (He_cp * (He_outlet_temp - He_inlet_temp)) %} + {%- set Channel_mass_flow_rate = Mass_flow_rate / num_cool_pins %} + {%- set Coolant_channel_XS = 3.14 * (Coolant_channel_diam/2)**2 %} + {%- set He_velocity = Channel_mass_flow_rate / (He_density * Coolant_channel_XS) %} + {%- set Re_num = Coolant_channel_diam * He_velocity * He_density / He_viscosity %} + {%- set Prandtl_num = He_cp * He_viscosity / He_K %} + {%- set F_blausius = (100*Re_num)**(-0.25) %} + {%- set Nu_DittBoe = 0.023 * (Re_num ** 0.8) * (Prandtl_num ** 0.4) %} + {%- set H_sam = Nu_DittBoe * He_K / Coolant_channel_diam %} + {%- set total_XS_coolant_area_per_fuel_assembly = Coolant_channel_XS * num_cool_pins %} + {%- set surface_area_den = num_fuel_pins * 3.14 * 2 * (FuelPin_rad + Graphite_thickness) / (100 * num_cool_pins * Coolant_channel_XS) %} + {%- set Power_fuel_pin = Tot_assembly_power / (num_fuel_pins) %} + {%- set graph_x = Coolant_channel_diam / 2 + Graphite_thickness / 100 %} + {%- set fuel_x = graph_x + FuelPin_rad / 100 %} + {#- + Render the parameters + #} + +[GlobalParams] + global_init_P = {{ He_Pressure }} + global_init_V = {{ He_velocity }} + global_init_T = {{ He_inlet_temp }} + gravity = '-9.8 0 0' + scaling_factor_var = '1 1e-3 1e-6' + Tsolid_sf = 1e-3 # Scaling factors for solid temperature +[] +[Functions] + active = 'power_dist kf cpf kclad cpclad rhoclad kgraphite cpgraphite rhographite kHe cpHe rhoHe muHe HHe beta_fn' + # [./power_dist] # Function name + # type = PiecewiseLinear # Function type + # axis = x # X-co-ordinate is used for x + # x = ' 0.0 0.5 1.0 1.5 2.0' + # y = ' {{ Init_P_1 }} {{ Init_P_2 }} {{ Init_P_3 }} {{ Init_P_4 }} {{ Init_P_5 }}' + # [../] + + [./power_dist] # Function name + type = PiecewiseLinear # Function type + axis = x # X-co-ordinate is used for x + x = ' 0.0 0.5 1.0 1.5 2.0' + y = ' 1.0 1.0 1.0 1.0 1.0' + [../] + + + [./kf] #fuel thermal conductivity (UO2); x- Temperature [K], y- Thermal condiuctivity [W/m-K] + type = PiecewiseLinear + x ='600 700 800 900 1000 1100 1200 1300 1400 1500' + y ='55.6153061 51.02219975 47.11901811 43.95203134 41.16924224 38.85202882 36.89323509 35.04777834 33.20027175 31.3520767' + [../] + [./cpf] #fuel matrix specific heat (UO2); x- Temperature [K], y- sp. heat [J/kg-K] + type = PiecewiseLinear + x ='300 325 350 375 400 425 450 475 500 525 550 575 600 625 650 675 700 725 750 775 800 825 850 875 900 925 950 975 1000 1025 1050 1075 1100 1125 1150 1175 1200 1225 1250 1275 1300 1325 1350 1375 1400 1425 1450 1475 1500' + y ='44.87198213 57.09373669 71.35471375 87.81224925 106.6236791 127.9463393 151.9375658 178.7546944 208.5550611 241.4960019 277.7348528 317.4289495 360.7356281 407.8122246 458.8160748 513.9045146 573.2348801 636.9645072 705.2507318 778.2508898 856.1223171 939.0223498 1027.108324 1120.537575 1219.467439 1324.055252 1434.458351 1550.83407 1673.339746 1802.132715 1937.370313 2079.209875 2227.808738 2383.324238 2545.91371 2715.73449 2892.943915 3077.69932 3270.158042 3470.477415 3678.814777 3895.327463 4120.172809 4353.508151 4595.490824 4846.278166 5106.027511 5374.896196 5653.041556' + [../] + [./kclad] #clad therm. cond; x- Temperature [K], y-Thermal condiuctivity [W/m-K] + type = PiecewiseLinear + x ='0 478.1709374 571.7659 668.7480342 769.1357153 871.2212698 969.9012774 1068.58496 1167.263743 1274.445367 2118.255351 5000' + y ='3.812850324 3.812850324 3.453993823 3.678279136 3.812850324 4.0819927 4.440849201 4.665134514 5.068848078 5.651989892 11.43855097 11.43855097' + [../] + [./cpclad] #clad specific heat; x- Temperature [K], y- sp. heat [J/kg-K] + type = PiecewiseLinear + x ='300 325 350 375 400 425 450 475 500 525 550 575 600 625 650 675 700 725 750 775 800 825 850 875 900 925 950 975 1000 1025 1050 1075 1100 1125 1150 1175 1200 1225 1250 1275 1300 1325 1350 1375 1400 1425 1450 1475 1500' + y ='286.38 288.94 291.5 294.06 296.62 299.18 301.74 304.3 306.86 309.42 311.98 314.54 317.1 319.66 322.22 324.78 327.34 329.9 332.46 335.02 337.58 340.14 342.7 345.26 347.82 350.38 352.94 355.5 358.06 360.62 363.18 365.74 336.785 335.2703125 333.95125 332.8278125 331.9 331.1678125 330.63125 330.2903125 330.145 330.1953125 330.44125 330.8828125 331.52 332.3528125 333.38125 334.6053125 336.025' + [../] + [./rhoclad] #clad density; x- Temperature [K], y- density [kg/m3] + type = PiecewiseLinear + x ='300 325 350 375 400 425 450 475 500 525 550 575 600 625 650 675 700 725 750 775 800 825 850 875 900 925 950 975 1000 1025 1050 1075 1100 1125 1150 1175 1200 1225 1250 1275 1300 1325 1350 1375 1400 1425 1450 1475 1500' + y ='6550.89 6547.1975 6543.505 6539.8125 6536.12 6532.4275 6528.735 6525.0425 6521.35 6517.6575 6513.965 6510.2725 6506.58 6502.8875 6499.195 6495.5025 6491.81 6488.1175 6484.425 6480.7325 6477.04 6473.3475 6469.655 6465.9625 6462.27 6458.5775 6454.885 6451.1925 6447.5 6443.8075 6440.115 6436.4225 6485.95 6481.3125 6476.675 6472.0375 6467.4 6462.7625 6458.125 6453.4875 6448.85 6444.2125 6439.575 6434.9375 6430.3 6425.6625 6421.025 6416.3875 6411.75' + [../] + [./kgraphite] #G-348 graphite therm. cond; x- Temperature [K], y-Thermal condiuctivity [W/m-K] + type = PiecewiseLinear + x ='295.75 374.15 472.45 574.75 674.75 774.75 874.75 974.85 1074.45 1173.95 1274.05' + y ='133.02 128.54 117.62 106.03 96.7 88.61 82.22 76.52 71.78 67.88 64.26' + [../] + [./cpgraphite] #G-348 graphite specific heat; x- Temperature [K], y- sp. heat [J/kg-K] + type = PiecewiseLinear + x ='295.75 374.15 472.45 574.75 674.75 774.75 874.75 974.85 1074.45 1173.95 1274.05' + y ='726.19 933.15 1154.47 1341.07 1486.83 1603.53 1697.43 1773.6 1835.58 1886.68 1929.44' + [../] + [./rhographite] #G-348 graphite density; x- Temperature [K], y- density [kg/m3] + type = PiecewiseLinear + x ='295.75 374.15 472.45 574.75 674.75 774.75 874.75 974.85 1074.45 1173.95 1274.05' + y ='1888.5 1886.3 1883.5 1880.4 1877.2 1873.9 1870.5 1867 1863.4 1859.6 1855.7' + [../] + [./kHe] #Helium therm. cond; x- Temperature [K], y-Thermal condiuctivity [W/m-K] + type = PiecewiseLinear + x ='300 320 340 360 380 400 420 440 460 480 500 520 540 560 580 600 620 640 660 680 700 720 740 760 780 800 820 840 860 880 900 920 940 960 980 1000 1020 1040 1060 1080 1100 1120 1140 1160 1180 1200 1220 1240 1260 1280 1300 1320 1340 1360 1380 1400 1420 1440 1460 1480 1500' + y ='0.16053 0.16754 0.17444 0.18123 0.18792 0.19451 0.20102 0.20743 0.21377 0.22003 0.22622 0.23233 0.23838 0.24437 0.2503 0.25616 0.26198 0.26773 0.27344 0.27909 0.2847 0.29026 0.29578 0.30126 0.30669 0.31208 0.31743 0.32275 0.32802 0.33327 0.33847 0.34365 0.34879 0.3539 0.35897 0.36402 0.36904 0.37403 0.37899 0.38392 0.38883 0.39371 0.39856 0.40339 0.4082 0.41298 0.41774 0.42248 0.42719 0.43188 0.43655 0.4412 0.44583 0.45043 0.45502 0.45959 0.46414 0.46867 0.47318 0.47767 0.48215' + [../] + [./muHe] #Helium viscosity; x- Temperature [K], y-viscosity [Pa.s] + type = PiecewiseLinear + x ='300 320 340 360 380 400 420 440 460 480 500 520 540 560 580 600 620 640 660 680 700 720 740 760 780 800 820 840 860 880 900 920 940 960 980 1000 1020 1040 1060 1080 1100 1120 1140 1160 1180 1200 1220 1240 1260 1280 1300 1320 1340 1360 1380 1400 1420 1440 1460 1480 1500' + y ='0.00002016 0.0002148 0.000021921 0.000022782 0.00002363 0.000024467 0.000025294 0.00002611 0.000026917 0.000027715 0.000028504 0.000029285 0.000030058 0.000030823 0.000031582 0.000032333 0.000033078 0.000033816 0.000034549 0.000035275 0.000035996 0.000036711 0.00003742 0.000038125 0.000038825 0.00003952 0.00004021 0.000040895 0.000041576 0.000042253 0.000042926 0.000043595 0.00004426 0.00004492 0.000045578 0.000046231 0.000046881 0.000047528 0.000048171 0.000048811 0.000049447 0.000050081 0.000050711 0.000051338 0.000051963 0.000052584 0.000053203 0.000053818 0.000054432 0.000055042 0.00005565 0.000056255 0.000056858 0.000057458 0.000058056 0.000058651 0.000059244 0.000059835 0.000060424 0.00006101 0.000061594' + [../] + [./cpHe] #Helium specific heat; x- Temperature [K], y- sp. heat [J/kg-K] + type = PiecewiseLinear + x ='300 320 340 360 380 400 420 440 460 480 500 520 540 560 580 600 620 640 660 680 700 720 740 760 780 800 820 840 860 880 900 920 940 960 980 1000 1020 1040 1060 1080 1100 1120 1140 1160 1180 1200 1220 1240 1260 1280 1300 1320 1340 1360 1380 1400 1420 1440 1460 1480 1500' + y ='5188.5 5188 5187.6 5187.4 5187.2 5187.2 5187.1 5187.2 5187.2 5187.3 5187.4 5187.5 5187.6 5187.7 5187.8 5187.9 5188 5188.1 5188.2 5188.3 5188.4 5188.5 5188.7 5188.8 5188.8 5188.9 5189 5189.1 5189.2 5189.3 5189.4 5189.5 5189.5 5189.6 5189.7 5189.7 5189.8 5189.9 5189.9 5190 5190.1 5190.1 5190.2 5190.2 5190.3 5190.3 5190.4 5190.4 5190.5 5190.5 5190.6 5190.6 5190.7 5190.7 5190.7 5190.8 5190.8 5190.8 5190.9 5190.9 5190.9' + [../] + [./rhoHe] #Helium density; x- Temperature [K], y- density [kg/m3] + type = PiecewiseLinear + x ='300 320 340 360 380 400 420 440 460 480 500 520 540 560 580 600 620 640 660 680 700 720 740 760 780 800 820 840 860 880 900 920 940 960 980 1000 1020 1040 1060 1080 1100 1120 1140 1160 1180 1200 1220 1240 1260 1280 1300 1320 1340 1360 1380 1400 1420 1440 1460 1480 1500' + y ='10.883 10.225 9.6425 9.1224 8.6555 8.234 7.8516 7.5031 7.1842 6.8912 6.6212 6.3715 6.14 5.9246 5.7239 5.5363 5.3605 5.1956 5.0405 4.8944 4.7565 4.6262 4.5028 4.3858 4.2747 4.1691 4.0686 3.9729 3.8815 3.7942 3.7108 3.6309 3.5545 3.4811 3.4108 3.3432 3.2782 3.2157 3.1556 3.0976 3.0418 2.9879 2.9359 2.8857 2.8371 2.7902 2.7448 2.7009 2.6583 2.617 2.577 2.5383 2.5006 2.4641 2.4286 2.3941 2.3606 2.328 2.2963 2.2655 2.2354' + [../] + [./HHe] #Helium Enthalpy; x- Temperature [K], y- denthalpy [j/kg] + type = PiecewiseLinear + x ='300 320 340 360 380 400 420 440 460 480 500 520 540 560 580 600 620 640 660 680 700 720 740 760 780 800 820 840 860 880 900 920 940 960 980 1000 1020 1040 1060 1080 1100 1120 1140 1160 1180 1200 1220 1240 1260 1280 1300 1320 1340 1360 1380 1400 1420 1440 1460 1480 1500' + y ='1585700 1689500 1793300 1897000 2000800 2104500 2208200 2312000 2415700 2519500 2623200 2727000 2830700 2934500 3038200 3142000 3245700 3349500 3453300 3557000 3660800 3764600 3868300 3972100 4075900 4179700 4283400 4387200 4491000 4594800 4698600 4802400 4906200 5010000 5113700 5217500 5321300 5425100 5528900 5632700 5736500 5840300 5944100 6047900 6151700 6255600 6359400 6463200 6567000 6670800 6774600 6878400 6982200 7086000 7189800 7293700 7397500 7501300 7605100 7708900 7812700' + [../] + [./beta_fn] + type = PiecewiseLinear + x = '300 2000' + y = '0 0' + [../] + + [./T_max_fuel] + type = ParsedFunction + value = Tf1+Tf2 + vars = 'Tf1 Tf2' + vals = 'max_Tf_1 max_Tf_2' + [../] + +[] +[EOS] + [./eos] + type = PTFluidPropertiesEOS + p_0 = {{ He_Pressure }} # Pa + fp = fluid_props1 + [../] +[] +[MaterialProperties] + [./fluid_props1] + type = FunctionFluidProperties + rho = rhoHe + beta = beta_fn + cp = cpHe + mu = muHe + k = kHe + enthalpy = HHe + [../] + [./fuel-mat] # Material name + type = SolidMaterialProps + k = kf # Thermal conductivity + Cp = cpf # Specific heat + rho = 1.104e4 # Density + [../] + [./clad-mat] # Material name + type = SolidMaterialProps + k = kgraphite # Thermal conductivity + Cp = cpgraphite # Specific heat + rho = rhographite # Density + [../] + [./graphite-mat] # Material name + type = SolidMaterialProps + k = kgraphite # Thermal conductivity + Cp = cpgraphite # Specific heat + rho = rhographite # Density + [../] + [./leadBUF-mat] # Material name + type = SolidMaterialProps + k = kgraphite # Thermal conductivity + Cp = cpgraphite # Specific heat + rho = rhographite # Density + [../] +[] +[Components] + [./reactor] + type = ReactorPower + initial_power = {{ Tot_assembly_power }} # Initial total reactor power + [../] + + [./CH1] # Component name + type = PBCoreChannel # PBCorechannel component + eos = eos # The equation-of-state name + position = '0 {{Height_FC/5 * 0}} 0' + orientation = '0 1 0' + assembly_type = Block-Channel + n_rods = {{ num_fuel_pins }} + A = {{ total_XS_coolant_area_per_fuel_assembly }} + Dh = {{ Coolant_channel_diam }} + length = {{ Height_FC/5 }} + n_elems = 20 + f = {{ F_blausius }} # User specified friction coefficient (Blausis f=(100 Re)^-0.25 + Hw = {{ H_sam }} # User specified heat transfer coefficient (Dittus-Boelter) + HT_surface_area_density = {{ surface_area_den }} # Heat transfer surface area density, Ph/Ac + name_of_hs = 'fuel graphite' # Heat structure names + Ts_init = {{ He_inlet_temp }} # Initial structure temeprature + n_heatstruct = 2 # Number of heat structures + fuel_type = cylinder # Fuel geometric type, cylinder or plate + width_of_hs = '{{FuelPin_rad/100}} {{ Graphite_thickness/100 }}' # The width of all heat structures + elem_number_of_hs = '50 10' # The element numbers of all heat structures + material_hs = 'fuel-mat graphite-mat' # The material used for all heat structures + power_fraction = '0.2 0.0' # The power fractions of all heat structures + power_shape_function = power_dist # the axial power shape function name + [../] + + [./CH2] # Component name + type = PBCoreChannel # PBCorechannel component + eos = eos # The equation-of-state name + position = '0 {{Height_FC/5 * 1}} 0' + orientation = '0 1 0' + assembly_type = Block-Channel + n_rods = {{ num_fuel_pins }} + A = {{ total_XS_coolant_area_per_fuel_assembly }} + Dh = {{ Coolant_channel_diam }} + length = {{ Height_FC/5 }} + n_elems = 20 + f = {{ F_blausius }} # User specified friction coefficient (Blausis f=(100 Re)^-0.25 + Hw = {{ H_sam }} # User specified heat transfer coefficient (Dittus-Boelter) + HT_surface_area_density = {{ surface_area_den }} # Heat transfer surface area density, Ph/Ac + name_of_hs = 'fuel graphite' # Heat structure names + Ts_init = {{ He_inlet_temp }} # Initial structure temeprature + n_heatstruct = 2 # Number of heat structures + fuel_type = cylinder # Fuel geometric type, cylinder or plate + width_of_hs = '{{FuelPin_rad/100}} {{ Graphite_thickness/100 }}' # The width of all heat structures + elem_number_of_hs = '50 10' # The element numbers of all heat structures + material_hs = 'fuel-mat graphite-mat' # The material used for all heat structures + power_fraction = '0.2 0.0' # The power fractions of all heat structures + power_shape_function = power_dist # the axial power shape function name + [../] + + [./CH3] # Component name + type = PBCoreChannel # PBCorechannel component + eos = eos # The equation-of-state name + position = '0 {{Height_FC/5 * 2}} 0' + orientation = '0 1 0' + assembly_type = Block-Channel + n_rods = {{ num_fuel_pins }} + A = {{ total_XS_coolant_area_per_fuel_assembly }} + Dh = {{ Coolant_channel_diam }} + length = {{ Height_FC/5 }} + n_elems = 20 + f = {{ F_blausius }} # User specified friction coefficient (Blausis f=(100 Re)^-0.25 + Hw = {{ H_sam }} # User specified heat transfer coefficient (Dittus-Boelter) + HT_surface_area_density = {{ surface_area_den }} # Heat transfer surface area density, Ph/Ac + name_of_hs = 'fuel graphite' # Heat structure names + Ts_init = {{ He_inlet_temp }} # Initial structure temeprature + n_heatstruct = 2 # Number of heat structures + fuel_type = cylinder # Fuel geometric type, cylinder or plate + width_of_hs = '{{FuelPin_rad/100}} {{ Graphite_thickness/100 }}' # The width of all heat structures + elem_number_of_hs = '50 10' # The element numbers of all heat structures + material_hs = 'fuel-mat graphite-mat' # The material used for all heat structures + power_fraction = '0.2 0.0' # The power fractions of all heat structures + power_shape_function = power_dist # the axial power shape function name + [../] + + [./CH4] # Component name + type = PBCoreChannel # PBCorechannel component + eos = eos # The equation-of-state name + position = '0 {{Height_FC/5 * 3}} 0' + orientation = '0 1 0' + assembly_type = Block-Channel + n_rods = {{ num_fuel_pins }} + A = {{ total_XS_coolant_area_per_fuel_assembly }} + Dh = {{ Coolant_channel_diam }} + length = {{ Height_FC/5 }} + n_elems = 20 + f = {{ F_blausius }} # User specified friction coefficient (Blausis f=(100 Re)^-0.25 + Hw = {{ H_sam }} # User specified heat transfer coefficient (Dittus-Boelter) + HT_surface_area_density = {{ surface_area_den }} # Heat transfer surface area density, Ph/Ac + name_of_hs = 'fuel graphite' # Heat structure names + Ts_init = {{ He_inlet_temp }} # Initial structure temeprature + n_heatstruct = 2 # Number of heat structures + fuel_type = cylinder # Fuel geometric type, cylinder or plate + width_of_hs = '{{FuelPin_rad/100}} {{ Graphite_thickness/100 }}' # The width of all heat structures + elem_number_of_hs = '50 10' # The element numbers of all heat structures + material_hs = 'fuel-mat graphite-mat' # The material used for all heat structures + power_fraction = '0.2 0.0' # The power fractions of all heat structures + power_shape_function = power_dist # the axial power shape function name + [../] + + [./CH5] # Component name + type = PBCoreChannel # PBCorechannel component + eos = eos # The equation-of-state name + position = '0 {{Height_FC/5 * 4}} 0' + orientation = '0 1 0' + assembly_type = Block-Channel + n_rods = {{ num_fuel_pins }} + A = {{ total_XS_coolant_area_per_fuel_assembly }} + Dh = {{ Coolant_channel_diam }} + length = {{ Height_FC/5 }} + n_elems = 20 + f = {{ F_blausius }} # User specified friction coefficient (Blausis f=(100 Re)^-0.25 + Hw = {{ H_sam }} # User specified heat transfer coefficient (Dittus-Boelter) + HT_surface_area_density = {{ surface_area_den }} # Heat transfer surface area density, Ph/Ac + name_of_hs = 'fuel graphite' # Heat structure names + Ts_init = {{ He_inlet_temp }} # Initial structure temeprature + n_heatstruct = 2 # Number of heat structures + fuel_type = cylinder # Fuel geometric type, cylinder or plate + width_of_hs = '{{FuelPin_rad/100}} {{ Graphite_thickness/100 }}' # The width of all heat structures + elem_number_of_hs = '50 10' # The element numbers of all heat structures + material_hs = 'fuel-mat graphite-mat' # The material used for all heat structures + power_fraction = '0.2 0.0' # The power fractions of all heat structures + power_shape_function = power_dist # the axial power shape function name + [../] + + [./junc_CH1_CH2] + type = PBSingleJunction + eos = eos + inputs = 'CH1(out)' + outputs = 'CH2(in)' + [../] + [./junc_CH2_CH3] + type = PBSingleJunction + eos = eos + inputs = 'CH2(out)' + outputs = 'CH3(in)' + [../] + [./junc_CH3_CH4] + type = PBSingleJunction + eos = eos + inputs = 'CH3(out)' + outputs = 'CH4(in)' + [../] + [./junc_CH4_CH5] + type = PBSingleJunction + eos = eos + inputs = 'CH4(out)' + outputs = 'CH5(in)' + [../] + + + [./inlet] #Boundary components + type = PBTDJ + input = 'CH1(in)' + v_bc = {{ He_velocity }} + T_bc = {{ He_inlet_temp }} + eos = eos + [../] + [./outlet] + type = PBTDV + input = 'CH5(out)' + p_bc = '{{ He_Pressure }}' + T_bc = {{ He_outlet_temp }} + eos = eos + [../] +[] +[Postprocessors] + +# [max_Tf] +# type = ParsedPostprocessor +# function = 'max(max(max_Tf_1,max_Tf_2),max(max_Tf_3,max(max_Tf_4,max_Tf_5)))' +# pp_names = 'max_Tf_1 max_Tf_2 max_Tf_3 max_Tf_4 max_Tf_5' +# [] +# +# [avg_Tgraphite] +# type = ParsedPostprocessor +# function = '(avg_Tgraphite_1+avg_Tgraphite_2+avg_Tgraphite_3+avg_Tgraphite_4+avg_Tgraphite_5)/5' +# pp_names = 'avg_Tgraphite_1 avg_Tgraphite_2 avg_Tgraphite_3 avg_Tgraphite_4 avg_Tgraphite_5' +# [] + + [./max_Tcoolant] # Output maximum fluid temperature of block CH1:pipe + type = NodalMaxValue + block = 'CH1:pipe' + variable = temperature + [../] + [./max_Tw] # Output maximum wall temperature of block CH1:pipe + type = NodalMaxValue + block = 'CH1:pipe' + variable = Tw + [../] + [./max_Tf_1] # Output maximum solid temperature of block CH1: solid:fuel + type = NodalMaxValue + block = 'CH1:solid:fuel' + variable = T_solid + [../] + [./max_Tf_2] # Output maximum solid temperature of block CH1: solid:fuel + type = NodalMaxValue + block = 'CH2:solid:fuel' + variable = T_solid + [../] + [./max_Tf_3] # Output maximum solid temperature of block CH1: solid:fuel + type = NodalMaxValue + block = 'CH3:solid:fuel' + variable = T_solid + [../] + [./max_Tf_4] # Output maximum solid temperature of block CH1: solid:fuel + type = NodalMaxValue + block = 'CH4:solid:fuel' + variable = T_solid + [../] + [./max_Tf_5] # Output maximum solid temperature of block CH1: solid:fuel + type = NodalMaxValue + block = 'CH5:solid:fuel' + variable = T_solid + [../] + [./max_Tgraphite_1] # Output maximum solid temperature of block CH1: solid:fuel + type = NodalMaxValue + block = 'CH1:solid:graphite' + variable = T_solid + [../] + [./max_Tgraphite_2] # Output maximum solid temperature of block CH1: solid:fuel + type = NodalMaxValue + block = 'CH2:solid:graphite' + variable = T_solid + [../] + [./max_Tgraphite_3] # Output maximum solid temperature of block CH1: solid:fuel + type = NodalMaxValue + block = 'CH3:solid:graphite' + variable = T_solid + [../] + [./max_Tgraphite_4] # Output maximum solid temperature of block CH1: solid:fuel + type = NodalMaxValue + block = 'CH4:solid:graphite' + variable = T_solid + [../] + [./max_Tgraphite_5] # Output maximum solid temperature of block CH1: solid:fuel + type = NodalMaxValue + block = 'CH5:solid:graphite' + variable = T_solid + [../] + + [./max_Pcoolant_1] # Output maximum fluid temperature of block CH1:pipe + type = NodalMaxValue + block = 'CH1:pipe' + variable = pressure + [../] + [./max_Pcoolant_2] # Output maximum fluid temperature of block CH1:pipe + type = NodalMaxValue + block = 'CH2:pipe' + variable = pressure + [../] + [./max_Pcoolant_3] # Output maximum fluid temperature of block CH1:pipe + type = NodalMaxValue + block = 'CH3:pipe' + variable = pressure + [../] + [./max_Pcoolant_4] # Output maximum fluid temperature of block CH1:pipe + type = NodalMaxValue + block = 'CH4:pipe' + variable = pressure + [../] + [./max_Pcoolant_5] # Output maximum fluid temperature of block CH1:pipe + type = NodalMaxValue + block = 'CH5:pipe' + variable = pressure + [../] + + [./avg_Tcoolant_1] # Output maximum fluid temperature of block CH1:pipe + type = ElementAverageValue + block = 'CH1:pipe' + variable = temperature + [../] + [./avg_Tcoolant_2] # Output maximum fluid temperature of block CH1:pipe + type = ElementAverageValue + block = 'CH2:pipe' + variable = temperature + [../] + [./avg_Tcoolant_3] # Output maximum fluid temperature of block CH1:pipe + type = ElementAverageValue + block = 'CH3:pipe' + variable = temperature + [../] + [./avg_Tcoolant_4] # Output maximum fluid temperature of block CH1:pipe + type = ElementAverageValue + block = 'CH4:pipe' + variable = temperature + [../] + [./avg_Tcoolant_5] # Output maximum fluid temperature of block CH1:pipe + type = ElementAverageValue + block = 'CH5:pipe' + variable = temperature + [../] + + [./avg_Tf_1] # Output maximum solid temperature of block CH1: solid:fuel + type = ElementAverageValue + block = 'CH1:solid:fuel' + variable = T_solid + [../] + [./avg_Tf_2] # Output maximum solid temperature of block CH1: solid:fuel + type = ElementAverageValue + block = 'CH2:solid:fuel' + variable = T_solid + [../] + [./avg_Tf_3] # Output maximum solid temperature of block CH1: solid:fuel + type = ElementAverageValue + block = 'CH3:solid:fuel' + variable = T_solid + [../] + [./avg_Tf_4] # Output maximum solid temperature of block CH1: solid:fuel + type = ElementAverageValue + block = 'CH4:solid:fuel' + variable = T_solid + [../] + [./avg_Tf_5] # Output maximum solid temperature of block CH1: solid:fuel + type = ElementAverageValue + block = 'CH5:solid:fuel' + variable = T_solid + [../] + + [./avg_Tgraphite_1] # Output maximum solid temperature of block CH1: solid:fuel + type = ElementAverageValue + block = 'CH1:solid:graphite' + variable = T_solid + [../] + [./avg_Tgraphite_2] # Output maximum solid temperature of block CH1: solid:fuel + type = ElementAverageValue + block = 'CH2:solid:graphite' + variable = T_solid + [../] + [./avg_Tgraphite_3] # Output maximum solid temperature of block CH1: solid:fuel + type = ElementAverageValue + block = 'CH3:solid:graphite' + variable = T_solid + [../] + [./avg_Tgraphite_4] # Output maximum solid temperature of block CH1: solid:fuel + type = ElementAverageValue + block = 'CH4:solid:graphite' + variable = T_solid + [../] + [./avg_Tgraphite_5] # Output maximum solid temperature of block CH1: solid:fuel + type = ElementAverageValue + block = 'CH5:solid:graphite' + variable = T_solid + [../] +[] +[VectorPostprocessors] + [./vel] + type = LineValueSampler + variable = velocity + start_point = '0 0 0' + end_point = '0 {{ Height_FC/5 }} 0' + num_points = 21 + use_displaced_mesh = true + sort_by = id + [../] +[] +[Preconditioning] + active = 'SMP_PJFNK' + [./SMP_PJFNK] + type = SMP + full = true + solve_type = 'PJFNK' + petsc_options_iname = '-pc_type' + petsc_options_value = 'lu' + [../] +[] +[Executioner] + type = Steady + petsc_options_iname = '-ksp_gmres_restart' + petsc_options_value = '300' + nl_rel_tol = 1e-9 + nl_abs_tol = 1e-7 + nl_max_its = 20 + l_tol = 1e-5 + l_max_its = 50 + [./Quadrature] + type = TRAP + order = FIRST + [../] +[] + +[Outputs] + print_linear_residuals = false + perf_graph = true + [./out] + type = Checkpoint + [../] + [./console] + type = Console + [../] + [./out_displaced] + type = Exodus + use_displaced = true + execute_on = 'initial timestep_end' + sequence = false + [../] + [./csv] + type = CSV + [../] +[] diff --git a/src/watts_ui/examples/PicardIterations_SAM-OpenMC_VHTR/watts_comprehensive.son b/src/watts_ui/examples/PicardIterations_SAM-OpenMC_VHTR/watts_comprehensive.son new file mode 100644 index 00000000..119d2810 --- /dev/null +++ b/src/watts_ui/examples/PicardIterations_SAM-OpenMC_VHTR/watts_comprehensive.son @@ -0,0 +1,76 @@ +watts{ + plugins{ + plugin(ID1){ + code = moose +% template = sam_junction_template + template = "/Users/zhieejhiaooi/Documents/ANL/watts-devel/watts/src/watts_ui/examples/PicardIterations_SAM-OpenMC_VHTR/sam_template" +% extra_inputs = [input1 input2] + exec_dir= SAM_DIR + exec_name = "sam-opt" + show_stderr = False + show_stdout = False + output = "out.txt" + } + plugin(ID2){ + code = openmc + module_dir = "/Users/zhieejhiaooi/Documents/ANL/watts-devel/watts/src/watts_ui/examples/PicardIterations_SAM-OpenMC_VHTR" + template = "/Users/zhieejhiaooi/Documents/ANL/watts-devel/watts/src/watts_ui/examples/PicardIterations_SAM-OpenMC_VHTR/openmc_template.py" + scores = ["nu-fission"] % Name of scores for OpenMC tallies. This will be the base name used for saving the tallies. + score_names = ["Init_P"] % A more representative name for the scores + } + } + + workflow_level1{ +% plugin = ID2 + variables{ + param(He_inlet_temp) {value = 873.15} + param(He_outlet_temp) {value = 1023.15} + param(He_cp) {value = 5189.2} + param(He_K) {value = 0.32802} + param(He_density) {value = 3.8815} + param(He_viscosity) {value = 4.16e-5} + param(He_Pressure) {value = 7e6} + param(Tot_assembly_power) {value = 250000} + + param("Init_P_1") {value = 1} + param("Init_P_2") {value = 1} + param("Init_P_3") {value = 1} + param("Init_P_4") {value = 1} + param("Init_P_5") {value = 1} + + + param(ax_ref) {value = 2.0} + param(num_cool_pins) {value = 24} + param(num_fuel_pins) {value = 44} + param(Height_FC) {value = 2.0} + param(Lattice_pitch) {value = 2.0} + param(FuelPin_rad) {value = 0.9} + param(cool_hole_rad) {value = 0.6} + param(Coolant_channel_diam) {value = 0.012} + param(Graphite_thickness) {value = 0.5} + param(Assembly_pitch) {value = 17.3205080756887} + param(lbp_rad) {value = 0.25} + param(mod_ext_rad) {value = 0.90} + param(shell_thick) {value = 0.05} + param(liner_thick) {value = 0.007} + param(control_pin_rad) {value = 9.9, unit = mm} + param(cl) {value = 160.0} + param(pf) {value = 40.0} + param(temp) {value = 700.0} + param(use_sab) = {bool = True} + param(use_sab_BeO) = {bool = True} + param(use_sab_YH2) = {bool = False} + } + + iteration{ + plugin_main = ID1 + plugin_sub = ID2 + nmax = 10 + convergence_params = keff % Make sure that this parameter is po + convergence_criteria = 0.0001 + to_sub_params = ["avg_Tf_1" "avg_Tf_2" "avg_Tf_3" "avg_Tf_4" "avg_Tf_5"] + to_main_params = ["Init_P_1" "Init_P_2" "Init_P_3" "Init_P_4" "Init_P_5"] + } + } + +} \ No newline at end of file diff --git a/src/watts_ui/examples/PicardIterations_SAM-OpenMC_VHTR/watts_exec.py b/src/watts_ui/examples/PicardIterations_SAM-OpenMC_VHTR/watts_exec.py new file mode 100644 index 00000000..5fd2aefc --- /dev/null +++ b/src/watts_ui/examples/PicardIterations_SAM-OpenMC_VHTR/watts_exec.py @@ -0,0 +1,103 @@ +# SPDX-FileCopyrightText: 2022 UChicago Argonne, LLC +# SPDX-License-Identifier: MIT + +""" +This example demonstrates how to use WATTS to perform several +iterations where SAM calculations are followed by OpenMC +calculation and temperature/power information are exchanged +until convergence. This example uses a simple VHTR unit-cell +model with 1 coolant channel surrounded by graphite and fuel. +""" + +from pathlib import Path +from math import cos, pi +import os +import watts +from statistics import mean +from openmc_template import build_openmc_model + + +params = watts.Parameters() + +# TH params + +params['He_inlet_temp'] = 600 + 273.15 # K +params['He_outlet_temp'] = 850 + 273.15 # K +params['He_cp'] = 5189.2 # J/kg-K +params['He_K'] = 0.32802 # W/m-K +params['He_density'] = 3.8815 # kg/m3 +params['He_viscosity'] = 4.16e-5 # Pa.s +params['He_Pressure'] = 7e6 # Pa +params['Tot_assembly_power'] = 250000 # W + +for i in range(1, 6): + # params[f'Init_P_{i}'] = 1 # Fraction + params[f'nufission_{i}'] = 1 # Fraction + +# Core design params +params['ax_ref'] = 20 # cm +params['num_cool_pins'] = 1*6+2*6+6*2/2 +params['num_fuel_pins'] = 6+6+6+3*6+2*6/2+6/3 +params['Height_FC'] = 2.0 # m +params['Lattice_pitch'] = 2.0 +params['FuelPin_rad'] = 0.90 # cm +params['cool_hole_rad'] = 0.60 # cm +params['Coolant_channel_diam'] = (params['cool_hole_rad'] * 2)/100 # in m +params['Graphite_thickness'] = (params['Lattice_pitch'] - params['FuelPin_rad'] - params['cool_hole_rad']) # cm +params['Assembly_pitch'] = 7.5 * 2 * params['Lattice_pitch'] / (cos(pi/6) * 2) +params['lbp_rad'] = 0.25 # cm +params['mod_ext_rad'] = 0.90 # cm +params['shell_thick'] = 0.05 # FeCrAl +params['liner_thick'] = 0.007 # Cr +params['control_pin_rad'] = 0.99 # cm + +# Control use of S(a,b) tables +params['use_sab'] = True +params['use_sab_BeO'] = True +params['use_sab_YH2'] = False + +# OpenMC params +params['cl'] = params['Height_FC']*100 - 2 * params['ax_ref'] # cm +params['pf'] = 40 # percent + +# printout params +params.show_summary(show_metadata=True, sort_by='time') +conv_it = True +nmax_it = 5 +conv_criteria = 1e-4 + +app_dir = Path(os.environ["SAM_DIR"]) +list_keff = [] +while conv_it: + # MOOSE Workflow + sam_plugin = watts.PluginMOOSE( + 'sam_template', + executable=app_dir / "sam-opt", + show_stderr=True + ) + sam_result = sam_plugin(params) + + # get temperature from SAM results + # params['temp'] = mean([sam_result.csv_data[f'avg_Tgraphite_{i}'][-1] for i in range(1, 6)]) + params['temp'] = 700 + for i in range(1, 6): + params[f'avg_Tf_{i}'] = sam_result.csv_data[f'avg_Tf_{i}'][-1] + + params.show_summary(show_metadata=False, sort_by='time') + + # Run OpenMC plugin + openmc_plugin = watts.PluginOpenMC(build_openmc_model, show_stderr=True) # show only error + openmc_result = openmc_plugin(params) + print("KEFF = ", openmc_result.keff) + list_keff.append(openmc_result.keff) + + power_fractions = openmc_result.tallies[0].get_values(scores=['nu-fission']).ravel() + for i, power_frac in enumerate(power_fractions): + params[f'nufission_{i+1}'] = power_frac + + if len(list_keff) > 1 and (list_keff[-1]-list_keff[-2])/list_keff[-1] < conv_criteria: + conv_it = False + if len(list_keff) > nmax_it: + conv_it = False +params.show_summary(show_metadata=True, sort_by='time') +print (list_keff) diff --git a/src/watts_ui/examples/watts_comprehensive.son b/src/watts_ui/examples/watts_comprehensive.son deleted file mode 100644 index d0ba25ce..00000000 --- a/src/watts_ui/examples/watts_comprehensive.son +++ /dev/null @@ -1,21 +0,0 @@ -watts{ - workflow_level1{ - plugin = ID1 - workflow_level2{} - variables{ - param(temp) {value = 100 range = [100 200]} - } - } - plugins{ - plugin(ID1){ - code = MCNP - template = "my_template.tmpl" - extra_inputs = [input1 input2] - } - plugin(ID2){ - code = openmc - template = "my_template.tmpl" - extra_inputs = [input1 input2] - } - } -} \ No newline at end of file diff --git a/src/watts_ui/examples/watts_workbench_V3.son b/src/watts_ui/examples/watts_workbench_V3.son deleted file mode 100644 index 331d3aca..00000000 --- a/src/watts_ui/examples/watts_workbench_V3.son +++ /dev/null @@ -1,119 +0,0 @@ -The input file consists of multiple 'blocks' where each block contains user-input -information. Currently, only the 'application' block is necessary and the others -are optional. Users can choose to input values of variable with the 'variables' -block. The 'loop' block allows user to build loops (nested if necessary) where -the applications are executed which allows users to loop through variables with -different values. The 'application' block is where the information of the application -that is to be executed is inputted. Multiple 'application' blocks are acceptable -to allow for the coupling of different applications. The order of execution is -determine by the 'order' option in the block. The 'output' option allows users to -select the results that they wish to extract for postprocessing or use as inputs -to the next application. The 'operation' block allows simple operations to be -carried out for postprocessing. The 'plot' blocks allows simple plotting and -visualization of the results. - -watts{ - database_path = 'path-to-databse'[optional] - - workflow_level0 { # required - has "optimize" [optional] "iterate" [optional] "parametric" [optional] - postprocess [optional] - # workflow bock requires [variable and plugin] OR [sub-workflow]. - variables { # set of variables - we can define several sets - but need to be defined in each set - params(Initial_Temp){value = 1500 , unit=optional, bonds=[1000, 1800]} % value = required - unit = optional [m, K, C, etc.] - ID = unique - bonds: required if optimization! - params(Swelling_Coefficient){value = 3000 , unit=optional} - params(Core_Diameter){value = 12 , unit=ft} - } - - workflow_level1{ # optional - - optimize{ # this is for single criteria optimization? - objective_functions = 'ID1[var1][0]' # variable to optimize - method = 'SLSQP' # optimizatio algorithm - maybe different options (pymoo, etc.) - tolerance = '1e-4' # convergence criteria - options = '' # additional options - } - - variables { # set of variables - we can define several sets - but need to be defined in each set - params(Swelling_Coefficient){value = 3000 , unit=optional} - } - - plugin(ID1) - - workflow_level2{ # optional - iterate { - nmax = 3 # required - convergence ('ID1[var1][0]') = 1e-4 - } - variables(VAR2) { # set of variables - we can define several sets - but need to be defined in each set - params(Initial_Temp){value = 'ID1[var1][0]+ID2[var3][0]' , unit=optional} % value = required - unit = optional [m, K, C, etc.] - ID = unique - params(Swelling_Coefficient){value = 'op2[0]' , unit=optional} - params(Core_Diameter){value = 'ID2[var3][0]' , unit=ft} - } - plugin(ID1) - plugin(ID2) - postprocessor (post_process_2){ - value = 'ID1[var4] + ID2[var7]' - } - } - plugin(ID2) - - } - workflow_level1{ # optional - parametric{ - changing_params = Initial_Temp - values_changin = [1000, 1500] - } - variables { # set of variables - we can define several sets - but need to be defined in each set - params(Initial_Temp){value = '1000' , unit=optional} % value = required - unit = optional [m, K, C, etc.] - ID = unique - params(Swelling_Coefficient){value = 'op2[0]' , unit=optional} - params(Core_Diameter){value = 'ID2[var3][0]' , unit=ft} - } - plugin(ID1) - plugin(ID2) - } - - } - - - - # For executing applications - plugins{ - plugin(ID1) { # ID is unique - code = 'SAM' # required - template = 'template.tmpl' # required - executable = './sam-opt' # optional if provided in bashrc - extra_input = ['main_in.e', 'sub.i'] # optional - output = ['var1', 'list_var2'] # optional - Save the outputs to something - like dictionary that can accept - different data types. The saved - outputs can be accessed in a - hierarchical manner like how values - in Python dictionary are accessed. - show_stderr = 'False' # optional - show_stdout = 'False' # optional - postprocessing = 'Name_of_operation' # optional - Allows users to postprocess extracted results - # and store them in 'params' as input for the - # next application. The name of operation must - # match one of the operations in the 'operation' block. - ... - } - - # For executing applications - plugin (ID2){ - code = 'PyARC' # required - template = 'template.tmpl' # required - executable = './PyARC.py' # optional if provided in bashrc - extra_input = ['main_in.e', 'sub.i'] # optional - output = ['var1', 'var2'] # optional - names of variables to be extracted - #this won't be straightforward! # post processing added to 'params' to - # be used as input for the next application. - show_stderr = 'False' # optional - show_stdout = 'False' # optional - postprocessing = 'Name_of_operation' # optional - Allows users to postprocess extracted results - # and store them in 'params' as input for the - # next application. The name of operation must - # match one of the operations in the 'operation' block. - ... - } - } - -} diff --git a/src/watts_ui/wasppy b/src/watts_ui/wasppy new file mode 120000 index 00000000..d9a5444d --- /dev/null +++ b/src/watts_ui/wasppy @@ -0,0 +1 @@ +/Applications/Workbench-5.0.1.app/Contents/wasppy \ No newline at end of file diff --git a/src/watts_ui/watts_ui.py b/src/watts_ui/watts_ui.py index cd4a15f7..019c275a 100755 --- a/src/watts_ui/watts_ui.py +++ b/src/watts_ui/watts_ui.py @@ -1,42 +1,478 @@ - import os -import sys, getopt -# import watts # this needs to be installed in Workbench environment (follow example from setup_openmc or setup_dassh) +from pathlib import Path +import sys +from typing import Optional +import getopt +import subprocess + +from astropy.units import Quantity +import numpy as np +# this needs to be installed in Workbench +# environment (follow example from setup_openmc or setup_dassh) +import watts +from wasppy import xml2obj + +import openmc + ### -#etc nstauff$ cp watts.py /Applications/Workbench-5.0.0.app/Contents/rte/ -#pywatts nstauff$ mkdir bin -#pywatts nstauff$ ln -s /Applications/Workbench-5.0.0.app/Contents/bin/sonvalidxml bin/sonvalidxml -#pywatts nstauff$ ln -s /Applications/Workbench-5.0.0.app/Contents/wasppy ./ +# etc nstauff$ cp watts.py /Applications/Workbench-5.0.0.app/Contents/rte/ +# pywatts nstauff$ mkdir bin +# pywatts nstauff$ ln -s /Applications/Workbench-5.0.0.app/Contents/bin/sonvalidxml bin/sonvalidxml +# pywatts nstauff$ ln -s /Applications/Workbench-5.0.0.app/Contents/wasppy ./ # if needed - change wasppy/xml2obj.py line 89 - if isinstance(src, (str,bytes)): # chmod 777 watts_ui.py # execute with command: `python watts_ui.py -i examples/watts_comprehensive.son` ### + def load_obj(input_path, watts_path): - '''convert son file to xml stream and create python data structure''' - import subprocess + """Converts son file to xml stream and create python data structure + + Parameters + ---------- + input_path + Path + watts_path + Path to Watts + + Returns + ------- + xlm stream + + """ sonvalidxml = watts_path + "/bin/sonvalidxml" schema = watts_path + "/etc/watts.sch" cmd = ' '.join([sonvalidxml, schema, input_path]) xmlresult = subprocess.check_output(cmd, shell=True) - ### obtain pieces of input by name for convenience - from wasppy import xml2obj + # obtain pieces of input by name for convenience return xml2obj.xml2obj(xmlresult) + +def create_plugins(plugins): + """Create a dictionary to store plugins + + Parameters + ---------- + plugins + User input plugins + + Returns + ------- + watts_plugins + Watts plugins for storing user input plugins info + + """ + watts_plugins = {} + for it, plg in enumerate(watts_wb.plugins.plugin): + nested_plugins = {} + + # Initialize as False + nested_plugins['show_stderr'] = False + nested_plugins['show_stdout'] = False + + nested_plugins['code'] = str(plg.code.value).strip('\"') + nested_plugins['template'] = str(plg.template.value).strip('\"') + if plg.exec_dir is not None: + nested_plugins['exec_dir'] = str(plg.exec_dir.value).strip('\"') + if plg.module_dir is not None: + nested_plugins['module_dir'] = str( + plg.module_dir.value).strip('\"') + if plg.exec_name is not None: + nested_plugins['exec_name'] = str(plg.exec_name.value).strip('\"') + if plg.extra_inputs is not None: + nested_plugins['extra_inputs'] = convert_to_list(plg.extra_inputs) + if plg.extra_template_inputs is not None: + nested_plugins['extra_template_inputs'] = convert_to_list( + plg.extra_template_inputs) + if plg.scores is not None: + nested_plugins['scores'] = convert_to_list(plg.scores) + if plg.score_names is not None: + nested_plugins['score_names'] = convert_to_list(plg.score_names) + if plg.output is not None: + nested_plugins['output'] = str(plg.output.value) + if plg.show_stderr is not None and str(plg.show_stderr.value).capitalize() == 'True': + nested_plugins['show_stderr'] = True + if plg.show_stdout is not None and str(plg.show_stdout.value).capitalize() == 'True': + nested_plugins['show_stdout'] = True + + watts_plugins[str(plg.id)] = nested_plugins + + return watts_plugins + + +def create_watts_params(variables): + """Creates a dictionary for input parameters + + Parameters + ---------- + variables + User input variables + + Returns + ------- + params + Watts params for storing user input variables + + """ + params = watts.Parameters() + params_id = [] + for it, param in enumerate(variables): + param_id = str(param.id).strip('\"') + if param.value is not None: + if isfloat(str(param.value.value)): + if param.unit is not None: + params[param_id] = Quantity( + float(str(param.value.value)), str(param.unit.value)) + else: + params[param_id] = float(str(param.value.value)) + else: + params[param_id] = str(param.value.value) + elif param.list is not None: + params[param_id] = convert_to_list(param.list) + elif param.func is not None: + func = '' + input_func = str(param.func.value).strip('\"').split() + for n, val in enumerate(input_func): + string = str(input_func[n]) + if string in params_id: + func += str(params[string]) + else: + func += string + params[param_id] = eval(func) + elif param.bool is not None: + bool_str = str(param.bool.value).strip('\"') + if bool_str.upper() == "TRUE": + params[param_id] = True + else: + params[param_id] = False + + params_id.append(str(param.id)) + + return (params) + + +def convert_to_list(wb_list): + """Convert a Workbench list to Python list + + Parameters + ---------- + wb_list + Workbench list to convert + + Returns + ------- + convert_list + Converted Python list + + """ + convert_list = [] + for n, val in enumerate(wb_list.value): + string = str(wb_list.value[n]).strip('\"') + if isfloat(string): + convert_list.append(float(string)) + else: + convert_list.append(string) + return (convert_list) + + +def get_last_value(watts_params, name_list): + """Extract the value of the last index from the + results created by WATTS plugins for iteration workflow + + Parameters + ---------- + watts_params + WATTS params + name_list + List of name of params to extract values + + Returns + ------- + watts_params + Updated WATTS params + + """ + for param_name in name_list: + if isinstance(watts_params[param_name], (list, np.ndarray)): + watts_params[param_name] = watts_params[param_name][-1] + return (watts_params) + + +def isfloat(num): + """Check whether entries of a list are numeric + + Parameters + ---------- + num + Entry of list + + Returns + ------- + True + If entry is numeric + + """ + try: + float(num) + return True + except ValueError: + return False + + +def run_workflow(watts_params, wf_level, plugin_ID, watts_plugins): + """Run workflow + + Parameters + ---------- + watts_params + Watts params with stored user input parameters + wf_level + Level of workflow + plugin_ID + ID of plugin + plugin + Dictionary of plugin + + Returns + ------- + app_result + WATTS results + + """ + if wf_level.iteration is not None: + watts_params, app_result_plugin_1, app_result_plugin_2 = run_iterate( + watts_params, watts_plugins, wf_level) + + # Combine the results from plugins 1 and 2 into a dictionary + app_result = {'app_result_plugin_1': app_result_plugin_1, + 'app_result_plugin_2': app_result_plugin_1} + + return (app_result, watts_params) + + elif wf_level.parametric is not None: + watts_params, app_result = run_parametric( + watts_params, watts_plugins[plugin_ID], wf_level) + + return (app_result, watts_params) + + elif wf_level.optimization is not None: + operation = wf_level.optimization + ... + else: + watts_params, app_result = run_direct( + watts_params, watts_plugins[plugin_ID]) + + return (app_result, watts_params) + + +def run_direct(watts_params, plugin): + """Run workflow + + Parameters + ---------- + watts_params + Watts params with stored user input parameters + plugin + Dictionary of plugin + + Returns + ------- + watts_params + Updated WATTS parameters + app_result + WATTS results + + """ + if plugin['code'].upper() == 'MOOSE': + + if 'exec_dir' in plugin: + app_dir = Path(os.environ[plugin['exec_dir']]) + else: + raise RuntimeError("Please provide path to MOOSE app directory.") + + if 'exec_name' not in plugin: + raise RuntimeError( + "Please specify executable name of the MOOSE application.") + app_plugin = watts.PluginMOOSE( + plugin['template'], + executable=app_dir / plugin['exec_name'], + show_stdout=plugin['show_stdout'], + show_stderr=plugin['show_stderr']) + app_result = app_plugin(watts_params) + + elif plugin['code'].upper() == 'OPENMC': + + # Insert path of directory OpenMC template + # file then import the OpenMC model. + if 'module_dir' in plugin: + sys.path.insert(0, plugin['module_dir']) + from openmc_template import build_openmc_model + + app_plugin = watts.PluginOpenMC( + build_openmc_model, show_stderr=True) # show only error + + app_result = app_plugin(watts_params) + + # Save keff results + if hasattr(app_result, 'keff'): + watts_params['keff'] = app_result.keff + + # Save tally results + if 'scores' in plugin: + for n_score, score in enumerate(plugin['scores']): + tallies = app_result.tallies[0].get_values( + scores=[score]).ravel() + for i, result in enumerate(tallies): + if 'score_names' in plugin: + watts_params[f"{plugin['score_names'][n_score]}_{i}"] = result + else: + watts_params[f"{score}_{i}"] = result + + # Store results to watts_params + if hasattr(app_result, 'csv_data'): + for key in app_result.csv_data: + watts_params[key] = app_result.csv_data[key] + + return (watts_params, app_result) + + +def run_iterate(watts_params, plugin, wf_level): + """Run workflow + + Parameters + ---------- + watts_params + Watts params with stored user input parameters + plugin + Dictionary of plugin + wf_level + Level of workflow + + Returns + ------- + watts_params + Updated WATTS parameters + app_result + WATTS results + + """ + operation = wf_level.iteration + plugin_1 = str(operation.plugin_main.value).strip('\"') + plugin_2 = str(operation.plugin_sub.value).strip('\"') + nmax = float(str(operation.nmax.value)) + tolerance = float(str(operation.convergence_criteria.value)) + convergence_params = str(operation.convergence_params.value).strip('\"') + to_sub_params = convert_to_list(operation.to_sub_params) + to_main_params = convert_to_list(operation.to_main_params) + + convergence_list = [] + conv = True + while conv: + + # Run the main plugin + watts_params, app_result_plugin_1 = run_direct( + watts_params, watts_plugins[plugin_1]) + + # Extract the values of the last index of the iterating + # parameters. This step is necessary because the results + # created by WATTS plugins could be list or ndarray with + # multiple values (especially for transient). + watts_params = get_last_value(watts_params, to_sub_params) + + # Run the sub plugin + watts_params, app_result_plugin_2 = run_direct( + watts_params, watts_plugins[plugin_2]) + + # Extract the values of the last index of the iterating + # parameters. This step is necessary because the results + # created by WATTS plugins could be list or ndarray with + # multiple values (especially for transient). + watts_params = get_last_value(watts_params, to_main_params) + + convergence_list.append(watts_params[convergence_params]) + + if len(convergence_list) > 1 and ((convergence_list[-1] - convergence_list[-2])/convergence_list[-1]) < tolerance: + conv = False + if len(convergence_list) > nmax: + conv = False + + watts_params["convergence_list"] = convergence_list + + return (watts_params, app_result_plugin_1, app_result_plugin_2) + + +def run_parametric(watts_params, plugin, wf_level): + """Run workflow + + Parameters + ---------- + watts_params + Watts params with stored user input parameters + plugin + Dictionary of plugin + wf_level + Level of workflow + + Returns + ------- + watts_params + Updated WATTS parameters + app_result + WATTS results + + """ + operation = wf_level.parametric + parametric_name = str(operation.changing_params.value).strip('\"') + parametric_list = [] + app_result = {} + for n, val in enumerate(operation.changing_values.value): + watts_params[parametric_name] = float(str(val)) + parametric_list.append(float(str(val))) + + watts_params, app_result_parametric = run_direct( + watts_params, watts_plugins[plugin_ID]) + # Store the results from each individual run to + # the 'app_result' dictionary as individual tuple. + app_result[f"run_{n}"] = app_result_parametric + + watts_params[f"{parametric_name}_list"] = parametric_list + return (watts_params, app_result) + + # Need to update and get properly from workbench the executable path and the argument -watts_path = "/Users/nstauff/Documents/CODES/WATTS/src/watts_ui/" -opts, args = getopt.getopt(sys.argv[1:],"hi:o:",["ifile=","ofile="]) +watts_path = "/Users/zhieejhiaooi/Documents/ANL/watts-devel/watts/src/watts_ui/" +opts, args = getopt.getopt(sys.argv[1:], "hi:o:", ["ifile=", "ofile="]) for opt, arg in opts: if opt == "-i": - input_path = os.getcwd() +"/"+ str(arg) - -watts = load_obj(input_path, watts_path).watts - -if watts.workflow_level1 is not None: - print ("here - workflow_level1") - if watts.workflow_level1.variables is not None: - for it, param in enumerate(watts.workflow_level1.variables.param): - print (str(param.id), str(param.value.value), str(param.unit.value)) -if watts.plugins is not None: - for it, plg in enumerate(watts.plugins.plugin): - print ("plugin ", str(plg.id), " code ", str(plg.code.value)) + input_path = os.getcwd() + "/" + str(arg) + +# Load Watts workbench +watts_wb = load_obj(input_path, watts_path).watts + +# Load plugins +if watts_wb.plugins is not None: + watts_plugins = create_plugins(watts_wb.plugins) + +# Start workflow +if watts_wb.workflow_level1 is not None: + + print("Executing Workflow Level 1") + + wf_level = watts_wb.workflow_level1 + + plugin_ID = None + if wf_level.plugin is not None: + plugin_ID = str(wf_level.plugin.value) + + if wf_level.variables is not None: + variables = wf_level.variables.param + + # Create WATTS params to store user input variables + watts_params = create_watts_params(variables) + watts_params.show_summary(show_metadata=False, sort_by='key') + + # Run workflow + app_result, watts_params = run_workflow( + watts_params, wf_level, plugin_ID, watts_plugins) + + watts_params.show_summary(show_metadata=False, sort_by='key') From b71c8e2afd8fd19705b374339c2b35fcefd9718c Mon Sep 17 00:00:00 2001 From: Zhiee Jhia Ooi Date: Sun, 18 Dec 2022 22:05:56 -0600 Subject: [PATCH 07/18] Added run for all apps. Added examples. --- src/watts_ui/etc/watts.sch | 46 +- .../1App_OpenMC_VHTR/watts_comprehensive.son | 31 +- .../sam_template} | 0 .../watts_comprehensive.son | 25 +- .../watts_exec.py | 0 .../examples/1App_SAM_VHTR/sam_template | 149 -- .../Channel | 319 ++++ .../DecayPower | 199 +++ .../FuelCladding | 128 ++ .../PRIMAR4 | 423 +++++ .../PointKinetics | 85 + .../Primary | 62 + .../README.md | 27 + .../sas_template | 199 +++ .../watts_comprehensive.son | 38 + .../watts_exec.py | 57 + .../examples/1App_SAS_SodiumLoop/README.md | 20 + .../examples/1App_SAS_SodiumLoop/sas_template | 1397 +++++++++++++++++ .../watts_comprehensive.son | 34 + .../1App_SAS_SodiumLoop/watts_exec.py | 73 + .../sam_template} | 0 .../watts_comprehensive.son | 21 +- .../watts_exec.py | 0 .../examples/Parametric_SAM_VHTR/sam_template | 149 -- .../watts_comprehensive.son | 16 +- src/watts_ui/watts_ui.py | 163 +- 26 files changed, 3263 insertions(+), 398 deletions(-) rename src/watts_ui/examples/{1App_SAM_VHTR/sam_junction_template => 1App_SAM_SimpleJunction/sam_template} (100%) rename src/watts_ui/examples/{1App_SAM_VHTR => 1App_SAM_SimpleJunction}/watts_comprehensive.son (55%) rename src/watts_ui/examples/{1App_SAM_VHTR => 1App_SAM_SimpleJunction}/watts_exec.py (100%) delete mode 100644 src/watts_ui/examples/1App_SAM_VHTR/sam_template create mode 100644 src/watts_ui/examples/1App_SAS_MultiTemplates_SodiumLoop/Channel create mode 100644 src/watts_ui/examples/1App_SAS_MultiTemplates_SodiumLoop/DecayPower create mode 100644 src/watts_ui/examples/1App_SAS_MultiTemplates_SodiumLoop/FuelCladding create mode 100644 src/watts_ui/examples/1App_SAS_MultiTemplates_SodiumLoop/PRIMAR4 create mode 100644 src/watts_ui/examples/1App_SAS_MultiTemplates_SodiumLoop/PointKinetics create mode 100644 src/watts_ui/examples/1App_SAS_MultiTemplates_SodiumLoop/Primary create mode 100644 src/watts_ui/examples/1App_SAS_MultiTemplates_SodiumLoop/README.md create mode 100644 src/watts_ui/examples/1App_SAS_MultiTemplates_SodiumLoop/sas_template create mode 100644 src/watts_ui/examples/1App_SAS_MultiTemplates_SodiumLoop/watts_comprehensive.son create mode 100644 src/watts_ui/examples/1App_SAS_MultiTemplates_SodiumLoop/watts_exec.py create mode 100644 src/watts_ui/examples/1App_SAS_SodiumLoop/README.md create mode 100644 src/watts_ui/examples/1App_SAS_SodiumLoop/sas_template create mode 100644 src/watts_ui/examples/1App_SAS_SodiumLoop/watts_comprehensive.son create mode 100644 src/watts_ui/examples/1App_SAS_SodiumLoop/watts_exec.py rename src/watts_ui/examples/{Parametric_SAM_VHTR/sam_junction_template => Parametric_SAM_SimpleJunction/sam_template} (100%) rename src/watts_ui/examples/{Parametric_SAM_VHTR => Parametric_SAM_SimpleJunction}/watts_comprehensive.son (63%) rename src/watts_ui/examples/{Parametric_SAM_VHTR => Parametric_SAM_SimpleJunction}/watts_exec.py (100%) delete mode 100644 src/watts_ui/examples/Parametric_SAM_VHTR/sam_template diff --git a/src/watts_ui/etc/watts.sch b/src/watts_ui/etc/watts.sch index c79da0eb..27a36c47 100644 --- a/src/watts_ui/etc/watts.sch +++ b/src/watts_ui/etc/watts.sch @@ -151,7 +151,6 @@ watts{ ValType=String InputTmpl="flagtypes" InputDefault= codename - ValEnums=[ K m s kg mm] MinOccurs=0 MaxOccurs=1 } @@ -245,7 +244,7 @@ watts{ ValType=String InputTmpl="flagtypes" InputDefault= codename - ValEnums=[ PyARC OpenMC SERPENT ABCE MCNP MOOSE] + ValEnums=[PyARC OpenMC SERPENT ABCE MCNP MOOSE SAS Dakota Serpent] } template{ Description = "Template name" @@ -255,11 +254,6 @@ watts{ InputTmpl="flagtypes" InputDefault= "path-to-template" } - module_dir{ - MinOccurs=0 - MaxOccurs=1 - ValType=String - } exec_dir{ MinOccurs=0 MaxOccurs=1 @@ -311,13 +305,13 @@ watts{ } } output{ + Description = "[optional] List of output files" InputTmpl="sonarray" MinOccurs=0 MaxOccurs=1 value{ MinOccurs=0 MaxOccurs=NoLimit - ValType=String } } show_stderr{ @@ -330,6 +324,42 @@ watts{ MaxOccurs=1 ValType=String } + plotfl_to_csv{ + MinOccurs=0 + MaxOccurs=1 + ValType=String + } + extra_args{ + Description = "[optional] List of extra arguments" + InputTmpl="sonarray" + MinOccurs=0 + MaxOccurs=1 + value{ + MinOccurs=0 + MaxOccurs=NoLimit + } + } + conv_channel{ + MinOccurs=0 + MaxOccurs=1 + ValType=String + } + conv_primar4{ + MinOccurs=0 + MaxOccurs=1 + ValType=String + } + auto_link_files{ + MinOccurs=0 + MaxOccurs=1 + ValType=String + } } } + workflow_dir{ + Description = "[Required] Workflow directory: Dir where all files are located in. Necessary if have multiple input files." + InputTmpl="sonobject" + MinOccurs=1 + MaxOccurs=1 + } } diff --git a/src/watts_ui/examples/1App_OpenMC_VHTR/watts_comprehensive.son b/src/watts_ui/examples/1App_OpenMC_VHTR/watts_comprehensive.son index be8869bb..10f67f10 100644 --- a/src/watts_ui/examples/1App_OpenMC_VHTR/watts_comprehensive.son +++ b/src/watts_ui/examples/1App_OpenMC_VHTR/watts_comprehensive.son @@ -1,32 +1,20 @@ watts{ + % Change the working directory to the directory where the input files are stored. This is necessary + % due to how WATTS copies input files to the temporary working directory. + workflow_dir = "/Users/zhieejhiaooi/Documents/ANL/watts-devel/watts/src/watts_ui/examples/1App_OpenMC_VHTR" + plugins{ plugin(ID1){ - code = moose -% template = sam_junction_template - template = "/Users/zhieejhiaooi/Documents/ANL/watts-devel/watts/src/watts_ui/examples/1App_SAM_VHTR/sam_junction_template" -% extra_inputs = [input1 input2] - exec_dir= SAM_DIR - exec_name = "sam-opt" - show_stderr = False - show_stdout = False - output = "out.txt" - } - plugin(ID2){ code = openmc - module_dir = "/Users/zhieejhiaooi/Documents/ANL/watts-devel/watts/src/watts_ui/examples/1App_OpenMC_VHTR" - template = "/Users/zhieejhiaooi/Documents/ANL/watts-devel/watts/src/watts_ui/examples/1App_OpenMC_VHTR/openmc_template.py" - scores = ["nu-fission"] % Name of scores for OpenMC tallies. This will be the base name used for saving the tallies. - score_names = ["power"] % A more representative name for the scores - } - plugin(ID3){ - code = MCNP - template = "my_template.tmpl" - extra_inputs = [input1 input2] + template = "openmc_template.py" + scores = ["nu-fission"] % Name of scores for OpenMC tallies. + score_names = ["power"] % A more representative name for the scores. Optional but might be necessary for score names with + % hyphens because Jinja and Workbench have difficulties reading hyphens. } } workflow_level1{ - plugin = ID2 + plugin = ID1 variables{ param(ax_ref) {value = 2.0} param(num_cool_pins) {value = 24} @@ -56,5 +44,4 @@ watts{ param(use_sab_YH2) = {bool = False} } } - } \ No newline at end of file diff --git a/src/watts_ui/examples/1App_SAM_VHTR/sam_junction_template b/src/watts_ui/examples/1App_SAM_SimpleJunction/sam_template similarity index 100% rename from src/watts_ui/examples/1App_SAM_VHTR/sam_junction_template rename to src/watts_ui/examples/1App_SAM_SimpleJunction/sam_template diff --git a/src/watts_ui/examples/1App_SAM_VHTR/watts_comprehensive.son b/src/watts_ui/examples/1App_SAM_SimpleJunction/watts_comprehensive.son similarity index 55% rename from src/watts_ui/examples/1App_SAM_VHTR/watts_comprehensive.son rename to src/watts_ui/examples/1App_SAM_SimpleJunction/watts_comprehensive.son index 34f82645..1429148a 100644 --- a/src/watts_ui/examples/1App_SAM_VHTR/watts_comprehensive.son +++ b/src/watts_ui/examples/1App_SAM_SimpleJunction/watts_comprehensive.son @@ -1,25 +1,16 @@ watts{ + % Change the working directory to the directory where the input files are stored. This is necessary + % due to how WATTS copies input files to the temporary working directory. + workflow_dir = "/Users/zhieejhiaooi/Documents/ANL/watts-devel/watts/src/watts_ui/examples/1App_SAM_SimpleJunction" + plugins{ plugin(ID1){ - code = moose -% template = sam_junction_template - template = "/Users/zhieejhiaooi/Documents/ANL/watts-devel/watts/src/watts_ui/examples/1App_SAM_VHTR/sam_junction_template" -% extra_inputs = [input1 input2] - exec_dir= SAM_DIR + code = "moose" + template = "sam_template" + exec_dir = "SAM_DIR" exec_name = "sam-opt" show_stderr = False show_stdout = False - output = "out.txt" - } - plugin(ID2){ - code = openmc - template = "my_template.tmpl" - extra_inputs = [input1 input2] - } - plugin(ID3){ - code = MCNP - template = "my_template.tmpl" - extra_inputs = [input1 input2] } } @@ -39,8 +30,6 @@ watts{ param(wall_bc) {bool = "True"} param(heat_source) {value = 1e5} } -% iterations{nmax = 10 convergence_criteria = 0.0001 iter_params = var1} -% workflow_level2{} } } \ No newline at end of file diff --git a/src/watts_ui/examples/1App_SAM_VHTR/watts_exec.py b/src/watts_ui/examples/1App_SAM_SimpleJunction/watts_exec.py similarity index 100% rename from src/watts_ui/examples/1App_SAM_VHTR/watts_exec.py rename to src/watts_ui/examples/1App_SAM_SimpleJunction/watts_exec.py diff --git a/src/watts_ui/examples/1App_SAM_VHTR/sam_template b/src/watts_ui/examples/1App_SAM_VHTR/sam_template deleted file mode 100644 index 34178bcf..00000000 --- a/src/watts_ui/examples/1App_SAM_VHTR/sam_template +++ /dev/null @@ -1,149 +0,0 @@ -## Component functional requirement test case: PBOneDFluidComponent -## Requirement: Model simplified 1D single phase flow -## with user-specified flow geometry (A and Dh). - -## Acceptance criteria: The inlet mass flow rate (determined by A) -## must match the hand-calculated value within a tolerance of 1e-12. -## The pressure drop for a given constant friction (determined by Dh) -## must match the hand-calculated value within a tolerance of 1e-3. - -A = 3.14e-4 -v = {{ velocity }} -rho = 865.51 -mu = 2.6216e-4 -Dh = {{ Dh }} -# The friction factor is -f = 0.01 -# The inlet flow rate is -m_dot = ${fparse rho*v*A} -# The pressure drop is -dP = ${fparse f/Dh*rho*v*v/2} - -[GlobalParams] - global_init_P = 1.0e5 - global_init_V = ${v} - global_init_T = 628.15 -[] - -[EOS] - [eos] # Simple linearized Sodium approximation - type = PTConstantEOS - p_0 = 1e5 # Pa - rho_0 = ${rho} # kg/m^3 - beta = 2.7524e-4 # K^{-1} - cp = 1272.0 # at Tavg; - h_0 = 7.9898e5 # J/kg - T_0 = 628.15 # K - mu = ${mu} # Pa-s - k = 72 # W/m-K - [] -[] - - -[Components] - [pipe1] - type = PBOneDFluidComponent - eos = eos - position = '0 0 0' - orientation = '0 1 0' - - A = ${A} # Check cross-sectional flow area is used - Dh = ${Dh} # Check hydraulic diameter is used - length = 1.0 - n_elems = 10 - - f = ${f} - [] - - [inlet] - type = PBTDJ - input = 'pipe1(in)' - eos = eos - v_bc = ${v} - T_bc = 628.15 - [] - - [outlet] - type = PBTDV - input = 'pipe1(out)' - eos = eos - p_bc = '1.0e5' - [] -[] - -[Preconditioning] - [SMP_PJFNK] - type = SMP - full = true - solve_type = 'PJFNK' - petsc_options_iname = '-pc_type' - petsc_options_value = 'lu' - [] -[] - -[Postprocessors] - [m_dot_inlet] - type = ComponentBoundaryFlow - input = pipe1(in) - outputs = none - [] - [P_outlet] - type = ComponentBoundaryVariableValue - input = pipe1(out) - variable = pressure - outputs = none - [] - [P_inlet] - type = ComponentBoundaryVariableValue - input = pipe1(in) - variable = pressure - outputs = none - [] - [DeltaP] - type = DifferencePostprocessor - value1 = P_inlet - value2 = P_outlet - outputs = none - [] - [check_requirement_A] - type = PostprocessorComparison - comparison_type = equals - value_a = ${m_dot} - value_b = 'm_dot_inlet' - [] - [check_requirement_Dh] - type = PostprocessorComparison - comparison_type = equals - value_a = ${dP} - value_b = 'DeltaP' - absolute_tolerance = 1e-3 - [] -[] - -[Executioner] - type = Steady - - petsc_options_iname = '-ksp_gmres_restart' - petsc_options_value = '100' - - nl_rel_tol = 1e-8 - nl_abs_tol = 1e-7 - nl_max_its = 20 - l_tol = 1e-4 - l_max_its = 100 - - [Quadrature] - type = TRAP - order = FIRST - [] -[] - -[Outputs] - print_linear_residuals = false - [csv] - type = CSV - [] - [console] - type = Console - [] -[] diff --git a/src/watts_ui/examples/1App_SAS_MultiTemplates_SodiumLoop/Channel b/src/watts_ui/examples/1App_SAS_MultiTemplates_SodiumLoop/Channel new file mode 100644 index 00000000..03b9911b --- /dev/null +++ b/src/watts_ui/examples/1App_SAS_MultiTemplates_SodiumLoop/Channel @@ -0,0 +1,319 @@ + + + + +#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 +#=============================================================================== +# +# # # ####### ####### # # +# ## ## # # # # # +# # # # # # # # # # +# # # # ##### # # # # +# # # # # ####### # +# # # # # # # # +# # # ####### # # # ####### +# +# # ##### # ###### +# # # # # # # # +# # # # # # # +# ####### # #### # # ###### +# # # # ####### # +# # # # # # # +# # ##### # # # +# +#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 +INPCOM 1 1 1 +# +# NCHAN: Number of Channels +# | + 1 1 1 +# + -1 +#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 +# +# INPCHN: Channel-Dependent Input (Integer) +# +INPCHN 51 1 0 +# +# IDBUGV: 8 for coolant-cladding temperature calculations +# | +# 1 1 8 +# +# NPLN: Number of Segments in Gas Plenum +# | NREFB: Number of Reflector Zones below Pin +# | | NREFT: Number of Reflector Zones above Pin +# | | | (Note: Below + Above <= 6) + 4 3 2 1 1 +# +# NZNODE(KZ): Number of Segments in Zone KZ +# 0.0476m Unheated section in the inlet tee +# | 3m Heated section + 0.001 Fictitious Gas Plenum +# | | 1.975m Unheated annular before the expansion joint +# | | | + 7 3 2 22 12 +# +# NT: Number of Radial Temperature Nodes in Fuel +# | + 14 1 10 +# +# IFUELV: Table Number of Property Value for Driver Fuel +# | IFUELB: Table Number of Property Value for Blanket Fuel +# | | ICLADV: Table Number for Cladding +# | | | + 15 3 1 0 1 +# +# NGRDSP: Number of spacer grids in pin +# | + 18 1 0 +# +# NPIN: Number of Pins per Subassembly +# | NSUBAS: Number of Subassemblies in Channel +# | | + 25 2 1 1 +# +# IRHOK: 0 for tabular fuel thermo-physical properties +# | + 3 1 0 +# + -1 +#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 +# +# GEOMIN: Geometry Input for Channel (Floating Point) +# +GEOMIN 61 1 0 +# +# ACCZ(KZ): Coolant Flow Area per Fuel Pin in Zone KZ +# | | | + 1 3 8.551E-04 8.551E-04 8.551E-04 +# +# AXHI(J): Length of Axial Segment J in Core and Blanket +# | | | | | + 8 5 0.15 0.15 0.15 0.15 0.15 + 13 5 0.15 0.15 0.15 0.15 0.15 + 18 5 0.15 0.15 0.15 0.15 0.15 + 23 5 0.15 0.15 0.15 0.15 0.15 +# +# DHZ(KZ): Hydraulic Diameter for Zone KZ +# | | | + 32 3 1.905E-2 1.905E-2 1.905E-2 +# +# DSTIZ(KZ): Thickness of Inner Structure Node in Zone KZ +# | | | + 39 3 2.54E-03 2.54E-03 2.54E-03 +# +# DSTOZ(KZ): Thickness of Outer Structure Node in Zone KZ +# | | | + 46 3 2.54E-03 2.54E-03 2.54E-03 +# +# PLENL: Length of Fission-Gas Plenum +# | + 53 1 0.001 # Made small relative to the entire heated section +# +# RBR(J): Cladding Inner Radius for Axial Segment J +# | + 54 1 9.0E-03 +# +# RER(J): Cladding Outer Radius for Axial Segment J +# | + 78 1 9.525E-03 +# +# RBRPL: Cladding Inner Radius in Fission-Gas Plenum +# | + 102 1 9.0E-03 +# +# RERPL: Cladding Outer Radius in Fission-Gas Plenum +# | + 103 1 9.525E-03 +# +# RINFP(J): Fuel Inner Radius for Axial Segment J +# | + 104 1 0.0E+00 +# +# ROUTFP(J): Fuel Outer Radius for Axial Segment J +# | + 128 1 9.0E-03 +# +# ZONEL(KZ): Length of Zone KZ +# 0.0476m Unheated section in inlet tee +# | 3m Heated section + 0.001m Gas Plenum +# | | 1.975m unheated annulus +# | | | + 152 3 0.500 3.001 2.000 +# +# SRFSTZ(KZ): Structure Perimeter per Pin in Zone KZ +# | | | + 159 3 1.197E-01 1.197E-01 1.197E-01 +# +# AREAPC: Coolant Plus Pin Area per Pin in the Pin Section +# | + 166 1 1.14E-03 +# +# RBR0: Nominal Cladding Inner Radius +# | RER0: Nominal Cladding Outer Radius +# | | + 180 2 9.0E-03 9.525E-03 +# +# SER(KZ): Reflector Perimeter, Pin Perimeter in +# Plenum Region when KZ = KZPIN +# | | | + 182 3 5.9847E-02 5.9847E-02 5.9847E-02 +# +# DRFO(KZ): Thickness of Outer Reflector Node/Cladding +# | | | + 169 3 5.25E-04 5.25E-04 5.25E-04 +# +# DRFI(KZ): Thickness of Inner Reflector Node in Zone KZ +# | | | + 189 3 5.25E-04 5.25E-04 5.25E-04 +# + -1 +#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 +# +# POWINC: Channel-Dependent Power Input (Floating Point) +# +POWINC 62 1 0 +# +# GAMSS: Fraction of Power from Direct Heating of Structure +# | + 2 1 1.0E-10 +# +# GAMTNC: Fraction of Power from Direct Heating of Coolant +# | GAMTNE: Fraction of Heating in Cladding +# | | + 4 2 1.0E-10 1.0E-10 +# +# PSHAPE(J): Ratio of Pin Power in Axial Segment J to Peak. +# | | | | | + 6 5 1.0 1.0 1.0 1.0 1.0 + 11 5 1.0 1.0 1.0 1.0 1.0 + 16 5 1.0 1.0 1.0 1.0 1.0 + 21 5 1.0 1.0 1.0 1.0 1.0 +# +# PSHAPR(I): Radial Power Shape within Pin +# | | | | | + 30 5 1.0 1.0 1.0 1.0 1.0 + 35 5 1.0 1.0 1.0 1.0 1.0 +# +# PRSHAP: Ratio of Average Power per Subassembly to +# | Average Power Over All Subassemblies +# | + 256 1 1.0 +# + -1 +#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 +# +# PMATCH: Channel-Dependent Properties Input (Floating Point) +# +PMATCH 63 1 0 +# +# XKSTIZ(KZ): Inner Structure Thermal Conductivity for Zone KZ +# | | | + 11 3 15.868 15.868 15.868 # Typical value @ 100 C +# +# XKSTOZ(KZ): Outer Structure Thermal Conductivity for Zone KZ +# | | | + 18 3 15.868 15.868 15.868 # Typical value @ 100 C +# +# P0GAS: Initial Plenum Gas Pressure at Reference Temperature TR +# | + 27 1 1.0E+05 # Fictitious +# +# XKRF(KZ): Reflector Thermal Coductivity for Zone KZ +# | | | + 28 3 15.868 15.868 15.868 # Typical value @ 100 C +# +# DENSS: Density of Solid Cladding at Reference Temperature TR +# | + 35 1 8.0E+03 +# +# RHOCSI(KZ): Density x Heat Capacity for Inner Structure +# | | | + 37 3 3.9293E+06 3.9293E+06 3.9293E+06 +# +# RHOCSO(KZ): Density x Heat Capacity for Outer Structure +# | | | + 44 3 3.9293E+06 3.9293E+06 3.9293E+06 +# +# RHOCR(KZ): Density x Heat Capacity for Reflector +# | | | + 51 3 3.9293E+06 3.9293E+06 3.9293E+06 +# +# RHOCG: Density x Heat Capacity for Gas in Plenum +# | RG: Thermal Resistance of Plenum Gas +# | | + 58 2 1.0E+03 0.06 # Fictitious +# +# REFDEN: Theoretical density of metal fuel at reference temperature +# | + 72 1 8.0E+03 +# + -1 +#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 +# +PMATCH 63 1 1 +# +# HBMAX: Max value of bond conductance when a gap exists +# | HBMIN: Minimum value of bond conductance +# | | + 5 2 1.0E+06 1.0E+00 +# +# HBPAR: Gap conductance = HBPAR/gap +# | (Used only if location 2-4 are zero) +# | + 7 1 64.0 +# + -1 +#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 +# +# COOLIN: Channel-Dependent Coolant Input (Floating Point) +# +COOLIN 64 1 0 +# +# AFR, BFR: Liquid Slug Friction Factor Coefficients +# | | + 1 2 0.3322 -0.25 +# +# C1, C2, C3: Coefficients for Convection Heat-Transfer Coefficient +# | | | + 3 3 1.077 0.4 0.0 +# +# RELAM: Re Number for Switch between Turb. and Lam. +# | AFLAM: Laminar Friction Factor = AFLAM/Re +# | | + 7 2 2000.0 95.36 +# +# W0: Initial Coolant Flow Rate per Pin (kg/s) +# | + 47 1 0.15 +# +# XKORI(K,M): Orifice coefficients +# K=1,2,3; @ Bottom of Zone K +# K=4; @ Top of Subassembly +# M=1,2; For upward & downward flow +# | | + 48 2 1.55 0.0 + 50 2 0.0 0.0 + 52 2 0.0 0.0 + 54 2 0.0 0.0 +# +# XKORGD: Orifice coefficient for spacer grids in pin +# | + 64 1 0.0 +# +# DZIAB, DZIAT: Effective Coolant Inertial Term Below/Above +# | | Subassembly Inlet/Outlet + 65 2 318.31 318.31 +# +# THETA1, THETA2: 0.5 Normally, 0/1 Implicit Calculation +# | | + 67 2 0 1. +# +# DTLMAX: Max. Coolant Temp. Change per Coolant Time Step +# | + 69 1 15.0 +# +# DTCMIN: Min. Coolant Time Step Size before Boiling +# | + 171 1 1.0E-05 +# + -1 \ No newline at end of file diff --git a/src/watts_ui/examples/1App_SAS_MultiTemplates_SodiumLoop/DecayPower b/src/watts_ui/examples/1App_SAS_MultiTemplates_SodiumLoop/DecayPower new file mode 100644 index 00000000..0e104147 --- /dev/null +++ b/src/watts_ui/examples/1App_SAS_MultiTemplates_SodiumLoop/DecayPower @@ -0,0 +1,199 @@ + + + + +#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 +#=============================================================================== +# +# ###### ####### ##### # # # +# # # # # # # # # # +# # # # # # # # # +# # # ##### # # # # +# # # # # ####### # +# # # # # # # # # +# ###### ####### ##### # # # +# +# ###### ####### # # ####### ###### +# # # # # # # # # # # +# # # # # # # # # # # +# ###### # # # # # ##### ###### +# # # # # # # # # # +# # # # # # # # # # +# # ####### ## ## ####### # # +# +#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 +INPCHN 51 1 1 +# +# IDKCRV: Power or Decay Heat Curve for this Channel +# | + 203 1 0 +# + -1 +#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 +INPCOM 1 1 1 +# +# NDKGRP: Number of Decay Heat Groups +# | + 17 1 0 +# +# NPOWDK: Number of Power Curves or Sets of Decay Heat Parameters +# | + 45 1 0 +# + -1 +#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 +POWINA 12 1 1 +# +# DKBET2(L,IPW): Decay heat precursor yield for group L in +# | decay heat curve IPW (New Model) +# 511 1 0.020 +# 512 1 0.022 +# 513 1 0.017 +# 514 1 0.015 +# 515 1 0.014 +# 516 1 0.012 +# +# DKLAM2(L,IPW): Decay heat decay constant for group L in +# | decay heat curve IPW (New Model) +# 631 1 0.100 +# 632 1 0.050 +# 633 1 0.010 +# 634 1 0.005 +# 635 1 0.002 +# 636 1 0.0005 +# + -1 +#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 +# AXIAL!!! +#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 +INPCHN 51 1 1 +# +# IREACZ: Axial Reactivity Worth (0/1 = On MZ/MZC Mesh) +# | + 365 1 1 +# +# IAXEXP: Calculate Simple Axial Expansion Feedback +# | + 181 1 1 +# + -1 +#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 +INPCOM 1 1 1 +# +# MODEEX: Axial Expansion Option +# | 0: Force balance or free expansion (gap-dependent) +# | 1: Cladding control fuel expansion +# | 2: Independent free fuel-clad expansion +# | 3: Force balance all the time + 55 1 2 +# + -1 +#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 +PMATCH 63 1 1 +# +# FUELEX: Fuel Axial Expansion Coefficient +# | + 73 1 2e-05 +# +# CLADEX: Clad Axial Expansion Coefficient +# | + 74 1 1.4e-05 +# +# YFUEL: Fuel Young's Modulus +# | +# 75 1 2.8E+09 +# +# YCLAD: Clad Young's Modulus +# | +# 76 1 1.5E+11 +# +# EXPCFF: Effective Axial Expansion Multiplier +# | (For Simple Feedback Model Only) + 79 1 1.0 +# + -1 +#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 +# +# POWINC: Channel-Dependent Power Input (Floating Point) +# +POWINC 62 1 1 +# +# FUELRA: Doppler Axial Weighting Factor +# | + 208 1 0.0 Lower Reflector 1, Segment 1 + 209 1 0.0 Lower Reflector 1, Segment 2 + 216 1 1.1E-05 Fuel, Segment 1 + 217 1 1.3E-05 Fuel, Segment 2 + 218 1 1.6E-05 Fuel, Segment 3 + 219 1 1.9E-05 Fuel, Segment 4 + 220 1 2.3E-05 Fuel, Segment 5 + 221 1 2.4E-05 Fuel, Segment 6 + 222 1 2.7E-05 Fuel, Segment 7 + 223 1 3.1E-05 Fuel, Segment 8 + 224 1 3.6E-05 Fuel, Segment 9 + 225 1 4.0E-05 Fuel, Segment 10 + 226 1 3.7E-05 Fuel, Segment 11 + 227 1 3.3E-05 Fuel, Segment 12 + 228 1 2.5E-05 Fuel, Segment 13 + 229 1 1.9E-05 Fuel, Segment 14 + 230 1 7.0E-05 Fuel, Segment 15 + 231 1 1.4E-05 Fuel, Segment 16 + 232 1 1.4E-05 Fuel, Segment 17 + 233 1 1.4E-05 Fuel, Segment 18 + 234 1 1.4E-05 Fuel, Segment 19 + 235 1 1.4E-05 Fuel, Segment 20 + 236 1 1.0E-05 Gas Plenum, Segment 1 + 237 1 0.0 Gas Plenum, Segment 2 + 238 1 0.0 Upper Reflector 1, Segment 1 + 239 1 0.0 Upper Reflector 1, Segment 2 + 240 1 0.0 Upper Reflector 1, Segment 3 + 241 1 0.0 Upper Reflector 1, Segment 4 + 242 1 0.0 Upper Reflector 1, Segment 5 + 243 1 0.0 Upper Reflector 1, Segment 6 + 244 1 0.0 Upper Reflector 1, Segment 7 + 245 1 0.0 Upper Reflector 1, Segment 8 + 246 1 0.0 Upper Reflector 1, Segment 9 + 247 1 0.0 Upper Reflector 1, Segment 10 + 248 1 0.0 Upper Reflector 1, Segment 11 + 249 1 0.0 Upper Reflector 1, Segment 12 +# +# CLADRA: Doppler Axial Weighting Factor +# | + 160 1 0.0 Lower Reflector 1, Segment 1 + 161 1 0.0 Lower Reflector 1, Segment 2 + 168 1 9.0E-07 Fuel, Segment 1 + 169 1 1.9E-06 Fuel, Segment 2 + 170 1 2.3E-06 Fuel, Segment 3 + 171 1 2.5E-06 Fuel, Segment 4 + 172 1 2.8E-06 Fuel, Segment 5 + 173 1 3.0E-06 Fuel, Segment 6 + 174 1 3.5E-06 Fuel, Segment 7 + 175 1 4.8E-06 Fuel, Segment 8 + 176 1 5.2E-06 Fuel, Segment 9 + 177 1 4.6E-06 Fuel, Segment 10 + 178 1 3.9E-06 Fuel, Segment 11 + 179 1 3.5E-06 Fuel, Segment 12 + 180 1 2.4E-06 Fuel, Segment 13 + 181 1 2.2E-06 Fuel, Segment 14 + 182 1 1.8E-06 Fuel, Segment 15 + 183 1 1.2E-06 Fuel, Segment 16 + 184 1 2.4E-06 Fuel, Segment 17 + 185 1 2.2E-06 Fuel, Segment 18 + 186 1 1.8E-06 Fuel, Segment 19 + 187 1 1.2E-06 Fuel, Segment 20 + 188 1 8.0E-07 Gas Plenum, Segment 1 + 189 1 0.0 Gas Plenum, Segment 2 + 190 1 0.0 Upper Reflector 1, Segment 1 + 191 1 0.0 Upper Reflector 1, Segment 2 + 192 1 0.0 Upper Reflector 1, Segment 3 + 193 1 0.0 Upper Reflector 1, Segment 4 + 194 1 0.0 Upper Reflector 1, Segment 5 + 195 1 0.0 Upper Reflector 1, Segment 6 + 196 1 0.0 Upper Reflector 1, Segment 7 + 197 1 0.0 Upper Reflector 1, Segment 8 + 198 1 0.0 Upper Reflector 1, Segment 9 + 199 1 0.0 Upper Reflector 1, Segment 10 + 200 1 0.0 Upper Reflector 1, Segment 11 + 201 1 0.0 Upper Reflector 1, Segment 12 +# + -1 \ No newline at end of file diff --git a/src/watts_ui/examples/1App_SAS_MultiTemplates_SodiumLoop/FuelCladding b/src/watts_ui/examples/1App_SAS_MultiTemplates_SodiumLoop/FuelCladding new file mode 100644 index 00000000..3bac0192 --- /dev/null +++ b/src/watts_ui/examples/1App_SAS_MultiTemplates_SodiumLoop/FuelCladding @@ -0,0 +1,128 @@ +#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 +#=============================================================================== +# +# ####### # # ####### # # # # ###### +# # # # # # # # ## # # # +# # # # # # # # # # # # # +# ##### # # ##### # # # # # # # # +# # # # # # ####### # # # # # +# # # # # # # # # ## # # +# # ##### ####### ####### # # # # ###### +# +# ##### # # ###### ###### ### # # ##### +# # # # # # # # # # # ## # # # +# # # # # # # # # # # # # # +# # # # # # # # # # # # # # #### +# # # ####### # # # # # # # # # # +# # # # # # # # # # # # ## # # +# ##### ####### # # ###### ###### ### # # ##### +# +#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 +INPCOM 1 1 1 +# +# IDBUG0: 3 for steady-state coolant debug prints +# | +# 2 1 2 +# +# IFUEL1: Number of Fuel Types +# | ICLAD1: Number of Cladding Types +# | | + 3 2 1 1 +# + -1 +#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 +PMATCM 13 1 1 +# +# TR: Reference Design Temperature +# | + 419 1 300.00 +# +# FGMM: Molecular Weight of Fission Gas +# | + 600 1 131.0 +# + -1 +#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 +# +# FUEL TYPE: Metal Fuel With Gap +# +#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 +PMATCM 13 1 1 +# +# RHOTAB(L,IFUEL): Theoretical Fuel Density (kg/m^3) +# | + 91 1 2.0E+04 +# +# XKTAB(L,IFUEL): Fuel Thermal Conductivity (W/m-K) +# | | + 420 2 10.0 22.0 +# +# XKTEM(L): Temperature for XKTAB +# | | + 580 2 300.0 1500.0 +# +#------------------------------------------------------------ +# +# CPFTAB(L,IFUEL): Fuel Specific Heat (J/kg-K) +# | | + 606 2 250.0 250.0 +# +# CPFTEM(L): Temperatures for CPFTAB +# | | + 766 2 300.0 3000.0 +# +#------------------------------------------------------------ +# +# TFSOL(IFUEL): Fuel Solidus Temperature (K) +# | + 786 1 1283.0 +# +# TFLIQ(IFUEL): Fuel Liquidus Temperature (K) +# | + 794 1 1293.0 +# +# UFMELT(IFUEL): Fuel Heat of Fusion (J/kg) +# | + 802 1 3.0E+05 +# + -1 +#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 +# +# CLADDING PROPERTIES +# +#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 +PMATCM 13 1 1 +# +# EXKTB(L,ICLAD): Thermal Conductivity of Cladding at +# | | Temperature L for Cladding Type ICLAD + 11 2 11.0 38.0 +# +# EXKTM(L): Temperatures for EXKTB +# | | + 71 2 300.0 1200.0 +# +# TESOL(ICLAD): Cladding Solidus Temperature +# | + 810 1 1293.0 +# +# TELIQ(ICLAD): Cladding Liquidus Temperature +# | + 813 1 1283.0 +# +# UEMELT(ICLAD): Cladding Heat of Fusion +# | + 816 1 3.0E+05 +# +# CPCTAB(L,ICLAD): Cladding Specific Heat +# | | + 819 2 500.0 500.0 +# +# CPCTEM(L,ICLAD): Temperatures for CPCTAB +# | | + 879 2 300.0 1200.0 +# +# CROETB(L,ICLAD): Specific Heat x Density for Cladding +# | + 990 1 4.0E+06 +# + -1 \ No newline at end of file diff --git a/src/watts_ui/examples/1App_SAS_MultiTemplates_SodiumLoop/PRIMAR4 b/src/watts_ui/examples/1App_SAS_MultiTemplates_SodiumLoop/PRIMAR4 new file mode 100644 index 00000000..e5e4e59c --- /dev/null +++ b/src/watts_ui/examples/1App_SAS_MultiTemplates_SodiumLoop/PRIMAR4 @@ -0,0 +1,423 @@ + + + +#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 +# +# ###### ###### # # # # ###### # # +# # # # # # ## ## # # # # # # +# # # # # # # # # # # # # # # # +# ###### ###### # # # # # # # ###### ### ####### +# # # # # # # # ####### # # # +# # # # # # # # # # # # +# # # # # # # # # # # # +# +# # # ##### ##### ###### # +# ## ## # # # # # # +# # # # # # # # # # # +# # # # # # # # # ##### # +# # # # # # # # # # +# # # # # # # # # +# # # ##### ##### ###### ####### +# +#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 +# +INPCOM 1 1 1 +# +# IPRION: 4 triggers PRIMAR-4 option +# | + 27 1 4 + -1 +# +#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 +# +INPMR4 3 0 0 + -1 +# +PMR4IN 18 0 0 + -1 +# +#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 +# +INPMR4 3 1 0 +# +# NCVP: # Compressible Volumes, Primary Loop +# | NCVS: # Compressible Volumes, Secondary Loop +# | | NCVD: # CV in DRACS Loop +# | | | NSEGLP: # Liquid Segments, Primary Loop +# | | | | NSEGLP: # Liquid Segments, Secondary Loop +# | | | | | + 1 5 4 0 0 4 0 +# +# NELEMT: Total # of Liquid Flow Elements +# | + 10 1 7 +# +# ITYPCV: Compressible Volume Type +# 1 = Inlet Plenum +# 4 = Almost incompressible liquid, no gas +# 7 = Outlet plenum with cover gas +# 8 = Pool with Cover Gas +# +# Lower end of the inlet Tee +# | Between the reducer and the expansion joint +# | | Tee before flow meter +# | | | Pressurizer tank +# | | | | + 11 4 1 4 4 8 +# +# ITYPEL: Liquid Flow Element Type +# 1 = Core Subassemblies +# 2 = Bypass Channel +# 3 = Pipe +# 5 = Pump Impeller +# 6 = IHX, Shell Side +# 11 = Valve +# +# Core Pipe IHX Pipe Pump Pipe Pipe +# | | | | | | | + 49 7 1 3 6 3 5 3 3 +# +# JCVL: Compressible Volumes at ends of Liquid Segments +# in out +# | | + 189 2 1 2 # Segment 1: inlet tee (CV1) ~ reducer top (CV2) + 191 2 2 3 # Segment 2: reducer top (CV2) ~ tee before FM (CV3) + 193 2 3 1 # Segment 3: tee before FM (CV3) ~ inlet tee (CV1) + 195 2 3 4 # Segment 4: tee before FM (CV3) ~ tank (CV4) +# +# NELML: # of Elements in Liquid Segment +# | | | | + 325 4 1 3 3 1 +# +# JFSELL: First Element # in Segments +# | | | | + 365 4 1 2 5 7 +# +# NPUMP: # of Water Pumps +# | IELPMP: Element # of Pump +# | | + 405 2 1 5 +# +# IEMPMP: Type of Pump (IEMPMP = 2 for Homologous Pump Model) +# | (IEMPMP = 0 for table of head vs time) + 418 1 0 +# +# ILRPMP: Pump Operation Option +# | + 430 1 0 +# +# NIHX: Number of Intermediate Heat Exchangers +# | + 470 1 1 +# +# IELIHX: Element index of IHX in primary loop +# | + 473 1 3 +# +# IHXCLC: IHX Detailed or Simple model option +# | (0 = Use Detailed Model) +# | (1 = Use Simple Model) + 489 1 -1 # Negative for outlet temperature vs time +# +# IPRADJ: Inlet/Outlet Plena Pressure Adjustment Option +# | + 497 1 1 +# +# NTGPT: # of Temperature Groups +# | + 512 1 5 +# +# NTNODE: # of Nodes in the Temperature Group. +# 2 nodes for tabular IHX. +# | | | | | + 513 5 20 2 20 20 20 +# +# IFSTEL: First Element in Temperature Group +# | | | | | + 613 5 2 3 4 5 7 +# +# ILSTEL: Last Element in Temperature Group +# | | | | | + 713 5 2 3 4 6 7 +# +# ISSIHX: Steady-state IHX temperature drop, if 1, user specifies +# | + 1155 1 0 +# +# ISSPMP: Steady-state pump head, if 1, user specifies +# | + 1159 1 0 +# +# IPIPTM: Pipe Temp Convection Differencing Approx. (Recommended = 2) +# | Multiple Inlet/Outlet Plenum Option +# | | + 1310 2 2 0 +# +#################################### +# Binary output setting for PRIMAR-4 +#################################### +# +# IP4PRT: How many PRIMAR steps to print PRIMAR-4 results +# | NBINOT: # of IBINOT entries for PRIMAR-4.dat +# | | IBINST: Output every IBINST steps to PRIMAR-4.dat +# | | | + 890 3 2000 16 200 +# +# IBINOT: Identification of output entries +# | see Manual Table A2.2-1 +# |||||| + 893 1240001 # Temperature of CV1 (inlet plenum) + 894 1240002 # Temperature of CV2 (outlet plenum) + 895 1240003 # Temperature of CV3 (tee to tank) + 896 1240004 # Temperature of CV4 (tank) + 897 1300003 # IHX Inlet Temperature (IELL=3) + 898 1300403 # IHX Outlet Temperature (IELL=3) + 899 1010001 # Flow Rate of S1 (core) + 900 1010002 # Flow Rate of S2 (core to tee) + 901 1010003 # Flow Rate of S3 (tee to core) + 902 1010004 # Flow Rate of S4 (tee to tank) + 903 1170004 # Gas Pressure of CV4 (tank) + 904 1160001 # Liquid Pressure of CV1 (inlet plenum) + 905 1160002 # Liquid Pressure of CV2 (outlet plenum) + 906 1160003 # Liquid Pressure of CV3 (tee to tank) + 907 1160004 # Liquid Pressure of CV4 (tank) + 908 1180001 # Pump Head +# + -1 +# +#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 +# +PMR4IN 18 1 0 +# +#################################### +# Liquid Segment Setting +#################################### +# +# FLOSSL: Initial flow rate in liquid flow segments. Important for convergence. +# | | | | + 2 4 0.8 0.8 0.8 1.0E-12 +# +# ZINL: Height of inlet to the liquid segment +# | | | | + 42 4 -0.500 5.000 -0.500 -0.500 +# +# CVLMLT: Multiplicity Factors at Liquid Segment Ends +# | | | | + 82 4 1.0 1.0 1.0 1.0 + 86 4 1.0 1.0 1.0 1.0 +# +#################################### +# Liquid Element Setting +#################################### +# +# ZOUTEL: Height at Outlet of the liquid element +# | | | | | + 162 5 5.000 5.500 5.000 -0.500 -0.500 + 167 2 -0.500 0.5270 +# +# XLENEL: Liquid element length (Pump:5) +# | | | | | + 302 5 5.500 2.500 0.500 5.500 0.0001 + 307 2 2.000 10.000 +# +# AREAEL: Cross-sectional flow area of liquid elements +# | | | | | + 442 5 8.5507E-04 2.1649E-03 1.0459E-02 2.1649E-03 1.3134E-03 + 447 2 1.3134E-03 9.3691E-05 +# +# DHELEM: Hydraulic Diameter of liquid elements +# | | | | | + 582 5 1.9050E-02 5.2501E-02 1.0255E-02 5.2501E-02 4.0894E-02 + 587 2 4.0894E-02 1.0922E-02 +# +# ROUGHl: Pipe Surface Roughness +# | | | | | + 722 5 2.0E-05 2.0E-05 2.0E-05 2.0E-05 2.0E-05 + 727 2 2.0E-05 2.0E-05 +# +# BENDNM: Number of Bends in Each Liquid Element +# | | | | | + 862 5 0.0 1.0 0.0 0.0 0.0 + 867 2 0.0 0.0 +# +################## +# +# G2PRDR: Initial Orifice Coefficient, normally 0 as input +# | | | | | + 1002 5 0.0 0.0 100.0 0.0 0.0 + 1007 2 0.0 0.0 +# +# BNDLOD: Effective L/D per bend +# | + 1142 1 11.52 +# +# WALLMC: Pipe wall mass times heat capacity/length +# | | | | | + 1143 5 1.0 1.0 1.0 1.0 1.0 + 1148 2 1.0 1.0 +# +# WALLH: Pipe wall heat transfer coefficient +# | | | | | + 1283 5 1.0 1.0 1.0 1.0 1.0 + 1288 2 1.0 1.0 +# +#################################### +# Compressible Volume Setting +#################################### +# +# VOLLGC: Total Volume of Compressible Volumes +# | | | | + 1423 4 2.981E-04 8.798E-04 1.021E-03 1.392 + +# VOLSG0: Initial Gas Volume +# | | | | + 3612 4 0.0 0.0 0.0 0.405 +# +# PRESG0: Initial Gas Pressure in CV +# | | | | + 1461 4 0.0 0.0 0.0 200000.0 +# +# ALPHAP: CV volume pressure expansion coefficient +# | | | | + 1499 4 1.0E-08 1.0E-08 1.0E-08 0 + +# ALPHAT: CV volume thermal expansion coefficient +# | | | | + 1537 4 2.0E-05 2.0E-05 2.0E-05 2.0E-05 +# +# BTAPNA: Water isothermal compressibility for the CV +# | | | | + 2464 4 2.0E-10 2.0E-10 2.0E-10 2.0E-10 +# +# BTATNA: Water thermal expansion coefficient for the CV +# | | | | + 2502 4 3.0E-04 3.0E-04 3.0E-04 3.0E-04 +# +# ZCVL: CV reference height for liquid pressure +# | | | | + 1575 4 -0.500 5.000 -0.500 0.527 +# +# AREAIN: Liquid-Gas Interface Area in CV (1.0 if no gas) +# | | | | + 1613 4 1.0 1.0 1.0 0.800 +# +# TREFCV: Steady-state gas temperature in CV +# | Input as 0.0 to use liquid temperature +# | | | | + 1651 4 0.0 0.0 0.0 0.0 +# +# HWALL: Wall-coolant heat-transfer coefficient for CV at reference temperature +# | | | | + 2578 4 1.0 1.0 1.0 1.0 +# +# AWALL: Wall surface area +# Modeled as a 8.938" long 1.5" Sch. 40 pipe +# | Modeled as a 16" long 2" Sch. 40 pipe +# | | Modeled as a 13" long 2.5" Sch. 40 pipe +# | | | Modeled as a 37" I.D. 79" tall cylinder +# | | | | + 2616 4 0.0292 0.0670 0.0651 4.1097 +# +# CMWALL: CV Wall mass times specific heat +# | | | | + 2654 4 1.0 1.0 1.0 1.0 +# +#################################### +# Cover Gas Data +#################################### +# +# Values given are for nitrogen gas at 100C +# +# GAMGSC: Cp/Cv for cover gas +# | + 1689 1 1.40 +# +# RGASC: Gas constant for cover gas. +# | + 1690 1 296.80 +# +# U0CVGS: Cover gas viscosity +# | + 1691 1 2.12E-05 +# +# TRFU: Gas viscosity reference temperature +# | + 1692 1 373.15 +# +# TAUGAS: Cover-gas temperature time constant. +# | | | | + 1861 4 1.0 1.0 1.0 2.0 +# +#################################### +# Simple Pump Setting +#################################### +# +# APMPHD: Value Table of Relative Pump Head (-) +# | | | | + 1983 4 1.0 1.0 1.0 1.0 + 1987 4 1.0 1.0 1.0 1.0 +# +# AMOTTK: Time Table of Relative Pump Head (s) +# | | + 2223 2 0.0 100 +# +# GRAVTY: Acceleration due to gravity +# | + 2463 1 9.80665 +# +#################################### +# Simple IHX Model Setting +#################################### +# +# DTMPTB: Table of exit temperature for IHX +# | | | | + 2937 4 600.00 600.00 600.00 600.00 +# +# ZCENTR: Height of thermal center for IHX +# | | | | + 3105 4 5.250 5.250 5.250 5.250 +# +# TMPMTB: Times for DTMPTB and ZCENTR +# | | | | + 3273 4 0.0 10.0 20.0 10000.0 +# +# C1PIPE, C2PIPE, C3PIPE: Conductance coefficient for pipe, recommended values +# | | | + 3650 3 0.025 0.8 4.80 +# +# EPSF: Maximum fractional change in liquid segment flow rate per time step +# | EPSFC: Maximum fractional change in core inlet flow rate +# | | per time step + 4282 2 0.2 0.1 +# +# DTIHX: Steady-state temperature drop across IHX +# | (Used only if ISSIHX > 0) +# 4284 1 1.0 +# +#################################### +# +# TPLCV: Temperature of CV. Entered only for inlet plena +# | + 4685 1 600.00 +# +# PPLCV: CV pressure for outlet plena only +# | + 4724 1 200000.0 +# +# ZPLENC: CV reference elevation for plena only +# | | + 4761 2 -0.500 5.000 +# + -1 +#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 +INPCOM 1 1 1 +# +# KPROPI: > 0 to input correlation coefficients in APROPI +# | This is probably reset by ICLPRP + 114 1 1 +# +# ICLPRP: 1 for Sodium (SAS4A version) +# | + 118 1 1 +# + -1 \ No newline at end of file diff --git a/src/watts_ui/examples/1App_SAS_MultiTemplates_SodiumLoop/PointKinetics b/src/watts_ui/examples/1App_SAS_MultiTemplates_SodiumLoop/PointKinetics new file mode 100644 index 00000000..d818f22c --- /dev/null +++ b/src/watts_ui/examples/1App_SAS_MultiTemplates_SodiumLoop/PointKinetics @@ -0,0 +1,85 @@ + + + + + + + + +#=============================================================================== +# +# ###### ####### ### # # ####### +# # # # # # ## # # +# # # # # # # # # # +# ###### # # # # # # # +# # # # # # # # # +# # # # # # ## # +# # ####### ### # # # +# +# # # ### # # ####### ####### ### ##### ##### +# # # # ## # # # # # # # # +# # # # # # # # # # # # +# ### # # # # ##### # # # ##### +# # # # # # # # # # # # +# # # # # ## # # # # # # # +# # # ### # # ####### # ### ##### ##### +# +#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 +INPCOM 1 1 1 +# +# NDELAY: Number of Delayed Neutron Precursor Families +# | + 16 1 6 +# + -1 +#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 +POWINA 12 1 1 +# +# GENTIM: Prompt Neutron Lifetime +# | + 2 1 2.0E-07 +# +# BETADN(L): Effective Delayed Neutron Fract. for Family L +# | + 4 1 0.0002 + 5 1 0.001 + 6 1 0.0012 + 7 1 0.0025 + 8 1 0.0015 + 9 1 0.0005 + +# +# DECCON(L): Decay Constant for Precursor Family L +# | + 10 1 1.0E-02 + 11 1 3.0E-02 + 12 1 1.0E-01 + 13 1 3.0E-01 + 14 1 8.0E-01 + 15 1 3.0E+00 +# + -1 +#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 +INPCOM 1 1 1 +# +# IPOWER: 0/1 = Reactivity/Power vs Time from PREA +# | + 8 1 0 +# +# NPREAT: Number of Entries in PREA vs. Time Table +# | (Power or Reactivity vs Time) + 18 1 2 +# + -1 +#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 +POWINA 12 1 1 +# +# PREATB: Transient power table used by PREA +# | | | | | + 29 2 0.0 0.0 +# +# PREATM: Times for PREATB +# | | + 49 2 0.0 10000.0 +# + -1 \ No newline at end of file diff --git a/src/watts_ui/examples/1App_SAS_MultiTemplates_SodiumLoop/Primary b/src/watts_ui/examples/1App_SAS_MultiTemplates_SodiumLoop/Primary new file mode 100644 index 00000000..2abbf27f --- /dev/null +++ b/src/watts_ui/examples/1App_SAS_MultiTemplates_SodiumLoop/Primary @@ -0,0 +1,62 @@ +#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 +#=============================================================================== +# +# ###### ###### ### # # # ###### +# # # # # # ## ## # # # # +# # # # # # # # # # # # # # +# ###### ###### # # # # # # ###### +# # # # # # # ####### # # +# # # # # # # # # # # +# # # # ### # # # # # # +# +#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 +INPCOM 1 1 1 +# +# NPRES: Coolant driving pressure option +# | Negative value for # of entries in table +# | of normalized flow rate vs. time. + 19 1 -1 +# +# NT0TAB: Number of entries in T0TAB vs. T0TME table of +# | coolant inlet temperature vs. time. + 22 1 1 +# +# IPRION: PRIMAR-4 Option Flag +# | + 27 1 0 +# + -1 +#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 +# +# OPCIN: Channel Independent Variables (Floating Point) +# Time Steps and Convergence Criteria Data +# +OPCIN 11 1 1 +# +# DTP0: Initial PRIMAR Time Step Size +# | DTPMAX: Maximum PRIMAR Time Step Size Before +# | | Boiling Starts + 13 2 0.05 0.05 +# + -1 +#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 +PRIMIN 14 0 0 +# +# PX: Coolant Exit Pressure at ZPLENU +# | + 1 1 200000.0 +# +# PRETAB: Normalized inlet coolant driving pressure or +# | coolant flow rate at times listed in PRETME +# | + 5 1 1.0 +# +# T0TAB(L): Inlet Temperature at Time T0TME(L) +# | + 45 1 600.00 +# +# ZPLENL/ZPLENU: Inlet/Outlet Plenum Reference Elevation +# | | + 87 2 -0.500 5.000 +# + -1 \ No newline at end of file diff --git a/src/watts_ui/examples/1App_SAS_MultiTemplates_SodiumLoop/README.md b/src/watts_ui/examples/1App_SAS_MultiTemplates_SodiumLoop/README.md new file mode 100644 index 00000000..a32ff8d7 --- /dev/null +++ b/src/watts_ui/examples/1App_SAS_MultiTemplates_SodiumLoop/README.md @@ -0,0 +1,27 @@ +# MultiTemplates_SAS_SodiumLoop + +## Purpose + +This example provides a demonstration on how to use WATTS to perform a simulation with multiple input files. This example utilizes SAS for demonstration. + +## Code(s) + +- SAS +- CHANNEL module +- PRIMAR4 module + +## Keywords + +- SAS INCLUDE directive +- Multiple input files + +## File descriptions + +- [__watts_exec.py__](watts_exec.py): This is the file to run the problem described above. +- [__sas_template__](sas_template): Main templated SAS input file. +- [__Channel__](Channel): Extra templated SAS input. +- [__DecayPower__](DecayPower): Extra templated SAS input. +- [__FuelCladding__](FuelCladding): Extra templated SAS input. +- [__PointKinetics__](PointKinetics): Extra templated SAS input. +- [__PRIMAR4__](PRIMAR4): Extra templated SAS input. +- [__Primary__](Primary): Extra templated SAS input. diff --git a/src/watts_ui/examples/1App_SAS_MultiTemplates_SodiumLoop/sas_template b/src/watts_ui/examples/1App_SAS_MultiTemplates_SodiumLoop/sas_template new file mode 100644 index 00000000..b5168f34 --- /dev/null +++ b/src/watts_ui/examples/1App_SAS_MultiTemplates_SodiumLoop/sas_template @@ -0,0 +1,199 @@ + +{#- + Create variables +#} +{# set sas_version = 5.5 #} +{# set tmax = 1000 s #} +{# set total_reactor_power = 20 kW #} +{#- + Render the parameters +#} + +#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 +# Version + Simple salt loop {{ sas_version }} +#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 +# +# STORAGE ALLOCATION RECORDS +# +# NCH: Number of Channels +# | NEUTSP: Neutronics Storage Allocation Flag +# | | IDBUGP: Data Management Print Flag +# | | | IPDECK: Input Data Editing Flag +# | | | | NBYSSH: Number of Bypass Channels in SA-to-SA Heat Transfer +# | | | | | IDATMO: Data Management Option Flag (0/1=Default/Extended) +# | | | | | | IADEFC: Data Pack DEFC Storage Allocation Flag +# | | | | | | | IAPLUC: Data Pack PLUC Storage Allocation Flag +# | | | | | | | | IACNTL: Control System Module Storage Allocation Flag +# | | | | | | | | | IALBOP: BOP Module Storage Allocation Flag +# | | | | | | | | | | + 1 0 0 0 0 1 1 1 1 1 +# +#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 +# +# INPCOM: Channel Independent Variables (Integer) +# +INPCOM 1 0 0 +# +# ICLCMP: Flag to Save Plot Data for Transients to Unit 11 +# | + 24 1 1 +# + -1 +#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 +# +# OPCIN: Channel Independent Variables (Floating Point) +# Time Steps and Convergence Criteria Data +# +OPCIN 11 0 0 +# +# EPSTEM: Steady-State Temperature Convergence +# | + 1 1 1.0E-03 +# +# EPSPOW: Neutron Flux Amplitude Convergence +# | + 3 1 1.0D-05 +# +# DT0: Initial and Max Main Time Step Size +# | + 5 1 0.05 +# +# DTFUEL: Max Fuel Temp Change per Heat-Transfer Time Step +# | DTCLAD: Max Clad Temp Change per HT Time Step +# | | + 10 2 5.0 30.0 +# + -1 +#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 +#=============================================================================== +# +# ##### ####### ###### ####### +# # # # # # # # +# # # # # # # +# # # # ###### ##### +# # # # # # # +# # # # # # # # +# ##### ####### # # ####### +# +# ###### ####### # # ####### ###### +# # # # # # # # # # # +# # # # # # # # # # # +# ###### # # # # # ##### ###### +# # # # # # # # # # +# # # # # # # # # # +# # ####### ## ## ####### # # +# +#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 +POWINA 12 1 1 +# +# POWTOT: Total Reactor Power (Watts) +# | + 3 1 {{ total_reactor_power }} # reactor power +# +# FRPR: Fraction of Total Power Represented by All Channels +# | FRFLOW: Fraction of Total Flow Represented +# | | by All SAS4A Channels + 69 2 1.0 1.0 +# + -1 +#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 + +INCLUDE "FuelCladding" +INCLUDE "Channel" +INCLUDE "Primary" +INCLUDE "PRIMAR4" +INCLUDE "DecayPower" +INCLUDE "PointKinetics" + +#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 +#=============================================================================== +# +# ####### ### # # ####### ##### ####### ####### ###### +# # # ## ## # # # # # # # +# # # # # # # # # # # # # +# # # # # # ##### ##### # ##### ###### +# # # # # # # # # # +# # # # # # # # # # # +# # ### # # ####### ##### # ####### # +# +#=============================================================================== +INPCOM 1 1 1 +# +# IPOWER: 0/1 = Reactivity/Power vs Time from PREA +# | + 8 1 1 +# +# MAXSTP: Maxiumum Number of Main (Power and Reactivity) +# | Time Steps + 11 1 99999 +# +# IPO: Number of Steps between Prints before IBLPRT or Boiling +# | IPOBOI: Number of Steps between Prints after IBLPRT or Boiling +# | | + 12 2 200 200 +# +# NPREAT: Number of Entries in PREA vs. Time Table +# | (Power or Reactivity vs Time) + 18 1 4 +# +# NOREAC: Main Time Step Intevals between PSHORT Print +# | + 41 1 200 +# +# IFIT(K): Input Table Lookup Options (K=1: Power/Reac vs. Time) +# | (0=Linear Fit) + 95 1 0 +# + -1 +#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 +POWINA 12 1 1 +# +# PREATB: Transient power table used by PREA +# | | | | + 29 4 1.0 1.0 1.0 1.0 +# +# PREATM: Times for PREATB +# | | | | + 49 4 0.0 10.0 20.0 10000.0 +# + -1 +#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 +OPCIN 11 1 1 +# +# DTMXB: Max heat transfer time-step after coolant boiling inception +# | + 6 1 0.01 +# +# TIMAX: Maximum Problem Time (s) +# | + 7 1 {{ tmax }} +# +# TCOSTP: # of CPU seconds reserved at end of run for writing restart files +# | + 9 1 15.0 +# +# DTPBOI: Max PRIMAR step size after start of boiling +# | + 15 1 0.01 +# +# DPINMX: Max change in inlet pressure per PRIMAR step +# | DTINMX: Max change in inlet temp per PRIMAR step +# | | DTMMXB: Max main time step after onset of boiling +# | | | + 19 3 1.0E+04 0.5 0.5 +# +# DTMIN: Time Step Sizes vs. Time +# | | + 95 2 0.05 0.05 +# +# TDTMIN: Time for Time Step Sizes +# | | + 105 2 0.0 10000.0 +# + -1 +#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 +# +######## ####### ####### ####### ####### ####### ####### ####### ####### ####### +ENDJOB -1 +######## ####### ####### ####### ####### ####### ####### ####### ####### ####### \ No newline at end of file diff --git a/src/watts_ui/examples/1App_SAS_MultiTemplates_SodiumLoop/watts_comprehensive.son b/src/watts_ui/examples/1App_SAS_MultiTemplates_SodiumLoop/watts_comprehensive.son new file mode 100644 index 00000000..4418f300 --- /dev/null +++ b/src/watts_ui/examples/1App_SAS_MultiTemplates_SodiumLoop/watts_comprehensive.son @@ -0,0 +1,38 @@ +watts{ + % Change the working directory to the directory where the input files are stored. This is necessary + % due to how WATTS copies input files to the temporary working directory. + workflow_dir = "/Users/zhieejhiaooi/Documents/ANL/watts-devel/watts/src/watts_ui/examples/1App_SAS_MultiTemplates_SodiumLoop" + + plugins{ + plugin(ID1){ + code = "sas" + template = "sas_template" + exec_dir = "SAS_DIR" + show_stderr = False + show_stdout = False + extra_template_inputs=["Primary", "FuelCladding", "Channel", "DecayPower", "PointKinetics", "PRIMAR4"] + % conv_channel = "path\to\CHANNELtoCSV.x" % Assumed to be in the same dir as the SAS executable if not provided + % conv_primar4 = "path\to\PRIMAR4toCSV.x" % Assumed to be in the same dir as the SAS executable if not provided + } + } + + workflow_level1{ + plugin = ID1 + variables{ + param(sas_version) {value = 5.5} + param(tmax) {value = 1000.0} + param(flow_per_pin) {value = 0.15} + param(total_reactor_power) {value = 20.0 unit = kW} + param(betai_1) {value = 2.0E-04} %Effective delayed neutron fraction + param(betai_2) {value = 1.0E-03} + param(betai_3) {value = 1.2E-03} + param(betai_4) {value = 2.5E-03} + param(betai_5) {value = 1.5E-03} + param(betai_6) {value = 5.0E-04} + param(fuel_axial_exp_coeff) {value = 2.0E-05} + param(clad_axial_exp_coeff) {value = 1.4E-05} + param(outlet_pressure) {value = 200000.0} + } + } + +} \ No newline at end of file diff --git a/src/watts_ui/examples/1App_SAS_MultiTemplates_SodiumLoop/watts_exec.py b/src/watts_ui/examples/1App_SAS_MultiTemplates_SodiumLoop/watts_exec.py new file mode 100644 index 00000000..337726f4 --- /dev/null +++ b/src/watts_ui/examples/1App_SAS_MultiTemplates_SodiumLoop/watts_exec.py @@ -0,0 +1,57 @@ +# SPDX-FileCopyrightText: 2022 UChicago Argonne, LLC +# SPDX-License-Identifier: MIT + +""" +Example problem of runing SAS4A/SASSY-1 with WATTS using the +SAS 'INCLUDE' directive that allows for multiple input files. +This example uses the same sodium loop model as in +example '1App_SAS_SodiumLoop'. For details on the loop, +please refer to the input file of '1App_SAS_SodiumLoop'. +In this example, the SAS input file is broken into several +input files, namely 'Channel', 'DecayPower', 'FuelCladding', +'PointKinetics', 'PRIMAR4', and 'Primary', and the main +input file is known as 'sas_template'. The values of any +parameters in the extra input files can be input/changed +using the same approach as the parameters in the main input +file. To include the input files to the simulation, users +need to add 'INCLUDE "Extra_file_name"' in the main input file. +""" + +from math import cos, pi +import os +import watts +from astropy.units import Quantity + + +params = watts.Parameters() + +# Channel params +params['sas_version'] = 5.5 +params['tmax'] = 1000.0 # maximum problem time in s +params['flow_per_pin'] = 0.15 # kg/s +params['total_reactor_power'] = Quantity(20, "kW") +params['betai_1'] = 2.0E-04 # Effective delayed neutron fraction +params['betai_2'] = 1.0E-03 +params['betai_3'] = 1.2E-03 +params['betai_4'] = 2.5E-03 +params['betai_5'] = 1.5E-03 +params['betai_6'] = 5.0E-04 +params['fuel_axial_exp_coeff'] = 2.0E-05 # Fuel axial expansion coefficient +params['clad_axial_exp_coeff'] = 1.4E-05 # Clad axial expansion coefficient +params['outlet_pressure'] = 200000.0 # Outlet plenum pressure + +params.show_summary(show_metadata=False, sort_by='key') + +# SAS Workflow +# template_file: Main input file +# extra_template_inputs: Additional templated input files +sas_plugin = watts.PluginSAS( + template_file='sas_template', + extra_template_inputs=['Primary', 'FuelCladding', 'Channel', 'DecayPower', 'PointKinetics', 'PRIMAR4'] + ) + +sas_result = sas_plugin(params) +for key in sas_result.csv_data: + print(key, sas_result.csv_data[key]) +print(sas_result.inputs) +print(sas_result.outputs) diff --git a/src/watts_ui/examples/1App_SAS_SodiumLoop/README.md b/src/watts_ui/examples/1App_SAS_SodiumLoop/README.md new file mode 100644 index 00000000..aec1580b --- /dev/null +++ b/src/watts_ui/examples/1App_SAS_SodiumLoop/README.md @@ -0,0 +1,20 @@ +# 1App_SAS_SodiumLoop + +## Purpose + +This example provides a demonstration on how to use WATTS for a simple SAS model. + +## Code(s) + +- SAS +- CHANNEL module +- PRIMAR4 module + +## Keywords + +- Sodium Loop + +## File descriptions + +- [__watts_exec.py__](watts_exec.py): This is the file to execute to run the problem described above. +- [__sas_template__](sas_template): Templated SAS input. diff --git a/src/watts_ui/examples/1App_SAS_SodiumLoop/sas_template b/src/watts_ui/examples/1App_SAS_SodiumLoop/sas_template new file mode 100644 index 00000000..327676bf --- /dev/null +++ b/src/watts_ui/examples/1App_SAS_SodiumLoop/sas_template @@ -0,0 +1,1397 @@ + +{#- + Create variables +#} +{# set sas_version = 5.5 #} +{# set flow_per_pin = 0.15 kg/s #} +{# set tmax = 1000 s #} +{# set total_reactor_power = 20 kW #} +{# set betai_1 = 2.0E-04 #} +{# set betai_2 = 1.0E-03 #} +{# set betai_3 = 1.2E-03 #} +{# set betai_4 = 2.5E-03 #} +{# set betai_5 = 1.5E-03 #} +{# set betai_6 = 5.0E-04 #} +{#- + Render the parameters +#} + +#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 +# Version + Simple salt loop {{ sas_version }} +#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 +# +# STORAGE ALLOCATION RECORDS +# +# NCH: Number of Channels +# | NEUTSP: Neutronics Storage Allocation Flag +# | | IDBUGP: Data Management Print Flag +# | | | IPDECK: Input Data Editing Flag +# | | | | NBYSSH: Number of Bypass Channels in SA-to-SA Heat Transfer +# | | | | | IDATMO: Data Management Option Flag (0/1=Default/Extended) +# | | | | | | IADEFC: Data Pack DEFC Storage Allocation Flag +# | | | | | | | IAPLUC: Data Pack PLUC Storage Allocation Flag +# | | | | | | | | IACNTL: Control System Module Storage Allocation Flag +# | | | | | | | | | IALBOP: BOP Module Storage Allocation Flag +# | | | | | | | | | | + 1 0 0 0 0 1 1 1 1 1 +# +#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 +# +# INPCOM: Channel Independent Variables (Integer) +# +INPCOM 1 0 0 +# +# ICLCMP: Flag to Save Plot Data for Transients to Unit 11 +# | + 24 1 1 +# + -1 +#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 +# +# OPCIN: Channel Independent Variables (Floating Point) +# Time Steps and Convergence Criteria Data +# +OPCIN 11 0 0 +# +# EPSTEM: Steady-State Temperature Convergence +# | + 1 1 1.0E-03 +# +# EPSPOW: Neutron Flux Amplitude Convergence +# | + 3 1 1.0D-05 +# +# DT0: Initial and Max Main Time Step Size +# | + 5 1 0.05 +# +# DTFUEL: Max Fuel Temp Change per Heat-Transfer Time Step +# | DTCLAD: Max Clad Temp Change per HT Time Step +# | | + 10 2 5.0 30.0 +# + -1 +#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 +#=============================================================================== +# +# ##### ####### ###### ####### +# # # # # # # # +# # # # # # # +# # # # ###### ##### +# # # # # # # +# # # # # # # # +# ##### ####### # # ####### +# +# ###### ####### # # ####### ###### +# # # # # # # # # # # +# # # # # # # # # # # +# ###### # # # # # ##### ###### +# # # # # # # # # # +# # # # # # # # # # +# # ####### ## ## ####### # # +# +#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 +POWINA 12 1 1 +# +# POWTOT: Total Reactor Power (Watts) +# | + 3 1 {{ total_reactor_power }} # reactor power +# +# FRPR: Fraction of Total Power Represented by All Channels +# | FRFLOW: Fraction of Total Flow Represented +# | | by All SAS4A Channels + 69 2 1.0 1.0 +# + -1 +#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 +#=============================================================================== +# +# ####### # # ####### # # # # ###### +# # # # # # # # ## # # # +# # # # # # # # # # # # # +# ##### # # ##### # # # # # # # # +# # # # # # ####### # # # # # +# # # # # # # # # ## # # +# # ##### ####### ####### # # # # ###### +# +# ##### # # ###### ###### ### # # ##### +# # # # # # # # # # # ## # # # +# # # # # # # # # # # # # # +# # # # # # # # # # # # # # #### +# # # ####### # # # # # # # # # # +# # # # # # # # # # # # ## # # +# ##### ####### # # ###### ###### ### # # ##### +# +#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 +INPCOM 1 1 1 +# +# IDBUG0: 3 for steady-state coolant debug prints +# | +# 2 1 2 +# +# IFUEL1: Number of Fuel Types +# | ICLAD1: Number of Cladding Types +# | | + 3 2 1 1 +# + -1 +#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 +PMATCM 13 1 1 +# +# TR: Reference Design Temperature +# | + 419 1 300.00 +# +# FGMM: Molecular Weight of Fission Gas +# | + 600 1 131.00 +# + -1 +#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 +# +# FUEL TYPE: Metal Fuel With Gap +# +#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 +PMATCM 13 1 1 +# +# RHOTAB(L,IFUEL): Theoretical Fuel Density (kg/m^3) +# | + 91 1 2.0E+04 +# +# XKTAB(L,IFUEL): Fuel Thermal Conductivity (W/m-K) +# | | + 420 2 10.0 22.0 +# +# XKTEM(L): Temperature for XKTAB +# | | + 580 2 300.0 1500.0 +# +#------------------------------------------------------------ +# +# CPFTAB(L,IFUEL): Fuel Specific Heat (J/kg-K) +# | | + 606 2 250.0 250.0 +# +# CPFTEM(L): Temperatures for CPFTAB +# | | + 766 2 300.0 3000.0 +# +#------------------------------------------------------------ +# +# TFSOL(IFUEL): Fuel Solidus Temperature (K) +# | + 786 1 1283.0 +# +# TFLIQ(IFUEL): Fuel Liquidus Temperature (K) +# | + 794 1 1293.0 +# +# UFMELT(IFUEL): Fuel Heat of Fusion (J/kg) +# | + 802 1 3.0E+05 +# + -1 +#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 +# +# CLADDING PROPERTIES +# +#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 +PMATCM 13 1 1 +# +# EXKTB(L,ICLAD): Thermal Conductivity of Cladding at +# | | Temperature L for Cladding Type ICLAD + 11 2 11.0 38.0 +# +# EXKTM(L): Temperatures for EXKTB +# | | + 71 2 300.0 1200.0 +# +# TESOL(ICLAD): Cladding Solidus Temperature +# | + 810 1 1293.0 +# +# TELIQ(ICLAD): Cladding Liquidus Temperature +# | + 813 1 1283.0 +# +# UEMELT(ICLAD): Cladding Heat of Fusion +# | + 816 1 3.0E+05 +# +# CPCTAB(L,ICLAD): Cladding Specific Heat +# | | + 819 2 500.0 500.0 +# +# CPCTEM(L,ICLAD): Temperatures for CPCTAB +# | | + 879 2 300.0 1200.0 +# +# CROETB(L,ICLAD): Specific Heat x Density for Cladding +# | + 990 1 4.0E+06 +# + -1 +#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 +#=============================================================================== +# +# # # ####### ####### # # +# ## ## # # # # # +# # # # # # # # # # +# # # # ##### # # # # +# # # # # ####### # +# # # # # # # # +# # # ####### # # # ####### +# +# # ##### # ###### +# # # # # # # # +# # # # # # # +# ####### # #### # # ###### +# # # # ####### # +# # # # # # # +# # ##### # # # +# +#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 +INPCOM 1 1 1 +# +# NCHAN: Number of Channels +# | + 1 1 1 +# + -1 +#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 +# +# INPCHN: Channel-Dependent Input (Integer) +# +INPCHN 51 1 0 +# +# IDBUGV: 8 for coolant-cladding temperature calculations +# | +# 1 1 8 +# +# NPLN: Number of Segments in Gas Plenum +# | NREFB: Number of Reflector Zones below Pin +# | | NREFT: Number of Reflector Zones above Pin +# | | | (Note: Below + Above <= 6) + 4 3 2 1 1 +# +# NZNODE(KZ): Number of Segments in Zone KZ +# 0.0476m Unheated section in the inlet tee +# | 3m Heated section + 0.001 Fictitious Gas Plenum +# | | 1.975m Unheated annular before the expansion joint +# | | | + 7 3 2 22 12 +# +# NT: Number of Radial Temperature Nodes in Fuel +# | + 14 1 10 +# +# IFUELV: Table Number of Property Value for Driver Fuel +# | IFUELB: Table Number of Property Value for Blanket Fuel +# | | ICLADV: Table Number for Cladding +# | | | + 15 3 1 0 1 +# +# NGRDSP: Number of spacer grids in pin +# | + 18 1 0 +# +# NPIN: Number of Pins per Subassembly +# | NSUBAS: Number of Subassemblies in Channel +# | | + 25 2 1 1 +# +# IRHOK: 0 for tabular fuel thermo-physical properties +# | + 3 1 0 +# + -1 +#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 +# +# GEOMIN: Geometry Input for Channel (Floating Point) +# +GEOMIN 61 1 0 +# +# ACCZ(KZ): Coolant Flow Area per Fuel Pin in Zone KZ +# | | | + 1 3 8.551E-04 8.551E-04 8.551E-04 +# +# AXHI(J): Length of Axial Segment J in Core and Blanket +# | | | | | + 8 5 0.15 0.15 0.15 0.15 0.15 + 13 5 0.15 0.15 0.15 0.15 0.15 + 18 5 0.15 0.15 0.15 0.15 0.15 + 23 5 0.15 0.15 0.15 0.15 0.15 +# +# DHZ(KZ): Hydraulic Diameter for Zone KZ +# | | | + 32 3 1.905E-2 1.905E-2 1.905E-2 +# +# DSTIZ(KZ): Thickness of Inner Structure Node in Zone KZ +# | | | + 39 3 2.54E-03 2.54E-03 2.54E-03 +# +# DSTOZ(KZ): Thickness of Outer Structure Node in Zone KZ +# | | | + 46 3 2.54E-03 2.54E-03 2.54E-03 +# +# PLENL: Length of Fission-Gas Plenum +# | + 53 1 0.001 # Made small relative to the entire heated section +# +# RBR(J): Cladding Inner Radius for Axial Segment J +# | + 54 1 9.0E-03 +# +# RER(J): Cladding Outer Radius for Axial Segment J +# | + 78 1 9.525E-03 +# +# RBRPL: Cladding Inner Radius in Fission-Gas Plenum +# | + 102 1 9.0E-03 +# +# RERPL: Cladding Outer Radius in Fission-Gas Plenum +# | + 103 1 9.525E-03 +# +# RINFP(J): Fuel Inner Radius for Axial Segment J +# | + 104 1 0.0E+00 +# +# ROUTFP(J): Fuel Outer Radius for Axial Segment J +# | + 128 1 9.0E-03 +# +# ZONEL(KZ): Length of Zone KZ +# 0.0476m Unheated section in inlet tee +# | 3m Heated section + 0.001m Gas Plenum +# | | 1.975m unheated annulus +# | | | + 152 3 0.500 3.001 2.000 +# +# SRFSTZ(KZ): Structure Perimeter per Pin in Zone KZ +# | | | + 159 3 1.197E-01 1.197E-01 1.197E-01 +# +# AREAPC: Coolant Plus Pin Area per Pin in the Pin Section +# | + 166 1 1.14E-03 +# +# RBR0: Nominal Cladding Inner Radius +# | RER0: Nominal Cladding Outer Radius +# | | + 180 2 9.0E-03 9.525E-03 +# +# SER(KZ): Reflector Perimeter, Pin Perimeter in +# Plenum Region when KZ = KZPIN +# | | | + 182 3 5.9847E-02 5.9847E-02 5.9847E-02 +# +# DRFO(KZ): Thickness of Outer Reflector Node/Cladding +# | | | + 169 3 5.25E-04 5.25E-04 5.25E-04 +# +# DRFI(KZ): Thickness of Inner Reflector Node in Zone KZ +# | | | + 189 3 5.25E-04 5.25E-04 5.25E-04 +# + -1 +#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 +# +# POWINC: Channel-Dependent Power Input (Floating Point) +# +POWINC 62 1 0 +# +# GAMSS: Fraction of Power from Direct Heating of Structure +# | + 2 1 1.0E-10 +# +# GAMTNC: Fraction of Power from Direct Heating of Coolant +# | GAMTNE: Fraction of Heating in Cladding +# | | + 4 2 1.0E-10 1.0E-10 +# +# PSHAPE(J): Ratio of Pin Power in Axial Segment J to Peak. +# | | | | | + 6 5 1.0 1.0 1.0 1.0 1.0 + 11 5 1.0 1.0 1.0 1.0 1.0 + 16 5 1.0 1.0 1.0 1.0 1.0 + 21 5 1.0 1.0 1.0 1.0 1.0 +# +# PSHAPR(I): Radial Power Shape within Pin +# | | | | | + 30 5 1.0 1.0 1.0 1.0 1.0 + 35 5 1.0 1.0 1.0 1.0 1.0 +# +# PRSHAP: Ratio of Average Power per Subassembly to +# | Average Power Over All Subassemblies +# | + 256 1 1.0 +# + -1 +#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 +# +# PMATCH: Channel-Dependent Properties Input (Floating Point) +# +PMATCH 63 1 0 +# +# XKSTIZ(KZ): Inner Structure Thermal Conductivity for Zone KZ +# | | | + 11 3 15.868 15.868 15.868 # Typical value @ 100 C +# +# XKSTOZ(KZ): Outer Structure Thermal Conductivity for Zone KZ +# | | | + 18 3 15.868 15.868 15.868 # Typical value @ 100 C +# +# P0GAS: Initial Plenum Gas Pressure at Reference Temperature TR +# | + 27 1 1.0E+05 # Fictitious +# +# XKRF(KZ): Reflector Thermal Coductivity for Zone KZ +# | | | + 28 3 15.868 15.868 15.868 # Typical value @ 100 C +# +# DENSS: Density of Solid Cladding at Reference Temperature TR +# | + 35 1 8.0E+03 +# +# RHOCSI(KZ): Density x Heat Capacity for Inner Structure +# | | | + 37 3 3.9293E+06 3.9293E+06 3.9293E+06 +# +# RHOCSO(KZ): Density x Heat Capacity for Outer Structure +# | | | + 44 3 3.9293E+06 3.9293E+06 3.9293E+06 +# +# RHOCR(KZ): Density x Heat Capacity for Reflector +# | | | + 51 3 3.9293E+06 3.9293E+06 3.9293E+06 +# +# RHOCG: Density x Heat Capacity for Gas in Plenum +# | RG: Thermal Resistance of Plenum Gas +# | | + 58 2 1.0E+03 0.06 # Fictitious +# +# REFDEN: Theoretical density of metal fuel at reference temperature +# | + 72 1 8.0E+03 +# + -1 +#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 +# +PMATCH 63 1 1 +# +# HBMAX: Max value of bond conductance when a gap exists +# | HBMIN: Minimum value of bond conductance +# | | + 5 2 1.0E+06 1.0E+00 +# +# HBPAR: Gap conductance = HBPAR/gap +# | (Used only if location 2-4 are zero) +# | + 7 1 64.0 +# + -1 +#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 +# +# COOLIN: Channel-Dependent Coolant Input (Floating Point) +# +COOLIN 64 1 0 +# +# AFR, BFR: Liquid Slug Friction Factor Coefficients +# | | + 1 2 0.3322 -0.25 +# +# C1, C2, C3: Coefficients for Convection Heat-Transfer Coefficient +# | | | + 3 3 1.077 0.4 0.0 +# +# RELAM: Re Number for Switch between Turb. and Lam. +# | AFLAM: Laminar Friction Factor = AFLAM/Re +# | | + 7 2 2000.0 95.36 +# +# W0: Initial Coolant Flow Rate per Pin (kg/s) +# | + 47 1 {{ flow_per_pin }} +# +# XKORI(K,M): Orifice coefficients +# K=1,2,3; @ Bottom of Zone K +# K=4; @ Top of Subassembly +# M=1,2; For upward & downward flow +# | | + 48 2 1.55 0.0 + 50 2 0.0 0.0 + 52 2 0.0 0.0 + 54 2 0.0 0.0 +# +# XKORGD: Orifice coefficient for spacer grids in pin +# | + 64 1 0.0 +# +# DZIAB, DZIAT: Effective Coolant Inertial Term Below/Above +# | | Subassembly Inlet/Outlet + 65 2 318.31 318.31 +# +# THETA1, THETA2: 0.5 Normally, 0/1 Implicit Calculation +# | | + 67 2 0 1. +# +# DTLMAX: Max. Coolant Temp. Change per Coolant Time Step +# | + 69 1 15.0 +# +# DTCMIN: Min. Coolant Time Step Size before Boiling +# | + 171 1 1.0E-05 +# + -1 +#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 +#=============================================================================== +# +# ###### ###### ### # # # ###### +# # # # # # ## ## # # # # +# # # # # # # # # # # # # # +# ###### ###### # # # # # # ###### +# # # # # # # ####### # # +# # # # # # # # # # # +# # # # ### # # # # # # +# +#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 +INPCOM 1 1 1 +# +# NPRES: Coolant driving pressure option +# | Negative value for # of entries in table +# | of normalized flow rate vs. time. + 19 1 -1 +# +# NT0TAB: Number of entries in T0TAB vs. T0TME table of +# | coolant inlet temperature vs. time. + 22 1 1 +# +# IPRION: PRIMAR-4 Option Flag +# | + 27 1 0 +# + -1 +#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 +# +# OPCIN: Channel Independent Variables (Floating Point) +# Time Steps and Convergence Criteria Data +# +OPCIN 11 1 1 +# +# DTP0: Initial PRIMAR Time Step Size +# | DTPMAX: Maximum PRIMAR Time Step Size Before +# | | Boiling Starts + 13 2 0.05 0.05 +# + -1 +#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 +PRIMIN 14 0 0 +# +# PX: Coolant Exit Pressure at ZPLENU +# | + 1 1 200000.0 +# +# PRETAB: Normalized inlet coolant driving pressure or +# | coolant flow rate at times listed in PRETME +# | + 5 1 1.0 +# +# T0TAB(L): Inlet Temperature at Time T0TME(L) +# | + 45 1 600.00 +# +# ZPLENL/ZPLENU: Inlet/Outlet Plenum Reference Elevation +# | | + 87 2 -0.500 5.000 +# + -1 +#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 +#=============================================================================== +# +# ####### ### # # ####### ##### ####### ####### ###### +# # # ## ## # # # # # # # +# # # # # # # # # # # # # +# # # # # # ##### ##### # ##### ###### +# # # # # # # # # # +# # # # # # # # # # # +# # ### # # ####### ##### # ####### # +# +#=============================================================================== +INPCOM 1 1 1 +# +# IPOWER: 0/1 = Reactivity/Power vs Time from PREA +# | + 8 1 1 +# +# MAXSTP: Maxiumum Number of Main (Power and Reactivity) +# | Time Steps + 11 1 99999 +# +# IPO: Number of Steps between Prints before IBLPRT or Boiling +# | IPOBOI: Number of Steps between Prints after IBLPRT or Boiling +# | | + 12 2 200 200 +# +# NPREAT: Number of Entries in PREA vs. Time Table +# | (Power or Reactivity vs Time) + 18 1 4 +# +# NOREAC: Main Time Step Intevals between PSHORT Print +# | + 41 1 200 +# +# IFIT(K): Input Table Lookup Options (K=1: Power/Reac vs. Time) +# | (0=Linear Fit) + 95 1 0 +# + -1 +#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 +POWINA 12 1 1 +# +# PREATB: Transient power table used by PREA +# | | | | + 29 4 1.0 1.0 1.0 1.0 +# +# PREATM: Times for PREATB +# | | | | + 49 4 0.0 10.0 20.0 10000.0 +# + -1 +#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 +OPCIN 11 1 1 +# +# DTMXB: Max heat transfer time-step after coolant boiling inception +# | + 6 1 0.01 +# +# TIMAX: Maximum Problem Time (s) +# | + 7 1 {{ tmax }} +# +# TCOSTP: # of CPU seconds reserved at end of run for writing restart files +# | + 9 1 15.0 +# +# DTPBOI: Max PRIMAR step size after start of boiling +# | + 15 1 0.01 +# +# DPINMX: Max change in inlet pressure per PRIMAR step +# | DTINMX: Max change in inlet temp per PRIMAR step +# | | DTMMXB: Max main time step after onset of boiling +# | | | + 19 3 1.0E+04 0.5 0.5 +# +# DTMIN: Time Step Sizes vs. Time +# | | + 95 2 0.05 0.05 +# +# TDTMIN: Time for Time Step Sizes +# | | + 105 2 0.0 10000.0 +# + -1 + +#=============================================================================== +# +# ###### ####### ### # # ####### +# # # # # # ## # # +# # # # # # # # # # +# ###### # # # # # # # +# # # # # # # # # +# # # # # # ## # +# # ####### ### # # # +# +# # # ### # # ####### ####### ### ##### ##### +# # # # ## # # # # # # # # +# # # # # # # # # # # # +# ### # # # # ##### # # # ##### +# # # # # # # # # # # # +# # # # # ## # # # # # # # +# # # ### # # ####### # ### ##### ##### +# +#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 +INPCOM 1 1 1 +# +# NDELAY: Number of Delayed Neutron Precursor Families +# | + 16 1 6 +# + -1 +#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 +POWINA 12 1 1 +# +# GENTIM: Prompt Neutron Lifetime +# | + 2 1 2.0E-07 +# +# BETADN(L): Effective Delayed Neutron Fract. for Family L +# | + 4 1 {{ betai_1 }} + 5 1 {{ betai_2 }} + 6 1 {{ betai_3 }} + 7 1 {{ betai_4 }} + 8 1 {{ betai_5 }} + 9 1 {{ betai_6 }} +# +# DECCON(L): Decay Constant for Precursor Family L +# | + 10 1 1.0E-02 + 11 1 3.0E-02 + 12 1 1.0E-01 + 13 1 3.0E-01 + 14 1 8.0E-01 + 15 1 3.0E+00 +# + -1 +#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 +INPCOM 1 1 1 +# +# IPOWER: 0/1 = Reactivity/Power vs Time from PREA +# | + 8 1 0 +# +# NPREAT: Number of Entries in PREA vs. Time Table +# | (Power or Reactivity vs Time) + 18 1 2 +# + -1 +#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 +POWINA 12 1 1 +# +# PREATB: Transient power table used by PREA +# | | | | | + 29 2 0.0 0.0 +# +# PREATM: Times for PREATB +# | | + 49 2 0.0 10000.0 +# + -1 +#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 +#=============================================================================== +# +# ###### ####### ##### # # # +# # # # # # # # # # +# # # # # # # # # +# # # ##### # # # # +# # # # # ####### # +# # # # # # # # # +# ###### ####### ##### # # # +# +# ###### ####### # # ####### ###### +# # # # # # # # # # # +# # # # # # # # # # # +# ###### # # # # # ##### ###### +# # # # # # # # # # +# # # # # # # # # # +# # ####### ## ## ####### # # +# +#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 +INPCHN 51 1 1 +# +# IDKCRV: Power or Decay Heat Curve for this Channel +# | + 203 1 0 +# + -1 +#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 +INPCOM 1 1 1 +# +# NDKGRP: Number of Decay Heat Groups +# | + 17 1 0 +# +# NPOWDK: Number of Power Curves or Sets of Decay Heat Parameters +# | + 45 1 0 +# + -1 +#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 +POWINA 12 1 1 +# +# DKBET2(L,IPW): Decay heat precursor yield for group L in +# | decay heat curve IPW (New Model) +# 511 1 0.020 +# 512 1 0.022 +# 513 1 0.017 +# 514 1 0.015 +# 515 1 0.014 +# 516 1 0.012 +# +# DKLAM2(L,IPW): Decay heat decay constant for group L in +# | decay heat curve IPW (New Model) +# 631 1 0.100 +# 632 1 0.050 +# 633 1 0.010 +# 634 1 0.005 +# 635 1 0.002 +# 636 1 0.0005 +# + -1 +#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 +# AXIAL!!! +#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 +INPCHN 51 1 1 +# +# IREACZ: Axial Reactivity Worth (0/1 = On MZ/MZC Mesh) +# | + 365 1 1 +# +# IAXEXP: Calculate Simple Axial Expansion Feedback +# | + 181 1 1 +# + -1 +#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 +INPCOM 1 1 1 +# +# MODEEX: Axial Expansion Option +# | 0: Force balance or free expansion (gap-dependent) +# | 1: Cladding control fuel expansion +# | 2: Independent free fuel-clad expansion +# | 3: Force balance all the time + 55 1 2 +# + -1 +#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 +PMATCH 63 1 1 +# +# FUELEX: Fuel Axial Expansion Coefficient +# | + 73 1 2.0E-05 +# +# CLADEX: Clad Axial Expansion Coefficient +# | + 74 1 1.4E-05 +# +# YFUEL: Fuel Young's Modulus +# | +# 75 1 2.8E+09 +# +# YCLAD: Clad Young's Modulus +# | +# 76 1 1.5E+11 +# +# EXPCFF: Effective Axial Expansion Multiplier +# | (For Simple Feedback Model Only) + 79 1 1.0 +# + -1 +#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 +# +# POWINC: Channel-Dependent Power Input (Floating Point) +# +POWINC 62 1 1 +# +# FUELRA: Doppler Axial Weighting Factor +# | + 208 1 0.0 Lower Reflector 1, Segment 1 + 209 1 0.0 Lower Reflector 1, Segment 2 + 216 1 1.1E-05 Fuel, Segment 1 + 217 1 1.3E-05 Fuel, Segment 2 + 218 1 1.6E-05 Fuel, Segment 3 + 219 1 1.9E-05 Fuel, Segment 4 + 220 1 2.3E-05 Fuel, Segment 5 + 221 1 2.4E-05 Fuel, Segment 6 + 222 1 2.7E-05 Fuel, Segment 7 + 223 1 3.1E-05 Fuel, Segment 8 + 224 1 3.6E-05 Fuel, Segment 9 + 225 1 4.0E-05 Fuel, Segment 10 + 226 1 3.7E-05 Fuel, Segment 11 + 227 1 3.3E-05 Fuel, Segment 12 + 228 1 2.5E-05 Fuel, Segment 13 + 229 1 1.9E-05 Fuel, Segment 14 + 230 1 7.0E-05 Fuel, Segment 15 + 231 1 1.4E-05 Fuel, Segment 16 + 232 1 1.4E-05 Fuel, Segment 17 + 233 1 1.4E-05 Fuel, Segment 18 + 234 1 1.4E-05 Fuel, Segment 19 + 235 1 1.4E-05 Fuel, Segment 20 + 236 1 1.0E-05 Gas Plenum, Segment 1 + 237 1 0.0 Gas Plenum, Segment 2 + 238 1 0.0 Upper Reflector 1, Segment 1 + 239 1 0.0 Upper Reflector 1, Segment 2 + 240 1 0.0 Upper Reflector 1, Segment 3 + 241 1 0.0 Upper Reflector 1, Segment 4 + 242 1 0.0 Upper Reflector 1, Segment 5 + 243 1 0.0 Upper Reflector 1, Segment 6 + 244 1 0.0 Upper Reflector 1, Segment 7 + 245 1 0.0 Upper Reflector 1, Segment 8 + 246 1 0.0 Upper Reflector 1, Segment 9 + 247 1 0.0 Upper Reflector 1, Segment 10 + 248 1 0.0 Upper Reflector 1, Segment 11 + 249 1 0.0 Upper Reflector 1, Segment 12 +# +# CLADRA: Doppler Axial Weighting Factor +# | + 160 1 0.0 Lower Reflector 1, Segment 1 + 161 1 0.0 Lower Reflector 1, Segment 2 + 168 1 9.0E-07 Fuel, Segment 1 + 169 1 1.9E-06 Fuel, Segment 2 + 170 1 2.3E-06 Fuel, Segment 3 + 171 1 2.5E-06 Fuel, Segment 4 + 172 1 2.8E-06 Fuel, Segment 5 + 173 1 3.0E-06 Fuel, Segment 6 + 174 1 3.5E-06 Fuel, Segment 7 + 175 1 4.8E-06 Fuel, Segment 8 + 176 1 5.2E-06 Fuel, Segment 9 + 177 1 4.6E-06 Fuel, Segment 10 + 178 1 3.9E-06 Fuel, Segment 11 + 179 1 3.5E-06 Fuel, Segment 12 + 180 1 2.4E-06 Fuel, Segment 13 + 181 1 2.2E-06 Fuel, Segment 14 + 182 1 1.8E-06 Fuel, Segment 15 + 183 1 1.2E-06 Fuel, Segment 16 + 184 1 2.4E-06 Fuel, Segment 17 + 185 1 2.2E-06 Fuel, Segment 18 + 186 1 1.8E-06 Fuel, Segment 19 + 187 1 1.2E-06 Fuel, Segment 20 + 188 1 8.0E-07 Gas Plenum, Segment 1 + 189 1 0.0 Gas Plenum, Segment 2 + 190 1 0.0 Upper Reflector 1, Segment 1 + 191 1 0.0 Upper Reflector 1, Segment 2 + 192 1 0.0 Upper Reflector 1, Segment 3 + 193 1 0.0 Upper Reflector 1, Segment 4 + 194 1 0.0 Upper Reflector 1, Segment 5 + 195 1 0.0 Upper Reflector 1, Segment 6 + 196 1 0.0 Upper Reflector 1, Segment 7 + 197 1 0.0 Upper Reflector 1, Segment 8 + 198 1 0.0 Upper Reflector 1, Segment 9 + 199 1 0.0 Upper Reflector 1, Segment 10 + 200 1 0.0 Upper Reflector 1, Segment 11 + 201 1 0.0 Upper Reflector 1, Segment 12 +# + -1 +#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 + + +#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 +# +# ###### ###### # # # # ###### # # +# # # # # # ## ## # # # # # # +# # # # # # # # # # # # # # # # +# ###### ###### # # # # # # # ###### ### ####### +# # # # # # # # ####### # # # +# # # # # # # # # # # # +# # # # # # # # # # # # +# +# # # ##### ##### ###### # +# ## ## # # # # # # +# # # # # # # # # # # +# # # # # # # # # ##### # +# # # # # # # # # # +# # # # # # # # # +# # # ##### ##### ###### ####### +# +#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 +# +INPCOM 1 1 1 +# +# IPRION: 4 triggers PRIMAR-4 option +# | + 27 1 4 + -1 +# +#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 +# +INPMR4 3 0 0 + -1 +# +PMR4IN 18 0 0 + -1 +# +#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 +# +INPMR4 3 1 0 +# +# NCVP: # Compressible Volumes, Primary Loop +# | NCVS: # Compressible Volumes, Secondary Loop +# | | NCVD: # CV in DRACS Loop +# | | | NSEGLP: # Liquid Segments, Primary Loop +# | | | | NSEGLP: # Liquid Segments, Secondary Loop +# | | | | | + 1 5 4 0 0 4 0 +# +# NELEMT: Total # of Liquid Flow Elements +# | + 10 1 7 +# +# ITYPCV: Compressible Volume Type +# 1 = Inlet Plenum +# 4 = Almost incompressible liquid, no gas +# 7 = Outlet plenum with cover gas +# 8 = Pool with Cover Gas +# +# Lower end of the inlet Tee +# | Between the reducer and the expansion joint +# | | Tee before flow meter +# | | | Pressurizer tank +# | | | | + 11 4 1 4 4 8 +# +# ITYPEL: Liquid Flow Element Type +# 1 = Core Subassemblies +# 2 = Bypass Channel +# 3 = Pipe +# 5 = Pump Impeller +# 6 = IHX, Shell Side +# 11 = Valve +# +# Core Pipe IHX Pipe Pump Pipe Pipe +# | | | | | | | + 49 7 1 3 6 3 5 3 3 +# +# JCVL: Compressible Volumes at ends of Liquid Segments +# in out +# | | + 189 2 1 2 # Segment 1: inlet tee (CV1) ~ reducer top (CV2) + 191 2 2 3 # Segment 2: reducer top (CV2) ~ tee before FM (CV3) + 193 2 3 1 # Segment 3: tee before FM (CV3) ~ inlet tee (CV1) + 195 2 3 4 # Segment 4: tee before FM (CV3) ~ tank (CV4) +# +# NELML: # of Elements in Liquid Segment +# | | | | + 325 4 1 3 3 1 +# +# JFSELL: First Element # in Segments +# | | | | + 365 4 1 2 5 7 +# +# NPUMP: # of Water Pumps +# | IELPMP: Element # of Pump +# | | + 405 2 1 5 +# +# IEMPMP: Type of Pump (IEMPMP = 2 for Homologous Pump Model) +# | (IEMPMP = 0 for table of head vs time) + 418 1 0 +# +# ILRPMP: Pump Operation Option +# | + 430 1 0 +# +# NIHX: Number of Intermediate Heat Exchangers +# | + 470 1 1 +# +# IELIHX: Element index of IHX in primary loop +# | + 473 1 3 +# +# IHXCLC: IHX Detailed or Simple model option +# | (0 = Use Detailed Model) +# | (1 = Use Simple Model) + 489 1 -1 # Negative for outlet temperature vs time +# +# IPRADJ: Inlet/Outlet Plena Pressure Adjustment Option +# | + 497 1 1 +# +# NTGPT: # of Temperature Groups +# | + 512 1 5 +# +# NTNODE: # of Nodes in the Temperature Group. +# 2 nodes for tabular IHX. +# | | | | | + 513 5 20 2 20 20 20 +# +# IFSTEL: First Element in Temperature Group +# | | | | | + 613 5 2 3 4 5 7 +# +# ILSTEL: Last Element in Temperature Group +# | | | | | + 713 5 2 3 4 6 7 +# +# ISSIHX: Steady-state IHX temperature drop, if 1, user specifies +# | + 1155 1 0 +# +# ISSPMP: Steady-state pump head, if 1, user specifies +# | + 1159 1 0 +# +# IPIPTM: Pipe Temp Convection Differencing Approx. (Recommended = 2) +# | Multiple Inlet/Outlet Plenum Option +# | | + 1310 2 2 0 +# +#################################### +# Binary output setting for PRIMAR-4 +#################################### +# +# IP4PRT: How many PRIMAR steps to print PRIMAR-4 results +# | NBINOT: # of IBINOT entries for PRIMAR-4.dat +# | | IBINST: Output every IBINST steps to PRIMAR-4.dat +# | | | + 890 3 2000 16 200 +# +# IBINOT: Identification of output entries +# | see Manual Table A2.2-1 +# |||||| + 893 1240001 # Temperature of CV1 (inlet plenum) + 894 1240002 # Temperature of CV2 (outlet plenum) + 895 1240003 # Temperature of CV3 (tee to tank) + 896 1240004 # Temperature of CV4 (tank) + 897 1300003 # IHX Inlet Temperature (IELL=3) + 898 1300403 # IHX Outlet Temperature (IELL=3) + 899 1010001 # Flow Rate of S1 (core) + 900 1010002 # Flow Rate of S2 (core to tee) + 901 1010003 # Flow Rate of S3 (tee to core) + 902 1010004 # Flow Rate of S4 (tee to tank) + 903 1170004 # Gas Pressure of CV4 (tank) + 904 1160001 # Liquid Pressure of CV1 (inlet plenum) + 905 1160002 # Liquid Pressure of CV2 (outlet plenum) + 906 1160003 # Liquid Pressure of CV3 (tee to tank) + 907 1160004 # Liquid Pressure of CV4 (tank) + 908 1180001 # Pump Head +# + -1 +# +#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 +# +PMR4IN 18 1 0 +# +#################################### +# Liquid Segment Setting +#################################### +# +# FLOSSL: Initial flow rate in liquid flow segments. Important for convergence. +# | | | | + 2 4 0.8 0.8 0.8 1.0E-12 +# +# ZINL: Height of inlet to the liquid segment +# | | | | + 42 4 -0.500 5.000 -0.500 -0.500 +# +# CVLMLT: Multiplicity Factors at Liquid Segment Ends +# | | | | + 82 4 1.0 1.0 1.0 1.0 + 86 4 1.0 1.0 1.0 1.0 +# +#################################### +# Liquid Element Setting +#################################### +# +# ZOUTEL: Height at Outlet of the liquid element +# | | | | | + 162 5 5.000 5.500 5.000 -0.500 -0.500 + 167 2 -0.500 0.5270 +# +# XLENEL: Liquid element length (Pump:5) +# | | | | | + 302 5 5.500 2.500 0.500 5.500 0.0001 + 307 2 2.000 10.000 +# +# AREAEL: Cross-sectional flow area of liquid elements +# | | | | | + 442 5 8.5507E-04 2.1649E-03 1.0459E-02 2.1649E-03 1.3134E-03 + 447 2 1.3134E-03 9.3691E-05 +# +# DHELEM: Hydraulic Diameter of liquid elements +# | | | | | + 582 5 1.9050E-02 5.2501E-02 1.0255E-02 5.2501E-02 4.0894E-02 + 587 2 4.0894E-02 1.0922E-02 +# +# ROUGHl: Pipe Surface Roughness +# | | | | | + 722 5 2.0E-05 2.0E-05 2.0E-05 2.0E-05 2.0E-05 + 727 2 2.0E-05 2.0E-05 +# +# BENDNM: Number of Bends in Each Liquid Element +# | | | | | + 862 5 0.0 1.0 0.0 0.0 0.0 + 867 2 0.0 0.0 +# +################## +# +# G2PRDR: Initial Orifice Coefficient, normally 0 as input +# | | | | | + 1002 5 0.0 0.0 100.0 0.0 0.0 + 1007 2 0.0 0.0 +# +# BNDLOD: Effective L/D per bend +# | + 1142 1 11.52 +# +# WALLMC: Pipe wall mass times heat capacity/length +# | | | | | + 1143 5 1.0 1.0 1.0 1.0 1.0 + 1148 2 1.0 1.0 +# +# WALLH: Pipe wall heat transfer coefficient +# | | | | | + 1283 5 1.0 1.0 1.0 1.0 1.0 + 1288 2 1.0 1.0 +# +#################################### +# Compressible Volume Setting +#################################### +# +# VOLLGC: Total Volume of Compressible Volumes +# | | | | + 1423 4 2.981E-04 8.798E-04 1.021E-03 1.392 + +# VOLSG0: Initial Gas Volume +# | | | | + 3612 4 0.0 0.0 0.0 0.405 +# +# PRESG0: Initial Gas Pressure in CV +# | | | | + 1461 4 0.0 0.0 0.0 200000.0 +# +# ALPHAP: CV volume pressure expansion coefficient +# | | | | + 1499 4 1.0E-08 1.0E-08 1.0E-08 0 + +# ALPHAT: CV volume thermal expansion coefficient +# | | | | + 1537 4 2.0E-05 2.0E-05 2.0E-05 2.0E-05 +# +# BTAPNA: Water isothermal compressibility for the CV +# | | | | + 2464 4 2.0E-10 2.0E-10 2.0E-10 2.0E-10 +# +# BTATNA: Water thermal expansion coefficient for the CV +# | | | | + 2502 4 3.0E-04 3.0E-04 3.0E-04 3.0E-04 +# +# ZCVL: CV reference height for liquid pressure +# | | | | + 1575 4 -0.500 5.000 -0.500 0.527 +# +# AREAIN: Liquid-Gas Interface Area in CV (1.0 if no gas) +# | | | | + 1613 4 1.0 1.0 1.0 0.800 +# +# TREFCV: Steady-state gas temperature in CV +# | Input as 0.0 to use liquid temperature +# | | | | + 1651 4 0.0 0.0 0.0 0.0 +# +# HWALL: Wall-coolant heat-transfer coefficient for CV at reference temperature +# | | | | + 2578 4 1.0 1.0 1.0 1.0 +# +# AWALL: Wall surface area +# Modeled as a 8.938" long 1.5" Sch. 40 pipe +# | Modeled as a 16" long 2" Sch. 40 pipe +# | | Modeled as a 13" long 2.5" Sch. 40 pipe +# | | | Modeled as a 37" I.D. 79" tall cylinder +# | | | | + 2616 4 0.0292 0.0670 0.0651 4.1097 +# +# CMWALL: CV Wall mass times specific heat +# | | | | + 2654 4 1.0 1.0 1.0 1.0 +# +#################################### +# Cover Gas Data +#################################### +# +# Values given are for nitrogen gas at 100C +# +# GAMGSC: Cp/Cv for cover gas +# | + 1689 1 1.40 +# +# RGASC: Gas constant for cover gas. +# | + 1690 1 296.80 +# +# U0CVGS: Cover gas viscosity +# | + 1691 1 2.12E-05 +# +# TRFU: Gas viscosity reference temperature +# | + 1692 1 373.15 +# +# TAUGAS: Cover-gas temperature time constant. +# | | | | + 1861 4 1.0 1.0 1.0 2.0 +# +#################################### +# Simple Pump Setting +#################################### +# +# APMPHD: Value Table of Relative Pump Head (-) +# | | | | + 1983 4 1.0 1.0 1.0 1.0 + 1987 4 1.0 1.0 1.0 1.0 +# +# AMOTTK: Time Table of Relative Pump Head (s) +# | | + 2223 2 0.0 100 +# +# GRAVTY: Acceleration due to gravity +# | + 2463 1 9.80665 +# +#################################### +# Simple IHX Model Setting +#################################### +# +# DTMPTB: Table of exit temperature for IHX +# | | | | + 2937 4 600.00 600.00 600.00 600.00 +# +# ZCENTR: Height of thermal center for IHX +# | | | | + 3105 4 5.250 5.250 5.250 5.250 +# +# TMPMTB: Times for DTMPTB and ZCENTR +# | | | | + 3273 4 0.0 10.0 20.0 10000.0 +# +# C1PIPE, C2PIPE, C3PIPE: Conductance coefficient for pipe, recommended values +# | | | + 3650 3 0.025 0.8 4.80 +# +# EPSF: Maximum fractional change in liquid segment flow rate per time step +# | EPSFC: Maximum fractional change in core inlet flow rate +# | | per time step + 4282 2 0.2 0.1 +# +# DTIHX: Steady-state temperature drop across IHX +# | (Used only if ISSIHX > 0) +# 4284 1 1.0 +# +#################################### +# +# TPLCV: Temperature of CV. Entered only for inlet plena +# | + 4685 1 600.00 +# +# PPLCV: CV pressure for outlet plena only +# | + 4724 1 200000.0 +# +# ZPLENC: CV reference elevation for plena only +# | | + 4761 2 -0.500 5.000 +# + -1 +#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 +INPCOM 1 1 1 +# +# KPROPI: > 0 to input correlation coefficients in APROPI +# | This is probably reset by ICLPRP + 114 1 1 +# +# ICLPRP: 1 for Sodium (SAS4A version) +# | + 118 1 1 +# + -1 +#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 +# +######## ####### ####### ####### ####### ####### ####### ####### ####### ####### +ENDJOB -1 +######## ####### ####### ####### ####### ####### ####### ####### ####### ####### \ No newline at end of file diff --git a/src/watts_ui/examples/1App_SAS_SodiumLoop/watts_comprehensive.son b/src/watts_ui/examples/1App_SAS_SodiumLoop/watts_comprehensive.son new file mode 100644 index 00000000..9ff8c305 --- /dev/null +++ b/src/watts_ui/examples/1App_SAS_SodiumLoop/watts_comprehensive.son @@ -0,0 +1,34 @@ +watts{ + % Change the working directory to the directory where the input files are stored. This is necessary + % due to how WATTS copies input files to the temporary working directory. + workflow_dir = "/Users/zhieejhiaooi/Documents/ANL/watts-devel/watts/src/watts_ui/examples/1App_SAS_SodiumLoop" + + plugins{ + plugin(ID1){ + code = "sas" + template = "sas_template" + exec_dir = "SAS_DIR" + show_stderr = False + show_stdout = False + % conv_channel = "path\to\CHANNELtoCSV.x" % Assumed to be in the same dir as the SAS executable if not provided + % conv_primar4 = "path\to\PRIMAR4toCSV.x" % Assumed to be in the same dir as the SAS executable if not provided + } + } + + workflow_level1{ + plugin = ID1 + variables{ + param(sas_version) {value = 5.5} + param(tmax) {value = 1000.0} + param(flow_per_pin) {value = 0.15} + param(total_reactor_power) {value = 20.0 unit = kW} + param(betai_1) {value = 2.0E-04} %Effective delayed neutron fraction + param(betai_2) {value = 1.0E-03} + param(betai_3) {value = 1.2E-03} + param(betai_4) {value = 2.5E-03} + param(betai_5) {value = 1.5E-03} + param(betai_6) {value = 5.0E-04} + } + } + +} \ No newline at end of file diff --git a/src/watts_ui/examples/1App_SAS_SodiumLoop/watts_exec.py b/src/watts_ui/examples/1App_SAS_SodiumLoop/watts_exec.py new file mode 100644 index 00000000..26716df7 --- /dev/null +++ b/src/watts_ui/examples/1App_SAS_SodiumLoop/watts_exec.py @@ -0,0 +1,73 @@ +# SPDX-FileCopyrightText: 2022 UChicago Argonne, LLC +# SPDX-License-Identifier: MIT + +""" +Example problem of runing SAS4A/SASSY-1 with WATTS. +This is a simple sodium loop that uses the channel (core) +and PRIMAR-4 module. Sodium is heated in the core, then +flows upwward through a series of pipes to a heat +exchanger (IHX), then downward to a pump, and lastly +back to the outlet of the core. A tank with cover gas is +used to provide compressible space. The design of +loop is a simplified version of the loop by Zhang et al. +(https://doi.org/10.1016/j.nucengdes.2021.111149). The +dimensions of this simplified loop are arbitrarily selected. + ___ + -------------------[ ] + | [ ] + | [ I ] + | P [ H ] + | I [ X ] + | P [ ] + | E [___] + | | + | | + * | + * | + * | + * | + * | + * C | + * O | ____________ + * R | | | + * R | | | + * | |------------| + * | | | + * | | | + * | | | + * ____ | | + * [ ] | | + -------------------[ ]----------|____________| + [____] TANK + PUMP +""" + +from math import cos, pi +import os +import watts +from astropy.units import Quantity + + +params = watts.Parameters() + +# Channel params +params['sas_version'] = 5.5 +params['tmax'] = 1000.0 # maximum problem time in s +params['flow_per_pin'] = 0.15 # kg/s +params['total_reactor_power'] = Quantity(20, "kW") +params['betai_1'] = 2.0E-04 # Effective delayed neutron fraction +params['betai_2'] = 1.0E-03 +params['betai_3'] = 1.2E-03 +params['betai_4'] = 2.5E-03 +params['betai_5'] = 1.5E-03 +params['betai_6'] = 5.0E-04 + +params.show_summary(show_metadata=False, sort_by='key') + +# SAS Workflow +sas_plugin = watts.PluginSAS('sas_template') # Show all the output +sas_result = sas_plugin(params) +for key in sas_result.csv_data: + print(key, sas_result.csv_data[key]) +print(sas_result.inputs) +print(sas_result.outputs) diff --git a/src/watts_ui/examples/Parametric_SAM_VHTR/sam_junction_template b/src/watts_ui/examples/Parametric_SAM_SimpleJunction/sam_template similarity index 100% rename from src/watts_ui/examples/Parametric_SAM_VHTR/sam_junction_template rename to src/watts_ui/examples/Parametric_SAM_SimpleJunction/sam_template diff --git a/src/watts_ui/examples/Parametric_SAM_VHTR/watts_comprehensive.son b/src/watts_ui/examples/Parametric_SAM_SimpleJunction/watts_comprehensive.son similarity index 63% rename from src/watts_ui/examples/Parametric_SAM_VHTR/watts_comprehensive.son rename to src/watts_ui/examples/Parametric_SAM_SimpleJunction/watts_comprehensive.son index d7545cfa..4dde9af0 100644 --- a/src/watts_ui/examples/Parametric_SAM_VHTR/watts_comprehensive.son +++ b/src/watts_ui/examples/Parametric_SAM_SimpleJunction/watts_comprehensive.son @@ -1,25 +1,16 @@ watts{ + % Change the working directory to the directory where the input files are stored. This is necessary + % due to how WATTS copies input files to the temporary working directory. + workflow_dir = "/Users/zhieejhiaooi/Documents/ANL/watts-devel/watts/src/watts_ui/examples/Parametric_SAM_SimpleJunction" + plugins{ plugin(ID1){ - code = moose -% template = sam_junction_template - template = "/Users/zhieejhiaooi/Documents/ANL/watts-devel/watts/src/watts_ui/examples/1App_SAM_VHTR/sam_junction_template" -% extra_inputs = [input1 input2] + code = "moose" + template = "sam_template" exec_dir= SAM_DIR exec_name = "sam-opt" show_stderr = False show_stdout = False - output = "out.txt" - } - plugin(ID2){ - code = openmc - template = "my_template.tmpl" - extra_inputs = [input1 input2] - } - plugin(ID3){ - code = MCNP - template = "my_template.tmpl" - extra_inputs = [input1 input2] } } diff --git a/src/watts_ui/examples/Parametric_SAM_VHTR/watts_exec.py b/src/watts_ui/examples/Parametric_SAM_SimpleJunction/watts_exec.py similarity index 100% rename from src/watts_ui/examples/Parametric_SAM_VHTR/watts_exec.py rename to src/watts_ui/examples/Parametric_SAM_SimpleJunction/watts_exec.py diff --git a/src/watts_ui/examples/Parametric_SAM_VHTR/sam_template b/src/watts_ui/examples/Parametric_SAM_VHTR/sam_template deleted file mode 100644 index 34178bcf..00000000 --- a/src/watts_ui/examples/Parametric_SAM_VHTR/sam_template +++ /dev/null @@ -1,149 +0,0 @@ -## Component functional requirement test case: PBOneDFluidComponent -## Requirement: Model simplified 1D single phase flow -## with user-specified flow geometry (A and Dh). - -## Acceptance criteria: The inlet mass flow rate (determined by A) -## must match the hand-calculated value within a tolerance of 1e-12. -## The pressure drop for a given constant friction (determined by Dh) -## must match the hand-calculated value within a tolerance of 1e-3. - -A = 3.14e-4 -v = {{ velocity }} -rho = 865.51 -mu = 2.6216e-4 -Dh = {{ Dh }} -# The friction factor is -f = 0.01 -# The inlet flow rate is -m_dot = ${fparse rho*v*A} -# The pressure drop is -dP = ${fparse f/Dh*rho*v*v/2} - -[GlobalParams] - global_init_P = 1.0e5 - global_init_V = ${v} - global_init_T = 628.15 -[] - -[EOS] - [eos] # Simple linearized Sodium approximation - type = PTConstantEOS - p_0 = 1e5 # Pa - rho_0 = ${rho} # kg/m^3 - beta = 2.7524e-4 # K^{-1} - cp = 1272.0 # at Tavg; - h_0 = 7.9898e5 # J/kg - T_0 = 628.15 # K - mu = ${mu} # Pa-s - k = 72 # W/m-K - [] -[] - - -[Components] - [pipe1] - type = PBOneDFluidComponent - eos = eos - position = '0 0 0' - orientation = '0 1 0' - - A = ${A} # Check cross-sectional flow area is used - Dh = ${Dh} # Check hydraulic diameter is used - length = 1.0 - n_elems = 10 - - f = ${f} - [] - - [inlet] - type = PBTDJ - input = 'pipe1(in)' - eos = eos - v_bc = ${v} - T_bc = 628.15 - [] - - [outlet] - type = PBTDV - input = 'pipe1(out)' - eos = eos - p_bc = '1.0e5' - [] -[] - -[Preconditioning] - [SMP_PJFNK] - type = SMP - full = true - solve_type = 'PJFNK' - petsc_options_iname = '-pc_type' - petsc_options_value = 'lu' - [] -[] - -[Postprocessors] - [m_dot_inlet] - type = ComponentBoundaryFlow - input = pipe1(in) - outputs = none - [] - [P_outlet] - type = ComponentBoundaryVariableValue - input = pipe1(out) - variable = pressure - outputs = none - [] - [P_inlet] - type = ComponentBoundaryVariableValue - input = pipe1(in) - variable = pressure - outputs = none - [] - [DeltaP] - type = DifferencePostprocessor - value1 = P_inlet - value2 = P_outlet - outputs = none - [] - [check_requirement_A] - type = PostprocessorComparison - comparison_type = equals - value_a = ${m_dot} - value_b = 'm_dot_inlet' - [] - [check_requirement_Dh] - type = PostprocessorComparison - comparison_type = equals - value_a = ${dP} - value_b = 'DeltaP' - absolute_tolerance = 1e-3 - [] -[] - -[Executioner] - type = Steady - - petsc_options_iname = '-ksp_gmres_restart' - petsc_options_value = '100' - - nl_rel_tol = 1e-8 - nl_abs_tol = 1e-7 - nl_max_its = 20 - l_tol = 1e-4 - l_max_its = 100 - - [Quadrature] - type = TRAP - order = FIRST - [] -[] - -[Outputs] - print_linear_residuals = false - [csv] - type = CSV - [] - [console] - type = Console - [] -[] diff --git a/src/watts_ui/examples/PicardIterations_SAM-OpenMC_VHTR/watts_comprehensive.son b/src/watts_ui/examples/PicardIterations_SAM-OpenMC_VHTR/watts_comprehensive.son index 119d2810..46b9357f 100644 --- a/src/watts_ui/examples/PicardIterations_SAM-OpenMC_VHTR/watts_comprehensive.son +++ b/src/watts_ui/examples/PicardIterations_SAM-OpenMC_VHTR/watts_comprehensive.son @@ -1,27 +1,26 @@ watts{ + % Change the working directory to the directory where the input files are stored. This is necessary + % due to how WATTS copies input files to the temporary working directory. + workflow_dir = "/Users/zhieejhiaooi/Documents/ANL/watts-devel/watts/src/watts_ui/examples/PicardIterations_SAM-OpenMC_VHTR" + plugins{ plugin(ID1){ code = moose -% template = sam_junction_template - template = "/Users/zhieejhiaooi/Documents/ANL/watts-devel/watts/src/watts_ui/examples/PicardIterations_SAM-OpenMC_VHTR/sam_template" -% extra_inputs = [input1 input2] + template = "sam_template" exec_dir= SAM_DIR exec_name = "sam-opt" show_stderr = False show_stdout = False - output = "out.txt" } plugin(ID2){ code = openmc - module_dir = "/Users/zhieejhiaooi/Documents/ANL/watts-devel/watts/src/watts_ui/examples/PicardIterations_SAM-OpenMC_VHTR" - template = "/Users/zhieejhiaooi/Documents/ANL/watts-devel/watts/src/watts_ui/examples/PicardIterations_SAM-OpenMC_VHTR/openmc_template.py" + template = "openmc_template.py" scores = ["nu-fission"] % Name of scores for OpenMC tallies. This will be the base name used for saving the tallies. score_names = ["Init_P"] % A more representative name for the scores } } workflow_level1{ -% plugin = ID2 variables{ param(He_inlet_temp) {value = 873.15} param(He_outlet_temp) {value = 1023.15} @@ -38,7 +37,6 @@ watts{ param("Init_P_4") {value = 1} param("Init_P_5") {value = 1} - param(ax_ref) {value = 2.0} param(num_cool_pins) {value = 24} param(num_fuel_pins) {value = 44} @@ -66,7 +64,7 @@ watts{ plugin_main = ID1 plugin_sub = ID2 nmax = 10 - convergence_params = keff % Make sure that this parameter is po + convergence_params = "keff" convergence_criteria = 0.0001 to_sub_params = ["avg_Tf_1" "avg_Tf_2" "avg_Tf_3" "avg_Tf_4" "avg_Tf_5"] to_main_params = ["Init_P_1" "Init_P_2" "Init_P_3" "Init_P_4" "Init_P_5"] diff --git a/src/watts_ui/watts_ui.py b/src/watts_ui/watts_ui.py index 019c275a..8d17fb75 100755 --- a/src/watts_ui/watts_ui.py +++ b/src/watts_ui/watts_ui.py @@ -12,8 +12,6 @@ import watts from wasppy import xml2obj -import openmc - ### # etc nstauff$ cp watts.py /Applications/Workbench-5.0.0.app/Contents/rte/ # pywatts nstauff$ mkdir bin @@ -66,19 +64,32 @@ def create_plugins(plugins): for it, plg in enumerate(watts_wb.plugins.plugin): nested_plugins = {} - # Initialize as False + # Initialize + nested_plugins['exec_dir'] = None + nested_plugins['extra_inputs'] = None + nested_plugins['extra_template_inputs'] = None nested_plugins['show_stderr'] = False nested_plugins['show_stdout'] = False + nested_plugins['plotfl_to_csv'] = False + # Save string plugin inputs nested_plugins['code'] = str(plg.code.value).strip('\"') nested_plugins['template'] = str(plg.template.value).strip('\"') if plg.exec_dir is not None: nested_plugins['exec_dir'] = str(plg.exec_dir.value).strip('\"') - if plg.module_dir is not None: - nested_plugins['module_dir'] = str( - plg.module_dir.value).strip('\"') if plg.exec_name is not None: nested_plugins['exec_name'] = str(plg.exec_name.value).strip('\"') + if plg.auto_link_files is not None: + nested_plugins['auto_link_files'] = str( + plg.auto_link_files.value).strip('\"') + if plg.conv_channel is not None: + nested_plugins['conv_channel'] = str( + plg.conv_channel.value).strip('\"') + if plg.conv_primar4 is not None: + nested_plugins['conv_primar4'] = str( + plg.conv_primar4.value).strip('\"') + + # Save list plugin inputs if plg.extra_inputs is not None: nested_plugins['extra_inputs'] = convert_to_list(plg.extra_inputs) if plg.extra_template_inputs is not None: @@ -88,12 +99,16 @@ def create_plugins(plugins): nested_plugins['scores'] = convert_to_list(plg.scores) if plg.score_names is not None: nested_plugins['score_names'] = convert_to_list(plg.score_names) - if plg.output is not None: - nested_plugins['output'] = str(plg.output.value) + if plg.extra_args is not None: + nested_plugins['extra_args'] = convert_to_list(plg.extra_args) + + # Save bool plugin inputs if plg.show_stderr is not None and str(plg.show_stderr.value).capitalize() == 'True': nested_plugins['show_stderr'] = True if plg.show_stdout is not None and str(plg.show_stdout.value).capitalize() == 'True': nested_plugins['show_stdout'] = True + if plg.plotfl_to_csv is not None and str(plg.plotfl_to_csv.value).capitalize() == 'True': + nested_plugins['plotfl_to_csv'] = True watts_plugins[str(plg.id)] = nested_plugins @@ -283,37 +298,117 @@ def run_direct(watts_params, plugin): WATTS results """ - if plugin['code'].upper() == 'MOOSE': - if 'exec_dir' in plugin: + # Provide the environment variable that is the path + # to the directory of the application. If environment + # variable is not set, provide the path to the directory + # instead. + if plugin['exec_dir'] is not None: + if plugin['exec_dir'] in os.environ: app_dir = Path(os.environ[plugin['exec_dir']]) else: - raise RuntimeError("Please provide path to MOOSE app directory.") + app_dir = Path(plugin['exec_dir']) + if plugin['code'].upper() == 'MOOSE': if 'exec_name' not in plugin: raise RuntimeError( "Please specify executable name of the MOOSE application.") + app_plugin = watts.PluginMOOSE( - plugin['template'], + template_file=plugin['template'], executable=app_dir / plugin['exec_name'], + extra_inputs=plugin['extra_inputs'], + extra_template_inputs=plugin['extra_template_inputs'], show_stdout=plugin['show_stdout'], show_stderr=plugin['show_stderr']) - app_result = app_plugin(watts_params) - elif plugin['code'].upper() == 'OPENMC': + elif plugin['code'].upper() == 'PYARC': + app_plugin = watts.PluginPyARC( + template_file=plugin['template'], + extra_inputs=plugin['extra_inputs'], + extra_template_inputs=plugin['extra_template_inputs'], + show_stdout=plugin['show_stdout'], + show_stderr=plugin['show_stderr']) + + elif plugin['code'].upper() == 'RELAP5': + app_plugin = watts.PluginRELAP5( + template_file=plugin['template'], + extra_inputs=plugin['extra_inputs'], + extra_template_inputs=plugin['extra_template_inputs'], + plotfl_to_csv=plugin['plotfl_to_csv'], + show_stdout=plugin['show_stdout'], + show_stderr=plugin['show_stderr']) + + elif plugin['code'].upper() == 'SAS': + app_plugin = watts.PluginSAS( + template_file=plugin['template'], + extra_inputs=plugin['extra_inputs'], + extra_template_inputs=plugin['extra_template_inputs'], + show_stdout=plugin['show_stdout'], + show_stderr=plugin['show_stderr']) + + if 'conv_channel' in plugin: + app_plugin.conv_channel = Path(plugin['conv_channel']) + if 'conv_primar4' in plugin: + app_plugin.conv_primar4 = Path(plugin['conv_primar4']) + + elif plugin['code'].upper() == 'SERPENT': + app_plugin = watts.PluginSerpent( + template_file=plugin['template'], + extra_inputs=plugin['extra_inputs'], + extra_template_inputs=plugin['extra_template_inputs'], + show_stdout=plugin['show_stdout'], + show_stderr=plugin['show_stderr']) - # Insert path of directory OpenMC template - # file then import the OpenMC model. - if 'module_dir' in plugin: - sys.path.insert(0, plugin['module_dir']) + elif plugin['code'].upper() == 'DAKOTA': + app_plugin = watts.PluginDakota( + template_file=plugin['template'], + extra_inputs=plugin['extra_inputs'], + extra_template_inputs=plugin['extra_template_inputs'], + auto_link_files=plugin['auto_link_files'], + show_stdout=plugin['show_stdout'], + show_stderr=plugin['show_stderr']) + + elif plugin['code'].upper() == 'ABCE': + app_plugin = watts.PluginABCE( + template_file=plugin['template'], + extra_inputs=plugin['extra_inputs'], + extra_template_inputs=plugin['extra_template_inputs'], + show_stdout=plugin['show_stdout'], + show_stderr=plugin['show_stderr']) + + elif plugin['code'].upper() == 'MCNP': + app_plugin = watts.PluginMCNP( + template_file=plugin['template'], + extra_inputs=plugin['extra_inputs'], + extra_template_inputs=plugin['extra_template_inputs'], + show_stdout=plugin['show_stdout'], + show_stderr=plugin['show_stderr']) + + elif plugin['code'].upper() == 'OPENMC': + sys.path.insert(0, os.getcwd()) from openmc_template import build_openmc_model app_plugin = watts.PluginOpenMC( - build_openmc_model, show_stderr=True) # show only error + model_builder=build_openmc_model, + extra_inputs=plugin['extra_inputs'], + show_stdout=plugin['show_stdout'], + show_stderr=plugin['show_stderr']) # show only error + + else: + raise RuntimeError("Please provide the correct application name.") + + # Set 'extra_args' if available + if 'extra_args' in plugin: + app_plugin(watts_params, extra_args=plugin['extra_args']) - app_result = app_plugin(watts_params) + # Run plugins and save to app_result + app_result = app_plugin(watts_params) - # Save keff results + # Store output data from app_result to watts_params + # Special treatment for OpenMC + if plugin['code'].upper() == 'OPENMC': + # Save keff results if hasattr(app_result, 'keff'): watts_params['keff'] = app_result.keff @@ -327,11 +422,16 @@ def run_direct(watts_params, plugin): watts_params[f"{plugin['score_names'][n_score]}_{i}"] = result else: watts_params[f"{score}_{i}"] = result - - # Store results to watts_params - if hasattr(app_result, 'csv_data'): - for key in app_result.csv_data: - watts_params[key] = app_result.csv_data[key] + else: + if hasattr(app_result, 'csv_data'): + for key in app_result.csv_data: + watts_params[key] = app_result.csv_data[key] + elif hasattr(app_result, 'output_data'): + for key in app_result.output_data: + watts_params[key] = app_result.output_data[key] + else: + for key in app_result: + watts_params[key] = app_result[key] return (watts_params, app_result) @@ -376,7 +476,7 @@ def run_iterate(watts_params, plugin, wf_level): # Extract the values of the last index of the iterating # parameters. This step is necessary because the results # created by WATTS plugins could be list or ndarray with - # multiple values (especially for transient). + # multiple values (especially for MOOSE based app). watts_params = get_last_value(watts_params, to_sub_params) # Run the sub plugin @@ -386,7 +486,7 @@ def run_iterate(watts_params, plugin, wf_level): # Extract the values of the last index of the iterating # parameters. This step is necessary because the results # created by WATTS plugins could be list or ndarray with - # multiple values (especially for transient). + # multiple values (especially for MOOSE based app). watts_params = get_last_value(watts_params, to_main_params) convergence_list.append(watts_params[convergence_params]) @@ -449,6 +549,13 @@ def run_parametric(watts_params, plugin, wf_level): # Load Watts workbench watts_wb = load_obj(input_path, watts_path).watts +# Change the working directory to the directory where +# the extra input files are stored. This is necessary +# due to how WATTS copies extra input files to the +# temporary working directory. +if watts_wb.workflow_dir is not None: + os.chdir(str(watts_wb.workflow_dir.value).strip('\"')) + # Load plugins if watts_wb.plugins is not None: watts_plugins = create_plugins(watts_wb.plugins) From 98a7476b6498a1a1a69ea1e0abaf820c0730fd64 Mon Sep 17 00:00:00 2001 From: Zhiee Jhia Ooi Date: Mon, 19 Dec 2022 09:46:40 -0600 Subject: [PATCH 08/18] Added PyARC example --- .../examples/1App_PyARC_UnitCell/README.md | 20 ++++++ .../examples/1App_PyARC_UnitCell/lumped.son | 6 ++ .../1App_PyARC_UnitCell/pyarc_template | 72 +++++++++++++++++++ .../watts_comprehensive.son | 25 +++++++ .../1App_PyARC_UnitCell/watts_exec.py | 36 ++++++++++ src/watts_ui/watts_ui.py | 3 + 6 files changed, 162 insertions(+) create mode 100644 src/watts_ui/examples/1App_PyARC_UnitCell/README.md create mode 100644 src/watts_ui/examples/1App_PyARC_UnitCell/lumped.son create mode 100644 src/watts_ui/examples/1App_PyARC_UnitCell/pyarc_template create mode 100644 src/watts_ui/examples/1App_PyARC_UnitCell/watts_comprehensive.son create mode 100644 src/watts_ui/examples/1App_PyARC_UnitCell/watts_exec.py diff --git a/src/watts_ui/examples/1App_PyARC_UnitCell/README.md b/src/watts_ui/examples/1App_PyARC_UnitCell/README.md new file mode 100644 index 00000000..1ca1251f --- /dev/null +++ b/src/watts_ui/examples/1App_PyARC_UnitCell/README.md @@ -0,0 +1,20 @@ +# 1App_PyARC_UnitCell + +## Purpose + +This example provides a demonstration on how to use WATTS to perform a single PyARC run and save selected results in the params database. + +## Code(s) + +- PyARC - MCC3 and DIF3D + +## Keywords + +- PyARC execution +- Results extraction + +## File descriptions + +- [__watts_exec.py__](watts_exec.py): WATTS workflow for this example. This is the file to execute to run the problem described above. +- [__pyarc_template__](pyarc_template): PyARC templated input file. +- [__lumped.son__](lumped.son): SON file referenced in PyARC input with description of lumped fission products. diff --git a/src/watts_ui/examples/1App_PyARC_UnitCell/lumped.son b/src/watts_ui/examples/1App_PyARC_UnitCell/lumped.son new file mode 100644 index 00000000..d7e6db09 --- /dev/null +++ b/src/watts_ui/examples/1App_PyARC_UnitCell/lumped.son @@ -0,0 +1,6 @@ +lumped_element_external_list{ + + afrac(Mo92) = 0.5 + afrac(Mo95) = 0.5 + +} diff --git a/src/watts_ui/examples/1App_PyARC_UnitCell/pyarc_template b/src/watts_ui/examples/1App_PyARC_UnitCell/pyarc_template new file mode 100644 index 00000000..5d42180f --- /dev/null +++ b/src/watts_ui/examples/1App_PyARC_UnitCell/pyarc_template @@ -0,0 +1,72 @@ +=arc +geometry{ + + materials{ + material ( LEU ) { + temp = {{ temp }} + adens{ + aden ( u235 ) = 2.0e-2 % atom density in at/barn-cm + aden ( u238 ) = 2.0e-2 % atom density in at/barn-cm + aden ( o16 ) = 8.0e-2 % atom density in at/barn-cm + } + lumped_element_aden( lu35 ) = 1e-3 + } + material ( LEU2 ) { + temp = {{ temp }} + adens{ + aden ( u236 ) = 2.0e-2 % atom density in at/barn-cm + aden ( u237 ) = 2.0e-2 % atom density in at/barn-cm + aden ( o16 ) = 8.0e-2 % atom density in at/barn-cm + } + } + } + surfaces{ + hexagon ( hex ){ orientation=y normal = z pitch = {{ assembly_pitch }} } + plane ( z0 ) { z = 0.0 } + plane ( z10 ) { z = {{ assembly_length }} } + } + + reactor{ + lower_axial_surf=z0 + upper_axial_surf=z10 + + lower_boundary_condition=reflective + upper_boundary_condition=reflective + reactor_hex_lattice { + pitch = hex + num_ring = 1 + fill = [ assembly ] + } + assembly ( assembly ) { + sub_assembly ( sub_assembly_name ) { + lower_axial_surf=z0 + upper_axial_surf=z10 + material=LEU + } + } + } +} +calculations{ + lumped_element_text_file( lu35 ) = "lumped.son" + mcc3{ + xslib = "endf7.0" + egroupname = ANL33 + scattering_order = 1 + + cell( a ){ + associated_sub_assembly = sub_assembly_name + } + } + dif3d{ + power = 1.0 + geometry_type = hexagonal_infinite_lattice + isotxs = previous + run_dif3d = true + max_axial_mesh_size = 0.05 + dif_fd_options{} + } +} + + + +end \ No newline at end of file diff --git a/src/watts_ui/examples/1App_PyARC_UnitCell/watts_comprehensive.son b/src/watts_ui/examples/1App_PyARC_UnitCell/watts_comprehensive.son new file mode 100644 index 00000000..1261ac04 --- /dev/null +++ b/src/watts_ui/examples/1App_PyARC_UnitCell/watts_comprehensive.son @@ -0,0 +1,25 @@ +watts{ + % Change the working directory to the directory where the input files are stored. This is necessary + % due to how WATTS copies input files to the temporary working directory. + workflow_dir = "/home/zooi/watts/src/watts_ui/examples/1App_PyARC_UnitCell" + + plugins{ + plugin(ID1){ + code = "PyARC" + template = "pyarc_template" + extra_inputs = ["lumped.son"] + show_stderr = False + show_stdout = True + } + } + + workflow_level1{ + plugin = ID1 + variables{ + param(assembly_pitch) {value = 20 unit = cm} + param(assembly_length) {value = 13 unit = cm} + param(temp) {value = 26.85 unit = Celsius} + } + } + +} \ No newline at end of file diff --git a/src/watts_ui/examples/1App_PyARC_UnitCell/watts_exec.py b/src/watts_ui/examples/1App_PyARC_UnitCell/watts_exec.py new file mode 100644 index 00000000..3477c670 --- /dev/null +++ b/src/watts_ui/examples/1App_PyARC_UnitCell/watts_exec.py @@ -0,0 +1,36 @@ +# SPDX-FileCopyrightText: 2022 UChicago Argonne, LLC +# SPDX-License-Identifier: MIT + +""" +This example demonstrates how to use WATTS to perform +PyARC simulations. The PyARC model is very simple +unit-cell that uses lumped fission product defined +in other file. Both MCC3 and DIF3D are being executed. +The example also applies unit-conversion +capability of WATTS. Results from PyARC are extracted +and stored in params. +""" + +import watts +from astropy.units import Quantity + +# TH params +params = watts.Parameters() +params['assembly_pitch'] = Quantity(20, "cm") # 20e-2 m +params['assembly_length'] = Quantity(13, "cm") # 0.13 m +params['temp'] = Quantity(26.85, "Celsius") # 300 K + +params.show_summary(show_metadata=False, sort_by='key') + +# PyARC Workflow + +pyarc_plugin = watts.PluginPyARC('pyarc_template', show_stdout=True, extra_inputs=['lumped.son']) # show all the output +pyarc_result = pyarc_plugin(params) +for key in pyarc_result.results_data: + print(key, pyarc_result.results_data[key]) +print(pyarc_result.inputs) +print(pyarc_result.outputs) +params['keff-dif3d'] = pyarc_result.results_data["keff_dif3d"][0.0] +params['keff-mcc3'] = pyarc_result.results_data["keff_mcc3"][('R', 0, 1, 'A', 1)] + +params.show_summary(show_metadata=True, sort_by='key') diff --git a/src/watts_ui/watts_ui.py b/src/watts_ui/watts_ui.py index 8d17fb75..fdec83ff 100755 --- a/src/watts_ui/watts_ui.py +++ b/src/watts_ui/watts_ui.py @@ -429,6 +429,9 @@ def run_direct(watts_params, plugin): elif hasattr(app_result, 'output_data'): for key in app_result.output_data: watts_params[key] = app_result.output_data[key] + elif hasattr(app_result, 'results_data'): + for key in app_result.results_data: + watts_params[key] = app_result.results_data[key] else: for key in app_result: watts_params[key] = app_result[key] From fe294b0ecd4afbbabe37750be37b9af1a16f834e Mon Sep 17 00:00:00 2001 From: Zhiee Jhia Ooi Date: Mon, 19 Dec 2022 12:32:23 -0600 Subject: [PATCH 09/18] Added RELAP5 example --- src/watts_ui/etc/watts.sch | 2 +- .../1App_RELAP5_SingleChannel/README.md | 19 ++ .../1App_RELAP5_SingleChannel/relap5_template | 280 ++++++++++++++++++ .../watts_comprehensive.son | 28 ++ .../1App_RELAP5_SingleChannel/watts_exec.py | 46 +++ src/watts_ui/watts_ui.py | 10 +- 6 files changed, 380 insertions(+), 5 deletions(-) create mode 100644 src/watts_ui/examples/1App_RELAP5_SingleChannel/README.md create mode 100644 src/watts_ui/examples/1App_RELAP5_SingleChannel/relap5_template create mode 100644 src/watts_ui/examples/1App_RELAP5_SingleChannel/watts_comprehensive.son create mode 100644 src/watts_ui/examples/1App_RELAP5_SingleChannel/watts_exec.py diff --git a/src/watts_ui/etc/watts.sch b/src/watts_ui/etc/watts.sch index 27a36c47..784f8192 100644 --- a/src/watts_ui/etc/watts.sch +++ b/src/watts_ui/etc/watts.sch @@ -244,7 +244,7 @@ watts{ ValType=String InputTmpl="flagtypes" InputDefault= codename - ValEnums=[PyARC OpenMC SERPENT ABCE MCNP MOOSE SAS Dakota Serpent] + ValEnums=[PyARC OpenMC SERPENT ABCE MCNP MOOSE SAS Dakota Serpent RELAP5] } template{ Description = "Template name" diff --git a/src/watts_ui/examples/1App_RELAP5_SingleChannel/README.md b/src/watts_ui/examples/1App_RELAP5_SingleChannel/README.md new file mode 100644 index 00000000..16e8b049 --- /dev/null +++ b/src/watts_ui/examples/1App_RELAP5_SingleChannel/README.md @@ -0,0 +1,19 @@ +# 1App_RELAP5_SingleChannel + +## Purpose + +This example provides a demonstration on how to use WATTS to run RELAP5-3D. + +## Code(s) + +- RELAP5-3D + +## Keywords + +- Single annulus channel +- Internally heated + +## File descriptions + +- [__watts_exec.py__](watts_exec.py): This is the file to execute to run the problem described above. +- [__relap5_template__](relap5_template): Templated RELAP5-3D input. diff --git a/src/watts_ui/examples/1App_RELAP5_SingleChannel/relap5_template b/src/watts_ui/examples/1App_RELAP5_SingleChannel/relap5_template new file mode 100644 index 00000000..ff1007a3 --- /dev/null +++ b/src/watts_ui/examples/1App_RELAP5_SingleChannel/relap5_template @@ -0,0 +1,280 @@ +=ANL Water SNGLCHN +* +* +****************************** +* Model Options * +****************************** +* type state +100 new transnt +* option +101 run +* iunits ounits +102 si si +* +104 ascii +* t1 t2 alloc +105 1.0 2.0 5.0e5 +* Noncondensable Gas Species +110 air +* cell elev fluid sysname +120 910010000 0.0 h2o SNGLCHN +* +* tend minstep maxstep copt pfreq majed rsrtf +201 10.0 1.0e-10 0.01 19 200 1000 1000 +* +******************************* +* General Tables * +******************************* +* +*n: HL +* type trip factor1 factor2 +20240000 htc-t 0 1.0 1.0 +* TimeHeat Transfer +20240001 -1.0 10.0 +20240001 1.4e5 10.0 +* +*n: source +* type trip factor1 factor2 +20250000 power 0 1.0 1.0 +* Time Power +20250001 -1.0 0.0 +20250002 0.0 {{ heater_power }} +20250003 1.4e5 {{ heater_power }} +* +************************** +* Materials * +************************** +* +*n: SS +* type tflag vflag +20100100 tbl/fctn 1 1 +* temp thcond +20100101 -100.0 12.97 +20100102 300.0 12.97 +20100103 800.0 21.06 +20100104 1600.0 34.0 +20100105 9999.0 34.0 +* heat Capacity +20100151 4.18e6 +* +*n: KF +* type tflag vflag +20100300 tbl/fctn 1 1 +* temp thcond +20100301 -100.0 0.0339 +20100302 273.15 0.0339 +20100303 297.15 0.0353 +20100304 305.15 0.0372 +20100305 1000.0 0.0372 +20100306 9999.0 0.0372 +* heat Capacity +20100351 8.32e4 +* +* +************************************* +* Hydraulic Components * +************************************* +* +************** Pipe *************** +* name type +2000000 "chan-1" annulus +* ncells +2000001 10 +* x-area volid +2000101 7.706e-3 10 +* x-length volid +2000301 0.3 10 +* volume volid +2000401 0.0 10 +* azim-angle volid +2000501 0.0 10 +* vert-angle volid +2000601 90.0 10 +* x-wall xhd volid +2000801 0.0 0.0384302 10 +* x-flags volid +2001001 0 10 +* ebt press temp none none none id +2001201 003 1.013e5 292.65 0.0 0.0 0.0 10 +* jefvcahs jun num +2001101 00001000 9 +* jun control +2001300 1 +* mfl mfv unused junid +2001301 0.0 0.0 0.0 9 +* +* +************ Inlet BC ************* +* name type +9100000 "inlet" tmdpvol +* area length vol +9100101 1000.0 0.0 1000.0 +* az-angle inc-angle dz +9100102 0.0 0.0 0.0 +* x-rough x-hd flags +9100103 0.0 0.0 10 +* cword +9100200 3 +* srch press temp +9100201 0.0 {{ inlet_pressure }} 292.65 +* +* +************ Outlet BC ************ +* name type +9200000 "outlet" tmdpvol +* area length vol +9200101 1000.0 0.0 1000.0 +* az-angle inc-angle dz +9200102 0.0 0.0 0.0 +* x-rough x-hd flags +9200103 0.0 0.0 10 +* cword +9200200 2 +* srch press squal +9200201 0.0 {{ outlet_pressure }} 1.0 +* +* +********** Inlet Junction ********** +* name type +2090000 "inflow" tmdpjun +* from to area jefvcahs +2090101 910010002 200010001 7.706e-3 0 +* control trip alpha num +2090200 1 +* srch mfl mfv unused +2090201 0.0 0.0 0.0 0.0 +2090202 50.0 0.5 0.0 0.0 +2090203 100.0 0.5 0.0 0.0 +2090204 150.0 0.8 0.0 0.0 +2090205 200.0 0.8 0.0 0.0 +* +* +********* Outlet Junction ********** +* name type +2190000 "outflow" sngljun +* from to area +2190101 200100002 920010001 7.706e-3 +* fwd. loss rev. loss jefvcahs +2190102 1.5 1.5 110 +* subcooled twophase +2190103 1.0 1.0 +* flow mfl mfv unused +2190201 1 0.0 0.0 0.0 +* +* +******************************** +* Heat Structures * +******************************** +* +* +********** Inner Annulus Heater ********** +* nh np geom ssif leftcoord reflood +12000000 10 2 2 1 0.0 0 +* mesh format +12000100 0 1 +* intervals radius +12000101 1 0.01270 +* material interval +12000201 1 1 +* rpkf interval +12000301 1.0 1 +* temp source +12000400 0 +* temp interval +12000401 292.65 2 + +* Left Boundary Condition Data +* bound incr type code factor node +12000501 0 0 0 1 0.3 1 +12000502 0 0 0 1 0.3 2 +12000503 0 0 0 1 0.3 3 +12000504 0 0 0 1 0.3 4 +12000505 0 0 0 1 0.3 5 +12000506 0 0 0 1 0.3 6 +12000507 0 0 0 1 0.3 7 +12000508 0 0 0 1 0.3 8 +12000509 0 0 0 1 0.3 9 +12000510 0 0 0 1 0.3 10 + +* Right Boundary Condition Data +* bound incr type code factor node +12000601 200010000 0 101 1 0.3 1 +12000602 200020000 0 101 1 0.3 2 +12000603 200030000 0 101 1 0.3 3 +12000604 200040000 0 101 1 0.3 4 +12000605 200050000 0 101 1 0.3 5 +12000606 200060000 0 101 1 0.3 6 +12000607 200070000 0 101 1 0.3 7 +12000608 200080000 0 101 1 0.3 8 +12000609 200090000 0 101 1 0.3 9 +12000610 200100000 0 101 1 0.3 10 +* source mult dmhl dmhr num +12000701 500 1.0 0.0 0.0 10 +* Left Additional Boundary Condition Data +12000800 1 +* hthd hlf hlr gslf gslr glcf glcr lbf ncl tpdr foul node +12000801 0.0 10.0 10.0 0.0 0.0 0.0 0.0 1.0 0.0 1.1 1.0 10 +* Right Additional Boundary Condition Data +12000900 0 +* hthd hlf hlr gslf gslr glcf glcr lbf node +12000901 0.0127 10.0 10.0 0.0 0.0 0.0 0.0 1.0 10 +* +* +********** Outer Channel Wall ********** +* nh np geom ssif leftcoord reflood +12010000 10 9 2 1 0.0511302 0 +* mesh format +12010100 0 1 +* intervals radius +12010101 4 0.05715 +12010102 4 0.10795 +* material interval +12010201 1 4 +12010202 3 8 +* rpkf interval +12010301 0.0 8 +* temp source +12010400 0 +* temp interval +12010401 292.65 9 +* +* Left Boundary Condition Data +* bound incr type code factor node +12010501 200010000 0 101 1 0.3 1 +12010502 200020000 0 101 1 0.3 2 +12010503 200030000 0 101 1 0.3 3 +12010504 200040000 0 101 1 0.3 4 +12010505 200050000 0 101 1 0.3 5 +12010506 200060000 0 101 1 0.3 6 +12010507 200070000 0 101 1 0.3 7 +12010508 200080000 0 101 1 0.3 8 +12010509 200090000 0 101 1 0.3 9 +12010510 200100000 0 101 1 0.3 10 +* +* Right Boundary Condition Data +* bound incr type code factor node +12010601 920010000 0 3400 1 0.3 1 +12010602 920010000 0 3400 1 0.3 2 +12010603 920010000 0 3400 1 0.3 3 +12010604 920010000 0 3400 1 0.3 4 +12010605 920010000 0 3400 1 0.3 5 +12010606 920010000 0 3400 1 0.3 6 +12010607 920010000 0 3400 1 0.3 7 +12010608 920010000 0 3400 1 0.3 8 +12010609 920010000 0 3400 1 0.3 9 +12010610 920010000 0 3400 1 0.3 10 +* source mult dmhl dmhr num +12010701 0 0.0 0.0 0.0 10 +* Left Additional Boundary Condition Data +12010800 1 +* hthd hlf hlr gslf gslr glcf glcr lbf ncl tpdr foul node +12010801 0.0 10.0 10.0 0.0 0.0 0.0 0.0 1.0 0.0 1.1 1.0 10 +* Right Additional Boundary Condition Data +12010900 0 +* hthd hlf hlr gslf gslr glcf glcr lbf node +12010901 0.0 10.0 10.0 0.0 0.0 0.0 0.0 1.0 10 +* +* +* +* +. diff --git a/src/watts_ui/examples/1App_RELAP5_SingleChannel/watts_comprehensive.son b/src/watts_ui/examples/1App_RELAP5_SingleChannel/watts_comprehensive.son new file mode 100644 index 00000000..6052d412 --- /dev/null +++ b/src/watts_ui/examples/1App_RELAP5_SingleChannel/watts_comprehensive.son @@ -0,0 +1,28 @@ +watts{ + % Change the working directory to the directory where the input files are stored. This is necessary + % due to how WATTS copies input files to the temporary working directory. + workflow_dir = "C:/Users/zooi/Desktop/watts-workbench/src/watts_ui/examples/1App_RELAP5_SingleChannel" + + % Make sure that all necessary files (executable, fluid property files, etc) are in the + % same directory as the input and template files. + plugins{ + plugin(ID1){ + code = "RELAP5" + template = "relap5_template" + show_stderr = False + show_stdout = False + plotfl_to_csv = True + % extra_args = ["-w", "tpfh2o", "-e", "tpfn2", "-tpfdir", "C:/Users/zooi/Documents/NSTF/watts/R5/"] + } + } + + workflow_level1{ + plugin = ID1 + variables{ + param(inlet_pressure) {value = 3.0e5} + param(outlet_pressure) {value = 1.013e5} + param(heater_power) {value = 20000} + } + } + +} \ No newline at end of file diff --git a/src/watts_ui/examples/1App_RELAP5_SingleChannel/watts_exec.py b/src/watts_ui/examples/1App_RELAP5_SingleChannel/watts_exec.py new file mode 100644 index 00000000..721a208a --- /dev/null +++ b/src/watts_ui/examples/1App_RELAP5_SingleChannel/watts_exec.py @@ -0,0 +1,46 @@ +# SPDX-FileCopyrightText: 2022 UChicago Argonne, LLC +# SPDX-License-Identifier: MIT + +""" +This is an example problem of running RELAP5-3D with WATTS. +The problem is a single annulus channel where the inner cylinder +is heated. The inner heater and the outer pipe wall are modeled +as heat structures. Inlet and outlet boundary conditions are +specified at the inlet and outlet of the channel. The example +also shows how to add extra input options to the execution of +RELAP5-3D. +""" + +import os +import watts +from astropy.units import Quantity + +from pathlib import Path + +params = watts.Parameters() + +# Channel params +params['inlet_pressure'] = 3.0e5 +params['outlet_pressure'] = 1.013e5 +params['heater_power'] = Quantity(20, "kW") + + +params.show_summary(show_metadata=False, sort_by='key') + +# RELAP5-3D Workflow +relap5_plugin = watts.PluginRELAP5('relap5_template') + +# Example of input with extra options, including explicitly specifying the +# locations of fluid files. +# relap5_plugin = watts.PluginRELAP5('relap5_template') +# relap5_plugin(params, extra_args=['-w', 'tpfh2o', '-e', 'tpfn2', '-tpfdir', 'location\of\fluid\property\files']) + +# If RELAP5_DIR is not added to the environment, the directory where the +# executable and license key are stored can be specified explicitly. +# relap5_plugin.relap5_dir = "location\of\executable\and\license\key" + +relap5_result = relap5_plugin(params) +for key in relap5_result.csv_data: + print(key, relap5_result.csv_data[key]) +print(relap5_result.inputs) +print(relap5_result.outputs) diff --git a/src/watts_ui/watts_ui.py b/src/watts_ui/watts_ui.py index fdec83ff..3dee351c 100755 --- a/src/watts_ui/watts_ui.py +++ b/src/watts_ui/watts_ui.py @@ -1,9 +1,11 @@ + +import getopt import os from pathlib import Path +import subprocess import sys from typing import Optional -import getopt -import subprocess +import warnings from astropy.units import Quantity import numpy as np @@ -433,8 +435,8 @@ def run_direct(watts_params, plugin): for key in app_result.results_data: watts_params[key] = app_result.results_data[key] else: - for key in app_result: - watts_params[key] = app_result[key] + warnings.warn( + "Results class has no attribute 'csv_data', 'output_data', or 'results_data'. Output results are not saved to WATTS params.") return (watts_params, app_result) From 72ac4f99cdac529d09b5cbaaac0e5c14762d2a5d Mon Sep 17 00:00:00 2001 From: Zhiee Jhia Ooi Date: Thu, 22 Dec 2022 10:11:19 -0600 Subject: [PATCH 10/18] Added WATTS conda set up in Workbench --- scripts/setup_conda_wb.sh | 72 +++++++++++++++++++++++++++++++++++++++ scripts/workbench.sh | 7 ++++ 2 files changed, 79 insertions(+) create mode 100755 scripts/setup_conda_wb.sh create mode 100755 scripts/workbench.sh diff --git a/scripts/setup_conda_wb.sh b/scripts/setup_conda_wb.sh new file mode 100755 index 00000000..a7e752c6 --- /dev/null +++ b/scripts/setup_conda_wb.sh @@ -0,0 +1,72 @@ +#!/bin/bash +######################################################################## +# Date: 2022-12-22 +# Authors: zooi (zooi [at] anl [dot] gov) +# Comment: Finds the workbench conda environment and initializes it. +# Requires `workbench_path` to be set in workbench.sh +######################################################################## + +GREEN='\033[0;32m' +RED='\033[0;31m' +NC='\033[0m' + +# ---------------------------------------------------------------------- +# Gather workbench_path from workbench.sh +source workbench.sh + +# check that workbench_path was retrieved +if [ -z $workbench_path ]; then + printf "${RED}ERROR: Could not find workbench_path; please confirm 'workbench_path' entry in workbench.sh file${NC}\n" + exit 1 +fi + +# Check that retrieved path to Workbench application exists +if [ ! -d $workbench_path ]; then + printf "${RED}ERROR: Path to Workbench application does not exist; please confirm 'workbench_path' entry in workbench.sh file${NC}\n" + printf " ${workbench_path}\n" + exit 1 +fi + +# # ---------------------------------------------------------------------- +# Find conda in Workbench +conda_path="${workbench_path}/rte/conda" +if [ ! -f "${conda_path}/bin/conda" ]; then + printf "${RED}ERROR: Path to conda executable within Workbench application does not exist; please confirm 'workbench_path' entry in workbench.sh file${NC}\n" + printf " ${conda_path}/bin/conda\n" + exit 1 +fi + +# ---------------------------------------------------------------------- +# Activate Workbench conda environment +# >>> conda init >>> +#!! Contents within this block are managed by 'conda init' !! +__conda_setup="$(CONDA_REPORT_ERRORS=false "${conda_path}/bin/conda" shell.bash hook 2> /dev/null)" +if [ $? -eq 0 ]; then + \eval "$__conda_setup" +else + if [ -f "${conda_path}/etc/profile.d/conda.sh" ]; then + . "${conda_path}/etc/profile.d/conda.sh" + CONDA_CHANGEPS1=false conda activate base + else + PATH="${conda_path}/conda/bin:${PATH}" + fi +fi +unset __conda_setup +# <<< conda init <<< + +# ---------------------------------------------------------------------- +# Check Python version available in Workbench (v3.x required) +pyv=$(python -V 2>&1 | sed 's/.* \([0-9]\).\([0-9]\).*/\1\2/') +if [ $pyv -lt 36 ]; then + printf "${RED}ERROR: Workbench with Python >= 3.6 enabled is required.${NC}\n" + printf " Python version: `python --version`\n" + exit 1 +fi + +# ---------------------------------------------------------------------- +printf "${GREEN}Found Workbench:${NC} ${workbench_path}\n" +printf "${GREEN}Activated Conda: ${NC} ${conda_path}\n" + +yes | python -m pip install watts + +printf "${GREEN}WATTS successfully set up in Workbench.\n" \ No newline at end of file diff --git a/scripts/workbench.sh b/scripts/workbench.sh new file mode 100755 index 00000000..8d62cf71 --- /dev/null +++ b/scripts/workbench.sh @@ -0,0 +1,7 @@ +######################################################################## +# Date: 2022-12-22 +# Authors: zooi (zooi [at] anl [dot] gov) +# Comment: Set the path to Workbench to be used for setting up WATTS in Workbench. +######################################################################## + +workbench_path="/Applications/Workbench-5.0.1.app/Contents" \ No newline at end of file From 043e314d485e02084a4a739f29a1a3800e4e2139 Mon Sep 17 00:00:00 2001 From: Zhiee Jhia Ooi Date: Sat, 24 Dec 2022 15:31:23 -0600 Subject: [PATCH 11/18] Updated documentations for Workbench --- doc/source/user/workbench.rst | 178 ++++++++++++++++++ examples/1App_OpenMC_VHTR/README.md | 2 +- examples/1App_PyARC_UnitCell/README.md | 1 + examples/1App_RELAP5_SingleChannel/README.md | 1 + examples/1App_SAM_VHTR/README.md | 1 + .../README.md | 1 + examples/1App_SAS_SodiumLoop/README.md | 1 + examples/README.md | 2 + 8 files changed, 186 insertions(+), 1 deletion(-) create mode 100755 doc/source/user/workbench.rst diff --git a/doc/source/user/workbench.rst b/doc/source/user/workbench.rst new file mode 100755 index 00000000..20abfe4c --- /dev/null +++ b/doc/source/user/workbench.rst @@ -0,0 +1,178 @@ +.. _workbench: + +Setup WATTS in NEAMS Workbench Environment +------------------------------------------ + +The `NEAMS Workbench ` is a tool +that facilitates the use of multiple tools in analysis +by providing a commom user interface for model creation, review, execution, output, +and visualization for integrated codes. Instructions on how to download and install +Workbench can be found on the Workbench +`Gitlab repository `. + +To set up WATTS in the Workbench environment, user needs to first provide the path to +where Workbench is installed in `workbench.sh` under the `scripts` directory. User can +then run `setup_conda_wb.sh` under the same directory to set up WATTS within +the Workbench environment. + +Optional: To install OpenMC in the Workbench environemnt, run `setup_openmc.sh`. + +To finish setting up WATTS, open Workbench and go to the `File` tab at the top-left corner +then select `Configurations` from the drop menu. In the `Application configurations` +window, click `Add` on the top most row then select `WATTS` from the pop-up window. +In the list of `Application Options`, input the path of `watts_ui.py` to `Executable`. +The file should exist by default in `/watts/src/watt_ui/`. Next, click `Load Grammar`. +Click `OK` to complete the setup. + +Optional: Environment variables can be added be added under `Run Environment`. + +WATTS Workbench Input File +++++++++++++++++++++++++++ + +To create a new WATTS input file in Workbench, go to `File`, select `New File`, +and select `WATTS files (*.son)` from the drop down menu. An existing `*.son` +file can also be dragged and dropped to the Workbench window. + +The WATTS input file utilizes a hierarchical block-based system where a block +is defined with opening and closing curly braces `{ }`. A `watts` block is first +created within which other blocks and variables can be defined. Within the `watts` +block, `workflow_dir` needs to be defined as the path to the working directory +(where all templates and extra files are located). + +Plugins +~~~~~~~ + +The `plugins` block is required. Within the `plugins` blocks are +`plugin` sub-blocks where WATTS plugins are defined. + +.. code-block:: text + plugins{ + plugin(ID1){ + code = moose + template = "sam_template" + exec_dir = SAM_DIR + exec_name = "sam-opt" + extra_inputs=["file1", "file2", "file3"] + extra_templat_inputs=["template1", "template2", "template3"] + show_stderr = False + show_stdout = False + } + + plugin(ID2){ + code = PyARC + template = "pyarc_template" + executable = "path/to/pyarc/executable" + show_stderr = False + show_stdout = False + } + } + +Multiple `plugin` sub-blocks can be defined within the `plugins` block where +each plugin is given a unique identity, as represented by `(ID1)` and `(ID2)` +in the snippet above. For each sub-block the basic inputs are:: + + `code` : Name of the application + `template` : Name of the template file + `show_stderr` : Option to display error + `show_stdout` : Option to display output + `exec_dir` : Environment variable that points to the directory in which the application's executable is stored + `extra_inputs` : Additional non-templated input files + `extra_templateinputs` : Additional tempalted input files + `exec_name` : Name of the executable + `executable` : Path to the executable + +Note that user must provide either BOTH `exec_dir` and `exec_name` or +ONLY `executable`. Additionally, there are application-specific inputs +that can be provided to the plugins such as:: + + `extra_args` (multiple apps) : Extra arguments to applications + `plotfl_to_csv` (RELAP5) : Option to convert `plotfl` file to `csv` file + `conv_channel` (SAS) : Path to `CHANNELtoCSV.x` + `conv_primar4` (SAS) : Path to `PRIMAR4toCSV.x` + `auto_link_files` (Dakota) : List of files for Dakota to link automatically + `scores` (OpenMC) : List of filters for tallies + `score_names` (OpenMC) : List of user-given names for tally filters + +Workflow level +~~~~~~~~~~~~~~ + +The `workflow_level1` block is required. The plugin to be used is specified +by the `plugin` keyword:: + + plugin = ID1 + +where 'ID1' is the ID of the plugin provided in the `plugins` block. The +`variable` sub-block is where the values of the templated variables are +specified, as shown below:: + + variables{ + param(T_inlet) {value = 873.15} + param(T_outlet) {value = 1000.15} + param(flow_area) {value = 3.14e-4} + param(component_name) {value = pipe1} + param(Dh) {value = 1 unit = m} + param(location) {list = [top bottom left right]} + param(length) {list = [3.0 5.0 7.0 10.0]} + param(T_mean) {func = "0.5 * ( T_inlet + T_outlet )"} + param(wall_bc) {bool = "True"} + } + +Each `param` has a unique ID represented by the string in the parantheses +shown in the snippet above. A `param` can accept different types of inputs +depending on the provided key word provided. The `value` keyword is used +for when a numeric or a string is provided. A `unit` keyword can be added +if a user intends to utilize WATTS' internal unit-conversion capability. +The `list` keyword is used for a list of numerics or strings. The `bool` +keyword is used for booleans. The `func` keyword is used when a user +intends to perform arithmetic with existing `param`. Note that each elemet +in `func` must be separated by a space. + +Execution ++++++++++ + +Three types of executions can be performed by WATTS on Workbench, namely +direct execution, parametric study, and Picard iteration. + +Direct execution +~~~~~~~~~~~~~~~~ + +Direct execution is the simplest execution type. The user only needs to +provide `workflow_dir`, `plugins` block, and `workflow_level1` block to +perform direct execution. + +Parametric study +~~~~~~~~~~~~~~~~ + +To perform parametric study, a `parametric` block needs to be added to +the `workflow_level1` block as follows:: + + parametric{ + changing_params = "heat_source" + changing_values = [0, 1e5, 2e5, 3e5] + } + +where `changing_params` is the parameter whose values are varied and +`changing_values` is a list of intended varied values. + +Picard iteration +~~~~~~~~~~~~~~~~ + +To perform Picard iteration, the `iteration` block needs to be added +to the `workflow_level1` block:: + + iteration{ + plugin_main = ID1 + plugin_sub = ID2 + nmax = 10 + convergence_params = "keff" + convergence_criteria = 0.0001 + to_sub_params = ["avg_Tf_1" "avg_Tf_2" "avg_Tf_3" "avg_Tf_4" "avg_Tf_5"] + to_main_params = ["Init_P_1" "Init_P_2" "Init_P_3" "Init_P_4" "Init_P_5"] + } + +where `plugin_main` and `plugin_sub` are the plugin IDs of the two applications, +`nmax` is the maximum number of iterations, `convergence_params` is the parameter +used for evaluating convergence, `convergence_criteria` is the tolerance for +convergence, `to_sub_params` and `to_main_params` are lists of parameters whose +values are iterated between the two applications where they each must have at least +one parameter. diff --git a/examples/1App_OpenMC_VHTR/README.md b/examples/1App_OpenMC_VHTR/README.md index 7bedcac0..8e1a0baf 100644 --- a/examples/1App_OpenMC_VHTR/README.md +++ b/examples/1App_OpenMC_VHTR/README.md @@ -18,4 +18,4 @@ This example provides a demonstration on how to use WATTS to perform a single SA - [__watts_exec.py__](watts_exec.py): WATTS workflow for this example. This is the file to execute to run the problem described above. - [__openmc_template__](openmc_template.py): OpenMC templated model. - +- [__watts_comprehensive.son__](watts_comprehensive.son): Workbench input file for this example. diff --git a/examples/1App_PyARC_UnitCell/README.md b/examples/1App_PyARC_UnitCell/README.md index 1ca1251f..2afe52ea 100644 --- a/examples/1App_PyARC_UnitCell/README.md +++ b/examples/1App_PyARC_UnitCell/README.md @@ -18,3 +18,4 @@ This example provides a demonstration on how to use WATTS to perform a single Py - [__watts_exec.py__](watts_exec.py): WATTS workflow for this example. This is the file to execute to run the problem described above. - [__pyarc_template__](pyarc_template): PyARC templated input file. - [__lumped.son__](lumped.son): SON file referenced in PyARC input with description of lumped fission products. +- [__watts_comprehensive.son__](watts_comprehensive.son): Workbench input file for this example. \ No newline at end of file diff --git a/examples/1App_RELAP5_SingleChannel/README.md b/examples/1App_RELAP5_SingleChannel/README.md index 16e8b049..b08e7802 100755 --- a/examples/1App_RELAP5_SingleChannel/README.md +++ b/examples/1App_RELAP5_SingleChannel/README.md @@ -17,3 +17,4 @@ This example provides a demonstration on how to use WATTS to run RELAP5-3D. - [__watts_exec.py__](watts_exec.py): This is the file to execute to run the problem described above. - [__relap5_template__](relap5_template): Templated RELAP5-3D input. +- [__watts_comprehensive.son__](watts_comprehensive.son): Workbench input file for this example. diff --git a/examples/1App_SAM_VHTR/README.md b/examples/1App_SAM_VHTR/README.md index 4815167b..26ec41c1 100644 --- a/examples/1App_SAM_VHTR/README.md +++ b/examples/1App_SAM_VHTR/README.md @@ -18,3 +18,4 @@ This example provides a demonstration on how to use WATTS to perform a single SA - [__watts_exec.py__](watts_exec.py): WATTS workflow for this example. This is the file to execute to run the problem described above. - [__sam_template__](sam_template): SAM templated input file. +- [__watts_comprehensive.son__](watts_comprehensive.son): Workbench input file for this example. diff --git a/examples/1App_SAS_MultiTemplates_SodiumLoop/README.md b/examples/1App_SAS_MultiTemplates_SodiumLoop/README.md index a32ff8d7..d24d62f3 100644 --- a/examples/1App_SAS_MultiTemplates_SodiumLoop/README.md +++ b/examples/1App_SAS_MultiTemplates_SodiumLoop/README.md @@ -25,3 +25,4 @@ This example provides a demonstration on how to use WATTS to perform a simulatio - [__PointKinetics__](PointKinetics): Extra templated SAS input. - [__PRIMAR4__](PRIMAR4): Extra templated SAS input. - [__Primary__](Primary): Extra templated SAS input. +- [__watts_comprehensive.son__](watts_comprehensive.son): Workbench input file for this example. \ No newline at end of file diff --git a/examples/1App_SAS_SodiumLoop/README.md b/examples/1App_SAS_SodiumLoop/README.md index aec1580b..4629f333 100644 --- a/examples/1App_SAS_SodiumLoop/README.md +++ b/examples/1App_SAS_SodiumLoop/README.md @@ -18,3 +18,4 @@ This example provides a demonstration on how to use WATTS for a simple SAS model - [__watts_exec.py__](watts_exec.py): This is the file to execute to run the problem described above. - [__sas_template__](sas_template): Templated SAS input. +- [__watts_comprehensive.son__](watts_comprehensive.son): Workbench input file for this example. \ No newline at end of file diff --git a/examples/README.md b/examples/README.md index 73963459..83d176b6 100644 --- a/examples/README.md +++ b/examples/README.md @@ -16,6 +16,7 @@ Training on WATTS is enabled with a suite of simple examples: * [__MultiStep_Griffin-BISON-Sockeye_MR__](MultiStep_Griffin-BISON-Sockeye_MR/README.md) - Advance MOOSE MultiApp calculation with steady-state and transient calculations ## Examples with Picard Iterations * [__PicardIterations_SAM-OpenMC_VHTR__](PicardIterations_SAM-OpenMC_VHTR/README.md) - Workflow with iterative MOOSE/SAM and OpenMC +* * [__PicardIterations_SAM-OpenMC_VHTR_Workbench__](PicardIterations_SAM-OpenMC_VHTR_Workbench/README.md) - Workflow with iterative MOOSE/SAM and OpenMC using Workbench ## Examples with Optimization * [__Optimization_SAM-OpenMC_VHTR-scipy__](Optimization_SAM-OpenMC_VHTR-scipy/README.md) - 1-criteria optimization of SAM/OpenMC workflow using scipy * [__Optimization_SAM-OpenMC_VHTR-pymoo__](Optimization_SAM-OpenMC_VHTR-pymoo/README.md) - Multi-criteria optimization of SAM/OpenMC workflow using pymoo @@ -25,3 +26,4 @@ Training on WATTS is enabled with a suite of simple examples: * [__Sensitivity_SAM-OpenMC_VHTR-scipy-LHS__](Sensitivity_SAM-OpenMC_VHTR-scipy-LHS/README.md) - Sampling with LHS of SAM/OpenMC workflow using scipy ## Examples with Parameteric studies * [__ParamStudy_SAM_VHTR__](ParamStudy_SAM_VHTR/README.md) - Showcasing SAM with parametric study +* [__ParamStudy_SAM_SimpleJunction_Workbench__](ParamStudy_SAM_SimpleJunction_Workbench/README.md) - Showcasing SAM with parametric study using Workbench From dc27ddbbc46b980997484ee6da5595b7aa5e9d9f Mon Sep 17 00:00:00 2001 From: Zhiee Jhia Ooi Date: Sun, 25 Dec 2022 13:22:21 -0600 Subject: [PATCH 12/18] Combined examples directory. --- src/watts_ui/bin/sonvalidxml | 1 - src/watts_ui/etc/watts.sch | 5 + .../examples/1App_OpenMC_VHTR/README.md | 21 - .../1App_OpenMC_VHTR/openmc_template.py | 355 ----- .../1App_OpenMC_VHTR/watts_comprehensive.son | 47 - .../examples/1App_OpenMC_VHTR/watts_exec.py | 82 - .../examples/1App_PyARC_UnitCell/README.md | 20 - .../examples/1App_PyARC_UnitCell/lumped.son | 6 - .../1App_PyARC_UnitCell/pyarc_template | 72 - .../watts_comprehensive.son | 25 - .../1App_PyARC_UnitCell/watts_exec.py | 36 - .../1App_RELAP5_SingleChannel/README.md | 19 - .../1App_RELAP5_SingleChannel/relap5_template | 280 ---- .../watts_comprehensive.son | 28 - .../1App_RELAP5_SingleChannel/watts_exec.py | 46 - .../1App_SAM_SimpleJunction/sam_template | 144 -- .../watts_comprehensive.son | 35 - .../1App_SAM_SimpleJunction/watts_exec.py | 65 - .../Channel | 319 ---- .../DecayPower | 199 --- .../FuelCladding | 128 -- .../PRIMAR4 | 423 ----- .../PointKinetics | 85 - .../Primary | 62 - .../README.md | 27 - .../sas_template | 199 --- .../watts_comprehensive.son | 38 - .../watts_exec.py | 57 - .../examples/1App_SAS_SodiumLoop/README.md | 20 - .../examples/1App_SAS_SodiumLoop/sas_template | 1397 ----------------- .../watts_comprehensive.son | 34 - .../1App_SAS_SodiumLoop/watts_exec.py | 73 - .../sam_template | 144 -- .../watts_comprehensive.son | 40 - .../watts_exec.py | 65 - .../README.md | 20 - .../openmc_template.py | 355 ----- .../sam_template | 574 ------- .../watts_comprehensive.son | 74 - .../watts_exec.py | 103 -- src/watts_ui/wasppy | 1 - src/watts_ui/watts_ui.py | 34 +- 42 files changed, 32 insertions(+), 5726 deletions(-) delete mode 120000 src/watts_ui/bin/sonvalidxml delete mode 100644 src/watts_ui/examples/1App_OpenMC_VHTR/README.md delete mode 100644 src/watts_ui/examples/1App_OpenMC_VHTR/openmc_template.py delete mode 100644 src/watts_ui/examples/1App_OpenMC_VHTR/watts_comprehensive.son delete mode 100644 src/watts_ui/examples/1App_OpenMC_VHTR/watts_exec.py delete mode 100644 src/watts_ui/examples/1App_PyARC_UnitCell/README.md delete mode 100644 src/watts_ui/examples/1App_PyARC_UnitCell/lumped.son delete mode 100644 src/watts_ui/examples/1App_PyARC_UnitCell/pyarc_template delete mode 100644 src/watts_ui/examples/1App_PyARC_UnitCell/watts_comprehensive.son delete mode 100644 src/watts_ui/examples/1App_PyARC_UnitCell/watts_exec.py delete mode 100644 src/watts_ui/examples/1App_RELAP5_SingleChannel/README.md delete mode 100644 src/watts_ui/examples/1App_RELAP5_SingleChannel/relap5_template delete mode 100644 src/watts_ui/examples/1App_RELAP5_SingleChannel/watts_comprehensive.son delete mode 100644 src/watts_ui/examples/1App_RELAP5_SingleChannel/watts_exec.py delete mode 100644 src/watts_ui/examples/1App_SAM_SimpleJunction/sam_template delete mode 100644 src/watts_ui/examples/1App_SAM_SimpleJunction/watts_comprehensive.son delete mode 100644 src/watts_ui/examples/1App_SAM_SimpleJunction/watts_exec.py delete mode 100644 src/watts_ui/examples/1App_SAS_MultiTemplates_SodiumLoop/Channel delete mode 100644 src/watts_ui/examples/1App_SAS_MultiTemplates_SodiumLoop/DecayPower delete mode 100644 src/watts_ui/examples/1App_SAS_MultiTemplates_SodiumLoop/FuelCladding delete mode 100644 src/watts_ui/examples/1App_SAS_MultiTemplates_SodiumLoop/PRIMAR4 delete mode 100644 src/watts_ui/examples/1App_SAS_MultiTemplates_SodiumLoop/PointKinetics delete mode 100644 src/watts_ui/examples/1App_SAS_MultiTemplates_SodiumLoop/Primary delete mode 100644 src/watts_ui/examples/1App_SAS_MultiTemplates_SodiumLoop/README.md delete mode 100644 src/watts_ui/examples/1App_SAS_MultiTemplates_SodiumLoop/sas_template delete mode 100644 src/watts_ui/examples/1App_SAS_MultiTemplates_SodiumLoop/watts_comprehensive.son delete mode 100644 src/watts_ui/examples/1App_SAS_MultiTemplates_SodiumLoop/watts_exec.py delete mode 100644 src/watts_ui/examples/1App_SAS_SodiumLoop/README.md delete mode 100644 src/watts_ui/examples/1App_SAS_SodiumLoop/sas_template delete mode 100644 src/watts_ui/examples/1App_SAS_SodiumLoop/watts_comprehensive.son delete mode 100644 src/watts_ui/examples/1App_SAS_SodiumLoop/watts_exec.py delete mode 100644 src/watts_ui/examples/Parametric_SAM_SimpleJunction/sam_template delete mode 100644 src/watts_ui/examples/Parametric_SAM_SimpleJunction/watts_comprehensive.son delete mode 100644 src/watts_ui/examples/Parametric_SAM_SimpleJunction/watts_exec.py delete mode 100644 src/watts_ui/examples/PicardIterations_SAM-OpenMC_VHTR/README.md delete mode 100644 src/watts_ui/examples/PicardIterations_SAM-OpenMC_VHTR/openmc_template.py delete mode 100644 src/watts_ui/examples/PicardIterations_SAM-OpenMC_VHTR/sam_template delete mode 100644 src/watts_ui/examples/PicardIterations_SAM-OpenMC_VHTR/watts_comprehensive.son delete mode 100644 src/watts_ui/examples/PicardIterations_SAM-OpenMC_VHTR/watts_exec.py delete mode 120000 src/watts_ui/wasppy diff --git a/src/watts_ui/bin/sonvalidxml b/src/watts_ui/bin/sonvalidxml deleted file mode 120000 index 66a857f9..00000000 --- a/src/watts_ui/bin/sonvalidxml +++ /dev/null @@ -1 +0,0 @@ -/Applications/Workbench-5.0.1.app/Contents/bin/sonvalidxml \ No newline at end of file diff --git a/src/watts_ui/etc/watts.sch b/src/watts_ui/etc/watts.sch index 784f8192..a307df09 100644 --- a/src/watts_ui/etc/watts.sch +++ b/src/watts_ui/etc/watts.sch @@ -264,6 +264,11 @@ watts{ MaxOccurs=1 ValType=String } + executable{ + MinOccurs=0 + MaxOccurs=1 + ValType=String + } extra_inputs{ Description = "[optional] List of extra (non-templated) input files that are needed" InputTmpl="sonarray" diff --git a/src/watts_ui/examples/1App_OpenMC_VHTR/README.md b/src/watts_ui/examples/1App_OpenMC_VHTR/README.md deleted file mode 100644 index 7bedcac0..00000000 --- a/src/watts_ui/examples/1App_OpenMC_VHTR/README.md +++ /dev/null @@ -1,21 +0,0 @@ -# MultiApp_SAM-OpenMC_VHTR - -## Purpose - -This example provides a demonstration on how to use WATTS to perform a single SAM run followed by OpenMC, where temperature results from SAM are input to OpenMC. - -## Code(s) - -- SAM -- OpenMC - -## Keywords - -- Information transfer from SAM to OpenMC -- simple VHTR model - -## File descriptions - -- [__watts_exec.py__](watts_exec.py): WATTS workflow for this example. This is the file to execute to run the problem described above. -- [__openmc_template__](openmc_template.py): OpenMC templated model. - diff --git a/src/watts_ui/examples/1App_OpenMC_VHTR/openmc_template.py b/src/watts_ui/examples/1App_OpenMC_VHTR/openmc_template.py deleted file mode 100644 index 771885a5..00000000 --- a/src/watts_ui/examples/1App_OpenMC_VHTR/openmc_template.py +++ /dev/null @@ -1,355 +0,0 @@ -# SPDX-FileCopyrightText: 2022 UChicago Argonne, LLC -# SPDX-License-Identifier: MIT - -from math import sqrt - -import openmc -import openmc.model - - -def build_openmc_model(params): - """ OpenMC Model """ - - materials = [] - - homfuel1 = openmc.Material(name="homfuel_1", temperature=params['temp_F1']) - homfuel1.set_density('g/cm3', 2.2767E+00) - homfuel1.add_nuclide('U235', 4.0841E-02, 'wo') - homfuel1.add_nuclide('U238', 1.6597E-01, 'wo') - homfuel1.add_nuclide('O16', 7.0029E-01, 'wo') - homfuel1.add_element('C', 2.0896E-02, 'wo') - homfuel1.add_nuclide('Si28', 6.6155E-02, 'wo') - homfuel1.add_nuclide('Si29', 3.4772E-03, 'wo') - homfuel1.add_nuclide('Si30', 2.3671E-03, 'wo') - materials.append(homfuel1) - - homfuel2 = openmc.Material(name="homfuel_2", temperature=params['temp_F2']) - homfuel2.set_density('g/cm3', 2.2767E+00) - homfuel2.add_nuclide('U235', 4.0841E-02, 'wo') - homfuel2.add_nuclide('U238', 1.6597E-01, 'wo') - homfuel2.add_nuclide('O16', 7.0029E-01, 'wo') - homfuel2.add_element('C', 2.0896E-02, 'wo') - homfuel2.add_nuclide('Si28', 6.6155E-02, 'wo') - homfuel2.add_nuclide('Si29', 3.4772E-03, 'wo') - homfuel2.add_nuclide('Si30', 2.3671E-03, 'wo') - materials.append(homfuel2) - - homfuel3 = openmc.Material(name="homfuel_1", temperature=params['temp_F3']) - homfuel3.set_density('g/cm3', 2.2767E+00) - homfuel3.add_nuclide('U235', 4.0841E-02, 'wo') - homfuel3.add_nuclide('U238', 1.6597E-01, 'wo') - homfuel3.add_nuclide('O16', 7.0029E-01, 'wo') - homfuel3.add_element('C', 2.0896E-02, 'wo') - homfuel3.add_nuclide('Si28', 6.6155E-02, 'wo') - homfuel3.add_nuclide('Si29', 3.4772E-03, 'wo') - homfuel3.add_nuclide('Si30', 2.3671E-03, 'wo') - materials.append(homfuel3) - - homfuel4 = openmc.Material(name="homfuel_1", temperature=params['temp_F4']) - homfuel4.set_density('g/cm3', 2.2767E+00) - homfuel4.add_nuclide('U235', 4.0841E-02, 'wo') - homfuel4.add_nuclide('U238', 1.6597E-01, 'wo') - homfuel4.add_nuclide('O16', 7.0029E-01, 'wo') - homfuel4.add_element('C', 2.0896E-02, 'wo') - homfuel4.add_nuclide('Si28', 6.6155E-02, 'wo') - homfuel4.add_nuclide('Si29', 3.4772E-03, 'wo') - homfuel4.add_nuclide('Si30', 2.3671E-03, 'wo') - materials.append(homfuel4) - - homfuel5 = openmc.Material(name="homfuel_1", temperature=params['temp_F5']) - homfuel5.set_density('g/cm3', 2.2767E+00) - homfuel5.add_nuclide('U235', 4.0841E-02, 'wo') - homfuel5.add_nuclide('U238', 1.6597E-01, 'wo') - homfuel5.add_nuclide('O16', 7.0029E-01, 'wo') - homfuel5.add_element('C', 2.0896E-02, 'wo') - homfuel5.add_nuclide('Si28', 6.6155E-02, 'wo') - homfuel5.add_nuclide('Si29', 3.4772E-03, 'wo') - homfuel5.add_nuclide('Si30', 2.3671E-03, 'wo') - materials.append(homfuel5) - - boro_ctr = openmc.Material(name="B4C-CTR", temperature=params['temp']) - boro_ctr.set_density('g/cm3', 2.47) - boro_ctr.add_nuclide('B10', 0.16, 'ao') - boro_ctr.add_nuclide('B11', 0.64, 'ao') - boro_ctr.add_element('C', 0.20, 'ao') - materials.append(boro_ctr) - - matrix = openmc.Material(name="matrix", temperature=params['temp']) - matrix.set_density('g/cm3', 1.806) - matrix.add_element('C', 1.0 - 0.0000003, 'ao') - matrix.add_nuclide('B10', 0.0000003, 'ao') - if params['use_sab']: - matrix.add_s_alpha_beta('c_Graphite') - materials.append(matrix) - - refl = openmc.Material(name="BeO", temperature=params['temp']) - refl.set_density('g/cm3', 2.7987) - refl.add_nuclide('Be9', 0.50, 'ao') - refl.add_nuclide('O16', 0.50, 'ao') - if params['use_sab_BeO']: - refl.add_s_alpha_beta('c_Be_in_BeO') - refl.add_s_alpha_beta('c_O_in_BeO') - materials.append(refl) - - yh2 = openmc.Material(name="moderator", temperature=params['temp']) - yh2.set_density('g/cm3', 4.30*0.95) - yh2.add_nuclide('Y89', 0.357142857, 'ao') - yh2.add_nuclide('H1', 0.642857143, 'ao') - if params['use_sab'] and params['use_sab_YH2']: - yh2.add_s_alpha_beta('c_H_in_YH2') - yh2.add_s_alpha_beta('c_Y_in_YH2') - materials.append(yh2) - - coolant = openmc.Material(name="coolant", temperature=params['temp']) - coolant.set_density('g/cm3', 0.00365) - coolant.add_nuclide('He4', 1, 'ao') - materials.append(coolant) - - Cr = openmc.Material(name="Cr", temperature=params['temp']) - Cr.set_density('g/cm3', 7.19) - Cr.add_nuclide('Cr50', -4.345e-2, 'ao') - Cr.add_nuclide('Cr52', -83.789e-2, 'ao') - Cr.add_nuclide('Cr53', -9.501e-2, 'ao') - Cr.add_nuclide('Cr54', -2.365e-2, 'ao') - materials.append(Cr) - - shell_mod = openmc.Material(name="shell_mod", temperature=params['temp']) - shell_mod.set_density('g/cm3', 7.055) # FeCrAl - shell_mod.add_nuclide('Cr50', 20.0e-2 * 4.340E-02,'ao') - shell_mod.add_nuclide('Cr52', 20.0e-2 * 8.381E-01,'ao') - shell_mod.add_nuclide('Cr53', 20.0e-2 * 9.490E-02,'ao') - shell_mod.add_nuclide('Cr54', 20.0e-2 * 2.360E-02,'ao') - shell_mod.add_nuclide('Fe54', 75.5e-2 * 5.800E-02,'ao') - shell_mod.add_nuclide('Fe56', 75.5e-2 * 9.172E-01,'ao') - shell_mod.add_nuclide('Fe57', 75.5e-2 * 2.200E-02,'ao') - shell_mod.add_nuclide('Fe58', 75.5e-2 * 2.800E-03,'ao') - shell_mod.add_nuclide('Al27', 4.5e-2 * 1.000 ,'ao') - materials.append(shell_mod) - - mat_dict = {} - for k,v in list(locals().items()): - if v in materials: - mat_dict[k] = v - - materials_file = openmc.Materials() - for mat in materials: - materials_file.append(mat) - materials_file.export_to_xml() - - Z_min = 0 - Z_cl = params['ax_ref'] - Z_cl_out = params['ax_ref'] - params['shell_thick'] - Z_up = params['ax_ref'] + params['cl'] - Z_up_out = params['ax_ref'] + params['cl'] + params['shell_thick'] - Z_max = params['cl'] + 2 * params['ax_ref'] - - # Create cylinder for fuel and coolant - - fuel_radius = openmc.ZCylinder(x0=0.0, y0=0.0, r=params['FuelPin_rad']) - mod_rad_0 = openmc.ZCylinder(x0=0.0, y0=0.0, r=params['mod_ext_rad'] - params['shell_thick'] - params['liner_thick']) - mod_rad_1a = openmc.ZCylinder(x0=0.0, y0=0.0, r=params['mod_ext_rad'] - params['shell_thick']) - mod_rad_1b = openmc.ZCylinder(x0=0.0, y0=0.0, r=params['mod_ext_rad']) - cool_radius = openmc.ZCylinder(x0=0.0, y0=0.0, r=params['cool_hole_rad']) - ctr_radius = openmc.ZCylinder(x0=0.0, y0=0.0, r=params['control_pin_rad']) - lbp_radius = openmc.ZCylinder(x0=0.0, y0=0.0, r=params['lbp_rad']) - - pin_pitch = params['Lattice_pitch'] - - min_z=openmc.ZPlane(z0=Z_min, boundary_type='vacuum') - max_z=openmc.ZPlane(z0=Z_max, boundary_type='vacuum') - sz_cl=openmc.ZPlane(z0=Z_cl) - - sz_cor1=openmc.ZPlane(z0= Z_cl + 1 * params['cl']/5) - sz_cor2=openmc.ZPlane(z0= Z_cl + 2 * params['cl']/5) - sz_cor3=openmc.ZPlane(z0= Z_cl + 3 * params['cl']/5) - sz_cor4=openmc.ZPlane(z0= Z_cl + 4 * params['cl']/5) - - sz_cl_out=openmc.ZPlane(z0=Z_cl_out) - sz_up=openmc.ZPlane(z0=Z_up) - sz_up_out=openmc.ZPlane(z0=Z_up_out) - cpin_low =openmc.ZPlane(z0=Z_up) - - Hex_Pitch = openmc.model.hexagonal_prism(orientation='x',edge_length=params['Assembly_pitch']/sqrt(3),origin=(0.0, 0.0), - boundary_type = 'reflective') # THIS SHOULD BE REFLECTIVE BONDARY - - - fuel_cell_1_1 = openmc.Cell(name='Fuel Pin', fill=homfuel1 , region=-fuel_radius & +sz_cl & -sz_cor1) - fuel_cell_1_2 = openmc.Cell(name='Fuel Pin', fill=homfuel2 , region=-fuel_radius & +sz_cor1 & -sz_cor2) - fuel_cell_1_3 = openmc.Cell(name='Fuel Pin', fill=homfuel3 , region=-fuel_radius & +sz_cor2 & -sz_cor3) - fuel_cell_1_4 = openmc.Cell(name='Fuel Pin', fill=homfuel4 , region=-fuel_radius & +sz_cor3 & -sz_cor4) - fuel_cell_1_5 = openmc.Cell(name='Fuel Pin', fill=homfuel5 , region=-fuel_radius & +sz_cor4 & -sz_up) - fuel_cell_2 = openmc.Cell(name='matrix', fill=matrix , region=+fuel_radius & +sz_cl & -sz_up) - fuel_cell_3 = openmc.Cell(name='reflL', fill=refl , region=-sz_cl) - fuel_cell_4 = openmc.Cell(name='reflO', fill=refl , region=+sz_up) - fuel_universe= openmc.Universe(cells=(fuel_cell_1_1, fuel_cell_1_2,fuel_cell_1_3,fuel_cell_1_4,fuel_cell_1_5,fuel_cell_2,fuel_cell_3,fuel_cell_4)) - TALLY_REGIONS=[fuel_cell_1_1, fuel_cell_1_2,fuel_cell_1_3,fuel_cell_1_4,fuel_cell_1_5] - - mod_cell_1 = openmc.Cell(name='YH2', fill=yh2, region=-mod_rad_0 & +sz_cl & -sz_up ) - mod_cell_2a = openmc.Cell(name='Liner', fill=Cr , region=+mod_rad_0 & -mod_rad_1a & +sz_cl & -sz_up) - mod_cell_2b = openmc.Cell(name='steel', fill=shell_mod , region=+mod_rad_1a & -mod_rad_1b & +sz_cl & -sz_up) - mod_cell_3 = openmc.Cell(name='matrix', fill=matrix , region=+mod_rad_1b & +sz_cl & -sz_up) - mod_cell_5 = openmc.Cell(name='Plug_L', fill=shell_mod , region=-mod_rad_1b & +sz_cl_out & -sz_cl) - mod_cell_6 = openmc.Cell(name='Plug_LR', fill=refl , region=+mod_rad_1b & +sz_cl_out & -sz_cl) - mod_cell_7 = openmc.Cell(name='Plug_U', fill=shell_mod , region=-mod_rad_1b & +sz_up & -sz_up_out) - mod_cell_8 = openmc.Cell(name='Plug_UR', fill=refl , region=+mod_rad_1b & +sz_up & -sz_up_out) - mod_cell_9 = openmc.Cell(name='LowRef', fill=refl , region=-sz_cl_out) - mod_cell_10 = openmc.Cell(name='UpRef', fill=refl , region=+sz_up) - mod_universe= openmc.Universe(cells=(mod_cell_1,mod_cell_2a, mod_cell_2b,mod_cell_3,mod_cell_5,mod_cell_6,mod_cell_7,mod_cell_8,mod_cell_9,mod_cell_10)) - - coolant_cell_1 = openmc.Cell(name='coolant', fill=coolant , region=-cool_radius) - coolant_cell_2 = openmc.Cell(name='matrix', fill=matrix , region=+cool_radius & +sz_cl & -sz_up) - coolant_cell_3 = openmc.Cell(name='reflL', fill=refl , region=+cool_radius & -sz_cl) - coolant_cell_4 = openmc.Cell(name='reflO', fill=refl , region=+cool_radius & +sz_up) - coolant_universe= openmc.Universe(cells=(coolant_cell_1,coolant_cell_2,coolant_cell_3,coolant_cell_4)) - - ctr_cell_1a = openmc.Cell(name='coolant', fill=coolant , region=-ctr_radius & +sz_cl & -cpin_low) - ctr_cell_1b = openmc.Cell(name='abs', fill=boro_ctr , region=-ctr_radius & +cpin_low) - ctr_cell_1c = openmc.Cell(name='refl', fill=refl , region=-ctr_radius & -sz_cl) - ctr_cell_2 = openmc.Cell(name='matrix', fill=matrix , region=+ctr_radius & +sz_cl & -sz_up) - ctr_cell_3 = openmc.Cell(name='reflL', fill=refl , region=+ctr_radius & -sz_cl) - ctr_cell_4 = openmc.Cell(name='reflO', fill=refl , region=+ctr_radius & +sz_up) - ctr_universe= openmc.Universe(cells=(ctr_cell_1a,ctr_cell_1b,ctr_cell_1c, ctr_cell_2,ctr_cell_3,ctr_cell_4)) - - Graph_cell_1= openmc.Cell(name='Graph cell', fill=matrix) - Graph_universe= openmc.Universe(cells=(Graph_cell_1,)) - - # Fill the hexagone with fuel and coolant cells - - assembly_description=[[]]*6 - assembly_description[5]=([ctr_universe]) - assembly_description[4] =([fuel_universe])*6 - assembly_description[3] =([fuel_universe]+[coolant_universe])*6 - assembly_description[2] =([coolant_universe] + [fuel_universe] + [mod_universe] + [coolant_universe] + [fuel_universe] + [mod_universe])*3 - assembly_description[1] =([fuel_universe]+[fuel_universe]+[coolant_universe]+[fuel_universe])*6 - assembly_description[0] =([fuel_universe]+[coolant_universe]+[fuel_universe]+[fuel_universe]+[coolant_universe])*6 - #print(assembly_description) - - lat_core = openmc.HexLattice() - lat_core.center=(0,0) - lat_core.pitch=[pin_pitch] - lat_core.outer=Graph_universe - lat_core.universes=assembly_description - # print(lat_core) - rotated_lat_core = openmc.Cell(fill=lat_core) - rotated_universe_lat_core = openmc.Universe(cells=(rotated_lat_core,)) - new_cell_lat_core=openmc.Cell() - new_cell_lat_core.fill=rotated_universe_lat_core - new_cell_lat_core.rotation=(0.,0.,90.) - new_universe_lat_core = openmc.Universe(cells=(new_cell_lat_core,)) - - main_cell = openmc.Cell(name="MainCell",fill=new_universe_lat_core, region=Hex_Pitch & +min_z & -max_z ) - - - # OpenMC expects that there is a root universe assigned number zero. Here we - # assign our three cells to this root universe. - root_universe = openmc.Universe(name='root universe', cells=(main_cell,)) - - # Finally we must create a geometry and assign the root universe - geometry = openmc.Geometry() - geometry.root_universe = root_universe - geometry.export_to_xml() - - # Now let's define our simulation parameters. These will go into our - # settings.xml via the SettingsFile object. - batches = 100 - inactive = 30 - particles = 5000 - - # Instantiate a SettingsFile - settings_file = openmc.Settings() - settings_file.run_mode = 'eigenvalue' - settings_file.cross_sections = '/software/openmc/data/v0.12pre-3/lanl_endfb80/cross_sections.xml' - settings_file.batches = batches - settings_file.inactive = inactive - settings_file.particles = particles - settings_file.material_cell_offsets = False - settings_file.temperature = {'method' : 'interpolation'} - - source = openmc.Source() - ll = [-params['Assembly_pitch']/4, -params['Assembly_pitch']/4, Z_min] - ur = [params['Assembly_pitch']/4, params['Assembly_pitch']/4, Z_max] - source.space = openmc.stats.Box(ll, ur) - source.strength = 1.0 - settings_file.source = source - - #lower_left, upper_right = main_cell.region.bounding_box - - list_tally_cell = [cell.id for cell in TALLY_REGIONS] - list_tally_scores = ['flux', 'nu-fission'] - cell_filter = openmc.CellFilter(list_tally_cell) - tally_file = openmc.Tally() - tally_file.filters.append(cell_filter) - tally_file.scores = list_tally_scores - tallies = openmc.Tallies() - tallies.append(tally_file) - tallies.export_to_xml() - - settings_file.export_to_xml() - - # Create a plots.xml file - radius = params['Assembly_pitch']/sqrt(3) - p1 = openmc.Plot() - p1.origin = (0, 0, (Z_max-Z_min)/2) - p1.width = (radius*2, radius*2) - p1.pixels = (2000, 2000) - p1.color = 'mat' - p1.basis = 'xy' - p1.color_by = 'material' - p1.col_spec = { - homfuel1.id: (255, 0, 0), - homfuel2.id: (255, 0, 0), - homfuel3.id: (255, 0, 0), - homfuel4.id: (255, 0, 0), - homfuel5.id: (255, 0, 0), - matrix.id: (100, 100, 100), - yh2.id: (20, 200, 50), - boro_ctr.id: (200, 20, 50), - shell_mod.id: (150,150,150), - coolant.id: (180,110,150), - refl.id: (80,210,50) - } - p2 = openmc.Plot() - p2.origin = (0, 0, (Z_max-Z_min)/2) - p2.width = (radius*2, Z_max) - p2.pixels = (200, 2000) - p2.color = 'mat' - p2.basis ='yz' - p2.color_by = 'material' - p2.col_spec = { - homfuel1.id: (255, 0, 0), - homfuel2.id: (255, 0, 0), - homfuel3.id: (255, 0, 0), - homfuel4.id: (255, 0, 0), - homfuel5.id: (255, 0, 0), - matrix.id: (100, 100, 100), - yh2.id: (20, 200, 50), - boro_ctr.id: (200, 20, 50), - shell_mod.id: (150,150,150), - coolant.id: (180,110,150), - refl.id: (80,210,50) - } - p3 = openmc.Plot() - p3.origin = (0, 0, (Z_max-1)) - p3.width = (radius*2, radius*2) - p3.pixels = (2000, 2000) - p3.color = 'mat' - p3.basis = 'xy' - p3.color_by = 'material' - p3.col_spec = { - homfuel1.id: (255, 0, 0), - homfuel2.id: (255, 0, 0), - homfuel3.id: (255, 0, 0), - homfuel4.id: (255, 0, 0), - homfuel5.id: (255, 0, 0), - matrix.id: (100, 100, 100), - yh2.id: (20, 200, 50), - boro_ctr.id: (200, 20, 50), - shell_mod.id: (150,150,150), - coolant.id: (180,110,150), - refl.id: (80,210,50) - } - plots = openmc.Plots() - plots.append(p1) - plots.append(p2) - plots.append(p3) - plots.export_to_xml() diff --git a/src/watts_ui/examples/1App_OpenMC_VHTR/watts_comprehensive.son b/src/watts_ui/examples/1App_OpenMC_VHTR/watts_comprehensive.son deleted file mode 100644 index 10f67f10..00000000 --- a/src/watts_ui/examples/1App_OpenMC_VHTR/watts_comprehensive.son +++ /dev/null @@ -1,47 +0,0 @@ -watts{ - % Change the working directory to the directory where the input files are stored. This is necessary - % due to how WATTS copies input files to the temporary working directory. - workflow_dir = "/Users/zhieejhiaooi/Documents/ANL/watts-devel/watts/src/watts_ui/examples/1App_OpenMC_VHTR" - - plugins{ - plugin(ID1){ - code = openmc - template = "openmc_template.py" - scores = ["nu-fission"] % Name of scores for OpenMC tallies. - score_names = ["power"] % A more representative name for the scores. Optional but might be necessary for score names with - % hyphens because Jinja and Workbench have difficulties reading hyphens. - } - } - - workflow_level1{ - plugin = ID1 - variables{ - param(ax_ref) {value = 2.0} - param(num_cool_pins) {value = 24} - param(num_fuel_pins) {value = 44} - param(Height_FC) {value = 2.0} - param(Lattice_pitch) {value = 2.0} - param(FuelPin_rad) {value = 0.9} - param(cool_hole_rad) {value = 0.6} - param(Coolant_channel_diam) {value = 0.012} - param(Graphite_thickness) {value = 0.5} - param(Assembly_pitch) {value = 17.3205080756887} - param(lbp_rad) {value = 0.25} - param(mod_ext_rad) {value = 0.90} - param(shell_thick) {value = 0.05} - param(liner_thick) {value = 0.007} - param(control_pin_rad) {value = 9.9, unit = mm} - param(cl) {value = 160.0} - param(pf) {value = 40.0} - param(temp) {value = 725.0} - param(temp_F1) {value = 725.0} - param(temp_F2) {value = 725.0} - param(temp_F3) {value = 725.0} - param(temp_F4) {value = 725.0} - param(temp_F5) {value = 725.0} - param(use_sab) = {bool = True} - param(use_sab_BeO) = {bool = True} - param(use_sab_YH2) = {bool = False} - } - } -} \ No newline at end of file diff --git a/src/watts_ui/examples/1App_OpenMC_VHTR/watts_exec.py b/src/watts_ui/examples/1App_OpenMC_VHTR/watts_exec.py deleted file mode 100644 index 9ab5b595..00000000 --- a/src/watts_ui/examples/1App_OpenMC_VHTR/watts_exec.py +++ /dev/null @@ -1,82 +0,0 @@ -# SPDX-FileCopyrightText: 2022 UChicago Argonne, LLC -# SPDX-License-Identifier: MIT - -""" -This example demonstrates how to use WATTS to perform -OpenMC calculation. This example uses a simple VHTR unit-cell -model with 1 coolant channel surrounded by graphite and fuel. -The demonstration includes the application of unit-conversion -approach in WATTS. OpenMC is executed and the main results are -printed out and stored in the params database. -""" - -from math import cos, pi -import os -import watts -from statistics import mean -from openmc_template import build_openmc_model -import openmc -from astropy.units import Quantity - - -params = watts.Parameters() - -# Core design params -params['ax_ref'] = 20 # cm -params['num_cool_pins'] = 1*6+2*6+6*2/2 -params['num_fuel_pins'] = 6+6+6+3*6+2*6/2+6/3 -params['Height_FC'] = 2.0 # m -params['Lattice_pitch'] = 2.0 -params['FuelPin_rad'] = 0.90 # cm -params['cool_hole_rad'] = 0.60 # cm -params['Coolant_channel_diam'] = (params['cool_hole_rad'] * 2)/100 # in m -params['Graphite_thickness'] = (params['Lattice_pitch'] - params['FuelPin_rad'] - params['cool_hole_rad']) # cm -params['Assembly_pitch'] = 7.5 * 2 * params['Lattice_pitch'] / (cos(pi/6) * 2) -params['lbp_rad'] = 0.25 # cm -params['mod_ext_rad'] = 0.90 # cm -params['shell_thick'] = 0.05 # FeCrAl -params['liner_thick'] = 0.007 # Cr -params['control_pin_rad'] = Quantity(9.9, "mm") # Automatically converts to 'm' for MOOSE and 'cm' for openmc - -# Control use of S(a,b) tables -params['use_sab'] = True -params['use_sab_BeO'] = True -params['use_sab_YH2'] = False - -# OpenMC params -params['cl'] = params['Height_FC']*100 - 2 * params['ax_ref'] # cm -params['pf'] = 40 # percent - -# get temperature from SAM results -params['temp'] = Quantity(725, "Celsius") -for i in range(1, 6): - params[f'temp_F{i}'] = Quantity(725, "Celsius") - -params.show_summary(show_metadata=False, sort_by='time') - -# Create OpenMC plugin -openmc_plugin = watts.PluginOpenMC(build_openmc_model, show_stderr=True) # show only error - -# Run OpenMC plugin, instructing it to plot the geometry and run a simulation -# def run_func(): -# openmc.plot_geometry() -# openmc.run() -# openmc_result = openmc_plugin(params, function=run_func) -openmc_result = openmc_plugin(params) -print("KEFF = ", openmc_result.keff) -print(openmc_result.inputs) -print(openmc_result.outputs) -print(openmc_result.tallies[0].get_pandas_dataframe()) - -# Open folder in order to view plot images that were produced -# openmc_result.open_folder() - -# Set power fractions in parameters -print(type(openmc_result.tallies[0].get_values(scores=['nu-fission']))) -print(len(openmc_result.tallies[0].get_values(scores=['nu-fission']))) -power_fractions = openmc_result.tallies[0].get_values(scores=['nu-fission']).ravel() -print(power_fractions) -for i, power_frac in enumerate(power_fractions): - params[f'Init_P_{i+1}'] = power_frac - -params.show_summary(show_metadata=True, sort_by='time') diff --git a/src/watts_ui/examples/1App_PyARC_UnitCell/README.md b/src/watts_ui/examples/1App_PyARC_UnitCell/README.md deleted file mode 100644 index 1ca1251f..00000000 --- a/src/watts_ui/examples/1App_PyARC_UnitCell/README.md +++ /dev/null @@ -1,20 +0,0 @@ -# 1App_PyARC_UnitCell - -## Purpose - -This example provides a demonstration on how to use WATTS to perform a single PyARC run and save selected results in the params database. - -## Code(s) - -- PyARC - MCC3 and DIF3D - -## Keywords - -- PyARC execution -- Results extraction - -## File descriptions - -- [__watts_exec.py__](watts_exec.py): WATTS workflow for this example. This is the file to execute to run the problem described above. -- [__pyarc_template__](pyarc_template): PyARC templated input file. -- [__lumped.son__](lumped.son): SON file referenced in PyARC input with description of lumped fission products. diff --git a/src/watts_ui/examples/1App_PyARC_UnitCell/lumped.son b/src/watts_ui/examples/1App_PyARC_UnitCell/lumped.son deleted file mode 100644 index d7e6db09..00000000 --- a/src/watts_ui/examples/1App_PyARC_UnitCell/lumped.son +++ /dev/null @@ -1,6 +0,0 @@ -lumped_element_external_list{ - - afrac(Mo92) = 0.5 - afrac(Mo95) = 0.5 - -} diff --git a/src/watts_ui/examples/1App_PyARC_UnitCell/pyarc_template b/src/watts_ui/examples/1App_PyARC_UnitCell/pyarc_template deleted file mode 100644 index 5d42180f..00000000 --- a/src/watts_ui/examples/1App_PyARC_UnitCell/pyarc_template +++ /dev/null @@ -1,72 +0,0 @@ -=arc -geometry{ - - materials{ - material ( LEU ) { - temp = {{ temp }} - adens{ - aden ( u235 ) = 2.0e-2 % atom density in at/barn-cm - aden ( u238 ) = 2.0e-2 % atom density in at/barn-cm - aden ( o16 ) = 8.0e-2 % atom density in at/barn-cm - } - lumped_element_aden( lu35 ) = 1e-3 - } - material ( LEU2 ) { - temp = {{ temp }} - adens{ - aden ( u236 ) = 2.0e-2 % atom density in at/barn-cm - aden ( u237 ) = 2.0e-2 % atom density in at/barn-cm - aden ( o16 ) = 8.0e-2 % atom density in at/barn-cm - } - } - } - surfaces{ - hexagon ( hex ){ orientation=y normal = z pitch = {{ assembly_pitch }} } - plane ( z0 ) { z = 0.0 } - plane ( z10 ) { z = {{ assembly_length }} } - } - - reactor{ - lower_axial_surf=z0 - upper_axial_surf=z10 - - lower_boundary_condition=reflective - upper_boundary_condition=reflective - reactor_hex_lattice { - pitch = hex - num_ring = 1 - fill = [ assembly ] - } - assembly ( assembly ) { - sub_assembly ( sub_assembly_name ) { - lower_axial_surf=z0 - upper_axial_surf=z10 - material=LEU - } - } - } -} -calculations{ - lumped_element_text_file( lu35 ) = "lumped.son" - mcc3{ - xslib = "endf7.0" - egroupname = ANL33 - scattering_order = 1 - - cell( a ){ - associated_sub_assembly = sub_assembly_name - } - } - dif3d{ - power = 1.0 - geometry_type = hexagonal_infinite_lattice - isotxs = previous - run_dif3d = true - max_axial_mesh_size = 0.05 - dif_fd_options{} - } -} - - - -end \ No newline at end of file diff --git a/src/watts_ui/examples/1App_PyARC_UnitCell/watts_comprehensive.son b/src/watts_ui/examples/1App_PyARC_UnitCell/watts_comprehensive.son deleted file mode 100644 index 1261ac04..00000000 --- a/src/watts_ui/examples/1App_PyARC_UnitCell/watts_comprehensive.son +++ /dev/null @@ -1,25 +0,0 @@ -watts{ - % Change the working directory to the directory where the input files are stored. This is necessary - % due to how WATTS copies input files to the temporary working directory. - workflow_dir = "/home/zooi/watts/src/watts_ui/examples/1App_PyARC_UnitCell" - - plugins{ - plugin(ID1){ - code = "PyARC" - template = "pyarc_template" - extra_inputs = ["lumped.son"] - show_stderr = False - show_stdout = True - } - } - - workflow_level1{ - plugin = ID1 - variables{ - param(assembly_pitch) {value = 20 unit = cm} - param(assembly_length) {value = 13 unit = cm} - param(temp) {value = 26.85 unit = Celsius} - } - } - -} \ No newline at end of file diff --git a/src/watts_ui/examples/1App_PyARC_UnitCell/watts_exec.py b/src/watts_ui/examples/1App_PyARC_UnitCell/watts_exec.py deleted file mode 100644 index 3477c670..00000000 --- a/src/watts_ui/examples/1App_PyARC_UnitCell/watts_exec.py +++ /dev/null @@ -1,36 +0,0 @@ -# SPDX-FileCopyrightText: 2022 UChicago Argonne, LLC -# SPDX-License-Identifier: MIT - -""" -This example demonstrates how to use WATTS to perform -PyARC simulations. The PyARC model is very simple -unit-cell that uses lumped fission product defined -in other file. Both MCC3 and DIF3D are being executed. -The example also applies unit-conversion -capability of WATTS. Results from PyARC are extracted -and stored in params. -""" - -import watts -from astropy.units import Quantity - -# TH params -params = watts.Parameters() -params['assembly_pitch'] = Quantity(20, "cm") # 20e-2 m -params['assembly_length'] = Quantity(13, "cm") # 0.13 m -params['temp'] = Quantity(26.85, "Celsius") # 300 K - -params.show_summary(show_metadata=False, sort_by='key') - -# PyARC Workflow - -pyarc_plugin = watts.PluginPyARC('pyarc_template', show_stdout=True, extra_inputs=['lumped.son']) # show all the output -pyarc_result = pyarc_plugin(params) -for key in pyarc_result.results_data: - print(key, pyarc_result.results_data[key]) -print(pyarc_result.inputs) -print(pyarc_result.outputs) -params['keff-dif3d'] = pyarc_result.results_data["keff_dif3d"][0.0] -params['keff-mcc3'] = pyarc_result.results_data["keff_mcc3"][('R', 0, 1, 'A', 1)] - -params.show_summary(show_metadata=True, sort_by='key') diff --git a/src/watts_ui/examples/1App_RELAP5_SingleChannel/README.md b/src/watts_ui/examples/1App_RELAP5_SingleChannel/README.md deleted file mode 100644 index 16e8b049..00000000 --- a/src/watts_ui/examples/1App_RELAP5_SingleChannel/README.md +++ /dev/null @@ -1,19 +0,0 @@ -# 1App_RELAP5_SingleChannel - -## Purpose - -This example provides a demonstration on how to use WATTS to run RELAP5-3D. - -## Code(s) - -- RELAP5-3D - -## Keywords - -- Single annulus channel -- Internally heated - -## File descriptions - -- [__watts_exec.py__](watts_exec.py): This is the file to execute to run the problem described above. -- [__relap5_template__](relap5_template): Templated RELAP5-3D input. diff --git a/src/watts_ui/examples/1App_RELAP5_SingleChannel/relap5_template b/src/watts_ui/examples/1App_RELAP5_SingleChannel/relap5_template deleted file mode 100644 index ff1007a3..00000000 --- a/src/watts_ui/examples/1App_RELAP5_SingleChannel/relap5_template +++ /dev/null @@ -1,280 +0,0 @@ -=ANL Water SNGLCHN -* -* -****************************** -* Model Options * -****************************** -* type state -100 new transnt -* option -101 run -* iunits ounits -102 si si -* -104 ascii -* t1 t2 alloc -105 1.0 2.0 5.0e5 -* Noncondensable Gas Species -110 air -* cell elev fluid sysname -120 910010000 0.0 h2o SNGLCHN -* -* tend minstep maxstep copt pfreq majed rsrtf -201 10.0 1.0e-10 0.01 19 200 1000 1000 -* -******************************* -* General Tables * -******************************* -* -*n: HL -* type trip factor1 factor2 -20240000 htc-t 0 1.0 1.0 -* TimeHeat Transfer -20240001 -1.0 10.0 -20240001 1.4e5 10.0 -* -*n: source -* type trip factor1 factor2 -20250000 power 0 1.0 1.0 -* Time Power -20250001 -1.0 0.0 -20250002 0.0 {{ heater_power }} -20250003 1.4e5 {{ heater_power }} -* -************************** -* Materials * -************************** -* -*n: SS -* type tflag vflag -20100100 tbl/fctn 1 1 -* temp thcond -20100101 -100.0 12.97 -20100102 300.0 12.97 -20100103 800.0 21.06 -20100104 1600.0 34.0 -20100105 9999.0 34.0 -* heat Capacity -20100151 4.18e6 -* -*n: KF -* type tflag vflag -20100300 tbl/fctn 1 1 -* temp thcond -20100301 -100.0 0.0339 -20100302 273.15 0.0339 -20100303 297.15 0.0353 -20100304 305.15 0.0372 -20100305 1000.0 0.0372 -20100306 9999.0 0.0372 -* heat Capacity -20100351 8.32e4 -* -* -************************************* -* Hydraulic Components * -************************************* -* -************** Pipe *************** -* name type -2000000 "chan-1" annulus -* ncells -2000001 10 -* x-area volid -2000101 7.706e-3 10 -* x-length volid -2000301 0.3 10 -* volume volid -2000401 0.0 10 -* azim-angle volid -2000501 0.0 10 -* vert-angle volid -2000601 90.0 10 -* x-wall xhd volid -2000801 0.0 0.0384302 10 -* x-flags volid -2001001 0 10 -* ebt press temp none none none id -2001201 003 1.013e5 292.65 0.0 0.0 0.0 10 -* jefvcahs jun num -2001101 00001000 9 -* jun control -2001300 1 -* mfl mfv unused junid -2001301 0.0 0.0 0.0 9 -* -* -************ Inlet BC ************* -* name type -9100000 "inlet" tmdpvol -* area length vol -9100101 1000.0 0.0 1000.0 -* az-angle inc-angle dz -9100102 0.0 0.0 0.0 -* x-rough x-hd flags -9100103 0.0 0.0 10 -* cword -9100200 3 -* srch press temp -9100201 0.0 {{ inlet_pressure }} 292.65 -* -* -************ Outlet BC ************ -* name type -9200000 "outlet" tmdpvol -* area length vol -9200101 1000.0 0.0 1000.0 -* az-angle inc-angle dz -9200102 0.0 0.0 0.0 -* x-rough x-hd flags -9200103 0.0 0.0 10 -* cword -9200200 2 -* srch press squal -9200201 0.0 {{ outlet_pressure }} 1.0 -* -* -********** Inlet Junction ********** -* name type -2090000 "inflow" tmdpjun -* from to area jefvcahs -2090101 910010002 200010001 7.706e-3 0 -* control trip alpha num -2090200 1 -* srch mfl mfv unused -2090201 0.0 0.0 0.0 0.0 -2090202 50.0 0.5 0.0 0.0 -2090203 100.0 0.5 0.0 0.0 -2090204 150.0 0.8 0.0 0.0 -2090205 200.0 0.8 0.0 0.0 -* -* -********* Outlet Junction ********** -* name type -2190000 "outflow" sngljun -* from to area -2190101 200100002 920010001 7.706e-3 -* fwd. loss rev. loss jefvcahs -2190102 1.5 1.5 110 -* subcooled twophase -2190103 1.0 1.0 -* flow mfl mfv unused -2190201 1 0.0 0.0 0.0 -* -* -******************************** -* Heat Structures * -******************************** -* -* -********** Inner Annulus Heater ********** -* nh np geom ssif leftcoord reflood -12000000 10 2 2 1 0.0 0 -* mesh format -12000100 0 1 -* intervals radius -12000101 1 0.01270 -* material interval -12000201 1 1 -* rpkf interval -12000301 1.0 1 -* temp source -12000400 0 -* temp interval -12000401 292.65 2 - -* Left Boundary Condition Data -* bound incr type code factor node -12000501 0 0 0 1 0.3 1 -12000502 0 0 0 1 0.3 2 -12000503 0 0 0 1 0.3 3 -12000504 0 0 0 1 0.3 4 -12000505 0 0 0 1 0.3 5 -12000506 0 0 0 1 0.3 6 -12000507 0 0 0 1 0.3 7 -12000508 0 0 0 1 0.3 8 -12000509 0 0 0 1 0.3 9 -12000510 0 0 0 1 0.3 10 - -* Right Boundary Condition Data -* bound incr type code factor node -12000601 200010000 0 101 1 0.3 1 -12000602 200020000 0 101 1 0.3 2 -12000603 200030000 0 101 1 0.3 3 -12000604 200040000 0 101 1 0.3 4 -12000605 200050000 0 101 1 0.3 5 -12000606 200060000 0 101 1 0.3 6 -12000607 200070000 0 101 1 0.3 7 -12000608 200080000 0 101 1 0.3 8 -12000609 200090000 0 101 1 0.3 9 -12000610 200100000 0 101 1 0.3 10 -* source mult dmhl dmhr num -12000701 500 1.0 0.0 0.0 10 -* Left Additional Boundary Condition Data -12000800 1 -* hthd hlf hlr gslf gslr glcf glcr lbf ncl tpdr foul node -12000801 0.0 10.0 10.0 0.0 0.0 0.0 0.0 1.0 0.0 1.1 1.0 10 -* Right Additional Boundary Condition Data -12000900 0 -* hthd hlf hlr gslf gslr glcf glcr lbf node -12000901 0.0127 10.0 10.0 0.0 0.0 0.0 0.0 1.0 10 -* -* -********** Outer Channel Wall ********** -* nh np geom ssif leftcoord reflood -12010000 10 9 2 1 0.0511302 0 -* mesh format -12010100 0 1 -* intervals radius -12010101 4 0.05715 -12010102 4 0.10795 -* material interval -12010201 1 4 -12010202 3 8 -* rpkf interval -12010301 0.0 8 -* temp source -12010400 0 -* temp interval -12010401 292.65 9 -* -* Left Boundary Condition Data -* bound incr type code factor node -12010501 200010000 0 101 1 0.3 1 -12010502 200020000 0 101 1 0.3 2 -12010503 200030000 0 101 1 0.3 3 -12010504 200040000 0 101 1 0.3 4 -12010505 200050000 0 101 1 0.3 5 -12010506 200060000 0 101 1 0.3 6 -12010507 200070000 0 101 1 0.3 7 -12010508 200080000 0 101 1 0.3 8 -12010509 200090000 0 101 1 0.3 9 -12010510 200100000 0 101 1 0.3 10 -* -* Right Boundary Condition Data -* bound incr type code factor node -12010601 920010000 0 3400 1 0.3 1 -12010602 920010000 0 3400 1 0.3 2 -12010603 920010000 0 3400 1 0.3 3 -12010604 920010000 0 3400 1 0.3 4 -12010605 920010000 0 3400 1 0.3 5 -12010606 920010000 0 3400 1 0.3 6 -12010607 920010000 0 3400 1 0.3 7 -12010608 920010000 0 3400 1 0.3 8 -12010609 920010000 0 3400 1 0.3 9 -12010610 920010000 0 3400 1 0.3 10 -* source mult dmhl dmhr num -12010701 0 0.0 0.0 0.0 10 -* Left Additional Boundary Condition Data -12010800 1 -* hthd hlf hlr gslf gslr glcf glcr lbf ncl tpdr foul node -12010801 0.0 10.0 10.0 0.0 0.0 0.0 0.0 1.0 0.0 1.1 1.0 10 -* Right Additional Boundary Condition Data -12010900 0 -* hthd hlf hlr gslf gslr glcf glcr lbf node -12010901 0.0 10.0 10.0 0.0 0.0 0.0 0.0 1.0 10 -* -* -* -* -. diff --git a/src/watts_ui/examples/1App_RELAP5_SingleChannel/watts_comprehensive.son b/src/watts_ui/examples/1App_RELAP5_SingleChannel/watts_comprehensive.son deleted file mode 100644 index 6052d412..00000000 --- a/src/watts_ui/examples/1App_RELAP5_SingleChannel/watts_comprehensive.son +++ /dev/null @@ -1,28 +0,0 @@ -watts{ - % Change the working directory to the directory where the input files are stored. This is necessary - % due to how WATTS copies input files to the temporary working directory. - workflow_dir = "C:/Users/zooi/Desktop/watts-workbench/src/watts_ui/examples/1App_RELAP5_SingleChannel" - - % Make sure that all necessary files (executable, fluid property files, etc) are in the - % same directory as the input and template files. - plugins{ - plugin(ID1){ - code = "RELAP5" - template = "relap5_template" - show_stderr = False - show_stdout = False - plotfl_to_csv = True - % extra_args = ["-w", "tpfh2o", "-e", "tpfn2", "-tpfdir", "C:/Users/zooi/Documents/NSTF/watts/R5/"] - } - } - - workflow_level1{ - plugin = ID1 - variables{ - param(inlet_pressure) {value = 3.0e5} - param(outlet_pressure) {value = 1.013e5} - param(heater_power) {value = 20000} - } - } - -} \ No newline at end of file diff --git a/src/watts_ui/examples/1App_RELAP5_SingleChannel/watts_exec.py b/src/watts_ui/examples/1App_RELAP5_SingleChannel/watts_exec.py deleted file mode 100644 index 721a208a..00000000 --- a/src/watts_ui/examples/1App_RELAP5_SingleChannel/watts_exec.py +++ /dev/null @@ -1,46 +0,0 @@ -# SPDX-FileCopyrightText: 2022 UChicago Argonne, LLC -# SPDX-License-Identifier: MIT - -""" -This is an example problem of running RELAP5-3D with WATTS. -The problem is a single annulus channel where the inner cylinder -is heated. The inner heater and the outer pipe wall are modeled -as heat structures. Inlet and outlet boundary conditions are -specified at the inlet and outlet of the channel. The example -also shows how to add extra input options to the execution of -RELAP5-3D. -""" - -import os -import watts -from astropy.units import Quantity - -from pathlib import Path - -params = watts.Parameters() - -# Channel params -params['inlet_pressure'] = 3.0e5 -params['outlet_pressure'] = 1.013e5 -params['heater_power'] = Quantity(20, "kW") - - -params.show_summary(show_metadata=False, sort_by='key') - -# RELAP5-3D Workflow -relap5_plugin = watts.PluginRELAP5('relap5_template') - -# Example of input with extra options, including explicitly specifying the -# locations of fluid files. -# relap5_plugin = watts.PluginRELAP5('relap5_template') -# relap5_plugin(params, extra_args=['-w', 'tpfh2o', '-e', 'tpfn2', '-tpfdir', 'location\of\fluid\property\files']) - -# If RELAP5_DIR is not added to the environment, the directory where the -# executable and license key are stored can be specified explicitly. -# relap5_plugin.relap5_dir = "location\of\executable\and\license\key" - -relap5_result = relap5_plugin(params) -for key in relap5_result.csv_data: - print(key, relap5_result.csv_data[key]) -print(relap5_result.inputs) -print(relap5_result.outputs) diff --git a/src/watts_ui/examples/1App_SAM_SimpleJunction/sam_template b/src/watts_ui/examples/1App_SAM_SimpleJunction/sam_template deleted file mode 100644 index f6866344..00000000 --- a/src/watts_ui/examples/1App_SAM_SimpleJunction/sam_template +++ /dev/null @@ -1,144 +0,0 @@ -[GlobalParams] - global_init_P = 1.2e5 - global_init_V = 1 - global_init_T = 628.15 - scaling_factor_var = '1 1e-3 1e-6' -[] - -[EOS] - [./eos] - type = PBSodiumEquationOfState - [../] -[] - -[Functions] - [./time_stepper] - type = PiecewiseLinear - x = ' 0 20 21 100 101 1e5' - y = '0.1 0.1 0.5 0.5 1 1' - [../] -[] - -[Components] - [./pipe1] - type = PBOneDFluidComponent - eos = eos - position = '0 0 0' - orientation = '0 0 1' - heat_source = {{ heat_source }} - f= {{ friction_factor }} - Dh = {{ Dh }} - length = 1 - # A = 3.14e-4 - A = {{ flow_area }} - n_elems = 10 - [../] - - [./pipe2] - type = PBOneDFluidComponent - eos = eos - position = '0 0 1' - orientation = '0 0 1' - f=0.1 - Dh = 0.01 - length = 1 - heat_source = 1e7 - A = 3.14e-4 - n_elems = 10 - [../] - - [./joint] - type = PBSingleJunction - eos = eos - inputs='pipe1(out)' - outputs='pipe2(in)' - weak_constraint = true - [../] - [./inlet] - type = PBTDJ - input = 'pipe1(in)' - eos = eos - v_bc = {{ velocity_inlet }} - T_bc = {{ temperature_inlet }} - [../] - - [./outlet] - type = PBTDV - input = 'pipe2(out)' - eos = eos - p_bc = '1.0e5' - T_bc = 728.15 - [../] -[] - -[Postprocessors] - [./TotalMassFlowRateInlet_2] - type = ComponentBoundaryFlow - input = 'pipe2(out)' - [../] - [./Outlet_Temperature_2] - type = ComponentBoundaryVariableValue - variable = temperature - input = 'pipe2(out)' - [../] -[] - -[Preconditioning] - active = 'SMP_PJFNK' - - [./SMP_PJFNK] - type = SMP - full = true - solve_type = 'PJFNK' - petsc_options_iname = '-pc_type' - petsc_options_value = 'lu' - [../] -[] # End preconditioning block - - -[Executioner] - type = Transient - - dt = 1e-1 - dtmin = 1e-5 - - # setting time step range - [./TimeStepper] - type = FunctionDT - function = time_stepper - [../] - - petsc_options_iname = '-ksp_gmres_restart' - petsc_options_value = '100' - - nl_rel_tol = 1e-8 - nl_abs_tol = 1e-7 - nl_max_its = 20 - - l_tol = 1e-5 # Relative linear tolerance for each Krylov solve - l_max_its = 100 # Number of linear iterations for each Krylov solve - - start_time = 0.0 - end_time = 100. - - [./Quadrature] - type = TRAP - order = FIRST - [../] -[] # close Executioner section - -[Outputs] - perf_graph = true - [./out_displaced] - type = Exodus - use_displaced = true - execute_on = 'initial timestep_end' - sequence = false - [../] - [./csv] - type = CSV - [../] - [./console] - type = Console - [../] -[] diff --git a/src/watts_ui/examples/1App_SAM_SimpleJunction/watts_comprehensive.son b/src/watts_ui/examples/1App_SAM_SimpleJunction/watts_comprehensive.son deleted file mode 100644 index 1429148a..00000000 --- a/src/watts_ui/examples/1App_SAM_SimpleJunction/watts_comprehensive.son +++ /dev/null @@ -1,35 +0,0 @@ -watts{ - % Change the working directory to the directory where the input files are stored. This is necessary - % due to how WATTS copies input files to the temporary working directory. - workflow_dir = "/Users/zhieejhiaooi/Documents/ANL/watts-devel/watts/src/watts_ui/examples/1App_SAM_SimpleJunction" - - plugins{ - plugin(ID1){ - code = "moose" - template = "sam_template" - exec_dir = "SAM_DIR" - exec_name = "sam-opt" - show_stderr = False - show_stdout = False - } - } - - workflow_level1{ - plugin = ID1 - variables{ - param(temperature_inlet) {value = 2.0} - param(friction_factor) {value = 0.1} - param(flow_area) {value = 3.14e-4} - param(country) {value = USA} - param(Dh) {value = 1 unit = m} - param(velocity_inlet) {value = 1} - param(name) {list = [ANL INL ORNL LANL]} - param(size) {list = [30.0 50.4 -60.6 1e-5]} - param(velocity_outlet) {func = "2 * temperature_inlet ** 3"} - param(velocity_outlet_2) {func = "friction_factor + 2 + temperature_inlet ** 3"} - param(wall_bc) {bool = "True"} - param(heat_source) {value = 1e5} - } - } - -} \ No newline at end of file diff --git a/src/watts_ui/examples/1App_SAM_SimpleJunction/watts_exec.py b/src/watts_ui/examples/1App_SAM_SimpleJunction/watts_exec.py deleted file mode 100644 index 6f090991..00000000 --- a/src/watts_ui/examples/1App_SAM_SimpleJunction/watts_exec.py +++ /dev/null @@ -1,65 +0,0 @@ -# SPDX-FileCopyrightText: 2022 UChicago Argonne, LLC -# SPDX-License-Identifier: MIT - -""" -This example demonstrates how to use WATTS to perform -SAM calculations. This example uses a simple VHTR unit-cell -model with 1 coolant channel surrounded by graphite and fuel. -The demonstration includes the application of unit-conversion -approach in WATTS. After execution of SAM using the MOOSE plugin, -the results stored in CSV files are displayed to the user. -""" - -from math import cos, pi -import os -from pathlib import Path - -import watts -from astropy.units import Quantity - - -params = watts.Parameters() - -# TH params - -params['He_inlet_temp'] = Quantity(600, "Celsius") # 873.15 K -params['He_outlet_temp'] = Quantity(850, "Celsius") # 1123.15 K -params['He_cp'] = Quantity(4.9184126, "BTU/(kg*K)") # 5189.2 J/kg-K -params['He_K'] = 0.32802 # W/m-K -params['He_density'] = 3.8815 # kg/m3 -params['He_viscosity'] = 4.16e-5 # Pa.s -params['He_Pressure'] = Quantity(1015.264164, "psi") # 7e6 Pa -params['Tot_assembly_power'] = 250000 # W - -for i in range(1, 6): - params[f'Init_P_{i}'] = 1 # Fraction - -# Core design params - some are not used in SAM model -params['ax_ref'] = 20 # cm -params['num_cool_pins'] = 1*6+2*6+6*2/2 -params['num_fuel_pins'] = 6+6+6+3*6+2*6/2+6/3 -params['Height_FC'] = Quantity(2000, "mm") # Automatically converts to 'm' for MOOSE and 'cm' for openmc -params['Lattice_pitch'] = 2.0 -params['FuelPin_rad'] = 0.90 # cm -params['cool_hole_rad'] = 0.60 # cm -params['Coolant_channel_diam'] = (params['cool_hole_rad'] * 2)/100 # in m -params['Graphite_thickness'] = (params['Lattice_pitch'] - params['FuelPin_rad'] - params['cool_hole_rad']) # cm -params['Assembly_pitch'] = 7.5 * 2 * params['Lattice_pitch'] / (cos(pi/6) * 2) -params['lbp_rad'] = 0.25 # cm -params['mod_ext_rad'] = 0.90 # cm -params['shell_thick'] = 0.05 # FeCrAl -params['liner_thick'] = 0.007 # Cr -params['control_pin_rad'] = Quantity(9.9, "mm") # Automatically converts to 'm' for MOOSE and 'cm' for openmc - -params.show_summary(show_metadata=False, sort_by='key') - -# MOOSE Workflow -# set your SAM directory as SAM_DIR - -app_dir = Path(os.environ["SAM_DIR"]) -moose_plugin = watts.PluginMOOSE('sam_template', executable=app_dir / 'sam-opt') -moose_result = moose_plugin(params) -for key in moose_result.csv_data: - print(key, moose_result.csv_data[key]) -print(moose_result.inputs) -print(moose_result.outputs) diff --git a/src/watts_ui/examples/1App_SAS_MultiTemplates_SodiumLoop/Channel b/src/watts_ui/examples/1App_SAS_MultiTemplates_SodiumLoop/Channel deleted file mode 100644 index 03b9911b..00000000 --- a/src/watts_ui/examples/1App_SAS_MultiTemplates_SodiumLoop/Channel +++ /dev/null @@ -1,319 +0,0 @@ - - - - -#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 -#=============================================================================== -# -# # # ####### ####### # # -# ## ## # # # # # -# # # # # # # # # # -# # # # ##### # # # # -# # # # # ####### # -# # # # # # # # -# # # ####### # # # ####### -# -# # ##### # ###### -# # # # # # # # -# # # # # # # -# ####### # #### # # ###### -# # # # ####### # -# # # # # # # -# # ##### # # # -# -#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 -INPCOM 1 1 1 -# -# NCHAN: Number of Channels -# | - 1 1 1 -# - -1 -#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 -# -# INPCHN: Channel-Dependent Input (Integer) -# -INPCHN 51 1 0 -# -# IDBUGV: 8 for coolant-cladding temperature calculations -# | -# 1 1 8 -# -# NPLN: Number of Segments in Gas Plenum -# | NREFB: Number of Reflector Zones below Pin -# | | NREFT: Number of Reflector Zones above Pin -# | | | (Note: Below + Above <= 6) - 4 3 2 1 1 -# -# NZNODE(KZ): Number of Segments in Zone KZ -# 0.0476m Unheated section in the inlet tee -# | 3m Heated section + 0.001 Fictitious Gas Plenum -# | | 1.975m Unheated annular before the expansion joint -# | | | - 7 3 2 22 12 -# -# NT: Number of Radial Temperature Nodes in Fuel -# | - 14 1 10 -# -# IFUELV: Table Number of Property Value for Driver Fuel -# | IFUELB: Table Number of Property Value for Blanket Fuel -# | | ICLADV: Table Number for Cladding -# | | | - 15 3 1 0 1 -# -# NGRDSP: Number of spacer grids in pin -# | - 18 1 0 -# -# NPIN: Number of Pins per Subassembly -# | NSUBAS: Number of Subassemblies in Channel -# | | - 25 2 1 1 -# -# IRHOK: 0 for tabular fuel thermo-physical properties -# | - 3 1 0 -# - -1 -#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 -# -# GEOMIN: Geometry Input for Channel (Floating Point) -# -GEOMIN 61 1 0 -# -# ACCZ(KZ): Coolant Flow Area per Fuel Pin in Zone KZ -# | | | - 1 3 8.551E-04 8.551E-04 8.551E-04 -# -# AXHI(J): Length of Axial Segment J in Core and Blanket -# | | | | | - 8 5 0.15 0.15 0.15 0.15 0.15 - 13 5 0.15 0.15 0.15 0.15 0.15 - 18 5 0.15 0.15 0.15 0.15 0.15 - 23 5 0.15 0.15 0.15 0.15 0.15 -# -# DHZ(KZ): Hydraulic Diameter for Zone KZ -# | | | - 32 3 1.905E-2 1.905E-2 1.905E-2 -# -# DSTIZ(KZ): Thickness of Inner Structure Node in Zone KZ -# | | | - 39 3 2.54E-03 2.54E-03 2.54E-03 -# -# DSTOZ(KZ): Thickness of Outer Structure Node in Zone KZ -# | | | - 46 3 2.54E-03 2.54E-03 2.54E-03 -# -# PLENL: Length of Fission-Gas Plenum -# | - 53 1 0.001 # Made small relative to the entire heated section -# -# RBR(J): Cladding Inner Radius for Axial Segment J -# | - 54 1 9.0E-03 -# -# RER(J): Cladding Outer Radius for Axial Segment J -# | - 78 1 9.525E-03 -# -# RBRPL: Cladding Inner Radius in Fission-Gas Plenum -# | - 102 1 9.0E-03 -# -# RERPL: Cladding Outer Radius in Fission-Gas Plenum -# | - 103 1 9.525E-03 -# -# RINFP(J): Fuel Inner Radius for Axial Segment J -# | - 104 1 0.0E+00 -# -# ROUTFP(J): Fuel Outer Radius for Axial Segment J -# | - 128 1 9.0E-03 -# -# ZONEL(KZ): Length of Zone KZ -# 0.0476m Unheated section in inlet tee -# | 3m Heated section + 0.001m Gas Plenum -# | | 1.975m unheated annulus -# | | | - 152 3 0.500 3.001 2.000 -# -# SRFSTZ(KZ): Structure Perimeter per Pin in Zone KZ -# | | | - 159 3 1.197E-01 1.197E-01 1.197E-01 -# -# AREAPC: Coolant Plus Pin Area per Pin in the Pin Section -# | - 166 1 1.14E-03 -# -# RBR0: Nominal Cladding Inner Radius -# | RER0: Nominal Cladding Outer Radius -# | | - 180 2 9.0E-03 9.525E-03 -# -# SER(KZ): Reflector Perimeter, Pin Perimeter in -# Plenum Region when KZ = KZPIN -# | | | - 182 3 5.9847E-02 5.9847E-02 5.9847E-02 -# -# DRFO(KZ): Thickness of Outer Reflector Node/Cladding -# | | | - 169 3 5.25E-04 5.25E-04 5.25E-04 -# -# DRFI(KZ): Thickness of Inner Reflector Node in Zone KZ -# | | | - 189 3 5.25E-04 5.25E-04 5.25E-04 -# - -1 -#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 -# -# POWINC: Channel-Dependent Power Input (Floating Point) -# -POWINC 62 1 0 -# -# GAMSS: Fraction of Power from Direct Heating of Structure -# | - 2 1 1.0E-10 -# -# GAMTNC: Fraction of Power from Direct Heating of Coolant -# | GAMTNE: Fraction of Heating in Cladding -# | | - 4 2 1.0E-10 1.0E-10 -# -# PSHAPE(J): Ratio of Pin Power in Axial Segment J to Peak. -# | | | | | - 6 5 1.0 1.0 1.0 1.0 1.0 - 11 5 1.0 1.0 1.0 1.0 1.0 - 16 5 1.0 1.0 1.0 1.0 1.0 - 21 5 1.0 1.0 1.0 1.0 1.0 -# -# PSHAPR(I): Radial Power Shape within Pin -# | | | | | - 30 5 1.0 1.0 1.0 1.0 1.0 - 35 5 1.0 1.0 1.0 1.0 1.0 -# -# PRSHAP: Ratio of Average Power per Subassembly to -# | Average Power Over All Subassemblies -# | - 256 1 1.0 -# - -1 -#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 -# -# PMATCH: Channel-Dependent Properties Input (Floating Point) -# -PMATCH 63 1 0 -# -# XKSTIZ(KZ): Inner Structure Thermal Conductivity for Zone KZ -# | | | - 11 3 15.868 15.868 15.868 # Typical value @ 100 C -# -# XKSTOZ(KZ): Outer Structure Thermal Conductivity for Zone KZ -# | | | - 18 3 15.868 15.868 15.868 # Typical value @ 100 C -# -# P0GAS: Initial Plenum Gas Pressure at Reference Temperature TR -# | - 27 1 1.0E+05 # Fictitious -# -# XKRF(KZ): Reflector Thermal Coductivity for Zone KZ -# | | | - 28 3 15.868 15.868 15.868 # Typical value @ 100 C -# -# DENSS: Density of Solid Cladding at Reference Temperature TR -# | - 35 1 8.0E+03 -# -# RHOCSI(KZ): Density x Heat Capacity for Inner Structure -# | | | - 37 3 3.9293E+06 3.9293E+06 3.9293E+06 -# -# RHOCSO(KZ): Density x Heat Capacity for Outer Structure -# | | | - 44 3 3.9293E+06 3.9293E+06 3.9293E+06 -# -# RHOCR(KZ): Density x Heat Capacity for Reflector -# | | | - 51 3 3.9293E+06 3.9293E+06 3.9293E+06 -# -# RHOCG: Density x Heat Capacity for Gas in Plenum -# | RG: Thermal Resistance of Plenum Gas -# | | - 58 2 1.0E+03 0.06 # Fictitious -# -# REFDEN: Theoretical density of metal fuel at reference temperature -# | - 72 1 8.0E+03 -# - -1 -#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 -# -PMATCH 63 1 1 -# -# HBMAX: Max value of bond conductance when a gap exists -# | HBMIN: Minimum value of bond conductance -# | | - 5 2 1.0E+06 1.0E+00 -# -# HBPAR: Gap conductance = HBPAR/gap -# | (Used only if location 2-4 are zero) -# | - 7 1 64.0 -# - -1 -#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 -# -# COOLIN: Channel-Dependent Coolant Input (Floating Point) -# -COOLIN 64 1 0 -# -# AFR, BFR: Liquid Slug Friction Factor Coefficients -# | | - 1 2 0.3322 -0.25 -# -# C1, C2, C3: Coefficients for Convection Heat-Transfer Coefficient -# | | | - 3 3 1.077 0.4 0.0 -# -# RELAM: Re Number for Switch between Turb. and Lam. -# | AFLAM: Laminar Friction Factor = AFLAM/Re -# | | - 7 2 2000.0 95.36 -# -# W0: Initial Coolant Flow Rate per Pin (kg/s) -# | - 47 1 0.15 -# -# XKORI(K,M): Orifice coefficients -# K=1,2,3; @ Bottom of Zone K -# K=4; @ Top of Subassembly -# M=1,2; For upward & downward flow -# | | - 48 2 1.55 0.0 - 50 2 0.0 0.0 - 52 2 0.0 0.0 - 54 2 0.0 0.0 -# -# XKORGD: Orifice coefficient for spacer grids in pin -# | - 64 1 0.0 -# -# DZIAB, DZIAT: Effective Coolant Inertial Term Below/Above -# | | Subassembly Inlet/Outlet - 65 2 318.31 318.31 -# -# THETA1, THETA2: 0.5 Normally, 0/1 Implicit Calculation -# | | - 67 2 0 1. -# -# DTLMAX: Max. Coolant Temp. Change per Coolant Time Step -# | - 69 1 15.0 -# -# DTCMIN: Min. Coolant Time Step Size before Boiling -# | - 171 1 1.0E-05 -# - -1 \ No newline at end of file diff --git a/src/watts_ui/examples/1App_SAS_MultiTemplates_SodiumLoop/DecayPower b/src/watts_ui/examples/1App_SAS_MultiTemplates_SodiumLoop/DecayPower deleted file mode 100644 index 0e104147..00000000 --- a/src/watts_ui/examples/1App_SAS_MultiTemplates_SodiumLoop/DecayPower +++ /dev/null @@ -1,199 +0,0 @@ - - - - -#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 -#=============================================================================== -# -# ###### ####### ##### # # # -# # # # # # # # # # -# # # # # # # # # -# # # ##### # # # # -# # # # # ####### # -# # # # # # # # # -# ###### ####### ##### # # # -# -# ###### ####### # # ####### ###### -# # # # # # # # # # # -# # # # # # # # # # # -# ###### # # # # # ##### ###### -# # # # # # # # # # -# # # # # # # # # # -# # ####### ## ## ####### # # -# -#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 -INPCHN 51 1 1 -# -# IDKCRV: Power or Decay Heat Curve for this Channel -# | - 203 1 0 -# - -1 -#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 -INPCOM 1 1 1 -# -# NDKGRP: Number of Decay Heat Groups -# | - 17 1 0 -# -# NPOWDK: Number of Power Curves or Sets of Decay Heat Parameters -# | - 45 1 0 -# - -1 -#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 -POWINA 12 1 1 -# -# DKBET2(L,IPW): Decay heat precursor yield for group L in -# | decay heat curve IPW (New Model) -# 511 1 0.020 -# 512 1 0.022 -# 513 1 0.017 -# 514 1 0.015 -# 515 1 0.014 -# 516 1 0.012 -# -# DKLAM2(L,IPW): Decay heat decay constant for group L in -# | decay heat curve IPW (New Model) -# 631 1 0.100 -# 632 1 0.050 -# 633 1 0.010 -# 634 1 0.005 -# 635 1 0.002 -# 636 1 0.0005 -# - -1 -#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 -# AXIAL!!! -#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 -INPCHN 51 1 1 -# -# IREACZ: Axial Reactivity Worth (0/1 = On MZ/MZC Mesh) -# | - 365 1 1 -# -# IAXEXP: Calculate Simple Axial Expansion Feedback -# | - 181 1 1 -# - -1 -#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 -INPCOM 1 1 1 -# -# MODEEX: Axial Expansion Option -# | 0: Force balance or free expansion (gap-dependent) -# | 1: Cladding control fuel expansion -# | 2: Independent free fuel-clad expansion -# | 3: Force balance all the time - 55 1 2 -# - -1 -#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 -PMATCH 63 1 1 -# -# FUELEX: Fuel Axial Expansion Coefficient -# | - 73 1 2e-05 -# -# CLADEX: Clad Axial Expansion Coefficient -# | - 74 1 1.4e-05 -# -# YFUEL: Fuel Young's Modulus -# | -# 75 1 2.8E+09 -# -# YCLAD: Clad Young's Modulus -# | -# 76 1 1.5E+11 -# -# EXPCFF: Effective Axial Expansion Multiplier -# | (For Simple Feedback Model Only) - 79 1 1.0 -# - -1 -#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 -# -# POWINC: Channel-Dependent Power Input (Floating Point) -# -POWINC 62 1 1 -# -# FUELRA: Doppler Axial Weighting Factor -# | - 208 1 0.0 Lower Reflector 1, Segment 1 - 209 1 0.0 Lower Reflector 1, Segment 2 - 216 1 1.1E-05 Fuel, Segment 1 - 217 1 1.3E-05 Fuel, Segment 2 - 218 1 1.6E-05 Fuel, Segment 3 - 219 1 1.9E-05 Fuel, Segment 4 - 220 1 2.3E-05 Fuel, Segment 5 - 221 1 2.4E-05 Fuel, Segment 6 - 222 1 2.7E-05 Fuel, Segment 7 - 223 1 3.1E-05 Fuel, Segment 8 - 224 1 3.6E-05 Fuel, Segment 9 - 225 1 4.0E-05 Fuel, Segment 10 - 226 1 3.7E-05 Fuel, Segment 11 - 227 1 3.3E-05 Fuel, Segment 12 - 228 1 2.5E-05 Fuel, Segment 13 - 229 1 1.9E-05 Fuel, Segment 14 - 230 1 7.0E-05 Fuel, Segment 15 - 231 1 1.4E-05 Fuel, Segment 16 - 232 1 1.4E-05 Fuel, Segment 17 - 233 1 1.4E-05 Fuel, Segment 18 - 234 1 1.4E-05 Fuel, Segment 19 - 235 1 1.4E-05 Fuel, Segment 20 - 236 1 1.0E-05 Gas Plenum, Segment 1 - 237 1 0.0 Gas Plenum, Segment 2 - 238 1 0.0 Upper Reflector 1, Segment 1 - 239 1 0.0 Upper Reflector 1, Segment 2 - 240 1 0.0 Upper Reflector 1, Segment 3 - 241 1 0.0 Upper Reflector 1, Segment 4 - 242 1 0.0 Upper Reflector 1, Segment 5 - 243 1 0.0 Upper Reflector 1, Segment 6 - 244 1 0.0 Upper Reflector 1, Segment 7 - 245 1 0.0 Upper Reflector 1, Segment 8 - 246 1 0.0 Upper Reflector 1, Segment 9 - 247 1 0.0 Upper Reflector 1, Segment 10 - 248 1 0.0 Upper Reflector 1, Segment 11 - 249 1 0.0 Upper Reflector 1, Segment 12 -# -# CLADRA: Doppler Axial Weighting Factor -# | - 160 1 0.0 Lower Reflector 1, Segment 1 - 161 1 0.0 Lower Reflector 1, Segment 2 - 168 1 9.0E-07 Fuel, Segment 1 - 169 1 1.9E-06 Fuel, Segment 2 - 170 1 2.3E-06 Fuel, Segment 3 - 171 1 2.5E-06 Fuel, Segment 4 - 172 1 2.8E-06 Fuel, Segment 5 - 173 1 3.0E-06 Fuel, Segment 6 - 174 1 3.5E-06 Fuel, Segment 7 - 175 1 4.8E-06 Fuel, Segment 8 - 176 1 5.2E-06 Fuel, Segment 9 - 177 1 4.6E-06 Fuel, Segment 10 - 178 1 3.9E-06 Fuel, Segment 11 - 179 1 3.5E-06 Fuel, Segment 12 - 180 1 2.4E-06 Fuel, Segment 13 - 181 1 2.2E-06 Fuel, Segment 14 - 182 1 1.8E-06 Fuel, Segment 15 - 183 1 1.2E-06 Fuel, Segment 16 - 184 1 2.4E-06 Fuel, Segment 17 - 185 1 2.2E-06 Fuel, Segment 18 - 186 1 1.8E-06 Fuel, Segment 19 - 187 1 1.2E-06 Fuel, Segment 20 - 188 1 8.0E-07 Gas Plenum, Segment 1 - 189 1 0.0 Gas Plenum, Segment 2 - 190 1 0.0 Upper Reflector 1, Segment 1 - 191 1 0.0 Upper Reflector 1, Segment 2 - 192 1 0.0 Upper Reflector 1, Segment 3 - 193 1 0.0 Upper Reflector 1, Segment 4 - 194 1 0.0 Upper Reflector 1, Segment 5 - 195 1 0.0 Upper Reflector 1, Segment 6 - 196 1 0.0 Upper Reflector 1, Segment 7 - 197 1 0.0 Upper Reflector 1, Segment 8 - 198 1 0.0 Upper Reflector 1, Segment 9 - 199 1 0.0 Upper Reflector 1, Segment 10 - 200 1 0.0 Upper Reflector 1, Segment 11 - 201 1 0.0 Upper Reflector 1, Segment 12 -# - -1 \ No newline at end of file diff --git a/src/watts_ui/examples/1App_SAS_MultiTemplates_SodiumLoop/FuelCladding b/src/watts_ui/examples/1App_SAS_MultiTemplates_SodiumLoop/FuelCladding deleted file mode 100644 index 3bac0192..00000000 --- a/src/watts_ui/examples/1App_SAS_MultiTemplates_SodiumLoop/FuelCladding +++ /dev/null @@ -1,128 +0,0 @@ -#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 -#=============================================================================== -# -# ####### # # ####### # # # # ###### -# # # # # # # # ## # # # -# # # # # # # # # # # # # -# ##### # # ##### # # # # # # # # -# # # # # # ####### # # # # # -# # # # # # # # # ## # # -# # ##### ####### ####### # # # # ###### -# -# ##### # # ###### ###### ### # # ##### -# # # # # # # # # # # ## # # # -# # # # # # # # # # # # # # -# # # # # # # # # # # # # # #### -# # # ####### # # # # # # # # # # -# # # # # # # # # # # # ## # # -# ##### ####### # # ###### ###### ### # # ##### -# -#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 -INPCOM 1 1 1 -# -# IDBUG0: 3 for steady-state coolant debug prints -# | -# 2 1 2 -# -# IFUEL1: Number of Fuel Types -# | ICLAD1: Number of Cladding Types -# | | - 3 2 1 1 -# - -1 -#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 -PMATCM 13 1 1 -# -# TR: Reference Design Temperature -# | - 419 1 300.00 -# -# FGMM: Molecular Weight of Fission Gas -# | - 600 1 131.0 -# - -1 -#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 -# -# FUEL TYPE: Metal Fuel With Gap -# -#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 -PMATCM 13 1 1 -# -# RHOTAB(L,IFUEL): Theoretical Fuel Density (kg/m^3) -# | - 91 1 2.0E+04 -# -# XKTAB(L,IFUEL): Fuel Thermal Conductivity (W/m-K) -# | | - 420 2 10.0 22.0 -# -# XKTEM(L): Temperature for XKTAB -# | | - 580 2 300.0 1500.0 -# -#------------------------------------------------------------ -# -# CPFTAB(L,IFUEL): Fuel Specific Heat (J/kg-K) -# | | - 606 2 250.0 250.0 -# -# CPFTEM(L): Temperatures for CPFTAB -# | | - 766 2 300.0 3000.0 -# -#------------------------------------------------------------ -# -# TFSOL(IFUEL): Fuel Solidus Temperature (K) -# | - 786 1 1283.0 -# -# TFLIQ(IFUEL): Fuel Liquidus Temperature (K) -# | - 794 1 1293.0 -# -# UFMELT(IFUEL): Fuel Heat of Fusion (J/kg) -# | - 802 1 3.0E+05 -# - -1 -#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 -# -# CLADDING PROPERTIES -# -#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 -PMATCM 13 1 1 -# -# EXKTB(L,ICLAD): Thermal Conductivity of Cladding at -# | | Temperature L for Cladding Type ICLAD - 11 2 11.0 38.0 -# -# EXKTM(L): Temperatures for EXKTB -# | | - 71 2 300.0 1200.0 -# -# TESOL(ICLAD): Cladding Solidus Temperature -# | - 810 1 1293.0 -# -# TELIQ(ICLAD): Cladding Liquidus Temperature -# | - 813 1 1283.0 -# -# UEMELT(ICLAD): Cladding Heat of Fusion -# | - 816 1 3.0E+05 -# -# CPCTAB(L,ICLAD): Cladding Specific Heat -# | | - 819 2 500.0 500.0 -# -# CPCTEM(L,ICLAD): Temperatures for CPCTAB -# | | - 879 2 300.0 1200.0 -# -# CROETB(L,ICLAD): Specific Heat x Density for Cladding -# | - 990 1 4.0E+06 -# - -1 \ No newline at end of file diff --git a/src/watts_ui/examples/1App_SAS_MultiTemplates_SodiumLoop/PRIMAR4 b/src/watts_ui/examples/1App_SAS_MultiTemplates_SodiumLoop/PRIMAR4 deleted file mode 100644 index e5e4e59c..00000000 --- a/src/watts_ui/examples/1App_SAS_MultiTemplates_SodiumLoop/PRIMAR4 +++ /dev/null @@ -1,423 +0,0 @@ - - - -#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 -# -# ###### ###### # # # # ###### # # -# # # # # # ## ## # # # # # # -# # # # # # # # # # # # # # # # -# ###### ###### # # # # # # # ###### ### ####### -# # # # # # # # ####### # # # -# # # # # # # # # # # # -# # # # # # # # # # # # -# -# # # ##### ##### ###### # -# ## ## # # # # # # -# # # # # # # # # # # -# # # # # # # # # ##### # -# # # # # # # # # # -# # # # # # # # # -# # # ##### ##### ###### ####### -# -#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 -# -INPCOM 1 1 1 -# -# IPRION: 4 triggers PRIMAR-4 option -# | - 27 1 4 - -1 -# -#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 -# -INPMR4 3 0 0 - -1 -# -PMR4IN 18 0 0 - -1 -# -#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 -# -INPMR4 3 1 0 -# -# NCVP: # Compressible Volumes, Primary Loop -# | NCVS: # Compressible Volumes, Secondary Loop -# | | NCVD: # CV in DRACS Loop -# | | | NSEGLP: # Liquid Segments, Primary Loop -# | | | | NSEGLP: # Liquid Segments, Secondary Loop -# | | | | | - 1 5 4 0 0 4 0 -# -# NELEMT: Total # of Liquid Flow Elements -# | - 10 1 7 -# -# ITYPCV: Compressible Volume Type -# 1 = Inlet Plenum -# 4 = Almost incompressible liquid, no gas -# 7 = Outlet plenum with cover gas -# 8 = Pool with Cover Gas -# -# Lower end of the inlet Tee -# | Between the reducer and the expansion joint -# | | Tee before flow meter -# | | | Pressurizer tank -# | | | | - 11 4 1 4 4 8 -# -# ITYPEL: Liquid Flow Element Type -# 1 = Core Subassemblies -# 2 = Bypass Channel -# 3 = Pipe -# 5 = Pump Impeller -# 6 = IHX, Shell Side -# 11 = Valve -# -# Core Pipe IHX Pipe Pump Pipe Pipe -# | | | | | | | - 49 7 1 3 6 3 5 3 3 -# -# JCVL: Compressible Volumes at ends of Liquid Segments -# in out -# | | - 189 2 1 2 # Segment 1: inlet tee (CV1) ~ reducer top (CV2) - 191 2 2 3 # Segment 2: reducer top (CV2) ~ tee before FM (CV3) - 193 2 3 1 # Segment 3: tee before FM (CV3) ~ inlet tee (CV1) - 195 2 3 4 # Segment 4: tee before FM (CV3) ~ tank (CV4) -# -# NELML: # of Elements in Liquid Segment -# | | | | - 325 4 1 3 3 1 -# -# JFSELL: First Element # in Segments -# | | | | - 365 4 1 2 5 7 -# -# NPUMP: # of Water Pumps -# | IELPMP: Element # of Pump -# | | - 405 2 1 5 -# -# IEMPMP: Type of Pump (IEMPMP = 2 for Homologous Pump Model) -# | (IEMPMP = 0 for table of head vs time) - 418 1 0 -# -# ILRPMP: Pump Operation Option -# | - 430 1 0 -# -# NIHX: Number of Intermediate Heat Exchangers -# | - 470 1 1 -# -# IELIHX: Element index of IHX in primary loop -# | - 473 1 3 -# -# IHXCLC: IHX Detailed or Simple model option -# | (0 = Use Detailed Model) -# | (1 = Use Simple Model) - 489 1 -1 # Negative for outlet temperature vs time -# -# IPRADJ: Inlet/Outlet Plena Pressure Adjustment Option -# | - 497 1 1 -# -# NTGPT: # of Temperature Groups -# | - 512 1 5 -# -# NTNODE: # of Nodes in the Temperature Group. -# 2 nodes for tabular IHX. -# | | | | | - 513 5 20 2 20 20 20 -# -# IFSTEL: First Element in Temperature Group -# | | | | | - 613 5 2 3 4 5 7 -# -# ILSTEL: Last Element in Temperature Group -# | | | | | - 713 5 2 3 4 6 7 -# -# ISSIHX: Steady-state IHX temperature drop, if 1, user specifies -# | - 1155 1 0 -# -# ISSPMP: Steady-state pump head, if 1, user specifies -# | - 1159 1 0 -# -# IPIPTM: Pipe Temp Convection Differencing Approx. (Recommended = 2) -# | Multiple Inlet/Outlet Plenum Option -# | | - 1310 2 2 0 -# -#################################### -# Binary output setting for PRIMAR-4 -#################################### -# -# IP4PRT: How many PRIMAR steps to print PRIMAR-4 results -# | NBINOT: # of IBINOT entries for PRIMAR-4.dat -# | | IBINST: Output every IBINST steps to PRIMAR-4.dat -# | | | - 890 3 2000 16 200 -# -# IBINOT: Identification of output entries -# | see Manual Table A2.2-1 -# |||||| - 893 1240001 # Temperature of CV1 (inlet plenum) - 894 1240002 # Temperature of CV2 (outlet plenum) - 895 1240003 # Temperature of CV3 (tee to tank) - 896 1240004 # Temperature of CV4 (tank) - 897 1300003 # IHX Inlet Temperature (IELL=3) - 898 1300403 # IHX Outlet Temperature (IELL=3) - 899 1010001 # Flow Rate of S1 (core) - 900 1010002 # Flow Rate of S2 (core to tee) - 901 1010003 # Flow Rate of S3 (tee to core) - 902 1010004 # Flow Rate of S4 (tee to tank) - 903 1170004 # Gas Pressure of CV4 (tank) - 904 1160001 # Liquid Pressure of CV1 (inlet plenum) - 905 1160002 # Liquid Pressure of CV2 (outlet plenum) - 906 1160003 # Liquid Pressure of CV3 (tee to tank) - 907 1160004 # Liquid Pressure of CV4 (tank) - 908 1180001 # Pump Head -# - -1 -# -#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 -# -PMR4IN 18 1 0 -# -#################################### -# Liquid Segment Setting -#################################### -# -# FLOSSL: Initial flow rate in liquid flow segments. Important for convergence. -# | | | | - 2 4 0.8 0.8 0.8 1.0E-12 -# -# ZINL: Height of inlet to the liquid segment -# | | | | - 42 4 -0.500 5.000 -0.500 -0.500 -# -# CVLMLT: Multiplicity Factors at Liquid Segment Ends -# | | | | - 82 4 1.0 1.0 1.0 1.0 - 86 4 1.0 1.0 1.0 1.0 -# -#################################### -# Liquid Element Setting -#################################### -# -# ZOUTEL: Height at Outlet of the liquid element -# | | | | | - 162 5 5.000 5.500 5.000 -0.500 -0.500 - 167 2 -0.500 0.5270 -# -# XLENEL: Liquid element length (Pump:5) -# | | | | | - 302 5 5.500 2.500 0.500 5.500 0.0001 - 307 2 2.000 10.000 -# -# AREAEL: Cross-sectional flow area of liquid elements -# | | | | | - 442 5 8.5507E-04 2.1649E-03 1.0459E-02 2.1649E-03 1.3134E-03 - 447 2 1.3134E-03 9.3691E-05 -# -# DHELEM: Hydraulic Diameter of liquid elements -# | | | | | - 582 5 1.9050E-02 5.2501E-02 1.0255E-02 5.2501E-02 4.0894E-02 - 587 2 4.0894E-02 1.0922E-02 -# -# ROUGHl: Pipe Surface Roughness -# | | | | | - 722 5 2.0E-05 2.0E-05 2.0E-05 2.0E-05 2.0E-05 - 727 2 2.0E-05 2.0E-05 -# -# BENDNM: Number of Bends in Each Liquid Element -# | | | | | - 862 5 0.0 1.0 0.0 0.0 0.0 - 867 2 0.0 0.0 -# -################## -# -# G2PRDR: Initial Orifice Coefficient, normally 0 as input -# | | | | | - 1002 5 0.0 0.0 100.0 0.0 0.0 - 1007 2 0.0 0.0 -# -# BNDLOD: Effective L/D per bend -# | - 1142 1 11.52 -# -# WALLMC: Pipe wall mass times heat capacity/length -# | | | | | - 1143 5 1.0 1.0 1.0 1.0 1.0 - 1148 2 1.0 1.0 -# -# WALLH: Pipe wall heat transfer coefficient -# | | | | | - 1283 5 1.0 1.0 1.0 1.0 1.0 - 1288 2 1.0 1.0 -# -#################################### -# Compressible Volume Setting -#################################### -# -# VOLLGC: Total Volume of Compressible Volumes -# | | | | - 1423 4 2.981E-04 8.798E-04 1.021E-03 1.392 - -# VOLSG0: Initial Gas Volume -# | | | | - 3612 4 0.0 0.0 0.0 0.405 -# -# PRESG0: Initial Gas Pressure in CV -# | | | | - 1461 4 0.0 0.0 0.0 200000.0 -# -# ALPHAP: CV volume pressure expansion coefficient -# | | | | - 1499 4 1.0E-08 1.0E-08 1.0E-08 0 - -# ALPHAT: CV volume thermal expansion coefficient -# | | | | - 1537 4 2.0E-05 2.0E-05 2.0E-05 2.0E-05 -# -# BTAPNA: Water isothermal compressibility for the CV -# | | | | - 2464 4 2.0E-10 2.0E-10 2.0E-10 2.0E-10 -# -# BTATNA: Water thermal expansion coefficient for the CV -# | | | | - 2502 4 3.0E-04 3.0E-04 3.0E-04 3.0E-04 -# -# ZCVL: CV reference height for liquid pressure -# | | | | - 1575 4 -0.500 5.000 -0.500 0.527 -# -# AREAIN: Liquid-Gas Interface Area in CV (1.0 if no gas) -# | | | | - 1613 4 1.0 1.0 1.0 0.800 -# -# TREFCV: Steady-state gas temperature in CV -# | Input as 0.0 to use liquid temperature -# | | | | - 1651 4 0.0 0.0 0.0 0.0 -# -# HWALL: Wall-coolant heat-transfer coefficient for CV at reference temperature -# | | | | - 2578 4 1.0 1.0 1.0 1.0 -# -# AWALL: Wall surface area -# Modeled as a 8.938" long 1.5" Sch. 40 pipe -# | Modeled as a 16" long 2" Sch. 40 pipe -# | | Modeled as a 13" long 2.5" Sch. 40 pipe -# | | | Modeled as a 37" I.D. 79" tall cylinder -# | | | | - 2616 4 0.0292 0.0670 0.0651 4.1097 -# -# CMWALL: CV Wall mass times specific heat -# | | | | - 2654 4 1.0 1.0 1.0 1.0 -# -#################################### -# Cover Gas Data -#################################### -# -# Values given are for nitrogen gas at 100C -# -# GAMGSC: Cp/Cv for cover gas -# | - 1689 1 1.40 -# -# RGASC: Gas constant for cover gas. -# | - 1690 1 296.80 -# -# U0CVGS: Cover gas viscosity -# | - 1691 1 2.12E-05 -# -# TRFU: Gas viscosity reference temperature -# | - 1692 1 373.15 -# -# TAUGAS: Cover-gas temperature time constant. -# | | | | - 1861 4 1.0 1.0 1.0 2.0 -# -#################################### -# Simple Pump Setting -#################################### -# -# APMPHD: Value Table of Relative Pump Head (-) -# | | | | - 1983 4 1.0 1.0 1.0 1.0 - 1987 4 1.0 1.0 1.0 1.0 -# -# AMOTTK: Time Table of Relative Pump Head (s) -# | | - 2223 2 0.0 100 -# -# GRAVTY: Acceleration due to gravity -# | - 2463 1 9.80665 -# -#################################### -# Simple IHX Model Setting -#################################### -# -# DTMPTB: Table of exit temperature for IHX -# | | | | - 2937 4 600.00 600.00 600.00 600.00 -# -# ZCENTR: Height of thermal center for IHX -# | | | | - 3105 4 5.250 5.250 5.250 5.250 -# -# TMPMTB: Times for DTMPTB and ZCENTR -# | | | | - 3273 4 0.0 10.0 20.0 10000.0 -# -# C1PIPE, C2PIPE, C3PIPE: Conductance coefficient for pipe, recommended values -# | | | - 3650 3 0.025 0.8 4.80 -# -# EPSF: Maximum fractional change in liquid segment flow rate per time step -# | EPSFC: Maximum fractional change in core inlet flow rate -# | | per time step - 4282 2 0.2 0.1 -# -# DTIHX: Steady-state temperature drop across IHX -# | (Used only if ISSIHX > 0) -# 4284 1 1.0 -# -#################################### -# -# TPLCV: Temperature of CV. Entered only for inlet plena -# | - 4685 1 600.00 -# -# PPLCV: CV pressure for outlet plena only -# | - 4724 1 200000.0 -# -# ZPLENC: CV reference elevation for plena only -# | | - 4761 2 -0.500 5.000 -# - -1 -#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 -INPCOM 1 1 1 -# -# KPROPI: > 0 to input correlation coefficients in APROPI -# | This is probably reset by ICLPRP - 114 1 1 -# -# ICLPRP: 1 for Sodium (SAS4A version) -# | - 118 1 1 -# - -1 \ No newline at end of file diff --git a/src/watts_ui/examples/1App_SAS_MultiTemplates_SodiumLoop/PointKinetics b/src/watts_ui/examples/1App_SAS_MultiTemplates_SodiumLoop/PointKinetics deleted file mode 100644 index d818f22c..00000000 --- a/src/watts_ui/examples/1App_SAS_MultiTemplates_SodiumLoop/PointKinetics +++ /dev/null @@ -1,85 +0,0 @@ - - - - - - - - -#=============================================================================== -# -# ###### ####### ### # # ####### -# # # # # # ## # # -# # # # # # # # # # -# ###### # # # # # # # -# # # # # # # # # -# # # # # # ## # -# # ####### ### # # # -# -# # # ### # # ####### ####### ### ##### ##### -# # # # ## # # # # # # # # -# # # # # # # # # # # # -# ### # # # # ##### # # # ##### -# # # # # # # # # # # # -# # # # # ## # # # # # # # -# # # ### # # ####### # ### ##### ##### -# -#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 -INPCOM 1 1 1 -# -# NDELAY: Number of Delayed Neutron Precursor Families -# | - 16 1 6 -# - -1 -#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 -POWINA 12 1 1 -# -# GENTIM: Prompt Neutron Lifetime -# | - 2 1 2.0E-07 -# -# BETADN(L): Effective Delayed Neutron Fract. for Family L -# | - 4 1 0.0002 - 5 1 0.001 - 6 1 0.0012 - 7 1 0.0025 - 8 1 0.0015 - 9 1 0.0005 - -# -# DECCON(L): Decay Constant for Precursor Family L -# | - 10 1 1.0E-02 - 11 1 3.0E-02 - 12 1 1.0E-01 - 13 1 3.0E-01 - 14 1 8.0E-01 - 15 1 3.0E+00 -# - -1 -#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 -INPCOM 1 1 1 -# -# IPOWER: 0/1 = Reactivity/Power vs Time from PREA -# | - 8 1 0 -# -# NPREAT: Number of Entries in PREA vs. Time Table -# | (Power or Reactivity vs Time) - 18 1 2 -# - -1 -#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 -POWINA 12 1 1 -# -# PREATB: Transient power table used by PREA -# | | | | | - 29 2 0.0 0.0 -# -# PREATM: Times for PREATB -# | | - 49 2 0.0 10000.0 -# - -1 \ No newline at end of file diff --git a/src/watts_ui/examples/1App_SAS_MultiTemplates_SodiumLoop/Primary b/src/watts_ui/examples/1App_SAS_MultiTemplates_SodiumLoop/Primary deleted file mode 100644 index 2abbf27f..00000000 --- a/src/watts_ui/examples/1App_SAS_MultiTemplates_SodiumLoop/Primary +++ /dev/null @@ -1,62 +0,0 @@ -#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 -#=============================================================================== -# -# ###### ###### ### # # # ###### -# # # # # # ## ## # # # # -# # # # # # # # # # # # # # -# ###### ###### # # # # # # ###### -# # # # # # # ####### # # -# # # # # # # # # # # -# # # # ### # # # # # # -# -#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 -INPCOM 1 1 1 -# -# NPRES: Coolant driving pressure option -# | Negative value for # of entries in table -# | of normalized flow rate vs. time. - 19 1 -1 -# -# NT0TAB: Number of entries in T0TAB vs. T0TME table of -# | coolant inlet temperature vs. time. - 22 1 1 -# -# IPRION: PRIMAR-4 Option Flag -# | - 27 1 0 -# - -1 -#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 -# -# OPCIN: Channel Independent Variables (Floating Point) -# Time Steps and Convergence Criteria Data -# -OPCIN 11 1 1 -# -# DTP0: Initial PRIMAR Time Step Size -# | DTPMAX: Maximum PRIMAR Time Step Size Before -# | | Boiling Starts - 13 2 0.05 0.05 -# - -1 -#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 -PRIMIN 14 0 0 -# -# PX: Coolant Exit Pressure at ZPLENU -# | - 1 1 200000.0 -# -# PRETAB: Normalized inlet coolant driving pressure or -# | coolant flow rate at times listed in PRETME -# | - 5 1 1.0 -# -# T0TAB(L): Inlet Temperature at Time T0TME(L) -# | - 45 1 600.00 -# -# ZPLENL/ZPLENU: Inlet/Outlet Plenum Reference Elevation -# | | - 87 2 -0.500 5.000 -# - -1 \ No newline at end of file diff --git a/src/watts_ui/examples/1App_SAS_MultiTemplates_SodiumLoop/README.md b/src/watts_ui/examples/1App_SAS_MultiTemplates_SodiumLoop/README.md deleted file mode 100644 index a32ff8d7..00000000 --- a/src/watts_ui/examples/1App_SAS_MultiTemplates_SodiumLoop/README.md +++ /dev/null @@ -1,27 +0,0 @@ -# MultiTemplates_SAS_SodiumLoop - -## Purpose - -This example provides a demonstration on how to use WATTS to perform a simulation with multiple input files. This example utilizes SAS for demonstration. - -## Code(s) - -- SAS -- CHANNEL module -- PRIMAR4 module - -## Keywords - -- SAS INCLUDE directive -- Multiple input files - -## File descriptions - -- [__watts_exec.py__](watts_exec.py): This is the file to run the problem described above. -- [__sas_template__](sas_template): Main templated SAS input file. -- [__Channel__](Channel): Extra templated SAS input. -- [__DecayPower__](DecayPower): Extra templated SAS input. -- [__FuelCladding__](FuelCladding): Extra templated SAS input. -- [__PointKinetics__](PointKinetics): Extra templated SAS input. -- [__PRIMAR4__](PRIMAR4): Extra templated SAS input. -- [__Primary__](Primary): Extra templated SAS input. diff --git a/src/watts_ui/examples/1App_SAS_MultiTemplates_SodiumLoop/sas_template b/src/watts_ui/examples/1App_SAS_MultiTemplates_SodiumLoop/sas_template deleted file mode 100644 index b5168f34..00000000 --- a/src/watts_ui/examples/1App_SAS_MultiTemplates_SodiumLoop/sas_template +++ /dev/null @@ -1,199 +0,0 @@ - -{#- - Create variables -#} -{# set sas_version = 5.5 #} -{# set tmax = 1000 s #} -{# set total_reactor_power = 20 kW #} -{#- - Render the parameters -#} - -#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 -# Version - Simple salt loop {{ sas_version }} -#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 -# -# STORAGE ALLOCATION RECORDS -# -# NCH: Number of Channels -# | NEUTSP: Neutronics Storage Allocation Flag -# | | IDBUGP: Data Management Print Flag -# | | | IPDECK: Input Data Editing Flag -# | | | | NBYSSH: Number of Bypass Channels in SA-to-SA Heat Transfer -# | | | | | IDATMO: Data Management Option Flag (0/1=Default/Extended) -# | | | | | | IADEFC: Data Pack DEFC Storage Allocation Flag -# | | | | | | | IAPLUC: Data Pack PLUC Storage Allocation Flag -# | | | | | | | | IACNTL: Control System Module Storage Allocation Flag -# | | | | | | | | | IALBOP: BOP Module Storage Allocation Flag -# | | | | | | | | | | - 1 0 0 0 0 1 1 1 1 1 -# -#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 -# -# INPCOM: Channel Independent Variables (Integer) -# -INPCOM 1 0 0 -# -# ICLCMP: Flag to Save Plot Data for Transients to Unit 11 -# | - 24 1 1 -# - -1 -#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 -# -# OPCIN: Channel Independent Variables (Floating Point) -# Time Steps and Convergence Criteria Data -# -OPCIN 11 0 0 -# -# EPSTEM: Steady-State Temperature Convergence -# | - 1 1 1.0E-03 -# -# EPSPOW: Neutron Flux Amplitude Convergence -# | - 3 1 1.0D-05 -# -# DT0: Initial and Max Main Time Step Size -# | - 5 1 0.05 -# -# DTFUEL: Max Fuel Temp Change per Heat-Transfer Time Step -# | DTCLAD: Max Clad Temp Change per HT Time Step -# | | - 10 2 5.0 30.0 -# - -1 -#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 -#=============================================================================== -# -# ##### ####### ###### ####### -# # # # # # # # -# # # # # # # -# # # # ###### ##### -# # # # # # # -# # # # # # # # -# ##### ####### # # ####### -# -# ###### ####### # # ####### ###### -# # # # # # # # # # # -# # # # # # # # # # # -# ###### # # # # # ##### ###### -# # # # # # # # # # -# # # # # # # # # # -# # ####### ## ## ####### # # -# -#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 -POWINA 12 1 1 -# -# POWTOT: Total Reactor Power (Watts) -# | - 3 1 {{ total_reactor_power }} # reactor power -# -# FRPR: Fraction of Total Power Represented by All Channels -# | FRFLOW: Fraction of Total Flow Represented -# | | by All SAS4A Channels - 69 2 1.0 1.0 -# - -1 -#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 - -INCLUDE "FuelCladding" -INCLUDE "Channel" -INCLUDE "Primary" -INCLUDE "PRIMAR4" -INCLUDE "DecayPower" -INCLUDE "PointKinetics" - -#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 -#=============================================================================== -# -# ####### ### # # ####### ##### ####### ####### ###### -# # # ## ## # # # # # # # -# # # # # # # # # # # # # -# # # # # # ##### ##### # ##### ###### -# # # # # # # # # # -# # # # # # # # # # # -# # ### # # ####### ##### # ####### # -# -#=============================================================================== -INPCOM 1 1 1 -# -# IPOWER: 0/1 = Reactivity/Power vs Time from PREA -# | - 8 1 1 -# -# MAXSTP: Maxiumum Number of Main (Power and Reactivity) -# | Time Steps - 11 1 99999 -# -# IPO: Number of Steps between Prints before IBLPRT or Boiling -# | IPOBOI: Number of Steps between Prints after IBLPRT or Boiling -# | | - 12 2 200 200 -# -# NPREAT: Number of Entries in PREA vs. Time Table -# | (Power or Reactivity vs Time) - 18 1 4 -# -# NOREAC: Main Time Step Intevals between PSHORT Print -# | - 41 1 200 -# -# IFIT(K): Input Table Lookup Options (K=1: Power/Reac vs. Time) -# | (0=Linear Fit) - 95 1 0 -# - -1 -#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 -POWINA 12 1 1 -# -# PREATB: Transient power table used by PREA -# | | | | - 29 4 1.0 1.0 1.0 1.0 -# -# PREATM: Times for PREATB -# | | | | - 49 4 0.0 10.0 20.0 10000.0 -# - -1 -#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 -OPCIN 11 1 1 -# -# DTMXB: Max heat transfer time-step after coolant boiling inception -# | - 6 1 0.01 -# -# TIMAX: Maximum Problem Time (s) -# | - 7 1 {{ tmax }} -# -# TCOSTP: # of CPU seconds reserved at end of run for writing restart files -# | - 9 1 15.0 -# -# DTPBOI: Max PRIMAR step size after start of boiling -# | - 15 1 0.01 -# -# DPINMX: Max change in inlet pressure per PRIMAR step -# | DTINMX: Max change in inlet temp per PRIMAR step -# | | DTMMXB: Max main time step after onset of boiling -# | | | - 19 3 1.0E+04 0.5 0.5 -# -# DTMIN: Time Step Sizes vs. Time -# | | - 95 2 0.05 0.05 -# -# TDTMIN: Time for Time Step Sizes -# | | - 105 2 0.0 10000.0 -# - -1 -#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 -# -######## ####### ####### ####### ####### ####### ####### ####### ####### ####### -ENDJOB -1 -######## ####### ####### ####### ####### ####### ####### ####### ####### ####### \ No newline at end of file diff --git a/src/watts_ui/examples/1App_SAS_MultiTemplates_SodiumLoop/watts_comprehensive.son b/src/watts_ui/examples/1App_SAS_MultiTemplates_SodiumLoop/watts_comprehensive.son deleted file mode 100644 index 4418f300..00000000 --- a/src/watts_ui/examples/1App_SAS_MultiTemplates_SodiumLoop/watts_comprehensive.son +++ /dev/null @@ -1,38 +0,0 @@ -watts{ - % Change the working directory to the directory where the input files are stored. This is necessary - % due to how WATTS copies input files to the temporary working directory. - workflow_dir = "/Users/zhieejhiaooi/Documents/ANL/watts-devel/watts/src/watts_ui/examples/1App_SAS_MultiTemplates_SodiumLoop" - - plugins{ - plugin(ID1){ - code = "sas" - template = "sas_template" - exec_dir = "SAS_DIR" - show_stderr = False - show_stdout = False - extra_template_inputs=["Primary", "FuelCladding", "Channel", "DecayPower", "PointKinetics", "PRIMAR4"] - % conv_channel = "path\to\CHANNELtoCSV.x" % Assumed to be in the same dir as the SAS executable if not provided - % conv_primar4 = "path\to\PRIMAR4toCSV.x" % Assumed to be in the same dir as the SAS executable if not provided - } - } - - workflow_level1{ - plugin = ID1 - variables{ - param(sas_version) {value = 5.5} - param(tmax) {value = 1000.0} - param(flow_per_pin) {value = 0.15} - param(total_reactor_power) {value = 20.0 unit = kW} - param(betai_1) {value = 2.0E-04} %Effective delayed neutron fraction - param(betai_2) {value = 1.0E-03} - param(betai_3) {value = 1.2E-03} - param(betai_4) {value = 2.5E-03} - param(betai_5) {value = 1.5E-03} - param(betai_6) {value = 5.0E-04} - param(fuel_axial_exp_coeff) {value = 2.0E-05} - param(clad_axial_exp_coeff) {value = 1.4E-05} - param(outlet_pressure) {value = 200000.0} - } - } - -} \ No newline at end of file diff --git a/src/watts_ui/examples/1App_SAS_MultiTemplates_SodiumLoop/watts_exec.py b/src/watts_ui/examples/1App_SAS_MultiTemplates_SodiumLoop/watts_exec.py deleted file mode 100644 index 337726f4..00000000 --- a/src/watts_ui/examples/1App_SAS_MultiTemplates_SodiumLoop/watts_exec.py +++ /dev/null @@ -1,57 +0,0 @@ -# SPDX-FileCopyrightText: 2022 UChicago Argonne, LLC -# SPDX-License-Identifier: MIT - -""" -Example problem of runing SAS4A/SASSY-1 with WATTS using the -SAS 'INCLUDE' directive that allows for multiple input files. -This example uses the same sodium loop model as in -example '1App_SAS_SodiumLoop'. For details on the loop, -please refer to the input file of '1App_SAS_SodiumLoop'. -In this example, the SAS input file is broken into several -input files, namely 'Channel', 'DecayPower', 'FuelCladding', -'PointKinetics', 'PRIMAR4', and 'Primary', and the main -input file is known as 'sas_template'. The values of any -parameters in the extra input files can be input/changed -using the same approach as the parameters in the main input -file. To include the input files to the simulation, users -need to add 'INCLUDE "Extra_file_name"' in the main input file. -""" - -from math import cos, pi -import os -import watts -from astropy.units import Quantity - - -params = watts.Parameters() - -# Channel params -params['sas_version'] = 5.5 -params['tmax'] = 1000.0 # maximum problem time in s -params['flow_per_pin'] = 0.15 # kg/s -params['total_reactor_power'] = Quantity(20, "kW") -params['betai_1'] = 2.0E-04 # Effective delayed neutron fraction -params['betai_2'] = 1.0E-03 -params['betai_3'] = 1.2E-03 -params['betai_4'] = 2.5E-03 -params['betai_5'] = 1.5E-03 -params['betai_6'] = 5.0E-04 -params['fuel_axial_exp_coeff'] = 2.0E-05 # Fuel axial expansion coefficient -params['clad_axial_exp_coeff'] = 1.4E-05 # Clad axial expansion coefficient -params['outlet_pressure'] = 200000.0 # Outlet plenum pressure - -params.show_summary(show_metadata=False, sort_by='key') - -# SAS Workflow -# template_file: Main input file -# extra_template_inputs: Additional templated input files -sas_plugin = watts.PluginSAS( - template_file='sas_template', - extra_template_inputs=['Primary', 'FuelCladding', 'Channel', 'DecayPower', 'PointKinetics', 'PRIMAR4'] - ) - -sas_result = sas_plugin(params) -for key in sas_result.csv_data: - print(key, sas_result.csv_data[key]) -print(sas_result.inputs) -print(sas_result.outputs) diff --git a/src/watts_ui/examples/1App_SAS_SodiumLoop/README.md b/src/watts_ui/examples/1App_SAS_SodiumLoop/README.md deleted file mode 100644 index aec1580b..00000000 --- a/src/watts_ui/examples/1App_SAS_SodiumLoop/README.md +++ /dev/null @@ -1,20 +0,0 @@ -# 1App_SAS_SodiumLoop - -## Purpose - -This example provides a demonstration on how to use WATTS for a simple SAS model. - -## Code(s) - -- SAS -- CHANNEL module -- PRIMAR4 module - -## Keywords - -- Sodium Loop - -## File descriptions - -- [__watts_exec.py__](watts_exec.py): This is the file to execute to run the problem described above. -- [__sas_template__](sas_template): Templated SAS input. diff --git a/src/watts_ui/examples/1App_SAS_SodiumLoop/sas_template b/src/watts_ui/examples/1App_SAS_SodiumLoop/sas_template deleted file mode 100644 index 327676bf..00000000 --- a/src/watts_ui/examples/1App_SAS_SodiumLoop/sas_template +++ /dev/null @@ -1,1397 +0,0 @@ - -{#- - Create variables -#} -{# set sas_version = 5.5 #} -{# set flow_per_pin = 0.15 kg/s #} -{# set tmax = 1000 s #} -{# set total_reactor_power = 20 kW #} -{# set betai_1 = 2.0E-04 #} -{# set betai_2 = 1.0E-03 #} -{# set betai_3 = 1.2E-03 #} -{# set betai_4 = 2.5E-03 #} -{# set betai_5 = 1.5E-03 #} -{# set betai_6 = 5.0E-04 #} -{#- - Render the parameters -#} - -#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 -# Version - Simple salt loop {{ sas_version }} -#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 -# -# STORAGE ALLOCATION RECORDS -# -# NCH: Number of Channels -# | NEUTSP: Neutronics Storage Allocation Flag -# | | IDBUGP: Data Management Print Flag -# | | | IPDECK: Input Data Editing Flag -# | | | | NBYSSH: Number of Bypass Channels in SA-to-SA Heat Transfer -# | | | | | IDATMO: Data Management Option Flag (0/1=Default/Extended) -# | | | | | | IADEFC: Data Pack DEFC Storage Allocation Flag -# | | | | | | | IAPLUC: Data Pack PLUC Storage Allocation Flag -# | | | | | | | | IACNTL: Control System Module Storage Allocation Flag -# | | | | | | | | | IALBOP: BOP Module Storage Allocation Flag -# | | | | | | | | | | - 1 0 0 0 0 1 1 1 1 1 -# -#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 -# -# INPCOM: Channel Independent Variables (Integer) -# -INPCOM 1 0 0 -# -# ICLCMP: Flag to Save Plot Data for Transients to Unit 11 -# | - 24 1 1 -# - -1 -#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 -# -# OPCIN: Channel Independent Variables (Floating Point) -# Time Steps and Convergence Criteria Data -# -OPCIN 11 0 0 -# -# EPSTEM: Steady-State Temperature Convergence -# | - 1 1 1.0E-03 -# -# EPSPOW: Neutron Flux Amplitude Convergence -# | - 3 1 1.0D-05 -# -# DT0: Initial and Max Main Time Step Size -# | - 5 1 0.05 -# -# DTFUEL: Max Fuel Temp Change per Heat-Transfer Time Step -# | DTCLAD: Max Clad Temp Change per HT Time Step -# | | - 10 2 5.0 30.0 -# - -1 -#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 -#=============================================================================== -# -# ##### ####### ###### ####### -# # # # # # # # -# # # # # # # -# # # # ###### ##### -# # # # # # # -# # # # # # # # -# ##### ####### # # ####### -# -# ###### ####### # # ####### ###### -# # # # # # # # # # # -# # # # # # # # # # # -# ###### # # # # # ##### ###### -# # # # # # # # # # -# # # # # # # # # # -# # ####### ## ## ####### # # -# -#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 -POWINA 12 1 1 -# -# POWTOT: Total Reactor Power (Watts) -# | - 3 1 {{ total_reactor_power }} # reactor power -# -# FRPR: Fraction of Total Power Represented by All Channels -# | FRFLOW: Fraction of Total Flow Represented -# | | by All SAS4A Channels - 69 2 1.0 1.0 -# - -1 -#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 -#=============================================================================== -# -# ####### # # ####### # # # # ###### -# # # # # # # # ## # # # -# # # # # # # # # # # # # -# ##### # # ##### # # # # # # # # -# # # # # # ####### # # # # # -# # # # # # # # # ## # # -# # ##### ####### ####### # # # # ###### -# -# ##### # # ###### ###### ### # # ##### -# # # # # # # # # # # ## # # # -# # # # # # # # # # # # # # -# # # # # # # # # # # # # # #### -# # # ####### # # # # # # # # # # -# # # # # # # # # # # # ## # # -# ##### ####### # # ###### ###### ### # # ##### -# -#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 -INPCOM 1 1 1 -# -# IDBUG0: 3 for steady-state coolant debug prints -# | -# 2 1 2 -# -# IFUEL1: Number of Fuel Types -# | ICLAD1: Number of Cladding Types -# | | - 3 2 1 1 -# - -1 -#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 -PMATCM 13 1 1 -# -# TR: Reference Design Temperature -# | - 419 1 300.00 -# -# FGMM: Molecular Weight of Fission Gas -# | - 600 1 131.00 -# - -1 -#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 -# -# FUEL TYPE: Metal Fuel With Gap -# -#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 -PMATCM 13 1 1 -# -# RHOTAB(L,IFUEL): Theoretical Fuel Density (kg/m^3) -# | - 91 1 2.0E+04 -# -# XKTAB(L,IFUEL): Fuel Thermal Conductivity (W/m-K) -# | | - 420 2 10.0 22.0 -# -# XKTEM(L): Temperature for XKTAB -# | | - 580 2 300.0 1500.0 -# -#------------------------------------------------------------ -# -# CPFTAB(L,IFUEL): Fuel Specific Heat (J/kg-K) -# | | - 606 2 250.0 250.0 -# -# CPFTEM(L): Temperatures for CPFTAB -# | | - 766 2 300.0 3000.0 -# -#------------------------------------------------------------ -# -# TFSOL(IFUEL): Fuel Solidus Temperature (K) -# | - 786 1 1283.0 -# -# TFLIQ(IFUEL): Fuel Liquidus Temperature (K) -# | - 794 1 1293.0 -# -# UFMELT(IFUEL): Fuel Heat of Fusion (J/kg) -# | - 802 1 3.0E+05 -# - -1 -#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 -# -# CLADDING PROPERTIES -# -#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 -PMATCM 13 1 1 -# -# EXKTB(L,ICLAD): Thermal Conductivity of Cladding at -# | | Temperature L for Cladding Type ICLAD - 11 2 11.0 38.0 -# -# EXKTM(L): Temperatures for EXKTB -# | | - 71 2 300.0 1200.0 -# -# TESOL(ICLAD): Cladding Solidus Temperature -# | - 810 1 1293.0 -# -# TELIQ(ICLAD): Cladding Liquidus Temperature -# | - 813 1 1283.0 -# -# UEMELT(ICLAD): Cladding Heat of Fusion -# | - 816 1 3.0E+05 -# -# CPCTAB(L,ICLAD): Cladding Specific Heat -# | | - 819 2 500.0 500.0 -# -# CPCTEM(L,ICLAD): Temperatures for CPCTAB -# | | - 879 2 300.0 1200.0 -# -# CROETB(L,ICLAD): Specific Heat x Density for Cladding -# | - 990 1 4.0E+06 -# - -1 -#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 -#=============================================================================== -# -# # # ####### ####### # # -# ## ## # # # # # -# # # # # # # # # # -# # # # ##### # # # # -# # # # # ####### # -# # # # # # # # -# # # ####### # # # ####### -# -# # ##### # ###### -# # # # # # # # -# # # # # # # -# ####### # #### # # ###### -# # # # ####### # -# # # # # # # -# # ##### # # # -# -#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 -INPCOM 1 1 1 -# -# NCHAN: Number of Channels -# | - 1 1 1 -# - -1 -#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 -# -# INPCHN: Channel-Dependent Input (Integer) -# -INPCHN 51 1 0 -# -# IDBUGV: 8 for coolant-cladding temperature calculations -# | -# 1 1 8 -# -# NPLN: Number of Segments in Gas Plenum -# | NREFB: Number of Reflector Zones below Pin -# | | NREFT: Number of Reflector Zones above Pin -# | | | (Note: Below + Above <= 6) - 4 3 2 1 1 -# -# NZNODE(KZ): Number of Segments in Zone KZ -# 0.0476m Unheated section in the inlet tee -# | 3m Heated section + 0.001 Fictitious Gas Plenum -# | | 1.975m Unheated annular before the expansion joint -# | | | - 7 3 2 22 12 -# -# NT: Number of Radial Temperature Nodes in Fuel -# | - 14 1 10 -# -# IFUELV: Table Number of Property Value for Driver Fuel -# | IFUELB: Table Number of Property Value for Blanket Fuel -# | | ICLADV: Table Number for Cladding -# | | | - 15 3 1 0 1 -# -# NGRDSP: Number of spacer grids in pin -# | - 18 1 0 -# -# NPIN: Number of Pins per Subassembly -# | NSUBAS: Number of Subassemblies in Channel -# | | - 25 2 1 1 -# -# IRHOK: 0 for tabular fuel thermo-physical properties -# | - 3 1 0 -# - -1 -#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 -# -# GEOMIN: Geometry Input for Channel (Floating Point) -# -GEOMIN 61 1 0 -# -# ACCZ(KZ): Coolant Flow Area per Fuel Pin in Zone KZ -# | | | - 1 3 8.551E-04 8.551E-04 8.551E-04 -# -# AXHI(J): Length of Axial Segment J in Core and Blanket -# | | | | | - 8 5 0.15 0.15 0.15 0.15 0.15 - 13 5 0.15 0.15 0.15 0.15 0.15 - 18 5 0.15 0.15 0.15 0.15 0.15 - 23 5 0.15 0.15 0.15 0.15 0.15 -# -# DHZ(KZ): Hydraulic Diameter for Zone KZ -# | | | - 32 3 1.905E-2 1.905E-2 1.905E-2 -# -# DSTIZ(KZ): Thickness of Inner Structure Node in Zone KZ -# | | | - 39 3 2.54E-03 2.54E-03 2.54E-03 -# -# DSTOZ(KZ): Thickness of Outer Structure Node in Zone KZ -# | | | - 46 3 2.54E-03 2.54E-03 2.54E-03 -# -# PLENL: Length of Fission-Gas Plenum -# | - 53 1 0.001 # Made small relative to the entire heated section -# -# RBR(J): Cladding Inner Radius for Axial Segment J -# | - 54 1 9.0E-03 -# -# RER(J): Cladding Outer Radius for Axial Segment J -# | - 78 1 9.525E-03 -# -# RBRPL: Cladding Inner Radius in Fission-Gas Plenum -# | - 102 1 9.0E-03 -# -# RERPL: Cladding Outer Radius in Fission-Gas Plenum -# | - 103 1 9.525E-03 -# -# RINFP(J): Fuel Inner Radius for Axial Segment J -# | - 104 1 0.0E+00 -# -# ROUTFP(J): Fuel Outer Radius for Axial Segment J -# | - 128 1 9.0E-03 -# -# ZONEL(KZ): Length of Zone KZ -# 0.0476m Unheated section in inlet tee -# | 3m Heated section + 0.001m Gas Plenum -# | | 1.975m unheated annulus -# | | | - 152 3 0.500 3.001 2.000 -# -# SRFSTZ(KZ): Structure Perimeter per Pin in Zone KZ -# | | | - 159 3 1.197E-01 1.197E-01 1.197E-01 -# -# AREAPC: Coolant Plus Pin Area per Pin in the Pin Section -# | - 166 1 1.14E-03 -# -# RBR0: Nominal Cladding Inner Radius -# | RER0: Nominal Cladding Outer Radius -# | | - 180 2 9.0E-03 9.525E-03 -# -# SER(KZ): Reflector Perimeter, Pin Perimeter in -# Plenum Region when KZ = KZPIN -# | | | - 182 3 5.9847E-02 5.9847E-02 5.9847E-02 -# -# DRFO(KZ): Thickness of Outer Reflector Node/Cladding -# | | | - 169 3 5.25E-04 5.25E-04 5.25E-04 -# -# DRFI(KZ): Thickness of Inner Reflector Node in Zone KZ -# | | | - 189 3 5.25E-04 5.25E-04 5.25E-04 -# - -1 -#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 -# -# POWINC: Channel-Dependent Power Input (Floating Point) -# -POWINC 62 1 0 -# -# GAMSS: Fraction of Power from Direct Heating of Structure -# | - 2 1 1.0E-10 -# -# GAMTNC: Fraction of Power from Direct Heating of Coolant -# | GAMTNE: Fraction of Heating in Cladding -# | | - 4 2 1.0E-10 1.0E-10 -# -# PSHAPE(J): Ratio of Pin Power in Axial Segment J to Peak. -# | | | | | - 6 5 1.0 1.0 1.0 1.0 1.0 - 11 5 1.0 1.0 1.0 1.0 1.0 - 16 5 1.0 1.0 1.0 1.0 1.0 - 21 5 1.0 1.0 1.0 1.0 1.0 -# -# PSHAPR(I): Radial Power Shape within Pin -# | | | | | - 30 5 1.0 1.0 1.0 1.0 1.0 - 35 5 1.0 1.0 1.0 1.0 1.0 -# -# PRSHAP: Ratio of Average Power per Subassembly to -# | Average Power Over All Subassemblies -# | - 256 1 1.0 -# - -1 -#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 -# -# PMATCH: Channel-Dependent Properties Input (Floating Point) -# -PMATCH 63 1 0 -# -# XKSTIZ(KZ): Inner Structure Thermal Conductivity for Zone KZ -# | | | - 11 3 15.868 15.868 15.868 # Typical value @ 100 C -# -# XKSTOZ(KZ): Outer Structure Thermal Conductivity for Zone KZ -# | | | - 18 3 15.868 15.868 15.868 # Typical value @ 100 C -# -# P0GAS: Initial Plenum Gas Pressure at Reference Temperature TR -# | - 27 1 1.0E+05 # Fictitious -# -# XKRF(KZ): Reflector Thermal Coductivity for Zone KZ -# | | | - 28 3 15.868 15.868 15.868 # Typical value @ 100 C -# -# DENSS: Density of Solid Cladding at Reference Temperature TR -# | - 35 1 8.0E+03 -# -# RHOCSI(KZ): Density x Heat Capacity for Inner Structure -# | | | - 37 3 3.9293E+06 3.9293E+06 3.9293E+06 -# -# RHOCSO(KZ): Density x Heat Capacity for Outer Structure -# | | | - 44 3 3.9293E+06 3.9293E+06 3.9293E+06 -# -# RHOCR(KZ): Density x Heat Capacity for Reflector -# | | | - 51 3 3.9293E+06 3.9293E+06 3.9293E+06 -# -# RHOCG: Density x Heat Capacity for Gas in Plenum -# | RG: Thermal Resistance of Plenum Gas -# | | - 58 2 1.0E+03 0.06 # Fictitious -# -# REFDEN: Theoretical density of metal fuel at reference temperature -# | - 72 1 8.0E+03 -# - -1 -#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 -# -PMATCH 63 1 1 -# -# HBMAX: Max value of bond conductance when a gap exists -# | HBMIN: Minimum value of bond conductance -# | | - 5 2 1.0E+06 1.0E+00 -# -# HBPAR: Gap conductance = HBPAR/gap -# | (Used only if location 2-4 are zero) -# | - 7 1 64.0 -# - -1 -#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 -# -# COOLIN: Channel-Dependent Coolant Input (Floating Point) -# -COOLIN 64 1 0 -# -# AFR, BFR: Liquid Slug Friction Factor Coefficients -# | | - 1 2 0.3322 -0.25 -# -# C1, C2, C3: Coefficients for Convection Heat-Transfer Coefficient -# | | | - 3 3 1.077 0.4 0.0 -# -# RELAM: Re Number for Switch between Turb. and Lam. -# | AFLAM: Laminar Friction Factor = AFLAM/Re -# | | - 7 2 2000.0 95.36 -# -# W0: Initial Coolant Flow Rate per Pin (kg/s) -# | - 47 1 {{ flow_per_pin }} -# -# XKORI(K,M): Orifice coefficients -# K=1,2,3; @ Bottom of Zone K -# K=4; @ Top of Subassembly -# M=1,2; For upward & downward flow -# | | - 48 2 1.55 0.0 - 50 2 0.0 0.0 - 52 2 0.0 0.0 - 54 2 0.0 0.0 -# -# XKORGD: Orifice coefficient for spacer grids in pin -# | - 64 1 0.0 -# -# DZIAB, DZIAT: Effective Coolant Inertial Term Below/Above -# | | Subassembly Inlet/Outlet - 65 2 318.31 318.31 -# -# THETA1, THETA2: 0.5 Normally, 0/1 Implicit Calculation -# | | - 67 2 0 1. -# -# DTLMAX: Max. Coolant Temp. Change per Coolant Time Step -# | - 69 1 15.0 -# -# DTCMIN: Min. Coolant Time Step Size before Boiling -# | - 171 1 1.0E-05 -# - -1 -#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 -#=============================================================================== -# -# ###### ###### ### # # # ###### -# # # # # # ## ## # # # # -# # # # # # # # # # # # # # -# ###### ###### # # # # # # ###### -# # # # # # # ####### # # -# # # # # # # # # # # -# # # # ### # # # # # # -# -#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 -INPCOM 1 1 1 -# -# NPRES: Coolant driving pressure option -# | Negative value for # of entries in table -# | of normalized flow rate vs. time. - 19 1 -1 -# -# NT0TAB: Number of entries in T0TAB vs. T0TME table of -# | coolant inlet temperature vs. time. - 22 1 1 -# -# IPRION: PRIMAR-4 Option Flag -# | - 27 1 0 -# - -1 -#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 -# -# OPCIN: Channel Independent Variables (Floating Point) -# Time Steps and Convergence Criteria Data -# -OPCIN 11 1 1 -# -# DTP0: Initial PRIMAR Time Step Size -# | DTPMAX: Maximum PRIMAR Time Step Size Before -# | | Boiling Starts - 13 2 0.05 0.05 -# - -1 -#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 -PRIMIN 14 0 0 -# -# PX: Coolant Exit Pressure at ZPLENU -# | - 1 1 200000.0 -# -# PRETAB: Normalized inlet coolant driving pressure or -# | coolant flow rate at times listed in PRETME -# | - 5 1 1.0 -# -# T0TAB(L): Inlet Temperature at Time T0TME(L) -# | - 45 1 600.00 -# -# ZPLENL/ZPLENU: Inlet/Outlet Plenum Reference Elevation -# | | - 87 2 -0.500 5.000 -# - -1 -#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 -#=============================================================================== -# -# ####### ### # # ####### ##### ####### ####### ###### -# # # ## ## # # # # # # # -# # # # # # # # # # # # # -# # # # # # ##### ##### # ##### ###### -# # # # # # # # # # -# # # # # # # # # # # -# # ### # # ####### ##### # ####### # -# -#=============================================================================== -INPCOM 1 1 1 -# -# IPOWER: 0/1 = Reactivity/Power vs Time from PREA -# | - 8 1 1 -# -# MAXSTP: Maxiumum Number of Main (Power and Reactivity) -# | Time Steps - 11 1 99999 -# -# IPO: Number of Steps between Prints before IBLPRT or Boiling -# | IPOBOI: Number of Steps between Prints after IBLPRT or Boiling -# | | - 12 2 200 200 -# -# NPREAT: Number of Entries in PREA vs. Time Table -# | (Power or Reactivity vs Time) - 18 1 4 -# -# NOREAC: Main Time Step Intevals between PSHORT Print -# | - 41 1 200 -# -# IFIT(K): Input Table Lookup Options (K=1: Power/Reac vs. Time) -# | (0=Linear Fit) - 95 1 0 -# - -1 -#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 -POWINA 12 1 1 -# -# PREATB: Transient power table used by PREA -# | | | | - 29 4 1.0 1.0 1.0 1.0 -# -# PREATM: Times for PREATB -# | | | | - 49 4 0.0 10.0 20.0 10000.0 -# - -1 -#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 -OPCIN 11 1 1 -# -# DTMXB: Max heat transfer time-step after coolant boiling inception -# | - 6 1 0.01 -# -# TIMAX: Maximum Problem Time (s) -# | - 7 1 {{ tmax }} -# -# TCOSTP: # of CPU seconds reserved at end of run for writing restart files -# | - 9 1 15.0 -# -# DTPBOI: Max PRIMAR step size after start of boiling -# | - 15 1 0.01 -# -# DPINMX: Max change in inlet pressure per PRIMAR step -# | DTINMX: Max change in inlet temp per PRIMAR step -# | | DTMMXB: Max main time step after onset of boiling -# | | | - 19 3 1.0E+04 0.5 0.5 -# -# DTMIN: Time Step Sizes vs. Time -# | | - 95 2 0.05 0.05 -# -# TDTMIN: Time for Time Step Sizes -# | | - 105 2 0.0 10000.0 -# - -1 - -#=============================================================================== -# -# ###### ####### ### # # ####### -# # # # # # ## # # -# # # # # # # # # # -# ###### # # # # # # # -# # # # # # # # # -# # # # # # ## # -# # ####### ### # # # -# -# # # ### # # ####### ####### ### ##### ##### -# # # # ## # # # # # # # # -# # # # # # # # # # # # -# ### # # # # ##### # # # ##### -# # # # # # # # # # # # -# # # # # ## # # # # # # # -# # # ### # # ####### # ### ##### ##### -# -#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 -INPCOM 1 1 1 -# -# NDELAY: Number of Delayed Neutron Precursor Families -# | - 16 1 6 -# - -1 -#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 -POWINA 12 1 1 -# -# GENTIM: Prompt Neutron Lifetime -# | - 2 1 2.0E-07 -# -# BETADN(L): Effective Delayed Neutron Fract. for Family L -# | - 4 1 {{ betai_1 }} - 5 1 {{ betai_2 }} - 6 1 {{ betai_3 }} - 7 1 {{ betai_4 }} - 8 1 {{ betai_5 }} - 9 1 {{ betai_6 }} -# -# DECCON(L): Decay Constant for Precursor Family L -# | - 10 1 1.0E-02 - 11 1 3.0E-02 - 12 1 1.0E-01 - 13 1 3.0E-01 - 14 1 8.0E-01 - 15 1 3.0E+00 -# - -1 -#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 -INPCOM 1 1 1 -# -# IPOWER: 0/1 = Reactivity/Power vs Time from PREA -# | - 8 1 0 -# -# NPREAT: Number of Entries in PREA vs. Time Table -# | (Power or Reactivity vs Time) - 18 1 2 -# - -1 -#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 -POWINA 12 1 1 -# -# PREATB: Transient power table used by PREA -# | | | | | - 29 2 0.0 0.0 -# -# PREATM: Times for PREATB -# | | - 49 2 0.0 10000.0 -# - -1 -#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 -#=============================================================================== -# -# ###### ####### ##### # # # -# # # # # # # # # # -# # # # # # # # # -# # # ##### # # # # -# # # # # ####### # -# # # # # # # # # -# ###### ####### ##### # # # -# -# ###### ####### # # ####### ###### -# # # # # # # # # # # -# # # # # # # # # # # -# ###### # # # # # ##### ###### -# # # # # # # # # # -# # # # # # # # # # -# # ####### ## ## ####### # # -# -#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 -INPCHN 51 1 1 -# -# IDKCRV: Power or Decay Heat Curve for this Channel -# | - 203 1 0 -# - -1 -#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 -INPCOM 1 1 1 -# -# NDKGRP: Number of Decay Heat Groups -# | - 17 1 0 -# -# NPOWDK: Number of Power Curves or Sets of Decay Heat Parameters -# | - 45 1 0 -# - -1 -#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 -POWINA 12 1 1 -# -# DKBET2(L,IPW): Decay heat precursor yield for group L in -# | decay heat curve IPW (New Model) -# 511 1 0.020 -# 512 1 0.022 -# 513 1 0.017 -# 514 1 0.015 -# 515 1 0.014 -# 516 1 0.012 -# -# DKLAM2(L,IPW): Decay heat decay constant for group L in -# | decay heat curve IPW (New Model) -# 631 1 0.100 -# 632 1 0.050 -# 633 1 0.010 -# 634 1 0.005 -# 635 1 0.002 -# 636 1 0.0005 -# - -1 -#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 -# AXIAL!!! -#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 -INPCHN 51 1 1 -# -# IREACZ: Axial Reactivity Worth (0/1 = On MZ/MZC Mesh) -# | - 365 1 1 -# -# IAXEXP: Calculate Simple Axial Expansion Feedback -# | - 181 1 1 -# - -1 -#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 -INPCOM 1 1 1 -# -# MODEEX: Axial Expansion Option -# | 0: Force balance or free expansion (gap-dependent) -# | 1: Cladding control fuel expansion -# | 2: Independent free fuel-clad expansion -# | 3: Force balance all the time - 55 1 2 -# - -1 -#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 -PMATCH 63 1 1 -# -# FUELEX: Fuel Axial Expansion Coefficient -# | - 73 1 2.0E-05 -# -# CLADEX: Clad Axial Expansion Coefficient -# | - 74 1 1.4E-05 -# -# YFUEL: Fuel Young's Modulus -# | -# 75 1 2.8E+09 -# -# YCLAD: Clad Young's Modulus -# | -# 76 1 1.5E+11 -# -# EXPCFF: Effective Axial Expansion Multiplier -# | (For Simple Feedback Model Only) - 79 1 1.0 -# - -1 -#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 -# -# POWINC: Channel-Dependent Power Input (Floating Point) -# -POWINC 62 1 1 -# -# FUELRA: Doppler Axial Weighting Factor -# | - 208 1 0.0 Lower Reflector 1, Segment 1 - 209 1 0.0 Lower Reflector 1, Segment 2 - 216 1 1.1E-05 Fuel, Segment 1 - 217 1 1.3E-05 Fuel, Segment 2 - 218 1 1.6E-05 Fuel, Segment 3 - 219 1 1.9E-05 Fuel, Segment 4 - 220 1 2.3E-05 Fuel, Segment 5 - 221 1 2.4E-05 Fuel, Segment 6 - 222 1 2.7E-05 Fuel, Segment 7 - 223 1 3.1E-05 Fuel, Segment 8 - 224 1 3.6E-05 Fuel, Segment 9 - 225 1 4.0E-05 Fuel, Segment 10 - 226 1 3.7E-05 Fuel, Segment 11 - 227 1 3.3E-05 Fuel, Segment 12 - 228 1 2.5E-05 Fuel, Segment 13 - 229 1 1.9E-05 Fuel, Segment 14 - 230 1 7.0E-05 Fuel, Segment 15 - 231 1 1.4E-05 Fuel, Segment 16 - 232 1 1.4E-05 Fuel, Segment 17 - 233 1 1.4E-05 Fuel, Segment 18 - 234 1 1.4E-05 Fuel, Segment 19 - 235 1 1.4E-05 Fuel, Segment 20 - 236 1 1.0E-05 Gas Plenum, Segment 1 - 237 1 0.0 Gas Plenum, Segment 2 - 238 1 0.0 Upper Reflector 1, Segment 1 - 239 1 0.0 Upper Reflector 1, Segment 2 - 240 1 0.0 Upper Reflector 1, Segment 3 - 241 1 0.0 Upper Reflector 1, Segment 4 - 242 1 0.0 Upper Reflector 1, Segment 5 - 243 1 0.0 Upper Reflector 1, Segment 6 - 244 1 0.0 Upper Reflector 1, Segment 7 - 245 1 0.0 Upper Reflector 1, Segment 8 - 246 1 0.0 Upper Reflector 1, Segment 9 - 247 1 0.0 Upper Reflector 1, Segment 10 - 248 1 0.0 Upper Reflector 1, Segment 11 - 249 1 0.0 Upper Reflector 1, Segment 12 -# -# CLADRA: Doppler Axial Weighting Factor -# | - 160 1 0.0 Lower Reflector 1, Segment 1 - 161 1 0.0 Lower Reflector 1, Segment 2 - 168 1 9.0E-07 Fuel, Segment 1 - 169 1 1.9E-06 Fuel, Segment 2 - 170 1 2.3E-06 Fuel, Segment 3 - 171 1 2.5E-06 Fuel, Segment 4 - 172 1 2.8E-06 Fuel, Segment 5 - 173 1 3.0E-06 Fuel, Segment 6 - 174 1 3.5E-06 Fuel, Segment 7 - 175 1 4.8E-06 Fuel, Segment 8 - 176 1 5.2E-06 Fuel, Segment 9 - 177 1 4.6E-06 Fuel, Segment 10 - 178 1 3.9E-06 Fuel, Segment 11 - 179 1 3.5E-06 Fuel, Segment 12 - 180 1 2.4E-06 Fuel, Segment 13 - 181 1 2.2E-06 Fuel, Segment 14 - 182 1 1.8E-06 Fuel, Segment 15 - 183 1 1.2E-06 Fuel, Segment 16 - 184 1 2.4E-06 Fuel, Segment 17 - 185 1 2.2E-06 Fuel, Segment 18 - 186 1 1.8E-06 Fuel, Segment 19 - 187 1 1.2E-06 Fuel, Segment 20 - 188 1 8.0E-07 Gas Plenum, Segment 1 - 189 1 0.0 Gas Plenum, Segment 2 - 190 1 0.0 Upper Reflector 1, Segment 1 - 191 1 0.0 Upper Reflector 1, Segment 2 - 192 1 0.0 Upper Reflector 1, Segment 3 - 193 1 0.0 Upper Reflector 1, Segment 4 - 194 1 0.0 Upper Reflector 1, Segment 5 - 195 1 0.0 Upper Reflector 1, Segment 6 - 196 1 0.0 Upper Reflector 1, Segment 7 - 197 1 0.0 Upper Reflector 1, Segment 8 - 198 1 0.0 Upper Reflector 1, Segment 9 - 199 1 0.0 Upper Reflector 1, Segment 10 - 200 1 0.0 Upper Reflector 1, Segment 11 - 201 1 0.0 Upper Reflector 1, Segment 12 -# - -1 -#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 - - -#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 -# -# ###### ###### # # # # ###### # # -# # # # # # ## ## # # # # # # -# # # # # # # # # # # # # # # # -# ###### ###### # # # # # # # ###### ### ####### -# # # # # # # # ####### # # # -# # # # # # # # # # # # -# # # # # # # # # # # # -# -# # # ##### ##### ###### # -# ## ## # # # # # # -# # # # # # # # # # # -# # # # # # # # # ##### # -# # # # # # # # # # -# # # # # # # # # -# # # ##### ##### ###### ####### -# -#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 -# -INPCOM 1 1 1 -# -# IPRION: 4 triggers PRIMAR-4 option -# | - 27 1 4 - -1 -# -#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 -# -INPMR4 3 0 0 - -1 -# -PMR4IN 18 0 0 - -1 -# -#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 -# -INPMR4 3 1 0 -# -# NCVP: # Compressible Volumes, Primary Loop -# | NCVS: # Compressible Volumes, Secondary Loop -# | | NCVD: # CV in DRACS Loop -# | | | NSEGLP: # Liquid Segments, Primary Loop -# | | | | NSEGLP: # Liquid Segments, Secondary Loop -# | | | | | - 1 5 4 0 0 4 0 -# -# NELEMT: Total # of Liquid Flow Elements -# | - 10 1 7 -# -# ITYPCV: Compressible Volume Type -# 1 = Inlet Plenum -# 4 = Almost incompressible liquid, no gas -# 7 = Outlet plenum with cover gas -# 8 = Pool with Cover Gas -# -# Lower end of the inlet Tee -# | Between the reducer and the expansion joint -# | | Tee before flow meter -# | | | Pressurizer tank -# | | | | - 11 4 1 4 4 8 -# -# ITYPEL: Liquid Flow Element Type -# 1 = Core Subassemblies -# 2 = Bypass Channel -# 3 = Pipe -# 5 = Pump Impeller -# 6 = IHX, Shell Side -# 11 = Valve -# -# Core Pipe IHX Pipe Pump Pipe Pipe -# | | | | | | | - 49 7 1 3 6 3 5 3 3 -# -# JCVL: Compressible Volumes at ends of Liquid Segments -# in out -# | | - 189 2 1 2 # Segment 1: inlet tee (CV1) ~ reducer top (CV2) - 191 2 2 3 # Segment 2: reducer top (CV2) ~ tee before FM (CV3) - 193 2 3 1 # Segment 3: tee before FM (CV3) ~ inlet tee (CV1) - 195 2 3 4 # Segment 4: tee before FM (CV3) ~ tank (CV4) -# -# NELML: # of Elements in Liquid Segment -# | | | | - 325 4 1 3 3 1 -# -# JFSELL: First Element # in Segments -# | | | | - 365 4 1 2 5 7 -# -# NPUMP: # of Water Pumps -# | IELPMP: Element # of Pump -# | | - 405 2 1 5 -# -# IEMPMP: Type of Pump (IEMPMP = 2 for Homologous Pump Model) -# | (IEMPMP = 0 for table of head vs time) - 418 1 0 -# -# ILRPMP: Pump Operation Option -# | - 430 1 0 -# -# NIHX: Number of Intermediate Heat Exchangers -# | - 470 1 1 -# -# IELIHX: Element index of IHX in primary loop -# | - 473 1 3 -# -# IHXCLC: IHX Detailed or Simple model option -# | (0 = Use Detailed Model) -# | (1 = Use Simple Model) - 489 1 -1 # Negative for outlet temperature vs time -# -# IPRADJ: Inlet/Outlet Plena Pressure Adjustment Option -# | - 497 1 1 -# -# NTGPT: # of Temperature Groups -# | - 512 1 5 -# -# NTNODE: # of Nodes in the Temperature Group. -# 2 nodes for tabular IHX. -# | | | | | - 513 5 20 2 20 20 20 -# -# IFSTEL: First Element in Temperature Group -# | | | | | - 613 5 2 3 4 5 7 -# -# ILSTEL: Last Element in Temperature Group -# | | | | | - 713 5 2 3 4 6 7 -# -# ISSIHX: Steady-state IHX temperature drop, if 1, user specifies -# | - 1155 1 0 -# -# ISSPMP: Steady-state pump head, if 1, user specifies -# | - 1159 1 0 -# -# IPIPTM: Pipe Temp Convection Differencing Approx. (Recommended = 2) -# | Multiple Inlet/Outlet Plenum Option -# | | - 1310 2 2 0 -# -#################################### -# Binary output setting for PRIMAR-4 -#################################### -# -# IP4PRT: How many PRIMAR steps to print PRIMAR-4 results -# | NBINOT: # of IBINOT entries for PRIMAR-4.dat -# | | IBINST: Output every IBINST steps to PRIMAR-4.dat -# | | | - 890 3 2000 16 200 -# -# IBINOT: Identification of output entries -# | see Manual Table A2.2-1 -# |||||| - 893 1240001 # Temperature of CV1 (inlet plenum) - 894 1240002 # Temperature of CV2 (outlet plenum) - 895 1240003 # Temperature of CV3 (tee to tank) - 896 1240004 # Temperature of CV4 (tank) - 897 1300003 # IHX Inlet Temperature (IELL=3) - 898 1300403 # IHX Outlet Temperature (IELL=3) - 899 1010001 # Flow Rate of S1 (core) - 900 1010002 # Flow Rate of S2 (core to tee) - 901 1010003 # Flow Rate of S3 (tee to core) - 902 1010004 # Flow Rate of S4 (tee to tank) - 903 1170004 # Gas Pressure of CV4 (tank) - 904 1160001 # Liquid Pressure of CV1 (inlet plenum) - 905 1160002 # Liquid Pressure of CV2 (outlet plenum) - 906 1160003 # Liquid Pressure of CV3 (tee to tank) - 907 1160004 # Liquid Pressure of CV4 (tank) - 908 1180001 # Pump Head -# - -1 -# -#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 -# -PMR4IN 18 1 0 -# -#################################### -# Liquid Segment Setting -#################################### -# -# FLOSSL: Initial flow rate in liquid flow segments. Important for convergence. -# | | | | - 2 4 0.8 0.8 0.8 1.0E-12 -# -# ZINL: Height of inlet to the liquid segment -# | | | | - 42 4 -0.500 5.000 -0.500 -0.500 -# -# CVLMLT: Multiplicity Factors at Liquid Segment Ends -# | | | | - 82 4 1.0 1.0 1.0 1.0 - 86 4 1.0 1.0 1.0 1.0 -# -#################################### -# Liquid Element Setting -#################################### -# -# ZOUTEL: Height at Outlet of the liquid element -# | | | | | - 162 5 5.000 5.500 5.000 -0.500 -0.500 - 167 2 -0.500 0.5270 -# -# XLENEL: Liquid element length (Pump:5) -# | | | | | - 302 5 5.500 2.500 0.500 5.500 0.0001 - 307 2 2.000 10.000 -# -# AREAEL: Cross-sectional flow area of liquid elements -# | | | | | - 442 5 8.5507E-04 2.1649E-03 1.0459E-02 2.1649E-03 1.3134E-03 - 447 2 1.3134E-03 9.3691E-05 -# -# DHELEM: Hydraulic Diameter of liquid elements -# | | | | | - 582 5 1.9050E-02 5.2501E-02 1.0255E-02 5.2501E-02 4.0894E-02 - 587 2 4.0894E-02 1.0922E-02 -# -# ROUGHl: Pipe Surface Roughness -# | | | | | - 722 5 2.0E-05 2.0E-05 2.0E-05 2.0E-05 2.0E-05 - 727 2 2.0E-05 2.0E-05 -# -# BENDNM: Number of Bends in Each Liquid Element -# | | | | | - 862 5 0.0 1.0 0.0 0.0 0.0 - 867 2 0.0 0.0 -# -################## -# -# G2PRDR: Initial Orifice Coefficient, normally 0 as input -# | | | | | - 1002 5 0.0 0.0 100.0 0.0 0.0 - 1007 2 0.0 0.0 -# -# BNDLOD: Effective L/D per bend -# | - 1142 1 11.52 -# -# WALLMC: Pipe wall mass times heat capacity/length -# | | | | | - 1143 5 1.0 1.0 1.0 1.0 1.0 - 1148 2 1.0 1.0 -# -# WALLH: Pipe wall heat transfer coefficient -# | | | | | - 1283 5 1.0 1.0 1.0 1.0 1.0 - 1288 2 1.0 1.0 -# -#################################### -# Compressible Volume Setting -#################################### -# -# VOLLGC: Total Volume of Compressible Volumes -# | | | | - 1423 4 2.981E-04 8.798E-04 1.021E-03 1.392 - -# VOLSG0: Initial Gas Volume -# | | | | - 3612 4 0.0 0.0 0.0 0.405 -# -# PRESG0: Initial Gas Pressure in CV -# | | | | - 1461 4 0.0 0.0 0.0 200000.0 -# -# ALPHAP: CV volume pressure expansion coefficient -# | | | | - 1499 4 1.0E-08 1.0E-08 1.0E-08 0 - -# ALPHAT: CV volume thermal expansion coefficient -# | | | | - 1537 4 2.0E-05 2.0E-05 2.0E-05 2.0E-05 -# -# BTAPNA: Water isothermal compressibility for the CV -# | | | | - 2464 4 2.0E-10 2.0E-10 2.0E-10 2.0E-10 -# -# BTATNA: Water thermal expansion coefficient for the CV -# | | | | - 2502 4 3.0E-04 3.0E-04 3.0E-04 3.0E-04 -# -# ZCVL: CV reference height for liquid pressure -# | | | | - 1575 4 -0.500 5.000 -0.500 0.527 -# -# AREAIN: Liquid-Gas Interface Area in CV (1.0 if no gas) -# | | | | - 1613 4 1.0 1.0 1.0 0.800 -# -# TREFCV: Steady-state gas temperature in CV -# | Input as 0.0 to use liquid temperature -# | | | | - 1651 4 0.0 0.0 0.0 0.0 -# -# HWALL: Wall-coolant heat-transfer coefficient for CV at reference temperature -# | | | | - 2578 4 1.0 1.0 1.0 1.0 -# -# AWALL: Wall surface area -# Modeled as a 8.938" long 1.5" Sch. 40 pipe -# | Modeled as a 16" long 2" Sch. 40 pipe -# | | Modeled as a 13" long 2.5" Sch. 40 pipe -# | | | Modeled as a 37" I.D. 79" tall cylinder -# | | | | - 2616 4 0.0292 0.0670 0.0651 4.1097 -# -# CMWALL: CV Wall mass times specific heat -# | | | | - 2654 4 1.0 1.0 1.0 1.0 -# -#################################### -# Cover Gas Data -#################################### -# -# Values given are for nitrogen gas at 100C -# -# GAMGSC: Cp/Cv for cover gas -# | - 1689 1 1.40 -# -# RGASC: Gas constant for cover gas. -# | - 1690 1 296.80 -# -# U0CVGS: Cover gas viscosity -# | - 1691 1 2.12E-05 -# -# TRFU: Gas viscosity reference temperature -# | - 1692 1 373.15 -# -# TAUGAS: Cover-gas temperature time constant. -# | | | | - 1861 4 1.0 1.0 1.0 2.0 -# -#################################### -# Simple Pump Setting -#################################### -# -# APMPHD: Value Table of Relative Pump Head (-) -# | | | | - 1983 4 1.0 1.0 1.0 1.0 - 1987 4 1.0 1.0 1.0 1.0 -# -# AMOTTK: Time Table of Relative Pump Head (s) -# | | - 2223 2 0.0 100 -# -# GRAVTY: Acceleration due to gravity -# | - 2463 1 9.80665 -# -#################################### -# Simple IHX Model Setting -#################################### -# -# DTMPTB: Table of exit temperature for IHX -# | | | | - 2937 4 600.00 600.00 600.00 600.00 -# -# ZCENTR: Height of thermal center for IHX -# | | | | - 3105 4 5.250 5.250 5.250 5.250 -# -# TMPMTB: Times for DTMPTB and ZCENTR -# | | | | - 3273 4 0.0 10.0 20.0 10000.0 -# -# C1PIPE, C2PIPE, C3PIPE: Conductance coefficient for pipe, recommended values -# | | | - 3650 3 0.025 0.8 4.80 -# -# EPSF: Maximum fractional change in liquid segment flow rate per time step -# | EPSFC: Maximum fractional change in core inlet flow rate -# | | per time step - 4282 2 0.2 0.1 -# -# DTIHX: Steady-state temperature drop across IHX -# | (Used only if ISSIHX > 0) -# 4284 1 1.0 -# -#################################### -# -# TPLCV: Temperature of CV. Entered only for inlet plena -# | - 4685 1 600.00 -# -# PPLCV: CV pressure for outlet plena only -# | - 4724 1 200000.0 -# -# ZPLENC: CV reference elevation for plena only -# | | - 4761 2 -0.500 5.000 -# - -1 -#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 -INPCOM 1 1 1 -# -# KPROPI: > 0 to input correlation coefficients in APROPI -# | This is probably reset by ICLPRP - 114 1 1 -# -# ICLPRP: 1 for Sodium (SAS4A version) -# | - 118 1 1 -# - -1 -#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 -# -######## ####### ####### ####### ####### ####### ####### ####### ####### ####### -ENDJOB -1 -######## ####### ####### ####### ####### ####### ####### ####### ####### ####### \ No newline at end of file diff --git a/src/watts_ui/examples/1App_SAS_SodiumLoop/watts_comprehensive.son b/src/watts_ui/examples/1App_SAS_SodiumLoop/watts_comprehensive.son deleted file mode 100644 index 9ff8c305..00000000 --- a/src/watts_ui/examples/1App_SAS_SodiumLoop/watts_comprehensive.son +++ /dev/null @@ -1,34 +0,0 @@ -watts{ - % Change the working directory to the directory where the input files are stored. This is necessary - % due to how WATTS copies input files to the temporary working directory. - workflow_dir = "/Users/zhieejhiaooi/Documents/ANL/watts-devel/watts/src/watts_ui/examples/1App_SAS_SodiumLoop" - - plugins{ - plugin(ID1){ - code = "sas" - template = "sas_template" - exec_dir = "SAS_DIR" - show_stderr = False - show_stdout = False - % conv_channel = "path\to\CHANNELtoCSV.x" % Assumed to be in the same dir as the SAS executable if not provided - % conv_primar4 = "path\to\PRIMAR4toCSV.x" % Assumed to be in the same dir as the SAS executable if not provided - } - } - - workflow_level1{ - plugin = ID1 - variables{ - param(sas_version) {value = 5.5} - param(tmax) {value = 1000.0} - param(flow_per_pin) {value = 0.15} - param(total_reactor_power) {value = 20.0 unit = kW} - param(betai_1) {value = 2.0E-04} %Effective delayed neutron fraction - param(betai_2) {value = 1.0E-03} - param(betai_3) {value = 1.2E-03} - param(betai_4) {value = 2.5E-03} - param(betai_5) {value = 1.5E-03} - param(betai_6) {value = 5.0E-04} - } - } - -} \ No newline at end of file diff --git a/src/watts_ui/examples/1App_SAS_SodiumLoop/watts_exec.py b/src/watts_ui/examples/1App_SAS_SodiumLoop/watts_exec.py deleted file mode 100644 index 26716df7..00000000 --- a/src/watts_ui/examples/1App_SAS_SodiumLoop/watts_exec.py +++ /dev/null @@ -1,73 +0,0 @@ -# SPDX-FileCopyrightText: 2022 UChicago Argonne, LLC -# SPDX-License-Identifier: MIT - -""" -Example problem of runing SAS4A/SASSY-1 with WATTS. -This is a simple sodium loop that uses the channel (core) -and PRIMAR-4 module. Sodium is heated in the core, then -flows upwward through a series of pipes to a heat -exchanger (IHX), then downward to a pump, and lastly -back to the outlet of the core. A tank with cover gas is -used to provide compressible space. The design of -loop is a simplified version of the loop by Zhang et al. -(https://doi.org/10.1016/j.nucengdes.2021.111149). The -dimensions of this simplified loop are arbitrarily selected. - ___ - -------------------[ ] - | [ ] - | [ I ] - | P [ H ] - | I [ X ] - | P [ ] - | E [___] - | | - | | - * | - * | - * | - * | - * | - * C | - * O | ____________ - * R | | | - * R | | | - * | |------------| - * | | | - * | | | - * | | | - * ____ | | - * [ ] | | - -------------------[ ]----------|____________| - [____] TANK - PUMP -""" - -from math import cos, pi -import os -import watts -from astropy.units import Quantity - - -params = watts.Parameters() - -# Channel params -params['sas_version'] = 5.5 -params['tmax'] = 1000.0 # maximum problem time in s -params['flow_per_pin'] = 0.15 # kg/s -params['total_reactor_power'] = Quantity(20, "kW") -params['betai_1'] = 2.0E-04 # Effective delayed neutron fraction -params['betai_2'] = 1.0E-03 -params['betai_3'] = 1.2E-03 -params['betai_4'] = 2.5E-03 -params['betai_5'] = 1.5E-03 -params['betai_6'] = 5.0E-04 - -params.show_summary(show_metadata=False, sort_by='key') - -# SAS Workflow -sas_plugin = watts.PluginSAS('sas_template') # Show all the output -sas_result = sas_plugin(params) -for key in sas_result.csv_data: - print(key, sas_result.csv_data[key]) -print(sas_result.inputs) -print(sas_result.outputs) diff --git a/src/watts_ui/examples/Parametric_SAM_SimpleJunction/sam_template b/src/watts_ui/examples/Parametric_SAM_SimpleJunction/sam_template deleted file mode 100644 index f6866344..00000000 --- a/src/watts_ui/examples/Parametric_SAM_SimpleJunction/sam_template +++ /dev/null @@ -1,144 +0,0 @@ -[GlobalParams] - global_init_P = 1.2e5 - global_init_V = 1 - global_init_T = 628.15 - scaling_factor_var = '1 1e-3 1e-6' -[] - -[EOS] - [./eos] - type = PBSodiumEquationOfState - [../] -[] - -[Functions] - [./time_stepper] - type = PiecewiseLinear - x = ' 0 20 21 100 101 1e5' - y = '0.1 0.1 0.5 0.5 1 1' - [../] -[] - -[Components] - [./pipe1] - type = PBOneDFluidComponent - eos = eos - position = '0 0 0' - orientation = '0 0 1' - heat_source = {{ heat_source }} - f= {{ friction_factor }} - Dh = {{ Dh }} - length = 1 - # A = 3.14e-4 - A = {{ flow_area }} - n_elems = 10 - [../] - - [./pipe2] - type = PBOneDFluidComponent - eos = eos - position = '0 0 1' - orientation = '0 0 1' - f=0.1 - Dh = 0.01 - length = 1 - heat_source = 1e7 - A = 3.14e-4 - n_elems = 10 - [../] - - [./joint] - type = PBSingleJunction - eos = eos - inputs='pipe1(out)' - outputs='pipe2(in)' - weak_constraint = true - [../] - [./inlet] - type = PBTDJ - input = 'pipe1(in)' - eos = eos - v_bc = {{ velocity_inlet }} - T_bc = {{ temperature_inlet }} - [../] - - [./outlet] - type = PBTDV - input = 'pipe2(out)' - eos = eos - p_bc = '1.0e5' - T_bc = 728.15 - [../] -[] - -[Postprocessors] - [./TotalMassFlowRateInlet_2] - type = ComponentBoundaryFlow - input = 'pipe2(out)' - [../] - [./Outlet_Temperature_2] - type = ComponentBoundaryVariableValue - variable = temperature - input = 'pipe2(out)' - [../] -[] - -[Preconditioning] - active = 'SMP_PJFNK' - - [./SMP_PJFNK] - type = SMP - full = true - solve_type = 'PJFNK' - petsc_options_iname = '-pc_type' - petsc_options_value = 'lu' - [../] -[] # End preconditioning block - - -[Executioner] - type = Transient - - dt = 1e-1 - dtmin = 1e-5 - - # setting time step range - [./TimeStepper] - type = FunctionDT - function = time_stepper - [../] - - petsc_options_iname = '-ksp_gmres_restart' - petsc_options_value = '100' - - nl_rel_tol = 1e-8 - nl_abs_tol = 1e-7 - nl_max_its = 20 - - l_tol = 1e-5 # Relative linear tolerance for each Krylov solve - l_max_its = 100 # Number of linear iterations for each Krylov solve - - start_time = 0.0 - end_time = 100. - - [./Quadrature] - type = TRAP - order = FIRST - [../] -[] # close Executioner section - -[Outputs] - perf_graph = true - [./out_displaced] - type = Exodus - use_displaced = true - execute_on = 'initial timestep_end' - sequence = false - [../] - [./csv] - type = CSV - [../] - [./console] - type = Console - [../] -[] diff --git a/src/watts_ui/examples/Parametric_SAM_SimpleJunction/watts_comprehensive.son b/src/watts_ui/examples/Parametric_SAM_SimpleJunction/watts_comprehensive.son deleted file mode 100644 index 4dde9af0..00000000 --- a/src/watts_ui/examples/Parametric_SAM_SimpleJunction/watts_comprehensive.son +++ /dev/null @@ -1,40 +0,0 @@ -watts{ - % Change the working directory to the directory where the input files are stored. This is necessary - % due to how WATTS copies input files to the temporary working directory. - workflow_dir = "/Users/zhieejhiaooi/Documents/ANL/watts-devel/watts/src/watts_ui/examples/Parametric_SAM_SimpleJunction" - - plugins{ - plugin(ID1){ - code = "moose" - template = "sam_template" - exec_dir= SAM_DIR - exec_name = "sam-opt" - show_stderr = False - show_stdout = False - } - } - - workflow_level1{ - plugin = ID1 - variables{ - param(temperature_inlet) {value = 2.0} - param(friction_factor) {value = 0.1} - param(flow_area) {value = 3.14e-4} - param(country) {value = USA} - param(Dh) {value = 1 unit = m} - param(velocity_inlet) {value = 1} - param(name) {list = [ANL INL ORNL LANL]} - param(size) {list = [30.0 50.4 -60.6 1e-5]} - param(velocity_outlet) {func = "2 * temperature_inlet ** 3"} - param(velocity_outlet_2) {func = "friction_factor + 2 + temperature_inlet ** 3"} - param(wall_bc) {bool = "True"} - } - - parametric{ - changing_params = "heat_source" - changing_values = [0, 1e5, 2e5, 3e5] - - } - } - -} \ No newline at end of file diff --git a/src/watts_ui/examples/Parametric_SAM_SimpleJunction/watts_exec.py b/src/watts_ui/examples/Parametric_SAM_SimpleJunction/watts_exec.py deleted file mode 100644 index 6f090991..00000000 --- a/src/watts_ui/examples/Parametric_SAM_SimpleJunction/watts_exec.py +++ /dev/null @@ -1,65 +0,0 @@ -# SPDX-FileCopyrightText: 2022 UChicago Argonne, LLC -# SPDX-License-Identifier: MIT - -""" -This example demonstrates how to use WATTS to perform -SAM calculations. This example uses a simple VHTR unit-cell -model with 1 coolant channel surrounded by graphite and fuel. -The demonstration includes the application of unit-conversion -approach in WATTS. After execution of SAM using the MOOSE plugin, -the results stored in CSV files are displayed to the user. -""" - -from math import cos, pi -import os -from pathlib import Path - -import watts -from astropy.units import Quantity - - -params = watts.Parameters() - -# TH params - -params['He_inlet_temp'] = Quantity(600, "Celsius") # 873.15 K -params['He_outlet_temp'] = Quantity(850, "Celsius") # 1123.15 K -params['He_cp'] = Quantity(4.9184126, "BTU/(kg*K)") # 5189.2 J/kg-K -params['He_K'] = 0.32802 # W/m-K -params['He_density'] = 3.8815 # kg/m3 -params['He_viscosity'] = 4.16e-5 # Pa.s -params['He_Pressure'] = Quantity(1015.264164, "psi") # 7e6 Pa -params['Tot_assembly_power'] = 250000 # W - -for i in range(1, 6): - params[f'Init_P_{i}'] = 1 # Fraction - -# Core design params - some are not used in SAM model -params['ax_ref'] = 20 # cm -params['num_cool_pins'] = 1*6+2*6+6*2/2 -params['num_fuel_pins'] = 6+6+6+3*6+2*6/2+6/3 -params['Height_FC'] = Quantity(2000, "mm") # Automatically converts to 'm' for MOOSE and 'cm' for openmc -params['Lattice_pitch'] = 2.0 -params['FuelPin_rad'] = 0.90 # cm -params['cool_hole_rad'] = 0.60 # cm -params['Coolant_channel_diam'] = (params['cool_hole_rad'] * 2)/100 # in m -params['Graphite_thickness'] = (params['Lattice_pitch'] - params['FuelPin_rad'] - params['cool_hole_rad']) # cm -params['Assembly_pitch'] = 7.5 * 2 * params['Lattice_pitch'] / (cos(pi/6) * 2) -params['lbp_rad'] = 0.25 # cm -params['mod_ext_rad'] = 0.90 # cm -params['shell_thick'] = 0.05 # FeCrAl -params['liner_thick'] = 0.007 # Cr -params['control_pin_rad'] = Quantity(9.9, "mm") # Automatically converts to 'm' for MOOSE and 'cm' for openmc - -params.show_summary(show_metadata=False, sort_by='key') - -# MOOSE Workflow -# set your SAM directory as SAM_DIR - -app_dir = Path(os.environ["SAM_DIR"]) -moose_plugin = watts.PluginMOOSE('sam_template', executable=app_dir / 'sam-opt') -moose_result = moose_plugin(params) -for key in moose_result.csv_data: - print(key, moose_result.csv_data[key]) -print(moose_result.inputs) -print(moose_result.outputs) diff --git a/src/watts_ui/examples/PicardIterations_SAM-OpenMC_VHTR/README.md b/src/watts_ui/examples/PicardIterations_SAM-OpenMC_VHTR/README.md deleted file mode 100644 index 26177572..00000000 --- a/src/watts_ui/examples/PicardIterations_SAM-OpenMC_VHTR/README.md +++ /dev/null @@ -1,20 +0,0 @@ -# PicardIterations_SAM-OpenMC_VHTR - -## Purpose - -This example demonstrates how to use WATTS to perform several iterations where SAM calculations are followed by OpenMC calculation and temperature/power information are exchanged until convergence. - -## Code(s) - -- SAM -- OpenMC - -## Keywords - -- Information transfer from SAM to OpenMC -- Picard iterations until convergence - -## File descriptions - -- [__watts_exec.py__](watts_exec.py): WATTS workflow for this example. This is the file to execute to run the problem described above. -- [__openmc_template__](openmc_template.py): Link to OpenMC templated model. \ No newline at end of file diff --git a/src/watts_ui/examples/PicardIterations_SAM-OpenMC_VHTR/openmc_template.py b/src/watts_ui/examples/PicardIterations_SAM-OpenMC_VHTR/openmc_template.py deleted file mode 100644 index bee18f80..00000000 --- a/src/watts_ui/examples/PicardIterations_SAM-OpenMC_VHTR/openmc_template.py +++ /dev/null @@ -1,355 +0,0 @@ -# SPDX-FileCopyrightText: 2022 UChicago Argonne, LLC -# SPDX-License-Identifier: MIT - -from math import sqrt - -import openmc -import openmc.model - - -def build_openmc_model(params): - """ OpenMC Model """ - - materials = [] - - homfuel1 = openmc.Material(name="homfuel_1", temperature=params['avg_Tf_1']) - homfuel1.set_density('g/cm3', 2.2767E+00) - homfuel1.add_nuclide('U235', 4.0841E-02, 'wo') - homfuel1.add_nuclide('U238', 1.6597E-01, 'wo') - homfuel1.add_nuclide('O16', 7.0029E-01, 'wo') - homfuel1.add_element('C', 2.0896E-02, 'wo') - homfuel1.add_nuclide('Si28', 6.6155E-02, 'wo') - homfuel1.add_nuclide('Si29', 3.4772E-03, 'wo') - homfuel1.add_nuclide('Si30', 2.3671E-03, 'wo') - materials.append(homfuel1) - - homfuel2 = openmc.Material(name="homfuel_2", temperature=params['avg_Tf_2']) - homfuel2.set_density('g/cm3', 2.2767E+00) - homfuel2.add_nuclide('U235', 4.0841E-02, 'wo') - homfuel2.add_nuclide('U238', 1.6597E-01, 'wo') - homfuel2.add_nuclide('O16', 7.0029E-01, 'wo') - homfuel2.add_element('C', 2.0896E-02, 'wo') - homfuel2.add_nuclide('Si28', 6.6155E-02, 'wo') - homfuel2.add_nuclide('Si29', 3.4772E-03, 'wo') - homfuel2.add_nuclide('Si30', 2.3671E-03, 'wo') - materials.append(homfuel2) - - homfuel3 = openmc.Material(name="homfuel_1", temperature=params['avg_Tf_3']) - homfuel3.set_density('g/cm3', 2.2767E+00) - homfuel3.add_nuclide('U235', 4.0841E-02, 'wo') - homfuel3.add_nuclide('U238', 1.6597E-01, 'wo') - homfuel3.add_nuclide('O16', 7.0029E-01, 'wo') - homfuel3.add_element('C', 2.0896E-02, 'wo') - homfuel3.add_nuclide('Si28', 6.6155E-02, 'wo') - homfuel3.add_nuclide('Si29', 3.4772E-03, 'wo') - homfuel3.add_nuclide('Si30', 2.3671E-03, 'wo') - materials.append(homfuel3) - - homfuel4 = openmc.Material(name="homfuel_1", temperature=params['avg_Tf_4']) - homfuel4.set_density('g/cm3', 2.2767E+00) - homfuel4.add_nuclide('U235', 4.0841E-02, 'wo') - homfuel4.add_nuclide('U238', 1.6597E-01, 'wo') - homfuel4.add_nuclide('O16', 7.0029E-01, 'wo') - homfuel4.add_element('C', 2.0896E-02, 'wo') - homfuel4.add_nuclide('Si28', 6.6155E-02, 'wo') - homfuel4.add_nuclide('Si29', 3.4772E-03, 'wo') - homfuel4.add_nuclide('Si30', 2.3671E-03, 'wo') - materials.append(homfuel4) - - homfuel5 = openmc.Material(name="homfuel_1", temperature=params['avg_Tf_5']) - homfuel5.set_density('g/cm3', 2.2767E+00) - homfuel5.add_nuclide('U235', 4.0841E-02, 'wo') - homfuel5.add_nuclide('U238', 1.6597E-01, 'wo') - homfuel5.add_nuclide('O16', 7.0029E-01, 'wo') - homfuel5.add_element('C', 2.0896E-02, 'wo') - homfuel5.add_nuclide('Si28', 6.6155E-02, 'wo') - homfuel5.add_nuclide('Si29', 3.4772E-03, 'wo') - homfuel5.add_nuclide('Si30', 2.3671E-03, 'wo') - materials.append(homfuel5) - - boro_ctr = openmc.Material(name="B4C-CTR", temperature=params['temp']) - boro_ctr.set_density('g/cm3', 2.47) - boro_ctr.add_nuclide('B10', 0.16, 'ao') - boro_ctr.add_nuclide('B11', 0.64, 'ao') - boro_ctr.add_element('C', 0.20, 'ao') - materials.append(boro_ctr) - - matrix = openmc.Material(name="matrix", temperature=params['temp']) - matrix.set_density('g/cm3', 1.806) - matrix.add_element('C', 1.0 - 0.0000003, 'ao') - matrix.add_nuclide('B10', 0.0000003, 'ao') - if params['use_sab']: - matrix.add_s_alpha_beta('c_Graphite') - materials.append(matrix) - - refl = openmc.Material(name="BeO", temperature=params['temp']) - refl.set_density('g/cm3', 2.7987) - refl.add_nuclide('Be9', 0.50, 'ao') - refl.add_nuclide('O16', 0.50, 'ao') - if params['use_sab_BeO']: - refl.add_s_alpha_beta('c_Be_in_BeO') - refl.add_s_alpha_beta('c_O_in_BeO') - materials.append(refl) - - yh2 = openmc.Material(name="moderator", temperature=params['temp']) - yh2.set_density('g/cm3', 4.30*0.95) - yh2.add_nuclide('Y89', 0.357142857, 'ao') - yh2.add_nuclide('H1', 0.642857143, 'ao') - if params['use_sab'] and params['use_sab_YH2']: - yh2.add_s_alpha_beta('c_H_in_YH2') - yh2.add_s_alpha_beta('c_Y_in_YH2') - materials.append(yh2) - - coolant = openmc.Material(name="coolant", temperature=params['temp']) - coolant.set_density('g/cm3', 0.00365) - coolant.add_nuclide('He4', 1, 'ao') - materials.append(coolant) - - Cr = openmc.Material(name="Cr", temperature=params['temp']) - Cr.set_density('g/cm3', 7.19) - Cr.add_nuclide('Cr50', -4.345e-2, 'ao') - Cr.add_nuclide('Cr52', -83.789e-2, 'ao') - Cr.add_nuclide('Cr53', -9.501e-2, 'ao') - Cr.add_nuclide('Cr54', -2.365e-2, 'ao') - materials.append(Cr) - - shell_mod = openmc.Material(name="shell_mod", temperature=params['temp']) - shell_mod.set_density('g/cm3', 7.055) # FeCrAl - shell_mod.add_nuclide('Cr50', 20.0e-2 * 4.340E-02,'ao') - shell_mod.add_nuclide('Cr52', 20.0e-2 * 8.381E-01,'ao') - shell_mod.add_nuclide('Cr53', 20.0e-2 * 9.490E-02,'ao') - shell_mod.add_nuclide('Cr54', 20.0e-2 * 2.360E-02,'ao') - shell_mod.add_nuclide('Fe54', 75.5e-2 * 5.800E-02,'ao') - shell_mod.add_nuclide('Fe56', 75.5e-2 * 9.172E-01,'ao') - shell_mod.add_nuclide('Fe57', 75.5e-2 * 2.200E-02,'ao') - shell_mod.add_nuclide('Fe58', 75.5e-2 * 2.800E-03,'ao') - shell_mod.add_nuclide('Al27', 4.5e-2 * 1.000 ,'ao') - materials.append(shell_mod) - - mat_dict = {} - for k,v in list(locals().items()): - if v in materials: - mat_dict[k] = v - - materials_file = openmc.Materials() - for mat in materials: - materials_file.append(mat) - materials_file.export_to_xml() - - Z_min = 0 - Z_cl = params['ax_ref'] - Z_cl_out = params['ax_ref'] - params['shell_thick'] - Z_up = params['ax_ref'] + params['cl'] - Z_up_out = params['ax_ref'] + params['cl'] + params['shell_thick'] - Z_max = params['cl'] + 2 * params['ax_ref'] - - # Create cylinder for fuel and coolant - - fuel_radius = openmc.ZCylinder(x0=0.0, y0=0.0, r=params['FuelPin_rad']) - mod_rad_0 = openmc.ZCylinder(x0=0.0, y0=0.0, r=params['mod_ext_rad'] - params['shell_thick'] - params['liner_thick']) - mod_rad_1a = openmc.ZCylinder(x0=0.0, y0=0.0, r=params['mod_ext_rad'] - params['shell_thick']) - mod_rad_1b = openmc.ZCylinder(x0=0.0, y0=0.0, r=params['mod_ext_rad']) - cool_radius = openmc.ZCylinder(x0=0.0, y0=0.0, r=params['cool_hole_rad']) - ctr_radius = openmc.ZCylinder(x0=0.0, y0=0.0, r=params['control_pin_rad']) - lbp_radius = openmc.ZCylinder(x0=0.0, y0=0.0, r=params['lbp_rad']) - - pin_pitch = params['Lattice_pitch'] - - min_z=openmc.ZPlane(z0=Z_min, boundary_type='vacuum') - max_z=openmc.ZPlane(z0=Z_max, boundary_type='vacuum') - sz_cl=openmc.ZPlane(z0=Z_cl) - - sz_cor1=openmc.ZPlane(z0= Z_cl + 1 * params['cl']/5) - sz_cor2=openmc.ZPlane(z0= Z_cl + 2 * params['cl']/5) - sz_cor3=openmc.ZPlane(z0= Z_cl + 3 * params['cl']/5) - sz_cor4=openmc.ZPlane(z0= Z_cl + 4 * params['cl']/5) - - sz_cl_out=openmc.ZPlane(z0=Z_cl_out) - sz_up=openmc.ZPlane(z0=Z_up) - sz_up_out=openmc.ZPlane(z0=Z_up_out) - cpin_low =openmc.ZPlane(z0=Z_up) - - Hex_Pitch = openmc.model.hexagonal_prism(orientation='x',edge_length=params['Assembly_pitch']/sqrt(3),origin=(0.0, 0.0), - boundary_type = 'reflective') # THIS SHOULD BE REFLECTIVE BONDARY - - - fuel_cell_1_1 = openmc.Cell(name='Fuel Pin', fill=homfuel1 , region=-fuel_radius & +sz_cl & -sz_cor1) - fuel_cell_1_2 = openmc.Cell(name='Fuel Pin', fill=homfuel2 , region=-fuel_radius & +sz_cor1 & -sz_cor2) - fuel_cell_1_3 = openmc.Cell(name='Fuel Pin', fill=homfuel3 , region=-fuel_radius & +sz_cor2 & -sz_cor3) - fuel_cell_1_4 = openmc.Cell(name='Fuel Pin', fill=homfuel4 , region=-fuel_radius & +sz_cor3 & -sz_cor4) - fuel_cell_1_5 = openmc.Cell(name='Fuel Pin', fill=homfuel5 , region=-fuel_radius & +sz_cor4 & -sz_up) - fuel_cell_2 = openmc.Cell(name='matrix', fill=matrix , region=+fuel_radius & +sz_cl & -sz_up) - fuel_cell_3 = openmc.Cell(name='reflL', fill=refl , region=-sz_cl) - fuel_cell_4 = openmc.Cell(name='reflO', fill=refl , region=+sz_up) - fuel_universe= openmc.Universe(cells=(fuel_cell_1_1, fuel_cell_1_2,fuel_cell_1_3,fuel_cell_1_4,fuel_cell_1_5,fuel_cell_2,fuel_cell_3,fuel_cell_4)) - TALLY_REGIONS=[fuel_cell_1_1, fuel_cell_1_2,fuel_cell_1_3,fuel_cell_1_4,fuel_cell_1_5] - - mod_cell_1 = openmc.Cell(name='YH2', fill=yh2, region=-mod_rad_0 & +sz_cl & -sz_up ) - mod_cell_2a = openmc.Cell(name='Liner', fill=Cr , region=+mod_rad_0 & -mod_rad_1a & +sz_cl & -sz_up) - mod_cell_2b = openmc.Cell(name='steel', fill=shell_mod , region=+mod_rad_1a & -mod_rad_1b & +sz_cl & -sz_up) - mod_cell_3 = openmc.Cell(name='matrix', fill=matrix , region=+mod_rad_1b & +sz_cl & -sz_up) - mod_cell_5 = openmc.Cell(name='Plug_L', fill=shell_mod , region=-mod_rad_1b & +sz_cl_out & -sz_cl) - mod_cell_6 = openmc.Cell(name='Plug_LR', fill=refl , region=+mod_rad_1b & +sz_cl_out & -sz_cl) - mod_cell_7 = openmc.Cell(name='Plug_U', fill=shell_mod , region=-mod_rad_1b & +sz_up & -sz_up_out) - mod_cell_8 = openmc.Cell(name='Plug_UR', fill=refl , region=+mod_rad_1b & +sz_up & -sz_up_out) - mod_cell_9 = openmc.Cell(name='LowRef', fill=refl , region=-sz_cl_out) - mod_cell_10 = openmc.Cell(name='UpRef', fill=refl , region=+sz_up) - mod_universe= openmc.Universe(cells=(mod_cell_1,mod_cell_2a, mod_cell_2b,mod_cell_3,mod_cell_5,mod_cell_6,mod_cell_7,mod_cell_8,mod_cell_9,mod_cell_10)) - - coolant_cell_1 = openmc.Cell(name='coolant', fill=coolant , region=-cool_radius) - coolant_cell_2 = openmc.Cell(name='matrix', fill=matrix , region=+cool_radius & +sz_cl & -sz_up) - coolant_cell_3 = openmc.Cell(name='reflL', fill=refl , region=+cool_radius & -sz_cl) - coolant_cell_4 = openmc.Cell(name='reflO', fill=refl , region=+cool_radius & +sz_up) - coolant_universe= openmc.Universe(cells=(coolant_cell_1,coolant_cell_2,coolant_cell_3,coolant_cell_4)) - - ctr_cell_1a = openmc.Cell(name='coolant', fill=coolant , region=-ctr_radius & +sz_cl & -cpin_low) - ctr_cell_1b = openmc.Cell(name='abs', fill=boro_ctr , region=-ctr_radius & +cpin_low) - ctr_cell_1c = openmc.Cell(name='refl', fill=refl , region=-ctr_radius & -sz_cl) - ctr_cell_2 = openmc.Cell(name='matrix', fill=matrix , region=+ctr_radius & +sz_cl & -sz_up) - ctr_cell_3 = openmc.Cell(name='reflL', fill=refl , region=+ctr_radius & -sz_cl) - ctr_cell_4 = openmc.Cell(name='reflO', fill=refl , region=+ctr_radius & +sz_up) - ctr_universe= openmc.Universe(cells=(ctr_cell_1a,ctr_cell_1b,ctr_cell_1c, ctr_cell_2,ctr_cell_3,ctr_cell_4)) - - Graph_cell_1= openmc.Cell(name='Graph cell', fill=matrix) - Graph_universe= openmc.Universe(cells=(Graph_cell_1,)) - - # Fill the hexagone with fuel and coolant cells - - assembly_description=[[]]*6 - assembly_description[5]=([ctr_universe]) - assembly_description[4] =([fuel_universe])*6 - assembly_description[3] =([fuel_universe]+[coolant_universe])*6 - assembly_description[2] =([coolant_universe] + [fuel_universe] + [mod_universe] + [coolant_universe] + [fuel_universe] + [mod_universe])*3 - assembly_description[1] =([fuel_universe]+[fuel_universe]+[coolant_universe]+[fuel_universe])*6 - assembly_description[0] =([fuel_universe]+[coolant_universe]+[fuel_universe]+[fuel_universe]+[coolant_universe])*6 - #print(assembly_description) - - lat_core = openmc.HexLattice() - lat_core.center=(0,0) - lat_core.pitch=[pin_pitch] - lat_core.outer=Graph_universe - lat_core.universes=assembly_description - # print(lat_core) - rotated_lat_core = openmc.Cell(fill=lat_core) - rotated_universe_lat_core = openmc.Universe(cells=(rotated_lat_core,)) - new_cell_lat_core=openmc.Cell() - new_cell_lat_core.fill=rotated_universe_lat_core - new_cell_lat_core.rotation=(0.,0.,90.) - new_universe_lat_core = openmc.Universe(cells=(new_cell_lat_core,)) - - main_cell = openmc.Cell(name="MainCell",fill=new_universe_lat_core, region=Hex_Pitch & +min_z & -max_z ) - - - # OpenMC expects that there is a root universe assigned number zero. Here we - # assign our three cells to this root universe. - root_universe = openmc.Universe(name='root universe', cells=(main_cell,)) - - # Finally we must create a geometry and assign the root universe - geometry = openmc.Geometry() - geometry.root_universe = root_universe - geometry.export_to_xml() - - # Now let's define our simulation parameters. These will go into our - # settings.xml via the SettingsFile object. - batches = 100 - inactive = 30 - particles = 5000 - - # Instantiate a SettingsFile - settings_file = openmc.Settings() - settings_file.run_mode = 'eigenvalue' - settings_file.cross_sections = '/software/openmc/data/v0.12pre-3/lanl_endfb80/cross_sections.xml' - settings_file.batches = batches - settings_file.inactive = inactive - settings_file.particles = particles - settings_file.material_cell_offsets = False - settings_file.temperature = {'method' : 'interpolation'} - - source = openmc.Source() - ll = [-params['Assembly_pitch']/4, -params['Assembly_pitch']/4, Z_min] - ur = [params['Assembly_pitch']/4, params['Assembly_pitch']/4, Z_max] - source.space = openmc.stats.Box(ll, ur) - source.strength = 1.0 - settings_file.source = source - - #lower_left, upper_right = main_cell.region.bounding_box - - list_tally_cell = [cell.id for cell in TALLY_REGIONS] - list_tally_scores = ['flux', 'nu-fission'] - cell_filter = openmc.CellFilter(list_tally_cell) - tally_file = openmc.Tally() - tally_file.filters.append(cell_filter) - tally_file.scores = list_tally_scores - tallies = openmc.Tallies() - tallies.append(tally_file) - tallies.export_to_xml() - - settings_file.export_to_xml() - - # Create a plots.xml file - radius = params['Assembly_pitch']/sqrt(3) - p1 = openmc.Plot() - p1.origin = (0, 0, (Z_max-Z_min)/2) - p1.width = (radius*2, radius*2) - p1.pixels = (2000, 2000) - p1.color = 'mat' - p1.basis = 'xy' - p1.color_by = 'material' - p1.col_spec = { - homfuel1.id: (255, 0, 0), - homfuel2.id: (255, 0, 0), - homfuel3.id: (255, 0, 0), - homfuel4.id: (255, 0, 0), - homfuel5.id: (255, 0, 0), - matrix.id: (100, 100, 100), - yh2.id: (20, 200, 50), - boro_ctr.id: (200, 20, 50), - shell_mod.id: (150,150,150), - coolant.id: (180,110,150), - refl.id: (80,210,50) - } - p2 = openmc.Plot() - p2.origin = (0, 0, (Z_max-Z_min)/2) - p2.width = (radius*2, Z_max) - p2.pixels = (200, 2000) - p2.color = 'mat' - p2.basis ='yz' - p2.color_by = 'material' - p2.col_spec = { - homfuel1.id: (255, 0, 0), - homfuel2.id: (255, 0, 0), - homfuel3.id: (255, 0, 0), - homfuel4.id: (255, 0, 0), - homfuel5.id: (255, 0, 0), - matrix.id: (100, 100, 100), - yh2.id: (20, 200, 50), - boro_ctr.id: (200, 20, 50), - shell_mod.id: (150,150,150), - coolant.id: (180,110,150), - refl.id: (80,210,50) - } - p3 = openmc.Plot() - p3.origin = (0, 0, (Z_max-1)) - p3.width = (radius*2, radius*2) - p3.pixels = (2000, 2000) - p3.color = 'mat' - p3.basis = 'xy' - p3.color_by = 'material' - p3.col_spec = { - homfuel1.id: (255, 0, 0), - homfuel2.id: (255, 0, 0), - homfuel3.id: (255, 0, 0), - homfuel4.id: (255, 0, 0), - homfuel5.id: (255, 0, 0), - matrix.id: (100, 100, 100), - yh2.id: (20, 200, 50), - boro_ctr.id: (200, 20, 50), - shell_mod.id: (150,150,150), - coolant.id: (180,110,150), - refl.id: (80,210,50) - } - plots = openmc.Plots() - plots.append(p1) - plots.append(p2) - plots.append(p3) - plots.export_to_xml() diff --git a/src/watts_ui/examples/PicardIterations_SAM-OpenMC_VHTR/sam_template b/src/watts_ui/examples/PicardIterations_SAM-OpenMC_VHTR/sam_template deleted file mode 100644 index 6742c196..00000000 --- a/src/watts_ui/examples/PicardIterations_SAM-OpenMC_VHTR/sam_template +++ /dev/null @@ -1,574 +0,0 @@ - - {#- - Create variables - #} - {%- set Mass_flow_rate = Tot_assembly_power / (He_cp * (He_outlet_temp - He_inlet_temp)) %} - {%- set Channel_mass_flow_rate = Mass_flow_rate / num_cool_pins %} - {%- set Coolant_channel_XS = 3.14 * (Coolant_channel_diam/2)**2 %} - {%- set He_velocity = Channel_mass_flow_rate / (He_density * Coolant_channel_XS) %} - {%- set Re_num = Coolant_channel_diam * He_velocity * He_density / He_viscosity %} - {%- set Prandtl_num = He_cp * He_viscosity / He_K %} - {%- set F_blausius = (100*Re_num)**(-0.25) %} - {%- set Nu_DittBoe = 0.023 * (Re_num ** 0.8) * (Prandtl_num ** 0.4) %} - {%- set H_sam = Nu_DittBoe * He_K / Coolant_channel_diam %} - {%- set total_XS_coolant_area_per_fuel_assembly = Coolant_channel_XS * num_cool_pins %} - {%- set surface_area_den = num_fuel_pins * 3.14 * 2 * (FuelPin_rad + Graphite_thickness) / (100 * num_cool_pins * Coolant_channel_XS) %} - {%- set Power_fuel_pin = Tot_assembly_power / (num_fuel_pins) %} - {%- set graph_x = Coolant_channel_diam / 2 + Graphite_thickness / 100 %} - {%- set fuel_x = graph_x + FuelPin_rad / 100 %} - {#- - Render the parameters - #} - -[GlobalParams] - global_init_P = {{ He_Pressure }} - global_init_V = {{ He_velocity }} - global_init_T = {{ He_inlet_temp }} - gravity = '-9.8 0 0' - scaling_factor_var = '1 1e-3 1e-6' - Tsolid_sf = 1e-3 # Scaling factors for solid temperature -[] -[Functions] - active = 'power_dist kf cpf kclad cpclad rhoclad kgraphite cpgraphite rhographite kHe cpHe rhoHe muHe HHe beta_fn' - # [./power_dist] # Function name - # type = PiecewiseLinear # Function type - # axis = x # X-co-ordinate is used for x - # x = ' 0.0 0.5 1.0 1.5 2.0' - # y = ' {{ Init_P_1 }} {{ Init_P_2 }} {{ Init_P_3 }} {{ Init_P_4 }} {{ Init_P_5 }}' - # [../] - - [./power_dist] # Function name - type = PiecewiseLinear # Function type - axis = x # X-co-ordinate is used for x - x = ' 0.0 0.5 1.0 1.5 2.0' - y = ' 1.0 1.0 1.0 1.0 1.0' - [../] - - - [./kf] #fuel thermal conductivity (UO2); x- Temperature [K], y- Thermal condiuctivity [W/m-K] - type = PiecewiseLinear - x ='600 700 800 900 1000 1100 1200 1300 1400 1500' - y ='55.6153061 51.02219975 47.11901811 43.95203134 41.16924224 38.85202882 36.89323509 35.04777834 33.20027175 31.3520767' - [../] - [./cpf] #fuel matrix specific heat (UO2); x- Temperature [K], y- sp. heat [J/kg-K] - type = PiecewiseLinear - x ='300 325 350 375 400 425 450 475 500 525 550 575 600 625 650 675 700 725 750 775 800 825 850 875 900 925 950 975 1000 1025 1050 1075 1100 1125 1150 1175 1200 1225 1250 1275 1300 1325 1350 1375 1400 1425 1450 1475 1500' - y ='44.87198213 57.09373669 71.35471375 87.81224925 106.6236791 127.9463393 151.9375658 178.7546944 208.5550611 241.4960019 277.7348528 317.4289495 360.7356281 407.8122246 458.8160748 513.9045146 573.2348801 636.9645072 705.2507318 778.2508898 856.1223171 939.0223498 1027.108324 1120.537575 1219.467439 1324.055252 1434.458351 1550.83407 1673.339746 1802.132715 1937.370313 2079.209875 2227.808738 2383.324238 2545.91371 2715.73449 2892.943915 3077.69932 3270.158042 3470.477415 3678.814777 3895.327463 4120.172809 4353.508151 4595.490824 4846.278166 5106.027511 5374.896196 5653.041556' - [../] - [./kclad] #clad therm. cond; x- Temperature [K], y-Thermal condiuctivity [W/m-K] - type = PiecewiseLinear - x ='0 478.1709374 571.7659 668.7480342 769.1357153 871.2212698 969.9012774 1068.58496 1167.263743 1274.445367 2118.255351 5000' - y ='3.812850324 3.812850324 3.453993823 3.678279136 3.812850324 4.0819927 4.440849201 4.665134514 5.068848078 5.651989892 11.43855097 11.43855097' - [../] - [./cpclad] #clad specific heat; x- Temperature [K], y- sp. heat [J/kg-K] - type = PiecewiseLinear - x ='300 325 350 375 400 425 450 475 500 525 550 575 600 625 650 675 700 725 750 775 800 825 850 875 900 925 950 975 1000 1025 1050 1075 1100 1125 1150 1175 1200 1225 1250 1275 1300 1325 1350 1375 1400 1425 1450 1475 1500' - y ='286.38 288.94 291.5 294.06 296.62 299.18 301.74 304.3 306.86 309.42 311.98 314.54 317.1 319.66 322.22 324.78 327.34 329.9 332.46 335.02 337.58 340.14 342.7 345.26 347.82 350.38 352.94 355.5 358.06 360.62 363.18 365.74 336.785 335.2703125 333.95125 332.8278125 331.9 331.1678125 330.63125 330.2903125 330.145 330.1953125 330.44125 330.8828125 331.52 332.3528125 333.38125 334.6053125 336.025' - [../] - [./rhoclad] #clad density; x- Temperature [K], y- density [kg/m3] - type = PiecewiseLinear - x ='300 325 350 375 400 425 450 475 500 525 550 575 600 625 650 675 700 725 750 775 800 825 850 875 900 925 950 975 1000 1025 1050 1075 1100 1125 1150 1175 1200 1225 1250 1275 1300 1325 1350 1375 1400 1425 1450 1475 1500' - y ='6550.89 6547.1975 6543.505 6539.8125 6536.12 6532.4275 6528.735 6525.0425 6521.35 6517.6575 6513.965 6510.2725 6506.58 6502.8875 6499.195 6495.5025 6491.81 6488.1175 6484.425 6480.7325 6477.04 6473.3475 6469.655 6465.9625 6462.27 6458.5775 6454.885 6451.1925 6447.5 6443.8075 6440.115 6436.4225 6485.95 6481.3125 6476.675 6472.0375 6467.4 6462.7625 6458.125 6453.4875 6448.85 6444.2125 6439.575 6434.9375 6430.3 6425.6625 6421.025 6416.3875 6411.75' - [../] - [./kgraphite] #G-348 graphite therm. cond; x- Temperature [K], y-Thermal condiuctivity [W/m-K] - type = PiecewiseLinear - x ='295.75 374.15 472.45 574.75 674.75 774.75 874.75 974.85 1074.45 1173.95 1274.05' - y ='133.02 128.54 117.62 106.03 96.7 88.61 82.22 76.52 71.78 67.88 64.26' - [../] - [./cpgraphite] #G-348 graphite specific heat; x- Temperature [K], y- sp. heat [J/kg-K] - type = PiecewiseLinear - x ='295.75 374.15 472.45 574.75 674.75 774.75 874.75 974.85 1074.45 1173.95 1274.05' - y ='726.19 933.15 1154.47 1341.07 1486.83 1603.53 1697.43 1773.6 1835.58 1886.68 1929.44' - [../] - [./rhographite] #G-348 graphite density; x- Temperature [K], y- density [kg/m3] - type = PiecewiseLinear - x ='295.75 374.15 472.45 574.75 674.75 774.75 874.75 974.85 1074.45 1173.95 1274.05' - y ='1888.5 1886.3 1883.5 1880.4 1877.2 1873.9 1870.5 1867 1863.4 1859.6 1855.7' - [../] - [./kHe] #Helium therm. cond; x- Temperature [K], y-Thermal condiuctivity [W/m-K] - type = PiecewiseLinear - x ='300 320 340 360 380 400 420 440 460 480 500 520 540 560 580 600 620 640 660 680 700 720 740 760 780 800 820 840 860 880 900 920 940 960 980 1000 1020 1040 1060 1080 1100 1120 1140 1160 1180 1200 1220 1240 1260 1280 1300 1320 1340 1360 1380 1400 1420 1440 1460 1480 1500' - y ='0.16053 0.16754 0.17444 0.18123 0.18792 0.19451 0.20102 0.20743 0.21377 0.22003 0.22622 0.23233 0.23838 0.24437 0.2503 0.25616 0.26198 0.26773 0.27344 0.27909 0.2847 0.29026 0.29578 0.30126 0.30669 0.31208 0.31743 0.32275 0.32802 0.33327 0.33847 0.34365 0.34879 0.3539 0.35897 0.36402 0.36904 0.37403 0.37899 0.38392 0.38883 0.39371 0.39856 0.40339 0.4082 0.41298 0.41774 0.42248 0.42719 0.43188 0.43655 0.4412 0.44583 0.45043 0.45502 0.45959 0.46414 0.46867 0.47318 0.47767 0.48215' - [../] - [./muHe] #Helium viscosity; x- Temperature [K], y-viscosity [Pa.s] - type = PiecewiseLinear - x ='300 320 340 360 380 400 420 440 460 480 500 520 540 560 580 600 620 640 660 680 700 720 740 760 780 800 820 840 860 880 900 920 940 960 980 1000 1020 1040 1060 1080 1100 1120 1140 1160 1180 1200 1220 1240 1260 1280 1300 1320 1340 1360 1380 1400 1420 1440 1460 1480 1500' - y ='0.00002016 0.0002148 0.000021921 0.000022782 0.00002363 0.000024467 0.000025294 0.00002611 0.000026917 0.000027715 0.000028504 0.000029285 0.000030058 0.000030823 0.000031582 0.000032333 0.000033078 0.000033816 0.000034549 0.000035275 0.000035996 0.000036711 0.00003742 0.000038125 0.000038825 0.00003952 0.00004021 0.000040895 0.000041576 0.000042253 0.000042926 0.000043595 0.00004426 0.00004492 0.000045578 0.000046231 0.000046881 0.000047528 0.000048171 0.000048811 0.000049447 0.000050081 0.000050711 0.000051338 0.000051963 0.000052584 0.000053203 0.000053818 0.000054432 0.000055042 0.00005565 0.000056255 0.000056858 0.000057458 0.000058056 0.000058651 0.000059244 0.000059835 0.000060424 0.00006101 0.000061594' - [../] - [./cpHe] #Helium specific heat; x- Temperature [K], y- sp. heat [J/kg-K] - type = PiecewiseLinear - x ='300 320 340 360 380 400 420 440 460 480 500 520 540 560 580 600 620 640 660 680 700 720 740 760 780 800 820 840 860 880 900 920 940 960 980 1000 1020 1040 1060 1080 1100 1120 1140 1160 1180 1200 1220 1240 1260 1280 1300 1320 1340 1360 1380 1400 1420 1440 1460 1480 1500' - y ='5188.5 5188 5187.6 5187.4 5187.2 5187.2 5187.1 5187.2 5187.2 5187.3 5187.4 5187.5 5187.6 5187.7 5187.8 5187.9 5188 5188.1 5188.2 5188.3 5188.4 5188.5 5188.7 5188.8 5188.8 5188.9 5189 5189.1 5189.2 5189.3 5189.4 5189.5 5189.5 5189.6 5189.7 5189.7 5189.8 5189.9 5189.9 5190 5190.1 5190.1 5190.2 5190.2 5190.3 5190.3 5190.4 5190.4 5190.5 5190.5 5190.6 5190.6 5190.7 5190.7 5190.7 5190.8 5190.8 5190.8 5190.9 5190.9 5190.9' - [../] - [./rhoHe] #Helium density; x- Temperature [K], y- density [kg/m3] - type = PiecewiseLinear - x ='300 320 340 360 380 400 420 440 460 480 500 520 540 560 580 600 620 640 660 680 700 720 740 760 780 800 820 840 860 880 900 920 940 960 980 1000 1020 1040 1060 1080 1100 1120 1140 1160 1180 1200 1220 1240 1260 1280 1300 1320 1340 1360 1380 1400 1420 1440 1460 1480 1500' - y ='10.883 10.225 9.6425 9.1224 8.6555 8.234 7.8516 7.5031 7.1842 6.8912 6.6212 6.3715 6.14 5.9246 5.7239 5.5363 5.3605 5.1956 5.0405 4.8944 4.7565 4.6262 4.5028 4.3858 4.2747 4.1691 4.0686 3.9729 3.8815 3.7942 3.7108 3.6309 3.5545 3.4811 3.4108 3.3432 3.2782 3.2157 3.1556 3.0976 3.0418 2.9879 2.9359 2.8857 2.8371 2.7902 2.7448 2.7009 2.6583 2.617 2.577 2.5383 2.5006 2.4641 2.4286 2.3941 2.3606 2.328 2.2963 2.2655 2.2354' - [../] - [./HHe] #Helium Enthalpy; x- Temperature [K], y- denthalpy [j/kg] - type = PiecewiseLinear - x ='300 320 340 360 380 400 420 440 460 480 500 520 540 560 580 600 620 640 660 680 700 720 740 760 780 800 820 840 860 880 900 920 940 960 980 1000 1020 1040 1060 1080 1100 1120 1140 1160 1180 1200 1220 1240 1260 1280 1300 1320 1340 1360 1380 1400 1420 1440 1460 1480 1500' - y ='1585700 1689500 1793300 1897000 2000800 2104500 2208200 2312000 2415700 2519500 2623200 2727000 2830700 2934500 3038200 3142000 3245700 3349500 3453300 3557000 3660800 3764600 3868300 3972100 4075900 4179700 4283400 4387200 4491000 4594800 4698600 4802400 4906200 5010000 5113700 5217500 5321300 5425100 5528900 5632700 5736500 5840300 5944100 6047900 6151700 6255600 6359400 6463200 6567000 6670800 6774600 6878400 6982200 7086000 7189800 7293700 7397500 7501300 7605100 7708900 7812700' - [../] - [./beta_fn] - type = PiecewiseLinear - x = '300 2000' - y = '0 0' - [../] - - [./T_max_fuel] - type = ParsedFunction - value = Tf1+Tf2 - vars = 'Tf1 Tf2' - vals = 'max_Tf_1 max_Tf_2' - [../] - -[] -[EOS] - [./eos] - type = PTFluidPropertiesEOS - p_0 = {{ He_Pressure }} # Pa - fp = fluid_props1 - [../] -[] -[MaterialProperties] - [./fluid_props1] - type = FunctionFluidProperties - rho = rhoHe - beta = beta_fn - cp = cpHe - mu = muHe - k = kHe - enthalpy = HHe - [../] - [./fuel-mat] # Material name - type = SolidMaterialProps - k = kf # Thermal conductivity - Cp = cpf # Specific heat - rho = 1.104e4 # Density - [../] - [./clad-mat] # Material name - type = SolidMaterialProps - k = kgraphite # Thermal conductivity - Cp = cpgraphite # Specific heat - rho = rhographite # Density - [../] - [./graphite-mat] # Material name - type = SolidMaterialProps - k = kgraphite # Thermal conductivity - Cp = cpgraphite # Specific heat - rho = rhographite # Density - [../] - [./leadBUF-mat] # Material name - type = SolidMaterialProps - k = kgraphite # Thermal conductivity - Cp = cpgraphite # Specific heat - rho = rhographite # Density - [../] -[] -[Components] - [./reactor] - type = ReactorPower - initial_power = {{ Tot_assembly_power }} # Initial total reactor power - [../] - - [./CH1] # Component name - type = PBCoreChannel # PBCorechannel component - eos = eos # The equation-of-state name - position = '0 {{Height_FC/5 * 0}} 0' - orientation = '0 1 0' - assembly_type = Block-Channel - n_rods = {{ num_fuel_pins }} - A = {{ total_XS_coolant_area_per_fuel_assembly }} - Dh = {{ Coolant_channel_diam }} - length = {{ Height_FC/5 }} - n_elems = 20 - f = {{ F_blausius }} # User specified friction coefficient (Blausis f=(100 Re)^-0.25 - Hw = {{ H_sam }} # User specified heat transfer coefficient (Dittus-Boelter) - HT_surface_area_density = {{ surface_area_den }} # Heat transfer surface area density, Ph/Ac - name_of_hs = 'fuel graphite' # Heat structure names - Ts_init = {{ He_inlet_temp }} # Initial structure temeprature - n_heatstruct = 2 # Number of heat structures - fuel_type = cylinder # Fuel geometric type, cylinder or plate - width_of_hs = '{{FuelPin_rad/100}} {{ Graphite_thickness/100 }}' # The width of all heat structures - elem_number_of_hs = '50 10' # The element numbers of all heat structures - material_hs = 'fuel-mat graphite-mat' # The material used for all heat structures - power_fraction = '0.2 0.0' # The power fractions of all heat structures - power_shape_function = power_dist # the axial power shape function name - [../] - - [./CH2] # Component name - type = PBCoreChannel # PBCorechannel component - eos = eos # The equation-of-state name - position = '0 {{Height_FC/5 * 1}} 0' - orientation = '0 1 0' - assembly_type = Block-Channel - n_rods = {{ num_fuel_pins }} - A = {{ total_XS_coolant_area_per_fuel_assembly }} - Dh = {{ Coolant_channel_diam }} - length = {{ Height_FC/5 }} - n_elems = 20 - f = {{ F_blausius }} # User specified friction coefficient (Blausis f=(100 Re)^-0.25 - Hw = {{ H_sam }} # User specified heat transfer coefficient (Dittus-Boelter) - HT_surface_area_density = {{ surface_area_den }} # Heat transfer surface area density, Ph/Ac - name_of_hs = 'fuel graphite' # Heat structure names - Ts_init = {{ He_inlet_temp }} # Initial structure temeprature - n_heatstruct = 2 # Number of heat structures - fuel_type = cylinder # Fuel geometric type, cylinder or plate - width_of_hs = '{{FuelPin_rad/100}} {{ Graphite_thickness/100 }}' # The width of all heat structures - elem_number_of_hs = '50 10' # The element numbers of all heat structures - material_hs = 'fuel-mat graphite-mat' # The material used for all heat structures - power_fraction = '0.2 0.0' # The power fractions of all heat structures - power_shape_function = power_dist # the axial power shape function name - [../] - - [./CH3] # Component name - type = PBCoreChannel # PBCorechannel component - eos = eos # The equation-of-state name - position = '0 {{Height_FC/5 * 2}} 0' - orientation = '0 1 0' - assembly_type = Block-Channel - n_rods = {{ num_fuel_pins }} - A = {{ total_XS_coolant_area_per_fuel_assembly }} - Dh = {{ Coolant_channel_diam }} - length = {{ Height_FC/5 }} - n_elems = 20 - f = {{ F_blausius }} # User specified friction coefficient (Blausis f=(100 Re)^-0.25 - Hw = {{ H_sam }} # User specified heat transfer coefficient (Dittus-Boelter) - HT_surface_area_density = {{ surface_area_den }} # Heat transfer surface area density, Ph/Ac - name_of_hs = 'fuel graphite' # Heat structure names - Ts_init = {{ He_inlet_temp }} # Initial structure temeprature - n_heatstruct = 2 # Number of heat structures - fuel_type = cylinder # Fuel geometric type, cylinder or plate - width_of_hs = '{{FuelPin_rad/100}} {{ Graphite_thickness/100 }}' # The width of all heat structures - elem_number_of_hs = '50 10' # The element numbers of all heat structures - material_hs = 'fuel-mat graphite-mat' # The material used for all heat structures - power_fraction = '0.2 0.0' # The power fractions of all heat structures - power_shape_function = power_dist # the axial power shape function name - [../] - - [./CH4] # Component name - type = PBCoreChannel # PBCorechannel component - eos = eos # The equation-of-state name - position = '0 {{Height_FC/5 * 3}} 0' - orientation = '0 1 0' - assembly_type = Block-Channel - n_rods = {{ num_fuel_pins }} - A = {{ total_XS_coolant_area_per_fuel_assembly }} - Dh = {{ Coolant_channel_diam }} - length = {{ Height_FC/5 }} - n_elems = 20 - f = {{ F_blausius }} # User specified friction coefficient (Blausis f=(100 Re)^-0.25 - Hw = {{ H_sam }} # User specified heat transfer coefficient (Dittus-Boelter) - HT_surface_area_density = {{ surface_area_den }} # Heat transfer surface area density, Ph/Ac - name_of_hs = 'fuel graphite' # Heat structure names - Ts_init = {{ He_inlet_temp }} # Initial structure temeprature - n_heatstruct = 2 # Number of heat structures - fuel_type = cylinder # Fuel geometric type, cylinder or plate - width_of_hs = '{{FuelPin_rad/100}} {{ Graphite_thickness/100 }}' # The width of all heat structures - elem_number_of_hs = '50 10' # The element numbers of all heat structures - material_hs = 'fuel-mat graphite-mat' # The material used for all heat structures - power_fraction = '0.2 0.0' # The power fractions of all heat structures - power_shape_function = power_dist # the axial power shape function name - [../] - - [./CH5] # Component name - type = PBCoreChannel # PBCorechannel component - eos = eos # The equation-of-state name - position = '0 {{Height_FC/5 * 4}} 0' - orientation = '0 1 0' - assembly_type = Block-Channel - n_rods = {{ num_fuel_pins }} - A = {{ total_XS_coolant_area_per_fuel_assembly }} - Dh = {{ Coolant_channel_diam }} - length = {{ Height_FC/5 }} - n_elems = 20 - f = {{ F_blausius }} # User specified friction coefficient (Blausis f=(100 Re)^-0.25 - Hw = {{ H_sam }} # User specified heat transfer coefficient (Dittus-Boelter) - HT_surface_area_density = {{ surface_area_den }} # Heat transfer surface area density, Ph/Ac - name_of_hs = 'fuel graphite' # Heat structure names - Ts_init = {{ He_inlet_temp }} # Initial structure temeprature - n_heatstruct = 2 # Number of heat structures - fuel_type = cylinder # Fuel geometric type, cylinder or plate - width_of_hs = '{{FuelPin_rad/100}} {{ Graphite_thickness/100 }}' # The width of all heat structures - elem_number_of_hs = '50 10' # The element numbers of all heat structures - material_hs = 'fuel-mat graphite-mat' # The material used for all heat structures - power_fraction = '0.2 0.0' # The power fractions of all heat structures - power_shape_function = power_dist # the axial power shape function name - [../] - - [./junc_CH1_CH2] - type = PBSingleJunction - eos = eos - inputs = 'CH1(out)' - outputs = 'CH2(in)' - [../] - [./junc_CH2_CH3] - type = PBSingleJunction - eos = eos - inputs = 'CH2(out)' - outputs = 'CH3(in)' - [../] - [./junc_CH3_CH4] - type = PBSingleJunction - eos = eos - inputs = 'CH3(out)' - outputs = 'CH4(in)' - [../] - [./junc_CH4_CH5] - type = PBSingleJunction - eos = eos - inputs = 'CH4(out)' - outputs = 'CH5(in)' - [../] - - - [./inlet] #Boundary components - type = PBTDJ - input = 'CH1(in)' - v_bc = {{ He_velocity }} - T_bc = {{ He_inlet_temp }} - eos = eos - [../] - [./outlet] - type = PBTDV - input = 'CH5(out)' - p_bc = '{{ He_Pressure }}' - T_bc = {{ He_outlet_temp }} - eos = eos - [../] -[] -[Postprocessors] - -# [max_Tf] -# type = ParsedPostprocessor -# function = 'max(max(max_Tf_1,max_Tf_2),max(max_Tf_3,max(max_Tf_4,max_Tf_5)))' -# pp_names = 'max_Tf_1 max_Tf_2 max_Tf_3 max_Tf_4 max_Tf_5' -# [] -# -# [avg_Tgraphite] -# type = ParsedPostprocessor -# function = '(avg_Tgraphite_1+avg_Tgraphite_2+avg_Tgraphite_3+avg_Tgraphite_4+avg_Tgraphite_5)/5' -# pp_names = 'avg_Tgraphite_1 avg_Tgraphite_2 avg_Tgraphite_3 avg_Tgraphite_4 avg_Tgraphite_5' -# [] - - [./max_Tcoolant] # Output maximum fluid temperature of block CH1:pipe - type = NodalMaxValue - block = 'CH1:pipe' - variable = temperature - [../] - [./max_Tw] # Output maximum wall temperature of block CH1:pipe - type = NodalMaxValue - block = 'CH1:pipe' - variable = Tw - [../] - [./max_Tf_1] # Output maximum solid temperature of block CH1: solid:fuel - type = NodalMaxValue - block = 'CH1:solid:fuel' - variable = T_solid - [../] - [./max_Tf_2] # Output maximum solid temperature of block CH1: solid:fuel - type = NodalMaxValue - block = 'CH2:solid:fuel' - variable = T_solid - [../] - [./max_Tf_3] # Output maximum solid temperature of block CH1: solid:fuel - type = NodalMaxValue - block = 'CH3:solid:fuel' - variable = T_solid - [../] - [./max_Tf_4] # Output maximum solid temperature of block CH1: solid:fuel - type = NodalMaxValue - block = 'CH4:solid:fuel' - variable = T_solid - [../] - [./max_Tf_5] # Output maximum solid temperature of block CH1: solid:fuel - type = NodalMaxValue - block = 'CH5:solid:fuel' - variable = T_solid - [../] - [./max_Tgraphite_1] # Output maximum solid temperature of block CH1: solid:fuel - type = NodalMaxValue - block = 'CH1:solid:graphite' - variable = T_solid - [../] - [./max_Tgraphite_2] # Output maximum solid temperature of block CH1: solid:fuel - type = NodalMaxValue - block = 'CH2:solid:graphite' - variable = T_solid - [../] - [./max_Tgraphite_3] # Output maximum solid temperature of block CH1: solid:fuel - type = NodalMaxValue - block = 'CH3:solid:graphite' - variable = T_solid - [../] - [./max_Tgraphite_4] # Output maximum solid temperature of block CH1: solid:fuel - type = NodalMaxValue - block = 'CH4:solid:graphite' - variable = T_solid - [../] - [./max_Tgraphite_5] # Output maximum solid temperature of block CH1: solid:fuel - type = NodalMaxValue - block = 'CH5:solid:graphite' - variable = T_solid - [../] - - [./max_Pcoolant_1] # Output maximum fluid temperature of block CH1:pipe - type = NodalMaxValue - block = 'CH1:pipe' - variable = pressure - [../] - [./max_Pcoolant_2] # Output maximum fluid temperature of block CH1:pipe - type = NodalMaxValue - block = 'CH2:pipe' - variable = pressure - [../] - [./max_Pcoolant_3] # Output maximum fluid temperature of block CH1:pipe - type = NodalMaxValue - block = 'CH3:pipe' - variable = pressure - [../] - [./max_Pcoolant_4] # Output maximum fluid temperature of block CH1:pipe - type = NodalMaxValue - block = 'CH4:pipe' - variable = pressure - [../] - [./max_Pcoolant_5] # Output maximum fluid temperature of block CH1:pipe - type = NodalMaxValue - block = 'CH5:pipe' - variable = pressure - [../] - - [./avg_Tcoolant_1] # Output maximum fluid temperature of block CH1:pipe - type = ElementAverageValue - block = 'CH1:pipe' - variable = temperature - [../] - [./avg_Tcoolant_2] # Output maximum fluid temperature of block CH1:pipe - type = ElementAverageValue - block = 'CH2:pipe' - variable = temperature - [../] - [./avg_Tcoolant_3] # Output maximum fluid temperature of block CH1:pipe - type = ElementAverageValue - block = 'CH3:pipe' - variable = temperature - [../] - [./avg_Tcoolant_4] # Output maximum fluid temperature of block CH1:pipe - type = ElementAverageValue - block = 'CH4:pipe' - variable = temperature - [../] - [./avg_Tcoolant_5] # Output maximum fluid temperature of block CH1:pipe - type = ElementAverageValue - block = 'CH5:pipe' - variable = temperature - [../] - - [./avg_Tf_1] # Output maximum solid temperature of block CH1: solid:fuel - type = ElementAverageValue - block = 'CH1:solid:fuel' - variable = T_solid - [../] - [./avg_Tf_2] # Output maximum solid temperature of block CH1: solid:fuel - type = ElementAverageValue - block = 'CH2:solid:fuel' - variable = T_solid - [../] - [./avg_Tf_3] # Output maximum solid temperature of block CH1: solid:fuel - type = ElementAverageValue - block = 'CH3:solid:fuel' - variable = T_solid - [../] - [./avg_Tf_4] # Output maximum solid temperature of block CH1: solid:fuel - type = ElementAverageValue - block = 'CH4:solid:fuel' - variable = T_solid - [../] - [./avg_Tf_5] # Output maximum solid temperature of block CH1: solid:fuel - type = ElementAverageValue - block = 'CH5:solid:fuel' - variable = T_solid - [../] - - [./avg_Tgraphite_1] # Output maximum solid temperature of block CH1: solid:fuel - type = ElementAverageValue - block = 'CH1:solid:graphite' - variable = T_solid - [../] - [./avg_Tgraphite_2] # Output maximum solid temperature of block CH1: solid:fuel - type = ElementAverageValue - block = 'CH2:solid:graphite' - variable = T_solid - [../] - [./avg_Tgraphite_3] # Output maximum solid temperature of block CH1: solid:fuel - type = ElementAverageValue - block = 'CH3:solid:graphite' - variable = T_solid - [../] - [./avg_Tgraphite_4] # Output maximum solid temperature of block CH1: solid:fuel - type = ElementAverageValue - block = 'CH4:solid:graphite' - variable = T_solid - [../] - [./avg_Tgraphite_5] # Output maximum solid temperature of block CH1: solid:fuel - type = ElementAverageValue - block = 'CH5:solid:graphite' - variable = T_solid - [../] -[] -[VectorPostprocessors] - [./vel] - type = LineValueSampler - variable = velocity - start_point = '0 0 0' - end_point = '0 {{ Height_FC/5 }} 0' - num_points = 21 - use_displaced_mesh = true - sort_by = id - [../] -[] -[Preconditioning] - active = 'SMP_PJFNK' - [./SMP_PJFNK] - type = SMP - full = true - solve_type = 'PJFNK' - petsc_options_iname = '-pc_type' - petsc_options_value = 'lu' - [../] -[] -[Executioner] - type = Steady - petsc_options_iname = '-ksp_gmres_restart' - petsc_options_value = '300' - nl_rel_tol = 1e-9 - nl_abs_tol = 1e-7 - nl_max_its = 20 - l_tol = 1e-5 - l_max_its = 50 - [./Quadrature] - type = TRAP - order = FIRST - [../] -[] - -[Outputs] - print_linear_residuals = false - perf_graph = true - [./out] - type = Checkpoint - [../] - [./console] - type = Console - [../] - [./out_displaced] - type = Exodus - use_displaced = true - execute_on = 'initial timestep_end' - sequence = false - [../] - [./csv] - type = CSV - [../] -[] diff --git a/src/watts_ui/examples/PicardIterations_SAM-OpenMC_VHTR/watts_comprehensive.son b/src/watts_ui/examples/PicardIterations_SAM-OpenMC_VHTR/watts_comprehensive.son deleted file mode 100644 index 46b9357f..00000000 --- a/src/watts_ui/examples/PicardIterations_SAM-OpenMC_VHTR/watts_comprehensive.son +++ /dev/null @@ -1,74 +0,0 @@ -watts{ - % Change the working directory to the directory where the input files are stored. This is necessary - % due to how WATTS copies input files to the temporary working directory. - workflow_dir = "/Users/zhieejhiaooi/Documents/ANL/watts-devel/watts/src/watts_ui/examples/PicardIterations_SAM-OpenMC_VHTR" - - plugins{ - plugin(ID1){ - code = moose - template = "sam_template" - exec_dir= SAM_DIR - exec_name = "sam-opt" - show_stderr = False - show_stdout = False - } - plugin(ID2){ - code = openmc - template = "openmc_template.py" - scores = ["nu-fission"] % Name of scores for OpenMC tallies. This will be the base name used for saving the tallies. - score_names = ["Init_P"] % A more representative name for the scores - } - } - - workflow_level1{ - variables{ - param(He_inlet_temp) {value = 873.15} - param(He_outlet_temp) {value = 1023.15} - param(He_cp) {value = 5189.2} - param(He_K) {value = 0.32802} - param(He_density) {value = 3.8815} - param(He_viscosity) {value = 4.16e-5} - param(He_Pressure) {value = 7e6} - param(Tot_assembly_power) {value = 250000} - - param("Init_P_1") {value = 1} - param("Init_P_2") {value = 1} - param("Init_P_3") {value = 1} - param("Init_P_4") {value = 1} - param("Init_P_5") {value = 1} - - param(ax_ref) {value = 2.0} - param(num_cool_pins) {value = 24} - param(num_fuel_pins) {value = 44} - param(Height_FC) {value = 2.0} - param(Lattice_pitch) {value = 2.0} - param(FuelPin_rad) {value = 0.9} - param(cool_hole_rad) {value = 0.6} - param(Coolant_channel_diam) {value = 0.012} - param(Graphite_thickness) {value = 0.5} - param(Assembly_pitch) {value = 17.3205080756887} - param(lbp_rad) {value = 0.25} - param(mod_ext_rad) {value = 0.90} - param(shell_thick) {value = 0.05} - param(liner_thick) {value = 0.007} - param(control_pin_rad) {value = 9.9, unit = mm} - param(cl) {value = 160.0} - param(pf) {value = 40.0} - param(temp) {value = 700.0} - param(use_sab) = {bool = True} - param(use_sab_BeO) = {bool = True} - param(use_sab_YH2) = {bool = False} - } - - iteration{ - plugin_main = ID1 - plugin_sub = ID2 - nmax = 10 - convergence_params = "keff" - convergence_criteria = 0.0001 - to_sub_params = ["avg_Tf_1" "avg_Tf_2" "avg_Tf_3" "avg_Tf_4" "avg_Tf_5"] - to_main_params = ["Init_P_1" "Init_P_2" "Init_P_3" "Init_P_4" "Init_P_5"] - } - } - -} \ No newline at end of file diff --git a/src/watts_ui/examples/PicardIterations_SAM-OpenMC_VHTR/watts_exec.py b/src/watts_ui/examples/PicardIterations_SAM-OpenMC_VHTR/watts_exec.py deleted file mode 100644 index 5fd2aefc..00000000 --- a/src/watts_ui/examples/PicardIterations_SAM-OpenMC_VHTR/watts_exec.py +++ /dev/null @@ -1,103 +0,0 @@ -# SPDX-FileCopyrightText: 2022 UChicago Argonne, LLC -# SPDX-License-Identifier: MIT - -""" -This example demonstrates how to use WATTS to perform several -iterations where SAM calculations are followed by OpenMC -calculation and temperature/power information are exchanged -until convergence. This example uses a simple VHTR unit-cell -model with 1 coolant channel surrounded by graphite and fuel. -""" - -from pathlib import Path -from math import cos, pi -import os -import watts -from statistics import mean -from openmc_template import build_openmc_model - - -params = watts.Parameters() - -# TH params - -params['He_inlet_temp'] = 600 + 273.15 # K -params['He_outlet_temp'] = 850 + 273.15 # K -params['He_cp'] = 5189.2 # J/kg-K -params['He_K'] = 0.32802 # W/m-K -params['He_density'] = 3.8815 # kg/m3 -params['He_viscosity'] = 4.16e-5 # Pa.s -params['He_Pressure'] = 7e6 # Pa -params['Tot_assembly_power'] = 250000 # W - -for i in range(1, 6): - # params[f'Init_P_{i}'] = 1 # Fraction - params[f'nufission_{i}'] = 1 # Fraction - -# Core design params -params['ax_ref'] = 20 # cm -params['num_cool_pins'] = 1*6+2*6+6*2/2 -params['num_fuel_pins'] = 6+6+6+3*6+2*6/2+6/3 -params['Height_FC'] = 2.0 # m -params['Lattice_pitch'] = 2.0 -params['FuelPin_rad'] = 0.90 # cm -params['cool_hole_rad'] = 0.60 # cm -params['Coolant_channel_diam'] = (params['cool_hole_rad'] * 2)/100 # in m -params['Graphite_thickness'] = (params['Lattice_pitch'] - params['FuelPin_rad'] - params['cool_hole_rad']) # cm -params['Assembly_pitch'] = 7.5 * 2 * params['Lattice_pitch'] / (cos(pi/6) * 2) -params['lbp_rad'] = 0.25 # cm -params['mod_ext_rad'] = 0.90 # cm -params['shell_thick'] = 0.05 # FeCrAl -params['liner_thick'] = 0.007 # Cr -params['control_pin_rad'] = 0.99 # cm - -# Control use of S(a,b) tables -params['use_sab'] = True -params['use_sab_BeO'] = True -params['use_sab_YH2'] = False - -# OpenMC params -params['cl'] = params['Height_FC']*100 - 2 * params['ax_ref'] # cm -params['pf'] = 40 # percent - -# printout params -params.show_summary(show_metadata=True, sort_by='time') -conv_it = True -nmax_it = 5 -conv_criteria = 1e-4 - -app_dir = Path(os.environ["SAM_DIR"]) -list_keff = [] -while conv_it: - # MOOSE Workflow - sam_plugin = watts.PluginMOOSE( - 'sam_template', - executable=app_dir / "sam-opt", - show_stderr=True - ) - sam_result = sam_plugin(params) - - # get temperature from SAM results - # params['temp'] = mean([sam_result.csv_data[f'avg_Tgraphite_{i}'][-1] for i in range(1, 6)]) - params['temp'] = 700 - for i in range(1, 6): - params[f'avg_Tf_{i}'] = sam_result.csv_data[f'avg_Tf_{i}'][-1] - - params.show_summary(show_metadata=False, sort_by='time') - - # Run OpenMC plugin - openmc_plugin = watts.PluginOpenMC(build_openmc_model, show_stderr=True) # show only error - openmc_result = openmc_plugin(params) - print("KEFF = ", openmc_result.keff) - list_keff.append(openmc_result.keff) - - power_fractions = openmc_result.tallies[0].get_values(scores=['nu-fission']).ravel() - for i, power_frac in enumerate(power_fractions): - params[f'nufission_{i+1}'] = power_frac - - if len(list_keff) > 1 and (list_keff[-1]-list_keff[-2])/list_keff[-1] < conv_criteria: - conv_it = False - if len(list_keff) > nmax_it: - conv_it = False -params.show_summary(show_metadata=True, sort_by='time') -print (list_keff) diff --git a/src/watts_ui/wasppy b/src/watts_ui/wasppy deleted file mode 120000 index d9a5444d..00000000 --- a/src/watts_ui/wasppy +++ /dev/null @@ -1 +0,0 @@ -/Applications/Workbench-5.0.1.app/Contents/wasppy \ No newline at end of file diff --git a/src/watts_ui/watts_ui.py b/src/watts_ui/watts_ui.py index 3dee351c..04f797c8 100755 --- a/src/watts_ui/watts_ui.py +++ b/src/watts_ui/watts_ui.py @@ -7,6 +7,8 @@ from typing import Optional import warnings +import openmc + from astropy.units import Quantity import numpy as np # this needs to be installed in Workbench @@ -68,6 +70,8 @@ def create_plugins(plugins): # Initialize nested_plugins['exec_dir'] = None + nested_plugins['exec_name'] = None + nested_plugins['executable'] = None nested_plugins['extra_inputs'] = None nested_plugins['extra_template_inputs'] = None nested_plugins['show_stderr'] = False @@ -81,6 +85,9 @@ def create_plugins(plugins): nested_plugins['exec_dir'] = str(plg.exec_dir.value).strip('\"') if plg.exec_name is not None: nested_plugins['exec_name'] = str(plg.exec_name.value).strip('\"') + if plg.executable is not None: + nested_plugins['executable'] = str( + plg.executable.value).strip('\"') if plg.auto_link_files is not None: nested_plugins['auto_link_files'] = str( plg.auto_link_files.value).strip('\"') @@ -305,20 +312,26 @@ def run_direct(watts_params, plugin): # to the directory of the application. If environment # variable is not set, provide the path to the directory # instead. + if plugin['exec_dir'] is not None: - if plugin['exec_dir'] in os.environ: - app_dir = Path(os.environ[plugin['exec_dir']]) + if plugin['exec_name'] is not None: + if plugin['exec_dir'] in os.environ: + exec = Path(os.environ[plugin['exec_dir']] + ) / plugin['exec_name'] + else: + raise RuntimeError( + f"{plugin['exec_dir']} does not exist in environment.") else: - app_dir = Path(plugin['exec_dir']) + raise RuntimeError( + "Please specify executable name of the application.") + elif (plugin['executable'] is not None): + exec = plugin['executable'] if plugin['code'].upper() == 'MOOSE': - if 'exec_name' not in plugin: - raise RuntimeError( - "Please specify executable name of the MOOSE application.") app_plugin = watts.PluginMOOSE( template_file=plugin['template'], - executable=app_dir / plugin['exec_name'], + executable=exec, extra_inputs=plugin['extra_inputs'], extra_template_inputs=plugin['extra_template_inputs'], show_stdout=plugin['show_stdout'], @@ -327,6 +340,7 @@ def run_direct(watts_params, plugin): elif plugin['code'].upper() == 'PYARC': app_plugin = watts.PluginPyARC( template_file=plugin['template'], + executable=exec, extra_inputs=plugin['extra_inputs'], extra_template_inputs=plugin['extra_template_inputs'], show_stdout=plugin['show_stdout'], @@ -335,6 +349,7 @@ def run_direct(watts_params, plugin): elif plugin['code'].upper() == 'RELAP5': app_plugin = watts.PluginRELAP5( template_file=plugin['template'], + executable=exec, extra_inputs=plugin['extra_inputs'], extra_template_inputs=plugin['extra_template_inputs'], plotfl_to_csv=plugin['plotfl_to_csv'], @@ -344,6 +359,7 @@ def run_direct(watts_params, plugin): elif plugin['code'].upper() == 'SAS': app_plugin = watts.PluginSAS( template_file=plugin['template'], + executable=exec, extra_inputs=plugin['extra_inputs'], extra_template_inputs=plugin['extra_template_inputs'], show_stdout=plugin['show_stdout'], @@ -357,6 +373,7 @@ def run_direct(watts_params, plugin): elif plugin['code'].upper() == 'SERPENT': app_plugin = watts.PluginSerpent( template_file=plugin['template'], + executable=exec, extra_inputs=plugin['extra_inputs'], extra_template_inputs=plugin['extra_template_inputs'], show_stdout=plugin['show_stdout'], @@ -365,6 +382,7 @@ def run_direct(watts_params, plugin): elif plugin['code'].upper() == 'DAKOTA': app_plugin = watts.PluginDakota( template_file=plugin['template'], + executable=exec, extra_inputs=plugin['extra_inputs'], extra_template_inputs=plugin['extra_template_inputs'], auto_link_files=plugin['auto_link_files'], @@ -374,6 +392,7 @@ def run_direct(watts_params, plugin): elif plugin['code'].upper() == 'ABCE': app_plugin = watts.PluginABCE( template_file=plugin['template'], + executable=exec, extra_inputs=plugin['extra_inputs'], extra_template_inputs=plugin['extra_template_inputs'], show_stdout=plugin['show_stdout'], @@ -382,6 +401,7 @@ def run_direct(watts_params, plugin): elif plugin['code'].upper() == 'MCNP': app_plugin = watts.PluginMCNP( template_file=plugin['template'], + executable=exec, extra_inputs=plugin['extra_inputs'], extra_template_inputs=plugin['extra_template_inputs'], show_stdout=plugin['show_stdout'], From 68e7ffe9f28fb86c55cc38de2d0a47f96e8c8c57 Mon Sep 17 00:00:00 2001 From: Zhiee Jhia Ooi Date: Sun, 25 Dec 2022 13:35:29 -0600 Subject: [PATCH 13/18] Moved examples --- .../1App_OpenMC_VHTR/watts_comprehensive.son | 47 ++ .../watts_comprehensive.son | 26 + .../watts_comprehensive.son | 29 + .../1App_SAM_VHTR/watts_comprehensive.son | 59 ++ .../watts_comprehensive.son | 38 ++ .../watts_comprehensive.son | 34 ++ .../README.md | 20 + .../sam_template | 144 +++++ .../watts_comprehensive.son | 35 ++ .../README.md | 22 + .../openmc_template.py | 355 +++++++++++ .../sam_template | 574 ++++++++++++++++++ .../watts_comprehensive.son | 74 +++ scripts/setup_conda_wb.sh | 33 +- scripts/setup_openmc.sh | 86 +++ scripts/workbench.sh | 1 + 16 files changed, 1576 insertions(+), 1 deletion(-) create mode 100644 examples/1App_OpenMC_VHTR/watts_comprehensive.son create mode 100644 examples/1App_PyARC_UnitCell/watts_comprehensive.son create mode 100644 examples/1App_RELAP5_SingleChannel/watts_comprehensive.son create mode 100644 examples/1App_SAM_VHTR/watts_comprehensive.son create mode 100644 examples/1App_SAS_MultiTemplates_SodiumLoop/watts_comprehensive.son create mode 100644 examples/1App_SAS_SodiumLoop/watts_comprehensive.son create mode 100644 examples/ParamStudy_SAM_SimpleJunction_Workbench/README.md create mode 100644 examples/ParamStudy_SAM_SimpleJunction_Workbench/sam_template create mode 100644 examples/ParamStudy_SAM_SimpleJunction_Workbench/watts_comprehensive.son create mode 100644 examples/PicardIterations_SAM-OpenMC_VHTR_Workbench/README.md create mode 100644 examples/PicardIterations_SAM-OpenMC_VHTR_Workbench/openmc_template.py create mode 100644 examples/PicardIterations_SAM-OpenMC_VHTR_Workbench/sam_template create mode 100644 examples/PicardIterations_SAM-OpenMC_VHTR_Workbench/watts_comprehensive.son create mode 100755 scripts/setup_openmc.sh diff --git a/examples/1App_OpenMC_VHTR/watts_comprehensive.son b/examples/1App_OpenMC_VHTR/watts_comprehensive.son new file mode 100644 index 00000000..ec668111 --- /dev/null +++ b/examples/1App_OpenMC_VHTR/watts_comprehensive.son @@ -0,0 +1,47 @@ +watts{ + % Change the working directory to the directory where the input files are stored. This is necessary + % due to how WATTS copies input files to the temporary working directory. + workflow_dir = "/Users/zhieejhiaooi/Documents/ANL/watts-devel/watts/examples/1App_OpenMC_VHTR" + + plugins{ + plugin(ID1){ + code = openmc + template = "openmc_template.py" + scores = ["nu-fission"] % Name of scores for OpenMC tallies. + score_names = ["power"] % A more representative name for the scores. Optional but might be necessary for score names with + % hyphens because Jinja and Workbench have difficulties reading hyphens. + } + } + + workflow_level1{ + plugin = ID1 + variables{ + param(ax_ref) {value = 2.0} + param(num_cool_pins) {value = 24} + param(num_fuel_pins) {value = 44} + param(Height_FC) {value = 2.0} + param(Lattice_pitch) {value = 2.0} + param(FuelPin_rad) {value = 0.9} + param(cool_hole_rad) {value = 0.6} + param(Coolant_channel_diam) {value = 0.012} + param(Graphite_thickness) {value = 0.5} + param(Assembly_pitch) {value = 17.3205080756887} + param(lbp_rad) {value = 0.25} + param(mod_ext_rad) {value = 0.90} + param(shell_thick) {value = 0.05} + param(liner_thick) {value = 0.007} + param(control_pin_rad) {value = 9.9, unit = mm} + param(cl) {value = 160.0} + param(pf) {value = 40.0} + param(temp) {value = 725.0} + param(temp_F1) {value = 725.0} + param(temp_F2) {value = 725.0} + param(temp_F3) {value = 725.0} + param(temp_F4) {value = 725.0} + param(temp_F5) {value = 725.0} + param(use_sab) = {bool = True} + param(use_sab_BeO) = {bool = True} + param(use_sab_YH2) = {bool = False} + } + } +} \ No newline at end of file diff --git a/examples/1App_PyARC_UnitCell/watts_comprehensive.son b/examples/1App_PyARC_UnitCell/watts_comprehensive.son new file mode 100644 index 00000000..fc5ac704 --- /dev/null +++ b/examples/1App_PyARC_UnitCell/watts_comprehensive.son @@ -0,0 +1,26 @@ +watts{ + % Change the working directory to the directory where the input files are stored. This is necessary + % due to how WATTS copies input files to the temporary working directory. + workflow_dir = "/Users/zhieejhiaooi/Documents/ANL/watts-devel/watts/examples/1App_PyARC_UnitCell" + + plugins{ + plugin(ID1){ + code = "PyARC" + template = "pyarc_template" + extra_inputs = ["lumped.son"] + executable = "path/to/pyarc/executable" + show_stderr = False + show_stdout = True + } + } + + workflow_level1{ + plugin = ID1 + variables{ + param(assembly_pitch) {value = 20 unit = cm} + param(assembly_length) {value = 13 unit = cm} + param(temp) {value = 26.85 unit = Celsius} + } + } + +} \ No newline at end of file diff --git a/examples/1App_RELAP5_SingleChannel/watts_comprehensive.son b/examples/1App_RELAP5_SingleChannel/watts_comprehensive.son new file mode 100644 index 00000000..56569afa --- /dev/null +++ b/examples/1App_RELAP5_SingleChannel/watts_comprehensive.son @@ -0,0 +1,29 @@ +watts{ + % Change the working directory to the directory where the input files are stored. This is necessary + % due to how WATTS copies input files to the temporary working directory. + workflow_dir = "/Users/zhieejhiaooi/Documents/ANL/watts-devel/watts/examples/1App_RELAP5_SingleChannel" + + % Make sure that all necessary files (executable, fluid property files, etc) are in the + % same directory as the input and template files. + plugins{ + plugin(ID1){ + code = "RELAP5" + template = "relap5_template" + executable = "/path/to/relap5/executable" + show_stderr = False + show_stdout = False + plotfl_to_csv = True + % extra_args = ["-w", "tpfh2o", "-e", "tpfn2", "-tpfdir", "C:/Users/zooi/Documents/NSTF/watts/R5/"] + } + } + + workflow_level1{ + plugin = ID1 + variables{ + param(inlet_pressure) {value = 3.0e5} + param(outlet_pressure) {value = 1.013e5} + param(heater_power) {value = 20000} + } + } + +} \ No newline at end of file diff --git a/examples/1App_SAM_VHTR/watts_comprehensive.son b/examples/1App_SAM_VHTR/watts_comprehensive.son new file mode 100644 index 00000000..beb484d1 --- /dev/null +++ b/examples/1App_SAM_VHTR/watts_comprehensive.son @@ -0,0 +1,59 @@ +watts{ + % Change the working directory to the directory where the input files are stored. This is necessary + % due to how WATTS copies input files to the temporary working directory. + workflow_dir = "/Users/zhieejhiaooi/Documents/ANL/watts-devel/watts/examples/1App_SAM_VHTR" + + plugins{ + plugin(ID1){ + code = moose + template = "sam_template" + exec_dir = SAM_DIR + exec_name = "sam-opt" + show_stderr = False + show_stdout = False + } + } + + workflow_level1{ + plugin = ID1 + variables{ + param(He_inlet_temp) {value = 873.15} + param(He_outlet_temp) {value = 1023.15} + param(He_cp) {value = 5189.2} + param(He_K) {value = 0.32802} + param(He_density) {value = 3.8815} + param(He_viscosity) {value = 4.16e-5} + param(He_Pressure) {value = 7e6} + param(Tot_assembly_power) {value = 250000} + + param("Init_P_1") {value = 1} + param("Init_P_2") {value = 1} + param("Init_P_3") {value = 1} + param("Init_P_4") {value = 1} + param("Init_P_5") {value = 1} + + param(ax_ref) {value = 2.0} + param(num_cool_pins) {value = 24} + param(num_fuel_pins) {value = 44} + param(Height_FC) {value = 2.0} + param(Lattice_pitch) {value = 2.0} + param(FuelPin_rad) {value = 0.9} + param(cool_hole_rad) {value = 0.6} + param(Coolant_channel_diam) {value = 0.012} + param(Graphite_thickness) {value = 0.5} + param(Assembly_pitch) {value = 17.3205080756887} + param(lbp_rad) {value = 0.25} + param(mod_ext_rad) {value = 0.90} + param(shell_thick) {value = 0.05} + param(liner_thick) {value = 0.007} + param(control_pin_rad) {value = 9.9, unit = mm} + param(cl) {value = 160.0} + param(pf) {value = 40.0} + param(temp) {value = 700.0} + param(use_sab) = {bool = True} + param(use_sab_BeO) = {bool = True} + param(use_sab_YH2) = {bool = False} + } + } + +} \ No newline at end of file diff --git a/examples/1App_SAS_MultiTemplates_SodiumLoop/watts_comprehensive.son b/examples/1App_SAS_MultiTemplates_SodiumLoop/watts_comprehensive.son new file mode 100644 index 00000000..bc628d15 --- /dev/null +++ b/examples/1App_SAS_MultiTemplates_SodiumLoop/watts_comprehensive.son @@ -0,0 +1,38 @@ +watts{ + % Change the working directory to the directory where the input files are stored. This is necessary + % due to how WATTS copies input files to the temporary working directory. + workflow_dir = "/Users/zhieejhiaooi/Documents/ANL/watts-devel/watts/examples/1App_SAS_MultiTemplates_SodiumLoop" + + plugins{ + plugin(ID1){ + code = "sas" + template = "sas_template" + executable = "/Users/zhieejhiaooi/Documents/ANL/SAS/SAS/sas.x" + show_stderr = False + show_stdout = False + extra_template_inputs=["Primary", "FuelCladding", "Channel", "DecayPower", "PointKinetics", "PRIMAR4"] + % conv_channel = "path\to\CHANNELtoCSV.x" % Assumed to be in the same dir as the SAS executable if not provided + % conv_primar4 = "path\to\PRIMAR4toCSV.x" % Assumed to be in the same dir as the SAS executable if not provided + } + } + + workflow_level1{ + plugin = ID1 + variables{ + param(sas_version) {value = 5.5} + param(tmax) {value = 1000.0} + param(flow_per_pin) {value = 0.15} + param(total_reactor_power) {value = 20.0 unit = kW} + param(betai_1) {value = 2.0E-04} %Effective delayed neutron fraction + param(betai_2) {value = 1.0E-03} + param(betai_3) {value = 1.2E-03} + param(betai_4) {value = 2.5E-03} + param(betai_5) {value = 1.5E-03} + param(betai_6) {value = 5.0E-04} + param(fuel_axial_exp_coeff) {value = 2.0E-05} + param(clad_axial_exp_coeff) {value = 1.4E-05} + param(outlet_pressure) {value = 200000.0} + } + } + +} \ No newline at end of file diff --git a/examples/1App_SAS_SodiumLoop/watts_comprehensive.son b/examples/1App_SAS_SodiumLoop/watts_comprehensive.son new file mode 100644 index 00000000..c3d4bc46 --- /dev/null +++ b/examples/1App_SAS_SodiumLoop/watts_comprehensive.son @@ -0,0 +1,34 @@ +watts{ + % Change the working directory to the directory where the input files are stored. This is necessary + % due to how WATTS copies input files to the temporary working directory. + workflow_dir = "/Users/zhieejhiaooi/Documents/ANL/watts-devel/watts/examples/1App_SAS_SodiumLoop" + + plugins{ + plugin(ID1){ + code = "sas" + template = "sas_template" + executable = "/Users/zhieejhiaooi/Documents/ANL/SAS/SAS/sas.x" + show_stderr = False + show_stdout = False + % conv_channel = "path\to\CHANNELtoCSV.x" % Assumed to be in the same dir as the SAS executable if not provided + % conv_primar4 = "path\to\PRIMAR4toCSV.x" % Assumed to be in the same dir as the SAS executable if not provided + } + } + + workflow_level1{ + plugin = ID1 + variables{ + param(sas_version) {value = 5.5} + param(tmax) {value = 1000.0} + param(flow_per_pin) {value = 0.15} + param(total_reactor_power) {value = 20.0 unit = kW} + param(betai_1) {value = 2.0E-04} %Effective delayed neutron fraction + param(betai_2) {value = 1.0E-03} + param(betai_3) {value = 1.2E-03} + param(betai_4) {value = 2.5E-03} + param(betai_5) {value = 1.5E-03} + param(betai_6) {value = 5.0E-04} + } + } + +} \ No newline at end of file diff --git a/examples/ParamStudy_SAM_SimpleJunction_Workbench/README.md b/examples/ParamStudy_SAM_SimpleJunction_Workbench/README.md new file mode 100644 index 00000000..b6dd8a67 --- /dev/null +++ b/examples/ParamStudy_SAM_SimpleJunction_Workbench/README.md @@ -0,0 +1,20 @@ +# ParamStudy_SAM_SimpleJunction_Workbench + +## Purpose + +This example provides a demonstration on how to use WATTS on Workbench to perform parametric studies where the value of a parameter +is varied. + +## Code(s) + +- SAM + +## Keywords + +- Parametric study + +## File descriptions + +- [__watts_exec.py__](watts_exec.py): WATTS workflow for this example. This is the file to execute to run the problem described above. +- [__sam_template__](sam_template): SAM templated input file. +- [__watts_comprehensive.son__](watts_comprehensive.son): Workbench input file for this example. \ No newline at end of file diff --git a/examples/ParamStudy_SAM_SimpleJunction_Workbench/sam_template b/examples/ParamStudy_SAM_SimpleJunction_Workbench/sam_template new file mode 100644 index 00000000..f6866344 --- /dev/null +++ b/examples/ParamStudy_SAM_SimpleJunction_Workbench/sam_template @@ -0,0 +1,144 @@ +[GlobalParams] + global_init_P = 1.2e5 + global_init_V = 1 + global_init_T = 628.15 + scaling_factor_var = '1 1e-3 1e-6' +[] + +[EOS] + [./eos] + type = PBSodiumEquationOfState + [../] +[] + +[Functions] + [./time_stepper] + type = PiecewiseLinear + x = ' 0 20 21 100 101 1e5' + y = '0.1 0.1 0.5 0.5 1 1' + [../] +[] + +[Components] + [./pipe1] + type = PBOneDFluidComponent + eos = eos + position = '0 0 0' + orientation = '0 0 1' + heat_source = {{ heat_source }} + f= {{ friction_factor }} + Dh = {{ Dh }} + length = 1 + # A = 3.14e-4 + A = {{ flow_area }} + n_elems = 10 + [../] + + [./pipe2] + type = PBOneDFluidComponent + eos = eos + position = '0 0 1' + orientation = '0 0 1' + f=0.1 + Dh = 0.01 + length = 1 + heat_source = 1e7 + A = 3.14e-4 + n_elems = 10 + [../] + + [./joint] + type = PBSingleJunction + eos = eos + inputs='pipe1(out)' + outputs='pipe2(in)' + weak_constraint = true + [../] + [./inlet] + type = PBTDJ + input = 'pipe1(in)' + eos = eos + v_bc = {{ velocity_inlet }} + T_bc = {{ temperature_inlet }} + [../] + + [./outlet] + type = PBTDV + input = 'pipe2(out)' + eos = eos + p_bc = '1.0e5' + T_bc = 728.15 + [../] +[] + +[Postprocessors] + [./TotalMassFlowRateInlet_2] + type = ComponentBoundaryFlow + input = 'pipe2(out)' + [../] + [./Outlet_Temperature_2] + type = ComponentBoundaryVariableValue + variable = temperature + input = 'pipe2(out)' + [../] +[] + +[Preconditioning] + active = 'SMP_PJFNK' + + [./SMP_PJFNK] + type = SMP + full = true + solve_type = 'PJFNK' + petsc_options_iname = '-pc_type' + petsc_options_value = 'lu' + [../] +[] # End preconditioning block + + +[Executioner] + type = Transient + + dt = 1e-1 + dtmin = 1e-5 + + # setting time step range + [./TimeStepper] + type = FunctionDT + function = time_stepper + [../] + + petsc_options_iname = '-ksp_gmres_restart' + petsc_options_value = '100' + + nl_rel_tol = 1e-8 + nl_abs_tol = 1e-7 + nl_max_its = 20 + + l_tol = 1e-5 # Relative linear tolerance for each Krylov solve + l_max_its = 100 # Number of linear iterations for each Krylov solve + + start_time = 0.0 + end_time = 100. + + [./Quadrature] + type = TRAP + order = FIRST + [../] +[] # close Executioner section + +[Outputs] + perf_graph = true + [./out_displaced] + type = Exodus + use_displaced = true + execute_on = 'initial timestep_end' + sequence = false + [../] + [./csv] + type = CSV + [../] + [./console] + type = Console + [../] +[] diff --git a/examples/ParamStudy_SAM_SimpleJunction_Workbench/watts_comprehensive.son b/examples/ParamStudy_SAM_SimpleJunction_Workbench/watts_comprehensive.son new file mode 100644 index 00000000..bf2f7eb6 --- /dev/null +++ b/examples/ParamStudy_SAM_SimpleJunction_Workbench/watts_comprehensive.son @@ -0,0 +1,35 @@ +watts{ + % Change the working directory to the directory where the input files are stored. This is necessary + % due to how WATTS copies input files to the temporary working directory. + workflow_dir = "/Users/zhieejhiaooi/Documents/ANL/watts-devel/watts/examples/ParamStudy_SAM_SimpleJunction_Workbench" + + plugins{ + plugin(ID1){ + code = moose + template = "sam_template" + exec_dir = "SAM_DIR" + exec_name = "sam-opt" + show_stderr = False + show_stdout = False + } + } + + workflow_level1{ + plugin = ID1 + variables{ + param(temperature_inlet) {value = 2.0} + param(friction_factor) {value = 0.1} + param(flow_area) {value = 3.14e-4} + param(Dh) {value = 1 unit = m} + param(velocity_inlet) {value = 1} + param(wall_bc) {bool = "True"} + } + + parametric{ + changing_params = "heat_source" + changing_values = [0, 1e5, 2e5, 3e5] + + } + } + +} \ No newline at end of file diff --git a/examples/PicardIterations_SAM-OpenMC_VHTR_Workbench/README.md b/examples/PicardIterations_SAM-OpenMC_VHTR_Workbench/README.md new file mode 100644 index 00000000..2da471c5 --- /dev/null +++ b/examples/PicardIterations_SAM-OpenMC_VHTR_Workbench/README.md @@ -0,0 +1,22 @@ +# PicardIterations_SAM-OpenMC_VHTR_Workbench + +## Purpose + +This example demonstrates how to use WATTS on Workbench to perform several iterations where SAM calculations are followed by OpenMC calculation and temperature/power information are exchanged until convergence. This example is slightly different from the non Workbench example under the same name. + +## Code(s) + +- SAM +- OpenMC + +## Keywords + +- Information transfer from SAM to OpenMC +- Picard iterations until convergence + +## File descriptions + +- [__watts_exec.py__](watts_exec.py): WATTS workflow for this example. This is the file to execute to run the problem described above. +- [__openmc_template__](openmc_template.py): Link to OpenMC templated model. +- [__sam_template__](sam_template): Link to SAM templated model. +- [__watts_comprehensive.son__](watts_comprehensive.son): Workbench input file for this example. \ No newline at end of file diff --git a/examples/PicardIterations_SAM-OpenMC_VHTR_Workbench/openmc_template.py b/examples/PicardIterations_SAM-OpenMC_VHTR_Workbench/openmc_template.py new file mode 100644 index 00000000..bee18f80 --- /dev/null +++ b/examples/PicardIterations_SAM-OpenMC_VHTR_Workbench/openmc_template.py @@ -0,0 +1,355 @@ +# SPDX-FileCopyrightText: 2022 UChicago Argonne, LLC +# SPDX-License-Identifier: MIT + +from math import sqrt + +import openmc +import openmc.model + + +def build_openmc_model(params): + """ OpenMC Model """ + + materials = [] + + homfuel1 = openmc.Material(name="homfuel_1", temperature=params['avg_Tf_1']) + homfuel1.set_density('g/cm3', 2.2767E+00) + homfuel1.add_nuclide('U235', 4.0841E-02, 'wo') + homfuel1.add_nuclide('U238', 1.6597E-01, 'wo') + homfuel1.add_nuclide('O16', 7.0029E-01, 'wo') + homfuel1.add_element('C', 2.0896E-02, 'wo') + homfuel1.add_nuclide('Si28', 6.6155E-02, 'wo') + homfuel1.add_nuclide('Si29', 3.4772E-03, 'wo') + homfuel1.add_nuclide('Si30', 2.3671E-03, 'wo') + materials.append(homfuel1) + + homfuel2 = openmc.Material(name="homfuel_2", temperature=params['avg_Tf_2']) + homfuel2.set_density('g/cm3', 2.2767E+00) + homfuel2.add_nuclide('U235', 4.0841E-02, 'wo') + homfuel2.add_nuclide('U238', 1.6597E-01, 'wo') + homfuel2.add_nuclide('O16', 7.0029E-01, 'wo') + homfuel2.add_element('C', 2.0896E-02, 'wo') + homfuel2.add_nuclide('Si28', 6.6155E-02, 'wo') + homfuel2.add_nuclide('Si29', 3.4772E-03, 'wo') + homfuel2.add_nuclide('Si30', 2.3671E-03, 'wo') + materials.append(homfuel2) + + homfuel3 = openmc.Material(name="homfuel_1", temperature=params['avg_Tf_3']) + homfuel3.set_density('g/cm3', 2.2767E+00) + homfuel3.add_nuclide('U235', 4.0841E-02, 'wo') + homfuel3.add_nuclide('U238', 1.6597E-01, 'wo') + homfuel3.add_nuclide('O16', 7.0029E-01, 'wo') + homfuel3.add_element('C', 2.0896E-02, 'wo') + homfuel3.add_nuclide('Si28', 6.6155E-02, 'wo') + homfuel3.add_nuclide('Si29', 3.4772E-03, 'wo') + homfuel3.add_nuclide('Si30', 2.3671E-03, 'wo') + materials.append(homfuel3) + + homfuel4 = openmc.Material(name="homfuel_1", temperature=params['avg_Tf_4']) + homfuel4.set_density('g/cm3', 2.2767E+00) + homfuel4.add_nuclide('U235', 4.0841E-02, 'wo') + homfuel4.add_nuclide('U238', 1.6597E-01, 'wo') + homfuel4.add_nuclide('O16', 7.0029E-01, 'wo') + homfuel4.add_element('C', 2.0896E-02, 'wo') + homfuel4.add_nuclide('Si28', 6.6155E-02, 'wo') + homfuel4.add_nuclide('Si29', 3.4772E-03, 'wo') + homfuel4.add_nuclide('Si30', 2.3671E-03, 'wo') + materials.append(homfuel4) + + homfuel5 = openmc.Material(name="homfuel_1", temperature=params['avg_Tf_5']) + homfuel5.set_density('g/cm3', 2.2767E+00) + homfuel5.add_nuclide('U235', 4.0841E-02, 'wo') + homfuel5.add_nuclide('U238', 1.6597E-01, 'wo') + homfuel5.add_nuclide('O16', 7.0029E-01, 'wo') + homfuel5.add_element('C', 2.0896E-02, 'wo') + homfuel5.add_nuclide('Si28', 6.6155E-02, 'wo') + homfuel5.add_nuclide('Si29', 3.4772E-03, 'wo') + homfuel5.add_nuclide('Si30', 2.3671E-03, 'wo') + materials.append(homfuel5) + + boro_ctr = openmc.Material(name="B4C-CTR", temperature=params['temp']) + boro_ctr.set_density('g/cm3', 2.47) + boro_ctr.add_nuclide('B10', 0.16, 'ao') + boro_ctr.add_nuclide('B11', 0.64, 'ao') + boro_ctr.add_element('C', 0.20, 'ao') + materials.append(boro_ctr) + + matrix = openmc.Material(name="matrix", temperature=params['temp']) + matrix.set_density('g/cm3', 1.806) + matrix.add_element('C', 1.0 - 0.0000003, 'ao') + matrix.add_nuclide('B10', 0.0000003, 'ao') + if params['use_sab']: + matrix.add_s_alpha_beta('c_Graphite') + materials.append(matrix) + + refl = openmc.Material(name="BeO", temperature=params['temp']) + refl.set_density('g/cm3', 2.7987) + refl.add_nuclide('Be9', 0.50, 'ao') + refl.add_nuclide('O16', 0.50, 'ao') + if params['use_sab_BeO']: + refl.add_s_alpha_beta('c_Be_in_BeO') + refl.add_s_alpha_beta('c_O_in_BeO') + materials.append(refl) + + yh2 = openmc.Material(name="moderator", temperature=params['temp']) + yh2.set_density('g/cm3', 4.30*0.95) + yh2.add_nuclide('Y89', 0.357142857, 'ao') + yh2.add_nuclide('H1', 0.642857143, 'ao') + if params['use_sab'] and params['use_sab_YH2']: + yh2.add_s_alpha_beta('c_H_in_YH2') + yh2.add_s_alpha_beta('c_Y_in_YH2') + materials.append(yh2) + + coolant = openmc.Material(name="coolant", temperature=params['temp']) + coolant.set_density('g/cm3', 0.00365) + coolant.add_nuclide('He4', 1, 'ao') + materials.append(coolant) + + Cr = openmc.Material(name="Cr", temperature=params['temp']) + Cr.set_density('g/cm3', 7.19) + Cr.add_nuclide('Cr50', -4.345e-2, 'ao') + Cr.add_nuclide('Cr52', -83.789e-2, 'ao') + Cr.add_nuclide('Cr53', -9.501e-2, 'ao') + Cr.add_nuclide('Cr54', -2.365e-2, 'ao') + materials.append(Cr) + + shell_mod = openmc.Material(name="shell_mod", temperature=params['temp']) + shell_mod.set_density('g/cm3', 7.055) # FeCrAl + shell_mod.add_nuclide('Cr50', 20.0e-2 * 4.340E-02,'ao') + shell_mod.add_nuclide('Cr52', 20.0e-2 * 8.381E-01,'ao') + shell_mod.add_nuclide('Cr53', 20.0e-2 * 9.490E-02,'ao') + shell_mod.add_nuclide('Cr54', 20.0e-2 * 2.360E-02,'ao') + shell_mod.add_nuclide('Fe54', 75.5e-2 * 5.800E-02,'ao') + shell_mod.add_nuclide('Fe56', 75.5e-2 * 9.172E-01,'ao') + shell_mod.add_nuclide('Fe57', 75.5e-2 * 2.200E-02,'ao') + shell_mod.add_nuclide('Fe58', 75.5e-2 * 2.800E-03,'ao') + shell_mod.add_nuclide('Al27', 4.5e-2 * 1.000 ,'ao') + materials.append(shell_mod) + + mat_dict = {} + for k,v in list(locals().items()): + if v in materials: + mat_dict[k] = v + + materials_file = openmc.Materials() + for mat in materials: + materials_file.append(mat) + materials_file.export_to_xml() + + Z_min = 0 + Z_cl = params['ax_ref'] + Z_cl_out = params['ax_ref'] - params['shell_thick'] + Z_up = params['ax_ref'] + params['cl'] + Z_up_out = params['ax_ref'] + params['cl'] + params['shell_thick'] + Z_max = params['cl'] + 2 * params['ax_ref'] + + # Create cylinder for fuel and coolant + + fuel_radius = openmc.ZCylinder(x0=0.0, y0=0.0, r=params['FuelPin_rad']) + mod_rad_0 = openmc.ZCylinder(x0=0.0, y0=0.0, r=params['mod_ext_rad'] - params['shell_thick'] - params['liner_thick']) + mod_rad_1a = openmc.ZCylinder(x0=0.0, y0=0.0, r=params['mod_ext_rad'] - params['shell_thick']) + mod_rad_1b = openmc.ZCylinder(x0=0.0, y0=0.0, r=params['mod_ext_rad']) + cool_radius = openmc.ZCylinder(x0=0.0, y0=0.0, r=params['cool_hole_rad']) + ctr_radius = openmc.ZCylinder(x0=0.0, y0=0.0, r=params['control_pin_rad']) + lbp_radius = openmc.ZCylinder(x0=0.0, y0=0.0, r=params['lbp_rad']) + + pin_pitch = params['Lattice_pitch'] + + min_z=openmc.ZPlane(z0=Z_min, boundary_type='vacuum') + max_z=openmc.ZPlane(z0=Z_max, boundary_type='vacuum') + sz_cl=openmc.ZPlane(z0=Z_cl) + + sz_cor1=openmc.ZPlane(z0= Z_cl + 1 * params['cl']/5) + sz_cor2=openmc.ZPlane(z0= Z_cl + 2 * params['cl']/5) + sz_cor3=openmc.ZPlane(z0= Z_cl + 3 * params['cl']/5) + sz_cor4=openmc.ZPlane(z0= Z_cl + 4 * params['cl']/5) + + sz_cl_out=openmc.ZPlane(z0=Z_cl_out) + sz_up=openmc.ZPlane(z0=Z_up) + sz_up_out=openmc.ZPlane(z0=Z_up_out) + cpin_low =openmc.ZPlane(z0=Z_up) + + Hex_Pitch = openmc.model.hexagonal_prism(orientation='x',edge_length=params['Assembly_pitch']/sqrt(3),origin=(0.0, 0.0), + boundary_type = 'reflective') # THIS SHOULD BE REFLECTIVE BONDARY + + + fuel_cell_1_1 = openmc.Cell(name='Fuel Pin', fill=homfuel1 , region=-fuel_radius & +sz_cl & -sz_cor1) + fuel_cell_1_2 = openmc.Cell(name='Fuel Pin', fill=homfuel2 , region=-fuel_radius & +sz_cor1 & -sz_cor2) + fuel_cell_1_3 = openmc.Cell(name='Fuel Pin', fill=homfuel3 , region=-fuel_radius & +sz_cor2 & -sz_cor3) + fuel_cell_1_4 = openmc.Cell(name='Fuel Pin', fill=homfuel4 , region=-fuel_radius & +sz_cor3 & -sz_cor4) + fuel_cell_1_5 = openmc.Cell(name='Fuel Pin', fill=homfuel5 , region=-fuel_radius & +sz_cor4 & -sz_up) + fuel_cell_2 = openmc.Cell(name='matrix', fill=matrix , region=+fuel_radius & +sz_cl & -sz_up) + fuel_cell_3 = openmc.Cell(name='reflL', fill=refl , region=-sz_cl) + fuel_cell_4 = openmc.Cell(name='reflO', fill=refl , region=+sz_up) + fuel_universe= openmc.Universe(cells=(fuel_cell_1_1, fuel_cell_1_2,fuel_cell_1_3,fuel_cell_1_4,fuel_cell_1_5,fuel_cell_2,fuel_cell_3,fuel_cell_4)) + TALLY_REGIONS=[fuel_cell_1_1, fuel_cell_1_2,fuel_cell_1_3,fuel_cell_1_4,fuel_cell_1_5] + + mod_cell_1 = openmc.Cell(name='YH2', fill=yh2, region=-mod_rad_0 & +sz_cl & -sz_up ) + mod_cell_2a = openmc.Cell(name='Liner', fill=Cr , region=+mod_rad_0 & -mod_rad_1a & +sz_cl & -sz_up) + mod_cell_2b = openmc.Cell(name='steel', fill=shell_mod , region=+mod_rad_1a & -mod_rad_1b & +sz_cl & -sz_up) + mod_cell_3 = openmc.Cell(name='matrix', fill=matrix , region=+mod_rad_1b & +sz_cl & -sz_up) + mod_cell_5 = openmc.Cell(name='Plug_L', fill=shell_mod , region=-mod_rad_1b & +sz_cl_out & -sz_cl) + mod_cell_6 = openmc.Cell(name='Plug_LR', fill=refl , region=+mod_rad_1b & +sz_cl_out & -sz_cl) + mod_cell_7 = openmc.Cell(name='Plug_U', fill=shell_mod , region=-mod_rad_1b & +sz_up & -sz_up_out) + mod_cell_8 = openmc.Cell(name='Plug_UR', fill=refl , region=+mod_rad_1b & +sz_up & -sz_up_out) + mod_cell_9 = openmc.Cell(name='LowRef', fill=refl , region=-sz_cl_out) + mod_cell_10 = openmc.Cell(name='UpRef', fill=refl , region=+sz_up) + mod_universe= openmc.Universe(cells=(mod_cell_1,mod_cell_2a, mod_cell_2b,mod_cell_3,mod_cell_5,mod_cell_6,mod_cell_7,mod_cell_8,mod_cell_9,mod_cell_10)) + + coolant_cell_1 = openmc.Cell(name='coolant', fill=coolant , region=-cool_radius) + coolant_cell_2 = openmc.Cell(name='matrix', fill=matrix , region=+cool_radius & +sz_cl & -sz_up) + coolant_cell_3 = openmc.Cell(name='reflL', fill=refl , region=+cool_radius & -sz_cl) + coolant_cell_4 = openmc.Cell(name='reflO', fill=refl , region=+cool_radius & +sz_up) + coolant_universe= openmc.Universe(cells=(coolant_cell_1,coolant_cell_2,coolant_cell_3,coolant_cell_4)) + + ctr_cell_1a = openmc.Cell(name='coolant', fill=coolant , region=-ctr_radius & +sz_cl & -cpin_low) + ctr_cell_1b = openmc.Cell(name='abs', fill=boro_ctr , region=-ctr_radius & +cpin_low) + ctr_cell_1c = openmc.Cell(name='refl', fill=refl , region=-ctr_radius & -sz_cl) + ctr_cell_2 = openmc.Cell(name='matrix', fill=matrix , region=+ctr_radius & +sz_cl & -sz_up) + ctr_cell_3 = openmc.Cell(name='reflL', fill=refl , region=+ctr_radius & -sz_cl) + ctr_cell_4 = openmc.Cell(name='reflO', fill=refl , region=+ctr_radius & +sz_up) + ctr_universe= openmc.Universe(cells=(ctr_cell_1a,ctr_cell_1b,ctr_cell_1c, ctr_cell_2,ctr_cell_3,ctr_cell_4)) + + Graph_cell_1= openmc.Cell(name='Graph cell', fill=matrix) + Graph_universe= openmc.Universe(cells=(Graph_cell_1,)) + + # Fill the hexagone with fuel and coolant cells + + assembly_description=[[]]*6 + assembly_description[5]=([ctr_universe]) + assembly_description[4] =([fuel_universe])*6 + assembly_description[3] =([fuel_universe]+[coolant_universe])*6 + assembly_description[2] =([coolant_universe] + [fuel_universe] + [mod_universe] + [coolant_universe] + [fuel_universe] + [mod_universe])*3 + assembly_description[1] =([fuel_universe]+[fuel_universe]+[coolant_universe]+[fuel_universe])*6 + assembly_description[0] =([fuel_universe]+[coolant_universe]+[fuel_universe]+[fuel_universe]+[coolant_universe])*6 + #print(assembly_description) + + lat_core = openmc.HexLattice() + lat_core.center=(0,0) + lat_core.pitch=[pin_pitch] + lat_core.outer=Graph_universe + lat_core.universes=assembly_description + # print(lat_core) + rotated_lat_core = openmc.Cell(fill=lat_core) + rotated_universe_lat_core = openmc.Universe(cells=(rotated_lat_core,)) + new_cell_lat_core=openmc.Cell() + new_cell_lat_core.fill=rotated_universe_lat_core + new_cell_lat_core.rotation=(0.,0.,90.) + new_universe_lat_core = openmc.Universe(cells=(new_cell_lat_core,)) + + main_cell = openmc.Cell(name="MainCell",fill=new_universe_lat_core, region=Hex_Pitch & +min_z & -max_z ) + + + # OpenMC expects that there is a root universe assigned number zero. Here we + # assign our three cells to this root universe. + root_universe = openmc.Universe(name='root universe', cells=(main_cell,)) + + # Finally we must create a geometry and assign the root universe + geometry = openmc.Geometry() + geometry.root_universe = root_universe + geometry.export_to_xml() + + # Now let's define our simulation parameters. These will go into our + # settings.xml via the SettingsFile object. + batches = 100 + inactive = 30 + particles = 5000 + + # Instantiate a SettingsFile + settings_file = openmc.Settings() + settings_file.run_mode = 'eigenvalue' + settings_file.cross_sections = '/software/openmc/data/v0.12pre-3/lanl_endfb80/cross_sections.xml' + settings_file.batches = batches + settings_file.inactive = inactive + settings_file.particles = particles + settings_file.material_cell_offsets = False + settings_file.temperature = {'method' : 'interpolation'} + + source = openmc.Source() + ll = [-params['Assembly_pitch']/4, -params['Assembly_pitch']/4, Z_min] + ur = [params['Assembly_pitch']/4, params['Assembly_pitch']/4, Z_max] + source.space = openmc.stats.Box(ll, ur) + source.strength = 1.0 + settings_file.source = source + + #lower_left, upper_right = main_cell.region.bounding_box + + list_tally_cell = [cell.id for cell in TALLY_REGIONS] + list_tally_scores = ['flux', 'nu-fission'] + cell_filter = openmc.CellFilter(list_tally_cell) + tally_file = openmc.Tally() + tally_file.filters.append(cell_filter) + tally_file.scores = list_tally_scores + tallies = openmc.Tallies() + tallies.append(tally_file) + tallies.export_to_xml() + + settings_file.export_to_xml() + + # Create a plots.xml file + radius = params['Assembly_pitch']/sqrt(3) + p1 = openmc.Plot() + p1.origin = (0, 0, (Z_max-Z_min)/2) + p1.width = (radius*2, radius*2) + p1.pixels = (2000, 2000) + p1.color = 'mat' + p1.basis = 'xy' + p1.color_by = 'material' + p1.col_spec = { + homfuel1.id: (255, 0, 0), + homfuel2.id: (255, 0, 0), + homfuel3.id: (255, 0, 0), + homfuel4.id: (255, 0, 0), + homfuel5.id: (255, 0, 0), + matrix.id: (100, 100, 100), + yh2.id: (20, 200, 50), + boro_ctr.id: (200, 20, 50), + shell_mod.id: (150,150,150), + coolant.id: (180,110,150), + refl.id: (80,210,50) + } + p2 = openmc.Plot() + p2.origin = (0, 0, (Z_max-Z_min)/2) + p2.width = (radius*2, Z_max) + p2.pixels = (200, 2000) + p2.color = 'mat' + p2.basis ='yz' + p2.color_by = 'material' + p2.col_spec = { + homfuel1.id: (255, 0, 0), + homfuel2.id: (255, 0, 0), + homfuel3.id: (255, 0, 0), + homfuel4.id: (255, 0, 0), + homfuel5.id: (255, 0, 0), + matrix.id: (100, 100, 100), + yh2.id: (20, 200, 50), + boro_ctr.id: (200, 20, 50), + shell_mod.id: (150,150,150), + coolant.id: (180,110,150), + refl.id: (80,210,50) + } + p3 = openmc.Plot() + p3.origin = (0, 0, (Z_max-1)) + p3.width = (radius*2, radius*2) + p3.pixels = (2000, 2000) + p3.color = 'mat' + p3.basis = 'xy' + p3.color_by = 'material' + p3.col_spec = { + homfuel1.id: (255, 0, 0), + homfuel2.id: (255, 0, 0), + homfuel3.id: (255, 0, 0), + homfuel4.id: (255, 0, 0), + homfuel5.id: (255, 0, 0), + matrix.id: (100, 100, 100), + yh2.id: (20, 200, 50), + boro_ctr.id: (200, 20, 50), + shell_mod.id: (150,150,150), + coolant.id: (180,110,150), + refl.id: (80,210,50) + } + plots = openmc.Plots() + plots.append(p1) + plots.append(p2) + plots.append(p3) + plots.export_to_xml() diff --git a/examples/PicardIterations_SAM-OpenMC_VHTR_Workbench/sam_template b/examples/PicardIterations_SAM-OpenMC_VHTR_Workbench/sam_template new file mode 100644 index 00000000..6742c196 --- /dev/null +++ b/examples/PicardIterations_SAM-OpenMC_VHTR_Workbench/sam_template @@ -0,0 +1,574 @@ + + {#- + Create variables + #} + {%- set Mass_flow_rate = Tot_assembly_power / (He_cp * (He_outlet_temp - He_inlet_temp)) %} + {%- set Channel_mass_flow_rate = Mass_flow_rate / num_cool_pins %} + {%- set Coolant_channel_XS = 3.14 * (Coolant_channel_diam/2)**2 %} + {%- set He_velocity = Channel_mass_flow_rate / (He_density * Coolant_channel_XS) %} + {%- set Re_num = Coolant_channel_diam * He_velocity * He_density / He_viscosity %} + {%- set Prandtl_num = He_cp * He_viscosity / He_K %} + {%- set F_blausius = (100*Re_num)**(-0.25) %} + {%- set Nu_DittBoe = 0.023 * (Re_num ** 0.8) * (Prandtl_num ** 0.4) %} + {%- set H_sam = Nu_DittBoe * He_K / Coolant_channel_diam %} + {%- set total_XS_coolant_area_per_fuel_assembly = Coolant_channel_XS * num_cool_pins %} + {%- set surface_area_den = num_fuel_pins * 3.14 * 2 * (FuelPin_rad + Graphite_thickness) / (100 * num_cool_pins * Coolant_channel_XS) %} + {%- set Power_fuel_pin = Tot_assembly_power / (num_fuel_pins) %} + {%- set graph_x = Coolant_channel_diam / 2 + Graphite_thickness / 100 %} + {%- set fuel_x = graph_x + FuelPin_rad / 100 %} + {#- + Render the parameters + #} + +[GlobalParams] + global_init_P = {{ He_Pressure }} + global_init_V = {{ He_velocity }} + global_init_T = {{ He_inlet_temp }} + gravity = '-9.8 0 0' + scaling_factor_var = '1 1e-3 1e-6' + Tsolid_sf = 1e-3 # Scaling factors for solid temperature +[] +[Functions] + active = 'power_dist kf cpf kclad cpclad rhoclad kgraphite cpgraphite rhographite kHe cpHe rhoHe muHe HHe beta_fn' + # [./power_dist] # Function name + # type = PiecewiseLinear # Function type + # axis = x # X-co-ordinate is used for x + # x = ' 0.0 0.5 1.0 1.5 2.0' + # y = ' {{ Init_P_1 }} {{ Init_P_2 }} {{ Init_P_3 }} {{ Init_P_4 }} {{ Init_P_5 }}' + # [../] + + [./power_dist] # Function name + type = PiecewiseLinear # Function type + axis = x # X-co-ordinate is used for x + x = ' 0.0 0.5 1.0 1.5 2.0' + y = ' 1.0 1.0 1.0 1.0 1.0' + [../] + + + [./kf] #fuel thermal conductivity (UO2); x- Temperature [K], y- Thermal condiuctivity [W/m-K] + type = PiecewiseLinear + x ='600 700 800 900 1000 1100 1200 1300 1400 1500' + y ='55.6153061 51.02219975 47.11901811 43.95203134 41.16924224 38.85202882 36.89323509 35.04777834 33.20027175 31.3520767' + [../] + [./cpf] #fuel matrix specific heat (UO2); x- Temperature [K], y- sp. heat [J/kg-K] + type = PiecewiseLinear + x ='300 325 350 375 400 425 450 475 500 525 550 575 600 625 650 675 700 725 750 775 800 825 850 875 900 925 950 975 1000 1025 1050 1075 1100 1125 1150 1175 1200 1225 1250 1275 1300 1325 1350 1375 1400 1425 1450 1475 1500' + y ='44.87198213 57.09373669 71.35471375 87.81224925 106.6236791 127.9463393 151.9375658 178.7546944 208.5550611 241.4960019 277.7348528 317.4289495 360.7356281 407.8122246 458.8160748 513.9045146 573.2348801 636.9645072 705.2507318 778.2508898 856.1223171 939.0223498 1027.108324 1120.537575 1219.467439 1324.055252 1434.458351 1550.83407 1673.339746 1802.132715 1937.370313 2079.209875 2227.808738 2383.324238 2545.91371 2715.73449 2892.943915 3077.69932 3270.158042 3470.477415 3678.814777 3895.327463 4120.172809 4353.508151 4595.490824 4846.278166 5106.027511 5374.896196 5653.041556' + [../] + [./kclad] #clad therm. cond; x- Temperature [K], y-Thermal condiuctivity [W/m-K] + type = PiecewiseLinear + x ='0 478.1709374 571.7659 668.7480342 769.1357153 871.2212698 969.9012774 1068.58496 1167.263743 1274.445367 2118.255351 5000' + y ='3.812850324 3.812850324 3.453993823 3.678279136 3.812850324 4.0819927 4.440849201 4.665134514 5.068848078 5.651989892 11.43855097 11.43855097' + [../] + [./cpclad] #clad specific heat; x- Temperature [K], y- sp. heat [J/kg-K] + type = PiecewiseLinear + x ='300 325 350 375 400 425 450 475 500 525 550 575 600 625 650 675 700 725 750 775 800 825 850 875 900 925 950 975 1000 1025 1050 1075 1100 1125 1150 1175 1200 1225 1250 1275 1300 1325 1350 1375 1400 1425 1450 1475 1500' + y ='286.38 288.94 291.5 294.06 296.62 299.18 301.74 304.3 306.86 309.42 311.98 314.54 317.1 319.66 322.22 324.78 327.34 329.9 332.46 335.02 337.58 340.14 342.7 345.26 347.82 350.38 352.94 355.5 358.06 360.62 363.18 365.74 336.785 335.2703125 333.95125 332.8278125 331.9 331.1678125 330.63125 330.2903125 330.145 330.1953125 330.44125 330.8828125 331.52 332.3528125 333.38125 334.6053125 336.025' + [../] + [./rhoclad] #clad density; x- Temperature [K], y- density [kg/m3] + type = PiecewiseLinear + x ='300 325 350 375 400 425 450 475 500 525 550 575 600 625 650 675 700 725 750 775 800 825 850 875 900 925 950 975 1000 1025 1050 1075 1100 1125 1150 1175 1200 1225 1250 1275 1300 1325 1350 1375 1400 1425 1450 1475 1500' + y ='6550.89 6547.1975 6543.505 6539.8125 6536.12 6532.4275 6528.735 6525.0425 6521.35 6517.6575 6513.965 6510.2725 6506.58 6502.8875 6499.195 6495.5025 6491.81 6488.1175 6484.425 6480.7325 6477.04 6473.3475 6469.655 6465.9625 6462.27 6458.5775 6454.885 6451.1925 6447.5 6443.8075 6440.115 6436.4225 6485.95 6481.3125 6476.675 6472.0375 6467.4 6462.7625 6458.125 6453.4875 6448.85 6444.2125 6439.575 6434.9375 6430.3 6425.6625 6421.025 6416.3875 6411.75' + [../] + [./kgraphite] #G-348 graphite therm. cond; x- Temperature [K], y-Thermal condiuctivity [W/m-K] + type = PiecewiseLinear + x ='295.75 374.15 472.45 574.75 674.75 774.75 874.75 974.85 1074.45 1173.95 1274.05' + y ='133.02 128.54 117.62 106.03 96.7 88.61 82.22 76.52 71.78 67.88 64.26' + [../] + [./cpgraphite] #G-348 graphite specific heat; x- Temperature [K], y- sp. heat [J/kg-K] + type = PiecewiseLinear + x ='295.75 374.15 472.45 574.75 674.75 774.75 874.75 974.85 1074.45 1173.95 1274.05' + y ='726.19 933.15 1154.47 1341.07 1486.83 1603.53 1697.43 1773.6 1835.58 1886.68 1929.44' + [../] + [./rhographite] #G-348 graphite density; x- Temperature [K], y- density [kg/m3] + type = PiecewiseLinear + x ='295.75 374.15 472.45 574.75 674.75 774.75 874.75 974.85 1074.45 1173.95 1274.05' + y ='1888.5 1886.3 1883.5 1880.4 1877.2 1873.9 1870.5 1867 1863.4 1859.6 1855.7' + [../] + [./kHe] #Helium therm. cond; x- Temperature [K], y-Thermal condiuctivity [W/m-K] + type = PiecewiseLinear + x ='300 320 340 360 380 400 420 440 460 480 500 520 540 560 580 600 620 640 660 680 700 720 740 760 780 800 820 840 860 880 900 920 940 960 980 1000 1020 1040 1060 1080 1100 1120 1140 1160 1180 1200 1220 1240 1260 1280 1300 1320 1340 1360 1380 1400 1420 1440 1460 1480 1500' + y ='0.16053 0.16754 0.17444 0.18123 0.18792 0.19451 0.20102 0.20743 0.21377 0.22003 0.22622 0.23233 0.23838 0.24437 0.2503 0.25616 0.26198 0.26773 0.27344 0.27909 0.2847 0.29026 0.29578 0.30126 0.30669 0.31208 0.31743 0.32275 0.32802 0.33327 0.33847 0.34365 0.34879 0.3539 0.35897 0.36402 0.36904 0.37403 0.37899 0.38392 0.38883 0.39371 0.39856 0.40339 0.4082 0.41298 0.41774 0.42248 0.42719 0.43188 0.43655 0.4412 0.44583 0.45043 0.45502 0.45959 0.46414 0.46867 0.47318 0.47767 0.48215' + [../] + [./muHe] #Helium viscosity; x- Temperature [K], y-viscosity [Pa.s] + type = PiecewiseLinear + x ='300 320 340 360 380 400 420 440 460 480 500 520 540 560 580 600 620 640 660 680 700 720 740 760 780 800 820 840 860 880 900 920 940 960 980 1000 1020 1040 1060 1080 1100 1120 1140 1160 1180 1200 1220 1240 1260 1280 1300 1320 1340 1360 1380 1400 1420 1440 1460 1480 1500' + y ='0.00002016 0.0002148 0.000021921 0.000022782 0.00002363 0.000024467 0.000025294 0.00002611 0.000026917 0.000027715 0.000028504 0.000029285 0.000030058 0.000030823 0.000031582 0.000032333 0.000033078 0.000033816 0.000034549 0.000035275 0.000035996 0.000036711 0.00003742 0.000038125 0.000038825 0.00003952 0.00004021 0.000040895 0.000041576 0.000042253 0.000042926 0.000043595 0.00004426 0.00004492 0.000045578 0.000046231 0.000046881 0.000047528 0.000048171 0.000048811 0.000049447 0.000050081 0.000050711 0.000051338 0.000051963 0.000052584 0.000053203 0.000053818 0.000054432 0.000055042 0.00005565 0.000056255 0.000056858 0.000057458 0.000058056 0.000058651 0.000059244 0.000059835 0.000060424 0.00006101 0.000061594' + [../] + [./cpHe] #Helium specific heat; x- Temperature [K], y- sp. heat [J/kg-K] + type = PiecewiseLinear + x ='300 320 340 360 380 400 420 440 460 480 500 520 540 560 580 600 620 640 660 680 700 720 740 760 780 800 820 840 860 880 900 920 940 960 980 1000 1020 1040 1060 1080 1100 1120 1140 1160 1180 1200 1220 1240 1260 1280 1300 1320 1340 1360 1380 1400 1420 1440 1460 1480 1500' + y ='5188.5 5188 5187.6 5187.4 5187.2 5187.2 5187.1 5187.2 5187.2 5187.3 5187.4 5187.5 5187.6 5187.7 5187.8 5187.9 5188 5188.1 5188.2 5188.3 5188.4 5188.5 5188.7 5188.8 5188.8 5188.9 5189 5189.1 5189.2 5189.3 5189.4 5189.5 5189.5 5189.6 5189.7 5189.7 5189.8 5189.9 5189.9 5190 5190.1 5190.1 5190.2 5190.2 5190.3 5190.3 5190.4 5190.4 5190.5 5190.5 5190.6 5190.6 5190.7 5190.7 5190.7 5190.8 5190.8 5190.8 5190.9 5190.9 5190.9' + [../] + [./rhoHe] #Helium density; x- Temperature [K], y- density [kg/m3] + type = PiecewiseLinear + x ='300 320 340 360 380 400 420 440 460 480 500 520 540 560 580 600 620 640 660 680 700 720 740 760 780 800 820 840 860 880 900 920 940 960 980 1000 1020 1040 1060 1080 1100 1120 1140 1160 1180 1200 1220 1240 1260 1280 1300 1320 1340 1360 1380 1400 1420 1440 1460 1480 1500' + y ='10.883 10.225 9.6425 9.1224 8.6555 8.234 7.8516 7.5031 7.1842 6.8912 6.6212 6.3715 6.14 5.9246 5.7239 5.5363 5.3605 5.1956 5.0405 4.8944 4.7565 4.6262 4.5028 4.3858 4.2747 4.1691 4.0686 3.9729 3.8815 3.7942 3.7108 3.6309 3.5545 3.4811 3.4108 3.3432 3.2782 3.2157 3.1556 3.0976 3.0418 2.9879 2.9359 2.8857 2.8371 2.7902 2.7448 2.7009 2.6583 2.617 2.577 2.5383 2.5006 2.4641 2.4286 2.3941 2.3606 2.328 2.2963 2.2655 2.2354' + [../] + [./HHe] #Helium Enthalpy; x- Temperature [K], y- denthalpy [j/kg] + type = PiecewiseLinear + x ='300 320 340 360 380 400 420 440 460 480 500 520 540 560 580 600 620 640 660 680 700 720 740 760 780 800 820 840 860 880 900 920 940 960 980 1000 1020 1040 1060 1080 1100 1120 1140 1160 1180 1200 1220 1240 1260 1280 1300 1320 1340 1360 1380 1400 1420 1440 1460 1480 1500' + y ='1585700 1689500 1793300 1897000 2000800 2104500 2208200 2312000 2415700 2519500 2623200 2727000 2830700 2934500 3038200 3142000 3245700 3349500 3453300 3557000 3660800 3764600 3868300 3972100 4075900 4179700 4283400 4387200 4491000 4594800 4698600 4802400 4906200 5010000 5113700 5217500 5321300 5425100 5528900 5632700 5736500 5840300 5944100 6047900 6151700 6255600 6359400 6463200 6567000 6670800 6774600 6878400 6982200 7086000 7189800 7293700 7397500 7501300 7605100 7708900 7812700' + [../] + [./beta_fn] + type = PiecewiseLinear + x = '300 2000' + y = '0 0' + [../] + + [./T_max_fuel] + type = ParsedFunction + value = Tf1+Tf2 + vars = 'Tf1 Tf2' + vals = 'max_Tf_1 max_Tf_2' + [../] + +[] +[EOS] + [./eos] + type = PTFluidPropertiesEOS + p_0 = {{ He_Pressure }} # Pa + fp = fluid_props1 + [../] +[] +[MaterialProperties] + [./fluid_props1] + type = FunctionFluidProperties + rho = rhoHe + beta = beta_fn + cp = cpHe + mu = muHe + k = kHe + enthalpy = HHe + [../] + [./fuel-mat] # Material name + type = SolidMaterialProps + k = kf # Thermal conductivity + Cp = cpf # Specific heat + rho = 1.104e4 # Density + [../] + [./clad-mat] # Material name + type = SolidMaterialProps + k = kgraphite # Thermal conductivity + Cp = cpgraphite # Specific heat + rho = rhographite # Density + [../] + [./graphite-mat] # Material name + type = SolidMaterialProps + k = kgraphite # Thermal conductivity + Cp = cpgraphite # Specific heat + rho = rhographite # Density + [../] + [./leadBUF-mat] # Material name + type = SolidMaterialProps + k = kgraphite # Thermal conductivity + Cp = cpgraphite # Specific heat + rho = rhographite # Density + [../] +[] +[Components] + [./reactor] + type = ReactorPower + initial_power = {{ Tot_assembly_power }} # Initial total reactor power + [../] + + [./CH1] # Component name + type = PBCoreChannel # PBCorechannel component + eos = eos # The equation-of-state name + position = '0 {{Height_FC/5 * 0}} 0' + orientation = '0 1 0' + assembly_type = Block-Channel + n_rods = {{ num_fuel_pins }} + A = {{ total_XS_coolant_area_per_fuel_assembly }} + Dh = {{ Coolant_channel_diam }} + length = {{ Height_FC/5 }} + n_elems = 20 + f = {{ F_blausius }} # User specified friction coefficient (Blausis f=(100 Re)^-0.25 + Hw = {{ H_sam }} # User specified heat transfer coefficient (Dittus-Boelter) + HT_surface_area_density = {{ surface_area_den }} # Heat transfer surface area density, Ph/Ac + name_of_hs = 'fuel graphite' # Heat structure names + Ts_init = {{ He_inlet_temp }} # Initial structure temeprature + n_heatstruct = 2 # Number of heat structures + fuel_type = cylinder # Fuel geometric type, cylinder or plate + width_of_hs = '{{FuelPin_rad/100}} {{ Graphite_thickness/100 }}' # The width of all heat structures + elem_number_of_hs = '50 10' # The element numbers of all heat structures + material_hs = 'fuel-mat graphite-mat' # The material used for all heat structures + power_fraction = '0.2 0.0' # The power fractions of all heat structures + power_shape_function = power_dist # the axial power shape function name + [../] + + [./CH2] # Component name + type = PBCoreChannel # PBCorechannel component + eos = eos # The equation-of-state name + position = '0 {{Height_FC/5 * 1}} 0' + orientation = '0 1 0' + assembly_type = Block-Channel + n_rods = {{ num_fuel_pins }} + A = {{ total_XS_coolant_area_per_fuel_assembly }} + Dh = {{ Coolant_channel_diam }} + length = {{ Height_FC/5 }} + n_elems = 20 + f = {{ F_blausius }} # User specified friction coefficient (Blausis f=(100 Re)^-0.25 + Hw = {{ H_sam }} # User specified heat transfer coefficient (Dittus-Boelter) + HT_surface_area_density = {{ surface_area_den }} # Heat transfer surface area density, Ph/Ac + name_of_hs = 'fuel graphite' # Heat structure names + Ts_init = {{ He_inlet_temp }} # Initial structure temeprature + n_heatstruct = 2 # Number of heat structures + fuel_type = cylinder # Fuel geometric type, cylinder or plate + width_of_hs = '{{FuelPin_rad/100}} {{ Graphite_thickness/100 }}' # The width of all heat structures + elem_number_of_hs = '50 10' # The element numbers of all heat structures + material_hs = 'fuel-mat graphite-mat' # The material used for all heat structures + power_fraction = '0.2 0.0' # The power fractions of all heat structures + power_shape_function = power_dist # the axial power shape function name + [../] + + [./CH3] # Component name + type = PBCoreChannel # PBCorechannel component + eos = eos # The equation-of-state name + position = '0 {{Height_FC/5 * 2}} 0' + orientation = '0 1 0' + assembly_type = Block-Channel + n_rods = {{ num_fuel_pins }} + A = {{ total_XS_coolant_area_per_fuel_assembly }} + Dh = {{ Coolant_channel_diam }} + length = {{ Height_FC/5 }} + n_elems = 20 + f = {{ F_blausius }} # User specified friction coefficient (Blausis f=(100 Re)^-0.25 + Hw = {{ H_sam }} # User specified heat transfer coefficient (Dittus-Boelter) + HT_surface_area_density = {{ surface_area_den }} # Heat transfer surface area density, Ph/Ac + name_of_hs = 'fuel graphite' # Heat structure names + Ts_init = {{ He_inlet_temp }} # Initial structure temeprature + n_heatstruct = 2 # Number of heat structures + fuel_type = cylinder # Fuel geometric type, cylinder or plate + width_of_hs = '{{FuelPin_rad/100}} {{ Graphite_thickness/100 }}' # The width of all heat structures + elem_number_of_hs = '50 10' # The element numbers of all heat structures + material_hs = 'fuel-mat graphite-mat' # The material used for all heat structures + power_fraction = '0.2 0.0' # The power fractions of all heat structures + power_shape_function = power_dist # the axial power shape function name + [../] + + [./CH4] # Component name + type = PBCoreChannel # PBCorechannel component + eos = eos # The equation-of-state name + position = '0 {{Height_FC/5 * 3}} 0' + orientation = '0 1 0' + assembly_type = Block-Channel + n_rods = {{ num_fuel_pins }} + A = {{ total_XS_coolant_area_per_fuel_assembly }} + Dh = {{ Coolant_channel_diam }} + length = {{ Height_FC/5 }} + n_elems = 20 + f = {{ F_blausius }} # User specified friction coefficient (Blausis f=(100 Re)^-0.25 + Hw = {{ H_sam }} # User specified heat transfer coefficient (Dittus-Boelter) + HT_surface_area_density = {{ surface_area_den }} # Heat transfer surface area density, Ph/Ac + name_of_hs = 'fuel graphite' # Heat structure names + Ts_init = {{ He_inlet_temp }} # Initial structure temeprature + n_heatstruct = 2 # Number of heat structures + fuel_type = cylinder # Fuel geometric type, cylinder or plate + width_of_hs = '{{FuelPin_rad/100}} {{ Graphite_thickness/100 }}' # The width of all heat structures + elem_number_of_hs = '50 10' # The element numbers of all heat structures + material_hs = 'fuel-mat graphite-mat' # The material used for all heat structures + power_fraction = '0.2 0.0' # The power fractions of all heat structures + power_shape_function = power_dist # the axial power shape function name + [../] + + [./CH5] # Component name + type = PBCoreChannel # PBCorechannel component + eos = eos # The equation-of-state name + position = '0 {{Height_FC/5 * 4}} 0' + orientation = '0 1 0' + assembly_type = Block-Channel + n_rods = {{ num_fuel_pins }} + A = {{ total_XS_coolant_area_per_fuel_assembly }} + Dh = {{ Coolant_channel_diam }} + length = {{ Height_FC/5 }} + n_elems = 20 + f = {{ F_blausius }} # User specified friction coefficient (Blausis f=(100 Re)^-0.25 + Hw = {{ H_sam }} # User specified heat transfer coefficient (Dittus-Boelter) + HT_surface_area_density = {{ surface_area_den }} # Heat transfer surface area density, Ph/Ac + name_of_hs = 'fuel graphite' # Heat structure names + Ts_init = {{ He_inlet_temp }} # Initial structure temeprature + n_heatstruct = 2 # Number of heat structures + fuel_type = cylinder # Fuel geometric type, cylinder or plate + width_of_hs = '{{FuelPin_rad/100}} {{ Graphite_thickness/100 }}' # The width of all heat structures + elem_number_of_hs = '50 10' # The element numbers of all heat structures + material_hs = 'fuel-mat graphite-mat' # The material used for all heat structures + power_fraction = '0.2 0.0' # The power fractions of all heat structures + power_shape_function = power_dist # the axial power shape function name + [../] + + [./junc_CH1_CH2] + type = PBSingleJunction + eos = eos + inputs = 'CH1(out)' + outputs = 'CH2(in)' + [../] + [./junc_CH2_CH3] + type = PBSingleJunction + eos = eos + inputs = 'CH2(out)' + outputs = 'CH3(in)' + [../] + [./junc_CH3_CH4] + type = PBSingleJunction + eos = eos + inputs = 'CH3(out)' + outputs = 'CH4(in)' + [../] + [./junc_CH4_CH5] + type = PBSingleJunction + eos = eos + inputs = 'CH4(out)' + outputs = 'CH5(in)' + [../] + + + [./inlet] #Boundary components + type = PBTDJ + input = 'CH1(in)' + v_bc = {{ He_velocity }} + T_bc = {{ He_inlet_temp }} + eos = eos + [../] + [./outlet] + type = PBTDV + input = 'CH5(out)' + p_bc = '{{ He_Pressure }}' + T_bc = {{ He_outlet_temp }} + eos = eos + [../] +[] +[Postprocessors] + +# [max_Tf] +# type = ParsedPostprocessor +# function = 'max(max(max_Tf_1,max_Tf_2),max(max_Tf_3,max(max_Tf_4,max_Tf_5)))' +# pp_names = 'max_Tf_1 max_Tf_2 max_Tf_3 max_Tf_4 max_Tf_5' +# [] +# +# [avg_Tgraphite] +# type = ParsedPostprocessor +# function = '(avg_Tgraphite_1+avg_Tgraphite_2+avg_Tgraphite_3+avg_Tgraphite_4+avg_Tgraphite_5)/5' +# pp_names = 'avg_Tgraphite_1 avg_Tgraphite_2 avg_Tgraphite_3 avg_Tgraphite_4 avg_Tgraphite_5' +# [] + + [./max_Tcoolant] # Output maximum fluid temperature of block CH1:pipe + type = NodalMaxValue + block = 'CH1:pipe' + variable = temperature + [../] + [./max_Tw] # Output maximum wall temperature of block CH1:pipe + type = NodalMaxValue + block = 'CH1:pipe' + variable = Tw + [../] + [./max_Tf_1] # Output maximum solid temperature of block CH1: solid:fuel + type = NodalMaxValue + block = 'CH1:solid:fuel' + variable = T_solid + [../] + [./max_Tf_2] # Output maximum solid temperature of block CH1: solid:fuel + type = NodalMaxValue + block = 'CH2:solid:fuel' + variable = T_solid + [../] + [./max_Tf_3] # Output maximum solid temperature of block CH1: solid:fuel + type = NodalMaxValue + block = 'CH3:solid:fuel' + variable = T_solid + [../] + [./max_Tf_4] # Output maximum solid temperature of block CH1: solid:fuel + type = NodalMaxValue + block = 'CH4:solid:fuel' + variable = T_solid + [../] + [./max_Tf_5] # Output maximum solid temperature of block CH1: solid:fuel + type = NodalMaxValue + block = 'CH5:solid:fuel' + variable = T_solid + [../] + [./max_Tgraphite_1] # Output maximum solid temperature of block CH1: solid:fuel + type = NodalMaxValue + block = 'CH1:solid:graphite' + variable = T_solid + [../] + [./max_Tgraphite_2] # Output maximum solid temperature of block CH1: solid:fuel + type = NodalMaxValue + block = 'CH2:solid:graphite' + variable = T_solid + [../] + [./max_Tgraphite_3] # Output maximum solid temperature of block CH1: solid:fuel + type = NodalMaxValue + block = 'CH3:solid:graphite' + variable = T_solid + [../] + [./max_Tgraphite_4] # Output maximum solid temperature of block CH1: solid:fuel + type = NodalMaxValue + block = 'CH4:solid:graphite' + variable = T_solid + [../] + [./max_Tgraphite_5] # Output maximum solid temperature of block CH1: solid:fuel + type = NodalMaxValue + block = 'CH5:solid:graphite' + variable = T_solid + [../] + + [./max_Pcoolant_1] # Output maximum fluid temperature of block CH1:pipe + type = NodalMaxValue + block = 'CH1:pipe' + variable = pressure + [../] + [./max_Pcoolant_2] # Output maximum fluid temperature of block CH1:pipe + type = NodalMaxValue + block = 'CH2:pipe' + variable = pressure + [../] + [./max_Pcoolant_3] # Output maximum fluid temperature of block CH1:pipe + type = NodalMaxValue + block = 'CH3:pipe' + variable = pressure + [../] + [./max_Pcoolant_4] # Output maximum fluid temperature of block CH1:pipe + type = NodalMaxValue + block = 'CH4:pipe' + variable = pressure + [../] + [./max_Pcoolant_5] # Output maximum fluid temperature of block CH1:pipe + type = NodalMaxValue + block = 'CH5:pipe' + variable = pressure + [../] + + [./avg_Tcoolant_1] # Output maximum fluid temperature of block CH1:pipe + type = ElementAverageValue + block = 'CH1:pipe' + variable = temperature + [../] + [./avg_Tcoolant_2] # Output maximum fluid temperature of block CH1:pipe + type = ElementAverageValue + block = 'CH2:pipe' + variable = temperature + [../] + [./avg_Tcoolant_3] # Output maximum fluid temperature of block CH1:pipe + type = ElementAverageValue + block = 'CH3:pipe' + variable = temperature + [../] + [./avg_Tcoolant_4] # Output maximum fluid temperature of block CH1:pipe + type = ElementAverageValue + block = 'CH4:pipe' + variable = temperature + [../] + [./avg_Tcoolant_5] # Output maximum fluid temperature of block CH1:pipe + type = ElementAverageValue + block = 'CH5:pipe' + variable = temperature + [../] + + [./avg_Tf_1] # Output maximum solid temperature of block CH1: solid:fuel + type = ElementAverageValue + block = 'CH1:solid:fuel' + variable = T_solid + [../] + [./avg_Tf_2] # Output maximum solid temperature of block CH1: solid:fuel + type = ElementAverageValue + block = 'CH2:solid:fuel' + variable = T_solid + [../] + [./avg_Tf_3] # Output maximum solid temperature of block CH1: solid:fuel + type = ElementAverageValue + block = 'CH3:solid:fuel' + variable = T_solid + [../] + [./avg_Tf_4] # Output maximum solid temperature of block CH1: solid:fuel + type = ElementAverageValue + block = 'CH4:solid:fuel' + variable = T_solid + [../] + [./avg_Tf_5] # Output maximum solid temperature of block CH1: solid:fuel + type = ElementAverageValue + block = 'CH5:solid:fuel' + variable = T_solid + [../] + + [./avg_Tgraphite_1] # Output maximum solid temperature of block CH1: solid:fuel + type = ElementAverageValue + block = 'CH1:solid:graphite' + variable = T_solid + [../] + [./avg_Tgraphite_2] # Output maximum solid temperature of block CH1: solid:fuel + type = ElementAverageValue + block = 'CH2:solid:graphite' + variable = T_solid + [../] + [./avg_Tgraphite_3] # Output maximum solid temperature of block CH1: solid:fuel + type = ElementAverageValue + block = 'CH3:solid:graphite' + variable = T_solid + [../] + [./avg_Tgraphite_4] # Output maximum solid temperature of block CH1: solid:fuel + type = ElementAverageValue + block = 'CH4:solid:graphite' + variable = T_solid + [../] + [./avg_Tgraphite_5] # Output maximum solid temperature of block CH1: solid:fuel + type = ElementAverageValue + block = 'CH5:solid:graphite' + variable = T_solid + [../] +[] +[VectorPostprocessors] + [./vel] + type = LineValueSampler + variable = velocity + start_point = '0 0 0' + end_point = '0 {{ Height_FC/5 }} 0' + num_points = 21 + use_displaced_mesh = true + sort_by = id + [../] +[] +[Preconditioning] + active = 'SMP_PJFNK' + [./SMP_PJFNK] + type = SMP + full = true + solve_type = 'PJFNK' + petsc_options_iname = '-pc_type' + petsc_options_value = 'lu' + [../] +[] +[Executioner] + type = Steady + petsc_options_iname = '-ksp_gmres_restart' + petsc_options_value = '300' + nl_rel_tol = 1e-9 + nl_abs_tol = 1e-7 + nl_max_its = 20 + l_tol = 1e-5 + l_max_its = 50 + [./Quadrature] + type = TRAP + order = FIRST + [../] +[] + +[Outputs] + print_linear_residuals = false + perf_graph = true + [./out] + type = Checkpoint + [../] + [./console] + type = Console + [../] + [./out_displaced] + type = Exodus + use_displaced = true + execute_on = 'initial timestep_end' + sequence = false + [../] + [./csv] + type = CSV + [../] +[] diff --git a/examples/PicardIterations_SAM-OpenMC_VHTR_Workbench/watts_comprehensive.son b/examples/PicardIterations_SAM-OpenMC_VHTR_Workbench/watts_comprehensive.son new file mode 100644 index 00000000..7326e22d --- /dev/null +++ b/examples/PicardIterations_SAM-OpenMC_VHTR_Workbench/watts_comprehensive.son @@ -0,0 +1,74 @@ +watts{ + % Change the working directory to the directory where the input files are stored. This is necessary + % due to how WATTS copies input files to the temporary working directory. + workflow_dir = "/Users/zhieejhiaooi/Documents/ANL/watts-devel/watts/examples/PicardIterations_SAM-OpenMC_VHTR_Workbench" + + plugins{ + plugin(ID1){ + code = moose + template = "sam_template" + exec_dir = "SAM_DIR" + exec_name = "sam-opt" + show_stderr = False + show_stdout = False + } + plugin(ID2){ + code = openmc + template = "openmc_template.py" + scores = ["nu-fission"] % Name of scores for OpenMC tallies. This will be the base name used for saving the tallies. + score_names = ["Init_P"] % A more representative name for the scores + } + } + + workflow_level1{ + variables{ + param(He_inlet_temp) {value = 873.15} + param(He_outlet_temp) {value = 1023.15} + param(He_cp) {value = 5189.2} + param(He_K) {value = 0.32802} + param(He_density) {value = 3.8815} + param(He_viscosity) {value = 4.16e-5} + param(He_Pressure) {value = 7e6} + param(Tot_assembly_power) {value = 250000} + + param("Init_P_1") {value = 1} + param("Init_P_2") {value = 1} + param("Init_P_3") {value = 1} + param("Init_P_4") {value = 1} + param("Init_P_5") {value = 1} + + param(ax_ref) {value = 2.0} + param(num_cool_pins) {value = 24} + param(num_fuel_pins) {value = 44} + param(Height_FC) {value = 2.0} + param(Lattice_pitch) {value = 2.0} + param(FuelPin_rad) {value = 0.9} + param(cool_hole_rad) {value = 0.6} + param(Coolant_channel_diam) {value = 0.012} + param(Graphite_thickness) {value = 0.5} + param(Assembly_pitch) {value = 17.3205080756887} + param(lbp_rad) {value = 0.25} + param(mod_ext_rad) {value = 0.90} + param(shell_thick) {value = 0.05} + param(liner_thick) {value = 0.007} + param(control_pin_rad) {value = 9.9, unit = mm} + param(cl) {value = 160.0} + param(pf) {value = 40.0} + param(temp) {value = 700.0} + param(use_sab) = {bool = True} + param(use_sab_BeO) = {bool = True} + param(use_sab_YH2) = {bool = False} + } + + iteration{ + plugin_main = ID1 + plugin_sub = ID2 + nmax = 10 + convergence_params = "keff" + convergence_criteria = 0.0001 + to_sub_params = ["avg_Tf_1" "avg_Tf_2" "avg_Tf_3" "avg_Tf_4" "avg_Tf_5"] + to_main_params = ["Init_P_1" "Init_P_2" "Init_P_3" "Init_P_4" "Init_P_5"] + } + } + +} \ No newline at end of file diff --git a/scripts/setup_conda_wb.sh b/scripts/setup_conda_wb.sh index a7e752c6..318a72ef 100755 --- a/scripts/setup_conda_wb.sh +++ b/scripts/setup_conda_wb.sh @@ -69,4 +69,35 @@ printf "${GREEN}Activated Conda: ${NC} ${conda_path}\n" yes | python -m pip install watts -printf "${GREEN}WATTS successfully set up in Workbench.\n" \ No newline at end of file +printf "${GREEN}WATTS successfully installed in Workbench environment.\n" + +# ----------------------------------------------------------------------- +# Copying files between WATTS and Workbench +printf "${GREEN}Transfering files between WATTS and Workbench.\n" + +script_path=$(cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P) + +cd ../src/watts_ui + +current_path=$(cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P) + +# Copy watts.py to Workbench/rte +cp etc/watts.py $workbench_path/rte/ + +# Check if bin directory already exists +if [ -d "$current_path/bin" ]; then + printf "${RED}ERROR: bin directory already exists in $current_path.${NC}\n" + exit 1 +fi + +mkdir bin +ln -s $workbench_path/bin/sonvalidxml bin/sonvalidxml + +# Check if wasppy already exists +if [ -d "$current_path/wasppy" ]; then + printf "${RED}ERROR: wasppy already exists in $current_path.${NC}\n" + exit 1 +fi +ln -s $workbench_path/wasppy ./ + +printf "${GREEN}Transfer complete.\n" \ No newline at end of file diff --git a/scripts/setup_openmc.sh b/scripts/setup_openmc.sh new file mode 100755 index 00000000..79f6a416 --- /dev/null +++ b/scripts/setup_openmc.sh @@ -0,0 +1,86 @@ +#!/bin/bash +######################################################################## +# Date: 2022-09-08 +# Author: kkiesling (kkiesling [at] anl [dot] gov) +# Comment: Install OpenMC and its dependencies into the Workbench conda +# environment so that that are available in workbench. +######################################################################## + +GREEN='\033[0;32m' +RED='\033[0;31m' +BLUE='\033[0;34m' +NC='\033[0m' + +# ---------------------------------------------------------------------- +# Initialize conda +script_path=$(cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P) +# source $script_path/setup_conda_wb.sh + + +# ---------------------------------------------------------------------- +# Gather workbench_path from workbench.sh +source workbench.sh + +# check that workbench_path was retrieved +if [ -z $workbench_path ]; then + printf "${RED}ERROR: Could not find workbench_path; please confirm 'workbench_path' entry in workbench.sh file${NC}\n" + exit 1 +fi + +# Check that retrieved path to Workbench application exists +if [ ! -d $workbench_path ]; then + printf "${RED}ERROR: Path to Workbench application does not exist; please confirm 'workbench_path' entry in workbench.sh file${NC}\n" + printf " ${workbench_path}\n" + exit 1 +fi + +# # ---------------------------------------------------------------------- +# Find conda in Workbench +conda_path="${workbench_path}/rte/conda" +if [ ! -f "${conda_path}/bin/conda" ]; then + printf "${RED}ERROR: Path to conda executable within Workbench application does not exist; please confirm 'workbench_path' entry in workbench.sh file${NC}\n" + printf " ${conda_path}/bin/conda\n" + exit 1 +fi + +# ---------------------------------------------------------------------- +# Activate Workbench conda environment +# >>> conda init >>> +#!! Contents within this block are managed by 'conda init' !! +__conda_setup="$(CONDA_REPORT_ERRORS=false "${conda_path}/bin/conda" shell.bash hook 2> /dev/null)" +if [ $? -eq 0 ]; then + \eval "$__conda_setup" +else + if [ -f "${conda_path}/etc/profile.d/conda.sh" ]; then + . "${conda_path}/etc/profile.d/conda.sh" + CONDA_CHANGEPS1=false conda activate base + else + PATH="${conda_path}/conda/bin:${PATH}" + fi +fi +unset __conda_setup +# <<< conda init <<< + +# ---------------------------------------------------------------------- +printf "${GREEN}Found Workbench:${NC} ${workbench_path}\n" +printf "${GREEN}Activated Conda: ${NC} ${conda_path}\n" + + +# ---------------------------------------------------------------------- +# Clone original workbench environment (if not already cloned) and +# generate .yml copy (base_original.yml) if it is not already saved locally +printf "${GREEN}Cloning original workbench environment to:${NC} ${CONDA_DEFAULT_ENV}_base\n" +# "no" == do not overwrite environment if it already exists +yes no | conda create --name ${CONDA_DEFAULT_ENV}_clone --clone ${CONDA_DEFAULT_ENV} +if [ ! -f ${script_path}/${CONDA_DEFAULT_ENV}_original.yml ]; then + conda env export -n $CONDA_DEFAULT_ENV -f ${script_path}/${CONDA_DEFAULT_ENV}_original.yml + printf "${GREEN}Original workbench environment saved to:${NC} ${script_path}/${CONDA_DEFAULT_ENV}_original.yml\n" +fi + +# ---------------------------------------------------------------------- +# Install OpenMC into the conda environment +printf "${GREEN}Installing OpenMC into Workbench conda environment${NC}\n" +yes | conda install -c conda-forge openmc + +printf "${GREEN}OpenMC successfully installed in Workbench environment.${NC}\n" +printf "To complete the setup, add ${BLUE}OPENMC_CROSS_SECTIONS${NC} variable to Arc Workbench configuration.\n" diff --git a/scripts/workbench.sh b/scripts/workbench.sh index 8d62cf71..eac2e043 100755 --- a/scripts/workbench.sh +++ b/scripts/workbench.sh @@ -4,4 +4,5 @@ # Comment: Set the path to Workbench to be used for setting up WATTS in Workbench. ######################################################################## +# Provide path to workbench-.app/Contents workbench_path="/Applications/Workbench-5.0.1.app/Contents" \ No newline at end of file From b8f9d93258a0b9b10180826d9d4d10909c0805f9 Mon Sep 17 00:00:00 2001 From: Zhiee Jhia Ooi Date: Wed, 4 Jan 2023 14:35:29 -0600 Subject: [PATCH 14/18] Updated CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 17ae0c01..8a4fde76 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. executable to be used ([#75](https://github.com/watts-dev/watts/pull/75)) * A `verbose` argument has been added to `Plugin.__call__` that controls whether screen output is printed ([#82](https://github.com/watts-dev/watts/pull/82)) +* Develop capability to run WATTS with NEAMS Workbench. ## [0.4.0] From 4ae5ad72cd7b47619c70cd9eb7c2fdad79941869 Mon Sep 17 00:00:00 2001 From: Nicolas Stauff Date: Wed, 11 Jan 2023 13:15:12 -0600 Subject: [PATCH 15/18] added a few templates and modified schema accordingly. --- src/watts_ui/etc/templates/param.bool.tmpl | 1 + src/watts_ui/etc/templates/param.func.tmpl | 1 + src/watts_ui/etc/templates/param.list.tmpl | 1 + src/watts_ui/etc/templates/param.tmpl | 1 - src/watts_ui/etc/templates/param.value.tmpl | 1 + src/watts_ui/etc/templates/variables.tmpl | 6 +++++ src/watts_ui/etc/templates/wf_plugin.tmpl | 1 + src/watts_ui/etc/watts.sch | 28 ++++++++++----------- 8 files changed, 25 insertions(+), 15 deletions(-) create mode 100644 src/watts_ui/etc/templates/param.bool.tmpl create mode 100644 src/watts_ui/etc/templates/param.func.tmpl create mode 100644 src/watts_ui/etc/templates/param.list.tmpl delete mode 100644 src/watts_ui/etc/templates/param.tmpl create mode 100644 src/watts_ui/etc/templates/param.value.tmpl create mode 100644 src/watts_ui/etc/templates/variables.tmpl create mode 100644 src/watts_ui/etc/templates/wf_plugin.tmpl diff --git a/src/watts_ui/etc/templates/param.bool.tmpl b/src/watts_ui/etc/templates/param.bool.tmpl new file mode 100644 index 00000000..fc47f7f5 --- /dev/null +++ b/src/watts_ui/etc/templates/param.bool.tmpl @@ -0,0 +1 @@ +params( id ){bool = True} \ No newline at end of file diff --git a/src/watts_ui/etc/templates/param.func.tmpl b/src/watts_ui/etc/templates/param.func.tmpl new file mode 100644 index 00000000..27ab91f7 --- /dev/null +++ b/src/watts_ui/etc/templates/param.func.tmpl @@ -0,0 +1 @@ +params( id ){func = 'a + b' } \ No newline at end of file diff --git a/src/watts_ui/etc/templates/param.list.tmpl b/src/watts_ui/etc/templates/param.list.tmpl new file mode 100644 index 00000000..2c8a728b --- /dev/null +++ b/src/watts_ui/etc/templates/param.list.tmpl @@ -0,0 +1 @@ +params( id ){list = [ 0 ] } \ No newline at end of file diff --git a/src/watts_ui/etc/templates/param.tmpl b/src/watts_ui/etc/templates/param.tmpl deleted file mode 100644 index d2eb4f8f..00000000 --- a/src/watts_ui/etc/templates/param.tmpl +++ /dev/null @@ -1 +0,0 @@ -params( id ){value = 0 unit= m range = [ 0 0 ]} \ No newline at end of file diff --git a/src/watts_ui/etc/templates/param.value.tmpl b/src/watts_ui/etc/templates/param.value.tmpl new file mode 100644 index 00000000..fdfaeac8 --- /dev/null +++ b/src/watts_ui/etc/templates/param.value.tmpl @@ -0,0 +1 @@ +params( id ){value = 0 unit= m} \ No newline at end of file diff --git a/src/watts_ui/etc/templates/variables.tmpl b/src/watts_ui/etc/templates/variables.tmpl new file mode 100644 index 00000000..7ddc327c --- /dev/null +++ b/src/watts_ui/etc/templates/variables.tmpl @@ -0,0 +1,6 @@ +variables{ +% params( id ){value = 0 unit= m} +% params( id ){func = 'a + b' } +% params( id ){list = [ 0 ] } +% params( id ){bool = True} +} \ No newline at end of file diff --git a/src/watts_ui/etc/templates/wf_plugin.tmpl b/src/watts_ui/etc/templates/wf_plugin.tmpl new file mode 100644 index 00000000..e2644eb6 --- /dev/null +++ b/src/watts_ui/etc/templates/wf_plugin.tmpl @@ -0,0 +1 @@ +plugin = plugin_name \ No newline at end of file diff --git a/src/watts_ui/etc/watts.sch b/src/watts_ui/etc/watts.sch index a307df09..c98ecb14 100644 --- a/src/watts_ui/etc/watts.sch +++ b/src/watts_ui/etc/watts.sch @@ -118,7 +118,7 @@ watts{ } plugin{ Description = "[optional] plugin specification" - InputTmpl="flagtypes" + InputTmpl="wf_plugin" MinOccurs=0 MaxOccurs=NoLimit ValType=String @@ -126,13 +126,13 @@ watts{ } variables{ Description = "[optional] Variables definition" - InputTmpl="sonobject" + InputTmpl="variables" MinOccurs=0 MaxOccurs=1 ChildUniqueness = [ "param/id"] param{ Description = "[optional] Parameter definition" - InputTmpl="param" + InputVariants=[ "value" "func" "list" "bool" ] MinOccurs=1 MaxOccurs=NoLimit id{ @@ -154,17 +154,17 @@ watts{ MinOccurs=0 MaxOccurs=1 } - range{ - Description = "[optional] range of the value (for optimization)" - InputTmpl="sonarray" - MinOccurs=0 - MaxOccurs=1 - value{ - MinOccurs=2 - MaxOccurs=2 - ValType=Real - } - } +% range{ +% Description = "[optional] range of the value (for optimization)" +% InputTmpl="sonarray" +% MinOccurs=0 +% MaxOccurs=1 +% value{ +% MinOccurs=2 +% MaxOccurs=2 +% ValType=Real +% } +% } bool{ Description = "[optional] boolean" InputTmpl="flagtypes" From 6dd0eb470ed89eaf60aadfdbb087f0ccdb9513c2 Mon Sep 17 00:00:00 2001 From: Zhiee Jhia Ooi Date: Thu, 12 Jan 2023 11:24:04 -0600 Subject: [PATCH 16/18] Addressed reviewer comments --- doc/source/user/workbench.rst | 5 ++- .../1App_OpenMC_VHTR/watts_comprehensive.son | 4 --- .../watts_comprehensive.son | 4 --- .../watts_comprehensive.son | 4 --- .../1App_SAM_VHTR/watts_comprehensive.son | 4 --- .../watts_comprehensive.son | 4 --- .../watts_comprehensive.son | 4 --- .../watts_comprehensive.son | 4 --- .../watts_comprehensive.son | 8 ++--- src/watts_ui/etc/watts.sch | 14 +------- src/watts_ui/watts_ui.py | 32 +++++++------------ 11 files changed, 19 insertions(+), 68 deletions(-) diff --git a/doc/source/user/workbench.rst b/doc/source/user/workbench.rst index 20abfe4c..30e7021a 100755 --- a/doc/source/user/workbench.rst +++ b/doc/source/user/workbench.rst @@ -175,4 +175,7 @@ where `plugin_main` and `plugin_sub` are the plugin IDs of the two applications, used for evaluating convergence, `convergence_criteria` is the tolerance for convergence, `to_sub_params` and `to_main_params` are lists of parameters whose values are iterated between the two applications where they each must have at least -one parameter. +one parameter. Note that the parameter supplied to `convergence_params` must be +an output from the second plugin. For instance, in the above example, "keff" is +an output produced by the plugin of "ID2". The same also applies for `to_sub_params` +and `to_main_params`. diff --git a/examples/1App_OpenMC_VHTR/watts_comprehensive.son b/examples/1App_OpenMC_VHTR/watts_comprehensive.son index ec668111..92a8aa3f 100644 --- a/examples/1App_OpenMC_VHTR/watts_comprehensive.son +++ b/examples/1App_OpenMC_VHTR/watts_comprehensive.son @@ -1,8 +1,4 @@ watts{ - % Change the working directory to the directory where the input files are stored. This is necessary - % due to how WATTS copies input files to the temporary working directory. - workflow_dir = "/Users/zhieejhiaooi/Documents/ANL/watts-devel/watts/examples/1App_OpenMC_VHTR" - plugins{ plugin(ID1){ code = openmc diff --git a/examples/1App_PyARC_UnitCell/watts_comprehensive.son b/examples/1App_PyARC_UnitCell/watts_comprehensive.son index fc5ac704..c157804f 100644 --- a/examples/1App_PyARC_UnitCell/watts_comprehensive.son +++ b/examples/1App_PyARC_UnitCell/watts_comprehensive.son @@ -1,8 +1,4 @@ watts{ - % Change the working directory to the directory where the input files are stored. This is necessary - % due to how WATTS copies input files to the temporary working directory. - workflow_dir = "/Users/zhieejhiaooi/Documents/ANL/watts-devel/watts/examples/1App_PyARC_UnitCell" - plugins{ plugin(ID1){ code = "PyARC" diff --git a/examples/1App_RELAP5_SingleChannel/watts_comprehensive.son b/examples/1App_RELAP5_SingleChannel/watts_comprehensive.son index 56569afa..822b3eab 100644 --- a/examples/1App_RELAP5_SingleChannel/watts_comprehensive.son +++ b/examples/1App_RELAP5_SingleChannel/watts_comprehensive.son @@ -1,8 +1,4 @@ watts{ - % Change the working directory to the directory where the input files are stored. This is necessary - % due to how WATTS copies input files to the temporary working directory. - workflow_dir = "/Users/zhieejhiaooi/Documents/ANL/watts-devel/watts/examples/1App_RELAP5_SingleChannel" - % Make sure that all necessary files (executable, fluid property files, etc) are in the % same directory as the input and template files. plugins{ diff --git a/examples/1App_SAM_VHTR/watts_comprehensive.son b/examples/1App_SAM_VHTR/watts_comprehensive.son index beb484d1..3b2f5a87 100644 --- a/examples/1App_SAM_VHTR/watts_comprehensive.son +++ b/examples/1App_SAM_VHTR/watts_comprehensive.son @@ -1,8 +1,4 @@ watts{ - % Change the working directory to the directory where the input files are stored. This is necessary - % due to how WATTS copies input files to the temporary working directory. - workflow_dir = "/Users/zhieejhiaooi/Documents/ANL/watts-devel/watts/examples/1App_SAM_VHTR" - plugins{ plugin(ID1){ code = moose diff --git a/examples/1App_SAS_MultiTemplates_SodiumLoop/watts_comprehensive.son b/examples/1App_SAS_MultiTemplates_SodiumLoop/watts_comprehensive.son index bc628d15..b5a17b35 100644 --- a/examples/1App_SAS_MultiTemplates_SodiumLoop/watts_comprehensive.son +++ b/examples/1App_SAS_MultiTemplates_SodiumLoop/watts_comprehensive.son @@ -1,8 +1,4 @@ watts{ - % Change the working directory to the directory where the input files are stored. This is necessary - % due to how WATTS copies input files to the temporary working directory. - workflow_dir = "/Users/zhieejhiaooi/Documents/ANL/watts-devel/watts/examples/1App_SAS_MultiTemplates_SodiumLoop" - plugins{ plugin(ID1){ code = "sas" diff --git a/examples/1App_SAS_SodiumLoop/watts_comprehensive.son b/examples/1App_SAS_SodiumLoop/watts_comprehensive.son index c3d4bc46..a70ea297 100644 --- a/examples/1App_SAS_SodiumLoop/watts_comprehensive.son +++ b/examples/1App_SAS_SodiumLoop/watts_comprehensive.son @@ -1,8 +1,4 @@ watts{ - % Change the working directory to the directory where the input files are stored. This is necessary - % due to how WATTS copies input files to the temporary working directory. - workflow_dir = "/Users/zhieejhiaooi/Documents/ANL/watts-devel/watts/examples/1App_SAS_SodiumLoop" - plugins{ plugin(ID1){ code = "sas" diff --git a/examples/ParamStudy_SAM_SimpleJunction_Workbench/watts_comprehensive.son b/examples/ParamStudy_SAM_SimpleJunction_Workbench/watts_comprehensive.son index bf2f7eb6..8c685e6e 100644 --- a/examples/ParamStudy_SAM_SimpleJunction_Workbench/watts_comprehensive.son +++ b/examples/ParamStudy_SAM_SimpleJunction_Workbench/watts_comprehensive.son @@ -1,8 +1,4 @@ watts{ - % Change the working directory to the directory where the input files are stored. This is necessary - % due to how WATTS copies input files to the temporary working directory. - workflow_dir = "/Users/zhieejhiaooi/Documents/ANL/watts-devel/watts/examples/ParamStudy_SAM_SimpleJunction_Workbench" - plugins{ plugin(ID1){ code = moose diff --git a/examples/PicardIterations_SAM-OpenMC_VHTR_Workbench/watts_comprehensive.son b/examples/PicardIterations_SAM-OpenMC_VHTR_Workbench/watts_comprehensive.son index 7326e22d..f695e8e5 100644 --- a/examples/PicardIterations_SAM-OpenMC_VHTR_Workbench/watts_comprehensive.son +++ b/examples/PicardIterations_SAM-OpenMC_VHTR_Workbench/watts_comprehensive.son @@ -1,8 +1,4 @@ watts{ - % Change the working directory to the directory where the input files are stored. This is necessary - % due to how WATTS copies input files to the temporary working directory. - workflow_dir = "/Users/zhieejhiaooi/Documents/ANL/watts-devel/watts/examples/PicardIterations_SAM-OpenMC_VHTR_Workbench" - plugins{ plugin(ID1){ code = moose @@ -21,6 +17,7 @@ watts{ } workflow_level1{ + plugin = ID1 variables{ param(He_inlet_temp) {value = 873.15} param(He_outlet_temp) {value = 1023.15} @@ -61,8 +58,7 @@ watts{ } iteration{ - plugin_main = ID1 - plugin_sub = ID2 + plugin = ID2 % ID of plugin to iterate with nmax = 10 convergence_params = "keff" convergence_criteria = 0.0001 diff --git a/src/watts_ui/etc/watts.sch b/src/watts_ui/etc/watts.sch index a307df09..0f4721fe 100644 --- a/src/watts_ui/etc/watts.sch +++ b/src/watts_ui/etc/watts.sch @@ -17,13 +17,7 @@ watts{ InputTmpl="sonobject" MinOccurs=0 MaxOccurs=1 - plugin_main{ - Description = "[required] ID of the first plugin" - MinOccurs=1 - MaxOccurs=1 - ValType=String - } - plugin_sub{ + plugin{ Description = "[required] ID of the second plugin" MinOccurs=1 MaxOccurs=1 @@ -361,10 +355,4 @@ watts{ } } } - workflow_dir{ - Description = "[Required] Workflow directory: Dir where all files are located in. Necessary if have multiple input files." - InputTmpl="sonobject" - MinOccurs=1 - MaxOccurs=1 - } } diff --git a/src/watts_ui/watts_ui.py b/src/watts_ui/watts_ui.py index 04f797c8..9da06e13 100755 --- a/src/watts_ui/watts_ui.py +++ b/src/watts_ui/watts_ui.py @@ -7,25 +7,11 @@ from typing import Optional import warnings -import openmc - from astropy.units import Quantity import numpy as np -# this needs to be installed in Workbench -# environment (follow example from setup_openmc or setup_dassh) import watts from wasppy import xml2obj -### -# etc nstauff$ cp watts.py /Applications/Workbench-5.0.0.app/Contents/rte/ -# pywatts nstauff$ mkdir bin -# pywatts nstauff$ ln -s /Applications/Workbench-5.0.0.app/Contents/bin/sonvalidxml bin/sonvalidxml -# pywatts nstauff$ ln -s /Applications/Workbench-5.0.0.app/Contents/wasppy ./ -# if needed - change wasppy/xml2obj.py line 89 - if isinstance(src, (str,bytes)): -# chmod 777 watts_ui.py -# execute with command: `python watts_ui.py -i examples/watts_comprehensive.son` -### - def load_obj(input_path, watts_path): """Converts son file to xml stream and create python data structure @@ -409,6 +395,7 @@ def run_direct(watts_params, plugin): elif plugin['code'].upper() == 'OPENMC': sys.path.insert(0, os.getcwd()) + import openmc from openmc_template import build_openmc_model app_plugin = watts.PluginOpenMC( @@ -482,8 +469,8 @@ def run_iterate(watts_params, plugin, wf_level): """ operation = wf_level.iteration - plugin_1 = str(operation.plugin_main.value).strip('\"') - plugin_2 = str(operation.plugin_sub.value).strip('\"') + plugin_1 = str(wf_level.plugin.value).strip('\"') + plugin_2 = str(operation.plugin.value).strip('\"') nmax = float(str(operation.nmax.value)) tolerance = float(str(operation.convergence_criteria.value)) convergence_params = str(operation.convergence_params.value).strip('\"') @@ -564,9 +551,15 @@ def run_parametric(watts_params, plugin, wf_level): return (watts_params, app_result) -# Need to update and get properly from workbench the executable path and the argument -watts_path = "/Users/zhieejhiaooi/Documents/ANL/watts-devel/watts/src/watts_ui/" +# Get WATTS_DIR from environment +if "WATTS_DIR" in os.environ: + watts_path = os.environ["WATTS_DIR"] +else: + raise RuntimeError( + "WATTS_DIR variable does not exist in environment. Please set WATTS_DIR to environment.") + opts, args = getopt.getopt(sys.argv[1:], "hi:o:", ["ifile=", "ofile="]) + for opt, arg in opts: if opt == "-i": input_path = os.getcwd() + "/" + str(arg) @@ -578,8 +571,7 @@ def run_parametric(watts_params, plugin, wf_level): # the extra input files are stored. This is necessary # due to how WATTS copies extra input files to the # temporary working directory. -if watts_wb.workflow_dir is not None: - os.chdir(str(watts_wb.workflow_dir.value).strip('\"')) +os.chdir(os.getcwd()) # Load plugins if watts_wb.plugins is not None: From 193c444f6d713dfbe09f03cde4ad993f1760f004 Mon Sep 17 00:00:00 2001 From: Nicolas Stauff Date: Wed, 11 Jan 2023 13:15:12 -0600 Subject: [PATCH 17/18] added a few templates and modified schema accordingly. --- src/watts_ui/etc/templates/param.bool.tmpl | 1 + src/watts_ui/etc/templates/param.func.tmpl | 1 + src/watts_ui/etc/templates/param.list.tmpl | 1 + src/watts_ui/etc/templates/param.tmpl | 1 - src/watts_ui/etc/templates/param.value.tmpl | 1 + src/watts_ui/etc/templates/variables.tmpl | 6 +++++ src/watts_ui/etc/templates/wf_plugin.tmpl | 1 + src/watts_ui/etc/watts.sch | 28 ++++++++++----------- 8 files changed, 25 insertions(+), 15 deletions(-) create mode 100644 src/watts_ui/etc/templates/param.bool.tmpl create mode 100644 src/watts_ui/etc/templates/param.func.tmpl create mode 100644 src/watts_ui/etc/templates/param.list.tmpl delete mode 100644 src/watts_ui/etc/templates/param.tmpl create mode 100644 src/watts_ui/etc/templates/param.value.tmpl create mode 100644 src/watts_ui/etc/templates/variables.tmpl create mode 100644 src/watts_ui/etc/templates/wf_plugin.tmpl diff --git a/src/watts_ui/etc/templates/param.bool.tmpl b/src/watts_ui/etc/templates/param.bool.tmpl new file mode 100644 index 00000000..fc47f7f5 --- /dev/null +++ b/src/watts_ui/etc/templates/param.bool.tmpl @@ -0,0 +1 @@ +params( id ){bool = True} \ No newline at end of file diff --git a/src/watts_ui/etc/templates/param.func.tmpl b/src/watts_ui/etc/templates/param.func.tmpl new file mode 100644 index 00000000..27ab91f7 --- /dev/null +++ b/src/watts_ui/etc/templates/param.func.tmpl @@ -0,0 +1 @@ +params( id ){func = 'a + b' } \ No newline at end of file diff --git a/src/watts_ui/etc/templates/param.list.tmpl b/src/watts_ui/etc/templates/param.list.tmpl new file mode 100644 index 00000000..2c8a728b --- /dev/null +++ b/src/watts_ui/etc/templates/param.list.tmpl @@ -0,0 +1 @@ +params( id ){list = [ 0 ] } \ No newline at end of file diff --git a/src/watts_ui/etc/templates/param.tmpl b/src/watts_ui/etc/templates/param.tmpl deleted file mode 100644 index d2eb4f8f..00000000 --- a/src/watts_ui/etc/templates/param.tmpl +++ /dev/null @@ -1 +0,0 @@ -params( id ){value = 0 unit= m range = [ 0 0 ]} \ No newline at end of file diff --git a/src/watts_ui/etc/templates/param.value.tmpl b/src/watts_ui/etc/templates/param.value.tmpl new file mode 100644 index 00000000..fdfaeac8 --- /dev/null +++ b/src/watts_ui/etc/templates/param.value.tmpl @@ -0,0 +1 @@ +params( id ){value = 0 unit= m} \ No newline at end of file diff --git a/src/watts_ui/etc/templates/variables.tmpl b/src/watts_ui/etc/templates/variables.tmpl new file mode 100644 index 00000000..7ddc327c --- /dev/null +++ b/src/watts_ui/etc/templates/variables.tmpl @@ -0,0 +1,6 @@ +variables{ +% params( id ){value = 0 unit= m} +% params( id ){func = 'a + b' } +% params( id ){list = [ 0 ] } +% params( id ){bool = True} +} \ No newline at end of file diff --git a/src/watts_ui/etc/templates/wf_plugin.tmpl b/src/watts_ui/etc/templates/wf_plugin.tmpl new file mode 100644 index 00000000..e2644eb6 --- /dev/null +++ b/src/watts_ui/etc/templates/wf_plugin.tmpl @@ -0,0 +1 @@ +plugin = plugin_name \ No newline at end of file diff --git a/src/watts_ui/etc/watts.sch b/src/watts_ui/etc/watts.sch index 0f4721fe..618528ff 100644 --- a/src/watts_ui/etc/watts.sch +++ b/src/watts_ui/etc/watts.sch @@ -112,7 +112,7 @@ watts{ } plugin{ Description = "[optional] plugin specification" - InputTmpl="flagtypes" + InputTmpl="wf_plugin" MinOccurs=0 MaxOccurs=NoLimit ValType=String @@ -120,13 +120,13 @@ watts{ } variables{ Description = "[optional] Variables definition" - InputTmpl="sonobject" + InputTmpl="variables" MinOccurs=0 MaxOccurs=1 ChildUniqueness = [ "param/id"] param{ Description = "[optional] Parameter definition" - InputTmpl="param" + InputVariants=[ "value" "func" "list" "bool" ] MinOccurs=1 MaxOccurs=NoLimit id{ @@ -148,17 +148,17 @@ watts{ MinOccurs=0 MaxOccurs=1 } - range{ - Description = "[optional] range of the value (for optimization)" - InputTmpl="sonarray" - MinOccurs=0 - MaxOccurs=1 - value{ - MinOccurs=2 - MaxOccurs=2 - ValType=Real - } - } +% range{ +% Description = "[optional] range of the value (for optimization)" +% InputTmpl="sonarray" +% MinOccurs=0 +% MaxOccurs=1 +% value{ +% MinOccurs=2 +% MaxOccurs=2 +% ValType=Real +% } +% } bool{ Description = "[optional] boolean" InputTmpl="flagtypes" From 50abc5edc59c5fc54f3385c59c2967fe7dbe9ba2 Mon Sep 17 00:00:00 2001 From: Zhiee Jhia Ooi Date: Tue, 17 Jan 2023 08:04:41 -0600 Subject: [PATCH 18/18] Addressed reviewers comments --- doc/source/dev/workbench.rst | 103 ++++++ doc/source/user/workbench.rst | 94 ++++-- examples/1App_OpenMC_VHTR/README.md | 2 +- .../{watts_comprehensive.son => watts_wb.son} | 2 +- examples/1App_PyARC_UnitCell/README.md | 2 +- .../{watts_comprehensive.son => watts_wb.son} | 0 examples/1App_RELAP5_SingleChannel/README.md | 2 +- .../{watts_comprehensive.son => watts_wb.son} | 0 examples/1App_SAM_VHTR/README.md | 2 +- .../{watts_comprehensive.son => watts_wb.son} | 0 .../README.md | 2 +- .../{watts_comprehensive.son => watts_wb.son} | 0 examples/1App_SAS_SodiumLoop/README.md | 2 +- .../{watts_comprehensive.son => watts_wb.son} | 0 .../README.md | 21 ++ .../sam_template_0 | 149 +++++++++ .../sam_template_1 | 149 +++++++++ .../watts_wb.son | 36 ++ .../README.md | 2 +- .../{watts_comprehensive.son => watts_wb.son} | 3 +- .../README.md | 2 +- .../{watts_comprehensive.son => watts_wb.son} | 4 +- examples/README.md | 1 + scripts/setup_conda_wb.sh | 17 +- src/watts_ui/etc/templates/iteration.tmpl | 9 + src/watts_ui/etc/templates/param.bool.tmpl | 2 +- src/watts_ui/etc/templates/param.func.tmpl | 2 +- src/watts_ui/etc/templates/param.list.tmpl | 2 +- src/watts_ui/etc/templates/param.value.tmpl | 2 +- src/watts_ui/etc/templates/parametric.tmpl | 5 + .../etc/templates/plugin.auto_link_files.tmpl | 1 + .../etc/templates/plugin.conv_channel.tmpl | 1 + .../etc/templates/plugin.conv_primar4.tmpl | 1 + .../etc/templates/plugin.exec_dir.tmpl | 1 + .../etc/templates/plugin.exec_name.tmpl | 1 + .../etc/templates/plugin.executable.tmpl | 1 + .../etc/templates/plugin.extra_args.tmpl | 1 + .../etc/templates/plugin.extra_inputs.tmpl | 1 + .../plugin.extra_template_inputs.tmpl | 1 + .../etc/templates/plugin.plotfl_to_csv.tmpl | 1 + .../etc/templates/plugin.score_names.tmpl | 1 + src/watts_ui/etc/templates/plugin.scores.tmpl | 1 + src/watts_ui/etc/templates/plugin.tmpl | 6 + .../etc/templates/plugin.transfer_params.tmpl | 1 + src/watts_ui/etc/templates/plugin_id.tmpl | 1 + src/watts_ui/etc/templates/plugins.tmpl | 8 + src/watts_ui/etc/templates/variables.tmpl | 8 +- src/watts_ui/etc/templates/watts.tmpl | 12 +- src/watts_ui/etc/templates/wf_plugin.tmpl | 1 - src/watts_ui/etc/templates/workflow.tmpl | 7 + .../etc/templates/workflow_level1.tmpl | 9 + src/watts_ui/etc/watts.sch | 312 +++++++++--------- src/watts_ui/watts_ui.py | 59 ++-- 53 files changed, 815 insertions(+), 238 deletions(-) create mode 100644 doc/source/dev/workbench.rst rename examples/1App_OpenMC_VHTR/{watts_comprehensive.son => watts_wb.son} (98%) rename examples/1App_PyARC_UnitCell/{watts_comprehensive.son => watts_wb.son} (100%) rename examples/1App_RELAP5_SingleChannel/{watts_comprehensive.son => watts_wb.son} (100%) rename examples/1App_SAM_VHTR/{watts_comprehensive.son => watts_wb.son} (100%) rename examples/1App_SAS_MultiTemplates_SodiumLoop/{watts_comprehensive.son => watts_wb.son} (100%) rename examples/1App_SAS_SodiumLoop/{watts_comprehensive.son => watts_wb.son} (100%) create mode 100644 examples/MultiApp_SAM_SimpleJunction_Workbench/README.md create mode 100644 examples/MultiApp_SAM_SimpleJunction_Workbench/sam_template_0 create mode 100644 examples/MultiApp_SAM_SimpleJunction_Workbench/sam_template_1 create mode 100644 examples/MultiApp_SAM_SimpleJunction_Workbench/watts_wb.son rename examples/ParamStudy_SAM_SimpleJunction_Workbench/{watts_comprehensive.son => watts_wb.son} (91%) rename examples/PicardIterations_SAM-OpenMC_VHTR_Workbench/{watts_comprehensive.son => watts_wb.son} (94%) create mode 100644 src/watts_ui/etc/templates/iteration.tmpl create mode 100644 src/watts_ui/etc/templates/parametric.tmpl create mode 100644 src/watts_ui/etc/templates/plugin.auto_link_files.tmpl create mode 100644 src/watts_ui/etc/templates/plugin.conv_channel.tmpl create mode 100644 src/watts_ui/etc/templates/plugin.conv_primar4.tmpl create mode 100644 src/watts_ui/etc/templates/plugin.exec_dir.tmpl create mode 100644 src/watts_ui/etc/templates/plugin.exec_name.tmpl create mode 100644 src/watts_ui/etc/templates/plugin.executable.tmpl create mode 100644 src/watts_ui/etc/templates/plugin.extra_args.tmpl create mode 100644 src/watts_ui/etc/templates/plugin.extra_inputs.tmpl create mode 100644 src/watts_ui/etc/templates/plugin.extra_template_inputs.tmpl create mode 100644 src/watts_ui/etc/templates/plugin.plotfl_to_csv.tmpl create mode 100644 src/watts_ui/etc/templates/plugin.score_names.tmpl create mode 100644 src/watts_ui/etc/templates/plugin.scores.tmpl create mode 100644 src/watts_ui/etc/templates/plugin.tmpl create mode 100644 src/watts_ui/etc/templates/plugin.transfer_params.tmpl create mode 100644 src/watts_ui/etc/templates/plugin_id.tmpl create mode 100644 src/watts_ui/etc/templates/plugins.tmpl delete mode 100644 src/watts_ui/etc/templates/wf_plugin.tmpl create mode 100644 src/watts_ui/etc/templates/workflow.tmpl create mode 100644 src/watts_ui/etc/templates/workflow_level1.tmpl diff --git a/doc/source/dev/workbench.rst b/doc/source/dev/workbench.rst new file mode 100644 index 00000000..9e3e55c7 --- /dev/null +++ b/doc/source/dev/workbench.rst @@ -0,0 +1,103 @@ +.. devguide_workbench: + +Adding Application to Workbench +------------------------------- + +If you wish to use WATTS on the NEAMS Workbench with a code +that is not already available, adding the code can be done quite easily. + +First, you have to develop a plugin for the code and add it to WATTS following +the steps described previously. Once the plugin is available, you can then add it +to `watts_ui.py`. + +In the `run_direct()` function, you will need to add an `elif` statement as follows, + +.. code-block:: + + elif plugin['code'].upper() == '': + app_plugin = watts.name_of_new_plugin( + template_file=plugin['template'], + executable=exec, + extra_inputs=plugin['extra_inputs'], + extra_template_inputs=plugin['extra_template_inputs'], + show_stdout=plugin['show_stdout'], + show_stderr=plugin['show_stderr']) + +Note tha additional steps might be necessary here depending on the code that +is being added. + +If the plugin is developed to be similar to the other plugins on WATTS, +no other changes are necessary to `watts_ui.py`. Otherwise, the developer +is responsible for making sure that `watt_ui.py` can read the results +produced by the plugin. Within `run_direct()`, the results from the plugin +should be extracted and saved to `watts_params` as individual entries. This +is required for the coupling and data-transfer between different codes. + +Next, the `watts.sch` file needs to be updated. The name of the new code needs +to be added to the `code` block as follows:: + + watts{ + plugins{ + plugin{ + code{ + Description = "[Required] All - Name of application" + ... + ValEnums=[PyARC RELAP5 ... ] + } + } + } + } + +Note that the name used for the new code used here must match that used in +`watts_ui.py`. + +Adding new plugin options ++++++++++++++++++++++++++ + +Any additional options needed by the plugin can be added under the `plugin` +block as follows:: + + watts{ + plugins{ + plugin{ + additional_plugin_option{ + Description = "[optional] New_code - Description of the new option" + MinOccurs=0 + MaxOccurs=1 + ValType=String + InputTmpl="plugin.additional_plugin_option" + } + } + } + } + +Note that `MinOccurs` and `MaxOccurs` represent the minimum and maximum occurences of +this option, `ValType` is the input type of the new option, and `InputTmpl` is the +template file for the new option located in the `etc/templates` directory. Template +file is optional but highly recommended as it provides a template or example to other users. + +If new plugin options are added, the `create_plugins()` function in `watts_ui.py` must +be updated. The function essentially creates a nested Python dictionary that contains one +or more individual dictionaries where each individual dictionary stores the information +of each plugin. The function utilizes a series of `if` statements to decide what information +should be stored for each plugin. + +If the input of the new option is a string, the new option can be added as follows :: + + if plg.new_option_name is not None: + nested_plugins['new_option_name'] = str( + plg.new_option_name.value).strip('\"') + +If the input is a list :: + + if plg.new_option_name is not None: + nested_plugins['new_option_name'] = convert_to_list(plg.new_option_name) + +If the input is a bool :: + + nested_plugins['new_option_name'] = False + + if plg.new_option_name is not None and str(plg.new_option_name.value).capitalize() == 'True': + nested_plugins['new_option_name'] = True + +Similar approach can be used for plugin options of different input types. diff --git a/doc/source/user/workbench.rst b/doc/source/user/workbench.rst index 30e7021a..13aa6f53 100755 --- a/doc/source/user/workbench.rst +++ b/doc/source/user/workbench.rst @@ -10,8 +10,8 @@ and visualization for integrated codes. Instructions on how to download and inst Workbench can be found on the Workbench `Gitlab repository `. -To set up WATTS in the Workbench environment, user needs to first provide the path to -where Workbench is installed in `workbench.sh` under the `scripts` directory. User can +To set up WATTS in the Workbench environment, you first need to first provide the path to +where Workbench is installed in `workbench.sh` under the `scripts` directory. You can then run `setup_conda_wb.sh` under the same directory to set up WATTS within the Workbench environment. @@ -19,7 +19,7 @@ Optional: To install OpenMC in the Workbench environemnt, run `setup_openmc.sh`. To finish setting up WATTS, open Workbench and go to the `File` tab at the top-left corner then select `Configurations` from the drop menu. In the `Application configurations` -window, click `Add` on the top most row then select `WATTS` from the pop-up window. +window, click `Add` on the top most row then select `Watts` from the pop-up window. In the list of `Application Options`, input the path of `watts_ui.py` to `Executable`. The file should exist by default in `/watts/src/watt_ui/`. Next, click `Load Grammar`. Click `OK` to complete the setup. @@ -35,9 +35,7 @@ file can also be dragged and dropped to the Workbench window. The WATTS input file utilizes a hierarchical block-based system where a block is defined with opening and closing curly braces `{ }`. A `watts` block is first -created within which other blocks and variables can be defined. Within the `watts` -block, `workflow_dir` needs to be defined as the path to the working directory -(where all templates and extra files are located). +created within which other blocks and variables can be defined. Plugins ~~~~~~~ @@ -53,7 +51,7 @@ The `plugins` block is required. Within the `plugins` blocks are exec_dir = SAM_DIR exec_name = "sam-opt" extra_inputs=["file1", "file2", "file3"] - extra_templat_inputs=["template1", "template2", "template3"] + extra_template_inputs=["template1", "template2", "template3"] show_stderr = False show_stdout = False } @@ -77,7 +75,7 @@ in the snippet above. For each sub-block the basic inputs are:: `show_stdout` : Option to display output `exec_dir` : Environment variable that points to the directory in which the application's executable is stored `extra_inputs` : Additional non-templated input files - `extra_templateinputs` : Additional tempalted input files + `extra_template_inputs` : Additional tempalted input files `exec_name` : Name of the executable `executable` : Path to the executable @@ -86,6 +84,7 @@ ONLY `executable`. Additionally, there are application-specific inputs that can be provided to the plugins such as:: `extra_args` (multiple apps) : Extra arguments to applications + 'transfer_params' (multiple apps) : Output to transfer between applications for multi-apps run `plotfl_to_csv` (RELAP5) : Option to convert `plotfl` file to `csv` file `conv_channel` (SAS) : Path to `CHANNELtoCSV.x` `conv_primar4` (SAS) : Path to `PRIMAR4toCSV.x` @@ -93,6 +92,22 @@ that can be provided to the plugins such as:: `scores` (OpenMC) : List of filters for tallies `score_names` (OpenMC) : List of user-given names for tally filters +Currently all applications/codes already integrated to WATTS can be run on Workbench, these include +PyARC, OpenMC, SERPENT, ABCE, MCNP, MOOSE, SAS, Dakota, Serpent, and RELAP5. + +For OpenMC, multiple `scores` can be provided at once. If provided, the number of `score_names` must be the +same as the number of `scores`. For instance, :: + + scores = ["elastic", "nu-fission"] + score_names = ["total_elastic_scatter_rate", "total_fission_neutron_prod"] + +and there are N tallies where N > 1, then the outputs of the run will be named as:: + + total_elastic_scatter_rate_1, total_elastic_scatter_rate_2, ..., total_elastic_scatter_rate_N + total_fission_neutron_prod_1, total_fission_neutron_prod_2, ..., total_fission_neutron_prod_N + +If `score_names` is not provided, `scores` will be used as the base name for the outputs. + Workflow level ~~~~~~~~~~~~~~ @@ -101,8 +116,21 @@ by the `plugin` keyword:: plugin = ID1 -where 'ID1' is the ID of the plugin provided in the `plugins` block. The -`variable` sub-block is where the values of the templated variables are +where 'ID1' is the ID of the plugin provided in the `plugins` block. When performing +a multi-app run where more than one plugins are used, the sequence of the run is +determined by the order of plugins. For example, when the order of the plugins is:: + + plugin = ID1 + plugin = ID2 + +Workbench will run ID1 first then ID2. On the other than, when the order is :: + + plugin = ID2 + plugin = ID1 + +Workbench will instead run ID1 first then ID2. + +The`variable` sub-block is where the values of the templated variables are specified, as shown below:: variables{ @@ -146,9 +174,17 @@ Parametric study To perform parametric study, a `parametric` block needs to be added to the `workflow_level1` block as follows:: - parametric{ + workflow_level1{ + plugin = ID1 + variables{ + param(He_inlet_temp) {value = 873.15} + param(He_outlet_temp) {value = 1023.15} + ... + } + parametric{ changing_params = "heat_source" changing_values = [0, 1e5, 2e5, 3e5] + } } where `changing_params` is the parameter whose values are varied and @@ -160,22 +196,32 @@ Picard iteration To perform Picard iteration, the `iteration` block needs to be added to the `workflow_level1` block:: - iteration{ - plugin_main = ID1 - plugin_sub = ID2 - nmax = 10 - convergence_params = "keff" - convergence_criteria = 0.0001 - to_sub_params = ["avg_Tf_1" "avg_Tf_2" "avg_Tf_3" "avg_Tf_4" "avg_Tf_5"] - to_main_params = ["Init_P_1" "Init_P_2" "Init_P_3" "Init_P_4" "Init_P_5"] + workflow_level1{ + plugin = ID1 + variables{ + param(He_inlet_temp) {value = 873.15} + param(He_outlet_temp) {value = 1023.15} + ... + } + iteration{ + plugin = ID2 + nmax = 10 + convergence_params = "keff" + convergence_criteria = 0.0001 + to_sub_params = ["avg_Tf_1" "avg_Tf_2" "avg_Tf_3" "avg_Tf_4" "avg_Tf_5"] + to_main_params = ["Init_P_1" "Init_P_2" "Init_P_3" "Init_P_4" "Init_P_5"] + } } -where `plugin_main` and `plugin_sub` are the plugin IDs of the two applications, -`nmax` is the maximum number of iterations, `convergence_params` is the parameter -used for evaluating convergence, `convergence_criteria` is the tolerance for +`plugin` in the `iteration` block is the plugin ID (ID2 in this example) of the +application that will be used along with the the first plugin (ID1 in this example) +to perform iteration. `nmax` is the maximum number of iterations, +`convergence_params` is the parameter used for evaluating convergence, +`convergence_criteria` is the tolerance for convergence, `to_sub_params` and `to_main_params` are lists of parameters whose values are iterated between the two applications where they each must have at least one parameter. Note that the parameter supplied to `convergence_params` must be an output from the second plugin. For instance, in the above example, "keff" is -an output produced by the plugin of "ID2". The same also applies for `to_sub_params` -and `to_main_params`. +an output produced by the plugin of "ID2". Note that the choice of "keff" in +this example is arbitrary and `convergence_params` should be chosen according to +the applications used and the objective of iteration runs. diff --git a/examples/1App_OpenMC_VHTR/README.md b/examples/1App_OpenMC_VHTR/README.md index 8e1a0baf..818e7186 100644 --- a/examples/1App_OpenMC_VHTR/README.md +++ b/examples/1App_OpenMC_VHTR/README.md @@ -18,4 +18,4 @@ This example provides a demonstration on how to use WATTS to perform a single SA - [__watts_exec.py__](watts_exec.py): WATTS workflow for this example. This is the file to execute to run the problem described above. - [__openmc_template__](openmc_template.py): OpenMC templated model. -- [__watts_comprehensive.son__](watts_comprehensive.son): Workbench input file for this example. +- [__watts_wb.son__](watts_wb.son): Workbench input file for this example. diff --git a/examples/1App_OpenMC_VHTR/watts_comprehensive.son b/examples/1App_OpenMC_VHTR/watts_wb.son similarity index 98% rename from examples/1App_OpenMC_VHTR/watts_comprehensive.son rename to examples/1App_OpenMC_VHTR/watts_wb.son index 92a8aa3f..52427b21 100644 --- a/examples/1App_OpenMC_VHTR/watts_comprehensive.son +++ b/examples/1App_OpenMC_VHTR/watts_wb.son @@ -10,7 +10,7 @@ watts{ } workflow_level1{ - plugin = ID1 + plugin = ID1 variables{ param(ax_ref) {value = 2.0} param(num_cool_pins) {value = 24} diff --git a/examples/1App_PyARC_UnitCell/README.md b/examples/1App_PyARC_UnitCell/README.md index 2afe52ea..651b85bb 100644 --- a/examples/1App_PyARC_UnitCell/README.md +++ b/examples/1App_PyARC_UnitCell/README.md @@ -18,4 +18,4 @@ This example provides a demonstration on how to use WATTS to perform a single Py - [__watts_exec.py__](watts_exec.py): WATTS workflow for this example. This is the file to execute to run the problem described above. - [__pyarc_template__](pyarc_template): PyARC templated input file. - [__lumped.son__](lumped.son): SON file referenced in PyARC input with description of lumped fission products. -- [__watts_comprehensive.son__](watts_comprehensive.son): Workbench input file for this example. \ No newline at end of file +- [__watts_wb.son__](watts_wb.son): Workbench input file for this example. \ No newline at end of file diff --git a/examples/1App_PyARC_UnitCell/watts_comprehensive.son b/examples/1App_PyARC_UnitCell/watts_wb.son similarity index 100% rename from examples/1App_PyARC_UnitCell/watts_comprehensive.son rename to examples/1App_PyARC_UnitCell/watts_wb.son diff --git a/examples/1App_RELAP5_SingleChannel/README.md b/examples/1App_RELAP5_SingleChannel/README.md index b08e7802..ea2feff9 100755 --- a/examples/1App_RELAP5_SingleChannel/README.md +++ b/examples/1App_RELAP5_SingleChannel/README.md @@ -17,4 +17,4 @@ This example provides a demonstration on how to use WATTS to run RELAP5-3D. - [__watts_exec.py__](watts_exec.py): This is the file to execute to run the problem described above. - [__relap5_template__](relap5_template): Templated RELAP5-3D input. -- [__watts_comprehensive.son__](watts_comprehensive.son): Workbench input file for this example. +- [__watts_wb.son__](watts_wb.son): Workbench input file for this example. diff --git a/examples/1App_RELAP5_SingleChannel/watts_comprehensive.son b/examples/1App_RELAP5_SingleChannel/watts_wb.son similarity index 100% rename from examples/1App_RELAP5_SingleChannel/watts_comprehensive.son rename to examples/1App_RELAP5_SingleChannel/watts_wb.son diff --git a/examples/1App_SAM_VHTR/README.md b/examples/1App_SAM_VHTR/README.md index 26ec41c1..5364cfeb 100644 --- a/examples/1App_SAM_VHTR/README.md +++ b/examples/1App_SAM_VHTR/README.md @@ -18,4 +18,4 @@ This example provides a demonstration on how to use WATTS to perform a single SA - [__watts_exec.py__](watts_exec.py): WATTS workflow for this example. This is the file to execute to run the problem described above. - [__sam_template__](sam_template): SAM templated input file. -- [__watts_comprehensive.son__](watts_comprehensive.son): Workbench input file for this example. +- [__watts_wb__.son__](watts_wb.son): Workbench input file for this example. diff --git a/examples/1App_SAM_VHTR/watts_comprehensive.son b/examples/1App_SAM_VHTR/watts_wb.son similarity index 100% rename from examples/1App_SAM_VHTR/watts_comprehensive.son rename to examples/1App_SAM_VHTR/watts_wb.son diff --git a/examples/1App_SAS_MultiTemplates_SodiumLoop/README.md b/examples/1App_SAS_MultiTemplates_SodiumLoop/README.md index d24d62f3..95eb9bcb 100644 --- a/examples/1App_SAS_MultiTemplates_SodiumLoop/README.md +++ b/examples/1App_SAS_MultiTemplates_SodiumLoop/README.md @@ -25,4 +25,4 @@ This example provides a demonstration on how to use WATTS to perform a simulatio - [__PointKinetics__](PointKinetics): Extra templated SAS input. - [__PRIMAR4__](PRIMAR4): Extra templated SAS input. - [__Primary__](Primary): Extra templated SAS input. -- [__watts_comprehensive.son__](watts_comprehensive.son): Workbench input file for this example. \ No newline at end of file +- [__watts_wb.son__](watts_wb.son): Workbench input file for this example. \ No newline at end of file diff --git a/examples/1App_SAS_MultiTemplates_SodiumLoop/watts_comprehensive.son b/examples/1App_SAS_MultiTemplates_SodiumLoop/watts_wb.son similarity index 100% rename from examples/1App_SAS_MultiTemplates_SodiumLoop/watts_comprehensive.son rename to examples/1App_SAS_MultiTemplates_SodiumLoop/watts_wb.son diff --git a/examples/1App_SAS_SodiumLoop/README.md b/examples/1App_SAS_SodiumLoop/README.md index 4629f333..b16105f5 100644 --- a/examples/1App_SAS_SodiumLoop/README.md +++ b/examples/1App_SAS_SodiumLoop/README.md @@ -18,4 +18,4 @@ This example provides a demonstration on how to use WATTS for a simple SAS model - [__watts_exec.py__](watts_exec.py): This is the file to execute to run the problem described above. - [__sas_template__](sas_template): Templated SAS input. -- [__watts_comprehensive.son__](watts_comprehensive.son): Workbench input file for this example. \ No newline at end of file +- [__watts_wb.son__](watts_wb.son): Workbench input file for this example. \ No newline at end of file diff --git a/examples/1App_SAS_SodiumLoop/watts_comprehensive.son b/examples/1App_SAS_SodiumLoop/watts_wb.son similarity index 100% rename from examples/1App_SAS_SodiumLoop/watts_comprehensive.son rename to examples/1App_SAS_SodiumLoop/watts_wb.son diff --git a/examples/MultiApp_SAM_SimpleJunction_Workbench/README.md b/examples/MultiApp_SAM_SimpleJunction_Workbench/README.md new file mode 100644 index 00000000..8622f448 --- /dev/null +++ b/examples/MultiApp_SAM_SimpleJunction_Workbench/README.md @@ -0,0 +1,21 @@ +# MultiApp_SAM_SimpleJunction_Workbench + +## Purpose + +This example provides a demonstration on how to use WATTS on Workbench to run a coupled calculation where the results from one application is used as the input of another application + +## Code(s) + +- SAM + +## Keywords + +- Multiple applications +- Coupled run + +## File descriptions + +- [__watts_exec.py__](watts_exec.py): WATTS workflow for this example. This is the file to execute to run the problem described above. +- [__sam_template_0__](sam_template_0): SAM templated input file for the first run. +- [__sam_template_1__](sam_template_1): SAM templated input file for the second run. +- [__watts_wb.son__](watts_wb.son): Workbench input file for this example. \ No newline at end of file diff --git a/examples/MultiApp_SAM_SimpleJunction_Workbench/sam_template_0 b/examples/MultiApp_SAM_SimpleJunction_Workbench/sam_template_0 new file mode 100644 index 00000000..130fa857 --- /dev/null +++ b/examples/MultiApp_SAM_SimpleJunction_Workbench/sam_template_0 @@ -0,0 +1,149 @@ +[GlobalParams] + global_init_P = 1.2e5 + global_init_V = 1 + global_init_T = 628.15 + scaling_factor_var = '1 1e-3 1e-6' +[] + +[EOS] + [./eos] + type = PBSodiumEquationOfState + [../] +[] + +[Functions] + [./time_stepper] + type = PiecewiseLinear + x = ' 0 20 21 100 101 1e5' + y = '0.1 0.1 0.5 0.5 1 1' + [../] +[] + +[Components] + [./pipe1] + type = PBOneDFluidComponent + eos = eos + position = '0 0 0' + orientation = '0 0 1' + heat_source = {{ heat_source }} + f= {{ friction_factor }} + Dh = {{ Dh }} + length = 1 + # A = 3.14e-4 + A = {{ flow_area }} + n_elems = 10 + [../] + + [./pipe2] + type = PBOneDFluidComponent + eos = eos + position = '0 0 1' + orientation = '0 0 1' + f=0.1 + Dh = 0.01 + length = 1 + heat_source = 1e7 + A = 3.14e-4 + n_elems = 10 + [../] + + [./joint] + type = PBSingleJunction + eos = eos + inputs='pipe1(out)' + outputs='pipe2(in)' + weak_constraint = true + [../] + [./inlet] + type = PBTDJ + input = 'pipe1(in)' + eos = eos + v_bc = {{ velocity_inlet }} + T_bc = {{ temperature_inlet }} + [../] + + [./outlet] + type = PBTDV + input = 'pipe2(out)' + eos = eos + p_bc = '1.0e5' + T_bc = 728.15 + [../] +[] + +[Postprocessors] + [./TotalMassFlowRateInlet_2] + type = ComponentBoundaryFlow + input = 'pipe2(out)' + [../] + [./Inlet_Temperature_1] + type = ComponentBoundaryVariableValue + variable = temperature + input = 'pipe1(in)' + [../] + [./T_out_sam_template_0] + type = ComponentBoundaryVariableValue + variable = temperature + input = 'pipe2(out)' + [../] +[] + +[Preconditioning] + active = 'SMP_PJFNK' + + [./SMP_PJFNK] + type = SMP + full = true + solve_type = 'PJFNK' + petsc_options_iname = '-pc_type' + petsc_options_value = 'lu' + [../] +[] # End preconditioning block + + +[Executioner] + type = Transient + + dt = 1e-1 + dtmin = 1e-5 + + # setting time step range + [./TimeStepper] + type = FunctionDT + function = time_stepper + [../] + + petsc_options_iname = '-ksp_gmres_restart' + petsc_options_value = '100' + + nl_rel_tol = 1e-8 + nl_abs_tol = 1e-7 + nl_max_its = 20 + + l_tol = 1e-5 # Relative linear tolerance for each Krylov solve + l_max_its = 100 # Number of linear iterations for each Krylov solve + + start_time = 0.0 + end_time = 100. + + [./Quadrature] + type = TRAP + order = FIRST + [../] +[] # close Executioner section + +[Outputs] + perf_graph = true + [./out_displaced] + type = Exodus + use_displaced = true + execute_on = 'initial timestep_end' + sequence = false + [../] + [./csv] + type = CSV + [../] + [./console] + type = Console + [../] +[] diff --git a/examples/MultiApp_SAM_SimpleJunction_Workbench/sam_template_1 b/examples/MultiApp_SAM_SimpleJunction_Workbench/sam_template_1 new file mode 100644 index 00000000..eb2bd4bc --- /dev/null +++ b/examples/MultiApp_SAM_SimpleJunction_Workbench/sam_template_1 @@ -0,0 +1,149 @@ +[GlobalParams] + global_init_P = 1.2e5 + global_init_V = 1 + global_init_T = 628.15 + scaling_factor_var = '1 1e-3 1e-6' +[] + +[EOS] + [./eos] + type = PBSodiumEquationOfState + [../] +[] + +[Functions] + [./time_stepper] + type = PiecewiseLinear + x = ' 0 20 21 100 101 1e5' + y = '0.1 0.1 0.5 0.5 1 1' + [../] +[] + +[Components] + [./pipe1] + type = PBOneDFluidComponent + eos = eos + position = '0 0 0' + orientation = '0 0 1' + heat_source = {{ heat_source }} + f= {{ friction_factor }} + Dh = {{ Dh }} + length = 1 + # A = 3.14e-4 + A = {{ flow_area }} + n_elems = 10 + [../] + + [./pipe2] + type = PBOneDFluidComponent + eos = eos + position = '0 0 1' + orientation = '0 0 1' + f=0.1 + Dh = 0.01 + length = 1 + heat_source = 1e7 + A = 3.14e-4 + n_elems = 10 + [../] + + [./joint] + type = PBSingleJunction + eos = eos + inputs='pipe1(out)' + outputs='pipe2(in)' + weak_constraint = true + [../] + [./inlet] + type = PBTDJ + input = 'pipe1(in)' + eos = eos + v_bc = {{ velocity_inlet }} + T_bc = {{ T_out_sam_template_0 }} # Outlet temperature of Pipe_2 from file 'sam_template_0' + [../] + + [./outlet] + type = PBTDV + input = 'pipe2(out)' + eos = eos + p_bc = '1.0e5' + T_bc = 728.15 + [../] +[] + +[Postprocessors] + [./TotalMassFlowRateInlet_2] + type = ComponentBoundaryFlow + input = 'pipe2(out)' + [../] + [./Inlet_Temperature_1] + type = ComponentBoundaryVariableValue + variable = temperature + input = 'pipe1(in)' + [../] + [./Outlet_Temperature_2] + type = ComponentBoundaryVariableValue + variable = temperature + input = 'pipe2(out)' + [../] +[] + +[Preconditioning] + active = 'SMP_PJFNK' + + [./SMP_PJFNK] + type = SMP + full = true + solve_type = 'PJFNK' + petsc_options_iname = '-pc_type' + petsc_options_value = 'lu' + [../] +[] # End preconditioning block + + +[Executioner] + type = Transient + + dt = 1e-1 + dtmin = 1e-5 + + # setting time step range + [./TimeStepper] + type = FunctionDT + function = time_stepper + [../] + + petsc_options_iname = '-ksp_gmres_restart' + petsc_options_value = '100' + + nl_rel_tol = 1e-8 + nl_abs_tol = 1e-7 + nl_max_its = 20 + + l_tol = 1e-5 # Relative linear tolerance for each Krylov solve + l_max_its = 100 # Number of linear iterations for each Krylov solve + + start_time = 0.0 + end_time = 100. + + [./Quadrature] + type = TRAP + order = FIRST + [../] +[] # close Executioner section + +[Outputs] + perf_graph = true + [./out_displaced] + type = Exodus + use_displaced = true + execute_on = 'initial timestep_end' + sequence = false + [../] + [./csv] + type = CSV + [../] + [./console] + type = Console + [../] +[] diff --git a/examples/MultiApp_SAM_SimpleJunction_Workbench/watts_wb.son b/examples/MultiApp_SAM_SimpleJunction_Workbench/watts_wb.son new file mode 100644 index 00000000..db43a1bf --- /dev/null +++ b/examples/MultiApp_SAM_SimpleJunction_Workbench/watts_wb.son @@ -0,0 +1,36 @@ +watts{ + plugins{ + plugin(ID1){ + code = moose + template = "sam_template_0" + exec_dir = "SAM_DIR" + exec_name = "sam-opt" + show_stderr = False + show_stdout = False + transfer_params = ["T_out_sam_template_0"] + } + plugin(ID2){ + code = moose + template = "sam_template_1" + exec_dir = "SAM_DIR" + exec_name = "sam-opt" + show_stderr = False + show_stdout = False + } + } + + workflow_level1{ + plugin = ID1 + plugin = ID2 + variables{ + param(temperature_inlet) {value = 628.0} + param(friction_factor) {value = 0.1} + param(flow_area) {value = 3.14e-4} + param(Dh) {value = 1 unit = m} + param(velocity_inlet) {value = 1} + param(wall_bc) {bool = "True"} + param(heat_source) {value = 3e5} + } + } + +} \ No newline at end of file diff --git a/examples/ParamStudy_SAM_SimpleJunction_Workbench/README.md b/examples/ParamStudy_SAM_SimpleJunction_Workbench/README.md index b6dd8a67..cff2587f 100644 --- a/examples/ParamStudy_SAM_SimpleJunction_Workbench/README.md +++ b/examples/ParamStudy_SAM_SimpleJunction_Workbench/README.md @@ -17,4 +17,4 @@ is varied. - [__watts_exec.py__](watts_exec.py): WATTS workflow for this example. This is the file to execute to run the problem described above. - [__sam_template__](sam_template): SAM templated input file. -- [__watts_comprehensive.son__](watts_comprehensive.son): Workbench input file for this example. \ No newline at end of file +- [__watts_wb.son__](watts_wb.son): Workbench input file for this example. \ No newline at end of file diff --git a/examples/ParamStudy_SAM_SimpleJunction_Workbench/watts_comprehensive.son b/examples/ParamStudy_SAM_SimpleJunction_Workbench/watts_wb.son similarity index 91% rename from examples/ParamStudy_SAM_SimpleJunction_Workbench/watts_comprehensive.son rename to examples/ParamStudy_SAM_SimpleJunction_Workbench/watts_wb.son index 8c685e6e..b4d6d41c 100644 --- a/examples/ParamStudy_SAM_SimpleJunction_Workbench/watts_comprehensive.son +++ b/examples/ParamStudy_SAM_SimpleJunction_Workbench/watts_wb.son @@ -13,7 +13,7 @@ watts{ workflow_level1{ plugin = ID1 variables{ - param(temperature_inlet) {value = 2.0} + param(temperature_inlet) {value = 628.0} param(friction_factor) {value = 0.1} param(flow_area) {value = 3.14e-4} param(Dh) {value = 1 unit = m} @@ -24,7 +24,6 @@ watts{ parametric{ changing_params = "heat_source" changing_values = [0, 1e5, 2e5, 3e5] - } } diff --git a/examples/PicardIterations_SAM-OpenMC_VHTR_Workbench/README.md b/examples/PicardIterations_SAM-OpenMC_VHTR_Workbench/README.md index 2da471c5..09f38832 100644 --- a/examples/PicardIterations_SAM-OpenMC_VHTR_Workbench/README.md +++ b/examples/PicardIterations_SAM-OpenMC_VHTR_Workbench/README.md @@ -19,4 +19,4 @@ This example demonstrates how to use WATTS on Workbench to perform several itera - [__watts_exec.py__](watts_exec.py): WATTS workflow for this example. This is the file to execute to run the problem described above. - [__openmc_template__](openmc_template.py): Link to OpenMC templated model. - [__sam_template__](sam_template): Link to SAM templated model. -- [__watts_comprehensive.son__](watts_comprehensive.son): Workbench input file for this example. \ No newline at end of file +- [__watts_wb.son__](watts_wb.son): Workbench input file for this example. \ No newline at end of file diff --git a/examples/PicardIterations_SAM-OpenMC_VHTR_Workbench/watts_comprehensive.son b/examples/PicardIterations_SAM-OpenMC_VHTR_Workbench/watts_wb.son similarity index 94% rename from examples/PicardIterations_SAM-OpenMC_VHTR_Workbench/watts_comprehensive.son rename to examples/PicardIterations_SAM-OpenMC_VHTR_Workbench/watts_wb.son index f695e8e5..01171daa 100644 --- a/examples/PicardIterations_SAM-OpenMC_VHTR_Workbench/watts_comprehensive.son +++ b/examples/PicardIterations_SAM-OpenMC_VHTR_Workbench/watts_wb.son @@ -11,11 +11,10 @@ watts{ plugin(ID2){ code = openmc template = "openmc_template.py" - scores = ["nu-fission"] % Name of scores for OpenMC tallies. This will be the base name used for saving the tallies. + scores = ["nu-fission"] % Name of scores for OpenMC tallies. This will be the base name used for saving the tallies. score_names = ["Init_P"] % A more representative name for the scores } } - workflow_level1{ plugin = ID1 variables{ @@ -56,7 +55,6 @@ watts{ param(use_sab_BeO) = {bool = True} param(use_sab_YH2) = {bool = False} } - iteration{ plugin = ID2 % ID of plugin to iterate with nmax = 10 diff --git a/examples/README.md b/examples/README.md index 83d176b6..072cf3ee 100644 --- a/examples/README.md +++ b/examples/README.md @@ -12,6 +12,7 @@ Training on WATTS is enabled with a suite of simple examples: * [__1App_MOOSE-MultiApp_Simple__](1App_MOOSE-MultiApp_Simple/README.md) - Simple MOOSE MultiApp calculation ## Examples with Multi Applications * [__MultiApp_SAM-OpenMC_VHTR__](MultiApp_SAM-OpenMC_VHTR/README.md) - Workflow with MOOSE/SAM and OpenMC +* [__MultiApp_SAM_SimpleJunction_Workbench__](MultiApp_SAM_SimpleJunction_Workbench/README.md) - Workflow on how to use Workbench to run a coupled simulation with multiple apps ## Multi-step workflow * [__MultiStep_Griffin-BISON-Sockeye_MR__](MultiStep_Griffin-BISON-Sockeye_MR/README.md) - Advance MOOSE MultiApp calculation with steady-state and transient calculations ## Examples with Picard Iterations diff --git a/scripts/setup_conda_wb.sh b/scripts/setup_conda_wb.sh index 318a72ef..4ad29c85 100755 --- a/scripts/setup_conda_wb.sh +++ b/scripts/setup_conda_wb.sh @@ -86,18 +86,17 @@ cp etc/watts.py $workbench_path/rte/ # Check if bin directory already exists if [ -d "$current_path/bin" ]; then - printf "${RED}ERROR: bin directory already exists in $current_path.${NC}\n" - exit 1 + printf "${RED}Warning: bin directory already exists in $current_path. Skipped.\n" +else + mkdir bin + ln -s $workbench_path/bin/sonvalidxml bin/sonvalidxml fi -mkdir bin -ln -s $workbench_path/bin/sonvalidxml bin/sonvalidxml - # Check if wasppy already exists if [ -d "$current_path/wasppy" ]; then - printf "${RED}ERROR: wasppy already exists in $current_path.${NC}\n" - exit 1 + printf "${RED}Warning: wasppy already exists in $current_path. Skipped.\n" +else + ln -s $workbench_path/wasppy ./ fi -ln -s $workbench_path/wasppy ./ -printf "${GREEN}Transfer complete.\n" \ No newline at end of file +printf "${GREEN}Transfer complete.\n" diff --git a/src/watts_ui/etc/templates/iteration.tmpl b/src/watts_ui/etc/templates/iteration.tmpl new file mode 100644 index 00000000..c15dd4c9 --- /dev/null +++ b/src/watts_ui/etc/templates/iteration.tmpl @@ -0,0 +1,9 @@ +% Define input for iteration +iteration{ + plugin = plugin_name % ID of plugin to iterate with + nmax = max_number_of_iterations % Max number of iterations + convergence_params = "name_of_param" % Name of parameter for checking convergence + convergence_criteria = 0.0001 % Convergence criteria + to_sub_params = ["main_param_1" "main_param_2" "main_param_3"] % List of parameters to send to the sub app + to_main_params = ["sub_param_1" "sub_param_2" "sub_param_3"] % List of parameters to send to the main app +} diff --git a/src/watts_ui/etc/templates/param.bool.tmpl b/src/watts_ui/etc/templates/param.bool.tmpl index fc47f7f5..e282b1b1 100644 --- a/src/watts_ui/etc/templates/param.bool.tmpl +++ b/src/watts_ui/etc/templates/param.bool.tmpl @@ -1 +1 @@ -params( id ){bool = True} \ No newline at end of file +param( id ){bool = True} \ No newline at end of file diff --git a/src/watts_ui/etc/templates/param.func.tmpl b/src/watts_ui/etc/templates/param.func.tmpl index 27ab91f7..f58f1162 100644 --- a/src/watts_ui/etc/templates/param.func.tmpl +++ b/src/watts_ui/etc/templates/param.func.tmpl @@ -1 +1 @@ -params( id ){func = 'a + b' } \ No newline at end of file +param( id ){func = 'a + b' } \ No newline at end of file diff --git a/src/watts_ui/etc/templates/param.list.tmpl b/src/watts_ui/etc/templates/param.list.tmpl index 2c8a728b..0d597d7f 100644 --- a/src/watts_ui/etc/templates/param.list.tmpl +++ b/src/watts_ui/etc/templates/param.list.tmpl @@ -1 +1 @@ -params( id ){list = [ 0 ] } \ No newline at end of file +param( id ){list = [ 0 ] } \ No newline at end of file diff --git a/src/watts_ui/etc/templates/param.value.tmpl b/src/watts_ui/etc/templates/param.value.tmpl index fdfaeac8..e254bbbe 100644 --- a/src/watts_ui/etc/templates/param.value.tmpl +++ b/src/watts_ui/etc/templates/param.value.tmpl @@ -1 +1 @@ -params( id ){value = 0 unit= m} \ No newline at end of file +param( id ){value = 0 unit= m} \ No newline at end of file diff --git a/src/watts_ui/etc/templates/parametric.tmpl b/src/watts_ui/etc/templates/parametric.tmpl new file mode 100644 index 00000000..02de9beb --- /dev/null +++ b/src/watts_ui/etc/templates/parametric.tmpl @@ -0,0 +1,5 @@ +% Define input for parametric study +parametric{ + changing_params = "param_name" % name of param to change + changing_values = [0, 1, 2, 3] % list of values to change paramter to +} diff --git a/src/watts_ui/etc/templates/plugin.auto_link_files.tmpl b/src/watts_ui/etc/templates/plugin.auto_link_files.tmpl new file mode 100644 index 00000000..016efcec --- /dev/null +++ b/src/watts_ui/etc/templates/plugin.auto_link_files.tmpl @@ -0,0 +1 @@ +auto_link_files = "file1 file2 file3" % Dakota \ No newline at end of file diff --git a/src/watts_ui/etc/templates/plugin.conv_channel.tmpl b/src/watts_ui/etc/templates/plugin.conv_channel.tmpl new file mode 100644 index 00000000..e86a70b9 --- /dev/null +++ b/src/watts_ui/etc/templates/plugin.conv_channel.tmpl @@ -0,0 +1 @@ +conv_channel = "path\to\CHANNELtoCSV.x" % SAS \ No newline at end of file diff --git a/src/watts_ui/etc/templates/plugin.conv_primar4.tmpl b/src/watts_ui/etc/templates/plugin.conv_primar4.tmpl new file mode 100644 index 00000000..7427eb3e --- /dev/null +++ b/src/watts_ui/etc/templates/plugin.conv_primar4.tmpl @@ -0,0 +1 @@ +conv_primar4 = "path\to\PRIMAR4toCSV.x" % SAS \ No newline at end of file diff --git a/src/watts_ui/etc/templates/plugin.exec_dir.tmpl b/src/watts_ui/etc/templates/plugin.exec_dir.tmpl new file mode 100644 index 00000000..de2afb06 --- /dev/null +++ b/src/watts_ui/etc/templates/plugin.exec_dir.tmpl @@ -0,0 +1 @@ +exec_dir = dir_of_executable \ No newline at end of file diff --git a/src/watts_ui/etc/templates/plugin.exec_name.tmpl b/src/watts_ui/etc/templates/plugin.exec_name.tmpl new file mode 100644 index 00000000..d5574ba6 --- /dev/null +++ b/src/watts_ui/etc/templates/plugin.exec_name.tmpl @@ -0,0 +1 @@ +exec_name = name_of_executable \ No newline at end of file diff --git a/src/watts_ui/etc/templates/plugin.executable.tmpl b/src/watts_ui/etc/templates/plugin.executable.tmpl new file mode 100644 index 00000000..04e82bff --- /dev/null +++ b/src/watts_ui/etc/templates/plugin.executable.tmpl @@ -0,0 +1 @@ +executable = path_to_executable \ No newline at end of file diff --git a/src/watts_ui/etc/templates/plugin.extra_args.tmpl b/src/watts_ui/etc/templates/plugin.extra_args.tmpl new file mode 100644 index 00000000..d2d9fb8f --- /dev/null +++ b/src/watts_ui/etc/templates/plugin.extra_args.tmpl @@ -0,0 +1 @@ +extra_args = ["extra_args_1" "extra_args_2" "extra_args_3"] \ No newline at end of file diff --git a/src/watts_ui/etc/templates/plugin.extra_inputs.tmpl b/src/watts_ui/etc/templates/plugin.extra_inputs.tmpl new file mode 100644 index 00000000..57f51953 --- /dev/null +++ b/src/watts_ui/etc/templates/plugin.extra_inputs.tmpl @@ -0,0 +1 @@ +extra_inputs = ["extra_input_1" "extra_input_2" "extra_input_3"] \ No newline at end of file diff --git a/src/watts_ui/etc/templates/plugin.extra_template_inputs.tmpl b/src/watts_ui/etc/templates/plugin.extra_template_inputs.tmpl new file mode 100644 index 00000000..c9d8892e --- /dev/null +++ b/src/watts_ui/etc/templates/plugin.extra_template_inputs.tmpl @@ -0,0 +1 @@ +extra_template_inputs = ["extra_template_1" "extra_template_2" "extra_template_3"] \ No newline at end of file diff --git a/src/watts_ui/etc/templates/plugin.plotfl_to_csv.tmpl b/src/watts_ui/etc/templates/plugin.plotfl_to_csv.tmpl new file mode 100644 index 00000000..547fe9cf --- /dev/null +++ b/src/watts_ui/etc/templates/plugin.plotfl_to_csv.tmpl @@ -0,0 +1 @@ +plotfl_to_csv = True % RELAP5 \ No newline at end of file diff --git a/src/watts_ui/etc/templates/plugin.score_names.tmpl b/src/watts_ui/etc/templates/plugin.score_names.tmpl new file mode 100644 index 00000000..d7fbfe1c --- /dev/null +++ b/src/watts_ui/etc/templates/plugin.score_names.tmpl @@ -0,0 +1 @@ +score_names = ["score_name_1" "score_name_3" "score_name_3"] % OpenMC \ No newline at end of file diff --git a/src/watts_ui/etc/templates/plugin.scores.tmpl b/src/watts_ui/etc/templates/plugin.scores.tmpl new file mode 100644 index 00000000..9238fe32 --- /dev/null +++ b/src/watts_ui/etc/templates/plugin.scores.tmpl @@ -0,0 +1 @@ +scores = ["score_1" "score_2" "score_3"] % OpenMC \ No newline at end of file diff --git a/src/watts_ui/etc/templates/plugin.tmpl b/src/watts_ui/etc/templates/plugin.tmpl new file mode 100644 index 00000000..05e42c43 --- /dev/null +++ b/src/watts_ui/etc/templates/plugin.tmpl @@ -0,0 +1,6 @@ +plugin(plugin_name){ + code = code_name + template = template_file_name + show_stderr = False % show stderr + show_stdout = False % show stdout +} diff --git a/src/watts_ui/etc/templates/plugin.transfer_params.tmpl b/src/watts_ui/etc/templates/plugin.transfer_params.tmpl new file mode 100644 index 00000000..1cb98e88 --- /dev/null +++ b/src/watts_ui/etc/templates/plugin.transfer_params.tmpl @@ -0,0 +1 @@ +transfer_params = ["transfer_params_1" "transfer_params_2" "transfer_params_3"] \ No newline at end of file diff --git a/src/watts_ui/etc/templates/plugin_id.tmpl b/src/watts_ui/etc/templates/plugin_id.tmpl new file mode 100644 index 00000000..9e67cc44 --- /dev/null +++ b/src/watts_ui/etc/templates/plugin_id.tmpl @@ -0,0 +1 @@ +plugin = plugin_name % Name of plugin \ No newline at end of file diff --git a/src/watts_ui/etc/templates/plugins.tmpl b/src/watts_ui/etc/templates/plugins.tmpl new file mode 100644 index 00000000..45b1b2b8 --- /dev/null +++ b/src/watts_ui/etc/templates/plugins.tmpl @@ -0,0 +1,8 @@ +plugins{ + plugin(plugin_name){ + code = code_name % Name of application + template = template_file_name % Name of template file + show_stderr = False % show stderr + show_stdout = False % show stdout + } +} diff --git a/src/watts_ui/etc/templates/variables.tmpl b/src/watts_ui/etc/templates/variables.tmpl index 7ddc327c..df9a8005 100644 --- a/src/watts_ui/etc/templates/variables.tmpl +++ b/src/watts_ui/etc/templates/variables.tmpl @@ -1,6 +1,6 @@ variables{ -% params( id ){value = 0 unit= m} -% params( id ){func = 'a + b' } -% params( id ){list = [ 0 ] } -% params( id ){bool = True} + param( id ){value = 0 unit = m} % Param as a value (unit is optional) + param( id ){func = 'a + b' } % Param as a function (must include space between components and operators) + param( id ){list = [ 0 ] } % Param as a list (floats or strings are accepted) + param( id ){bool = True} % Param as a bool } \ No newline at end of file diff --git a/src/watts_ui/etc/templates/watts.tmpl b/src/watts_ui/etc/templates/watts.tmpl index c08627e4..30a4b9a4 100644 --- a/src/watts_ui/etc/templates/watts.tmpl +++ b/src/watts_ui/etc/templates/watts.tmpl @@ -1,8 +1,8 @@ watts{ - workflow_level1{ + plugins{ + % define plugins + } + workflow_level1{ % define workflows - } - plugins{ - % define plugins - } -} \ No newline at end of file + } +} diff --git a/src/watts_ui/etc/templates/wf_plugin.tmpl b/src/watts_ui/etc/templates/wf_plugin.tmpl deleted file mode 100644 index e2644eb6..00000000 --- a/src/watts_ui/etc/templates/wf_plugin.tmpl +++ /dev/null @@ -1 +0,0 @@ -plugin = plugin_name \ No newline at end of file diff --git a/src/watts_ui/etc/templates/workflow.tmpl b/src/watts_ui/etc/templates/workflow.tmpl new file mode 100644 index 00000000..42a789e7 --- /dev/null +++ b/src/watts_ui/etc/templates/workflow.tmpl @@ -0,0 +1,7 @@ +plugin = plugin_name % Name of plugin +variables{ + param( id ){value = 0 unit= m} % Param as a value (unit is optional) + param( id ){func = 'a + b' } % Param as a function (must include space between compenents and operators) + param( id ){list = [ 0 ] } % Param as a list (floats or strings are accepted) + param( id ){bool = True} % Param as a bool +} diff --git a/src/watts_ui/etc/templates/workflow_level1.tmpl b/src/watts_ui/etc/templates/workflow_level1.tmpl new file mode 100644 index 00000000..8f995038 --- /dev/null +++ b/src/watts_ui/etc/templates/workflow_level1.tmpl @@ -0,0 +1,9 @@ +workflow_level1{ + plugin = plugin_name % Name of plugin + variables{ + param( id ){value = 0 unit= m} % Param as a value (unit is optional) + param( id ){func = 'a + b' } % Param as a function (must include space between components and operators) + param( id ){list = [ 0 ] } % Param as a list (floats or strings are accepted) + param( id ){bool = True} % Param as a bool + } +} diff --git a/src/watts_ui/etc/watts.sch b/src/watts_ui/etc/watts.sch index 618528ff..86a405b9 100644 --- a/src/watts_ui/etc/watts.sch +++ b/src/watts_ui/etc/watts.sch @@ -6,117 +6,19 @@ watts{ InputTmpl = "watts" workflow_level1{ Description = "[required] Workflow definition - first level" - InputTmpl="sonobject" + InputTmpl="workflow_level1" MinOccurs=1 MaxOccurs=1 % ChildAtLeastOne = [plugin workflow_level2] % we need at least to do a plugin calc or define a sub-workflow - - iteration{ - Description = "[optional] definition of iterations workflow" - InputTmpl="sonobject" - MinOccurs=0 - MaxOccurs=1 - plugin{ - Description = "[required] ID of the second plugin" - MinOccurs=1 - MaxOccurs=1 - ValType=String - } - nmax{ - Description = "[required] Maximum number of iterations" - MinOccurs=1 - MaxOccurs=1 - ValType=Real - } - convergence_criteria{ - Description = "[required] Convergence criteria" - MinOccurs=1 - MaxOccurs=1 - InputTmpl="flagtypes" - ValType=Real - } - convergence_params{ - Description = "[required] Parameter to compare for convergence" - MinOccurs=1 - MaxOccurs=1 - ValType=String - } - to_sub_params{ - Description = "[required] Parameter(s) to send from plugin_1 to plugin_2" - InputTmpl="sonarray" - MinOccurs=0 - MaxOccurs=1 - value{ - MinOccurs=0 - MaxOccurs=NoLimit - } - } - to_main_params{ - Description = "[required] Parameter(s) to send from plugin_2 to plugin_1" - InputTmpl="sonarray" - MinOccurs=0 - MaxOccurs=1 - value{ - MinOccurs=0 - MaxOccurs=NoLimit - } - } - - } - parametric{ - Description = "[optional] definition of parametric workflow" - InputTmpl="sonobject" - MinOccurs=0 - MaxOccurs=1 - changing_params{ - Description = "[required] the parameter to perform parametric study" - MinOccurs=1 - MaxOccurs=1 - ValType=String - } - changing_values{ - Description = "[required] values for parametric study" - InputTmpl="sonarray" - MinOccurs=1 - MaxOccurs=1 - value{ - MinOccurs=1 - MaxOccurs=NoLimit - } - } - } - optimization{ - Description = "[optional] definition of optimization workflow" - InputTmpl="sonobject" - MinOccurs=0 - MaxOccurs=1 - objective_functions{ - Description = "[required] the parameter to optimize" - MinOccurs=1 - MaxOccurs=1 - ValType=String - } - method{ - Description = "[required] optimization parameter" - MinOccurs=1 - MaxOccurs=1 - ValType=String - } - tolerance{ - Description = "[required] convergence criteria" - MinOccurs=1 - MaxOccurs=1 - ValType=Real - } - } plugin{ - Description = "[optional] plugin specification" - InputTmpl="wf_plugin" + Description = "[Required] name of plugin" + InputTmpl="plugin_id" MinOccurs=0 MaxOccurs=NoLimit ValType=String ExistsIn = ["../../plugins/plugin/id"] + ChildUniqueness = [ "id"] } variables{ Description = "[optional] Variables definition" @@ -148,17 +50,6 @@ watts{ MinOccurs=0 MaxOccurs=1 } -% range{ -% Description = "[optional] range of the value (for optimization)" -% InputTmpl="sonarray" -% MinOccurs=0 -% MaxOccurs=1 -% value{ -% MinOccurs=2 -% MaxOccurs=2 -% ValType=Real -% } -% } bool{ Description = "[optional] boolean" InputTmpl="flagtypes" @@ -188,42 +79,136 @@ watts{ } } } - workflow_level2{ - Description = "[optional] Workflow definition - second level" - InputTmpl="sonobject" + iteration{ + Description = "[optional] definition of iterations workflow" + InputTmpl="iteration" MinOccurs=0 - MaxOccurs=NoLimit + MaxOccurs=1 + plugin{ + Description = "[required] ID of the second plugin" + InputTmpl="sonobject" + MinOccurs=1 + MaxOccurs=1 + ValType=String + } + nmax{ + Description = "[required] Maximum number of iterations" + MinOccurs=1 + MaxOccurs=1 + ValType=Real + } + convergence_criteria{ + Description = "[required] Convergence criteria" + MinOccurs=1 + MaxOccurs=1 + ValType=Real + } + convergence_params{ + Description = "[required] Parameter to compare for convergence" + MinOccurs=1 + MaxOccurs=1 + ValType=String + } + to_sub_params{ + Description = "[required] Parameter(s) to send from plugin_1 to plugin_2" + MinOccurs=1 + MaxOccurs=1 + value{ + MinOccurs=0 + MaxOccurs=NoLimit + } + } + to_main_params{ + Description = "[required] Parameter(s) to send from plugin_2 to plugin_1" + MinOccurs=1 + MaxOccurs=1 + value{ + MinOccurs=0 + MaxOccurs=NoLimit + } + } } - postprocessors{ - Description = "[optional] postprocessor " - InputTmpl="sonobject" + parametric{ + Description = "[optional] definition of parametric workflow" + InputTmpl="parametric" MinOccurs=0 - MaxOccurs=NoLimit - ChildUniqueness = ["id"] - value{ - Description = "[required] operation of the postprocessor" + MaxOccurs=1 + changing_params{ + Description = "[required] the parameter to perform parametric study" MinOccurs=1 MaxOccurs=1 ValType=String } - id{ - Description = "[required] ID of postprocessor" + changing_values{ + Description = "[required] values for parametric study" MinOccurs=1 MaxOccurs=1 - ValType=String + value{ + MinOccurs=1 + MaxOccurs=NoLimit + } } } + % optimization{ + % Description = "[optional] definition of optimization workflow" + % InputTmpl="sonobject" + % MinOccurs=0 + % MaxOccurs=1 + % objective_functions{ + % Description = "[required] the parameter to optimize" + % MinOccurs=1 + % MaxOccurs=1 + % ValType=String + % } + % method{ + % Description = "[required] optimization parameter" + % MinOccurs=1 + % MaxOccurs=1 + % ValType=String + % } + % tolerance{ + % Description = "[required] convergence criteria" + % MinOccurs=1 + % MaxOccurs=1 + % ValType=Real + % } + % } + % workflow_level2{ + % Description = "[optional] Workflow definition - second level" + % InputTmpl="sonobject" + % MinOccurs=0 + % MaxOccurs=NoLimit + % } + % postprocessors{ + % Description = "[optional] postprocessor " + % InputTmpl="sonobject" + % MinOccurs=0 + % MaxOccurs=NoLimit + % ChildUniqueness = ["id"] + % value{ + % Description = "[required] operation of the postprocessor" + % MinOccurs=1 + % MaxOccurs=1 + % ValType=String + % } + % id{ + % Description = "[required] ID of postprocessor" + % MinOccurs=1 + % MaxOccurs=1 + % ValType=String + % } + % } } plugins{ Description = "[required] Plugins definition" - InputTmpl="sonobject" + InputTmpl="plugins" MinOccurs=1 MaxOccurs=1 - ChildUniqueness = [ "plugin/id"] + ChildUniqueness = ["plugin/id"] plugin{ Description = "[required] Plugins definition" - InputTmpl="sonobject" + InputTmpl="plugin" MinOccurs=1 MaxOccurs=NoLimit id{ @@ -232,7 +217,7 @@ watts{ ValType=String } code{ - Description = "Code name" + Description = "[Required] All - Name of application" MaxOccurs=1 MinOccurs=1 ValType=String @@ -241,31 +226,36 @@ watts{ ValEnums=[PyARC OpenMC SERPENT ABCE MCNP MOOSE SAS Dakota Serpent RELAP5] } template{ - Description = "Template name" + Description = "[Required] All - Name of template file" MaxOccurs=1 MinOccurs=1 ValType=String - InputTmpl="flagtypes" InputDefault= "path-to-template" } exec_dir{ + Description = "[optional] All - Path to executable directory" MinOccurs=0 MaxOccurs=1 ValType=String + InputTmpl="plugin.exec_dir" } exec_name{ + Description = "[optional] All - Name of executable" MinOccurs=0 MaxOccurs=1 ValType=String + InputTmpl="plugin.exec_name" } executable{ + Description = "[optional] All - Path to executable" MinOccurs=0 MaxOccurs=1 ValType=String + InputTmpl="plugin.executable" } extra_inputs{ - Description = "[optional] List of extra (non-templated) input files that are needed" - InputTmpl="sonarray" + Description = "[optional] All - List of extra (non-templated) input files that are needed" + InputTmpl="plugin.extra_inputs" MinOccurs=0 MaxOccurs=1 value{ @@ -274,18 +264,18 @@ watts{ } } extra_template_inputs{ - Description = "[optional] List of extra templated input files that are needed" - InputTmpl="sonarray" + Description = "[optional] All - List of extra templated input files that are needed" MinOccurs=0 MaxOccurs=1 + InputTmpl="plugin.extra_template_inputs" value{ MinOccurs=0 MaxOccurs=NoLimit } } - scores{ - Description = "[optional] List of scores for OpenMC tallies" - InputTmpl="sonarray" + extra_args{ + Description = "[optional] All - List of extra arguments" + InputTmpl="plugin.extra_args" MinOccurs=0 MaxOccurs=1 value{ @@ -293,65 +283,75 @@ watts{ MaxOccurs=NoLimit } } - score_names{ - Description = "[optional] List of representative names for scores" - InputTmpl="sonarray" + transfer_params{ + Description = "[optional] All - List of parameters to transfer between runs" + InputTmpl="plugin.transfer_params" + MinOccurs=0 + MaxOccurs=1 + value{ + MinOccurs=0 + MaxOccurs=NoLimit + } + } + scores{ + Description = "[optional] OpenMC - List of scores for OpenMC tallies" MinOccurs=0 MaxOccurs=1 + InputTmpl="plugin.scores" value{ MinOccurs=0 MaxOccurs=NoLimit } } - output{ - Description = "[optional] List of output files" - InputTmpl="sonarray" + score_names{ + Description = "[optional] OpenMC - List of representative names for scores" MinOccurs=0 MaxOccurs=1 + InputTmpl="plugin.score_names" value{ MinOccurs=0 MaxOccurs=NoLimit } } show_stderr{ + Description = "[optional] All - Bool to print stderr" MinOccurs=0 MaxOccurs=1 ValType=String } show_stdout{ + Description = "[optional] All - Bool to print stdout" MinOccurs=0 MaxOccurs=1 ValType=String } plotfl_to_csv{ + Description = "[optional] RELAP5 - Bool to convert PLOTFL to CSV" MinOccurs=0 MaxOccurs=1 ValType=String - } - extra_args{ - Description = "[optional] List of extra arguments" - InputTmpl="sonarray" - MinOccurs=0 - MaxOccurs=1 - value{ - MinOccurs=0 - MaxOccurs=NoLimit - } + InputTmpl="plugin.plotfl_to_csv" } conv_channel{ + Description = "[optional] SAS - Path to CHANNELtoCSV.x" MinOccurs=0 MaxOccurs=1 ValType=String + InputTmpl="plugin.conv_channel" } conv_primar4{ + Description = "[optional] SAS - Path to PRIMAR4toCSV.x" MinOccurs=0 MaxOccurs=1 ValType=String + InputTmpl="plugin.conv_primar4" } auto_link_files{ + Description = "[optional] Dakota - List of auto link files" MinOccurs=0 MaxOccurs=1 ValType=String + InputTmpl="plugin.auto_link_files" } } } diff --git a/src/watts_ui/watts_ui.py b/src/watts_ui/watts_ui.py index 9da06e13..2da2ba18 100755 --- a/src/watts_ui/watts_ui.py +++ b/src/watts_ui/watts_ui.py @@ -4,7 +4,7 @@ from pathlib import Path import subprocess import sys -from typing import Optional +from typing import List, Optional import warnings from astropy.units import Quantity @@ -63,6 +63,7 @@ def create_plugins(plugins): nested_plugins['show_stderr'] = False nested_plugins['show_stdout'] = False nested_plugins['plotfl_to_csv'] = False + nested_plugins['transfer_params'] = None # Save string plugin inputs nested_plugins['code'] = str(plg.code.value).strip('\"') @@ -96,6 +97,9 @@ def create_plugins(plugins): nested_plugins['score_names'] = convert_to_list(plg.score_names) if plg.extra_args is not None: nested_plugins['extra_args'] = convert_to_list(plg.extra_args) + if plg.transfer_params is not None: + nested_plugins['transfer_params'] = convert_to_list( + plg.transfer_params) # Save bool plugin inputs if plg.show_stderr is not None and str(plg.show_stderr.value).capitalize() == 'True': @@ -185,9 +189,9 @@ def convert_to_list(wb_list): return (convert_list) -def get_last_value(watts_params, name_list): +def get_last_value(watts_params, name_list: Optional[List[str]] = None): """Extract the value of the last index from the - results created by WATTS plugins for iteration workflow + results created by WATTS plugins for transfer between plugins Parameters ---------- @@ -229,7 +233,7 @@ def isfloat(num): return False -def run_workflow(watts_params, wf_level, plugin_ID, watts_plugins): +def run_workflow(watts_params, wf_level, watts_plugins): """Run workflow Parameters @@ -238,8 +242,6 @@ def run_workflow(watts_params, wf_level, plugin_ID, watts_plugins): Watts params with stored user input parameters wf_level Level of workflow - plugin_ID - ID of plugin plugin Dictionary of plugin @@ -260,6 +262,7 @@ def run_workflow(watts_params, wf_level, plugin_ID, watts_plugins): return (app_result, watts_params) elif wf_level.parametric is not None: + plugin_ID = 'ID1' watts_params, app_result = run_parametric( watts_params, watts_plugins[plugin_ID], wf_level) @@ -269,8 +272,18 @@ def run_workflow(watts_params, wf_level, plugin_ID, watts_plugins): operation = wf_level.optimization ... else: - watts_params, app_result = run_direct( - watts_params, watts_plugins[plugin_ID]) + for n_plugin, plugin in enumerate(wf_level.plugin): + plugin_ID = str(plugin.value) + current_plugin = watts_plugins[plugin_ID] + + print("AAAAA") + print(current_plugin['template']) + + watts_params, app_result = run_direct( + watts_params, current_plugin) + if current_plugin['transfer_params'] is not None: + watts_params = get_last_value( + watts_params, current_plugin['transfer_params']) return (app_result, watts_params) @@ -541,8 +554,18 @@ def run_parametric(watts_params, plugin, wf_level): watts_params[parametric_name] = float(str(val)) parametric_list.append(float(str(val))) - watts_params, app_result_parametric = run_direct( - watts_params, watts_plugins[plugin_ID]) + # watts_params, app_result_parametric = run_direct( + # watts_params, watts_plugins[plugin_ID]) + + for n_plugin, plugin in enumerate(wf_level.plugin): + plugin_ID = str(plugin.value) + current_plugin = watts_plugins[plugin_ID] + watts_params, app_result_parametric = run_direct( + watts_params, current_plugin) + if current_plugin['transfer_params'] is not None: + watts_params = get_last_value( + watts_params, current_plugin['transfer_params']) + # Store the results from each individual run to # the 'app_result' dictionary as individual tuple. app_result[f"run_{n}"] = app_result_parametric @@ -551,12 +574,8 @@ def run_parametric(watts_params, plugin, wf_level): return (watts_params, app_result) -# Get WATTS_DIR from environment -if "WATTS_DIR" in os.environ: - watts_path = os.environ["WATTS_DIR"] -else: - raise RuntimeError( - "WATTS_DIR variable does not exist in environment. Please set WATTS_DIR to environment.") +# Set watts_path +watts_path = os.path.join(os.path.dirname(__file__)) opts, args = getopt.getopt(sys.argv[1:], "hi:o:", ["ifile=", "ofile="]) @@ -584,9 +603,9 @@ def run_parametric(watts_params, plugin, wf_level): wf_level = watts_wb.workflow_level1 - plugin_ID = None - if wf_level.plugin is not None: - plugin_ID = str(wf_level.plugin.value) + if wf_level.plugin is None: + raise RuntimeError( + "Please specify at least one plugin.") if wf_level.variables is not None: variables = wf_level.variables.param @@ -597,6 +616,6 @@ def run_parametric(watts_params, plugin, wf_level): # Run workflow app_result, watts_params = run_workflow( - watts_params, wf_level, plugin_ID, watts_plugins) + watts_params, wf_level, watts_plugins) watts_params.show_summary(show_metadata=False, sort_by='key')