function [Q]=bc8(Q,JM,KM,jmax,kmax,M_inf) %These are the boundary conditions for the airfoil %I must remember that the vector is formatted as %Q(xindex,yindex,qindex)==Q(column,row,quanity) %At inflow (x=-1), fix pu=M_inf,pv=0, and set dp/dx=0 *LEFT Q(1,KM,1)=Q(2,KM,1); Q(1,KM,2)=M_inf; Q(1,KM,3)=0; %At right dQ/dx=0. Therefore Q(:,kmax,:)=Q(:,kmax-1,:); *RIGHT Q(jmax,KM,:) = Q(jmax-1,KM,:); %At the top (y=2) fix all the variables p=1, u=M_inf,v=0 *TOP Q(JM,kmax,1)=1; Q(JM,kmax,2)=M_inf; Q(JM,kmax,3)=0; % At k=1 Extrap rho, u, fix rho v *BOTTOM RHO = Q(JM,1,1); Q(JM,1,1) = Q(JM,2,1); Q(JM,1,2) = Q(JM,2,2)./Q(JM,2,1).*Q(JM,1,1); Q(JM,1,3) = Q(JM,1,3)./RHO.*Q(JM,1,1);