1 Introduction

The linear stability analysis of plane Poiseuille flow is a classical problem in fluid dynamics. Plane Poiseuille flow refers to the laminar fully-developed flow of an incompressible Newtonian fluid between two parallel plates driven by a constant pressure gradient. The governing equations for the problem are the Navier-Stokes equation, which describes the local momentum balance, and the continuity equation, which describes the local mass balance and constrains the velocity field to be solenoidal. For the linear stability analysis, small perturbations around the base flow are considered. A detailed account of this analysis and its physical background can be found in several books such as [1] or [2].

The core of the linear stability analysis is the fourth-order differential eigenvalue problem well-known as the Orr–Sommerfeld problem. The critical Reynolds number for the linear instability of plane Poiseuille flow is approximately \(Re_c \approx 5772\) [2]. Below this critical Reynolds number, the flow is linearly stable and, above it, the flow is unstable. It must be stressed that linear stability analysis provides insights into the onset of instability, but it may not fully capture the complete mechanisms of transition, which often involve nonlinear effects and the development of finite-amplitude disturbances. On this topic, there are recent interesting investigations carried out in [3, 4] and [5].

The aim of this paper is to present a tutorial that provides all the details to achieve an accurate numerical solution for the Orr–Sommerfeld problem relative to the linear stability of the plane Poiseuille flow in a channel. The pedagogical approach adopted in this paper is meant to provide the reader with all the coding details needed for reproducing the numerical data presented. For the sake of brevity, we decided to refer the reader to textbooks for the underlying physical problem, as it is a cornerstone topic of fluid mechanics widely and effectively presented by many authors [1, 2]. Likewise, the basic results, such as the focus on the two-dimensional modes established by Squire’s theorem, leading to the formulation of the Orr–Sommerfeld eigenvalue problem can be found, for instance, in [1] or [2]. Our scope is limited to the numerical solution of the linear stability eigenvalue problem which is, in most cases, not described in all its details. Furthermore, we have chosen to adopt a numerical method which differs from that universally employed for this type of differential eigenvalue problems, namely the tau-method [6,7,8,9]. In the formulation of the method, we got inspired by the excellent paper from Fujimura and Kelly [10] where, however, not much details were provided regarding the solution technique. Step-by-step, the whole numerical procedure is described and implemented by providing its coding in the Mathematica language [11].

2 Definition of the problem

We consider the Orr–Sommerfeld eigenvalue problem defining the linear instability of the Poiseuille flow in a plane channel. Further details can be found in such papers as [6, 10, 12] as well as in textbooks such as [1] or [2].

The base dimensionless velocity profile for the flow along the x direction is given by

$$\begin{aligned} U(z) = 1 - z^2 \qquad -1 \le z \le 1, \end{aligned}$$
(1)

with z the transverse dimensionless coordinate.

The Orr–Sommerfeld problem associated with the base velocity profile (1) is formulated as

$$\begin{aligned}{} & {} \frac{1}{Re} \left[ \phi ''''(z) - 2 \alpha ^2 \phi ''(z) + \alpha ^4 \phi (z) \right] - i \alpha U(z) \left[ \phi ''(z) - \alpha ^2 \phi (z) \right] + i \alpha \, U''(z) \phi (z) \nonumber \\{} & {} \quad = c \left\{ - i \alpha \left[ \phi ''(z) - \alpha ^2 \phi (z) \right] \right\} , \end{aligned}$$
(2)
$$\begin{aligned}{} & {} \phi (\pm 1) = 0 \qquad \phi '(\pm 1) = 0, \end{aligned}$$
(3)

where Re is the Reynolds number for the Poiseuille flow (1), \(\alpha\) and c are the real wavenumber and the complex phase speed of the streamfunction disturbances, while the primes denote derivatives with respect to z. We mention that the dimensionless velocity U(z) has been scaled with the maximum base flow value, occurring at \(z=0\), while the dimensionless coordinate z has been scaled by the channel half-width. Such reference scales for the velocity and length are those adopted for the definition of the Reynolds number. The eigenfunction \(\phi (z)\) defines the streamfunction perturbation relative to the base flow given by (1),

$$\begin{aligned} \Phi (x,z,t) = \phi (z) \, e^{i \alpha \left( x - c\, t\right) } \quad \alpha \in \mathbb {R} \quad c \in \mathbb {C}, \end{aligned}$$
(4)

where t is time. With the eigenvalue given by \(c = c_r + i\, c_i\), the transition to linear instability happens when \(c_i\) changes from negative to positive.

3 Numerical solution

The solution of (2, 3) is obtained numerically as follows. Let us express the eigenfunction \(\phi (z)\) as

$$\begin{aligned} \phi (z) = \sum _{n=0}^{N} a_n \, \psi _n(z). \end{aligned}$$
(5)

Here, \(\psi _n(z)\) are basis functions satisfying the boundary conditions (3). A convenient choice is suggested in [10],

$$\begin{aligned} \psi _n(z) = \left[ U(z)\right] ^2 T_{2n}(z), \end{aligned}$$
(6)

where \(T_{2n}(z)\), with \(-1 \le z \le 1\), are the Chebyshev polynomials defined as

$$\begin{aligned} T_{2n}(\cos \theta ) = \cos (2 n \theta ) \qquad \theta \in \mathbb {R}. \end{aligned}$$
(7)

A sketch of the first five basis functions \(\psi _n(z)\) is displayed in Fig. 1.

We introduce the shorthand notation,

$$\begin{aligned} \langle f, g \rangle = \int \limits _{-1}^{1} f(z)\, g(z) \, \textrm{d}z. \end{aligned}$$
(8)

Then, (2) can be rewritten as

$$\begin{aligned} \sum _{n=0}^N A_{m n} \, a_n = c \sum _{n=0}^N B_{m n} \, a_n, \end{aligned}$$
(9)

where

$$\begin{aligned} A_{m n}= & {} \frac{1}{Re} \left[ \langle \psi _m, \psi _n'''' \rangle - 2 \alpha ^2 \langle \psi _m, \psi _n'' \rangle + \alpha ^4 \langle \psi _m, \psi _n \rangle \right] - i \alpha \langle \psi _m, U \psi _n'' \rangle \nonumber \\{} & {} +\ i \alpha ^3 \langle \psi _m, U \psi _n \rangle - 2 i \alpha \langle \psi _m, \psi _n \rangle , \nonumber \\ B_{m n}= & {} - i \alpha \left[ \langle \psi _m, \psi _n'' \rangle - \alpha ^2 \langle \psi _m, \psi _n \rangle \right] . \end{aligned}$$
(10)

In matrix notation, by using A for the \((N+1) \times (N + 1)\) matrix with elements \(A_{m n}\), B for the \((N+1) \times (N + 1)\) matrix with elements \(B_{m n}\) and a for the eigenvector \((a_0, a_1, a_2, \ldots , a_N)\), we can rewrite (9) as the generalised eigenvalue problem

$$\begin{aligned} A \cdot a = c\; B \cdot a. \end{aligned}$$
(11)

The matrix A depends on the parameters \((\alpha , Re)\), while B depends only on \(\alpha\).

Fig. 1
figure 1

Plots of the first five basis functions \(\psi _n(z)\)

4 Numerical code

The Mathematica coding of the generalised eigenvalue problem (11), is obtained by defining the matrices A and B as follows:

figure a

provided that the order N of the approximation must be less than or equal to the prefixed value \(\texttt {NN = 35}\) and prescribed by the variable \(\texttt {M}\) in the definition of the matrices A and B. Then, the eigenvalues of the generalised problem (11) are determined, for the sample case where \(\alpha =1.02055, Re=5772.222\), with

figure b

Function SortBy serves to order the eigenvalues with an increasing imaginary part. Thus, the last element of the list is the eigenvalue c having the largest growth rate \(c_i\). In this example, with M = 30, the output is

figure c

It is the last eigenvalue c in the list that displays \(c_i > 0\) and, hence, instability. In fact, the critical condition for instability is, according to [10],

$$\begin{aligned} (Re_c,\ \alpha _c,\ c_{rc}) = (5772.221816,\ 1.02054744,\ 0.2640002605). \end{aligned}$$
(12)

As a cross-check, with \(\alpha =1.02055, Re=5772.221\), the eigenvalues are evaluated with

figure d

again with M = 30. This yields the output

figure e

As expected, all eigenvalues have \(c_i < 0\) in this case.

In the lists displayed above, only the last eigenvalue (that with a maximum \(c_i\)) is relevant for determining the transition to linear instability. In order to get just that eigenvalue, one can employ function Last,

figure f

with the output

figure g

A fine tuning in the determination of the neutral stability threshold for a given \(\alpha\) can be obtained by gradually increasing Re with a Do loop,

figure h

The output is

figure i

with the transition to instability within \(Re = 5772.2218\) and \(Re = 5772.2219\).

A direct evaluation of the neutral stability value of Re can be obtained by stopping the Do loop at the first iteration where \(c_i > 0\). This is obtained with Break[]. Then, the code

figure j

yields the output

figure k

where the first entry is \(\alpha\) and the third entry is \(c_r\).

By varying the value of \(\alpha\), one can now get the data needed for drawing the neutral stability curve in the \((\alpha , Re)\) plane. This is achieved by running a Do loop over a varying \(\alpha\),

figure l

so that we obtain the output

figure m

By collecting the neutral stability data in this way, one can draw the neutral stability curve (see Fig. 2).

Fig. 2
figure 2

Neutral stability curve

5 Convergence test

A convergence test of the method can be done by changing the order N of the approximation, namely the variable M, with the code

figure n

The output is

figure o

which shows that the output remains unchanged for every value of M larger than 22.

It is only slightly less accurate when considering larger values of Re as, say, \(Re = 2\cdot 10^4\),

figure p

The output is

figure q

An interesting convergence test is carried out for \(\alpha = 1\) and \(Re = 10000\) by a comparison with the table reported in [12], where the author compares his results with those reported in [6]. This comparison is displayed in Table 1. It reveals a quite satisfactory agreement and a convergence comparable or slightly better than that displayed by the solution reported in [12]. In fact, [12] declares \(N + 1 = 25\) terms to be solved for in order to attain 8 significant figures accuracy, while the present method yields the same result with \(N + 1 = 24\) terms. For the sake of completeness, the numerical solution in [6] requires \(N + 1 = 29\) terms to achieve the same accuracy.

Table 1 The most unstable eigenvalue c for \(\alpha = 1\) and \(Re = 10000\)

6 Conclusions

A numerical solution of the Orr–Sommerfeld eigenvalue problem for the linear stability of the Poiseuille flow in a plane channel has been presented in detail. The solution is obtained by an expansion of the eigenfunctions in series of basis functions expressed in terms of Chebyshev polynomials. All the details of the numerical method, inspired by the study reported in [10], have been presented. Furthermore, the coding of the numerical method in Mathematica has been described step-by-step. A pedagogical approach has been chosen in order to fill a gap in the literature where the details of the numerical method and its coding are in many cases omitted. The convergence in the numerical evaluation of the eigenvalues has been tested and compared with sample data reported by other authors. The comparison revealed that our numerical solution yields an accurate determination of the most unstable eigenvalue with a number of terms in the polynomial expansion less or equal to that reported in [6] and in [12]. Another advantage of the numerical solution presented here, with respect to other numerical solutions available in the literature mostly based on the tau-method, is its evidently simpler formulation. The reason is that the basis functions are chosen so that they satisfy the boundary conditions. The same method can be extended to other situations where there is a thermal coupling in the momentum balance such as in convection heat transfer problems [10], or in other hydrodynamic instability problems where velocity boundary conditions departing from the no-slip conditions are considered.