Skip to content

Commit

Permalink
Merge pull request #29 from nstauff/example-reorg
Browse files Browse the repository at this point in the history
Completed reorganization of WATTS examples.
  • Loading branch information
nstauff authored Mar 24, 2022
2 parents 3f8b812 + 565c5f6 commit 8740958
Show file tree
Hide file tree
Showing 80 changed files with 454 additions and 1,151 deletions.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@

moose_app_type = "bison"
app_dir = os.environ[moose_app_type.upper() + "_DIR"]
moose_plugin = watts.PluginMOOSE(moose_app_type.lower() + '_template', show_stdout=True, n_cpu=2) # show all the output
moose_plugin = watts.PluginMOOSE('bison_template', show_stdout=True, n_cpu=2) # show all the output
moose_plugin.moose_exec = app_dir + "/" + moose_app_type.lower() + "-opt"
moose_result = moose_plugin(params)
for key in moose_result.csv_data:
Expand Down
20 changes: 20 additions & 0 deletions examples/1App_MOOSE-MultiApp_Simple/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# 1App_MOOSE-MultiApp_Simple

## Purpose

This example provides a demonstration on how to use WATTS to perform a simple simulation leveraging MOOSE's MultiApps system.

## Code(s)

- MOOSE MultiApps

## Keywords

- Simple MultiApps

## File descriptions

- [__watts_exec.py__](watts_exec.py): Optimization definition with `SciPy`. This is the file to execute to run the problem described above.
- [__main.tmpl__](main.tmpl): Main MOOSE input file for the main application. This input is templated.
- [__main_in.e__](main_in.e): Mesh file for the MOOSE simulation.
- [__sub.i__](sub.i): Input file for the sub-application.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# SPDX-FileCopyrightText: 2022 UChicago Argonne, LLC
# SPDX-License-Identifier: MIT

"""
This example provides a demonstration on how to use WATTS to perform a simple simulation leveraging MOOSE's MultiApps system.
"""

from math import cos, pi
import os
import watts
Expand Down
21 changes: 21 additions & 0 deletions examples/1App_OpenMC_VHTR/README.md
Original file line number Diff line number Diff line change
@@ -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.

68 changes: 68 additions & 0 deletions examples/1App_OpenMC_VHTR/watts_exec.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# 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
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')

# 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)
print(openmc_result.inputs)
print(openmc_result.outputs)
print(openmc_result.tallies[0].get_pandas_dataframe())

power_fractions = openmc_result.tallies[0].get_values(scores=['nu-fission']).ravel()
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')
20 changes: 20 additions & 0 deletions examples/1App_PyARC_UnitCell/README.md
Original file line number Diff line number Diff line change
@@ -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.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ calculations{
xslib = "endf7.0"
egroupname = ANL33
scattering_order = 1
lumped_element_text_file( lu35 ) = "lumped_test5.son"
lumped_element_text_file( lu35 ) = "lumped.son"
cell( a ){
associated_sub_assembly = sub_assembly_name
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
# 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

Expand All @@ -14,7 +24,7 @@

# PyARC Workflow

pyarc_plugin = watts.PluginPyARC('pyarc_template', show_stdout=True, extra_inputs=['lumped_test5.son']) # show all the output
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])
Expand Down
20 changes: 20 additions & 0 deletions examples/1App_SAM_VHTR/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# 1App_SAM_VHTR

## Purpose

This example provides a demonstration on how to use WATTS to perform a single SAM run using the MOOSE plugin.

## Code(s)

- SAM

## Keywords

- SAM execution
- unit-conversion
- 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.
- [__sam_template__](sam_template): SAM templated input file.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
# 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
import watts
Expand Down
20 changes: 20 additions & 0 deletions examples/1App_SAS_SodiumLoop/README.md
Original file line number Diff line number Diff line change
@@ -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.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
# SPDX-FileCopyrightText: 2022 UChicago Argonne, LLC
# SPDX-License-Identifier: MIT

"""
This example just uses the workflow in `MultiApp_SAM-OpenMC_VHTR`
and applies it in a procedure for re-use in optimization and
sensitivity analyses.
"""

from math import cos, pi
import os
import watts
Expand Down Expand Up @@ -61,7 +67,7 @@ def calc_workflow(X):
# set your SAM directorate as SAM_DIR
moose_app_type = "SAM"
app_dir = os.environ[moose_app_type.upper() + "_DIR"]
sam_plugin = watts.PluginMOOSE('../example1a_SAM/sam_template', show_stderr=False) # does not show anything
sam_plugin = watts.PluginMOOSE('../1App_SAM_VHTR/sam_template', show_stderr=False) # does not show anything
sam_plugin.moose_exec = app_dir + "/" + moose_app_type.lower() + "-opt"
sam_result = sam_plugin(params)
max_Tf = max(sam_result.csv_data[f'max_Tf_{i}'][-1] for i in range(1, 6))
Expand Down
21 changes: 21 additions & 0 deletions examples/MultiApp_SAM-OpenMC_VHTR/README.md
Original file line number Diff line number Diff line change
@@ -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): Link to OpenMC templated model.

1 change: 1 addition & 0 deletions examples/MultiApp_SAM-OpenMC_VHTR/openmc_template.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
# SPDX-FileCopyrightText: 2022 UChicago Argonne, LLC
# SPDX-License-Identifier: MIT

"""
This example demonstrates how to use WATTS to perform
SAM calculations followed by 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. After execution of SAM using the MOOSE plugin,
the results stored in CSV files are displayed to the user.
Then, OpenMC is executed with temperature information coming
from SAM calculated graphite temperature. After execution,
the main results from OpenMC are printed out and stored
in the params database.
"""

from math import cos, pi
import os
import watts
Expand Down Expand Up @@ -60,7 +74,7 @@

moose_app_type = "SAM"
app_dir = os.environ[moose_app_type.upper() + "_DIR"]
moose_plugin = watts.PluginMOOSE('../example1a_SAM/sam_template', show_stderr=True) # show only error
moose_plugin = watts.PluginMOOSE('../1App_SAM_VHTR/sam_template', show_stderr=True) # show only error
moose_plugin.moose_exec = app_dir + "/" + moose_app_type.lower() + "-opt"
moose_result = moose_plugin(params)
for key in moose_result.csv_data:
Expand Down
42 changes: 42 additions & 0 deletions examples/MultiStep_Griffin-BISON-Sockeye_MR/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# MultiStep_Griffin-BISON-Sockeye_MR

## Purpose

This example provides a demonstration on how to use WATTS to model multi-step Workflows for multiphysics simulation involving various MOOSE applications coupled by MOOSE's MultiApps system.

## Code(s)

- MOOSE MultiApp
- Sockeye
- BISON
- Griffin

## Keywords

- Multi-steps
- MultiApp
- Micro-reactor
- Steady-state
- Transient

## File descriptions

- [__watts_exec.py__](watts_exec.py): Workflow definition. This is the file to execute to run the problem described above.
- [__unitcell_nogap_hom_xml_G11_df_MP.xml__](unitcell_nogap_hom_xml_G11_df_MP.xml): ISOXML file containing multigroup XS for Griffin
- [__3D_unit_cell_FY21_level-1_bison.e__](3D_unit_cell_FY21_level-1_bison.e): Mesh file with heat pipe holes for BISON/MOOSE subapplication.
- [__3D_unit_cell_FY21_supersimple.e__](3D_unit_cell_FY21_supersimple.e): Main mesh file used by Griffin parent app.

### Steady State
- [__MP_ss_griffin.tmpl__](MP_ss_griffin.tmpl): Griffin input at steady-state - this is main template for steady-state.
- [__MP_ss_moose.i__](MP_ss_moose.i): MOOSE input for thermal heat conduction at steady-state. This is sub-app to Griffin.
- [__MP_ss_sockeye.i__](MP_ss_sockeye.i): Sockeye input for heat conduction through heatpipes at steady-state. This is sub-app to MOOSE.

### Null Transient
- [__MP_trN_griffin.tmpl__](MP_trN_griffin.tmpl): Griffin input during null transient.
- [__MP_trN_moose.i__](MP_trN_moose.i): MOOSE input for thermal heat conduction during null transient.
- [__MP_trN_sockeye.i__](MP_trN_sockeye.i): Sockeye input for heat conduction through heatpipes during null transient.

### Transinet
- [__MP_tr_griffin.tmpl__](MP_tr_griffin.tmpl): Griffin input during transient.
- [__MP_tr_moose.i__](MP_tr_moose.i): MOOSE input for thermal heat conduction during transient.
- [__MP_tr_sockeye.i__](MP_tr_sockeye.i): Sockeye input for heat conduction through heatpipes during transient.
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@
import os
import watts

# A three-step three-level MultiApps system for a Microreactor Unit Cell is run here
# First step is steady state simulation
# Second step is a Null transient simulation to confirm the steady state obtained
# Third step is a real transient simulation induced by loss of cooling capacity
"""
A three-step three-level MultiApps system for a Microreactor Unit Cell is run here
First step is steady state simulation
Second step is a Null transient simulation to confirm the steady state obtained
Third step is a real transient simulation induced by loss of cooling capacity
"""

# set your SuperMoose directory as SUPER_MOOSE
# As Sockeye is run through dynamic linking
Expand Down
Loading

0 comments on commit 8740958

Please sign in to comment.