Вы находитесь на странице: 1из 2

from math import *

#INGRESO DE DATOS
L=2000. #LONGITUD DE LA TUBER\u00cdA (m)
Q=92/1000. #Caudal(m3/s)
g=9.801 #Gravedad
T=0. #Temperatura
vs=(1.14-0.031*(T-15)+0.00068*((T-15)**2))*1E-6 #Viscocidad (m2/seg)
ks=0.00152/1000. #Rugosidad (m)
k=(g*pi**2)/(8*L*Q**2)
Tol=1E-13
Imax=40
#Caluclo del coeficiente de friccin
def friccion(ks,D,Q,vs):
#Semillas
fa=0.01
err=0.1
cont=0
while err >= Tol:
f1=f
#calculo del Numero de Reynolds,
Re =(4*Q/(pi*D*vs))
#calculo del diametro
fa =((-2*log10(ks/(3.7*D)+2.51/(Re*sqrt(f1))))**-2)
err=abs(f1-fa)
cont+=1
if cont >= Imax:
break
return fa
#Clculo del diametro
def diametro(Q,ks,k,hf):
#Semillas
D=0.1
err=0.1
cont=0
while err>=Tol:
D1=D
#Reynols
Re=4*Q/(pi*D1*vs)
#Diametro
D=((-2*log10((ks/(3.7*D1))+(2.51/(Re*sqrt(k*hf*D1**5)))))**-0.4)/((k*hf)
**0.2)
err=abs(D-D1)
cont+=1
if cont >= Imax:
break
return D
#Clculo de clases de tuberias
presiones1=(50,75,100,150)
presiones2=(150,100,75,50)
def clases(L,Po,Pf,Co,Cf):
if Po<Pf:
S=(Pf-Po)/(L*1.)
xt=0.
sc=(Co-Cf)/(L*1.)
for i in presiones1:
if i<Pf and i>=Po:
x=(i-Po)/(S)

ct=Co-(x*sc)
x-=xt
xt+=x
print x,ct,i
falta=L-xt
print falta,Cf,Pf
elif Po>Pf:
S=(Po-Pf)/(L*1.)
xt=0.
sc=(Co-Cf)/(L*1.)
for i in presiones2:
if i>Pf and i<=Po:
x=(Po-i)/(S)
ct=Co-(x*sc)
x-=xt
xt+=x
print x,ct,i
falta=L-xt
print falta,Cf,Pf
#clases(L,Po,Pf,Co,Cf)
#diametro(Q,ks,k,hf)
#diametro(Q,ks,k,30)
clases(2683.333,0,230,4100,3870)

Вам также может понравиться