Vous êtes sur la page 1sur 9

# Flow Instability Matlab Tutorial Bangalore, January 2010

1

## Simple dierentiation matrices

Imagine a vector that represents the values of a function y at N equispaced points between 1 < x < 1. We can create a simple matrix that, at each point, approximates d/dx of this vector:

1.1

prog 1.m

function [D1] = prog 1(N) % Create a 2nd order central difference matrix, D1, that differentiates the % vector on which it operates. The vector represents the values of y at N % equispaced points between -1 < x < 1. % % Operate this matrix on a sin wave and compare the result with the % analytical solution.
N = 17 4 3 2 1 0 1 2 3 4 1 y(x) y(x) D y(x)

0.5

0.5

To do For small N, e.g. N = 7, run with the command line D1 = prog 1(N). Examine
matrix D1 to understand why it dierentiates the vector on which it acts. Vary N and run with the command line D1 = prog 1(N); to examine its behaviour.

1.2
1

prog 2.m

## Repeat this for a 4th order central dierence matrix, D1.

This tutorial is based on one given at JNCASR by Peter Schmid in January 2009

0.5

0.5

## To do Same as for D1 = prog 1(N). Examine matrix D1 to understand why it is more

accurate than that in prog 1. Vary N and compare with the results of prog 1.

1.3

prog 5.m
N=7 3 2 1 0 1 2 3 4 1 y(x) y(x) D y(x)

## Repeat this for a Chebyshev dierentiation matrix

0.5

0.5

To do For small N, e.g. N = 7, run with the command line D1 = prog 5(N). Examine
matrix D1 and note the dierences with those from prog 1 and prog 2. Vary N and compare with the previous results.

2
2.1

Eigenvalue problems
prog 6.m
d2 u + u = 0 dx2

## We will now solve a simple eigenvalue problem:

with homogenous boundary conditions (u = 0 at x = 1). This is the solution for a wave on a string that is held at both ends. The rst eigenvalue corresponds to the fundamental

mode. Higher eigenvalues correspond to higher harmonics. % Calculate the Chebyshev matrix and the 2nd order differential operator matrix. [D,x] = cheb(N); D2 = D^2; % Apply the homogenous boundary conditions D2 = D2(2:N,2:N); % Find the eigenvalues and corresponding eigenvectors [V,Lam] = eig(-D2);

eig 1 =

1.0000000000000*4/pi2

eig 2 =

4.0000000000000*4/pi2

eig 3 =

9.0000000000001*4/pi2

eig 4 =

16.0000000000151*4/pi2

eig 5 =

24.9999999939847*4/pi2

eig 6 =

35.9999998570717*4/pi2

eig 7 =

49.0000063662937*4/pi2

eig 8 =

64.0000448323456*4/pi2

eig 9 =

81.0001741406969*4/pi2

To do Look at how the second order dierence 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 = 1 (harder)?

2.2

prog 7.m
d dx dy dx dy = y dx

## with boundary conditions y = 0 at x = 2 and x = 4.

21.54228846 0.2 0.15 0.1 0.05 0 2 3 329.6766153 0.6 0.4 0.2 0 0.2 2 3 1007.572134 0.4 0.2 0 0.2 0.4 2 3 4 0.6 0.4 0.2 0 0.2 2 4 0.6 0.4 0.2 0 0.2 2 4 0.2 0.1 0 0.1 0.2 2

83.16915382 0.6 0.4 0.2 0 3 514.5572114 0.4 0.2 0 0.2 3 1315.706461 0.6 0.4 0.2 0 3 4 0.2 2 4 0.4 2 4 0.2 2

185.8805961

3 740.5223844

3 1664.925365

## To do Watch the eigenvalues and eigenfunctions change as you increase N.

2.3

prog 9.m

We will now solve the Orr-Sommerfeld eigenvalue problem for planar Poiseuille ow, 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 p40.m in Spectral Methods in Matlab by Lloyd N. Trefethen (SIAM 2000). The Orr-Sommerfeld equation is: R1 d2 u d4 u 2 2 + u 2iu i(1 x2 ) dx4 dx d2 u u dx2 = d2 u u dx2

## with boundary conditions:

du = u = 0 at x = 1 dx We express this as a generalized eigenvalue problem: A = B u u 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 1. The gures below are for 60 Chebyshev points and are created by typing prog 9(60).

eigenvalues for N = 60 0

0.2

0.7 0.6

imag()

0.4

amplitude

0.6

0.8

0.2 0.1

1 0.8

0.6

## 0.4 0.2 real()

0.2

0 1

0.5

0 x

0.5

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.

## The Orr-Sommerfeld-Squire system

This section is a practical demonstration of parts of 2.1 of Peter Schmids 2007 Annual Review paper, Schmid (2007). We will start by considering planar Poiseuille ow 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.1

prog 10.m

We will look at planar Poiseuille ow rst because it can be compared with the previous section. prog 10.m calculates the Orr-Sommerfeld-Squire matrix, which is matrix A in equation (2.1a) of Schmid (2007). 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 10(60,1.0,0.0,5772);. function [OSSQ] = prog 10(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

eigenvalue number = 1 0

0.1

0.2

## OrrSommerfeld eigenfunction 1 amplitude 0 1 2 1 1 0.5 0 0.5 x Squire eigenfunction 1

0.3

0.4

0.5

0.6

0.7

0.8

amplitude

0.9

1 0.8

1 1
0.7 0.6 0.5 0.4 0.3 0.2 0.1 0 0.1 0.2

0.5

0 x

0.5

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 10.m returns the matrix OSSQ. Create your own routine to plot the eigenvalues of OSSQ. Watch out for the scale on your graph.

3.2

PoiMatrix.m

Some of the Orr-Sommerfeld-Squire eigenvalues have little inuence on the behaviour of the system and can safely be discarded. The function PoiMatrix.m cuts out the modes outside a dened 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 Amplication slide of Dan Henningsons notes. This can be run with the command line [Q,invF] = PoiMatrix(60,1.0,0.0,5772);, 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

normal (i.e. has orthogonal 5 4 4 0 2 2i 4 0 0 0.3 + i

This section looks at two simple matrices, one of which is eigenvectors) and the other of which is non-normal: 5 0 0 0 Ann = An = 0 2 2i 0 0 0.3 + i

4.1

## The numerical range

The numerical range is dened on page 136 of Schmid (2007). The maximum protrusion of the numerical range into the unstable half-plane determines the maximum energy growth at t = 0+ 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 An . 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 Ann . The numerical range is loop around the eigenvalues and extends signicantly 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 6 4 2 i 0 2 4 6 8 i unstable region eigenvalues numerical range 6 4 2 0 2 4 6 8 unstable region eigenvalues numerical range a nonnormal matrix

2 r

2 r

To do Make up your own non-normal matrices and plot their eigenvalues and numerical
range.

4.2

## Pseudospectra, a.k.a. the resolvent norm

Pseudospectra and the resolvent norm are dened four dierent but equivalent ways in Trefethen and Embree (2002) and on slide Pseudospectra, resolvents and sensitivity of Dan Henningsons 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 denition, see the rst three chapters of Trefethen and Embree or the video of Nick Trefethens talk at the rst AIM Meeting, available on the AIM website.)

The program RAnPlot.m plots the pseudospectra of An and RAnnPlot.m plots the pseudospectra of Ann . The contours show log10 of the resolvent norm at that value of .
pseudospectra of a normal matrix 6 4 2 i 0 2 4 6 8 i 6 4 2 0 2 4 6 8 pseudospectra of a nonnormal matrix

2 r

2 r

The programs RAnPlot shotgun.m and RAnnPlot shotgun.m plot the pseudospectra of An and Ann followed by the eigenvalues of 100 matrices that have been perturbed by an amount . In the gures below, = log10 (0.2).
pseudospectra of a normal matrix 6
0.6
1.4

## pseudospectra of a nonnormal matrix 6 4 2

.2
0 .6

0.6

1.4
0. 6

1.2

1.2

4
0. 6

0.6
0 .6

0.2 0.2

2
.2
0 0. .6 2

.2

0.8

0.8

0.2

0.2
0.6 1

0. 2

0.6

0.6
1

0.6

0.2

0.4

0.2

0 2
0 .6

0
0 .2

1 0.6 0.2

0.2

0.2

0.4

0.6

0.2

0.2

. 0
0.2

2
0.2

0.2
1 0.6

0.2

0.2
0.6

2 4
0 .6

0.2
0.2

4
0 .6

0.2

.2

0.2

0.4

0.4
0 .6

6 8

0.6

2 r

6 8

2 r

To do Vary

and re-run RAnPlot shotgun.m and RAnnPlot shotgun.m. Repeat for your own non-normal matrices.

4.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 specied by the user. Try TransientGrowth simple(A,[0 5],100).

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.

## Analysis of the Orr-Sommerfeld-Squire matrix

You now have all the tools you need to investigate the Orr-Sommerfeld-Squire matrix with Poiseuille ow as the base ow. Try combining section 4 with section 3. To get you started, the program start.m creates this gure:

Eigenvalues, pseudospectra and numerical range for Poiseuille flow 0 0.2 0.4 i 0.6 0.8 1 1.5 1 r 0.5 0

The Couette directory contains functions that generate the Orr-Sommerfeld-Squire matrix for Couette ow. 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 ow. If you have time, try creating the Orr-Sommerfeld-Squire matrix for your own base ows.