1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
|
#include <iostream.h>
#include <conio.h>
#include <algorithm>
void print();
class ftcs
{
private:
float a,b,c,d,e,f,u[100];
public:
int read_data (float a,float b, float c, float d, float e, float f)
{
print();
cout<<"\nThis program computes the velcoity of suddenly accelerated plate \nover a period of time \n";
print();
cout<<"\nPlease Enter the following details in SI units.....\n\n";
cout<<"Distance between the two plates (h) m :";cin>>a;
cout<<"Velocity of the moving plate (u0) m/s :";cin>>b;
cout<<"Kinematic viscosity of fluid (v) m2/s:";cin>>c;
print();
cout<<"\nSetting the Grid for the problem...\n\nGrid Spacing required along\n1.Y-Direction\t\t:";cin>>d;
cout<<"2.Time step Interval\t:";cin>>e;
cout<<"Time step at which velcoity to be found:";cin>>f;
print();cout<<"\n";
}
int array(float *u, int n)
{
for(int i=0;i<=n-1;i++)
{
if(i==n-1)
{u[i]=10;}else
{u[i]=0;}
}
}
};
int main()
{
float h,u0,v,dx,dt,t,d,u[100];
int n,cc;
ftcs x;
x.read_data(h,u0,v,dx,dt,t);
d=v*(dt/(dx*dx));
n=(h/dx)+1;
cc=n+1;
x.array( &u[100] ,n);
getch();
}
void print()
{
cout<<"-----------------------------------------------------------------";
}
|