-
Notifications
You must be signed in to change notification settings - Fork 2
/
main.py
47 lines (38 loc) · 1.35 KB
/
main.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
# Basic library
import numpy as np
# Thermodynamical properties functions
from thermo_props import *
# Diameter calculator
from diameter import *
# Initial data (inform here)
P_evap = 3 #bar
P_cond = 13 #bar
m_dot = 0.00282 #kg/s
d = np.array([0.036, 0.047, 0.055, 0.063]) #in
fluid = 'R600a' #please specify in this format
# Unit conversion/extra calculations
d = d*0.0254 #m
Area = np.pi*(d**2)/4 #m²
Q = m_dot/Area #m³/s
# Function Temp calculates the temperature, given the pressure
T_evap = Temp(P_evap,fluid)
T_cond = Temp(P_cond,fluid)
# Vector T: divide the temperature in small parts, correspondig to sections of the tube
T = np.linspace(T_cond, T_evap,int((T_cond - T_evap)))
# calculate the pressure for each temperature
P = Press(T,fluid)
# thermodynamical properties
v_l, v_v, h_l, h_v, mu_l, mu_v = Props(T,P,fluid)
# empty vectors
n = np.size(P)
V, h, A, B, C, x, v, mu, Vm, f, delta_L, L = np.zeros([12,1,n])
# Calling the function
# Recursive procedure for the evaluation of each diameter
for j in range(np.size(d)):
L_final = diameter(v_l, v_v, h_l, h_v, Q, d, Area, m_dot, P, mu_l, mu_v, n, V, h, A, B, C, x, v, mu, Vm, f, delta_L, L, j)
if L_final != 0:
print('Tube length: %.3f m' %(L_final))
print('Capillary tube diameter: %.3f in' %(d[j]/0.0254))
break
if L_final == 0:
print('Sorry, not found.')