Introduction to Engineering Computing
Lab Workshop #5
set up two circular calculations using Excel’s iterative solver
solve a nonlinear equation using the "live solution" bisection technique
The focus of this exercise is solving algebraic equations using Excel. These are "bread-and-butter"
techniques that you will be able to use over and over again in your science and engineering courses.
1. Launch Excel 2007 with a new, blank workbook. Enter your name, lab section and the date in the
upper left corner of the worksheet.
The following equation is used to calculate the Fanning friction factor, f , for flow of fluids inside
4 log10 Re f 0.4
(von Karman equation)
The other parameter in the equation is the Reynolds number, and this equation is valid for Re values
greater than 3000 (or so).
The point of this exercise is to set up a spreadsheet that solves for the value of f , given a value for
Pick a cell for the Reynolds number and name it Re. Also, put a label Re in an adjacent cell.
Enter a value of 100000 in the Re cell.
Pick another cell nearby and name it fstart. Also, put a label fstart in an adjacent cell. Enter a value
of 0.001 in the fstart cell.
Rearrange the equation above to solve for the f on the left-hand side. That will give you a formula
for f that involves
and f .
Enter that formula in a cell, using the fstart cell for f and the Re cell for Re . Name the cell that
contains the formula f and place a label f in an adjacent cell. The displayed result in f should be
different from the fstart value of 0.001.
You will now set up the iterative solver. You get to this via Office Button Excel Options
Formulas. Click on the Enable iterative calculation box to check it. Set Maximum Iterations to 1. Set
Maximum Change to 0.00001. Click OK.
Back on the spreadsheet, replace the value in the fstart cell with the pointer formula
The value that was in the f cell should now appear in the fstart cell, and a new value should appear in
the fstart cell. Press the F9 key a few times, counting the times, until the two values are the same.
Go back to the Formulas settings and change the Maximum Iterations to twice the number of times
you pressed the F9 key. Click OK.
Enter a new value in the Re cell and see that the fstart and f cells immediately converge to the same
value. This implements the iterative solver to find the value of the Fanning friction factor from the von
Complete the table below:
Save this workbook as Lab5a.xlsx and close it out.
2. Now, you will use the iterative solver to tackle a bigger problem. Imagine a thin metal fin attached to a
heated wall (at 200C) where the fin is surrounded by well-mixed water (at 30C), as shown below,
Wall at 200C
Thin Metal Fin
Fin surrounded by
water at 30C
What we want to do here is to solve for the temperature distribution in the cross-section of the fin
represented by the yellow rectangle above. It will be easier to fit this on a spreadsheet if we tip the
diagram so the fin is pointing up. You will set up a spreadsheet that is laid out like the diagram below.
Set up your worksheet following this pattern and as shown below.
In order to solve for the temperature at a cell location in the fin, we make use of a simple concept that
the temperature is equal to the average of the temperatures of the surrounding four cells. Enter this
formula first in the upper left cell of the fin, C4 on the spreadsheet above, as shown below.
This will give the result 15 when you press Enter. Before you copy this formula throughout the fin, you
need to set up the Iterative Solver. This setup is shown below.
Now, you can copy the formula throughout the interior of the fin. It may be easiest to do this by dragcopying across the top with the fill handle,
and then drag-copy that selection down with the fill handle. The temperatures should calculate
automatically and converge, as shown on the next page.
This is a massive iterative calculation, since the formulas in all these cells are interdependent, but
Excel handles it with no problem at all.
Select the fin cells, not the cells representing the water (30) and the wall (200), and create a surface
plot. You can find this via Insert, as shown to the right.
Move this chart to its own sheet. With the chart selected, on the Layout ribbon,
select 3D Rotation. Experiment with the settings to obtain a better 3D view of
the temperature distribution in the fin, similar to the one below.
Add a title to the chart with your name and lab section. Make a print-out of your chart and hand it in
with your lab workshop sheet. Save your workbook file as Lab5b.xlsx and close it out.
3. Open a new workbook file. From CULearn, open the Class08.doc class notes. By following the
notes, starting on slide 31, create the spreadsheet that solves for the liquid depth in the spherical tank.
When you complete slide 50, use your spreadsheet to complete the table below:
Add the case study, as described on slides 51-55.
Save your workbook file as Lab5c.xlsx, but don’t close it out.
4. Consider the nonlinear equation,
2 x 1 0
that has a solution between x = 0 and x = 2. Convert the Lab5c.xlsx spreadsheet over to solve this
equation. Remove any extraneous content having to do with the spherical tank problem. Adjust the
number of iterations of the method to that appropriate for an accurate solution.
What is the solution for x that you have determined? _____
“Save As” (F12 key) your workbook as Lab5d.xlsx and close it out.
3. Save you Lab5a.xlsx, Lab5b.xlsx, Lab5c.xlsx, and Lab5d.xlsx workbooks file to your K: drive
End of Lab Workshop #5