i2d.edp (2.7 KB)
While executing the file output files A1.csv and B1.csv are not created.
load “medit”
load “msh3”
int df=1;
int n=10;
border interval(t=0., df){x=t;y=0;z=0;};
meshL Th= buildmeshL(interval(n));
fespace Vh(Th,P2);
plot(Th,wait=1);
real Mj=0.9; // mach number
complex I = 1i;
real ga=1.4; //gamma
real M2=(1/(gaMjMj));
real Re;
cout<<“Enter Reynold’s number”<<endl;
cin>>Re;
real om,alp,bet;
// defining the type of stability problem
int a,b;
cout<<“Enter 1 for spatial stability and 2 for temporal stability\n”<<endl;
cin>> a;
if(a==1)
{
cout<<“Enter wave frequency\n”<<endl;
cin>>om;}
else{
cout<<“Enter streamwise wave number\n”<<endl;
cin>>alp;
cout<<“Enter spanwise wave number\n”<<endl;
cin>>bet;}
fespace Mh(Th,P1);
fespace Gh(Th,[P2,P2,P2,P1]);
Vh W,u,v,w,a2,a3,Wy,a1;
Mh p,a4;
W=2*y-1;
Wy=2;
plot(W,wait=1);
real lambda=(10^18);
matrixA1;
matrix B1;
varf A(u,v,w,p,a1,a2,a3,a4)=int1d(Th)(a1*(I*bet*W+(alp^2+bet^2)/(Re))*u-(1/Re)*dy(a1)*dy(u)+a1*p*I*alp+
a2*(I*bet*W+(alp^2+bet^2)/(Re))*v-(1/Re)*dy(a2)*dy(v)-p*dy(a2)+
a3*v*Wy+a3*(I*bet*W+(alp^2+bet^2)/(Re))*w-(1/Re)*dy(a3)*dy(w)+a3*I*bet*w+
a4*u*I*alp+a4*dy(v)+a4*bet*I*w
)+on(1,11,u=0,v=0,w=0);
varf B(u,v,w,p,a1,a2,a3,a4)=int1d(Th)(a1*I*u+a2*I*v+a3*I*w);
A1=A(Gh,Gh);
B1=B(Gh,Gh);
ofstream file("A1.csv");
for (int i = 0; i < A1.m; i++) {
for (int j = 0; j < A1.n; j++) {
if(imag(A1(i,j))>0){file<<real(A1(i,j))<<“+”<<imag(A1(i,j))<<“i”;}
else{file<<real(A1(i,j))<<imag(A1(i,j))<<“i”;}
if (j < A1.m - 1) {
file<< “,”;
}
}
file << endl;
}
ofstream file1("B1.csv");
for (int i = 0; i < B1.n; ++i) {
for (int j = 0; j < B1.m; ++j) {
if(imag(B1(i,j))>0){file1<<real(B1(i,j))<<“+”<<imag(B1(i,j))<<“i”;}
else{file1<<real(B1(i,j))<<imag(B1(i,j))<<“i”;}
if (j < B1.m - 1) {
file1<< “,”;
}
}
file1<< endl;
}
cout<<A1.m<<endl;
cout<<A1.n<<endl;