Baixe o app para aproveitar ainda mais
Esta é uma pré-visualização de arquivo. Entre para ver o arquivo original
#include<iostream> #include<conio.h> #include<iomanip> #include<cmath> using namespace std; const float pi=M_PI; int main(){ float d, e, t, v, vi, re, q; float f=1000, a, b, h=0, g=0, x=1, hf, l, fy=0.01; int p=0; cout<<"Entre com o valor do diametro em mm..."<<endl; cin>>d; cout<<"Entre com o valor da espessura da parede mm..."<<endl; cin>>e; cout<<"Entre com o valor da temperatura..."<<endl; cin>>t; cout<<"Entre com o valor da vazão em L/h..."<<endl; cin>>q; cout<<"Entre com o valor do comprimento de tubulação em m..."<<endl; cin>>l; d=d/1000;//transforma diametro de mm para m vi=1.78*pow(10,-6)/(1+0.0337*t+0.000221*pow(t,2)); q=q*1e-3/3600;//transforma vazão de L/h para m³/s v=4*q/pi/pow(d,2); re=v*d/vi; cout<<"Viscosidade(m²/s)"<<setw(16)<<"Velocidade(m/s)"<<setw(10)<<"Reynolds"<<endl; cout<<vi<<setw(16)<<v<<setw(14)<<re<<endl; a=e/(d*1000); //cout<<"a"<<a; b=5.02/M_LN10; //cout<<"b"<<b; for(p=0;p<15;p++){ while(x>=0.0000001&&p<50) { g= 1/sqrt(fy) + 2*log10(a/3.7+2.51/re/sqrt(fy)); //f(x) h=-0.5*pow(fy,-1.5)*(1+b/re/(a/3.7+2.51/re/sqrt(fy))); //derivada do f(x) fy=fy-g/h; x=fabs(fy-f); f=fy; p++; } } cout<<endl; cout<<"Coeficiente de atrito..."<<fy<<endl<<endl; hf=f*l*pow(v,2)/d/2/9.781; cout<<"Perda de carga..."<<hf<<setw(6)<<"m.c.a"; getch(); }
Compartilhar