You are on page 1of 5

CFD with Excel

By Sergio E. Perez, Ph.D. Copyright 2005. No part of this document may be reproduced in any way without the authors consent.

Its possible to do some simple CFD cases using Excel for the purpose of illustration Excel is not recommended for complex CFD problems. However, Excels ability to easily copy formulas repeatedly can make it quite useful for solving simple cases such as Couette flow. Case 1: Steady Couette Flow We recall from A First Course in Computational Fluid Dynamics, that the governing equation for couette flow is: d 2u =0 dy 2 We apply the finite difference approximation to the equation above: u y +1 2u y + u y 1 d 2u =0= 2 dy y 2 and solving for u:
u y = (u y +1 + u y 1 ) / 2 The result is a series of simultaneous equations. Lets suppose that the flow is broken up into 4 regions between the parallel plates, and that the top plate is moving at 100 m/s. As you will recall, the bottom plate is stationary. We then have the following equations: u6 = 0 u 5 = (u 6 + u 4 ) / 2 u 4 = (u 5 + u 3 ) / 2 u 3 = (u 4 + u 2 ) / 2 u 2 = (u 6 + u 4 ) / 2 u1 = 100 We will solve these equations by Gauss-Seidel iteration, as covered in the book referenced above. Briefly, this involves setting initial guesses to the unknown speeds at

nodes 2-5, and then looping through the equations, updating the unknown values each loop. Excel cells will represent each node, and the known values and guessed values are filled into each cell. Here, a guess of 1 will be used for nodes 2-5:

Next we place the formula for node 2 into cell B2:

Note that the formula is the average of the two values above and below it. We do the same for the next cell:

Theres no need to type in the remaining cell values. The beauty of Excel is that it will change the cell numbers for you when you copy to different cells. Simply highlight B2, and drag the lower right corner down two more cells. The formula from B2 should have been copied into B3 and B4, with the values updated. Now its only a matter of copying all of the unknown cells to the right. These will be the Gauss-Seidel iterations. We will do this by highlighting all of the unknown cells, and dragging the lower right hand corner about 50 or so cells to the right. If 50 is not enough (as shown by lack of convergence), then keep going further. The figure below shows the results:

It looks like we are pretty close to the linear velocity profile which is expected.

Case 2: Unsteady Couette Flow The governing equation for unsteady Couette flow is:

u 2u = 2 t y

When finite differences are applied to this, we obtain (again, please consult the reference text for more information if you have any questions about where these equations come from):

u y ,t +1 =

t u y +1,t 2u y ,t + u y 1,t y 2

] + u y ,t

[1]

We will solve the same problem as before, assuming that the constant in front of the parentheses is 0.1. The long-range solution should approach the steady-state solution above a linear velocity distribution. Initially, the speed everywhere is zero, and at time zero the top plate is suddenly moving at 100 m/s. We input these values into cells A1-A5. We then apply the appropriate formula to cell B2, as given by equation(1). In words, the speed at any time step is a function of the speeds at the same node, the nodes above, and the nodes below, at the previous time step.

We then highlight B2, and copy it into the cells B3-B4 below it. Row 1 is set to 100 for a large number of rows to the right, and row 5 is set to zero for a large number of rows to the right. We now highlight cells B2-B4, and copy them a large number of cells to the right. How far is far enough? When you see the answer converging. If the numbers appear to be still changing, copy more cells to the right. The result is below:

You can see that we are approaching the expected linear velocity distribution. If you are a stickler for details, you might want to continue further than the author did.

You might also like