%{ # Stability of a plane shear flow with a free surface This programs investigates the stability of a plane shear flow with profile $\bar{U}(y)$ in a domain $y \in [O,H]$. The bottom ($y=0$) is a wall while the upper surface ($y=H$) is a *free surface* characterized by surface tension $\gamma$. The domain above is a gaz with negligible density and viscosity and uniform pressure $P_0$. The gravity field is $g$, in the downward (y<0) direction. This code is adapted from two programs in the easystab project : [sandbox/easystab/TS_PlanePoiseuille.m]() for a shear flow without free surface [sandbox/easystab/free_surface_gravity.m]() for a free surface without shear flow ** NOTE : this program remains to be validated !** ## Equations ### Flow decomposition Noting $y = \eta(x,t)$ the equation of the free surface, the flow is thus expanded as follows : $$ \underbrace{\left[ \begin{array}{c} u \\ v \\ p \\ \eta \end{array} \right]}_{q} \, = \, \underbrace{\left[ \begin{array}{c} \bar{U}(y) \\ 0 \\ \bar{P}(y) \\ H \end{array} \right]}_{q_0} \quad + \quad \epsilon \underbrace{{\left[ \begin{array}{c} \hat{u}(y) \\ \hat{v}(y)\\ \hat{p}(y) \\ \hat{\eta} \end{array} \right]}}_{\hat{q}} e^{i k x - i \omega t} $$ ### Base flow If neglecting the effect of viscosity on the baseflow, the law $\bar{U}(y)$ can be arbitrary, and the associated pressure distribution is hydrostatic : $\bar{P}(y) = P_0 + \rho g (H-y)$. (NB if viscosity is retained and we want the base flow to be a *steady* solution of NS, the only solution is the parabolic profile $U(y) = y/H( 2- y/H)$ and an axial component of $g$ must be present, i.e. the plate must be tilted by some angle $\alpha$). ### Linear equations : bulk equations Within the bulk ($0100; s(rem)=[]; UU(:,rem)=[]; if(nargout==1) s=s(1); % this is a trick to allow to use the function as s=EV_FreeSurface(alpha). % This allows to pass the function as a handle for fzero. end end % function EV_FreeSurf function [] = plotmode(~,~,mode,omega,alpha) global y dy dyy figure(2);hold off; N = length(y); u = mode(1:N); v = mode(N+1:2*N); p = mode(2*N+1:3*N); eta = mode(3*N+1); vorticity = (dy*u)-1i*alpha*v; subplot(1,3,1);hold off; plot(real(u),y,'b-',imag(u),y,'b--');hold on; plot(real(v),y,'g-',imag(v),y,'g--');hold on; plot(real(p),y,'k-',imag(p),y,'k--');hold on; ylabel('y'); ylim([0,1.5]); legend({'Re(u)','Im(u)','Re(v)','Im(v)','Re(p)','Im(p)'},'Interpreter','latex') title('Structure of the eigenmode'); % plot 2D reconstruction Lx=2*pi/alpha; Nx =30; x=linspace(-Lx/2,Lx/2,Nx); yy = y; pp = 2*real(p*exp(1i*alpha*x)); uu=2*real(u*exp(1i*alpha*x)); vv=2*real(v*exp(1i*alpha*x)); vorticityvorticity=2*real(vorticity*exp(1i*alpha*x)); subplot(1,3,2:3); hold off; contourf(x,yy,vorticityvorticity,10); hold on; quiver(x,yy,uu,vv,'k'); hold on; plot(x,y(N)+0.1*real(eta*exp(1i*alpha*x)),'r-','linewidth',3) ylim([0:1.5]); xlabel('x'); ylabel('y'); title({'Structure of the eigenmode (2D reconstruction)',['for k = ',num2str(alpha) , ' ; omega = ',num2str(omega)]}); end% function plotmode