Python Para ingenieros mecánicos
Resolviendo problemas básicos de ingeniería con Python
# source: https://www.youtube.com/watch?v=tnoAro7whYw
from IPython.display import HTML
# Youtube
HTML('<iframe width="560" height="315"
src="https://www.youtube.com/embed/tnoAro7whYw?rel=0&controls=0&showinfo=0"
frameborder="0" allowfullscreen></iframe>')
El problema
¿Se llenaría un tanque de radio = 5 m y la altura = 10 m si la afluencia de agua es de 15 m
/min dentro de dos horas?
Fórmulas básicas
El volumen del tanque:
El volumen del fluido acumulado en el tiempo
dónde es una tasa de flujo volumétrico en unidades de (M/min) y el tiempo se dará en minutos.
La prueba para el sobrecarga
?>># definitions:
>>r = 5 # radius, (m)
>>h = 10 # height, (m)
>>Q = 15 # flow rate (m^3/min)
>>pi = 3.14159 # or use from math import pi
>>from math import pi
>>V_tank = pi * r**2 * h
>>t = 120 # time, (min)
>>V_in = Q * t
>>if V_in > V_tank:
print("Tank overfilled by " + str(V_in - V_tank) + " m^3")
>>else:
print("Safe")
>>Tank overfilled by 1014.6018366025517 m^3
>># let's plot the process
>># import a plotting package, matplotlib
>>import matplotlib.pyplot as plt
>># import a numerical package numpy that allows to multiply a scalar by vector
>>import numpy as np
>>t = np.arange(0,120)
>>plt.figure(figsize=(8,6))
>>plt.plot(t,Q*t,'--')
>>plt.plot([0,120],[V_tank,V_tank])
>>plt.xlabel('$t$ (min)',fontsize=18)
>>plt.ylabel('$V$ (m$^3$/min)',fontsize=18);
>>plt.legend((r'$V_f$',r'$V_{\mathrm{tank}}$'),fontsize=16);

No hay comentarios.:
Publicar un comentario