马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?我要加入
x
程序为何解不出t[n],v[n]和m[n]的值?
程序如下:- #include<stdio.h>
- #include<iostream.h>
- #include<math.h>
- void main()
- {
- int i,j;
- double p[100],t[100],m[100],v[100]; // p为密度,t为温度,m为质量流量
- double b[13]={20,25,30,35,40,45,50,55,60,65,70,75,80},G[13]={697.78,705.04,708.51,708.15,703.98,696.02,684.33,669.03,650.23,628.11,602.86,574.72,543.96}; //输入角度和G
- double cp=1005,ta=293,pa=1.205,ycol=0.6,a=1378,Hchi=123,h=10,L=1501,Achi=2290.2;
- double f=0.008428,ein=0.056; //损失系数
- //double f=0.056,ein=1.5; //损失系数
- double D=54; //D为集热棚的水力直径
- double Acol=0.5*a*a;
- for(j=0;j<13;j++)
- {
- //t[0]=300,p[0]=1.0,m[0]=10000,v[0]=1.0; //赋初值
- t[0]=0,p[0]=1.0,m[0]=10000,v[0]=1.0; //赋初值
- int n=0;
- for(i=0;1;i++)
- {
- //```````````````````````方程的迭代格式``````````````````````````````````````````````//
- t[i+1]=(ycol*Acol/cp)*G[j]/m+ta;
- p[i+1]=2.2204-0.00353*t;
-
- m[i+1]=p*v*Achi;
- v[i+1]=sqrt((2*(pa-p)*9.8*(Hchi+0.5*a*sin(b[j]*3.1415926/180))-0.5*f*L*p*pow(v,2)/D-0.5*ein*pa*pow((m/a/h),2))/p);
- //```````````````````````````````````````````````````````````````````````````````````//
- if((fabs(t[i+1]-t)<10e-6) && (fabs(p[i+1]-p)<10e-6)&&(fabs(m[i+1]-m)<10e-6)&&(fabs(v[i+1]-m)<10e-6))// 判断跌代的值
- break;
- n++;
- }
- printf("%f\t",p[n]);
- printf("%f\t",t[n]);
- printf("%f\t",v[n]);
- printf("%f\t",m[n]);
- printf("\n");
- }
- }
复制代码
[ 本帖最后由 风花雪月 于 2008-4-9 08:24 编辑 ] |