Skip to content

Commit

Permalink
Update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
paulromano committed Feb 18, 2022
1 parent ad6c561 commit 2ed634e
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 26 deletions.
3 changes: 2 additions & 1 deletion doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@
'python': ('https://docs.python.org/3', None),
'numpy': ('https://numpy.org/doc/stable/', None),
'openmc': ('https://docs.openmc.org/en/stable/', None),
'h5py': ('https://docs.h5py.org/en/stable', None)
'h5py': ('https://docs.h5py.org/en/stable', None),
'astropy': ('https://docs.astropy.org/en/stable/', None)
}

# -- Options for HTML output -------------------------------------------------
Expand Down
6 changes: 4 additions & 2 deletions doc/source/reference/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ API Reference
watts.Parameters
watts.Plugin
watts.PluginOpenMC
watts.PluginSAM
watts.PluginMOOSE
watts.PluginPyARC
watts.Results
watts.ResultsOpenMC
watts.ResultsSAM
watts.ResultsMOOSE
watts.ResultsPyARC
52 changes: 29 additions & 23 deletions doc/source/user/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -48,31 +48,35 @@ workflows.
Units
~~~~~

To handle codes that use different unit systems, WATTS relies on `Astropy <https://www.astropy.org>`_ to perform unit conversion on parameters to ensure that the correct units are used for each code. For instance, MOOSE-based codes use the SI units while OpenMC uses the CGS units. With the built-in unit-conversion capability, a parameter needs only to be set once in any unit system and WATTS can automatically convert it to the correct unit for different codes. To use the unit-conversion capability, parameters need to be set to the ``astropy.units.quantity.Quantity`` class
as follows::

from astropy import units as u

Quantity = u.Quantity
To handle codes that use different unit systems, WATTS relies on the
:class:`~astropy.units.Quantity` class from :mod:`astropy.units` to perform unit
conversion on parameters to ensure that the correct units are used for each
code. For instance, MOOSE-based codes use the SI units while OpenMC uses the CGS
units. With the built-in unit-conversion capability, a parameter needs only to
be set once in any unit system and WATTS can automatically convert it to the
correct unit for different codes. To use the unit-conversion capability,
parameters need to be set using the :class:`~astropy.units.Quantity` class as
follows::

params['control_pin_rad'] = Quantity(9.9, "mm")
params['He_inlet_temp'] = Quantity(600, "Celsius")
params['He_cp'] = Quantity(4.9184126, "BTU/(kg*K)")
from astropy.units import Quantity

with the format of ``Quantity(<value>, <current unit>)``. Imperial units can also be enabled as
follows::
params['radius'] = Quantity(9.9, "mm")
params['inlet_temperature'] = Quantity(600, "Celsius")
params['c_p'] = Quantity(4.9184126, "BTU/(kg*K)")

u.imperial.enable()
with the format of ``Quantity(value, unit)``.

Plugins
+++++++

Using a particular code within WATTS requires a "plugin" that controls input file
generation, execution, and post-processing. Three plugin classes,
:class:`~watts.PluginMOOSE`, :class:`~watts.PluginOpenMC`, and :class:`~watts.PluginPyARC`, have already been added to WATTS and are available for your use.
Using a particular code within WATTS requires a "plugin" that controls input
file generation, execution, and post-processing. Three plugin classes,
:class:`~watts.PluginMOOSE`, :class:`~watts.PluginOpenMC`, and
:class:`~watts.PluginPyARC`, have already been added to WATTS and are available
for your use.

MOOSE Plugin
~~~~~~~~~~
~~~~~~~~~~~~

The :class:`~watts.PluginMOOSE` class enables MOOSE simulations using a
templated input file. This is demonstrated here for a SAM application, but other
Expand All @@ -96,7 +100,8 @@ follows:
Tsolid_sf = 1e-3
[]
If the templated input file is ``sam_template.inp``, the SAM code will rely the general MOOSE plugin that can be created as::
If the templated input file is ``sam_template.inp``, the SAM code will rely on
the general MOOSE plugin that can be created as::

moose_plugin = watts.PluginMOOSE('sam_template.inp')

Expand Down Expand Up @@ -137,7 +142,7 @@ OpenMC Plugin
~~~~~~~~~~~~~

The :class:`~watts.PluginOpenMC` class handles OpenMC execution in a similar
manner to the :class:`~watts.PluginSAM` class for SAM. However, for OpenMC,
manner to the :class:`~watts.PluginMOOSE` class for MOOSE. However, for OpenMC,
inputs are generated programmatically through the OpenMC Python API. Instead of
writing a text template, for the OpenMC plugin you need to write a function that
accepts an instance of :class:`~watts.Parameters` and generates the necessary
Expand Down Expand Up @@ -183,7 +188,7 @@ PyARC Plugin
~~~~~~~~~~~~~

The :class:`~watts.PluginPyARC` class handles PyARC execution in a similar
manner to the :class:`~watts.PluginSAM` class for SAM. PyARC use text-based
manner to the :class:`~watts.PluginMOOSE` class for MOOSE. PyARC use text-based
input files which can be templated as follows:

.. code-block:: jinja
Expand All @@ -194,7 +199,8 @@ input files which can be templated as follows:
plane ( z10 ) { z = {{ assembly_length }} }
}
If the templated input file is `pyarc_template`, then the PyARC plugin can be instantiated with following command line::
If the templated input file is `pyarc_template`, then the PyARC plugin can be
instantiated with following command line::

pyarc_plugin = watts.PluginPyARC('pyarc_template', show_stdout=True, extra_inputs=['lumped_test5.son'])

Expand Down Expand Up @@ -248,9 +254,9 @@ k-effective value at the end of the simulation:
>>> results.keff
1.0026170700986219+/-0.003342785895893627
For SAM, the :class:`~watts.ResultsMOOSE` class
provides a :attr:`~watts.ResultsMOOSE.csv_data` attribute that gathers the
results from every CSV files generated by MOOSE applications (such as SAM or BISON)::
For MOOSE, the :class:`~watts.ResultsMOOSE` class provides a
:attr:`~watts.ResultsMOOSE.csv_data` attribute that gathers the results from
every CSV files generated by MOOSE applications (such as SAM or BISON)::

moose_result = moose_plugin.workflow(params)
for key in moose_result.csv_data:
Expand Down

0 comments on commit 2ed634e

Please sign in to comment.