-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRheology.py
204 lines (147 loc) · 6.82 KB
/
Rheology.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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import math
class Rheology:
'''
For rheology calculation
'''
def __init__(self, _coef = 0.48):
'''
__coef - conversion factor
__coef - коэфициент перевода единиц
'''
self.__coef = _coef
self._dict = {}
''' Type of models:
0 - Bingham Plastic Model (bh)—This model describes fluids in which
the shear stress shear rate ratio is linear
once a specific shear stress has been exceeded.
1 - Power Law (pl) —The Power Law is used to describe the flow of
shear thinning or pseudoplastic drilling fluids.
2 - Herschel-Bulkley Model (hb) —Also called the “modified” power law and
yield-pseudoplastic model, the Herschel-Bulkley model is used to describe
the flow of pseudoplastic drilling fluids which require a yield stress
to initiate flow. Defoult model
'''
def hbModel(self, data):
'''Herschel-Bulkley Model'''
try:
plastic_viscosity = data['600'] - data['300']
self._dict['plastic_viscosity'] = plastic_viscosity
yield_point = (data['300'] - plastic_viscosity) * self.__coef
self._dict['yield_point'] = yield_point
yield_stress = 2 * data['3'] - data['6']
self._dict['yield_stress'] = yield_stress
flow_index = 3.32 * \
math.log10((data['600'] - yield_stress) /
(data['300'] - yield_stress))
self._dict['flow_index'] = flow_index
consistency_index = (
data['300'] - yield_stress) / math.pow(511, flow_index)
self._dict['consistency_index'] = consistency_index
return self._dict
except Exception as e:
print(f'\nОшибка: {e}\n')
return self._dict
def powerLowModel(self, data):
'''Power Low Model'''
self._dict = {}
try:
plastic_viscosity = data['600'] - data['300']
self._dict['PV'] = plastic_viscosity
yield_point = (data['300'] - plastic_viscosity) * self.__coef
self._dict['YP'] = yield_point
yield_stress = 2 * data['3'] - data['6']
self._dict['ys'] = yield_stress
'''For Pipe flow'''
pipe_flow_index = 3.32 * \
math.log10(data['600'] / data['300'])
self._dict['pfi'] = pipe_flow_index
pipe_flow_consistency_index = (
data['300']) / math.pow(511, pipe_flow_index)
self._dict['pfci'] = pipe_flow_consistency_index
'''For Annular flow '''
annular_flow_index = 3.32 * \
math.log10((data['600'] - yield_stress) /
(data['300'] - yield_stress))
self._dict['afi'] = annular_flow_index
annular_flow_consistency_index = (
data['300'] - yield_stress) / math.pow(511, annular_flow_index)
self._dict['afci'] = annular_flow_consistency_index
return self._dict
except Exception as e:
print(f'\nОшибка: {e}\n')
return self._dict
def binghamModel(self, data):
'''Bingham Model'''
self._dict = {}
try:
plastic_viscosity = data['600'] - data['300']
self._dict['PV'] = plastic_viscosity
yield_point = (data['300'] - plastic_viscosity) * self.__coef
self._dict['YP'] = yield_point
yield_stress = 2 * data['3'] - data['6']
self._dict['ys'] = yield_stress
'''For Pipe flow'''
pipe_flow_index = 3.32 * \
math.log10(data['600'] / data['300'])
self._dict['pfi'] = pipe_flow_index
pipe_flow_consistency_index = (
data['300']) / math.pow(511, pipe_flow_index)
self._dict['pfci'] = pipe_flow_consistency_index
'''For Annular flow '''
annular_flow_index = 3.32 * \
math.log10((data['600'] - yield_stress) /
(data['300'] - yield_stress))
self._dict['afi'] = annular_flow_index
annular_flow_consistency_index = \
(data['300'] - yield_stress) / math.pow(511, annular_flow_index)
self._dict['afci'] = annular_flow_consistency_index
return self._dict
except Exception as e:
print(f'\nОшибка: {e}\n')
return self._dict
pass
def sns_1(self, data):
''' For SNS calculation'''
_sns = {}
sns_10s = data['sns_10s'] * self.__coef
_sns['sns_10s'] = sns_10s
sns_10m = data['sns_10m'] * self.__coef
_sns['sns_10m'] = sns_10m
return _sns
def hydro(self, data):
try:
'''Проводим расчёт для трубного пространства'''
'''Расчитываем срднюю скорость
Fluid velocity Pipe/ Скорость потока в трубном пространстве'''
velocity_pipe = 24.21 * data['Q'] / math.pow(data['di'], 2)
self._dict['Vp'] = velocity_pipe
'''Hydraulic diameter Pipe'''
Dhydp = data['di']
self._dict['Dhydp'] = Dhydp
'''Shear rate pipe / расчитываем скорость сдвига у стенок трубы, с-1'''
yp = ( (3 * self._dict['pipe_flow_index'] + 1) / (4 * self._dict['pipe_flow_index']) ) \
* (8 * velocity_pipe / data['dh'] )
self._dict['yp'] = yp
'''effective viscosity / Определяем эффективную вязкость'''
mea = (self._dict['pfci'] * math.pow(yp, self._dict['pipe_flow_index'])) / yp
self._dict['mea'] = mea
'''Определяем режим течения'''
Re = (data['dh'] * velocity_pipe * data['g']) / mea
self._dict['Re'] = Re
'''Вычисляем градиент давления'''
pressure_gradient = 2 * (16 / Re) * math.pow(velocity_pipe, 2) * data['g'] / data['dh']
self._dict['p/L'] = pressure_gradient
'''Проводим расчёт для кольцевого пространства'''
'''Fluid velocity Annulus/ Скорость потока в кольцвом пространстве'''
velocity_annulus = 24.21 * \
data['Q'] / (math.pow(data['dh'], 2) - math.pow(data['dp'], 2))
self._dict['Va'] = velocity_annulus
'''Hydraulic diameter Annulus '''
Dhyda = data['dh'] - data['dp']
self._dict['Dhyda'] = Dhyda
return self._dict
except Exception as e:
print(f'\nОшибка: {e}\n')
return self._dict