Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add validity ranges and clean up water_prop_pack, seawater_prop_pack, and NaCl_T_dep_prop_pack #1304

Merged
merged 23 commits into from
Mar 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
a668e34
updating comment format to add validity ranges seawater
savannahsakhai Jul 17, 2023
176b667
updating comment format to add validity ranges pure water
savannahsakhai Jul 17, 2023
913eab2
reformat references and make location for valid ranges coag
savannahsakhai Jul 17, 2023
939c2a3
Merge branch 'main' into prop_doc
savannahsakhai Jul 20, 2023
5990510
Merge branch 'main' into prop_doc
savannahsakhai Sep 11, 2023
7c3c82a
Merge branch 'main' into prop_doc
savannahsakhai Jan 25, 2024
1442183
add validity ranges to seawater prop pack
savannahsakhai Jan 25, 2024
f13dcb2
add validity ranges to the water prop pack
savannahsakhai Jan 25, 2024
a61cc00
update ref list for nacl w/ t_dep
savannahsakhai Jan 25, 2024
dac3d34
update nacl w/ t_dep documentation reference list
savannahsakhai Jan 25, 2024
503c4d5
restore
savannahsakhai Jan 25, 2024
4650cfc
Merge branch 'watertap-org:main' into prop_doc
savannahsakhai Jan 25, 2024
828adea
Merge branch 'main' into prop_doc
savannahsakhai Feb 19, 2024
39a9a50
Merge branch 'prop_doc' of https://github.com/savannahsakhai/watertap…
savannahsakhai Feb 19, 2024
3bc48f6
Update watertap/property_models/seawater_prop_pack.py
savannahsakhai Feb 28, 2024
31ad3df
Merge branch 'main' into prop_doc
savannahsakhai Feb 28, 2024
40822da
Update docs/technical_reference/property_models/NaCl_T_dep.rst
savannahsakhai Mar 4, 2024
8942fb3
Merge branch 'main' into prop_doc
hunterbarber Mar 4, 2024
f9ecaaf
Merge branch 'main' into prop_doc
savannahsakhai Mar 5, 2024
0413147
Merge branch 'prop_doc' of https://github.com/savannahsakhai/watertap…
savannahsakhai Mar 5, 2024
2f62c83
Merge branch 'main' into prop_doc
savannahsakhai Mar 18, 2024
1945559
Merge branch 'main' into prop_doc
savannahsakhai Mar 22, 2024
b8500e3
Merge branch 'main' into prop_doc
lbianchi-lbl Mar 22, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions docs/technical_reference/property_models/NaCl_T_dep.rst
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,6 @@ References

Pitzer, Kenneth S., J. Christopher Peiper, and R. H. Busey. (1984). Thermodynamic Properties of Aqueous Sodium Chloride Solutions, Journal of Physical and Chemical Reference Data 13, no. 1 , 1–102. `DOI: 10.1063/1.555709 <https://doi.org/10.1063/1.555709>`_

.. _Sharqawy:

Mostafa H. Sharqawy, John H. Lienhard V & Syed M. Zubair. (2010). Thermophysical properties of seawater: a review of existing correlations and data, Desalination and Water Treatment, 16:1-3, 354-380, `DOI: 10.5004/dwt.2010.1079 <https://doi.org/10.5004/dwt.2010.1079>`_

.. _Sparrow:

Sparrow, Benjamin S. (2003). Empirical Equations for the Thermodynamic Properties of Aqueous Sodium Chloride, Desalination 159, no. 2, 161–70. `DOI: 10.1016/S0011-9164(03)90068-3 <https://doi.org/10.1016/S0011-9164(03)90068-3>`_
Expand Down
10 changes: 10 additions & 0 deletions watertap/property_models/NaCl_T_dep_prop_pack.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,16 @@ def build(self):
# phases
self.Liq = LiquidPhase()

""" References
This package was developed from the following references:
- Pitzer, Kenneth S., J. Christopher Peiper, and R. H. Busey. (1984).
Thermodynamic Properties of Aqueous Sodium Chloride Solutions, Journal of Physical and Chemical Reference Data 13,
no. 1 , 1–102. DOI: 10.1063/1.555709
- Sparrow, Benjamin S. (2003). Empirical Equations for the Thermodynamic Properties of Aqueous Sodium Chloride,
Desalination 159, no. 2, 161–70. DOI: 10.1016/S0011-9164(03)90068-3
- Zaytsev Ivan Dmitrievich & Aseev G. G. (1992). Properties of aqueous solutions of electrolytes, CRC Press.
"""

# molecular weight
mw_comp_data = {"H2O": 18.01528e-3, "NaCl": 58.44e-3}
self.mw_comp = Param(
Expand Down
121 changes: 55 additions & 66 deletions watertap/property_models/seawater_prop_pack.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,8 @@ def build(self):
mw_comp_data = {
"H2O": 18.01528e-3,
"TDS": 31.4038218e-3,
} # average atomic weight of sea salt, based on
}
# molecular weight of TDS is taken as the average atomic weight of sea salt, based on
# "Reference-Composition Salinity Scale" in Millero et al. (2008) and cited by Sharqawy et al. (2010)

self.mw_comp = Param(
Expand All @@ -117,7 +118,8 @@ def build(self):
doc="Molecular weight",
)

# mass density parameters, eq. 8 in Sharqawy et al. (2010)
# mass density parameters, 0-180 C, 0-150 g/kg, 0-12 MPa
# eq. 8 in Sharqawy et al. (2010)
dens_units = pyunits.kg / pyunits.m**3
t_inv_units = pyunits.K**-1
s_inv_units = pyunits.kg / pyunits.g
Expand Down Expand Up @@ -184,7 +186,8 @@ def build(self):
)

visc_d_units = pyunits.Pa * pyunits.s
# dynamic viscosity parameters, eq. 22 and 23 in Sharqawy
# dynamic viscosity parameters, 0-180 C, 0-150 g/kg
# eq. 22 and 23 in Sharqawy et al. (2010)
self.visc_d_param_muw_A = Var(
within=Reals,
initialize=4.2844e-5,
Expand Down Expand Up @@ -246,7 +249,8 @@ def build(self):
doc="Dynamic viscosity parameter 3 for term B",
)

# diffusivity parameters, eq 6 in Bartholomew
# diffusivity parameters, 25 C
savannahsakhai marked this conversation as resolved.
Show resolved Hide resolved
# eq. 6 in Bartholomew & Mauter (2019)
diffus_param_dict = {
"0": 1.51e-9,
"1": -2.00e-9,
Expand All @@ -259,10 +263,11 @@ def build(self):
domain=Reals,
initialize=diffus_param_dict,
units=pyunits.m**2 / pyunits.s,
doc="Dynamic viscosity parameters",
doc="Diffusivity parameters",
)

# osmotic coefficient parameters, eq. 49 in Sharqawy
# osmotic coefficient parameters, 0-200 C, 0-120 g/kg
# eq. 49 in Sharqawy et al. (2010)
self.osm_coeff_param_1 = Var(
within=Reals,
initialize=8.9453e-1,
Expand Down Expand Up @@ -324,7 +329,8 @@ def build(self):
doc="Osmotic coefficient parameter 10",
)

# specific enthalpy parameters, Table 9 in Nayar et al. (2016)
# specific enthalpy parameters, 10-120 C, 0-120 g/kg, 0-12 MPa
# Table 9 in Nayar et al. (2016)
enth_mass_units = pyunits.J / pyunits.kg
P_inv_units = pyunits.MPa**-1

Expand Down Expand Up @@ -461,7 +467,8 @@ def build(self):
doc="Specific enthalpy parameter C4",
)

# vapor pressure parameters, eq. 5 and 6 in Nayar et al.(2016)
# vapor pressure parameters, 0-180 C, 0-160 g/kg
# eq. 5 and 6 in Nayar et al.(2016)
self.pressure_sat_param_psatw_A1 = Var(
within=Reals,
initialize=-5.8002206e3,
Expand Down Expand Up @@ -511,7 +518,8 @@ def build(self):
doc="Vapor pressure of seawater parameter B2",
)

# specific heat parameters from eq (9) in Sharqawy et al. (2010)
# specific heat parameters, 0-180 C, 0-180 g/kg, 0-12 MPa
# eq. 9 in Sharqawy et al. (2010)
cp_units = pyunits.J / (pyunits.kg * pyunits.K)
self.cp_phase_param_A1 = Var(
within=Reals,
Expand Down Expand Up @@ -586,8 +594,8 @@ def build(self):
doc="Specific heat of seawater parameter D3",
)

# thermal conductivity parameters from eq. 13 in Sharqawy et al. (2010)

# thermal conductivity parameters, 0-180 C, 0-160 g/kg
# eq. 13 in Sharqawy et al. (2010)
self.therm_cond_phase_param_1 = Var(
within=Reals,
initialize=240,
Expand Down Expand Up @@ -637,7 +645,8 @@ def build(self):
doc="Thermal conductivity of seawater parameter 8",
)

# latent heat of pure water parameters from eq. 54 in Sharqawy et al. (2010)
# latent heat of pure water parameters, 0-200 C
# eq. 54 in Sharqawy et al. (2010)
self.dh_vap_w_param_0 = Var(
within=Reals,
initialize=2.501e6,
Expand Down Expand Up @@ -669,7 +678,8 @@ def build(self):
doc="Latent heat of pure water parameter 4",
)

# Boiling point elevation parameters from eq. 36 in Sharqawy et al. (2010)
# Boiling point elevation parameters, 0-200 C, 0-120 g/kg
# eq. 36 in Sharqawy et al. (2010)
self.bpe_A0 = Var(
within=Reals,
initialize=17.95,
Expand Down Expand Up @@ -764,8 +774,6 @@ def define_metadata(cls, obj):
}
)

# TODO: add diffusivity variable and constraint since it is needed when calculating mass transfer coefficient in
# current implementation of 0D RO model
obj.add_default_units(
{
"time": pyunits.s,
Expand Down Expand Up @@ -1084,8 +1092,8 @@ def _dens_mass_phase(self):
units=pyunits.kg * pyunits.m**-3,
doc="Mass density of seawater",
)

def rule_dens_mass_phase(b, p): # density, eq. 8 in Sharqawy
# Sharqawy et al. (2010), eq. 8, 0-180 C, 0-150 g/kg, 0-12 MPa
def rule_dens_mass_phase(b, p):
t = b.temperature - 273.15 * pyunits.K
s = b.mass_frac_phase_comp[p, "TDS"]
dens_mass = (
Expand All @@ -1109,8 +1117,8 @@ def _dens_mass_solvent(self):
units=pyunits.kg * pyunits.m**-3,
doc="Mass density of pure water",
)

def rule_dens_mass_solvent(b): # density, eq. 8 in Sharqawy
# Sharqawy et al. (2010), eq. 8, 0-180 C
def rule_dens_mass_solvent(b):
t = b.temperature - 273.15 * pyunits.K
dens_mass_w = (
b.params.dens_mass_param_A1
Expand Down Expand Up @@ -1244,11 +1252,10 @@ def _visc_d_phase(self):
units=pyunits.Pa * pyunits.s,
doc="Viscosity",
)

def rule_visc_d_phase(b, p): # dynamic viscosity, eq. 22 and 23 in Sharqawy
t = (
b.temperature - 273.15 * pyunits.K
) # temperature in degC, but pyunits are K
# Sharqawy et al. (2010), eq. 22 and 23, 0-180 C, 0-150 g/kg
def rule_visc_d_phase(b, p):
# temperature in degC, but pyunits are K
t = b.temperature - 273.15 * pyunits.K
s = b.mass_frac_phase_comp[p, "TDS"]
mu_w = (
b.params.visc_d_param_muw_A
Expand All @@ -1274,9 +1281,8 @@ def rule_visc_d_phase(b, p): # dynamic viscosity, eq. 22 and 23 in Sharqawy
self.params.phase_list, rule=rule_visc_d_phase
)

def _diffus_phase_comp(
self,
): # TODO: diffusivity from NaCl prop model used temporarily--reconsider this
# TODO: diffusivity from NaCl prop model used temporarily--reconsider this
def _diffus_phase_comp(self):
self.diffus_phase_comp = Var(
self.params.phase_list,
["TDS"],
Expand All @@ -1285,10 +1291,8 @@ def _diffus_phase_comp(
units=pyunits.m**2 * pyunits.s**-1,
doc="Diffusivity",
)

def rule_diffus_phase_comp(
b, p, j
): # diffusivity, eq 6 in Bartholomew, substituting NaCl w/ TDS
# Bartholomew & Mauter (2019), eq. 6 (substituting NaCl w/ TDS), 25 C
def rule_diffus_phase_comp(b, p, j):
return b.diffus_phase_comp[p, j] == (
b.params.diffus_param["4"] * b.mass_frac_phase_comp[p, j] ** 4
+ b.params.diffus_param["3"] * b.mass_frac_phase_comp[p, j] ** 3
Expand All @@ -1308,12 +1312,11 @@ def _osm_coeff(self):
units=pyunits.dimensionless,
doc="Osmotic coefficient",
)

def rule_osm_coeff(b): # osmotic coefficient, eq. 49 in Sharqawy
# Sharqawy et al. (2010), eq. 49, 0-200 C, 0-120 g/kg
def rule_osm_coeff(b):
s = b.mass_frac_phase_comp["Liq", "TDS"]
t = (
b.temperature - 273.15 * pyunits.K
) # temperature in degC, but pyunits are still K
# temperature in degC, but pyunits are still K
t = b.temperature - 273.15 * pyunits.K
osm_coeff = (
b.params.osm_coeff_param_1
+ b.params.osm_coeff_param_2 * t
Expand All @@ -1338,10 +1341,8 @@ def _pressure_osm_phase(self):
units=pyunits.Pa,
doc="Osmotic pressure",
)

def rule_pressure_osm_phase(
b, p
): # osmotic pressure, based on eq. 48 in Nayar et al. (2016)
# Nayar et al. (2016), eq. 48, 0-200 C, 0-120 g/kg
def rule_pressure_osm_phase(b, p):
i = 2 # number of ionic species
rhow = b.dens_mass_solvent
return (
Expand All @@ -1365,13 +1366,10 @@ def _enth_mass_phase(self):
units=pyunits.J * pyunits.kg**-1,
doc="Specific enthalpy",
)

def rule_enth_mass_phase(
b, p
): # specific enthalpy, eq. 25 and 26 in Nayar et al. (2016)
t = (
b.temperature - 273.15 * pyunits.K
) # temperature in degC, but pyunits in K
# Nayar et al. (2016), eq. 25 and 26, 10-120 C, 0-120 g/kg, 0-12 MPa
def rule_enth_mass_phase(b, p):
# temperature in degC, but pyunits in K
t = b.temperature - 273.15 * pyunits.K
S_kg_kg = b.mass_frac_phase_comp[p, "TDS"]
S_g_kg = S_kg_kg * 1000
P = b.pressure - 101325 * pyunits.Pa
Expand Down Expand Up @@ -1429,10 +1427,8 @@ def _pressure_sat(self):
self.pressure_sat = Var(
initialize=1e3, bounds=(1, 1e8), units=pyunits.Pa, doc="Vapor pressure"
)

def rule_pressure_sat(
b,
): # vapor pressure, eq. 5 and 6 in Nayar et al.(2016)
# Nayar et al.(2016), eq. 5 and 6, 0-180 C, 0-160 g/kg
def rule_pressure_sat(b):
t = b.temperature
s = b.mass_frac_phase_comp["Liq", "TDS"] * 1000 * pyunits.g / pyunits.kg
psatw = (
Expand Down Expand Up @@ -1461,8 +1457,8 @@ def _cp_mass_phase(self):
units=pyunits.J / pyunits.kg / pyunits.K,
doc="Specific heat capacity",
)

def rule_cp_mass_phase(b, p): # specific heat, eq. 9 in Sharqawy et al. (2010)
# Sharqawy et al. (2010), eq. 9, 0-180 C, 0-180 g/kg, 0-12 MPa
def rule_cp_mass_phase(b, p):
# Convert T90 to T68, eq. 4 in Sharqawy et al. (2010); primary reference from Rusby (1991)
t = (b.temperature - 0.00025 * 273.15 * pyunits.K) / (1 - 0.00025)
s = b.mass_frac_phase_comp[p, "TDS"] * 1000 * pyunits.g / pyunits.kg
Expand Down Expand Up @@ -1500,10 +1496,8 @@ def _therm_cond_phase(self):
units=pyunits.W / pyunits.m / pyunits.K,
doc="Thermal conductivity",
)

def rule_therm_cond_phase(
b, p
): # thermal conductivity, eq. 13 in Sharqawy et al. (2010)
# Sharqawy et al. (2010), eq. 13, 0-180 C, 0-160 g/kg
savannahsakhai marked this conversation as resolved.
Show resolved Hide resolved
def rule_therm_cond_phase(b, p):
# Convert T90 to T68, eq. 4 in Sharqawy et al. (2010); primary reference from Rusby (1991)
t = (b.temperature - 0.00025 * 273.15 * pyunits.K) / (1 - 0.00025)
s = b.mass_frac_phase_comp[p, "TDS"] * 1000 * pyunits.g / pyunits.kg
Expand Down Expand Up @@ -1543,10 +1537,8 @@ def _dh_vap_mass(self):
units=pyunits.J / pyunits.kg,
doc="Latent heat of vaporization",
)

def rule_dh_vap_mass(
b,
): # latent heat of seawater from eq. 37 and eq. 55 in Sharqawy et al. (2010)
# Sharqawy et al. (2010), eq. 37 and 54, 0-200 C, 0-240 g/kg
def rule_dh_vap_mass(b):
t = b.temperature - 273.15 * pyunits.K
s = b.mass_frac_phase_comp["Liq", "TDS"]
dh_vap_mass_w = (
Expand All @@ -1568,11 +1560,8 @@ def _boiling_point_elevation_phase(self):
units=pyunits.K,
doc="Boiling point elevation",
)

def rule_boiling_point_elevation_phase(
b, p
): # boiling point elevation of seawater from eq. 36 in Sharqawy et al. (2010)

# Sharqawy et al. (2010), eq. 36, 0-200 C, 0-120 g/kg
def rule_boiling_point_elevation_phase(b, p):
t = b.temperature - 273.15 * pyunits.K
s = b.mass_frac_phase_comp["Liq", "TDS"]
A = b.params.bpe_A0 + b.params.bpe_A1 * t + b.params.bpe_A2 * t**2
Expand Down
Loading
Loading