Skip to content

Commit

Permalink
Merge branch 'main' into issue929
Browse files Browse the repository at this point in the history
  • Loading branch information
bknueven authored May 17, 2023
2 parents c02dec2 + 9f208f2 commit e321ead
Show file tree
Hide file tree
Showing 138 changed files with 9,414 additions and 1,203 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# WaterTAP

This is the WaterTAP development repository.

WaterTAP is developed as part of the [National Alliance for Water Innovation](https://nawihub.org/) project.
Expand All @@ -16,6 +17,8 @@ WaterTAP is developed as part of the [National Alliance for Water Innovation](ht

To quickly install and start using WaterTAP, head over to the [Getting Started](https://watertap.readthedocs.io/en/stable/getting_started.html) section of the documentation.

If you wish to use the **WaterTAP UI**, you can [download and install](https://watertap-org.github.io) it from this page: https://watertap-org.github.io.

## Documentation

The WaterTAP documentation is available online at <https://watertap.readthedocs.io>.
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 3 additions & 5 deletions docs/technical_reference/property_models/ADM1.rst
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ Components
"Particulate inerts, X_I", ":math:`X_I`", "X_I"
"Total cation equivalents concentration, S_cat", ":math:`S_{cat}`", "S_cat"
"Total anion equivalents concentration, S_an", ":math:`S_{an}`", "S_an"
"Carbon dioxide carbon, S_co2", ":math:`S_{co2}`", "S_co2"
"Carbon dioxide, S_co2", ":math:`S_{co2}`", "S_co2"

**NOTE: S_h2 and S_ch4 have vapor phase and liquid phase, S_co2 only has vapor phase, and the other components only have liquid phase**
**NOTE: S_h2 and S_ch4 have vapor phase and liquid phase, S_co2 only has vapor phase, and the other components only have liquid phase. The amount of CO2 dissolved in the liquid phase is equivalent to S_IC - S_HCO3-.**

State variables
---------------
Expand All @@ -62,8 +62,7 @@ State variables
"Component mass concentrations", ":math:`C_j`", "conc_mass_comp", "[p]", ":math:`\text{kg/}\text{m}^3`"
"Anions in molar concentrations", ":math:`M_a`", "anions", "None", ":math:`\text{kmol/}\text{m}^3`"
"Cations in molar concentrations", ":math:`M_c`", "cations", "None", ":math:`\text{kmol/}\text{m}^3`"
"Water pressure", ":math:`P_{w,sat}`", "p_w_sat", "None", ":math:`\text{Pa}`"
"Component pressure", ":math:`P_{j,sat}`", "p_sat", "[p]", ":math:`\text{Pa}`"
"Component pressure", ":math:`P_{j,sat}`", "pressure_sat", "[p]", ":math:`\text{Pa}`"

Stoichiometric Parameters
-------------------------
Expand Down Expand Up @@ -142,7 +141,6 @@ Kinetic Parameters
"Valerate acid-base equilibrium constant, K_a_va", ":math:`K_{a,va}`", "K_a_va", 1.38e-5, ":math:`\text{kmol/}\text{m}^3`"
"Butyrate acid-base equilibrium constant, K_a_bu", ":math:`K_{a,bu}`", "K_a_bu", 1.5e-5, ":math:`\text{kmol/}\text{m}^3`"
"Propionate acid-base equilibrium constant, K_a_pro", ":math:`K_{a,pro}`", "K_a_bu", 1.32e-5, ":math:`\text{kmol/}\text{m}^3`"
"Propionate acid-base equilibrium constant, K_a_ac", ":math:`K_{a,ac}`", "K_a_ac", 1.74e-5, ":math:`\text{kmol/}\text{m}^3`"
"Acetate acid-base equilibrium constant, K_a_ac", ":math:`K_{a,ac}`", "K_a_ac", 1.74e-5, ":math:`\text{kmol/}\text{m}^3`"
"Carbon dioxide acid-base equilibrium constant, K_a_co2", ":math:`K_{a,co2}`", "K_a_co2", 4.94e-7, ":math:`\text{kmol/}\text{m}^3`"
"Inorganic nitrogen acid-base equilibrium constant, K_a_IN", ":math:`K_{a,IN}`", "K_a_IN", 1.11e-9, ":math:`\text{kmol/}\text{m}^3`"
Expand Down
1 change: 1 addition & 0 deletions docs/technical_reference/property_models/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ Property Models
ASM1
ASM2D
ADM1
modified_ADM1
mc_aq_sol
352 changes: 352 additions & 0 deletions docs/technical_reference/property_models/modified_ADM1.rst

Large diffs are not rendered by default.

42 changes: 18 additions & 24 deletions docs/technical_reference/unit_models/gac.rst
Original file line number Diff line number Diff line change
Expand Up @@ -245,33 +245,27 @@ The following parameters are constructed when applying the GAC costing method in

"Number of GAC contactors in operation in parallel", ":math:`N_{op}`", "num_contactors_op", "1", ":math:`\text{dimensionless}`"
"Number of off-line redundant GAC contactors in parallel", ":math:`N_{red}`", "num_contactors_redundant", "1", ":math:`\text{dimensionless}`"
"GAC steel pressure contactor polynomial cost coefficient 0 (U.S. EPA, 2021)", ":math:`x_{p0}`", "pres_contactor_cost_coeff_0", "10010.9", ":math:`$`"
"GAC steel pressure contactor polynomial cost coefficient 1 (U.S. EPA, 2021)", ":math:`x_{p1}`", "pres_contactor_cost_coeff_1", "2204.95", ":math:`$/m^3`"
"GAC steel pressure contactor polynomial cost coefficient 2 (U.S. EPA, 2021)", ":math:`x_{p2}`", "pres_contactor_cost_coeff_2", "-15.9378", ":math:`$/\left( m^3 \right)^2`"
"GAC steel pressure contactor polynomial cost coefficient 3 (U.S. EPA, 2021)", ":math:`x_{p3}`", "pres_contactor_cost_coeff_3", "0.110592", ":math:`$/\left( m^3 \right)^3`"
"GAC concrete gravity contactor polynomial cost coefficient 0", ":math:`x_{g0}`", "grav_contactor_cost_coeff_0", "75131.3", ":math:`$`"
"GAC concrete gravity contactor polynomial cost coefficient 1", ":math:`x_{g1}`", "grav_contactor_cost_coeff_1", "735.550", ":math:`$/m^3`"
"GAC concrete gravity contactor polynomial cost coefficient 2", ":math:`x_{g2}`", "grav_contactor_cost_coeff_2", "-1.01827", ":math:`$/\left( m^3 \right)^2`"
"GAC concrete gravity contactor polynomial cost coefficient 3", ":math:`x_{g3}`", "grav_contactor_cost_coeff_3", "0", ":math:`$/\left( m^3 \right)^3`"
"Reference maximum value of GAC mass needed for initial charge where economy of scale no longer discounts the unit price (U.S. EPA, 2021)", ":math:`M_{GAC}^{ref}`", "bed_mass_gac_max_ref", "18143.7", ":math:`kg`"
"GAC adsorbent exponential cost pre-exponential coefficient (U.S. EPA, 2021)", ":math:`y_0`", "adsorbent_unit_cost_coeff", "4.58342", ":math:`$/kg`"
"GAC adsorbent exponential cost parameter coefficient (U.S. EPA, 2021)", ":math:`y_1`", "adsorbent_unit_cost_exp_coeff ", "-1.25311e-5", ":math:`kg^{-1}`"
"GAC pressure other cost power law coefficient", ":math:`z_{p0}`", "pres_other_cost_coeff", "16660.7", ":math:`$/\left( m^3 \right)^{z_1}`"
"GAC pressure other cost power law exponent", ":math:`z_{p1}`", "pres_other_cost_exp", "0.552207", ":math:`\text{dimensionless}`"
"GAC gravity other cost power law coefficient", ":math:`z_{g0}`", "grav_other_cost_coeff", "38846.9", ":math:`$/\left( m^3 \right)^{z_1}`"
"GAC gravity other cost power law exponent", ":math:`z_{g1}`", "grav_other_cost_exp", "0.490571", ":math:`\text{dimensionless}`"
"Fraction of spent GAC adsorbent that can be regenerated for reuse", ":math:`f_{regen}`", "regen_frac", "0.70", ":math:`\text{dimensionless}`"
"Reference maximum value of GAC mass needed for initial charge where economy of scale no longer discounts the unit price (U.S. EPA, 2021)", ":math:`M_{GAC}^{ref}`", "bed_mass_gac_max_ref", "18143.7", ":math:`kg`"
"Contactor polynomial cost coefficients", ":math:`x`", "contactor_cost_coeff", "tabulated", ":math:`\text{dimensionless}`"
"Adsorbent exponential cost coefficients", ":math:`y`", "adsorbent_unit_cost_coeff", "tabulated", ":math:`\text{dimensionless}`"
"Other process costs power law coefficients", ":math:`z`", "other_cost_param", "tabulated", ":math:`\text{dimensionless}`"
"Unit cost to regenerate spent GAC adsorbent by an offsite regeneration facility", ":math:`C_{regen}`", "regen_unit_cost", "4.28352", ":math:`$/kg`"
"Unit cost to makeup spent GAC adsorbent with fresh adsorbent", ":math:`C_{makeup}`", "makeup_unit_cost", "4.58223", ":math:`$/kg`"
"GAC steel pressure contactor polynomial energy consumption coefficient 0", ":math:`\alpha_{p0}`", "pres_energy_coeff_0", "8.09926e-4", ":math:`kW`"
"GAC steel pressure contactor polynomial energy consumption coefficient 1", ":math:`\alpha_{p1}`", "pres_energy_coeff_1", "8.70577e-4", ":math:`kW/m^3`"
"GAC steel pressure contactor polynomial energy consumption coefficient 2", ":math:`\alpha_{p2}`", "pres_energy_coeff_2", "0", ":math:`kW/\left( m^3 \right)^2`"
"GAC concrete gravity contactor polynomial energy consumption coefficient 0", ":math:`\alpha_{g0}`", "grav_energy_coeff_0", "0.123782", ":math:`kW`"
"GAC concrete gravity contactor polynomial energy consumption coefficient 1", ":math:`\alpha_{g1}`", "grav_energy_coeff_1", "0.132403", ":math:`kW/m^3`"
"GAC concrete gravity contactor polynomial energy consumption coefficient 2", ":math:`\alpha_{g2}`", "grav_energy_coeff_2", "-1.41512e-5", ":math:`kW/\left( m^3 \right)^2`"
"Energy consumption polynomial coefficients", ":math:`alpha`", "energy_consumption_coeff", "tabulated", ":math:`\text{dimensionless}`"

Costing methods are available for steel pressure vessel contactors (default) and concrete gravity basin contactors. Given that the form of the costing component equations are different (polynomial, exponential, and power law), the units associated with the parameters are embedded in the constraints and not directly applied to the variable. Additionally, the index is generalized to its position ``([0:len(parameter_data)])`` in the list, although some parameters are coefficients while others are exponents (see equations below for details). Variables with the (U.S. EPA, 2021) citation are directly taken from previously determined expressions. Other variables are regressed from higher detailed costing methods in (U.S. EPA, 2021). The variations in costing parameters are tabulated below:

.. csv-table::
:header: "Variable Name", "Contactor Type", "Index 0", "Index 1", "Index 2", "Index 3"

Variables with the (U.S. EPA, 2021) citation are directly taken from previously determined expressions. Other variables
are regressed from higher detailed costing methods in (U.S. EPA, 2021).
"adsorbent_unit_cost_coeff (U.S. EPA, 2021)", "n/a", "4.58342", "-1.25311e-5", "", ""
"contactor_cost_coeff (U.S. EPA, 2021)", "pressure", "10010.9", "2204.95", "-15.9378", "0.110592"
"contactor_cost_coeff", "gravity", "75131.3", "735.550", "-1.01827", "0"
"other_cost_param", "pressure", "16660.7", "0.552207", "", ""
"other_cost_param", "gravity", "38846.9", "0.490571", "", ""
"energy_consumption_coeff_data", "pressure", "8.09926e-4", "8.70577e-4", "0", ""
"energy_consumption_coeff_data", "gravity", "0.123782", "0.132403", "-1.41512e-5", ""

Costing GAC contactors is defaulted to purchasing 1 operational and 1 redundant contactor for alternating operation. For large systems this may be a poor
assumption considering vessel sizing and achieving pseudo-steady state. The number of contactors input by the user should justify reasonable
Expand Down Expand Up @@ -357,4 +351,4 @@ Crittenden, J. C., Berrigan, J. K., Hand, D. W., & Lykins, B. (1987). Design of
Nonconstant Diffusivities. Journal of Environmental Engineering, 113(2), 243–259.

United States Environmental Protection Agency. (2021). Work Breakdown Structure-Based Cost Model for Granular Activated
Carbon Drinking Water Treatment.
Carbon Drinking Water Treatment. https://www.epa.gov/system/files/documents/2022-03/gac-documentation-.pdf_0.pdf
2 changes: 2 additions & 0 deletions docs/technical_reference/unit_models/translators/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ Translators
:maxdepth: 1

translator_adm1_asm1
translator_adm1_asm2d
translator_asm1_adm1
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,64 @@ Sets
**Notes**
:sup:`*` Ion" is a subset of "Component" and uses the same symbol j.

ADM1 Components
---------------
Additional documentation on the ADM1 property model can be found here: `Anaerobic Digestion Model 1 Documentation <https://watertap.readthedocs.io/en/latest/technical_reference/property_models/ADM1.html>`_

.. csv-table::
:header: "Description", "Symbol", "Variable"

"Monosaccharides, S_su", ":math:`S_{su}`", "S_su"
"Amino acids, S_aa", ":math:`S_{aa}`", "S_aa"
"Long chain fatty acids, S_fa", ":math:`S_{fa}`", "S_fa"
"Total valerate, S_va", ":math:`S_{va}`", "S_va"
"Total butyrate, S_bu", ":math:`S_{bu}`", "S_bu"
"Total propionate, S_pro", ":math:`S_{pro}`", "S_pro"
"Total acetate, S_ac", ":math:`S_{ac}`", "S_ac"
"Hydrogen gas, S_h2", ":math:`S_{h2}`", "S_h2"
"Methane gas, S_ch4", ":math:`S_{ch4}`", "S_ch4"
"Inorganic carbon, S_IC", ":math:`S_{IC}`", "S_IC"
"Inorganic nitrogen, S_IN", ":math:`S_{IN}`", "S_IN"
"Soluble inerts, S_I", ":math:`S_I`", "S_I"
"Composites, X_c", ":math:`X_c`", "X_c"
"Carbohydrates, X_ch", ":math:`X_{ch}`", "X_ch"
"Proteins, X_pr", ":math:`X_{pr}`", "X_pr"
"Lipids, X_li", ":math:`X_{li}`", "X_li"
"Sugar degraders, X_su", ":math:`X_{su}`", "X_su"
"Amino acid degraders, X_aa", ":math:`X_{aa}`", "X_aa"
"Long chain fatty acid (LCFA) degraders, X_fa", ":math:`X_{fa}`", "X_fa"
"Valerate and butyrate degraders, X_c4", ":math:`X_{c4}`", "X_c4"
"Propionate degraders, X_pro", ":math:`X_{pro}`", "X_pro"
"Acetate degraders, X_ac", ":math:`X_{ac}`", "X_ac"
"Hydrogen degraders, X_h2", ":math:`X_{h2}`", "X_h2"
"Particulate inerts, X_I", ":math:`X_I`", "X_I"
"Total cation equivalents concentration, S_cat", ":math:`S_{cat}`", "S_cat"
"Total anion equivalents concentration, S_an", ":math:`S_{an}`", "S_an"
"Carbon dioxide, S_co2", ":math:`S_{co2}`", "S_co2"

**NOTE: S_h2 and S_ch4 have vapor phase and liquid phase, S_co2 only has vapor phase, and the other components only have liquid phase. The amount of CO2 dissolved in the liquid phase is equivalent to S_IC - S_HCO3-.**

ASM1 Components
---------------
Additional documentation on the ASM1 property model can be found here: `Activated Sludge Model 1 Documentation <https://watertap.readthedocs.io/en/latest/technical_reference/property_models/ASM1.html>`_

.. csv-table::
:header: "Description", "Symbol", "Variable"

"Soluble inert organic matter, S_I", ":math:`S_I`", "S_I"
"Readily biodegradable substrate S_S", ":math:`S_S`", "S_S"
"Particulate inert organic matter, X_I", ":math:`X_I`", "X_I"
"Slowly biodegradable substrate X_S", ":math:`X_S`", "X_S"
"Active heterotrophic biomass X_B,H", ":math:`X_{B,H}`", "X_BH"
"Active autotrophic biomass X_B,A", ":math:`X_{B,A}`", "X_BA"
"Particulate products arising from biomass decay, X_P", ":math:`X_P`", "X_P"
"Oxygen, S_O", ":math:`S_O`", "S_O"
"Nitrate and nitrite nitrogen, S_NO", ":math:`S_{NO}`", "S_NO"
"NH4 :math:`^{+}` + NH :math:`_{3}` Nitrogen, S_NH", ":math:`S_{NH}`", "S_NH"
"Soluble biodegradable organic nitrogen, S_ND", ":math:`S_{ND}`", "S_ND"
"Particulate biodegradable organic nitrogen, X_ND", ":math:`X_{ND}`", "X_ND"
"Alkalinity, S_ALK", ":math:`S_{ALK}`", "S_ALK"

.. _Translator_ADM1_ASM1_equations:

Equations and Relationships
Expand Down Expand Up @@ -87,4 +145,4 @@ References
[1] Copp J. and Jeppsson, U., Rosen, C., 2006.
Towards an ASM1 - ADM1 State Variable Interface for Plant-Wide Wastewater Treatment Modeling.
Proceedings of the Water Environment Federation, 2003, pp 498-510.
https://www.accesswater.org/publications/-290550/towards-an-asm1--ndash--adm1-state-variable-interface-for-plant-wide-wastewater-treatment-modeling
https://www.accesswater.org/publications/proceedings/-290550/towards-an-asm1---adm1-state-variable-interface-for-plant-wide-wastewater-treatment-modeling
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
ADM1 to ASM2d Translator
========================

Introduction
------------

A link is required to translate between biological based and physical or chemical mediated processes
to develop plant-wide modeling of wastewater treatment. This model mediates the interaction between
the Modified Anaerobic Digestor Model 1 (ADM1) and the Modified Activated Sludge Model 2d (ASM2d).

The model relies on the following key assumption:

* supports only liquid phase
* supports only Modified ADM1 to Modified ASM2d translations

.. index::
pair: watertap.unit_models.translators.translator_adm1_asm2d;translator_adm1_asm2d

.. currentmodule:: watertap.unit_models.translators.translator_adm1_asm2d

Degrees of Freedom
------------------
The translator degrees of freedom are the inlet feed state variables:

* temperature
* pressure
* volumetric flowrate
* solute compositions
* cations
* anions

Ports
-----

This model provides two ports:

* inlet
* outlet

Sets
----

.. csv-table::
:header: "Description", "Symbol", "Indices"

"Time", ":math:`t`", "[0]"
"Inlet/outlet", ":math:`x`", "['in', 'out']"
"Phases", ":math:`p`", "['Liq']"
"Inlet Components", ":math:`j`", "['H2O', 'S_su', 'S_aa', 'S_fa', 'S_va', 'S_bu', 'S_pro', 'S_ac','S_h2','S_ch4','S_IC','S_IN','S_IP','S_I','X_ch','X_pr','X_li','X_su','X_aa','X_fa','X_c4','X_pro','X_ac','X_h2','X_I','X_PHA','X_PP','X_PAO','S_K','S_Mg']"
"Ion", ":math:`j`", "['S_cat', 'S_an'] \ :sup:`1`"
"Outlet Components", ":math:`j`", "['H2O', 'S_A','S_F','S_I','S_N2','S_NH4','S_NO3','S_O2','S_PO4','S_ALK','X_AUT','X_H','X_I','X_MeOH','X_MeP','X_PAO','X_PHA','X_PP','X_S','X_TSS'] \ :sup:`2`"
"Readily Biodegradable COD", ":math:`k`", "['S_su', 'S_aa', 'S_fa', 'S_va', 'S_bu', 'S_pro', 'S_ac']"
"Slowly Biodegradable COD", ":math:`m`", "['X_ch', 'X_pr', 'X_li']"
"Unchanged Components", ":math:`j`", "['S_I','X_I','X_PP','X_PHA']"
"Zero Flow Components", ":math:`j`", "['S_N2','S_NO3','S_O2','X_AUT','X_H','X_PAO','X_TSS','X_MeOH','X_MeP']"

**Notes**
:sup:`1` Ion" is a subset of "Inlet Components" and uses the same symbol j.
:sup:`2` "Outlet Components" also includes any additional solutes that the user specifies for Modified ASM2d.

.. _Translator_ADM1_ASM2d_equations:

Equations and Relationships
---------------------------

.. csv-table::
:header: "Description", "Equation"

"Volumetric flow equality", ":math:`F_{out} = F_{in}`"
"Temperature balance", ":math:`T_{out} = T_{in}`"
"Pressure balance", ":math:`P_{out} = P_{in}`"
"Fermentable substrate conversion", ":math:`S_{F, out} = S_{su, in} + S_{aa, in} + S_{fa, in}`"
"Acetic acid conversion", ":math:`S_{A, out} = S_{va, in} + S_{bu, in} + S_{pro, in} + S_{ac, in}`"
"Inert soluble COD conversion", ":math:`S_{I, out} = S_{I, in}`"
"Inert particulate COD conversion", ":math:`X_{I, out} = X_{I, in}`"
"Polyphosphate conversion", ":math:`X_{PP, out} = X_{PP, in}`"
"Polyhydroxyalkanoates conversion", ":math:`X_{PHA, out} = X_{PHA, in}`"
"Ammonium conversion", ":math:`S_{NH4, out} = S_{IN, in}`"
"Phosphate conversion", ":math:`S_{PO4, out} = S_{IP, in}`"
"Alkalinity conversion", ":math:`S_{ALK, out} = \frac{S_{IC, in}}{12}`"
"Biodegradable particulate organics conversion", ":math:`X_{S, out} = X_{ch, in} + X_{pr, in} + X_{li, in}`"


Classes
-------
.. currentmodule:: watertap.unit_models.translators.translator_adm1_asm2d

.. autoclass:: TranslatorDataADM1ASM2D
:members:
:noindex:

References
----------
[1] Flores-Alsina, X., Solon, K., Mbamba, C.K., Tait, S., Gernaey, K.V., Jeppsson, U. and Batstone, D.J., 2016.
Modelling phosphorus (P), sulfur (S) and iron (Fe) interactions for dynamic simulations of anaerobic digestion processes.
Water Research, 95, pp.370-382.

Loading

0 comments on commit e321ead

Please sign in to comment.