Вы находитесь на странице: 1из 10

Name: Mishra Bhaskar Anupam

Enroll: 14012141016

Class: 6th ME B

Program for “FORCED CONVECTION”

#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
int i, r;
re : clrscr();
printf("Welcome to forced convection calculator ");
printf("\n Please select what do you want to calculate: ");
printf("\n 1. Displacement, momentum, energy thickness ");
printf("\n 2. Boundary layer Problem ");
printf("\n 3. Heat transfer problem\n ");
scanf("%d",&i);
clrscr();
if(i == 1)
{
printf("Please select type of equation:");
printf("\n 1. Linear");
printf("\n 2. Quadratic");
printf("\n 3. Cubic\n ");
scanf("%d",&i);
clrscr();
if (i == 1)
{
float dt, mt, et, H, I, J;
dt = 0.5;
mt = 0.16666666;
et = 0.25;
H = (dt)/(mt);
I = (dt)/(et);
J = (mt)/(et);
printf("For linear flow:");
printf("\n 1. Displacement to Boundary thickness = %f", dt);
printf("\n 2. Momentum to Boundary thickness = %f", mt);
printf("\n 3. Energy to Boundary thickness = %f", et);
printf("\n 4. Displacement to Momentum thickness ratio = %f", H);
printf("\n 5. Displacement to Energy thickness ratio = %f", I);
printf("\n 6. Momentum to Energy thickness ratio = %f", J);
}
else if(i == 2)
{
float dt, mt, et, H, I, J;
dt = 0.33333333;
mt = (2.0/15.0);
et = 0.25;
H = (dt)/(mt);
I = (dt)/(et);
J = (mt)/(et);
printf("For Quadratic flow flow:");
printf("\n 1. Displacement to Boundary thickness = %f", dt);
printf("\n 2. Momentum to Boundary thickness = %f", mt);
printf("\n 3. Energy to Boundary thickness = %f", et);
printf("\n 4. Displacement to Momentum thickness ratio = %f", H);
printf("\n 5. Displacement to Energy thickness ratio = %f", I);
printf("\n 6. Momentum to Energy thickness ratio = %f", J);
}
else if(i == 3)
{
float dt, mt, et, H, I, J;
dt = 0.33333333;
mt = (2.0/15.0);
et = 0.25;
H = (dt)/(mt);
I = (dt)/(et);
J = (mt)/(et);
printf("For Cubic flow:");
printf("\n 1. Displacement to Boundary thickness = %f", dt);
printf("\n 2. Momentum to Boundary thickness = %f", mt);
printf("\n 3. Energy to Boundary thickness = %f", et);
printf("\n 4. Displacement to Momentum thickness ratio = %f", H);
printf("\n 5. Displacement to Energy thickness ratio = %f", I);
printf("\n 6. Momentum to Energy thickness ratio = %f", J);
}
else
{
printf("\n invalid");
}
}
else if(i == 2)
{
printf("Boundary Layer Problem:");
printf("\n Choose type of flow:");
printf("\n 1. General (Blasius Eqn.)");
printf("\n 2. Linear");
printf("\n 3. Quadratic");
printf("\n 4. cubic\n");
scanf("%d",&i);
clrscr();
if(i == 1)
{
float l,b,v,P,u,Cp,K,x,Rex,Rel,btx,btl,Cfx,Cfa,To,Fd,Pr,btth,m;
printf("Please enter the values of following:\n");
printf("\nLength of plate in m:\n");
scanf("%f",&l);
printf("\nWidth of plate in m:\n");
scanf("%f",&b);
printf("\nVelocity of flow in m/s:\n");
scanf("%f",&v);
printf("\nDensity of fluid in kg/m^3:\n");
scanf("%f",&P);
printf("\nDynamic viscosity in uNs (X 10^-6):\n");
scanf("%f",&u);
printf("\nSpecific heatin j/kg:\n");
scanf("%f",&Cp);
printf("\nThermal conductivity in W/mk:\n");
scanf("%f",&K);
printf("\nDistance on plate in m:\n");
scanf("%f",&x);
Rex=(P*1000000*v*x)/u;
Rel=(P*1000000*v*l)/u;
btx=(5*x)/(sqrt(Rex));
btl=(5*l)/(sqrt(Rel));
Cfx=0.664/(sqrt(Rex));
Cfa=2*Cfx;
To=0.5*P*pow(v,2)*Cfa;
Fd=To*l*b;
Pr=(u*Cp)/(K*1000000);
btth=(btl)/(pow(Pr,0.333334));
m=0.625*P*v*btl;
printf("\n Reynolds no. at distance %.2f is %.2f",x,Rex);
printf("\n Avg Reynolds no. is %.2f",Rel);
printf("\n Boundary layer Thickness at dist %.2f is %f m",x,btx);
printf("\n Boundary layer Thickness for total length is %f m",btl);
printf("\n Local friction coefficient at dist %.2f is %f",x,Cfx);
printf("\n Avg friction coefficient is %f",Cfa);
printf("\n Avg Shear Stress is %f N/m^2",To);
printf("\n Avg Drag Force is %f N",Fd);
printf("\n Prandtle no. is %.2f",Pr);
printf("\n Thermal boundary layer is %f m",btth);
printf("\n Avg mass flow rate is %f kg/s",m);

}
else if(i == 2)
{
float l,b,v,P,u,Cp,K,x,Rex,Rel,btx,btl,Cfx,Cfa,To,Fd,Pr,btth,m;
printf("Please enter the values of following:\n");
printf("\nLength of plate in m:\n");
scanf("%f",&l);
printf("\nWidth of plate in m:\n");
scanf("%f",&b);
printf("\nVelocity of flow in m/s:\n");
scanf("%f",&v);
printf("\nDensity of fluid in kg/m^3:\n");
scanf("%f",&P);
printf("\nDynamic viscosity in uNs (X 10^-6):\n");
scanf("%f",&u);
printf("\nSpecific heatin j/kg:\n");
scanf("%f",&Cp);
printf("\nThermal conductivity in W/mk:\n");
scanf("%f",&K);
printf("\nDistance on plate in m:\n");
scanf("%f",&x);
Rex=(P*1000000*v*x)/u;
Rel=(P*1000000*v*l)/u;
btx=(3.64*x)/(sqrt(Rex));
btl=(3.64*l)/(sqrt(Rel));
Cfx=0.5775/(sqrt(Rex));
Cfa=2*Cfx;
To=0.5*P*pow(v,2)*Cfa;
Fd=To*l*b;
Pr=(u*Cp)/(K*1000000);
btth=(btl)/(pow(Pr,0.333334));
m=0.625*P*v*btl;
printf("\n Reynolds no. at distance %.2f is %.2f",x,Rex);
printf("\n Avg Reynolds no. is %.2f",Rel);
printf("\n Boundary layer Thickness at dist %.2f is %f m",x,btx);
printf("\n Boundary layer Thickness for total length is %f m",btl);
printf("\n Local friction coefficient at dist %.2f is %f",x,Cfx);
printf("\n Avg friction coefficient is %f",Cfa);
printf("\n Avg Shear Stress is %f N/m^2",To);
printf("\n Avg Drag Force is %f N",Fd);
printf("\n Prandtle no. is %.2f",Pr);
printf("\n Thermal boundary layer is %f m",btth);
printf("\n Avg mass flow rate is %f kg/s",m);
}
else if(i == 3)
{
float l,b,v,P,u,Cp,K,x,Rex,Rel,btx,btl,Cfx,Cfa,To,Fd,Pr,btth,m;
printf("Please enter the values of following:\n");
printf("\nLength of plate in m:\n");
scanf("%f",&l);
printf("\nWidth of plate in m:\n");
scanf("%f",&b);
printf("\nVelocity of flow in m/s:\n");
scanf("%f",&v);
printf("\nDensity of fluid in kg/m^3:\n");
scanf("%f",&P);
printf("\nDynamic viscosity in uNs (X 10^-6):\n");
scanf("%f",&u);
printf("\nSpecific heatin j/kg:\n");
scanf("%f",&Cp);
printf("\nThermal conductivity in W/mk:\n");
scanf("%f",&K);
printf("\nDistance on plate in m:\n");
scanf("%f",&x);
Rex=(P*1000000*v*x)/u;
Rel=(P*1000000*v*l)/u;
btx=(5.48*x)/(sqrt(Rex));
btl=(5.48*l)/(sqrt(Rel));
Cfx=0.73/(sqrt(Rex));
Cfa=2*Cfx;
To=0.5*P*pow(v,2)*Cfa;
Fd=To*l*b;
Pr=(u*Cp)/(K*1000000);
btth=(btl)/(pow(Pr,0.333334));
m=0.625*P*v*btl;
printf("\n Reynolds no. at distance %.2f is %.2f",x,Rex);
printf("\n Avg Reynolds no. is %.2f",Rel);
printf("\n Boundary layer Thickness at dist %.2f is %f m",x,btx);
printf("\n Boundary layer Thickness for total length is %f m",btl);
printf("\n Local friction coefficient at dist %.2f is %f",x,Cfx);
printf("\n Avg friction coefficient is %f",Cfa);
printf("\n Avg Shear Stress is %f N/m^2",To);
printf("\n Avg Drag Force is %f N",Fd);
printf("\n Prandtle no. is %.2f",Pr);
printf("\n Thermal boundary layer is %f m",btth);
printf("\n Avg mass flow rate is %f kg/s",m);
}
else if(i == 4)
{
float l,b,v,P,u,Cp,K,x,Rex,Rel,btx,btl,Cfx,Cfa,To,Fd,Pr,btth,m;
printf("Please enter the values of following:\n");
printf("\nLength of plate in m:\n");
scanf("%f",&l);
printf("\nWidth of plate in m:\n");
scanf("%f",&b);
printf("\nVelocity of flow in m/s:\n");
scanf("%f",&v);
printf("\nDensity of fluid in kg/m^3:\n");
scanf("%f",&P);
printf("\nDynamic viscosity in uNs (X 10^-6):\n");
scanf("%f",&u);
printf("\nSpecific heatin j/kg:\n");
scanf("%f",&Cp);
printf("\nThermal conductivity in W/mk:\n");
scanf("%f",&K);
printf("\nDistance on plate in m:\n");
scanf("%f",&x);
Rex=(P*1000000*v*x)/u;
Rel=(P*1000000*v*l)/u;
btx=(4.64*x)/(sqrt(Rex));
btl=(4.64*l)/(sqrt(Rel));
Cfx=0.646/(sqrt(Rex));
Cfa=2*Cfx;
To=0.5*P*pow(v,2)*Cfa;
Fd=To*l*b;
Pr=(u*Cp)/(K*1000000);
btth=(btl)/(pow(Pr,0.333334));
m=0.625*P*v*btl;
printf("\n Reynolds no. at distance %.2f is %.2f",x,Rex);
printf("\n Avg Reynolds no. is %.2f",Rel);
printf("\n Boundary layer Thickness at dist %.2f is %f m",x,btx);
printf("\n Boundary layer Thickness for total length is %f m",btl);
printf("\n Local friction coefficient at dist %.2f is %f",x,Cfx);
printf("\n Avg friction coefficient is %f",Cfa);
printf("\n Avg Shear Stress is %f N/m^2",To);
printf("\n Avg Drag Force is %f N",Fd);
printf("\n Prandtle no. is %.2f",Pr);
printf("\n Thermal boundary layer is %f m",btth);
printf("\n Avg mass flow rate is %f kg/s",m);
}
else
{
printf("invalid");
}
}
else if(i == 3)
{
printf("Heat transfer problem:\n");
printf("\n Please select the type of problem:");
printf("\n 1. Flow over plate");
printf("\n 2. Flow through pipe\n");
scanf("%d",&i);
clrscr();
if(i == 1)
{
float l,b,v,P,u,Cp,K,Tp,Ta,Rel,Pr,Nu,h,Q;
printf("Flow over plate (air)\n\n");
printf("Please enter the values of following:\n");
printf("\nLength of plate in m:\n");
scanf("%f",&l);
printf("\nWidth of plate in m:\n");
scanf("%f",&b);
printf("\nVelocity of flow in m/s:\n");
scanf("%f",&v);
printf("\nDensity of fluid in kg/m^3:\n");
scanf("%f",&P);
printf("\nDynamic viscosity in uNs (X 10^-6):\n");
scanf("%f",&u);
printf("\nSpecific heatin j/kg:\n");
scanf("%f",&Cp);
printf("\nThermal conductivity in W/mk:\n");
scanf("%f",&K);
printf("\n No of sides on which flow occours\n");
scanf("%d",&i);
printf("\n Temp of plate\n");
scanf("%f",&Tp);
printf("\n Temp of air\n");
scanf("%f",&Ta);
if(i == 1 || i == 2)
{
Rel=(P*v*l)/u;
if(Rel <= 0.5)
{
Pr=(u*Cp)/(K*1000000);
Nu=0.332*i*(sqrt(Rel*1000000))*(pow(Pr,0.333334));
}
else
{
if(Ta < Tp)
{
Pr=(u*Cp)/(K*1000000);
Nu=0.0288*i*(pow((Rel*1000000),0.8))*(pow(Pr,0.333334));
}
else if(Ta > Tp)
{
Pr=(u*Cp)/(K*1000000);
Nu=0.0288*i*(pow((Rel*1000000),0.8))*(pow(Pr,0.4));
}
else
{
printf("\n No Heat Transfer would occour");
}
}
h=Nu*K/l;
Q=h*l*b*(Tp-Ta);
printf("\n Reynolds no is %f\n",Rel*1000000);
printf("\n Prandtle no is %f\n",Pr);
printf("\n Nusselt no is %f\n",Nu);
printf("\n Heat transf coefficient is %f W/m^2K\n",h);
printf("\n Heat transfer rate is %f W",Q);
}
else
{
printf("\ninvalid");
}
}
else if(i == 2)
{
float l,d,v,P,u,Cp,K,Tp,Ta,Rel,Pr,Nu,h,Q;
printf("Flow through pipe (water):\n\n");
printf("Please enter the values of following:\n");
printf("\nLength of pipe in m:\n");
scanf("%f",&l);
printf("\nDiameter of pipe in m:\n");
scanf("%f",&d);
printf("\nVelocity of flow in m/s:\n");
scanf("%f",&v);
printf("\nDensity of fluid in kg/m^3:\n");
scanf("%f",&P);
printf("\nDynamic viscosity in uNs (X 10^-6):\n");
scanf("%f",&u);
printf("\nSpecific heat in j/kg:\n");
scanf("%f",&Cp);
printf("\nThermal conductivity in W/mk:\n");
scanf("%f",&K);
printf("\n Temp of pipe\n");
scanf("%f",&Tp);
printf("\n Temp of water\n");
scanf("%f",&Ta);
Rel=(P*v*d)/u;
if(Rel <= 0.002300)
{
Pr=(u*Cp)/(K*1000000);
Nu=3.65;
}
else
{
if(Ta < Tp)
{
Pr=(u*Cp)/(K*1000000);
Nu=0.023*(pow((Rel*1000000),0.8))*(pow(Pr,0.333334));
}
else if(Ta > Tp)
{
Pr=(u*Cp)/(K*1000000);
Nu=0.023*(pow((Rel*1000000),0.8))*(pow(Pr,0.4));
}
else
{
printf("\n No Heat Transfer would occour");
}
}
h=Nu*K/d;
Q=h*l*3.14*d*(Tp-Ta);
printf("\n Reynolds no is %f\n",Rel*1000000);
printf("\n Prandtle no is %f\n",Pr);
printf("\n Nusselt no is %f\n",Nu);
printf("\n Heat transf coefficient is %f W/m^2K\n",h);
printf("\n Heat transfer rate is %f W",Q);

}
}
else
{
printf("\n invalid");
}
printf("\n\n Press 0 to restart, any other key followed by enter to exit\n");
scanf("%d",&r);
if(r == 0)
{
goto re;
}
getch();
}

Thank You

Вам также может понравиться