This is a package for configuring Reaktoro as a gray box model in Pyomo, IDAES-PSE, and WaterTAP modeling libraries. This package is not meant to replace or act as a higher level API for Reaktoro - it is only meant to enable setting up Reaktoro equilibrium problems as blocks on Pyomo models and automate transferring Reaktoro data into Pyomo variables.
The user must familiarize thyself with Reaktoro options and usage, especially when selecting Reaktoro provided databases, database files, and activity models for aqueous, solid, and gas phases. This package does not automatically select any of these options, and will use ideal models by default.
- Please refer here for information on Reaktoro supported databases (all are supported)
- Please refer here for information on Reaktoro supported activity models (all are supported, included chain operations, or passing in pre-configured activity models)
By default the package will use:
- Database: PhreeqcDatabase
- Data file: pitzer.dat
- Aqueous activity models: ActivityModelIdealAqueous
- Gas activity models: ActivityModelIdealGas
- Solid activity models: ActivityModelIdealSolution
- Ion exchange activity modells: ActivityModelIonExchange
The Reaktoro blocks built by this package are designed to solve an equilibrium problem using user provided apparent species or true species, temperature, pressure, and pH, which are broken down to base elements and equilibrated within Reaktoro to provide exact speciation and equilibrium state. Using this state the block can return various information supported by Reaktoro:
- Chemical properties
- Aqueous properties
- Pyomo build properties, which are custom properties built in Pyomo that use chemical properties or aqueous properties as inputs
Note: Only Reaktoro properties that return a single floating point or real value are supported, as they will be directly matched to a Pyomo Var. Reaktoro functions that return arrays or strings are not supported.
To-date, this has only been tested with cyipopt - other solvers have not been tested.
- For accessing other HSL linear solvers beyond MUMPS (such as MA27, MA57, etc. solver common to WaterTAP and IDAES-PSE) follow these instructions for adding it to cyipopt.
Please include a minimal example using Reaktoro for your specific feature or issue request if possible. Please also include full traceback for errors the occur.
Reaktoro-pse depends on the following packages and/or versions:
- Python 3.9 through 3.12
- Reaktoro 2.12
- CyIpopt 1.4.1
- Pyomo>=6.8.0
- idaes-pse>=2.5.0
- watertap>=1.0.0 - (required for watertap-cyipopt wrapper only)
- A Conda distribution compatible with
conda-forge
, e.g. Miniforge - Git (needed by setuptools_scm to set the version dynamically during installation of the Python package distribution)
git clone https://github.com/watertap-org/reaktoro-pse.git
cd reaktoro-pse
conda create --yes -c conda-forge --name reaktoro-pse-dev python=3.11 reaktoro=2.12.1 cyipopt=1.4.1
conda activate reaktoro-pse-dev
pip install -r requirements-dev.txt
conda activate reaktoro-pse-dev
pytest --pyargs reaktoro_pse --verbose
black .