-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRynolds.py
More file actions
50 lines (40 loc) · 1.92 KB
/
Rynolds.py
File metadata and controls
50 lines (40 loc) · 1.92 KB
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
#book: incropera Appendix A.4
import json
with open("./Properties_table.json",encoding="UTF-8",mode="r") as file:
properties=json.load(file)
import pandas as pd
from interpolation import Interp
class RynoldNumber(object):
def __init__(self,Gas:str,pressure:float=1*10**5,temp:float=100):
"""
Gas is a string: air, o2, n2, h2, nh3, co2 and co
Temperature in kelvin
Pressure in Pascal N/m^2
"""
if pressure!=1*10**5:
pressure_considered=True
self.pd=pd.DataFrame(properties[Gas])
self.Value=0
#Calculate Prandtl number its an independent dimentionless of pressure so we will calculate it with respect to temperature
Prandtl=Interp(Xaxis=self.pd['temp'].to_list(),Yaxis=self.pd['Pr'].to_list())
self.Pr=Prandtl.newton_interpol([temp])[0]
# getting the viscosity by newton interpolation
Viscosity=Interp(Xaxis=self.pd['temp'].to_list(),Yaxis=self.pd['kyn_vis'].to_list())
self.Vis=Viscosity.newton_interpol([temp])[0]
if pressure_considered:
# getting the viscosity by newton interpolation
dynb_Viscosity=Interp(Xaxis=self.pd['temp'].to_list(),Yaxis=self.pd['vis'].to_list())
vis=dynb_Viscosity.newton_interpol([temp])[0]
density1=Interp(Xaxis=self.pd['temp'].to_list(),Yaxis=self.pd['Density'].to_list())
d1=density1.newton_interpol([temp])[0]
p1=1*10**5
p2=pressure
d2=(p2/p1)*d1 #PV=MRT
self.Vis=vis/d2
def Calculate(self,u_infinity:float,length)->list[float,float]:
"""
U infinity is the velocity of the fluid in m/s
length: if flat plate then its the actual length of the plate parallel to the streamline of the flow, if a pipe then it is the diameter
"""
self.Value = (u_infinity*length)/self.Vis
return [self.Value,self.Pr]