-
Notifications
You must be signed in to change notification settings - Fork 1
/
viscosity.py
135 lines (112 loc) · 3.18 KB
/
viscosity.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
# -*- coding: utf-8 -*-
"""
Created on Jan 26 09:42:32 2022
@author: Ludovic Lepers
"""
import math
def estimate_viscosity(visc_init, T_init, T, fevap, fw, Cevap = 10,
Cemls1 = 2.5, Cemls2 = 0.65, Ctemp = 5000):
"""
Return the viscosity [Pa s]
source: (Lerh, 2002)
params
------
visc_init: initial viscosity [Pa s]
T_init: temperature of the measurment of visc_init [K]
T: temperature [K]
fevap: evaporated fraction (0-1)[]
fw: water fraction (0-1)[]
"""
return visc_init * math.exp(Cemls1*fw/(1-Cemls2*fw)+Cevap*fevap+Ctemp*(1/T-1/T_init))
def riazi_viscosity(A, B, I):
"""
Return the viscosity [Pa s]
source : (Riazi, 2001)
params
------
A : parameter [1/cp]
B : parameter [1/cp]
"""
return 1/(A + B /I) /1000
def riazi_A(Tbr, M, S, I20):
"""
Return the parameter A [1/cp]
source : (Riazi, 2001)
params
------
Tbr : Reduced boiling temperature []
M : molar mass [kg/mol]
S : specific gravity []
I20 : refractive parameter at 20°C []
"""
return (37.34745 - 0.20611 * M * 1000 + 141.1265 * S - 637.727 * I20
- 6.75 * Tbr + 6.98 * Tbr * Tbr - 0.81 * Tbr * Tbr * Tbr)
def riazi_B(Tbr, M, S, I20):
"""
Return the parameter B [1/cp]
source : (Riazi, 2001)
params
------
Tbr : Reduced boiling temperature []
M : molar mass [kg/mol]
S : specific gravity []
I20 : refractive parameter at 20°C []
"""
return (-15.5437 + 0.046603 * M * 1000 - 42.8873 * S + 211.6542 * I20
+ 1.676 * Tbr - 1.8 * Tbr * Tbr + 0.212 * Tbr * Tbr * Tbr)
def riazi_reduced_Teb(Teb):
"""
Return the reduced ebulition temperature []
source : (Riazi, 2001)
params
------
Teb : Boiling temperature [K]
"""
return (1.8 * Teb - 459.67) / 100
def riazi_I20(Teb, M, S):
"""
Return the refraction parameter at 20°C [1/cp]
source : (Riazi, 2001)
params
------
Teb : Boiling temperature [K]
M : molar mass [kg/mol]
S : specific gravity []
"""
M = M * 1000 #to g/mol
if M <= 300:
return (2.3435e-2 * math.exp(7.029e-4 * Teb + 2.468 * S - 10.273e-4 * Teb * S)
* math.pow(Teb, 0.0572) * math.pow(S, -0.72))
else:
return (1.8429e-2 * math.exp(11.635e-4 * Teb + 5.144 * S - 5.92e-4 * Teb * S)
* math.pow(Teb,-0.4077) * math.pow(S, -3.333))
def riazi_I(T, I20):
"""
Return the refraction parameter [] at the temperature T
source : (Riazi, 2001)
params
------
T : temperature [K]
I20 : refraction parameter [] at 20 °C
"""
n20 = math.sqrt((2*I20+1)/(1-I20))
n = n20 - 0.0004 *(T- 20 - 273.15)
return (n * n - 1)/(n * n + 2)
def viscosity(T, Teb, M, rho):
"""
Return the viscosity [Pa s]
source : (Riazi, 2001)
params
------
T : Temperature [K]
Teb : Boiling temperature [K]
M : molar mass [kg/mol]
rho : density [kg/m³]
"""
S = rho / 1000
I20 = riazi_I20(Teb, M, S)
I = riazi_I(T, I20)
Tbr = riazi_reduced_Teb(Teb)
A = riazi_A(Tbr, M, S, I20)
B = riazi_B(Tbr, M, S, I20)
return riazi_viscosity(A, B, I)