Skip to content

Commit 50abc5e

Browse files
committed
Addressed reviewers comments
1 parent 193c444 commit 50abc5e

53 files changed

Lines changed: 815 additions & 238 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

doc/source/dev/workbench.rst

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
.. devguide_workbench:
2+
3+
Adding Application to Workbench
4+
-------------------------------
5+
6+
If you wish to use WATTS on the NEAMS Workbench with a code
7+
that is not already available, adding the code can be done quite easily.
8+
9+
First, you have to develop a plugin for the code and add it to WATTS following
10+
the steps described previously. Once the plugin is available, you can then add it
11+
to `watts_ui.py`.
12+
13+
In the `run_direct()` function, you will need to add an `elif` statement as follows,
14+
15+
.. code-block::
16+
17+
elif plugin['code'].upper() == '<name_of_new_code>':
18+
app_plugin = watts.name_of_new_plugin(
19+
template_file=plugin['template'],
20+
executable=exec,
21+
extra_inputs=plugin['extra_inputs'],
22+
extra_template_inputs=plugin['extra_template_inputs'],
23+
show_stdout=plugin['show_stdout'],
24+
show_stderr=plugin['show_stderr'])
25+
26+
Note tha additional steps might be necessary here depending on the code that
27+
is being added.
28+
29+
If the plugin is developed to be similar to the other plugins on WATTS,
30+
no other changes are necessary to `watts_ui.py`. Otherwise, the developer
31+
is responsible for making sure that `watt_ui.py` can read the results
32+
produced by the plugin. Within `run_direct()`, the results from the plugin
33+
should be extracted and saved to `watts_params` as individual entries. This
34+
is required for the coupling and data-transfer between different codes.
35+
36+
Next, the `watts.sch` file needs to be updated. The name of the new code needs
37+
to be added to the `code` block as follows::
38+
39+
watts{
40+
plugins{
41+
plugin{
42+
code{
43+
Description = "[Required] All - Name of application"
44+
...
45+
ValEnums=[PyARC RELAP5 ... <name_of_new_code>]
46+
}
47+
}
48+
}
49+
}
50+
51+
Note that the name used for the new code used here must match that used in
52+
`watts_ui.py`.
53+
54+
Adding new plugin options
55+
+++++++++++++++++++++++++
56+
57+
Any additional options needed by the plugin can be added under the `plugin`
58+
block as follows::
59+
60+
watts{
61+
plugins{
62+
plugin{
63+
additional_plugin_option{
64+
Description = "[optional] New_code - Description of the new option"
65+
MinOccurs=0
66+
MaxOccurs=1
67+
ValType=String
68+
InputTmpl="plugin.additional_plugin_option"
69+
}
70+
}
71+
}
72+
}
73+
74+
Note that `MinOccurs` and `MaxOccurs` represent the minimum and maximum occurences of
75+
this option, `ValType` is the input type of the new option, and `InputTmpl` is the
76+
template file for the new option located in the `etc/templates` directory. Template
77+
file is optional but highly recommended as it provides a template or example to other users.
78+
79+
If new plugin options are added, the `create_plugins()` function in `watts_ui.py` must
80+
be updated. The function essentially creates a nested Python dictionary that contains one
81+
or more individual dictionaries where each individual dictionary stores the information
82+
of each plugin. The function utilizes a series of `if` statements to decide what information
83+
should be stored for each plugin.
84+
85+
If the input of the new option is a string, the new option can be added as follows ::
86+
87+
if plg.new_option_name is not None:
88+
nested_plugins['new_option_name'] = str(
89+
plg.new_option_name.value).strip('\"')
90+
91+
If the input is a list ::
92+
93+
if plg.new_option_name is not None:
94+
nested_plugins['new_option_name'] = convert_to_list(plg.new_option_name)
95+
96+
If the input is a bool ::
97+
98+
nested_plugins['new_option_name'] = False
99+
100+
if plg.new_option_name is not None and str(plg.new_option_name.value).capitalize() == 'True':
101+
nested_plugins['new_option_name'] = True
102+
103+
Similar approach can be used for plugin options of different input types.

doc/source/user/workbench.rst

Lines changed: 70 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,16 @@ and visualization for integrated codes. Instructions on how to download and inst
1010
Workbench can be found on the Workbench
1111
`Gitlab repository <https://code.ornl.gov/neams-workbench/downloads>`.
1212

13-
To set up WATTS in the Workbench environment, user needs to first provide the path to
14-
where Workbench is installed in `workbench.sh` under the `scripts` directory. User can
13+
To set up WATTS in the Workbench environment, you first need to first provide the path to
14+
where Workbench is installed in `workbench.sh` under the `scripts` directory. You can
1515
then run `setup_conda_wb.sh` under the same directory to set up WATTS within
1616
the Workbench environment.
1717

1818
Optional: To install OpenMC in the Workbench environemnt, run `setup_openmc.sh`.
1919

2020
To finish setting up WATTS, open Workbench and go to the `File` tab at the top-left corner
2121
then select `Configurations` from the drop menu. In the `Application configurations`
22-
window, click `Add` on the top most row then select `WATTS` from the pop-up window.
22+
window, click `Add` on the top most row then select `Watts` from the pop-up window.
2323
In the list of `Application Options`, input the path of `watts_ui.py` to `Executable`.
2424
The file should exist by default in `/watts/src/watt_ui/`. Next, click `Load Grammar`.
2525
Click `OK` to complete the setup.
@@ -35,9 +35,7 @@ file can also be dragged and dropped to the Workbench window.
3535

3636
The WATTS input file utilizes a hierarchical block-based system where a block
3737
is defined with opening and closing curly braces `{ }`. A `watts` block is first
38-
created within which other blocks and variables can be defined. Within the `watts`
39-
block, `workflow_dir` needs to be defined as the path to the working directory
40-
(where all templates and extra files are located).
38+
created within which other blocks and variables can be defined.
4139

4240
Plugins
4341
~~~~~~~
@@ -53,7 +51,7 @@ The `plugins` block is required. Within the `plugins` blocks are
5351
exec_dir = SAM_DIR
5452
exec_name = "sam-opt"
5553
extra_inputs=["file1", "file2", "file3"]
56-
extra_templat_inputs=["template1", "template2", "template3"]
54+
extra_template_inputs=["template1", "template2", "template3"]
5755
show_stderr = False
5856
show_stdout = False
5957
}
@@ -77,7 +75,7 @@ in the snippet above. For each sub-block the basic inputs are::
7775
`show_stdout` : Option to display output
7876
`exec_dir` : Environment variable that points to the directory in which the application's executable is stored
7977
`extra_inputs` : Additional non-templated input files
80-
`extra_templateinputs` : Additional tempalted input files
78+
`extra_template_inputs` : Additional tempalted input files
8179
`exec_name` : Name of the executable
8280
`executable` : Path to the executable
8381

@@ -86,13 +84,30 @@ ONLY `executable`. Additionally, there are application-specific inputs
8684
that can be provided to the plugins such as::
8785

8886
`extra_args` (multiple apps) : Extra arguments to applications
87+
'transfer_params' (multiple apps) : Output to transfer between applications for multi-apps run
8988
`plotfl_to_csv` (RELAP5) : Option to convert `plotfl` file to `csv` file
9089
`conv_channel` (SAS) : Path to `CHANNELtoCSV.x`
9190
`conv_primar4` (SAS) : Path to `PRIMAR4toCSV.x`
9291
`auto_link_files` (Dakota) : List of files for Dakota to link automatically
9392
`scores` (OpenMC) : List of filters for tallies
9493
`score_names` (OpenMC) : List of user-given names for tally filters
9594

95+
Currently all applications/codes already integrated to WATTS can be run on Workbench, these include
96+
PyARC, OpenMC, SERPENT, ABCE, MCNP, MOOSE, SAS, Dakota, Serpent, and RELAP5.
97+
98+
For OpenMC, multiple `scores` can be provided at once. If provided, the number of `score_names` must be the
99+
same as the number of `scores`. For instance, ::
100+
101+
scores = ["elastic", "nu-fission"]
102+
score_names = ["total_elastic_scatter_rate", "total_fission_neutron_prod"]
103+
104+
and there are N tallies where N > 1, then the outputs of the run will be named as::
105+
106+
total_elastic_scatter_rate_1, total_elastic_scatter_rate_2, ..., total_elastic_scatter_rate_N
107+
total_fission_neutron_prod_1, total_fission_neutron_prod_2, ..., total_fission_neutron_prod_N
108+
109+
If `score_names` is not provided, `scores` will be used as the base name for the outputs.
110+
96111
Workflow level
97112
~~~~~~~~~~~~~~
98113

@@ -101,8 +116,21 @@ by the `plugin` keyword::
101116

102117
plugin = ID1
103118

104-
where 'ID1' is the ID of the plugin provided in the `plugins` block. The
105-
`variable` sub-block is where the values of the templated variables are
119+
where 'ID1' is the ID of the plugin provided in the `plugins` block. When performing
120+
a multi-app run where more than one plugins are used, the sequence of the run is
121+
determined by the order of plugins. For example, when the order of the plugins is::
122+
123+
plugin = ID1
124+
plugin = ID2
125+
126+
Workbench will run ID1 first then ID2. On the other than, when the order is ::
127+
128+
plugin = ID2
129+
plugin = ID1
130+
131+
Workbench will instead run ID1 first then ID2.
132+
133+
The`variable` sub-block is where the values of the templated variables are
106134
specified, as shown below::
107135

108136
variables{
@@ -146,9 +174,17 @@ Parametric study
146174
To perform parametric study, a `parametric` block needs to be added to
147175
the `workflow_level1` block as follows::
148176

149-
parametric{
177+
workflow_level1{
178+
plugin = ID1
179+
variables{
180+
param(He_inlet_temp) {value = 873.15}
181+
param(He_outlet_temp) {value = 1023.15}
182+
...
183+
}
184+
parametric{
150185
changing_params = "heat_source"
151186
changing_values = [0, 1e5, 2e5, 3e5]
187+
}
152188
}
153189

154190
where `changing_params` is the parameter whose values are varied and
@@ -160,22 +196,32 @@ Picard iteration
160196
To perform Picard iteration, the `iteration` block needs to be added
161197
to the `workflow_level1` block::
162198

163-
iteration{
164-
plugin_main = ID1
165-
plugin_sub = ID2
166-
nmax = 10
167-
convergence_params = "keff"
168-
convergence_criteria = 0.0001
169-
to_sub_params = ["avg_Tf_1" "avg_Tf_2" "avg_Tf_3" "avg_Tf_4" "avg_Tf_5"]
170-
to_main_params = ["Init_P_1" "Init_P_2" "Init_P_3" "Init_P_4" "Init_P_5"]
199+
workflow_level1{
200+
plugin = ID1
201+
variables{
202+
param(He_inlet_temp) {value = 873.15}
203+
param(He_outlet_temp) {value = 1023.15}
204+
...
205+
}
206+
iteration{
207+
plugin = ID2
208+
nmax = 10
209+
convergence_params = "keff"
210+
convergence_criteria = 0.0001
211+
to_sub_params = ["avg_Tf_1" "avg_Tf_2" "avg_Tf_3" "avg_Tf_4" "avg_Tf_5"]
212+
to_main_params = ["Init_P_1" "Init_P_2" "Init_P_3" "Init_P_4" "Init_P_5"]
213+
}
171214
}
172215

173-
where `plugin_main` and `plugin_sub` are the plugin IDs of the two applications,
174-
`nmax` is the maximum number of iterations, `convergence_params` is the parameter
175-
used for evaluating convergence, `convergence_criteria` is the tolerance for
216+
`plugin` in the `iteration` block is the plugin ID (ID2 in this example) of the
217+
application that will be used along with the the first plugin (ID1 in this example)
218+
to perform iteration. `nmax` is the maximum number of iterations,
219+
`convergence_params` is the parameter used for evaluating convergence,
220+
`convergence_criteria` is the tolerance for
176221
convergence, `to_sub_params` and `to_main_params` are lists of parameters whose
177222
values are iterated between the two applications where they each must have at least
178223
one parameter. Note that the parameter supplied to `convergence_params` must be
179224
an output from the second plugin. For instance, in the above example, "keff" is
180-
an output produced by the plugin of "ID2". The same also applies for `to_sub_params`
181-
and `to_main_params`.
225+
an output produced by the plugin of "ID2". Note that the choice of "keff" in
226+
this example is arbitrary and `convergence_params` should be chosen according to
227+
the applications used and the objective of iteration runs.

examples/1App_OpenMC_VHTR/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ This example provides a demonstration on how to use WATTS to perform a single SA
1818

1919
- [__watts_exec.py__](watts_exec.py): WATTS workflow for this example. This is the file to execute to run the problem described above.
2020
- [__openmc_template__](openmc_template.py): OpenMC templated model.
21-
- [__watts_comprehensive.son__](watts_comprehensive.son): Workbench input file for this example.
21+
- [__watts_wb.son__](watts_wb.son): Workbench input file for this example.

examples/1App_OpenMC_VHTR/watts_comprehensive.son renamed to examples/1App_OpenMC_VHTR/watts_wb.son

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ watts{
1010
}
1111

1212
workflow_level1{
13-
plugin = ID1
13+
plugin = ID1
1414
variables{
1515
param(ax_ref) {value = 2.0}
1616
param(num_cool_pins) {value = 24}

examples/1App_PyARC_UnitCell/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ This example provides a demonstration on how to use WATTS to perform a single Py
1818
- [__watts_exec.py__](watts_exec.py): WATTS workflow for this example. This is the file to execute to run the problem described above.
1919
- [__pyarc_template__](pyarc_template): PyARC templated input file.
2020
- [__lumped.son__](lumped.son): SON file referenced in PyARC input with description of lumped fission products.
21-
- [__watts_comprehensive.son__](watts_comprehensive.son): Workbench input file for this example.
21+
- [__watts_wb.son__](watts_wb.son): Workbench input file for this example.
File renamed without changes.

examples/1App_RELAP5_SingleChannel/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ This example provides a demonstration on how to use WATTS to run RELAP5-3D.
1717

1818
- [__watts_exec.py__](watts_exec.py): This is the file to execute to run the problem described above.
1919
- [__relap5_template__](relap5_template): Templated RELAP5-3D input.
20-
- [__watts_comprehensive.son__](watts_comprehensive.son): Workbench input file for this example.
20+
- [__watts_wb.son__](watts_wb.son): Workbench input file for this example.
File renamed without changes.

examples/1App_SAM_VHTR/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ This example provides a demonstration on how to use WATTS to perform a single SA
1818

1919
- [__watts_exec.py__](watts_exec.py): WATTS workflow for this example. This is the file to execute to run the problem described above.
2020
- [__sam_template__](sam_template): SAM templated input file.
21-
- [__watts_comprehensive.son__](watts_comprehensive.son): Workbench input file for this example.
21+
- [__watts_wb__.son__](watts_wb.son): Workbench input file for this example.
File renamed without changes.

0 commit comments

Comments
 (0)