LAb caviatacion
Enviado por Rebecca • 24 de Enero de 2018 • 934 Palabras (4 Páginas) • 415 Visitas
...
//Iterar
while((Math.abs(D1-D))>=0.0001){
System.out.println(" ITERA ");
D1 = D;
double Re = Ecua.reynolds(Q,D1,vc);
System.out.println(" Nuevo Re " + Re);
double f = Ecua.cw(E,D1,Re);
System.out.println("nuevo f " + f);
D = Math.pow((Math.pow(Q,2)/Hf)*((8*6.8/(9.81*Math.pow(Math.PI,2)))+((8*f1*L)/(9.81*Math.pow(Math.PI,2)*D1))),0.24);
import java.lang.Math;
public class Ecua{
//Método Para el calculo de Reynolds a partir de Q, D y viscosidad
public static double reynolds(double Q, double Di, double vc){
double Re = (4*Q)/(Math.PI*Di*vc);
return Re;
}
//Método para el calculo de Darcy con velocidad para obtener Hf
public static double darcyHfVel (double f, double L, double Di, double ve){
double hf = f*(L/Di)*((Math.pow(ve,2))/(2*9.81));
return hf;
}
//Método Darcy para calcular Hf cuando se tiene Q
public static double darcyHfCau (double f, double L, double Di, double Q){
double hf = f*((8*L)/(9.81*Math.pow(Math.PI,2)*Math.pow(Di,5)))*Math.pow(Q,2);
return hf;
}
//Método Haaland para calcular f
public static double haaland(double E, double Di, double Re){
double f = Math.pow(-1.8*Math.log10(Math.pow((E*Di/3.7),1.11)+(6.9/Re)),-2);
return f;
}
//Método Hazen-Williams para calcular D
public static double hw (double L, double Q, double CH, double Hf){
double D = Math.pow((10.675*L*Math.pow((Q/CH),1.852))/Hf,(1/4.87));
return D;
}
//Método Darcy para calcular D a partir de Q
public static double darcyD (double f, double L, double Hf, double Q){
double D = Math.pow(f*8*L*Math.pow(Q,2)/(9.81*Hf*Math.pow(Math.PI,2)),0.2);
return D;
}
//Método Darcy para calcular Q a partir de D
public static double darcyQ (double f, double L, double Hf, double Di){
double Q = Math.pow((Hf*Math.pow(Di,5)*9.81*Math.pow(Math.PI,2))/(f*8*L),0.5);
return Q;
}
//Método Colebrook-White para calcular f iterando
public static double cw (double E, double Di, double Re){
double f1 = Ecua.haaland(E,Di,Re);
double f = Math.pow((-2*Math.log10((E/(3.7*Di))+(2.51/(Re*Math.pow(f1,0.5))))),-2);
while (Math.abs(f-f1)>=0.0001){
f1 = f;
f = Math.pow((-2*Math.log10((E/(3.7*Di))+(2.51/(Re*Math.pow(f1,0.5))))),-2);
}
return f;
}
}
...