Flow Instability Matlab Tutorial Bangalore, January Matthew Juniper, Dan Henningson, Peter Schmid Simple differentiation matrices Imagine a vector that represents the values of a function y at N equispaced points between < x <. We can create a simple matrix that, at each point, approximates d/dx of this vector:. prog.m function [D] = prog (N) % Create a nd order central difference matrix, D, that differentiates the % vector on which it operates. The vector represents the values of y at N % equispaced points between - < x <. % % Operate this matrix on a sin wave and compare the result with the % analytical solution. 3 N = 7 y(x) y (x) D y(x) 3.5.5 To do For small N, e.g. N = 7, run with the command line D = prog (N). Examine matrix D to understand why it differentiates the vector on which it acts. Vary N and run with the command line D = prog (N); to examine its behaviour.. prog.m Repeat this for a th order central difference matrix, D. This tutorial is based on one given at JNCASR by Peter Schmid in January 9
3 N = 7 y(x) y (x) D y(x) 3.5.5 To do Same as for D = prog (N). Examine matrix D to understand why it is more accurate than that in prog. Vary N and compare with the results of prog..3 prog 5.m Repeat this for a Chebyshev differentiation matrix 3 N = 7 y(x) y (x) D y(x) 3.5.5 To do For small N, e.g. N = 7, run with the command line D = prog 5(N). Examine matrix D and note the differences with those from prog and prog. Vary N and compare with the previous results. Eigenvalue problems. prog.m We will now solve a simple eigenvalue problem: d u dx + λu = with homogenous boundary conditions (u = at x = ±). This is the solution for a wave on a string that is held at both ends. The first eigenvalue corresponds to the fundamental
mode. Higher eigenvalues correspond to higher harmonics. % Calculate the Chebyshev matrix and the nd order differential operator matrix. [D,x] = cheb(n); D = D^; % Apply the homogenous boundary conditions D = D(:N,:N); % Find the eigenvalues and corresponding eigenvectors [V,Lam] = eig(-d); eig =.*/pi eig =.*/pi eig 3 = 9.*/pi eig =.5*/pi eig 5 =.999999993987*/pi eig = 35.99999985777*/pi eig 7 = 9.3937*/pi eig 8 =.8335*/pi eig 9 = 8.799*/pi To do Look at how the second order difference matrix is created. Look at how the homogenous boundary conditions are applied. How many eigenvalues are there? What happens as you reduce N? Why? How would you change the boundary conditions to enforce a zero gradient at x = ± (harder)?. prog 7.m We will now solve another eigenvalue problem of the Sturm-Liouville type: ( d x dy ) + x dy dx dx dx = λy with boundary conditions y = at x = and x =. 3
..588. 83.9538. 85.8859.5.....5. 3 3 3. 39.753. 5.557. 7.538..... 3 3. 3. 7.573. 35.7..9535...... 3 3 3 To do Watch the eigenvalues and eigenfunctions change as you increase N..3 prog 9.m We will now solve the Orr-Sommerfeld eigenvalue problem for planar Poiseuille flow, assuming that the perturbations are two-dimensional. (Later on we will allow for perturbations to vary in the direction into the page, which introduces the Squire modes.) This problem is adapted from p.m in Spectral Methods in Matlab by Lloyd N. Trefethen (SIAM ). The Orr-Sommerfeld equation is: ( d R ) ( u dx u d d dx + u iu i( x ) ( u d ) ) dx u u = λ dx u with boundary conditions: du = u = at x = ± dx We express this as a generalized eigenvalue problem: Aû = λbû We plot the eigenvalues in the complex plane. In this formulation, the eigenvalue with the highest real part is the most unstable / least stable. In this formulation, the axial wavenumber has been taken to be. The figures below are for Chebyshev points and are created by typing prog 9().
eigenvalues for N =.9.8 Highlighted eigenvector.7. imag(λ).. amplitude.5..3.8...8... real(λ).5.5 x To do Click on eigenvalues to plot the corresponding eigenvector. Investigate the different branches of the eigenvalue plot. What happens as you increase N? Change the Reynolds number, R, by editing the program. 3 The Orr-Sommerfeld-Squire system This section is a practical demonstration of parts of. of Peter Schmid s 7 Annual Review paper, Schmid (7). We will start by considering planar Poiseuille flow at Reynolds number R. Unlike in the previous section, we will allow the perturbation to vary in the direction into the page (spanwise). We consider waves in the streamwise direction with wavenumber α and waves in the spanwise direction with wavenumber β. 3. prog.m We will look at planar Poiseuille flow first because it can be compared with the previous section. prog.m calculates the Orr-Sommerfeld-Squire matrix, which is matrix A in equation (.a) of Schmid (7). It plots out the eigenvalues of this matrix and the Orr-Sommerfeld eigenvector and Squire eigenvector of the eigenvalue that is clicked on by the user. e.g. type [OSSQ] = prog (,.,.,577);. function [OSSQ] = prog (N,alp,beta,Re) % Calculate the Orr-Sommerfeld-Squire matrix for planar Poiseuille flow. % % N : Number of Chebyshev points % alp : streamwise wavenumber % beta : spanwise wavenumber % Re : Reynolds number 5
eigenvalue number =. Orr Sommerfeld eigenfunction.3. amplitude.5..7.8.9.8.7..5..3... amplitude.5.5 x Squire eigenfunction.5.5 x To do Compare the eigenvalue plot with that from prog 9.m at the same value of N. Click on eigenvalues to plot the corresponding eigenvectors. Identify the Orr-Sommerfeld eigenvalues and the Squire eigenvalues. Change the Reynolds number and N. prog.m returns the matrix OSSQ. Create your own routine to plot the eigenvalues of OSSQ. Watch out for the scale on your graph. 3. PoiMatrix.m Some of the Orr-Sommerfeld-Squire eigenvalues have little influence on the behaviour of the system and can safely be discarded. The function PoiMatrix.m cuts out the modes outside a defined window. It then calls function OSSQMatrix, which computes the matrix, Q. This matrix has the same eigenvalues as the reduced OSSQ matrix and is used to calculate transient growth. This is on the Maximum Amplification slide of Dan Henningson s notes. This can be run with the command line [Q,invF] = PoiMatrix(,.,.,577);, for instance. In the rest of this tutorial, we will used this reduced matrix, Q. To do Plot the eigenvalues of Q with your own routine. Compare the eigenvalue plot with that of prog 9.m at the same value of N. (Optional: plot out some of the corresponding eigenfunctions). Normal and non-normal matrices This section looks at two simple matrices, one of which is normal (i.e. has orthogonal eigenvectors) and the other of which is non-normal: A n = 5 i.3 + i A nn = 5 i.3 + i
. The numerical range The numerical range is defined on page 3 of Schmid (7). The maximum protrusion of the numerical range into the unstable half-plane determines the maximum energy growth at t = + i.e. it is a measure of the growth rate at very small times. Eigenvalues, on the other hand, give a measure of the growth or decay at large times. The program AnPlot.m (A normal plot) plots the eigenvalues and numerical range of matrix A n. The numerical range is a set of straight lines joining the eigenvalues. It therefore does not extend further into the right half plane than the right-most eigenvalue. This means that the growth rate at small times is the same as that at large times. The program AnnPlot.m (A non-normal plot) plots the eigenvalues and numerical range of matrix A nn. The numerical range is loop around the eigenvalues and extends significantly into the right half plane. This means that the growth rate at small times will be higher than that given by the right-most eigenvalue alone. a normal matrix unstable region eigenvalues numerical range a non normal matrix unstable region eigenvalues numerical range λ i λ i 8 λ r 8 λ r To do range. Make up your own non-normal matrices and plot their eigenvalues and numerical. Pseudospectra, a.k.a. the resolvent norm Pseudospectra and the resolvent norm are defined four different but equivalent ways in Trefethen and Embree () and on slide Pseudospectra, resolvents and sensitivity of Dan Henningson s notes. When a random matrix E with norm ɛ is added to a matrix L, the eigenvalues of L move slightly. The maximum amount that they will move is given by the pseudospectra of L. They will not move outside the pseudospectra contour level at height ɛ. The amount that the pseudospectra extend into the right half plane gives an indication of the maximum transient growth possible with matrix L. (For a clearer definition, see the first three chapters of Trefethen and Embree or the video of Nick Trefethen s talk at the first AIM Meeting, available on the AIM website.) 7
The program RAnPlot.m plots the pseudospectra of A n and RAnnPlot.m plots the pseudospectra of A nn. The contours show log of the resolvent norm at that value of σ. pseudospectra of a normal matrix pseudospectra of a non normal matrix 8 8 The programs RAnPlot shotgun.m and RAnnPlot shotgun.m plot the pseudospectra of A n and A nn followed by the eigenvalues of matrices that have been perturbed by an amount ɛ. In the figures below, ɛ = log ().. pseudospectra of a normal matrix...... 8..........8..... pseudospectra of a non normal matrix...... 8.........8.... To do Vary ɛ and re-run RAnPlot shotgun.m and RAnnPlot shotgun.m. Repeat for your own non-normal matrices..3 Transient growth If a matrix, A, is non-normal, it can exhibit transient growth. The maximum possible transient growth at time T is called G(T ) and is the maximum singular value of the matrix exponential of A T. Transient growth can occur whether or not the matrix has unstable eigenvalues. The function TransientGrowth simple.m calculates G(T ) for the range specified by the user. Try TransientGrowth simple(a,[ 5],). 8
To do Calculate the transient growth for a non-normal matrix with stable eigenvalues. Change the non-normality of the matrix. See what happens to the transient growth. 5 Analysis of the Orr-Sommerfeld-Squire matrix You now have all the tools you need to investigate the Orr-Sommerfeld-Squire matrix with Poiseuille flow as the base flow. Try combining section with section 3. To get you started, the program start.m creates this figure: Eigenvalues, pseudospectra and numerical range for Poiseuille flow...8.5.5 The Couette directory contains functions that generate the Orr-Sommerfeld-Squire matrix for Couette flow. To generate the matrix, use the command [Q,invF] = CouMatrix(N,alp,beta,Re). The Pipe directory contains functions that generate the axisymmetric Orr-Sommerfeld-Squire matrix for round pipe flow. If you have time, try creating the Orr-Sommerfeld-Squire matrix for your own base flows. 9