Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NEAMS Workbench #85

Open
wants to merge 22 commits into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 18 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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]

Expand Down
178 changes: 178 additions & 0 deletions doc/source/user/workbench.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,178 @@
.. _workbench:

Setup WATTS in NEAMS Workbench Environment
------------------------------------------

The `NEAMS Workbench <https://www.ornl.gov/onramp/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 <https://code.ornl.gov/neams-workbench/downloads>`.

To set up WATTS in the Workbench environment, user needs to first provide the path to
zhieejhia93 marked this conversation as resolved.
Show resolved Hide resolved
where Workbench is installed in `workbench.sh` under the `scripts` directory. User can
zhieejhia93 marked this conversation as resolved.
Show resolved Hide resolved
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.
zhieejhia93 marked this conversation as resolved.
Show resolved Hide resolved
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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the setup worked great - very straightforward.

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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand why this directory would need to be defined.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed workflow_dir

(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"]
zhieejhia93 marked this conversation as resolved.
Show resolved Hide resolved
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::

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need a plugin.tmpl template that has all these options listed out that a user can autocomplete.

`code` : Name of the application
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it would be nice to have list of options, if required or optional, etc. In fact, I can show you how such documentation can be automatically generated with Workbench (and maybe added to this documentation)

`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"}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should develop different param templates that show the different options (param.value.tmpl, param.list.tmpl, param.func.tmpl, param.bool.tmpl, etc.)

}

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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure why plugin_main and plugin_sub needs specifying - I would have guessed we would use the plugin specified under workflow_level1. I see why this is needed currently because we are specifying how data is transferred from 1 app to the other. However, could this be done directly at the workflow/plugin/params level so that it can generalized in case we have additional apps involved in the workflow?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No longer need to specify plugin_main but still need to specify plugin = ID2. This is specifically for iteration only because of how the iteration workflow is set up currently. I think it's less confusing this way but we can change it if needed.

plugin_sub = ID2
nmax = 10
convergence_params = "keff"
convergence_criteria = 0.0001
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not clear at this point how "keff" is defined (as an output of an application).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a few sentences to explain what keff and better explanations on how to use iteration

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.
2 changes: 1 addition & 1 deletion examples/1App_OpenMC_VHTR/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change names of the files - watts_comprehensive.son is just an example of input with all options listed out for testing. This file should be more watts_wb.son

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renamed all .son files

47 changes: 47 additions & 0 deletions examples/1App_OpenMC_VHTR/watts_comprehensive.son
Original file line number Diff line number Diff line change
@@ -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"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think providing this link should be necessary! the Python script should know the path to this input already.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed workflow_dir


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}
}
}
}
1 change: 1 addition & 0 deletions examples/1App_PyARC_UnitCell/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
26 changes: 26 additions & 0 deletions examples/1App_PyARC_UnitCell/watts_comprehensive.son
Original file line number Diff line number Diff line change
@@ -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}
}
}

}
1 change: 1 addition & 0 deletions examples/1App_RELAP5_SingleChannel/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
29 changes: 29 additions & 0 deletions examples/1App_RELAP5_SingleChannel/watts_comprehensive.son
Original file line number Diff line number Diff line change
@@ -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}
}
}

}
1 change: 1 addition & 0 deletions examples/1App_SAM_VHTR/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
59 changes: 59 additions & 0 deletions examples/1App_SAM_VHTR/watts_comprehensive.son
Original file line number Diff line number Diff line change
@@ -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}
}
}

}
1 change: 1 addition & 0 deletions examples/1App_SAS_MultiTemplates_SodiumLoop/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Loading