From 2ed634e8366110486e3982c4f9dde126981c03d4 Mon Sep 17 00:00:00 2001 From: Paul Romano Date: Thu, 17 Feb 2022 22:54:01 -0600 Subject: [PATCH] Update documentation --- doc/source/conf.py | 3 +- doc/source/reference/index.rst | 6 ++-- doc/source/user/usage.rst | 52 +++++++++++++++++++--------------- 3 files changed, 35 insertions(+), 26 deletions(-) diff --git a/doc/source/conf.py b/doc/source/conf.py index 36c45970..afc7dd7a 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -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 ------------------------------------------------- diff --git a/doc/source/reference/index.rst b/doc/source/reference/index.rst index 01c4c714..c8125d97 100644 --- a/doc/source/reference/index.rst +++ b/doc/source/reference/index.rst @@ -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 diff --git a/doc/source/user/usage.rst b/doc/source/user/usage.rst index 34bca750..5b3bccd7 100644 --- a/doc/source/user/usage.rst +++ b/doc/source/user/usage.rst @@ -48,31 +48,35 @@ workflows. Units ~~~~~ -To handle codes that use different unit systems, WATTS relies on `Astropy `_ 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(, )``. 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 @@ -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') @@ -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 @@ -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 @@ -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']) @@ -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: