Skip to content

Commit

Permalink
Merge branch 'main' into memb_resis
Browse files Browse the repository at this point in the history
  • Loading branch information
lbianchi-lbl authored Dec 18, 2024
2 parents 7d49e18 + 9eb240e commit 29e1bc2
Show file tree
Hide file tree
Showing 106 changed files with 6,704 additions and 3,643 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,10 @@ jobs:
if: matrix.coverage
run:
|
echo PYTEST_ADDOPTS="$PYTEST_ADDOPTS --cov-report=xml" >> $GITHUB_ENV
echo PYTEST_ADDOPTS="$PYTEST_ADDOPTS --cov --cov-report=xml" >> $GITHUB_ENV
- name: Test with pytest
run: |
pytest --pyargs watertap
pytest --pyargs watertap --idaes-flowsheets --entry-points-group watertap.flowsheets
- name: Upload coverage report as job artifact
if: matrix.coverage
uses: actions/upload-artifact@v4
Expand Down
4 changes: 2 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@
author = "NAWI"

# The full version, including alpha/beta/rc tags
release = "1.2.dev0"
release = "1.3.dev0"
# The short X.Y version
version = "1.2.dev0"
version = "1.3.dev0"
# -- General configuration ---------------------------------------------------


Expand Down
2 changes: 1 addition & 1 deletion docs/how_to_guides/how_to_use_debugging_solver_wrapper.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ In a python module containing the model and script to solve that model, the user

.. testcode::

from watertap.core.util.model_debug_mode import activate
from watertap_solvers.model_debug_mode import activate
activate()


Expand Down
10 changes: 6 additions & 4 deletions docs/how_to_guides/how_to_use_loopTool_to_explore_flowsheets.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ How to use loopTool to explore flowsheets
=========================================

.. index::
pair: watertap.tools.analysis_tools.loop_tool;loop_tool
pair: parameter_sweep.loop_tool;loop_tool

.. currentmodule:: watertap.tools.analysis_tools.loop_tool
.. currentmodule:: parameter_sweep.loop_tool

The loopTool is a wrapper for the parameter sweep (PS) tool set, and is designed to simplify setting up parametric sweeps, enabling sweeping over discrete design choices, and providing structured data management.

Expand Down Expand Up @@ -143,7 +143,9 @@ The sweep_param_loop parameters will be iterated over one by one, to sweep over
param: key on the flowsheet that can be found using m.find_component (e.g., fs.costing.reverse_osmosis.membrane_cost)
lower_limit: lower value for sampling
upper_limit: upper value for sampling
num_samples: number of samples to run
num_samples: number of samples to run
Please note that YAML only supports literals for numeric data types. Expression-like values such as ``150 * 0.8`` will be parsed as strings and cause errors once the YAML inputs have been loaded.

**Defining diff_param_loop**

Expand Down Expand Up @@ -365,7 +367,7 @@ Example of code for setting up our example of RO with ERD
# This imports the function created in the example for RO_with_energy_recovery above
import ro_erd as ro_setup
# import the loopTool and utility function for getting a working directory
from watertap.tools.analysis_tools.loop_tool.loop_tool import loopTool, get_working_dir
from parameter_sweep.loop_tool.loop_tool import loopTool, get_working_dir
if __name__=='__main__': we will execute the loopTool script here, required for safe execution of parallel scripts
# We assume our .yaml file is in the same directory as this script
Expand Down
29 changes: 25 additions & 4 deletions docs/how_to_guides/how_to_use_ui_api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,21 @@

Add a flowsheet to the UI
==========================
.. py:currentmodule:: watertap.ui.fsapi
.. py:currentmodule:: idaes_flowsheet_processor.api
This API is intended for model developers who would like to connect their flowsheets to the UI.
Developers can select which variables to "export" to the UI for each component of the model,
and provide extra metadata (display name, description) for them. For flowsheets, they should also
specify how to build and solve the flowsheets.

For reference, see :class:`FlowsheetInterface` and :class:`FlowsheetExport` in the `watertap.ui.fsapi` module.
For reference, see :class:`FlowsheetInterface` and :class:`FlowsheetExport` in the `idaes_flowsheet_processor.api` module.

----

In some Python module, define the function ``export_to_ui``, which will look
similar to this::

from watertap.ui.fsapi import FlowsheetInterface, FlowsheetCategory
from idaes_flowsheet_processor.api import FlowsheetInterface, FlowsheetCategory
def export_to_ui():
return FlowsheetInterface(
name="NF-DSPM-DE",
Expand Down Expand Up @@ -194,4 +194,25 @@ entrypoint must be defined in setup.py with the path to the export file. For exa
]


For a complete overview of all arguments, see :class:`FlowsheetInterface`.
For a complete overview of all arguments, see :class:`FlowsheetInterface`.

Testing flowsheet interfaces
-------------------------------

.. note::
The following requires the WaterTAP testing dependencies to be installed. This is done by default in a developer environment, or can be installed manually by running ``pip install "watertap[testing]"``.

To verify that the flowsheet interfaces developed and distributed with WaterTAP function correctly, it is possible to use pytest to run a series of standardized tests against each interface. The ``idaes-flowsheets`` pytest plugin that enables this functionality is installed together with the rest of the WaterTAP testing dependencies. However, it must be activated by providing additional command-line flags when invoking pytest.

.. code-block:: shell
# run tests for all flowsheet interfaces registered under the `watertap.flowsheets` entry point group
pytest --idaes-flowsheets --entry-point-group watertap.flowsheets
# run tests for one or more importable Python modules (useful when developing a new flowsheet interface as it also supports modules not yet registered as an entry point)
pytest --idaes-flowsheets --modules watertap.flowsheets.gac.gac_ui watertap.flowsheets.mvc.mvc_single_stage_ui
.. note::
By default, the ``idaes-flowsheets`` pytest plugin will collect and run its tests *in addition* to the normally discovered pytest tests (e.g. test functions defined in ``test_*.py`` files throughout the current working directory). To disable normal (Python) pytest collection and only run ``idaes-flowsheets`` tests, use the ``-p no:python`` flag::

pytest --idaes-flowsheets --modules watertap.flowsheets.gac.gac_ui watertap.flowsheets.mvc.mvc_single_stage_ui -p no:python
2 changes: 1 addition & 1 deletion docs/technical_reference/flowsheets/lsrro.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Moreover, LSRRO can be constructed using commercially available nanofiltration m


Implementation
==============
--------------

Figure 1 illustrates the LSRRO flowsheet. The LSRRO system comprises a conventional RO stage followed by low-salt-rejection (LSR) stages, where the saline permeate of each LSR stage is recycled to the inlet of the previous stage. Brine is concentrated further as it passes through each subsequent LSR stage.
The first stage RO permeate is collected as purified water (Product Water) and the last LSR stage produces the final concentrated brine.
Expand Down
2 changes: 1 addition & 1 deletion docs/technical_reference/ui/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ changes from the UI front-end.

.. include:: <isonum.txt>

.. py:currentmodule:: watertap.ui.fsapi
.. py:currentmodule:: idaes_flowsheet_processor.api
.. contents:: Contents
:depth: 1
Expand Down
2 changes: 2 additions & 0 deletions docs/technical_reference/unit_models/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Unit Models
generic_separator
ion_exchange_0D
membrane_distillation_0D
membrane_distillation_1D
mvc
nanofiltration_ZO
nanofiltration_dspmde_0D
Expand All @@ -32,6 +33,7 @@ Unit Models
pump
reverse_osmosis_0D
reverse_osmosis_1D
steam_ejector
stoichiometric_reactor
thickener
translators/index
Expand Down
Loading

0 comments on commit 29e1bc2

Please sign in to comment.