Skip to content

Commit

Permalink
Add dynamic viscosity parameter to REDstack model and update calcul…
Browse files Browse the repository at this point in the history
…ations
  • Loading branch information
tristantc committed Dec 18, 2024
1 parent 92439d5 commit ef77253
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions gdplib/reverse_electrodialysis/REDstack.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ def build_REDstack():
) # Mehdizadeh, et al. (2019) Membranes, 9(6), 73. https://doi.org/10.3390/membranes9060073
# Linear temperature dependence of the solution conductivity. The temperature coefficient of the solution conductivity is 0.02 K-1.

m.dynamic_viscosity = pyo.Param(
doc='Dynamic viscosity of the solution [Pa s]', default=1e-3, initialize=1e-3
)

m.pump_eff = pyo.Param(doc='Pump efficiency [-]', default=0.75, initialize=0.75)

# =============================================================================
Expand Down Expand Up @@ -518,7 +522,7 @@ def _pressure_x(m, x, sol):
"""
delta_p = pyo.value(
48
* ureg.convert(1, 'cP', 'Pa*s')
* m.dynamic_viscosity
* ureg.convert(m.vel_init[sol], 'cm', 'm')
/ m.dh[sol] ** 2
* m.L
Expand Down Expand Up @@ -548,7 +552,7 @@ def _pressure_x_b(m, x, sol):
"""
delta_p = pyo.value(
48
* ureg.convert(1, 'cP', 'Pa*s')
* m.dynamic_viscosity
* ureg.convert(m.vel_ub[sol], 'cm', 'm')
/ m.dh[sol] ** 2
* m.L
Expand Down Expand Up @@ -587,7 +591,7 @@ def _pressure_x_b(m, x, sol):
bounds=lambda _, x, sol: (
ureg.convert(
-48
* ureg.convert(1, 'cP', 'Pa*s')
* m.dynamic_viscosity
* ureg.convert(m.vel_ub[sol], 'cm', 'm')
/ m.dh[sol] ** 2
* m.L,
Expand All @@ -601,7 +605,7 @@ def _pressure_x_b(m, x, sol):
if x == m.length_domain.first()
else ureg.convert(
-48
* ureg.convert(1, 'cP', 'Pa*s')
* m.dynamic_viscosity
* ureg.convert(m.vel_init[sol], 'cm', 'm')
/ m.dh[sol] ** 2
* m.L,
Expand Down Expand Up @@ -977,7 +981,9 @@ def _Rcpx(m, x):
m.PP = pyo.Var(
domain=pyo.NonNegativeReals,
initialize=sum(
ureg.convert(48e-7 * m.vel_init[sol] / m.dh[sol] ** 2, 'mbar', 'Pa')
48
* m.dynamic_viscosity
* ureg.convert(48e-7 * m.vel_init[sol] / m.dh[sol] ** 2, 'mbar', 'Pa')
* m.flow_vol['rm', sol]
/ 3.6e3
/ m.pump_eff
Expand All @@ -987,7 +993,7 @@ def _Rcpx(m, x):
None,
sum(
48
* ureg.convert(1, 'cP', 'Pa*s')
* m.dynamic_viscosity
* ureg.convert(m.vel_ub[sol], 'cm', 'm')
/ m.dh[sol] ** 2
* m.flow_vol['rm', sol].ub
Expand Down Expand Up @@ -1688,7 +1694,7 @@ def _deltaP(m, x, sol):
"""
return ureg.convert(
48
* ureg.convert(1, 'cP', 'Pa*s')
* m.dynamic_viscosity
* ureg.convert(m.vel[x, sol], 'cm', 'm')
/ m.dh[sol] ** 2,
'Pa',
Expand Down

0 comments on commit ef77253

Please sign in to comment.