Skip to content

Commit

Permalink
add VMD, PGMD/CGMD (#1466)
Browse files Browse the repository at this point in the history
* add VMD, PGMD/CGMD

* modifies gap heat conduction

* black

* modifies scaling factor calculations

* VMD modifications

* modifications for PGMD

* black

* modifies VMD

* modifies PGMD

* Revert "updates"

This reverts commit 3792195, reversing
changes made to 8070194.

* Reapply "updates"

This reverts commit 42005cf.

* 1D VMD and PGMD

* resolve PGMD heat balance issue at inlet for 0D model. PGMD 1D was working as expected

* refine tests

* revise tests

* black

* linting

* resolve doc issue

* resolve doc issue

* refine tests

* resolve doc issue

* improve scaling

* Update watertap/unit_models/MD/membrane_distillation_1D.py

Co-authored-by: MarcusHolly <96305519+MarcusHolly@users.noreply.github.com>

* Update watertap/unit_models/tests/test_membrane_distillation_0D.py

Co-authored-by: Adam Atia <aatia@keylogic.com>

* add docs for new configs and 1D MD

* resolve doc issue

* doc revise

* Update docs/technical_reference/unit_models/membrane_distillation_1D.rst

Co-authored-by: MarcusHolly <96305519+MarcusHolly@users.noreply.github.com>

* Update docs/technical_reference/unit_models/membrane_distillation_0D.rst

Co-authored-by: MarcusHolly <96305519+MarcusHolly@users.noreply.github.com>

* Update docs/technical_reference/unit_models/membrane_distillation_1D.rst

Co-authored-by: MarcusHolly <96305519+MarcusHolly@users.noreply.github.com>

* Update docs/technical_reference/unit_models/membrane_distillation_0D.rst

Co-authored-by: MarcusHolly <96305519+MarcusHolly@users.noreply.github.com>

* Update docs/technical_reference/unit_models/membrane_distillation_1D.rst

Co-authored-by: MarcusHolly <96305519+MarcusHolly@users.noreply.github.com>

* rename PGMD_CGMD to GMD

* categorize equations based on MD config type

---------

Co-authored-by: Ludovico Bianchi <lbianchi@lbl.gov>
Co-authored-by: MarcusHolly <96305519+MarcusHolly@users.noreply.github.com>
Co-authored-by: Adam Atia <aatia@keylogic.com>
  • Loading branch information
4 people authored Dec 18, 2024
1 parent 500647b commit 9eb240e
Show file tree
Hide file tree
Showing 11 changed files with 2,437 additions and 312 deletions.
1 change: 1 addition & 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 Down
149 changes: 102 additions & 47 deletions docs/technical_reference/unit_models/membrane_distillation_0D.rst
Original file line number Diff line number Diff line change
@@ -1,48 +1,60 @@
=========================================
Membrane Distillation (0D)
=========================================
This Membrane Distillation (MD) unit model
* is developed for direct contact configuration (other configurations are under development)
* is developed for couterflow mode (parallel flow is under development)
* is 0-dimensional
* supports steady-state only
* Assumes heat loss in equipment is negligible
* Assumes permeate exits the membrane pores with zero salinity
* Assumes no concentration polarization for the cold channel
* Assumes complete vapor condensation on the cold channel


This Membrane Distillation (MD) unit model:
* supports the following configurations:

.. index::
pair: watertap.unit_models.MD;MD
- **DCMD** (Direct Contact Membrane Distillation)
- **VMD** (Vacuum Membrane Distillation)
- **GMD** (Permeate Gap/Conductive Gap Membrane Distillation)

* is 0-dimensional
* supports steady-state only
* assumes heat loss in equipment is negligible
* assumes permeate exits the membrane pores with zero salinity
* assumes no concentration polarization for the cold channel
* assumes complete vapor condensation for the cold channel (in DCMD and GMD)
* accounts for vapor expansion in VMD
* assumes linear temperature change across gap channel (in GMD)
* assumes no pressure change and temperature polarization in VMD vacuum channel

.. currentmodule:: watertap.unit_models.MD

Degrees of Freedom
------------------
In addition to the hot channel and cold channel inlet state variables (i.e, temperature, pressure, and component flowrates), the MD model has
at least 4 degrees of freedom that should be fixed for the unit to be fully specified. Typically, the following variables are fixed for the MD model:

* Membrane permeability coefficient
* Membrane thickness
* Membrane thermal conductivity
* Recovery *or* membrane area

In addition to the hot channel and cold channel inlet state variables (i.e, temperature, pressure, and component flowrates) for the **DCMD** and **GMD** configurations, the MD model has at least **4 degrees of freedom** for all configurations that should be fixed for the unit to be fully specified. Typically, the following variables are fixed:

- Membrane permeability coefficient
- Membrane thickness
- Membrane thermal conductivity
- Recovery *or* membrane area

**Additional degress of freedom**:

- **VMD** introduces vacuum pressure at the cold side.
- **GMD** introduces gap thermal conductivity and gap thickness.

Configuring the MD unit to calculate temperature polarization, concentration polarization, mass transfer
coefficient, and pressure drop would result in five additional degrees of freedom. In this case, in addition to the
previously fixed variables, we typically fix the following variables to fully specify the unit:

* Hot channel spacer porosity
* Hot channel height
* Cold channel spacer porosity
* Cold channel height
* Cold channel spacer porosity (in DCMD and GMD)
* Cold channel height (in DCMD and GMD)
* Membrane length *or* membrane width

Model Structure
------------------
This MD model consists of a separate MDchannel0Dblock for the hot channel and the cold channel of the module.
---------------
The MD model consists of a separate `MDchannel0Dblock` for each channel depending on the configuration:

* Each MDchannel0Dblock includes 6 stateblocks: 2 stateBlocks for the bulk properites at the inlet and outlet (properties_in and properties_out), which are used for mass, energy, and momentum balances; 2 StateBlocks for the conditions at the membrane interface, and 2 stateblocks for the vapor phase at the membrane interface. Property packages must be declared for each MD channel block for the liquid (bulk and interface) and vapor Phases.
- **DCMD**: Includes **hot channel** and **cold channel**.
- **VMD**: Includes **hot channel** and **vacuum (cold) channel**.
- **GMD**: Includes **hot channel**, **gap channel**, and **cold channel**.

- **hot and cold channels in all configurations** includes bulk properties at the inlet and outlet (`properties_in` and `properties_out`) which are used for mass, energy, and momentum balances
- **hot channel in all configurations, cold channel in DCMD and GMD, and gap channel in GMD** includes 2 StateBlocks for the conditions at the membrane interface and gap interface
- **hot channel in all configurations, cold channel in DCMD, and gap channel in GMD** includes Vapor properties at the membrane interface (for **DCMD** and **VMD** configurations).

Sets
----
Expand All @@ -56,25 +68,40 @@ Sets

\*Solute depends on the imported property model.

.. _MD_variables:
.. _0MD_variables:

Variables
----------

Variables
---------
.. csv-table::
:header: "Description", "Symbol", "Variable Name", "Index", "Units"

"Membrane permeability coefficient", ":math:`B_0`", "permeability_coef", "[t]", ":math:`\text{kg/m/Pa/s}`"
"Membrane thickness", ":math:`\sigma`", "membrane_thickness", "None", ":math:`\text{m}`"
"Membrane thermal conductivity", ":math:`k_m`", "membrane_tc", "None", ":math:`\text{W/K/m}`"
"Mass density of solvent", ":math:`\rho_{solvent}`", "dens_solvent", "[p]", ":math:`\text{kg/}\text{m}^3`"
"Mass flux across membrane", ":math:`J`", "flux_mass", "[t, x]", ":math:`\text{kg/s}\text{/m}^2`"
"Conduction heat flux across membrane", ":math:`q_{cond}`", "flux_conduction_heat", "[t, x]", ":math:`\text{W}\text{/m}^2`"
"Evaporation heat flux from hot channel", ":math:`q_{evap}`", "flux_enth_hot", "[t, x]", ":math:`\text{W}\text{/m}^2`"
"Condensation heat flux to cold channel", ":math:`q_{conden}`", "flux_enth_cold", "[t, x]", ":math:`\text{W}\text{/m}^2`"
"Membrane area", ":math:`A_m`", "area", "None", ":math:`\text{m}^2`"
"Recovery rate", ":math:`R`", "recovery_mass", "[t]", ":math:`\text{dimensionless}`"


**Additional Variables for VMD**:

.. csv-table::
:header: "Description", "Symbol", "Variable Name", "Index", "Units"

"Vapor expansion heat flux", ":math:`q_{exp}`", "flux_expansion_heat", "[t, x]", ":math:`\text{W}\text{/m}^2`"

**Additional Variables for GMD**:

.. csv-table::
:header: "Description", "Symbol", "Variable Name", "Index", "Units"

"Gap thermal conductivity", ":math:`k_{gap}`", "gap_thermal_conductivity", "None", ":math:`\text{W/K/m}`"
"Gap thickness", ":math:`\sigma_{gap}`", "gap_thickness", "None", ":math:`\text{m}`"
"gap conduction heat flux", ":math:`q_{gap}`", "flux_conduction_heat_gap", "[t, x]", ":math:`\text{W}\text{/m}^2`"

The following variables are only built when specific configuration key-value pairs are selected.

if ``has_pressure_change`` is set to ``True``:
Expand Down Expand Up @@ -174,32 +201,60 @@ if ``pressure_change_type`` is set to ``PressureChangeType.calculated``:
"Cold channel velocity", ":math:`v_c`", "cold_ch.velocity", "[t, x]", ":math:`\text{m/s}`"
"Pressure drop per unit length of cold channel at inlet/outlet", ":math:`(ΔP/Δx)_c`", "cold_ch.dP_dx", "[t, x]", ":math:`\text{Pa/m}`"

.. _MD_equations:
.. _0MD_equations:

Equations
-----------
---------

.. csv-table::
if ``MD_configuration_type`` is set to ``MDconfigurationType.DCMD``:

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

"Vapor flux across membrane", ":math:`J(t, x) = \frac{B_0(t)}{\sigma} \times \left( P_{\text{sat, hot}}(t, x) - P_{\text{sat, cold}}(t, x) \right)`"
"Average flux across membrane", ":math:`J_{avg, j} = \frac{1}{2}\sum_{x} J_{x, j}`"
"hot channel membrane-interface solute concentration", ":math:`C_{\text{interface, j, h}}(t, x) = C_{\text{bulk, j, h}}(t, x) \times \exp\left( \frac{J(t, x)}{\rho_{\text{solvent}} \times k_h(t, x, j)} \right)`"
"Evaporation heat flux from hot channel", ":math:`q_{\text{evap}}(t, x) = J(t, x) \times \widehat{H}_{\text{h}}(t, x, Vap)`"
"Condensation heat flux to cold channel", ":math:`q_{\text{conden}}(t, x) = J(t, x) \times \widehat{H}_{\text{c}}(t, x, Vap)`"
"Average evaporation flux from hot channel", ":math:`\overline{q}_{\text{evap}}(t) = \frac{1}{2} \sum_{x} q_{\text{evap}}(t, x)`"
"Average condensation flux to cold channel", ":math:`\overline{q}_{\text{conden}}(t) = \frac{1}{2} \sum_{x} q_{\text{conden}}(t, x)`"
"Hot channel convective heat transfer", ":math:`h_{\text{conv}, h}(t, x) \left( T_{\text{bulk}, h}(t, x) - T_{\text{interface}, h}(t, x) \right) = q_{\text{cond}}(t, x) + q_{\text{evap}}(t, x) - J(t, x) \cdot \widehat{H}_{\text{bulk, h}}(t, x, Liq)`"
"Cold channel convective heat transfer", ":math:`h_{\text{conv}, c}(t, x) \left( T_{\text{interface}, c}(t, x) - T_{\text{bulk}, c}(t, x) \right) = q_{\text{cond}}(t, x) + q_{\text{conden}}(t, x) - J(t, x) \cdot \widehat{H}_{\text{bulk}, c}(t, x, Liq)`"
"Hot channel convective heat transfer", ":math:`h_{\text{conv}, h}(t, x) \left( T_{\text{bulk}, h}(t, x) - T_{\text{interface}, h}(t, x) \right) = q_{\text{cond}}(t, x) + q_{\text{evap}}(t, x) - J(t, x) \cdot \widehat{H}_{\text{bulk, h}}(t, x, Liq)`"
"Conduction heat flux across membrane", ":math:`q_{\text{cond}}(t, x) = \frac{k_{\text{m}}}{\sigma} \left( T_{\text{interface}, h}(t, x) - T_{\text{interface}, c}(t, x) \right)`"
"Average conduction heat across membrane", ":math:`q_{\text{cond, avg}}(t) = \frac{1}{N} \sum_{x} q_{\text{cond}}(t, x)`"
"Total permeate production", ":math:`M_p = A \cdot J_{\text{avg}}`"
"Total conduction heat transfer", ":math:`q_{\text{cond,total}} = - A \cdot q_{\text{cond,avg}}`"
"Hot channel total evapration heat", ":math:`q_{\text{evap,total}} = - A \cdot \overline{\widehat{H}_h}`"
"Cold channel total condensation heat", ":math:`q_{\text{conden,total}} = A \cdot \overline{\widehat{H}_c}`"
"Mass transfer balance between hot and cold channel", ":math:`\dot{m}_{\text{cold}}(t, x, p, j) = -\dot{m}_{\text{hot}}(t, x, p, j)`"
"Conductive heat transfer to cold channel", ":math:`q_{\text{cond, hot}}(t, x) = -q_{\text{cond, cold}}(t, x)`"

if ``MD_configuration_type`` is set to ``MDconfigurationType.VMD``:

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

"Vapor flux across membrane", ":math:`J(t, x) = \frac{B_0(t)}{\sigma} \times \left( P_{\text{sat, hot}}(t, x) - P_{\text{vaccuum, cold}}(t, x) \right)`"
"Hot channel convective heat transfer", ":math:`h_{\text{conv}, h}(t, x) \left( T_{\text{bulk}, h}(t, x) - T_{\text{interface}, h}(t, x) \right) = q_{\text{exp}}(t, x) + q_{\text{evap}}(t, x) - J(t, x) \cdot \widehat{H}_{\text{bulk, h}}(t, x, Liq)`"
"Vapor expansion heat flux", ":math:`q_{\text{exp}}(t, x) = \frac{R \cdot T}{M} \ln\left( \frac{P_f}{P_p} \right) \cdot J(t, x)`"
"Mass transfer from vapor phase to vacuum channel", ":math:`\dot{m}_{\text{cold}}(t, x, Vap, j) = -\dot{m}_{\text{hot}}(t, x, Liq, j)`"
"Conductive heat transfer to cold channel", ":math:`q_{\text{cond, hot}}(t, x) = -q_{\text{exp}}(t, x)`"
"Cold channel inlet temperature", ":math:`T_{\text{cold, in}}(t) = T_{\text{hot, in}}(t)`"

if ``MD_configuration_type`` is set to ``MDconfigurationType.GMD``:

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

"Vapor flux across membrane", ":math:`J(t, x) = \frac{B_0(t)}{\sigma} \times \left( P_{\text{sat, hot}}(t, x) - P_{\text{sat, gap}}(t, x) \right)`"
"Cold channel convective heat transfer", ":math:`h_{\text{conv}, c}(t, x) \left( T_{\text{interface}, c}(t, x) - T_{\text{bulk}, c}(t, x) \right) = q_{\text{gap}}(t, x)`"
"Hot channel convective heat transfer", ":math:`h_{\text{conv}, h}(t, x) \left( T_{\text{bulk}, h}(t, x) - T_{\text{interface}, h}(t, x) \right) = q_{\text{cond}}(t, x) + q_{\text{evap}}(t, x) - J(t, x) \cdot \widehat{H}_{\text{bulk, h}}(t, x, Liq)`"
"Conduction heat flux across membrane", ":math:`q_{\text{cond}}(t, x) = \frac{k_{\text{m}}}{\sigma} \left( T_{\text{interface}, h}(t, x) - T_{\text{interface}, gap}(t, x) \right)`"
"Conduction heat flux across gap", ":math:`q_{\text{gap}}(t, x) = \frac{k_{\text{m}}}{\sigma} \left( T_{\text{interface}, gap}(t, x) - T_{\text{interface}, c}(t, x) \right)`"
"Mass transfer balance between hot and gap channel", ":math:`\dot{m}_{\text{gap}}(t, x, Liq, H2O) = -\dot{m}_{\text{hot}}(t, x, Liq, H2O)`"
"Conductive heat transfer between channels", ":math:`q_{\text{cold}}(t, x) = -q_{\text{hot}}(t, x) - ΔH_{\text{hot}}(t, x) - ΔH_{\text{gap}}(t, x)`"

Common in all configurations:

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

"Average flux across membrane", ":math:`J_{avg, j} = \frac{1}{2}\sum_{x} J_{x, j}`"
"Hot channel membrane-interface solute concentration", ":math:`C_{\text{interface, j, h}}(t, x) = C_{\text{bulk, j, h}}(t, x) \times \exp\left( \frac{J(t, x)}{\rho_{\text{solvent}} \times k_h(t, x, j)} \right)`"
"Evaporation heat flux from hot channel", ":math:`q_{\text{evap}}(t, x) = J(t, x) \times \widehat{H}_{\text{h}}(t, x, Vap)`"
"Average evaporation flux from hot channel", ":math:`\overline{q}_{\text{evap}}(t) = \frac{1}{2} \sum_{x} q_{\text{evap}}(t, x)`"
"Convective heat transfer coefficient", ":math:`h_{\text{conv},(t, x)} = \frac{\kappa_{(t, x)} \cdot \text{Nu}_{(t, x)}}{d_h}`"
"Nusselt number", ":math:`Nu[t, x] == 0.162 * (Re[t, x] ** 0.656) * (Pr[t, x] ** 0.333)`"
"Prandtl number", ":math:`Pr(t, x) = \frac{\mu(t, x) \cdot C_p(t, x)}{\kappa}`"
"Effectiveness", ":math:`\epsilon(t) = \frac{T_{\text{cold, first}}(t) - T_{\text{c, last}}(t)}{T_{\text{h, first}}(t) - T_{\text{c, last}}(t)}`"
"Thermal efficiency", ":math:`\eta(t) = \frac{q_{\text{evap,total}}(t)}{q_{\text{evap,total}}(t) + q_{\text{cond,total}}(t)}`"
"Concentration polarization modulus",":math:`CP_{mod} = C_{interface}/C_{bulk}`"
Expand All @@ -224,4 +279,4 @@ Class Documentation
* :mod:`watertap.unit_models.MD.membrane_distillation_0D`
* :mod:`watertap.unit_models.MD.membrane_distillation_base`
* :mod:`watertap.unit_models.MD.MD_channel_0D`
* :mod:`watertap.unit_models.MD.MD_channel_base`
* :mod:`watertap.unit_models.MD.MD_channel_base`
88 changes: 88 additions & 0 deletions docs/technical_reference/unit_models/membrane_distillation_1D.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
Membrane Distillation (1D)
=========================================

This Membrane Distillation (MD) unit model:
* supports the following configurations:

- **DCMD** (Direct Contact Membrane Distillation)
- **VMD** (Vacuum Membrane Distillation)
- **GMD** (Permeate Gap/Conductive Gap Membrane Distillation)

* is 1-dimensional
* supports steady-state only
* assumes heat loss in equipment is negligible
* assumes permeate exits the membrane pores with zero salinity
* assumes no concentration polarization for the cold channel
* assumes complete vapor condensation for the cold channel (in DCMD and GMD)
* accounts for vapor expansion in VMD
* assumes linear temperature change across gap channel (in GMD)
* assumes no pressure change and temperature polarization in VMD vaccuum channel


Degrees of Freedom
------------------
In addition to the hot channel and cold channel inlet state variables (i.e, temperature, pressure, and component flowrates) for the **DCMD** and **GMD** configurations, the MD model has at least **4 degrees of freedom** for all configurations that should be fixed for the unit to be fully specified. Typically, the following variables are fixed:

- Membrane permeability coefficient
- Membrane thickness
- Membrane thermal conductivity
- Recovery *or* membrane area

**Additional degress of freedom**:

- **VMD** introduces vacuum pressure at the cold side.
- **GMD** introduces gap thermal conductivity and gap thickness.

Configuring the MD unit to calculate temperature polarization, concentration polarization, mass transfer
coefficient, and pressure drop would result in five additional degrees of freedom. In this case, in addition to the
previously fixed variables, we typically fix the following variables to fully specify the unit:

* Hot channel spacer porosity
* Hot channel height
* Cold channel spacer porosity (in DCMD and GMD)
* Cold channel height (in DCMD and GMD)
* Membrane length *or* membrane width

Model Structure
---------------
The MD model consists of a separate `MDchannel1Dblock` for each channel depending on the configuration:

- **DCMD**: Includes **hot channel** and **cold channel**.
- **VMD**: Includes **hot channel** and **vacuum (cold) channel**.
- **GMD**: Includes **hot channel**, **gap channel**, and **cold channel**.

- **hot and cold channels in all configurations** includes bulk properties StateBlocks indexed by time and space which are used for mass, energy, and momentum balances
- **hot channel in all configurations, cold channel in DCMD and GMD, and gap channel in GMD** includes StateBlocks indexed by time and space for the conditions at the membrane interface and gap interface
- **hot channel in all configurations, cold channel in DCMD, and gap channel in GMD** includes StateBlocks indexed by time and space for Vapor properties at the membrane interface (for **DCMD** and **VMD** configurations).

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

"Time", ":math:`t`", "[0]"
"Space", ":math:`x`", "None"
"Phases", ":math:`p`", "['Liq', 'Vap']"
"Components", ":math:`j`", "['H2O', solute]*"

\*Solute depends on the imported property model.

Variables
----------

Refer to the :any:`0MD_variables` section in the 0D MD model.

.. _1MD_equations:

Equations
-----------

Refer to the :any:`0MD_equations` section in the 0D MD model.

Class Documentation
-------------------

* :mod:`watertap.unit_models.MD.membrane_distillation_1D`
* :mod:`watertap.unit_models.MD.membrane_distillation_base`
* :mod:`watertap.unit_models.MD.MD_channel_1D`
* :mod:`watertap.unit_models.MD.MD_channel_base`
Loading

0 comments on commit 9eb240e

Please sign in to comment.