已结贴√
问题点数:20 回复次数:4
大家帮我看看一个水力压降计算的程序究竟错哪里了
#define p 15500
#define g 9.8
#define pi 3.14159
#include
#include
void main ()
{
int G,K;
float T,D1,D2,D3,L1,L2,L3,V1,V2,V3,U,DENSITY,RE1,RE2,RE0,Pfric1,Pfric2,Pfric3,Pfric,Pform1,Pform2,
Pform3,Pform,k1,k2,k3,Pacc,A1,A2,A3,B1,B2,Pgrav;
/*DENSITY密度;G为管型 U为粘度,C,N为摩擦系数中常数,K为弯头常数*/
printf("please enter T,D1,D2,D3,L2,L3,V1,K\n" );
scanf("%f %f %f %f %f %f %f %d",&T,&D1,&D2,&D3,&L2,&L3,&V1,&K);/* 输入已知量*/
if (T>=0&&T<=310)
{DENSITY=1.277808*pow(10,3)-1.839807*T+2.02097*pow(10,-7)*T*T+4.723564*pow(10,-10)*pow(T,3)+8.253361*pow(10,-10)*pow(T,4);/*密度公式一*/
U=25.3/((T+273.15)*(T+273.15)+91*(T+273.15)-85800);}
else if(T>310&&T<=340)
{DENSITY=1.1755984*pow(10,6)+8.1437361*pow(10,3)-21.136559*pow(T+273.15,2)+2.4381598*pow(10,-2)*pow(T+273.15,3)-1.0549747*pow(10,-5)*pow(T+273.15,2)+(p-1.5*pow(10,4))*pow(10,3)*exp(-14.64389+1.1283357*pow(10,-3)*exp(0.012670366*(T+273.15)));/*密度公式2*/
printf("DENSITY is %f\n",DENSITY);
U=25.3/((T+273.15)*(T+273.15)+91*(T+273.15)-85800);}
else if(T>340)
{printf("ERROR\n");}
printf("DENSITY is %f\n U is %f",DENSITY,U);
L1=D1*pi/4;
A1=pi*D1*D1/4;
A2=pi*D2*D2/4;
A3=pi*D3*D3/4;
B1=A1/A2;
B2=A2/A3;
V2=V1*B1;
V3=V2*B2;
RE0=DENSITY*D1*V1/U;
RE1=DENSITY*D2*V2/U;
RE2=DENSITY*D3*V3/U;
Pgrav=DENSITY*g*(L1+L2+L3);
printf("Pgrav is %f\n",Pgrav);
/*1 提升压降*/
{int i; float f1,f2,f3;
float RE[3]={RE0,RE1,RE2},D[3]={D1,D2,D3},f[3]={f1,f2,f3};
{
for(i=0;i<=2;i++);
{if(RE[i]<=2100)
{printf("RE=%f, %d管内为层流\n",RE[i],i);
f[i]=64/RE[i];}
else if(RE[i]>=10000)
{printf("%d管内为湍流1 or 0 ?\n",i); } /*粗糙管还是光滑管*/
scanf("%d",&G);
{if(G==0) f[i]=0.184*pow(RE[i],-0.2); //????
else f[i]=pow(2*log10(D[i]/0.09)+1.74,-2);//???????????????????????????????????????
}
}
}
Pfric1=f1*L1*DENSITY*V1*V1/(2*D1);
Pfric2=f2*L2*DENSITY*V2*V2/(2*D2);
Pfric3=f3*L3*DENSITY*V3*V3/(2*D3);
Pfric=Pfric1+Pfric2+Pfric3;
printf("Pfric is %f\n",Pfric);/*2 摩擦压降*/
}
{
switch(K)//????????????????
{case 0:k1=1.2;break;
case 1:k1=0.8;break;
case 2:k1=0.6;break;
case 3:k1=0.48;break;
case 4:k1=0.36;break;
case 5:k1=0.3;break;
case 6:k1=0.29;break;}
Pform1=k1*DENSITY*V1*V1/2;
{if(A1>A2)k2=0.5*(1-B1*B1);
else k2=(1-1/B1)*(1-1/B1);
Pform2=k2*DENSITY*V2*V2/2;}
{if(A2>A3)k3=0.5*(1-B2*B2);
else k3=(1-1/B2)*(1-1/B2);
Pform3=k3*DENSITY*V3*V3/2;}
Pform=Pform1+Pform2+Pform2;
printf("Pform1 is %f Pform2 is %f pform3 is %f Pform is %f\n",Pform1,Pform2,Pform3,Pform);/*3 形阻压降*/
}
{Pacc=(DENSITY*(V1*V1+(V2-V1)*(V2+V1)+(V3-V2)*(V3+V2)))/2;
printf("Pacc is %f\n",Pacc);} /*4加速压降*/
}
说明:程序是能运行,但答案算出来是错的,就是Pfriche
搜索更多相关主题的帖子:
压降 水力