Phys 291 Project - Couette Flow

Project description

The goal of this project is to make a numerical model of the Couette flow - An incompressible flow between two parallell plates where the upper plate is travelling with a constant velocity U relative to the lower plate. The code will be written in C++ and will use ROOT for visualization

Source code

The source code can be downloaded here

Progress log

Here you can read the progress log

Mathematical problem

For an incompressible flow in the x-direction the governing equations (Navier-Stokes eqs.) reduces to ρ u t = μ 2 u t 2 (1)
Where u = u(y) is the velocity of the flow, ρ is density, μ is viscosity and t is time. U is the velocity of the upper plate, y is the distance from the lower plate, and D is the distance between the plates. We've also used the no-slip boundary conditions so that the flow velocity at the lower plate is zero and at the upper plate U.
When written in non-dimensional variables u' = u/U, y' = y/D, t' = t/(D/U) (dropping primes):
ρ u t = 1 Re 2 u t 2 (2)

Numerical procedure

To solve this equation we follow the so-called “Crank-Nicolson” approach, a finite-difference technique which leads to the following equation:
A u j-1 n+1 +B u j n+1 +A u j+1 n+1 = K j (3)
Where
A=- t 2(y ) 2 Re (4)
B=1+ t (y ) 2 Re (5)
K j =[ 1- t ( y ) 2 Re ] u j n + t 2( y ) 2 Re ( u j+1 n + u j-1 n ) (6)
Re is the Reynolds number (=ρDu/μ), j is grid point index, n is iteration step so that the velocities on the left side of eq. (3) are unknown values (next, n+1, iteration step) as function of the known K values. If we chose N+1 grid points (in the y-direction) the separation between the points will be ∆y = D/N.
This set of equations can be set up as a linear matrix equation involving a tri-diagonal matrix,
[ B A 0 0 0 A B A 0 0 0 A B . 0 0 0 . . A 0 0 0 A B ][ u 2 n+1 u 3 n+1 . . u N n+1 ]=[ K 2 K 3 . . K N -AU ]
which can be solved using Thomas' algorithm (see reference for details).

The Program

The program asks the user for values of Reynolds number, number of grid points N and time steps ∆t. Then it calculates (using Thomas' Algorithm) flow velocities in grid points at next time step. For each iteration step to the fourth power (1, 16, 81, 256..) a graph showing the velocity profile is drawn until the final, steady state is achieved. This happens when the velocities at all grid points doesn't deviate from the linear velocity distribution more than some accuracy epsilon (set to 0.001). At the end, the steady state solution is drawn.
The parameter E= t Re( y ) 2 is important for the numerical behavior of the code. The code will be stable as long as E is less than about 4000. although when E is large, we will get some nonphysical transient results but still obtain the correct steady state solution. Even for E equal to 4 or 5 we see some strange velocities near the upper plate after the first step.
For low values of E (<5) we have timewise accurate solutions, meaning that at same total relative time t, we have the same velocity distribution even though we use different sizes of the time steps. How many iteration steps we need is also dependent on E, and it turns out that E approximately equal to 10 is when we need the fewest amount of iteration steps to reach the steady state and therefore use the least computer power.

Results and Plots

Underneath one can see screenshots of the velocity profile with E = 1 (figure 1), E = 4 (figure 2), E = 10 (figure 3) and the extreme case when E = 4000 (figure 4)
image: 0_Home_stud5_tsv065_Screenshot-Untitled_Window.png
image: 1_Home_stud5_tsv065_Screenshot-Untitled_Window-4.png
image: 2_Home_stud5_tsv065_Screenshot-Untitled_Window-1.png
image: 3_Home_stud5_tsv065_Screenshot-Untitled_Window-3.png

Outline

It has been good practice for me to get a feeling for simple CFD through working with the Couette Flow, and also to get familiar with some of the possibilities that comes with ROOT. In addition to what I did I also wanted to do a vector plot. Unfortunately I wasn't able to do this in ROOT.

Reference

Anderson, John D., Jr: “Computational Fluid Dynamics - The Basics with Applications”, International Editions 1995