0% found this document useful (0 votes)
4 views2 pages

Untitled2.ipynb - Colab

The document contains a Python script that calculates fluid dynamics parameters using the Darcy-Weisbach equation and the Swamee-Jain formula for friction factor. It evaluates flow rates and friction factors for different heights in a system of pipes, generating a table of results. The script utilizes iterative methods to find velocity and friction factor, and outputs the results in a structured format.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views2 pages

Untitled2.ipynb - Colab

The document contains a Python script that calculates fluid dynamics parameters using the Darcy-Weisbach equation and the Swamee-Jain formula for friction factor. It evaluates flow rates and friction factors for different heights in a system of pipes, generating a table of results. The script utilizes iterative methods to find velocity and friction factor, and outputs the results in a structured format.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

1/4/25, 12:52 p.m. Untitled2.

ipynb - Colab

import math
import pandas as pd

# Constantes
g = 9.81 # gravedad (m/s^2)
d = 0.28 # diámetro de tubería (m)
z1, z2, z3 = 25, 115, 85 # alturas de los depósitos (m)
L1, L2, L3 = 95, 125, 160 # longitudes de las tuberías (m)
e_d = 1 / 280 # rugosidad relativa

# Función de Darcy-Weisbach para pérdida de carga


def darcy_weisbach(L, d, V, f):
return f * (L / d) * (V**2 / (2 * g))

# Fórmula de Swamee-Jain para el factor de fricción


def swamee_jain(e_d, Re):
return 0.25 / (math.log10(e_d / 3.7 + 5.74 / Re**0.9))**2

# Método iterativo para encontrar V y f


def calcular_V_y_f(L, d, delta_z, ha, inicial=1.0):
V = inicial
error = 1
while error > 1e-5:
Re = 998 * abs(V) * d / 0.001 # Re = ρVD/μ
f = swamee_jain(e_d, Re)
V_nuevo = math.copysign(math.sqrt(abs((delta_z - ha) * 2 * g * d / (L * f))), delta_z - ha)
error = abs(V_nuevo - V)
V = V_nuevo
return f, V

# Evaluación de ha desde 70 a 80
resultados = []
for ha in range(70, 81):
f1, V1 = calcular_V_y_f(L1, d, z1, ha)
f2, V2 = calcular_V_y_f(L2, d, z2, ha)
f3, V3 = calcular_V_y_f(L3, d, z3, ha)

A = math.pi * (d / 2) ** 2
Q1 = A * V1
Q2 = A * V2
Q3 = A * V3
sum_Q = Q1 + Q2 + Q3

resultados.append({
"ha (m)": ha,
"f1": round(f1, 5),
"V1 (m/s)": round(V1, 2),
"Q1 (m³/s)": round(Q1, 2),
"f2": round(f2, 5),
"V2 (m/s)": round(V2, 2),
"Q2 (m³/s)": round(Q2, 2),
"f3": round(f3, 5),
"V3 (m/s)": round(V3, 2),
"Q3 (m³/s)": round(Q3, 2),
"ΣQ (m³/s)": round(sum_Q, 4)
})

# Crear y mostrar la tabla


df_resultados = pd.DataFrame(resultados)
print(df_resultados)

ha (m) f1 V1 (m/s) Q1 (m³/s) f2 V2 (m/s) Q2 (m³/s) \


0 70 0.02757 -9.71 -0.60 0.02758 8.47 0.52
1 71 0.02757 -9.82 -0.60 0.02758 8.37 0.52
2 72 0.02757 -9.93 -0.61 0.02758 8.28 0.51
3 73 0.02757 -10.03 -0.62 0.02758 8.18 0.50
4 74 0.02757 -10.14 -0.62 0.02759 8.08 0.50
5 75 0.02757 -10.24 -0.63 0.02759 7.98 0.49
6 76 0.02757 -10.34 -0.64 0.02759 7.88 0.49
7 77 0.02757 -10.44 -0.64 0.02759 7.78 0.48
8 78 0.02757 -10.54 -0.65 0.02759 7.68 0.47
9 79 0.02757 -10.64 -0.66 0.02759 7.57 0.47
10 80 0.02757 -10.74 -0.66 0.02759 7.47 0.46

f3 V3 (m/s) Q3 (m³/s) ΣQ (m³/s)


0 0.02765 4.32 0.27 0.1889

https://colab.research.google.com/drive/1IAKB7BdmFMxTCljyPDQAjuFv_k4-3FGu?authuser=0#scrollTo=cfdb44a8QSiO&printMode=true 1/2
1/4/25, 12:52 p.m. Untitled2.ipynb - Colab
1 0.02766 4.17 0.26 0.1675
2 0.02766 4.02 0.25 0.1456
3 0.02767 3.86 0.24 0.1235
4 0.02768 3.69 0.23 0.1009
5 0.02768 3.52 0.22 0.0778
6 0.02769 3.34 0.21 0.0542
7 0.02770 3.15 0.19 0.0299
8 0.02772 2.94 0.18 0.0048
9 0.02773 2.73 0.17 -0.0213
10 0.02775 2.49 0.15 -0.0485

No fue posible conectarse al servicio de reCAPTCHA. Comprueba tu conexión a Internet y vuelve a cargar la página para obtener un desafío de reCAPTCHA.

https://colab.research.google.com/drive/1IAKB7BdmFMxTCljyPDQAjuFv_k4-3FGu?authuser=0#scrollTo=cfdb44a8QSiO&printMode=true 2/2

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy