computer-aided thermofluid analyses using excel

280
HAL Id: halshs-02289507 https://halshs.archives-ouvertes.fr/halshs-02289507v2 Preprint submitted on 24 Jan 2021 HAL is a multi-disciplinary open access archive for the deposit and dissemination of sci- entific research documents, whether they are pub- lished or not. The documents may come from teaching and research institutions in France or abroad, or from public or private research centers. L’archive ouverte pluridisciplinaire HAL, est destinée au dépôt et à la diffusion de documents scientifiques de niveau recherche, publiés ou non, émanant des établissements d’enseignement et de recherche français ou étrangers, des laboratoires publics ou privés. Computer-Aided Thermofluid Analyses using Excel Mohamed Musadag El-Awad To cite this version: Mohamed Musadag El-Awad. Computer-Aided Thermofluid Analyses using Excel. 2021. halshs- 02289507v2

Upload: others

Post on 02-Nov-2021

9 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Computer-Aided Thermofluid Analyses using Excel

HAL Id: halshs-02289507https://halshs.archives-ouvertes.fr/halshs-02289507v2

Preprint submitted on 24 Jan 2021

HAL is a multi-disciplinary open accessarchive for the deposit and dissemination of sci-entific research documents, whether they are pub-lished or not. The documents may come fromteaching and research institutions in France orabroad, or from public or private research centers.

L’archive ouverte pluridisciplinaire HAL, estdestinée au dépôt et à la diffusion de documentsscientifiques de niveau recherche, publiés ou non,émanant des établissements d’enseignement et derecherche français ou étrangers, des laboratoirespublics ou privés.

Computer-Aided Thermofluid Analyses using ExcelMohamed Musadag El-Awad

To cite this version:Mohamed Musadag El-Awad. Computer-Aided Thermofluid Analyses using Excel. 2021. �halshs-02289507v2�

Page 2: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad

Computer-Aided Thermofluid

Analyses Using Excel

Page 3: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

Computer-Aided Thermofluid Analyses

Using Excel

Page 4: Computer-Aided Thermofluid Analyses using Excel

Comouter-Aided Thermofluid Analyses Using Excel

Computer-Aided Thermofluid Analyses

Using Excel

Mohamed M. El-Awad

Associate Professor,

University of Technology and Applied Sciences

College of Applied Sciences, Sohar

Page 5: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

Page 6: Computer-Aided Thermofluid Analyses using Excel

Comouter-Aided Thermofluid Analyses Using Excel

This book is dedicated to the memory of my parents

Amna and El-Awad

May Allah bless their souls in Heaven

Page 7: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

January, 2021

The Thermax add-in can be downloaded from:

https://www.researchgate.net/publication/334959438_Thermax

Page 8: Computer-Aided Thermofluid Analyses using Excel

Comouter-Aided Thermofluid Analyses Using Excel

Preface

Microsoft Excel is a general-purpose application that is taught to engineering students

in the introductory courses on computer applications. The powerful tools of Excel for data analysis and visualisation, together with its wide availability and simplicity,

encouraged its use as an educational tool in various engineering subjects. With respect

thermofluid analyses, a number of articles and research papers have been presented in this regard at various conferences and specialised publications over the past two

decades. The lack of built-in functions in Excel for fluid properties also motivated a

number of academic institutions and individual researchers to develop relevant Excel

add-ins. However, a textbook that presents a general pedagogical approach for using Excel as a platform for computer-aided thermofluid analyses and provides the lecturers

and students with sufficiently detailed examples and exercises has, so far, been missing.

The aim of this book is to complement the previous efforts by gathering the information needed for using Excel as an effective modelling platform for various types of

computer-aided thermofluid analyses.

The Excel-based modelling platform described in the book has four elements; (i) Excel with its user-interface and built-in functions, (ii) the integrated programming language

Visual Basic for Applications (VBA), (iii) the Solver add-in that comes with Excel, and

(iv) an Excel add-in for fluid properties called Thermax. While Excel and Solver are adequate for most fluid mecanics and heat-transfer analyses, the Thermax add-in helps

the students to perform thermodynamic analyses with Excel in an effective and accurate

manner. VBA is needed for the development of custom functions when the analytical

model cannot be executed by only using Excel‟s built-in functions and Thermax functions. Proper use of the Excel-based modelling platform minimises the effort of

developing the analytical model so that more attention can be paid to the application of

the physical and economic principles in thermofluid analyses.

The first three chapters of the book review the basic principles of thermofluid analyses

and describe the four components of the Excel-based modelling platform. Chapter 4 is

also a general chapter that shows how Excel and its iterative tools can be used for performing iterative solutions in the three thermofluid areas. The following six chapters

apply the platform for particular types of thermofluid analyses. Chapters 5 and 6 are

dedicated to the hydraulic analyses of pump-pipe systems and pipe-networks, while Chapters 7 and 8 deal with heat-transfer analyses by focussing on the numerical

solution of the heat-conduction equation by using the finite-difference method. The

application of the Excel-based platform for thermodynamic analyses is demonstrated in Chapters 9 and 10 that use the property functions provided by the Thermax add-in for

ideal gases and refrigerant fluids for dealing with the analyses of power-generation and

refrigeration cycles.

The book adopts a learning-by-example approach and most of its examples are based on

relevant cases or examples given in popular thermofluid textbooks so that the students

Page 9: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

can verify their Excel solutions and look for additional applications. Exercises are given at the end of each chapter that help students to sharpen their skills related to the

particular topic.

The material covered in the book is adequate for a stand-alone course on computer-

aided thermofluid analyses, but the book can also be used to supplement the existing

relevant courses by selecting certain chapters or sections from it. Although the book is primarily meant for educational purposes, it is hoped that the material covered in the

book can also be useful for practicing engineers in the area of thermofluid systems.

Acknowledgements The writing of this book would not have been possible without benefitting from the

efforts of many colleagues who have made their information and software available in

the open literature or their websites. In this respect, a special gratitude goes to the Mechanical Engineering Department at the University of Alabama (USA) whose

initiatives both inspired and helped me throughout the preparation of the book. I am

also indebted to my colleagues and students at the College of Applied Sciences in Sohar

and hope that they find this book a worthy token of appreciation and gratitude. Last, but not least, I am grateful to my beloved family, Ghada, Ahmed, and Ula, for their

tolerance and unfailing support that I desperately needed to complete this work.

Page 10: Computer-Aided Thermofluid Analyses using Excel

Comouter-Aided Thermofluid Analyses Using Excel

CONTENTS

Nomenclature xi

1. Introduction 1

1.1. A review of thermofluid principles 2

1.1.1. Thermodynamics 2 1.1.2. Fluid dynamics 7

1.1.3. Heat transfer 10

1.2. Advantages of computer-aided thermofluid analyses 13

1.3. The Excel-based modelling platform for thermofluid analyses 16 1.4. Closure 18

References 19

2. Excel 20

2.1. Elements of Excel‟s user-interface 21

2.2. Excel‟s formulae 22

2.2.1. Cell reference by location 22 2.2.2. Use of cell labels 24

2.3. Excel‟s built-in functions 27

2.3.1. Logical functions 28 2.3.2. Functions for matrix operations 29

2.4. Solution of linear systems of equations 33

2.5. Iterative solutions with Excel 35

2.5.1. Iterative solutions with Goal-Seek 35 2.5.2. Iterative solutions with circular calculations 37

2.6. Excel‟s graphical tools for data presentation and analysis 40

2.7. Closure 43 References 43

Exercises 44

3. Solver, VBA, and Thermax 47 3.1. Solver 48

3.1.1. Activation of Solver 48

3.1.2. The GRG Nonlinear method50 3.1.3. The Evolutionary method 52

3.1.4. The Simplex LP method 54

3.1.5. The default settings of Solver options 56 3.2. VBA and the development of user-defined functions 58

3.2.1. Activation of VBA 59

3.2.2. Development of UDFs 61

3.3. Thermax installation and use 63 3.4. Closure 67

References 67

Page 11: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

Exercises 68

4. Iterative solutions 71

4.1. Iterative solutions by using Goal Seek 72 4.1.1. Type-2 and type-3 pipe flow analyses 72

4.1.2. Thermodynamic analyses involving ideal-gas mixtures 74

4.1.3. Convection heat-transfer analyses 77 4.2. Constrained iterative solutions with Solver 80

4.3. Iterative solutions involving nonlinear equations 87

4.4. Closure 89

References 89 Exercises 90

5. Hydraulic analyses of multi-pipe and pump-pipe systems 93 5.1. Analyses of multi-pipe systems 94

5.1.1. Tyep-1 flow analyses 95

5.1.2. Type-2 and type-3 flow analyses 99

5.2. The operating point for a pump-pipe system 101 5.2.1. A centrifugal pump connected to a single pipe 101

5.2.2. A centrifugal pump connected to two branching pipes 105

5.2.3. A centrifugal pump connected to a simple pipe-network 108 5.3. Centrifugal pumps in serial and parallel arrangements 112

5.3.1. Two centrifugal pumps connected in parallel 112

5.3.2. Two centrifugal pumps connected in series 115

5.3.3. A comparison of serial and parallel pump arrangements 117 5.4. Closure 118

References 118

Exercises 118

6. Hydraulic analyses of pipe networks 123

6.1. The methodology of looped pipe-network analysis 124

6.2. Analyses of looped pipe networks by Excel-Solver 129 6.3. Analyses of branched pipe networks by Excel-Solver 137

6.4. Analyses of mixed pipe networks by Excel-Solver 141

6.5. Closure 145 References 146

Exercises 146

7. Finite-difference solution of the steady heat-conduction equation 149

7.1. Analytical solutions of the steady one-dimensional conduction equation 150

7.2. Application of the FD method to the steady 1D conduction equation 152

7.3. Dealing with various boundary conditions 155 7.4. Conduction with heat-generation 157

7.5. Two-dimensional steady heat conduction 160

Page 12: Computer-Aided Thermofluid Analyses using Excel

Comouter-Aided Thermofluid Analyses Using Excel

7.6. Application of the FD method using Excel‟s iterative calculation option 164 7.7. Closure 166

References 167

Exercises 167

8. Finite-difference solution of the transient heat-conduction equation 170

8.1. Transient 1D conduction: the explicit FTCS formulation 171 8.2. Transient 1D conduction: the implicit BTCS formulation 175

8.2.1. Application of the BTCS scheme by assembling the linear system 176

8.2.2. Application of the BTCS scheme by using iterative calculations 178

8.3. Transient 2D heat conduction: A general formulation 178 8.4. The explicit FTCS scheme for 2D conduction 180

8.5. The implicit BTCS scheme for 2D conduction 184

8.6. Closure 187 References 187

Exercises 188

9. Thermodynamic analyses of gas power cycles 191 9.1 The ideal Brayton cycle 192

9.2 The regenerative Brayton cycle 196

9.3 Energy analysis of the Otto cycle 200 9.4 Exergy analysis of the Otto cycle 203

9.5 Closure 206

References 207

Exercises 207

10. Analyses of simple and multi-stage compression VCR cycles 209

10.1. The ideal vapour-compression refrigeration cycle 210 10.2. The actual vapour-compression refrigeration cycle 213

10.3. Optimisation analysis of the two-stage compression cycle 215

10.3.1. The analytical model 215

10.3.2. The optimisation analysis 217 10.4. Optimisation analysis of the three-stage compression cycle 220

10.4.1. The analytical model 222

10.4.2. The optimisation analysis 222 10.5. Closure 224

References 225

Exercises 225

Appendices 227

Appendix A: Properties of air and liquid water at atmospheric pressure 228

Appendix B: The numerical tools provided by Thermax 230 Appendix C: Application of the Hardy-Cross method with Excel 238

Appendix D: Analysis of a gravity-driven network with eight loops 246

Page 13: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

Appendix E: Finite-difference analysis of heat transfer from a triangular fin 252 Appendix F: Macros and VBA functions for applying the finite-difference method

with Excel 258

Subject index 264

Page 14: Computer-Aided Thermofluid Analyses using Excel

Comouter-Aided Thermofluid Analyses Using Excel

Nomenclature

A Area

C Friction coefficient in Hazen-Williams equation, Equation (1.28)

cp Specific heat at constant pressure, kJ/kg·oC

cv Specific heat at constant volume, kJ/kg·oC

D Diameter

E Total energy of the system

e Energy per unit mass of the system EG Total energy generated in the system

eG Energy generated per unit volume

f Darcy friction factor, defined by Equation (1.21) f Manning friction factor, defined by Equation (1.27)

FD Drag force, defined by Equation (B.2)

g Acceleration of gravity h Average heat-transfer coefficient

h Enthalpy, kJ/kg

hf Major friction in a pipe system

k Thermal conductivity, W/m·oC

k Isentropic exponent, dimensionless (k=cp /cv)

K Minor losses friction coefficient in a pipe system, defined by Equation (1.29)

L Length m Mass ̇

m Mass rate of flow

P Pressure, usually in kPa

Pr Relative pressure (for an ideal gas) q Heat-transfer per kg of the working fluid, usually kJ

Q Heat, usually in kJ

Q Volume flow rate

Q Rate of heat transfer, W or kW

r Radius or radial distance

R Gas constant, kJ/kg.K

Rth Thermal resistance, usually oC/W

Ru Universal gas constant kJ/kmol.K

s Entropy

T Temperature u Internal energy per unit mass, kJ/kg

U Overall heat-transfer coefficient of a heat-exchanger

v Specific volume, m3/kg

V Velocity, usually m/s w Work-done per kg of the working fluid, usually kJ

W Power, W or kW

x,y,z Space coordinates in the Cartesian system

Page 15: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

Greek Characters γ Specific weight of a fluid

δ Thickness (e.g. of insulation)

∆ Difference (e.g. temperature) ε Roughness of surface material

ε Heat-exchanger effectiveness

η Efficiency μ Dynamic viscosity, kg/m.s

ν Kinematic viscosity, m2/s

ρ Density, kg/m3

Time, annual operating hours of a system

Mesh Fourier number in the finite-difference method, defined by Equation (8.6)

Dimensionless Numbers and Groups

Bi Biot number

Cf Friction coefficient, defined by Equation (B.3)

Fi Fourier number Nu Nusselt number

Pr Prandtl number

Re Reynolds number

Subscripts

f Saturated liquid condition fg Difference in property between saturated liquid and saturated vapour

g Saturated vapour condition

lm Log-mean

s Saturation temperature or pressure s Evaluated at the surface

∞ Evaluation at free-stream ambient conditions

Page 16: Computer-Aided Thermofluid Analyses using Excel

Comouter-Aided Thermofluid Analyses Using Excel

1

Introduction

Page 17: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

Cars, refrigerators, and air-conditioners have become indispensible items for families in both developed and developing countries. The energy required to operate these systems

mainly comes from burning fossil fuels in power-generation plants. Apart from being

non-renewable energy sources, large-scale combustion of fossil fuels is the main cause for global warming and its increasingly devastating effects at different parts of the

world. Therefore, proper design and operation of these and other energy-demanding

devices are required for minimising these effects. The design methods of these systems are mainly based on the principles of thermodynamics, fluid mechanics, and heat

transfer. This chapter reviews the main principles of these three thermofluid subjects

with the objective of showing how they can be used to reduce the losses and minimise

energy consumption. For a number of reasons the equations involved in thermofluid analyses are difficult to solve without using computer-aided methods. Therefore, these

analyses introduce many simplifications that reduce their accuracy. In this respect, the

chapter highlights the advantages of computer-aided methods for thermofluid analyses and describes the Excel-based modelling platform used in this book for these analyses.

1.1. A review of thermofluid principles

The two main principles that form the framework for thermofluid analyses are the conservation of mass (the continuity equation) and the conservation of energy (the first-

law of thermodynamics). These principles take different mathematical forms depending

on whether the system under consideration is open or closed and on whether the flow is steady or unsteady, compressible or incompressible, laminar or turbulent, etc.

Numerous auxiliary relationships are needed in order to quantify the various parameters

involved in the resulting equations such as pressure-variations, friction losses, and rates

of heat-transfer. In what follows, the main concepts of thermodynamics, fluid dynamics, and heat-transfer are reviewed by considering typical applications.

1.1.1. Thermodynamics

The principles of engineering thermodynamics allow us to determine the amount of energy transfer in the form of work or heat between any system and its surroundings.

They also allow us to determine the efficiency and effectiveness of the system if energy

conversion is involved. There are four basic laws for thermodynamics the most important of which are the first and the second laws of thermodynamics. To apply these

two basic laws, thermodynamic analyses use many property relationships, tables, and

charts that determine the properties of the particular fluid involved and its phase (a liquid, a liquid-vapour mixture, a gas, or a gaseous mixture). To illustrate the

application of thermodynamic laws and relationships in a typical analysis, consider the

air-compression system shown in Figure 1.1.a. Air enters the system that has two stages

of compression separated by an intercooler at a temperature T1 and pressure P1. The first-stage compressor, C1, compresses the air adiabatically to state 2, after which it

enters the intercooler where its temperature is reduced to T3. The second-stage

compressor, C2, then increases the air pressure to P4 at which the temperature increases to T4. Figure 1.1.b shows the compression process on a temperature-entropy diagram.

Page 18: Computer-Aided Thermofluid Analyses using Excel

Comouter-Aided Thermofluid Analyses Using Excel

Figure 1.1. Schematic and T-s diagrams of a two-stage air compressor with inter-stage

intercooling

How the total compression work is divided between the two compressor stages depends on their compression ratios and there is a certain value of the intermediate pressure (Pi) that minimises the total compression work. The principles of thermodynamics help us to determine this optimum pressure as shown below. Treating the two compressor stages as steady-flow processes and neglecting changes in kinetic and potential energy, the first-law of thermodynamics is expressed as [1]:

inout hhwq (1.1)

Where q and w are the amounts of heat transfer and work transfer per unit mass flow of air, respectively, and (hout –hin) is the resulting enthalpy change over the stage. Equation (1.1) adopts the usual sign convention that heat into the system is positive, while work into the system is negative. Assuming the compression processes in both stages to be isentropic as shown in Figure 1.1.b means that they are adiabatic (q=0) and reversible. Therefore, using an average specific heat for air at constant pressure (cp), the compression work per unit mass flow of air in stage 1 (w1) and in stage 2 (w2) can be determined from Equation (1.1) as follows:

12121 TTchhw p (1.2)

34342 TTchhw p (1.3)

The total compression work (wtotal) is then given by:

341221 TTTTcwww ptotal (1.4)

Assuming perfect intercooling, i.e., T3 = T1, Equation (1.4) can be rearranged as:

(b) (a)

1

2

3

4 P1

P2

P4

T

1

T

s

Intercooling

1

2

4

Intercooler

Air

Cooling water

C1 C2

3

Page 19: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

3

4

1

21

3

4

1

21 211

T

T

T

TTc

T

T

T

TTcw pptotal (1.5)

Since the two compression processes are assumed to be isentropic and the specific heat cp for air to be constant, the temperature ratios in Equation (1.5) can be converted into pressure ratios by using the following approximate relationships:

k

k

P

P

T

T

1

1

2

1

2

(1.6)

k

k

P

P

T

T

1

3

4

3

4

(1.7)

Where k is the ratio of specific heats (k=cp/cv; cv is the specific heat for air at constant

volume). With the assumption that there is no pressure loss in the intercooler, P3 = P2= Pi. Substituting from Equations (1.6) and (1.7), Equation (1.5) becomes:

k

k

i

k

k

iptotal

p

P

P

PTcw

1

4

1

1

1 2 (1.8)

To see how the total compression work varies with the intermediate pressure Pi, a specific case was considered in which T1= 300K, P1=100 kPa, and P4 = 900 kPa. Using Equation (1.8), the total compression work in the system was calculated for different values of Pi and Figure 1.2 shows the result. The figure shows that the value of Pi at which the total compression work is minimal is around 300 kPa. Increasing and decreasing Pi from this value both increase the compression work.

Figure 1.2. Variation of the total compression work with the intermediate pressure

260

270

280

290

300

310

0 200 400 600 800 1000

Tota

l co

mp

ress

ion

wo

rk (

kJ)

Intermediate pressure (kPa)

Page 20: Computer-Aided Thermofluid Analyses using Excel

Comouter-Aided Thermofluid Analyses Using Excel

The principles of thermodynamics are particularly useful for performance evaluation and optimisation of power-generation and refrigeration systems. For example, consider

the regenerative steam-turbine power plant shown in Figure 1.3. This plant consists of a

boiler house for producing superheated steam, a high-pressure steam turbine (HPT), a low-pressure steam turbine (LPT), a condenser, an open feed-water heater (FWH) and

two feed-water pumps. A fraction of the steam (y) is extracted after the HPT for

preheating the feed-water before going back to the boiler house.

Figure 1.3. Schematic diagram of a regenerative steam-turbine power plant

Although extracted steam reduces the work output from plant, it reduces the amount of heat added in the boiler and its net effect is to increase the thermal efficiency of the

plant. There is also a certain extraction pressure for the steam at which the plant‟s

thermal efficiency attains a maximum value. As shown below, the principles of

thermodynamics can be used to determine this optimum steam-extraction pressure.

The total specific work output from the two turbines (wout) and the total work input to

the two pumps (win) are given by:

LPTHPTout www (1.9)

21 PPin www (1.10)

Where wHPT and wLPT are the specific work output from the high-pressure turbine and

the low-pressure turbine, respectively, and wP1 and wP2 are the specific work inputs in

pump 1 and pump 2, respectively. Assuming the two turbines and the two pumps to be adiabatic and neglecting the changes in kinetic and potential energies, the work output

or input for each device can be determined from the enthalpy difference across the

device. Per each kg of steam generated in the boiler, these are given by:

21 hhwHPT (1.11)

Pump 1 Pump 2

FWH

Boiler

House

Condenser

HPT

y

1 - y

LPT

1 2

3

4

5 6

7

Page 21: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

321 hhywLPT (1.12)

451 1 hhywP (1.13)

672 hhwP (1.14)

Mass and energy balance over the open feed-water heater gives:

652 11 hhyyh (1.15)

The net specific work output from the plant (wnet) is then given by:

inoutnet www (1.16)

Similarly, the specific heat input to the boiler (qin) is determined by the relevant

enthalpy change as follows:

71 hhqin (1.17)

Finally, the thermal efficiency of the plant (η) can be calculated from:

innet qw / (1.18)

Both wnet and η depend on the fraction of steam extracted for regeneration (y); which in turn depends on the extraction pressure (P2). Figure 1.4 shows the variation of y and η

with P2 for an ideal cycle in which P1 = 15 MPa, T1 = 600oC, and P4 = 10 kPa. The

figure shows that the cycle‟s efficiency attains a maximum value of 45.55% when P2 is

in the range of 1000 kPa.

It should be mentioned that the working fluid in the above power plant, which is water,

changes its phase from a liquid to superheated steam in the boiler, to a saturated mixture of water and steam in the low-pressure turbine, and returns to liquid water in

the condenser. Therefore, appropriate property tables or charts are needed for

determining the thermodynamic properties of water at the different states. In general,

thermodynamic analyses use many tables and charts for various working fluids. The principles of thermodynamics are also needed for the analyses of air-conditioning

systems and processes and for the analyses of the processes that involve combustion

and other chemical reactions. For such analyses, thermodynamics provides the basic relationships needed to quantify the effects of fluid mixing and chemical reactions on

the properties of the working fluids and to determine the transfer of energy and

effluents to or from the system.

Page 22: Computer-Aided Thermofluid Analyses using Excel

Comouter-Aided Thermofluid Analyses Using Excel

Figure 1.4. The effect of intermediate pressure (P2) on the fraction of extracted steam

(y) and thermal efficiency (η) of a regenerative steam-turbine power plant

1.1.2. Fluid dynamics In addition to pipes and ducts, fluid-transporting systems require various equipment

such as pumps, compressors, control valves, and flow-measuring devices. The

principles of fluid dynamics help us to estimate the power needed for overcoming friction in these equipment and to determine suitable types and sizes for them. To

illustrate the application of these principles, consider the pump-pipe system shown in

Figure 1.5 that conveys a liquid between two non-pressurised tanks A and B through a

pipe of known length L, diameter D, and roughness ε. Suppose that we want to determine the needed pump power for transporting the liquid at a certain flow rate Q.

Figure 1.5. Schematic diagram of a simple pump-pipe system

The required pump power (W ) can be determined from the following “power equation”:

/phQW [W] (1.19)

Where γ is the specific weight of the transported liquid (N/m

3), Q is the volume flow

rate of the liquid (m3/s), hp is the pump head (m) needed to circulate the fluid through

0

0.05

0.1

0.15

0.2

0.25

0.3

0.45

0.451

0.452

0.453

0.454

0.455

0.456

0 1000 2000 3000 4000

Frac

tion

of

extr

acte

d st

eam

(y)

The

rmal

eff

icie

ncy

(η)

Extraction pressure (kPa)

Efficiency

y

A

B

Q

L1

L2 D

L3

Page 23: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

the pipe from A to B, and η is the combined efficiency of the pump and the electric motor. For a steady flow of an incompressible fluid, hp can be determined from the

following “energy equation”:

g

VVZZhh AB

ABtotalfp2

22

,

[m] (1.20)

Where hf,total is the total head loss through the system due to friction (m), ZA and ZB are

the elevations (m) at points A and B, respectively, and VA and VB are the corresponding fluid velocities (m/s). If the two tanks are not open to the atmosphere, the energy

equation should also include a term for the pressure difference between the tanks.

The total friction head loss hf,total consists of two parts: the major friction loss (hf),

which is the part lost in the pipe itself, and the minor friction head loss (hc), which is

the part lost in other components of the system like nozzles, elbows, valves, etc. The

major friction loss can be determined from the following Darcy-Weisbach equation [2]:

g

V

D

Lfh f

2

2

[m] (1.21)

Where f is the dimensionless Dracy friction factor, V the fluid velocity (m/s), L the total length of the pipe (m), and D the internal diameter of the pipe (m). The value of the

friction factor, which depends on the roughness of the pipe surface and on whether the

flow is laminar or turbulent, can be obtained from a Moody diagram [2] or calculated from a relevant formula. For laminar flows, f can be calculated from:

Re/64f Re < 2300 (1.22)

Where Re is the Reynolds number defined as:

/Re VD (1.23)

Where ν is the kinematic viscosity of the flowing fluid (m2/s). For a turbulent flow in

rough pipes, f can be obtained from the following Swamee-Jain formula [2]:

2

9.010Re

74.5

7.3log/25.0

Df

Re > 4000 (1.24)

For more accuracy, the friction factor for a turbulent flow can be determined by using

the following Colebrook-White formula (frequently referred to as the Colebrook

equation):

Page 24: Computer-Aided Thermofluid Analyses using Excel

Comouter-Aided Thermofluid Analyses Using Excel

f

D

f Re

51.2

7.3

/log0.2

110

(1.25)

The Colebrook equation is an example of the implicit equations met in thermofluid

analyses that need to be solved iteratively. For turbulent flows in smooth tubes, f can be determined from the first Petukhov formula [2]:

264.1Reln790.0

f 10

4 < Re < 10

6 (1.26)

Chemical engineers usually determine the pipe friction by using the following Chezy-

Manning equation instead of the Darcy-Weisbach equation:

g

V

D

Lfh f

2

2 [m] (1.27)

Where f is the Fanning friction factor. Comparison with Equation (1.21) reveals that the

value of the Fanning friction factor is 4 times the corresponding value of the Darcy

friction factor. Civil engineers determine the friction head loss in water-transporting pipes by using the following Hazen-Williams equation:

8704.4852.1

852.167.10

DC

LQh f [m] (1.28)

Where C is a coefficient that depends on the roughness of the pipe. Unlike Equations

(1.21) and (1.27), Equation (1.28) is applicable for both laminar and turbulent flows.

The minor friction losses, hc, can be determined from the following equation:

n

cg

VKh

1

2

2 [m] (1.29)

Where n is the total number of components in the fluid system and K is a coefficient the

value of which can be found for each component in relevant tables.

Given the values of the pipe length and diameter, flow rate, fluid viscosity, and pipe

material or roughness, the equations described above can be used to determine the

required pump power. The equations can also be used to determine the maximum flow

rate of the fluid to be delivered via a pipe of a certain diameter such that the friction loss in the system or the needed pump power does not exceed a specified limit.

Moreover, by taking into consideration the initial cost of the pump-pipe system that

Page 25: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

increases with D, and the cost of electrical energy needed by the pump that decreases with D, the equations can be used to determine the economic pipe diameter Dopt that

gives the lowest total owning cost for the system over its entire life-time. In general, the

equations are also applicable for analysing and optimising pipe-networks.

The principles of fluid dynamics also enable us to select the appropriate type and size of

the pump for a given pump-pipe system by matching the “pump curve” with the “system curve”. This is achieved with the help of pump characteristic curves usually

provided by the manufacturers. In many situations a single pump or compressor may

not be adequate for the required flow rate or delivery pressure and more than one pump

or compressor have to be used. In this situation, the principles of fluid dynamics help us to decide when to arrange the pumps/compressors in parallel or in series.

1.1.3. Heat transfer The design practices of energy-conversion equipment that deal with the transfer of thermal energy such as boilers, condensers, and heat exchangers are mainly based on

the principles of heat transfer. Three independent physical laws are used in heat-

transfer analyses to quantify the rate of heat transfer between an object and its surroundings depending on whether the heat transfers by conduction (Fourier‟s Law),

convection (Newton‟s law of cooling), or radiation (Stefan-Boltzmann law). The

physical properties that determine the rate of heat transfer by conduction, radiation, and

convection are the thermal conductivity (k), the surface emissivity (ε) and absorptivity (α), and the heat-transfer coefficient (h), respectively.

While k , ε, and α are material or surface-specific, h depends on both the fluid and the flow. Numerous analytically-obtained relationships and empirical formulae are used for

determining h depending on whether the flow is forced or natural and whether the flow

is internal or external to the system being considered. These formulae usually give the

Nusselt number (Nu) which is related to h as follows:

NuD

kh [W/m

2.K] (1.30)

Where D is the pipe diameter and k is the thermal conductivity of the transported fluid. Many analytical or empirical formulae are used for determining the Nusselt number for

forced or natural flows over single tubes, bank of tubes, plates, etc. For example, the

following Dittus-Boelter equation is used for determining Nu inside a fluid-transporting pipe due to forced convection [3]:

nNu PrRe023.0 8.0 (1.31)

Where Re is the Reynolds number, Pr the Prandtl number, and n is a constant that takes

a value of 0.4 when the pipe is being heated and 0.3 when it is being cooled.

Page 26: Computer-Aided Thermofluid Analyses using Excel

Comouter-Aided Thermofluid Analyses Using Excel

The subject also describes the methods that can be used to minimise or maximise the rate of heat-transfer between the system‟s components or between the system and its

surroundings by means of thermal insulation, fins, heat-pipes, etc. To illustrate the use

of heat-transfer concepts in thermal-insulation analyses, consider the metal pipe shown in Figure 1.6 that has an internal radius r1 and external radius r2. The pipe carries a fluid

at a temperature Ti, while the surrounding air is at a different temperature T∞.

Figure 1.6. Schematic for an insulated metal pipe

The temperature difference between the pipe and the surroundings will cause heat gain or heat loss to/from the pipe and, in order to reduce this heat gain or heat loss, the pipe

has to be covered by an insulating material. The principles of heat transfer help us to

account for the effect of thermal insulation on the rate of heat-transfer to/from the pipe.

The rate of heat transfer ( Q ) can be calculated from [3]:

thi RTTQ / [W] (1.32)

Where Rth is the combined thermal resistance to heat-transfer by conduction, convection, and radiation, which is given by [3]:

32

23

1

12

1

1

2

/ln

2

/ln1

AhLk

rr

Lk

rr

AhR

oi

th

[K/W] (1.33)

Where hi and A1 are the heat-transfer coefficient and surface area inside the pipe,

respectively, ho and A3 are the heat-transfer coefficient and surface area outside the

insulated pipe, respectively, L is the length of the pipe, and k1 and k2 are the thermal conductivities of the pipe and the insulation, respectively. To simplify the analysis, ho

in Equation (1.33) takes into account the heat-transfer by both convection and radiation

to/from the insulation surface. The thickness of the metal pipe is usually small

compared to its diameter, while its thermal conductivity is much higher than that of the insulation material. Therefore, the equation can be simplified further by neglecting the

term that represents the thermal resistance due to conduction through the pipe.

Ti

T∞ r1

r2

r3

δ

Page 27: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

Equations (1.32) and (1.33) can be used to determine the required thickness of insulation (δ) for reducing the rate of heat transfer to the required tolerance or for

controlling the surface temperature within a range that is dictated by safety or other

practical considerations. Although the thicker the insulation the lower will be the rate heat transfer, the cost of insulation increases with its thickness and, therefore, adding

more insulation will not be economically profitable beyond a certain thickness. By

extending the above heat-transfer model so that the cost of insulation and the value of the saved thermal energy can be calculated and compared, the above equations can also

be used to determine the economically optimal thickness of insulation (δopt).

Figure 1.7 shows a metal pipe with circular fins attached to its surface so as to boost the rate of heat-transfer between the fluid being transported with the pipe and the

surrounding medium, usually air. The principles of heat transfer can be used to develop

the required mathematical equations that determine the the rate of heat transfer from the pipe and, therefore, to evaluate the effectiveness and efficiency of the fin.

Figure 1.9. Circular fins attached to a metal pipe

Another important application of heat-transfer principles is that related to the design and selection heat-exchangers. A heat-exchanger is any device that allows the transfer

of thermal energy between two fluids through a separating surface usually a pipe, a

duct, a tube, or a plate. Figures 1.8 and 1.9 show two types of heat-exchangers commonly used in industries and power-plants. Figure 1.8 shows a shell-and-tube heat-

exchanger while Figure 1.9 shows a cross-flow heat-exchanger. Heat-exchanger

analyses either aim at determining the required size (i.e., surface area) for a specified

heat-transfer duty or determining the exit temperatures of the two streams from a specified heat-exchanger type and size. Two methods are used for these two types of

analyses which are the log-mean temperature difference (LMTD) method and the

effectiveness-number of transfer units (ε-NTU) method. Complex thermal systems use heat-exchanger networks [HENs] and finding the configuration that minimises the

annual cost of the network is based on the principles of heat transfer.

Page 28: Computer-Aided Thermofluid Analyses using Excel

Comouter-Aided Thermofluid Analyses Using Excel

Figure 1.8. A parallel-flow shell-and-tube exchanger

Figure 1.9. A cross-flow exchanger with both streams unmixed

1.2. Advantages of computer-aided thermofluid analyses Apart from saving time and eliminating possible human errors, computer-aided

thermofluid of analyses offer a number of advantages over traditional methods that use property tables and charts. An important advantage of computer-aided methods is their

ability to give more realistic results by avoiding unnecessary simplification of the

models and by using more accurate estimations of fluid properties. Moreover, they offer reliable techniques for iterative solutions, optimisation analyses, and the analyses of

complex thermofluid systems. In what follows, these advantages are illustrated by

means of relevant examples.

A. Avoiding excessive simplification of the model

In many situations, traditional analytical methods adopt excessive simplifications of the

analytical models; which makes their results grossly deviate from the behaviour of real

systems. A good example of this situation is given by the models of internal-combustion (IC) engines. Traditional air-standard models of IC engines, such as the

Otto cycle and the Diesel cycle, neglect heat-transfer and friction losses, treat the

combustion process as heat-addition from an external source, and use constant specific

Cold out

Cold in

Hot

in

Hot out

Cross-flow

(unmixed)

Tube-flow (unmixed)

Page 29: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

heats for the working fluids. These assumptions enable the engine processes to be represented by simple closed-form relations for calculating the amount of heat added to

the engine and net work from the engine [4]. However, air-standard models usually

overestimate the engine‟s output and thermal efficiency.

By comparison, computer-aided models of IC engines closely mimic the behaviour of

actual IC engines by taking into consideration the geometrical as well as the thermodynamic characteristics of the engines. Therefore, these models can be used to

investigate the effect of important design and operation factors such the ignition or

injection timing on the engine performance or the effect of engine speed on the specific

fuel consumption. However, the formulation of these models leads to a set of ordinary differential equations that need to be solved simultaneously by using a numerical

method such as the Newton-Raphson method [5].

B. Accurate representation of fluid properties and processes

The ideal-gas law can be used with reasonable accuracy for determining the specific

volume of a superheated vapour, but when the temperature approaches the saturation

line, the value of the specific volume determined by the ideal-gas law departs significantly from the actual volume. More accurate estimates can be obtained by using

the following Soave-Redlich-Kwong (SRK) equation of state [1]:

)~(~~ bvv

a

bv

TRP u

(1.34)

Where P is the absolute pressure of the gas, v~ is the molar specific volume, Ru is the

universal gas constant, T is the absolute temperature of the gas, and the constants a, b

and are fluid-dependent. Figure 1.10 shows the deviations from the tabulated values by those obtained from the ideal-gas law and the SRK equation of state for refrigerant

R134a at 0.2 MPa. The figure shows that the error of the ideal-gas law is more that 2%

even at high temperatures and increases as the temperature approaches the saturation

value, but the accuracy of the SRK equation remained higher than 99% even close to

the saturation line. However, since the SRK equation is implicit in v~ it cannot be used

directly to determine the specific volume. A number of standard iterative procedures

(e.g. Newton-Raphson method) can be used to solve the equation, but they are more suitable for computer-aided analyses than hand calculations.

Another important implicit equation for thermofluid analyses is the Colebrook-White

equation, Equation (1.25), that determines the friction factor (f) for turbulent pipe-flows. Since the equation involves f on both sides and needs to be solved iteratively, the

explicit relationships such as the Swamee-Jain formula are preferred even though the

Colebrook-White equation is more accurate. Many other nonlinear equations like the SRK equation and the Colebrook-White equation give advantage to computer-aided

thermofluid analyses by enabling more realistic and accurate estimations.

Page 30: Computer-Aided Thermofluid Analyses using Excel

Comouter-Aided Thermofluid Analyses Using Excel

Figure 1.10. Errors in the specific volume of R134a by the ideal-gas law

and the SRK equation of state

C. Dealing with iterative solutions and optimisation analyses

A good example of thermofluid analyses that require iterative solutions is found in

pipe-flow analyses. Pipe flow problems that require the friction head loss to be

determined when both the diameter and flow rate are known can be solved in a straightforward manner by using Equation (1.21). However, in design analyses of

pump-pipe systems we may need to find the flow rate in a given pipe that gives a

specified head loss or to find a suitable pipe diameter for specified head loss, flow rate, and pipe length. In these two cases, the friction factor f cannot be determined in

advance because it depends on the Reynolds number. Therefore, these two types of

pipe-flow problems, referred to as type-2 and type-3 problems, need to be solved by

iteration. It is much easier to carry out the iterative process to the required level of accuracy by using a computer-aided method than by doing it manually. Other types of

thermofluid analyses that also require iterative solutions include rating analyses of heat

exchanger and the determination of the adiabatic flame temperature by first-law analysis of the combustion process.

Optimisation analyses are needed for determining the best design for a thermofluid system such as the optimum intermediate pressure for a two-stage air-compression

system, the optimum steam-extraction pressure for a regenerative Rankine cycle, and

the economic thickness of insulation for a pipe. While simple optimisation analyses that

involve a single design parameter can be performed by means of calculus techniques and graphic tools, optimisation analyses of complex systems that involve multiple

design variables require the use of computer-aided techniques.

D. Analyses involving complex models

The complexity of modelling certain thermofluid systems makes their analyses only

possible with the help of computer-aided methods. The model complexity can be either

0

1

2

3

4

5

6

7

250 300 350 400

Erro

r in

sp

eci

fic

volu

me

(%

)

Temperature K

Ideal-gas model

SRK model

Page 31: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

due to the complexity of the physical structure of the system itself or the complexity of its mathematical representation. An example of physically complex systems is the pipe

network shown in Figure 1.11 that consists of four pipe loops and four consumption

points and fed by two water tanks; tank A and tank B. Suppose that the flow rates from the two supply tanks are specified together with the pipe diameters and lengths and it is

required to determine the discharges at the four consumption points.

Figure 1.11. A looped pipe network supplied by two tanks

Although the solution is mainly based on the two well-known principles of

conservation of mass and conservation of energy, it is difficult to solve the problem by using manual analytical methods especially when a minimum or a maximum pressure

level is to be met at the discharge points. In this case, a computer-aided method, such as

the Hardy-Cross method presented in Appendix C, has to be used [6, 7]. The

optimisation analyses of heat-exchanger networks give another example of the models that deal with physically complex systems [8].

Mathematically complex thermofluid models that need computer-aided numerical methods are found in multi-dimensional fluid-flow and heat transfer analyses. This type

of analyses involves coupled and nonlinear partial differential equations that have to be

solved by using computational fluid dynamics (CFD) methods such as the finite-volume

method or the finite-difference method. Many commercial CFD applications are available nowadays that offer great flexibility and user-friendliness.

1.3. The Excel-based modelling platform for thermofluid analyses Microsoft Excel is commonly used for data visulation and for dealing with simple computer-based operations like matrix inversion and matrix multiplications [3,9].

However, Excel is equipped with other features that make it a capable modelling

platform for a wide range of engineering “What-if” analyses [10-12]. In addition to its Goal Seek command and the Solver add-in, the “Developer” ribbon in Excel provides a

programming language called Visual Basic for Applications (VBA) that can be used for

developing customised user-defined functions (UDFs) not provided by Excel. The

B

A

QB

QA

Q1

Q2

Q3

Q4

Page 32: Computer-Aided Thermofluid Analyses using Excel

Comouter-Aided Thermofluid Analyses Using Excel

Developer ribbon also allows the use of macros to remove the tedium of parametric studies and repetitive calculations. The main limitation of Excel with respect to

thermofluid analyses, which is the lack of built-in functions for fluid properties, could

be solved by developing suitable add-ins for this purpose [13-15].

This book uses an Excel-based modelling platform for thermofluid analyses that

includes in addition to Excel, Solver, and VBA, an educational Excel add-in called Thermax. Thermax provides seven groups of property functions for ideal gases,

saturated water and superheated steam, synthetic and natural refrigerants, atmospheric

humid air for psychrometric analyses, two aqua solutions for vapour-absorption

refrigeration, chemically-reacting substances, and air at standard atmospheric pressure. Thermax also provides two interpolation functions and a Newton-Raphson solver for

nonlinear equations that enhance the usefulness of the Excel-based modelling platform.

Table 1.1 summarises the roles of the four components of the Excel-based modelling platform as used in this book.

Table 1.1. Roles of the four components of the Excel-based modelling platform

Component Role

Excel

Provides the basic functions needed for thermofluid analyses including the general mathematical functions and the matrix-

operation functions

Provides the Goal Seek command needed for performing

unconstrained iterative solutions involving a single parameter

Allows circular calculations which can be a convenient method for

dealing with parameter dependency in certain analyses

Provides graphical tools needed for data visualisation and analyses

Allows macros to be recorded for repetitive calculations

Solver

Allows constrained iterative solutions involving multiple parameters

Allows optimisation analyses with single and multiple design variables

Offers three solution options that suit different types of analyses

Thermax

add-in

Provides the physical properties of various fluids

Provides two interpolation functions for tabulated data and a Newton-

Raphson solver for non-linear equations such as the Colebrook-White

equation and the SRK equation

VBA

Needed for developing custom functions for the non-linear equations

involved in iterative solutions and optimisation analyses

Needed for developing numerical solvers for large systems of linear equations

Can be used to develop additional fluid property functions or other

functions not provided by Excel or the Thermax add-in

Page 33: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

1.4. Closure The following two chapters describe the Excel-based modelling platform in more

details. While Chapter 2 focuses on the features of Excel that are mostly needed for

thermofluid analyses such as its matrix functions and its Goal Seek command, Chapter

3 introduces the other three components of the modelling platform. Chapter 3 gives examples of using the three solution methods offered by Solver, describes the

development of user-defined functions with VBA, and shows how the property

functions provided by Thermax can be used in Excel formulae. Chapter 4 deals with iterative solutions of thermofluid problems and gives examples of using Excel‟s Goal

Seek command and Solver for this type of analyses in the fields of fluid dynamics, heat-

transfer, and thermodynamics. The Excel-based platform is then used in Chapters 5 to 10 for various types of thermofluid analyses.

Chapters 5 and 6 deal with fluid systems and illustrate the use of Excel and Solver for

the analyses of multi-pipe and pump-pipe systems and pipe-networks. Different pipe and pump arrangements are analysed in Chapter 5 to determine the system‟s friction

losses, power requirement, or operating point. Chapter 6 uses Solver for the analyses of

gravity-driven pipe-networks with looped, branched, and mixed configurations. Both Chapters 7 and 8 deal with the numerical solution of the heat-conduction equation by

using the finite-difference (FD) method. While Chapter 7 focuses on the steady

conduction equation, Chapter 8 focuses on the transient equation. Two approaches are

presented in these chapters for applying the explicit and implicit formulations of the FD method by using Excel‟s matrix functions and iterative calculations.

Chapters 9 and 10 deal with thermodynamic analyses by using the property functions provided by the Thermax add-in. Chapter 9 that deals with the analyses of power-

generation cycles focuses on the Brayton cycle for gas-turbines and the Otto cycle for

the spark-ignition internal-combustion engines. Using air standard assumptions, this

chapter presents both energy and exergy analyses of the Otto cycle. Chapter 10 that deals with the analyses of refrigeration cycles focuses on the vapour-compression

refrigeration (VCR) cycle with refrigerant R134a as the working fluid. The chapter

considers both the simple single-stage cycle and the multi-stage cycle with two and three stages of compression and shows how the Solver add-in provided by Excel can be

used for optimisation analyses of the multi-stage VCR cycles.

References

[1] Y.A. Cengel, and M.A. Boles, Thermodynamics an Engineering Approach ,

McGraw-Hill, 7th

Edition, 2007

[2] C. T. Crowe, D. F. Elger, B. C. Wiliams, and J. A. Roberson, Engineering Fluid Mechanics, 9

th edition, John Wiley & Sons, Inc., 2009.

[3] Y.A. Cengel and A.J. Ghajar, Heat and Mass Transfer: Fundamentals and

Applications. 4th

edition, McGraw Hill, 2011. [4] W.W. Pulkrabek, Engineering Fundamentals of the Internal Combustion Engine ,

2nd

Edition, Pearson Education International, 2004.

Page 34: Computer-Aided Thermofluid Analyses using Excel

Comouter-Aided Thermofluid Analyses Using Excel

[5] C.R. Ferguson, Internal Combustion Engines, John Wiley & Sons, 1986. [6] A. Rivas, T. Gómez-Acebo, and J. C. Ramos. The application of spreadsheets to

the analysis and optimization of systems and processes in the teaching of

hydraulic and thermal engineering, Computer Applications in Engineering Education, Vol. 14, Issue 4, 2006, pp. 256-268.

[7] D. Brkic, Spreadsheet-Based Pipe Networks Analysis for Teaching and Learning

Purpose, Spreadsheets in Education (eJSiE): Vol. 9: Iss. 2, Article 4, 2016. Available at: http://epublications.bond.edu.au/ejsie/vol9/iss2/4

[8] A. Bejan, G. Tsatsaronis, M. Moran, Thermal Design & Optimisation, John

Wiley & Sons, 1996.

[9] J. P. Holman, Heat Transfer, 10th

edition, McGraw-Hill. 2010. [10] A. Karimi, Using Excel for the thermodynamic analyses of air-standard cycles

and combustion processes, ASME 2009 Lake Buena Vista, Florida, USA.

[11] Z. Ahmadi-Brooghani, Using Spreadsheets as a Computational Tool in Teaching Mechanical Engineering, Proceedings of the 10

th WSEAS International

Conference on computers, Vouliagmeni, Athens, Greece, July 1315, 2006, 305-

310

[12] S.A. Oke, Spreadsheet Applications in Engineering Education: A Review, Int. J. Engng Ed. Vol. 20, 2004, No. 6, 893-901

[13] The University of Alabama, Mechanical Engineering, Excel for Mechanical

Engineering project, Internet: http://www.me.ua.edu/excelinme/index.htm (Last accessed July 11, 2019).

[14] J. Huguet, K. Woodbury, R. Taylor, Development of Excel add-in modules for

use in thermodynamics curriculum: steam and ideal gas properties, American

Society for Engineering Education, 2008, AC 2008-1751. [15] K. Mahan, J. Huguet, K. Woodbury, R. Taylor, Excel in ME: Extending and

refining ubiquitous software tools, American Society for Engineering Education,

2009, AC 2009-2295.

Page 35: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

2

Excel

Page 36: Computer-Aided Thermofluid Analyses using Excel

Comouter-Aided Thermofluid Analyses Using Excel

With its user-interface, built-in functions, iterative tools, and graphical tools, Excel forms the backbone of the modelling platform used in this book for thermofluid

analyses. This chapter is not intended to review all the features and built-in functions

provided by Excel, but to focus on those needed for building analytical models for thermofluid analyses. In this respect, the chapter highlights the use of cell-labelling in

writing formulae instead of the usual referencing by location. The chapter also

illustrates the use of Excel‟s matrix functions for the solution of linear systems of equations and the use of Goal Seek and circular calculations for the solution of

nonlinear equations. The final section on Excel‟s graphical tools demonstrates the use

of the trendline feature for curve-fitting of tabulated data.

2.1. Elements of Excel‟s user-interface

Excel‟s user-interface allows us to manipulate the stored data by providing a large set

of built-in functions and a number of analytical tools. It also provides numerous commands for adjusting the appearance of the workspace and presenting the primary

data and the results in various forms. Figure 2.1 shows a screenshot of an Excel sheet

that stores the scores obtained by a group of students in one semester.

Figure 2.1. The main elements of Excel‟s user-interface

To allow easy access to the large number of functions, tools, and commands provided by Excel, its interface is divided into a number of elements with different purposes.

Figure 2.1 shows four of these elements which are:

1. The ribbon

2. The name box

3. The formula bar

4. The workspace

The Ribbon, which occupies the upper part of the sheet, organises the numerous

commands provided by Excel into nine “tabs”, e.g., the File , Home , and Insert tabs.

1

2

4

3

Page 37: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

Each tab consists of a number of command-groups that have a common purpose. The Workspace , which is the main part of the sheet, is divided into a grid of columns and

rows that form separate “cells” at their intersections. A cell is referred to by a letter and

a number, e.g., A1, B3, H2, etc. The lettert represents the cell‟s column while the number represents its row. The Name box shows the location of the current cell.

As Figure 2.1 shows, a cell can simply contain a character data, such as “Saeed” and “Salim”, or a numerical data, such as 62.5 and 70. A cell can also contain a formula for

data manipulation using the numerous built-in functions provided by Excel. The

formula bar in Figure 2.1 reveals the formula typed in cell H2 that uses the built-in

function “AVERAGE” to determine the average score of the first student in the list (Saeed) in the five subjects as 64.0. Note that, unlike simple numerical or character

cells, a cell that includes a formula must include the equal sign “=”. The role of the

Formula bar will be explained in more details in the following section.

2.2. Excel‟s formulae

In general, Excel‟s formulae include mathematical or logical operators, built-in

functions, and cell references. Excel provides two ways to refer a particular cell; either by its location in the sheet, e.g., A2, C10, etc., or by giving it a relevant name, e.g.,

efficiency, diameter, etc. The two methods will be illustrated below.

2.2.1. Cell reference by location

To illustrate this method, let us write a formula that calculates the area of a circle from

its radius. To do this, open a new Excel sheet and type the number 5, which is the radius

of the circle, in cell A1 as shown in Figure 2.2.

Figure 2.2. Writing an Excel formula to determine the area of a circle

Now, go to cell A2 and type the following formula:

=PI()*A1^2/4 The function “PI()” is a built-in function that returns the value of Archimedes‟ constant

π. The formula also contains a reference to cell A1 that stores the value of the circle‟s

radius, the multiplication operator *, the division operator /, the power operator ,̂ and

Formula

bar

Page 38: Computer-Aided Thermofluid Analyses using Excel

Comouter-Aided Thermofluid Analyses Using Excel

the constants 2 and 4. Note that the formula is shown in the formula bar which can also be used to edit the formula. Pressing the Enter key after typing the formula, you will

obtain the result shown in Figure 2.3; which is 19.63495 square metres.

Figure 2.3. The Excel sheet with a formula that determines the area of a circle

The following example shows how Excel‟s formulae and built-in functions can be used in a simple thermodynamic analysis.

Example 2-1. Determining the specific volume of R134a by using the ideal-gas law Develop an Excel sheet that calculates the specific volume (v) of refrigerant R134a

from the ideal-gas law at a pressure of 200 kPa (Tsat = -10.09oC) and temperatures in the

range 0oC to 100

oC (273 to 373 K). Compare your results with the tabulated data.

Solution

Figure 2.4 shows the Excel sheet prepared for this example. The pressure (P), the gas

constant (R), and the temperature (T) are stored in columns A, B, and C, respectively. Column D stores the values of v obtained from relevant property tables and column E

stores the corresponding values obtained from the ideal-gas law:

PRTv / (2.1)

Where, P and T are the absolute pressure and temperature, respectively, and R is the gas

constant for R134a (R = 0.08149 kJ/kg.K). The percentage error of the ideal-gas law in estimating the specific volume is given by:

100

Table

TableIdeal

v

vvError (2.2)

To determine the percentage error at 273K, go to cell F2 and type the following formula

which is equivalent to Equation (2.2):

=(E2 – D2)/D2*100

Page 39: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

Figure 2.4.The sheet developed for determining error in the ideal-gas law for R134a

Note that the formula bar in Figure 2.4 reveals the above formula. When you press the

Enter key, the number 6.566 will appear in cell F2 as shown in the figure. To find the percentage errors at other temperatures you can simply copy the formula in cell F2 and

paste it on cells F3 to F12. The calculated values of the errors show that the maximum

error occurs at the lowest temperature, which is 273K. The error decreases gradually as the temperature increases.

2.2.2. Use of cell labels The usual reference to cells by their columns and rows suits perfectly statistical

analyses in which the same formula is applied to a large body of data that is stored

column-wise or row-wise. For example, we may want to determine the average value,

maximum value, or minimum value of the tabulated data. Example 2-1 illustrated this situation. However, thermofluid analyses usually involve numerous formulae but a

small set of data, e.g. the diameter of a pipe, the density or viscosity of a fluid, the

effectiveness of a heat exchanger, etc. For such analyses, it is more convenient to give the cell a meaningful name or “label” that matches its content. The cell can then be

referred to by its label instead of its relative location. This method makes it easier to

recognise the quantities involved in the Excel formulae.

For the purpose of illustration, let us develop an Excel sheet to compare the density of

air before and after an isentropic compression process from an initial condition of P1 =

100 kPa and T1 =300K to a final pressure of P2 = 800 kPA. The two air densities involved can be calculated from the ideal-gas law as follows:

111 / RTP (2.3)

Page 40: Computer-Aided Thermofluid Analyses using Excel

Comouter-Aided Thermofluid Analyses Using Excel

222 / RTP (2.4)

Where R is the gas constant for air (R = 0.287 kJ/kg.K). For an isentropic process, T2 is

related to T1 according to the following approximate relationship:

k

k

PPTT1

1212 /

(2.5)

Where k is the ratio of specific heat at constant pressure (cp) and at constant volume (cv). For air, k can be taken as 1.4. Note that in Appendix A, Table A.1, k is used for the

thermal conductivity.

Figure 2.5 shows the sheet prepared for this analysis in which the respective cell labels are typed in the column to the left of the different pressures and temperatures, while the

corresponding units are written in the column to the right of each quantity. This is also

done to the other quantities in the calculations. The sheet also shows the units of the different properties involved for more clarification.

Figure 2.5. Excel sheet for calculating the air densities before and after compression

Placing the cursor on cell F4 makes the formula bar reveal the formula used in the

calculation of the temperature T2 according to Equation (2.5) which is:

=B4*B7^((B8-1)/B8)

The above formula can be made more understandable by using familiar labels to refer to the different cells involved. To do that, select the cells in columns A and B as shown

in Figure 2.6, then go to Formulas and, at the Name Manager, select Create from

Selection. When the form shown in Figure 2.6 appears to you, tick the “Left column” option. Pressing the “OK” button will make Excel create names for the different values

in the selection box according to the labels written on the left column. The cell F3 that

stores the value of P2 can also be associated with its corresponding label in cell E3.

Page 41: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

Figure 2.6. Creating names for a selected group of cells

Now, retype the formula in cell F4 that determines T2 as follows:

=T_1*P_r^((k_-1)/k_)

The formula bar in the sheet shown in Figure 2.7 reveals the formula with the corresponding labels instead of location references.

Figure 2.7. Formulae using cells labels instead of locations

Labelled formulae are easier to edit than those using location referencing particularly

when intricate formulas are involved. Another advantage of cell-labelling is that if you copy a labelled formula and paste it in any other cell you will get the same answer, but

if you copy a formula that uses the usual referencing by location in another cell you will

get a different answer. To reveal or hide all the formulae in the sheet, press the control

key (ctrl) with the tilde key (~). When naming your cells, choose suitable representative names for the variables involved, e.g. P_1 and T_1 for P1 and T1. Note that Excel does

not accept “P1” or “T1” as labels since these can be confused with usual cell references

Page 42: Computer-Aided Thermofluid Analyses using Excel

Comouter-Aided Thermofluid Analyses Using Excel

by locations. Therefore, Excel automatically changes these labels to “P1_” and “T1_”. More information about Excel formulae can be found in Walkenbach [1].

2.3. Excel‟s built-in functions Excel provides a large library of built-in functions for data manipulation, like the

AVERAGE function, and other functions commonly used in engineering analyses like

the PI, SIN, and COS functions. To view the full range of Excel‟s functions, type “=” in any Excel cell as shown in Figure 2.8 and then place the cursor on the “Insert

Function” fx button in the formula bar and click it. The dialog box shown in Figure 2.9

will appear to you. List all the categories via the “Select a category” slot.

Figure 2.8. Exploring Excel‟s built-in functions

Figure 2.9. The various categories of Excel‟s built-in functions

Page 43: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

The Math & Trig group includes the mathematical and trigonometric functions used in different types of engineering analyses. Figure 2.10 shows some of the numerous

functions in this group. Note that the dialog box gives a brief explanation of each

function. For example, the explanation given to the ABS function is that it returns the absolute value of a number. The functions ACOS, ASIN, and ATAN apply the familiar

inverse trigonometric functions: cos-1

, sin-1

, and tan-1

, respectively. By scrolling down

the list, you can find many other familiar functions. The following discussion focuses on two types of functions that are needed for the development of analytical models in

subsequent chapters of the book, which are (a) the logical functions and (b) the

functions for matrix operations.

Figure 2.10. Common mathematical functions supported by Excel

2.3.1. Logical functions To determine the major friction loss (hf) in a pipe by using the Darcy-Weisbach

equation we have to establish whether the flow is laminar or turbulent so as to select the

relevant formula for the friction factor (f). The flow remains laminar before the Reynolds number (Re) reaches a certain value, which can be taken as 2,000, but the

flow can only be considered fully turbulent beyond Re = 3000. There is a transitional

region between laminar and turbulent flows when 2000 < Re < 3,000. Suppose that we want to write an Excel formula that determines the type of flow from the given value of

the Reynolds number. Using a simple IF function, we can write the following formula:

=IF(Re<=2000, “Laminar”, “Turbulent or transitional”)

Page 44: Computer-Aided Thermofluid Analyses using Excel

Comouter-Aided Thermofluid Analyses Using Excel

Note that the above IF-formula does not differentiate between a turbulent and a transitional flow. Therefore, we need to use a second logical test inside the first logical

test. This can be done by using the following nested IF function:

=IF(Re<=2000, “Laminar”, IF(Re>=3000, “Turbulent”, “Transitional”))

Figure 2.11 shows an Excel sheet containing the above formula (shown in the formula bar) and the response of the formula when Re = 500, which is “Laminar”. Depending

on the value of Re stored in cell C2, the result of the If-formula can be “laminar”,

“Turbulent”, or “Mixed”. Excel supports six other logical functions; AND, FALSE,

IFERROR, NOT, OR and TRUE that can be combined in the same formula so as to handle more intricate choices.

Figure 2.11. A formula using the nested IF function to determine the type of flow

2.3.2. Functions for matrix operations

Adjacent cells can be treated as a matrix or a vector and a group of Excel‟s formulae allow for the addition, subtraction, and multiplication of these matrices and vectors

according to the established rules of matrix operations. Figure 2.12 shows a 3x3 matrix

(A) stored in the cells B3:D5 and a vector (b) stored in cells F3:F5.

Figure 2.12. Step 1 of using the matrix multiplication function

Matrix (A) and vector (b) can be multiplied and the result stored in a third vector (c) by using the matrix function MMULT. The procedure is as follows:

1. After keying in the data of matrix (A) and vector (b) as shown in Figure 2.12,

position the cursor at cell H3 and type the formula: =MMULT(B3:D5;F3:F5).

Page 45: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

2. Now press ENTER key and cell H3 will take the value 14, which the result of multiplying the first row of the matrix with the vector (b) as Figure 2.13 shows.

Figure 2.13. Step 2 of using the matrix multiplication function

The other two elements of the result vector will not appear automatically. To view the

complete solution vector, do as follows:

1. Select the cells H3:H5 as shown in Figure 2.14,

2. Press the function key F2 once and then simultaneously hold the (SHIFT +

CONTROL) keys together and press ENTER. The complete solution vector (c) will now appear as shown in Figure 2.15.

Figure 2.14. Step 3 of using the matrix multiplication function

Figure 2.15. Step 4 of using the matrix multiplication function

An important matrix-operation function provided by Excel is the matrix-inversion

function MINVERSE which is needed for the solution of linear systems of equations.

The following example illustrates the use of this function.

Page 46: Computer-Aided Thermofluid Analyses using Excel

Comouter-Aided Thermofluid Analyses Using Excel

Example 2-2. Using the matrix inversion function By using the MINVERSE function, find the inverse of matrix [A] given by:

[A] =

507

650

301

Solution

The first step is to enter the elements of the matrix as shown in Figure 2.16. After

entering the data, go to cell F2 and type the formula “=MINVERSE(B2:D4)”. When you press ENTER, this cell will have the value -0.3125, which is the first element of

the inverse matrix [A]-1

shown in Figure 2.17.

Figure 2.16. Step 1 of using the MINVERSE function

Figure 2.17. Step 2 of using the MINVERSE function

Starting with the formula in cell F2, select the range F2 to H4 as shown in Figure 2.17.

Press and release the function key F2 and then simultaneously hold the CTRL+SHIFT

keys and press ENTER. Other elements of the inverse matrix [A]-1

will then appear as shown in Figure 2.18. You can check the solution by multiplying matrix [A] with its

inverse by using the MMULT functions. The procedure is illustrated by Figures 2.19 to

2.21. As should be expected, Figure 2.21 shows that the resultant matrix is the identity matrix.

Page 47: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

Figure 2.18. The complete inverse matrix [A]

-1

Figure 2.19. Multiplying matrix [A] by its inverse [A]

-1

Figure 2.20. The first element of the product (identity) matrix

Figure 2.21. The complete solution which is the identity matrix

Page 48: Computer-Aided Thermofluid Analyses using Excel

Comouter-Aided Thermofluid Analyses Using Excel

2.4. Solution of linear system of equations An example of thermofluid analyses that involve systems of linear equations is the solution of the heat conduction equation with the finite-difference method. Linear systems of equations can be solved with Excel by applying the matrix-inversion method. For illustration, consider the following linear system written in matrix notation:

yxA (2.6)

Where [A] is the coefficient matrix, {x} the vector of unknowns, and {y} the right-side or “load” vector. By applying the matrix-inversion method, the solution vector {x} can be obtained as follows:

yAx1

(2.7)

Where [A]

-1 is the inverse of matrix [A]. The following example illustrates the

procedure of applying the method by using Excel‟s matrix functions.

Example 2-3. Solution of a system of linear equations

Find the values of xi in the following system of linear equations:

794916325

4947523

16536159

322155214

5391414

5

4

3

2

1

x

x

x

x

x

=

463

329

106

100

15

(2.8)

Solution Note that the system is symmetric; which is typically the case with linear systems that arise in the solution of heat-conduction problems by the finite-difference method. For larger systems of equations, the symmetry of the system can be utilised for reducing the required computer memory by storing only one half of the coefficient matrix. However, this requires a complicated computer programming. For small systems like the one considered here, it is more convenient to use Excel‟s matrix inversion and multiplication functions. Figure 2.22 shows the Excel sheet that stores both the coefficient matrix [A] and the load vector {y}. The inverse matrix [A]

-1, which is

obtained by following the procedure described in the previous section, is stored below the coefficient matrix as shown in the figure. The inverse matrix [A]

-1 is then multiplied

with the load vector {y} and the result stored below the load vector as shown in Figure 2.23. The complete solution is shown in Figure 2.24. The first element is practically zero and, therefore, the solution vector is{x} = (0, 1, 2, 3, 4).

Page 49: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

Figure 2.22.The coefficient matrix [A], the load vector {y}, and the inverse matrix [A]

-1

Figure 2.23. Multiplying the inverse matrix [A]

-1 with the load vector {y}

Figure 2.24. The complete solution vector {x}

Page 50: Computer-Aided Thermofluid Analyses using Excel

Comouter-Aided Thermofluid Analyses Using Excel

It should be mentioned that the procedure described above by using Excel‟s functions suits best one-dimensional fluid-flow and heat-transfer analyses. This is because the

linear systems generated in multi-dimensional analyses are usually too large to be

solved efficiently by using the matrix-inversion method.

2.5. Itearative solutions with Excel

Excel offers its user two methods to perform iterative solutions: (i) by using the Goal

Seek command and (ii) by using circular calculations . In what follows the two

methods will be illustrated with the help of simple examples.

2.5.1. Itearative solutions with Goal Seek The Goal Seek command is used for finding the value of an independent variable (x)

that yields a specified value of a dependent variable (y). It is a simple, yet very useful

tool for “What-if” analyses. The following example illustrates how this command can be used to solve a nonlinear equation.

Example 2-4. Solution of a nonlinear equation by Goal Seek

A centrifugal pump is used for lifting water from the utility network at the

ground level to a tank at the top of a

building that is 30-m high as shown in Figure 2.25. The pump‟s characteristic

curve can be represented by the

following formula:

32

0 cQbQaQhhp (2.9)

Where hp and Q are the pump‟s head (m)

and discharge (m3/s), respectively, and

h0, a, b, and c are constants the values of

which are 47.22, 2.985x103, 1.549x10

5,

and 2.348x108, respectively.

Neglecting friction losses in the pipe,

determine the water flow rate (m3/s) that

can be delivered by the pump.

Figure 2.25. Schematic for Example 2-4

Solution

Figure 2.25 shows the Excel sheet prepared for this example in which the values of the four constants in Equation (2.9) are stored at the top of the sheet. The pump‟s discharge

is calculated at various values of the discharge and plotted as shown in the figure. We

can see from the plot that the value of Q that yield hp = 30 m is approximately 0.003 m

3/s.

30 m

Pump

Page 51: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

Figure 2.25. Excel sheet for Example 2-4

To solve the problem by using Goal Seek, enter an initial guess for Q in cell B7, say 0,

and then enter the following formula that uses Equation (2.9) to calculate hp in cell B9:

=$B$2-$B$3*B7-$B$4*B7^2-$B$5*B7^3

Note the dollar sign ($) that has been added to the references of the four constants, e.g.

B2 has become $B$2. The formula bar in Figure 2.25 reveals the above formula by

placing the cursor at cell B9.

To activate the Goal Seek command, go to the Data tab, select the What-If-Analysis

option in the Data Tools group and then select Goal Seek, as shown in Figure 2.26.

The Goal Seek dialog box shown in Figure 2.27.a will then appear to you. The dialog box asks you to select the “Set cell”, i.e. the cell that contains the dependent variable,

which is B9 in this case. You also have to specify the value sought for this cell and the

adjustable cell that stores the parameter to be changed. In this case, we seek the value in

the cell B9 to be 30 by changing the value of the cell B7. The completed form is shown in Figure 2.27.b.

Figure 2.26. Activation of the Goal Seek command

Page 52: Computer-Aided Thermofluid Analyses using Excel

Computer-Aided Thermofluid Analyses Using Excel

(a) (b)

Figure 2.27. Goal Seek Set-up for Example 2-4: (a) before completion (b) the

completed box

By pressing the “OK” button after completing the Goal Seek form, Excel will change

the value in the adjustable cell (B7) until the Set cell (B9) acquires the required value.

As shown in Figure 2.28, the answer obtained is Q = 0.003 m3/s which agrees with the

estimated value from the plot in Figure 2.25.

Figure 2.28. Goal Seek solution for Example 2-4

2.5.2. Iterative solution with circular calculations

A circular reference occurs when an Excel formula tries to refer to its own cell in a direct or indirect manner. In standard programming this is not allowed, but Excel gives

its user the option to use “circular calculation” if intended. In this case, Excel will

itearate until all the formulae involved are satisfied. The following example illustrates

this special feature which is useful for thermofluid analyses.

Example 2-5. Determining the final temperature of heated air

Heat is added to a piston-cylinder device that contains one kg of air initially at 300K. If 100 kJ of heat is added to the air at constant pressure, determine the final temperature of

Page 53: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

air taking into consideration that its molar specific-heat ( pc~ ) varies with temperature

according to the following formula:

32~ dTcTbTacp [kJ/kmol] (2.10)

Where a = 28.11, b =1.97x10

-03, c = 4.80x10

-06, and d = -1.97x10

-09.

Solution From the defenition of specific heat, the final temperature (T2) is given by:

McQTT p /~/12 (2.11)

Where T1 is the initial temperature, Q is the amount of heat added, and M is the molar

mass for air (M=29). If the variation of pc~ with temperature is ignored and its value at

T1 alone is used, Equation (2.11) determines T2 as 399.73K. However, we can be more

accurate by using Equation (2.10) to determine pc~ at the average temperature, Tavr =

(T1+T2)/2. Figure 2.29 shows the Excel sheet developed for this method which reveals

the formulae inserted in cells F2, F4, and F6.

Figure 2.29. Excel sheet developed for Example 2-5

As soon as we type Equation (2.11) in cell F6, Excel will make the warning message that there is a circulare refernce as shown in Figure 2.30.

Figure 2.30. The circular-reference prompt

Page 54: Computer-Aided Thermofluid Analyses using Excel

Computer-Aided Thermofluid Analyses Using Excel

The circular reference occurs because T2 depends on pc~ according to Equation (2.11)

while pc~ itself depends on T2 according to Equation (2.10). If we press the “OK” button

shown in Figure 2.30, the cells involved in the circular reference whill be identified as

shown in Figure 2.31. In this case, three cells are involved in the circular reference,

which are F2, F4, and F6.

Figure 2.31. The cells involved in the circular reference

Excel can iterate to determine the values of both T2 and pc~ that satisfy the relevant

equations if permitted because the iterative-calculation option is not allowed by default.

To allow it, go to File and select Options . The Backstage View form shown in Figure

2.32 will appear to you. Select Formulas , then the form will appear as shown in Figure 2.33. Enable iterative calculations by ticking (√) the box indicated in the figure and

press the “OK” button. Excel can now iterate to find the values of T2 and cp that

simultaneously satisfy Equations (2.10) and (2.11). Figure 2.34 shows the solution found by this method, which is T2 =398.976K.

Figure 2.32. Selecting Excel's option (Formulas)

Page 55: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

Figure 2.33. Enabling iterative calculations from Excel's Formulas option

Figure 2.34. Solution of Example 2-5 by circular calculations

This example can also be solved by using the Goal Seek command. In this case, we have to start the iterative solution by providing Excel with a guessed value for T2, call it T2o, based on which a new value for T2 is calculated, called it T2c. Since the guessed value T2c is unlikely to be correct, it will be different from T2o. Goal Seek is then used to adjust the value of T2o until the difference (Diff = T2c - T2o) vanishes. Most iterative solutions in this book are obtained by using the Goal Seek command. However, the circular-calculation option is more useful in certain situations as demonstrated in Chapters 8 and 9 that deal with the numerical solution of the heat-

conduction equation with the finite-difference method. 2.6. Excel‟s graphical tools for data presentation and analysis

Excel has numerous graphical tools that can be used to present the stored data in a variety of charts. Figure 2.35 shows one type of Excel charts that displays the annual variation of temperature and relative humidity at one location in a certain day. The figure shows a line chart in which the temperature is scaled on the primary y-axis (on the left) while the humidity is scaled on the secondary y-axis (on the right). This arrangement is useful for displaying two or more types of data that differ significantly in magnitude such as the net specific work and thermal efficiency of a power cycle.

Page 56: Computer-Aided Thermofluid Analyses using Excel

Computer-Aided Thermofluid Analyses Using Excel

Figure 2.35. An example of line charts

Excel supports other types of charts that allow the user to select the most appropriate

way to display his/her data in the form of bar, area, or scatter charts. For more information about the different types of Excel‟s charts, the reader can refer to

specialised references such as Walkenbach [2]. A number of tutorials and videos that

show how to create different types of charts can also be found in the internet.

Excel‟s charts provide a curve-fitting capability of numerical data by using the

Trendline feature. This capability is particularly useful for computer-aided thermofluid

analyses because it can be used to convert tabulated fluid-properties and other data into analytical equations that make the data more suitable for iterative solutions and

optimisation analyses. To illustrate the use of this feature, consider Table 2.1 that shows

properties of saturated water in the range 0.001oC – 60

oC. These values of the saturation

pressure (Psat) and saturated liquid enthalpy (hf) are used in psychrometric analyses of air-conditioning applications. For computer-aided analyses, it is useful to convert these

data into relevant equations.

The trendline feature provides a number of options, which include exponential, linear,

logarithmic, polynomial, and power equations as shown in Figure 2.36. To fit a

trendline to the data, we have to create line charts for the two properties as shown in

Figures 2.37.a and 2.39.b. Trendlines can then be added on the line charts. Figures 2.37.a and 2.39.b also show the corresponding trendline equations of the tabulated data

as determined by using polynomial equations. As Figure 2.37.b shows, a linear equation

is adequate for the hf data since its variation over the given temperature range is mild. However, a third-order polynomial is required to represent the variation of Psat with

temperature as shown in Figure 2.37.a.

0

10

20

30

40

50

60

0

5

10

15

20

25

30

35

40

45

Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec

Hu

mid

ity

(%)

Tem

pe

ratu

re (

oC

)

Month

temperature

Humidity

Page 57: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

Table 2.1. Properties of saturated water at temperatures in the range 0oC- 60

oC taken

from Cengel and Boles [3] ToC Psat

[kPa] v f [m3/kg]

vg [m3/kg]

uf [kJ/kg]

ug [kJ/kg]

hf [kJ/kg]

hg [kJ/kg]

sf [kJ/kg.K]

sg [kJ/kg.K]

0.01 0.6117 0.001000 206.00 0.000 2374.9 0.001 2500.9 0.0000 9.1556

5 0.8725 0.001000 147.03 21.019 2381.8 21.020 2510.1 0.0763 9.0249

10 1.2281 0.001000 106.32 42.020 2388.7 42.022 2519.2 0.1511 8.8999

15 1.7057 0.001001 77.885 62.980 2395.5 62.982 2528.3 0.2245 8.7803

20 2.3392 0.001002 57.762 83.913 2402.3 83.915 2537.4 0.2965 8.6661

25 3.1698 0.001003 43.340 104.83 2409.1 104.83 2546.5 0.3672 8.5567

30 4.2469 0.001004 32.879 125.73 2415.9 125.74 2555.6 0.4368 8.4520

35 5.6291 0.001006 25.205 146.63 2422.7 146.64 2564.6 0.5051 8.3517

40 7.3851 0.001008 19.515 167.53 2429.4 167.53 2573.5 0.5724 8.2556

45 9.5953 0.001010 15.251 188.43 2436.1 188.44 2582.4 0.6386 8.1633

50 12.352 0.001012 12.026 209.33 2442.7 209.34 2591.3 0.7038 8.0748

55 15.763 0.001015 9.5639 230.24 2449.3 230.26 2600.1 0.7680 7.9898

60 19.947 0.001017 7.6670 251.16 2455.9 251.18 2608.8 0.8313 7.9082

Figure 2.37. The Format Trendline window

Page 58: Computer-Aided Thermofluid Analyses using Excel

Computer-Aided Thermofluid Analyses Using Excel

(a) (b)

Figure 2.37. Fitting trendlines on tabulated data for water of

(a) saturation pressure and (b) saturated liquid enthalpy

2.7. Closure

This chapter described the main features of Excel needed for thermofluid analyses. The

chapter highlighted the importance of using cell labelling with Excel‟s formulae and illustrated the use of Excel‟s general mathematical functions, logical functions, and the

functions for matrix operations. The chapter also demonstrated the use of Excel‟s two

iterative tools: Goal Seek and circular calculations. In spite of its simplicity, the Goal

Seek command is very useful for iterative solutions as shown in later chapters of this book. Finally, the chapter illustrated the usefulness of Excel‟s charting tools for the

presentation of tabulated data particularly the trendline feature.

It should be mentioned that the Developer tab in Excel‟s user-interface provides a

number of other useful features that have not been mentioned in the chapter but needed

for enhancing the effectiveness of Excel as modelling platform for thermofluid analyses. One of these features is the ability to record macros for conducting repetitive

calculations and parametric analyses as illustrated in Appendix F.

References [1] J. Walkenbach, Excel 2010 Formulas, Wiley Publishing Inc., 2010

[2] J. Walkenbach, Excel 2007 Charts, Wiley Publishing Inc., 2007

[3] Y. A. Cengel and M. A. Boles. Thermodynamics an Engineering Approach, McGraw-Hill, 7

th Edition, 2007

[4] S. C. Chapra and R. P. Canale, Numerical Methods for Engineers, 6th

Edition,

McGraw Hill, 2010

y = 9E-05x3 - 0.0012x2 + 0.0788x + 0.5418

0

5

10

15

20

25

0 25 50 75

Satu

rati

on

pre

ssu

re (

kPa)

Temperature (oC)

y = 4.184x + 0.146

0

50

100

150

200

250

300

0 25 50 75

Enth

alp

y (k

J/kg

)

Temperature (oC)

Page 59: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

Exercises 1. The following table shows measured values of the temperature by two different

methods compared to the correct corresponding values. Find the average error for

each method.

Correct T (oC) Method 1 Method 2

0 0.1044 0.1112

10 10.1092 10.1153

20 20.1139 20.1194

30 30.1186 30.1235

40 40.1231 40.1275

50 50.1276 50.1316

60 60.1320 60.1357

70 70.1364 70.1397

80 80.1407 80.1438

90 90.1450 90.1479

100 100.1493 100.1520

2. The following table shows the data for the saturation pressure of a certain fluid. Use

a nested IF statement to develop an interpolation formula that determines the

saturation pressure of the fluid at any temperature in the range 5oC ≤ T ≤ 30

oC.

T(oC) Psat (kPa)

5 0.872

10 1.228

15 1.705

20 2.339

25 3.169

30 4.246

3. A system of algebraic equations can be expressed in matrix form as follows:

307

518

636

1040

1160

0170

c

b

a

Solve the system of equations to determine the values of the three unknowns a, b,

and c. This exercise is based on Example 9.11 in Chapra and Canale [4]. The answer is: a = 8.5941, b=34.4118, and c = 36.7647.

4. Figure 2.P4 shows a triangular fin attached to the surface of a wall. Solution of the

conduction heat transfer equation with the finite-difference method resulted in the

Page 60: Computer-Aided Thermofluid Analyses using Excel

Computer-Aided Thermofluid Analyses Using Excel

following system of linear equations the solution of which gives the temperatures in

oC at different distances from the fin base as shown in the figure:

Figure 2.P4. Trianangular fin

-8.008 T1 + 3.5 T2 = -900.209

3.5 T1 -6.008 T2 + 2.5 T3 = -0.209

2.5 T2 -4.008 T3 + 1.5 T4 = -0.209

1.5 T3 -2.008 T4 + 0.5 T5 = -0.209

T4 - 1.008 T5 = -0.209

Use Excel functions to solve the above system of linear equations.

5. Adopting suitable names in your formulae, prepare an Excel sheet for calculating

the frictional loss (hf) in a circular pipe of diameter D, length L, and roughness k s.

Use your sheet to determine hf in the following cases:

(a) D = 25 cm, L = 150 m, V = 2 m/s, k s = 0.045 mm, carrying water at 20oC.

(b) D = 25 cm, L = 150 m, V = 0.2 m/s, k s = 0.045 mm, carrying oil at 20oC.

(c) D = 25 cm, L = 150 m, V = 7 m/s, k s = 0.045 mm, carrying air at 20oC.

Use the Dracy-Weisbach equations and determine the values of the kinematic

viscosity from relevant property tables.

6. Using a line chart, plot the variation of sine θ for -180 ≤ θ ≤ 180 in steps of 10othen

add cosine θ on the same chart.

7. Using the data shown in Table 2.1, make a line chart for vf and vg. Add polynomial

trendlines for both and comment on the trendlines equations. 8. The table below shows some of the thermo-physical properties of air at

atmospheric pressure and different temperatures. Use Excel charts to show the

1 2 3 4 5 0

Page 61: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

variation of the properties ρ, β, cp, k, α, μ, ν, and Pr with temperature and use trendline to obtain suitable equations for these properties.

T

(K)

(kg/m3)

310 (1/K)

pc

(J/kg.K)

k(W/m.K)

(m2/s)

610

(N S/m2)

610

(m2/s)

Pr

273 1.252 3.66 1011 0.0237 19.2 17.456 13.9 0.71

293 1.164 3.41 1012 0.0251 22.0 18.240 15.7 0.71

313 1.092 3.19 1014 0.0265 24.8 19.123 17.6 0.71

333 1.025 3.00 1017 0.0279 27.6 19.907 19.4 0.71

353 0.968 2.83 1019 0.0293 30.6 20.790 21.5 0.71

373 0.916 2.68 1022 0.0307 33.6 21.673 23.6 0.71

473 0.723 2.11 1035 0.0370 49.7 25.693 35.5 0.71

573 0.596 1.75 1047 0.0429 68.9 29.322 49.2 0.71

673 0.508 1.49 1059 0.0485 89.4 32.754 64.6 0.72

773 0.442 1.29 1076 0.0540 113.2 35.794 81.0 0.72

9. The volume V of liquid in a spherical tank of radius r is related to the depth h of the

liquid by:

V = πh

2(3r −h)/3

Using the Goal Seek command, determine the value of h for the tank with r=1 m and V = 0.5 m

3.

This exercise is based on Problem 8.9 in Chapra and Canale [4]. Answer: h = 0.431

m.

Page 62: Computer-Aided Thermofluid Analyses using Excel

Computer-Aided Thermofluid Analyses Using Excel

3

Solver, VBA, and Thermax

Page 63: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

As the main component of the present modelling platform for thermofluid analyses, Excel provides the user-interface and built-in functions, two iterative tools, and graphic

tools. However, what make Excel an effective platform for thermofluid analyses are the

three auxiliary components; Solver, VBA, and Thermax. This chapter focuses on these three components and illustrates their use by means of relevant examples. With respect

to Solver, the chapter shows how its three solution methods can be used for performing

optimisation analyses and solving systems of linear and nonlinear equations. The chapter also shows how VBA can be used for developing custom functions and how

Thermax functions can be used in Excel formulae.

3.1. Solver Solver is a multi-purpose iterative tool developed by Frontline Systems [1] as an Excel

add-in for “What-if” analyses. Compared to Excel‟s own iterative tool, which is the

Goal Seek command described in Chapter 2, Solver offers the following advantages:

1. While Goal-Seek can only be used for simple problems that involve only one

decision variable, Solver can deal with more difficult problems in which the

objective cell is affected by numerous decision variables. 2. Goal Seek allows only a required value of the objective cell to be achieved, but

Solver also enables Excel to perform an optimisation analysis by finding the

maximum or minimum value for the formula in the objective cell. 3. Solver allows constraints to be applied on the solution, which is not possible

with Goal Seek. The ability to impose constraints is needed for both

optimisation analyses and iterative solutions.

4. Solver offers three solution methods that suit different types of problems and gives the user a number of numerical options for applying the same method.

3.1.1. Activation of Solver Like the Goal Seek command, Solver is found in the Data tab as shown in Figure 3.1.

If it doesn‟t appear in your Data tab, then go to File and then click Options and select

Add-Ins . From the Manage option at the bottom of the menu select Excel Add-ins and

then klick “Go”. The Add-Ins dialog box shown in Figure 3.2 will be shown. To add Solver to the add-ins menu, tick (√) on the “Solver” option and return to the Data tab.

When you click the Solver button from the Data tab, the Solver Parameters dialog

box shown in Figure 3.3 will be shown.

Figure 3.1. The Solver add-in in the Data tab

Page 64: Computer-Aided Thermofluid Analyses using Excel

Computer-Aided Thermofluid Analyses Using Excel

Figure 3.2. Activating Solver from the menu of Excel add-ins

Figure 3.3. Solver Parameters dialog box

Page 65: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

Solver Parameters dialog box helps the user to select a formula in one cell, called the objective cell, and a group of other cells, called decision variables or variable cells,

which are directly or indirectly related to the formula in the objective cell. By adjusting

the decision variables , the objective cell can be maximised, minimised, or made to acquire a certain value. As shown in Figure 3.3, constraints can be applied on the

decision variables. To suit different types of problems, Solver offers three solution

methods which are:

1. The GRG Nonlinear method,

2. The Evolutionary method

3. The Simplex LP method.

The GRG Nonlinear method involves the determination of the function‟s gradient like

the Steepest Descent method [2, 3]. The Evolutionary method adopts a variety of genetic algorithms and local search methods [4, 5]. While both the GRG Nonlinear

and the Evolutionary methods are suitable for non-linear problems, the Simplex LP

method, which is a linear-programming method, is suitable for linear problems. As

shown in Figure 3.3, Solver uses the GRG Nonlinear method by default. The following sections give examples of using the three solution methods.

3.1.2. The GRG Nonlinear method In an optimisation analysis we may require the objective function to be maximised or

minimised depending on the situation at hand. For example, the optimisation of pipe

insulation requires its total cost to be minimised, while the optimisation of a thermal

power plant requires its thermal efficiency to be maximised. The following example illustrates the use of the GRG Nonlinear method in optimisation analyses.

Example 3-1. Finding the minimum value of a quadratic function Find the minimum value of the following quadratic function in the specified range.

f (x) =x2 −2x – 1; −2 ≤ x ≤3 (3.1)

Solution

Figure 3.4 shows the Excel sheet developed for this example. The line chart inserted in

the figure shows the variation of f with x from which we can see that the minimum value of f is -2 and occurs at x =1. An initial value for x is entered in cell B3 based on

which the function f(x) is calculated in cell B6 according to Equation (3.1). Note the

curser is placed on cell B6 to reveal the following formula typed in the cel:

= B3^2-2*B3−1

We can now use Solver to determine the minimum value of the function. To do so, select Solver from the Data tab and fill its parameters dialog-box as shown in Figure

3.5 that shows the top part of the completed box.

Page 66: Computer-Aided Thermofluid Analyses using Excel

Computer-Aided Thermofluid Analyses Using Excel

Figure 3.4. Excel sheet for determining the local minimum of the quadratic function

Figure 3.5. The completed Solver dialog box for Example 3-1

The dialog box in Figure 3.5 has been filled as follows:

Set Objective: B6 and Min have been selected for this option since

want the value of the function in cell B6 is to be minimised

By Changing Variable Cells: B3 which is the cell that stores the value of the

independent variable x Subject to the Constraints: Two constraints have been added that specify the

minimum and maximum values of x, e.g. x ≥ -2 and

x ≤ 3

Select a Solving Method: The GRG Nonlinear method (the default option)

Pressing the “Solve” button of the completed parameters box sparks Solver to find the

required solution. As shown Figure 3.6, shows, the answer found by Solver, which is x = 1, f = -2, agrees with the graphical solution shown in Figure 3.4.

Page 67: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

Figure 3.6. Solver solution for Example 3-1

3.1.3. The Evolutionary method

When the function to be optimised has more than one point of inflection, the solution found by the GRG Nonlinear method may only be a local minimum or maximum. The

following example illustrates the capability of the Evolutionary method to find the

global optimum solution for a simple function.

Example 3-2. Finding the global minimum of a function Determine the global minimum value for the following function:

)cos(xxxf 3 ≤ x ≤ 14 (3.2)

Solution

Figure 3.7 shows the Excel sheet developed for solving this example. The insert shows that the function has two minima in the specified range of x; one at x ≈ 5 and another at

x ≈ 11. Let us first try to solve the problem with the GRG Nonlinear method. An initial

value for x has been entered in cell B2 based on which the function f is calculated in cell B4. The formula bar in Figure 3.7 reveals the formula entered in the cell B4. Figure

3.8 shows the completed Solver parameters dialog-box with two constraints that specify

the upper and lower limits for x. From Figure 3.9 that shows the solution found by

Solver it is clear that it found the local minimum (y = − 4.81) which is nearer to the initially specified value and not the global minimum.

In order to locate the global minimum by the GRG Nonlinear method, the solution has to be started with an initial guess that is closer to the global minimum, e.g., x = 9. The

advantage of the Evolutionary method is that such an arrangement is not required. The

set-up shown in Figure 3.8 only needs the solution method to be changed to

“Evolutionary”. Figure 3.10 that shows the solution obtained by this method confirms that the method produced the global minimum (y = − 11.041).

Page 68: Computer-Aided Thermofluid Analyses using Excel

Computer-Aided Thermofluid Analyses Using Excel

Figure 3.7. The Excel sheet for Example 3-2

Figure 3.8. Solver set-up for Example 3-2 with GRG Nonlinear method

Figure 3.9. Solver solution for Example 3-2 with the GRG Nonlinear method

Page 69: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

Figure 3.10. Solver solution for Example 3-2 with the Evolutionary method

The Evolutionary method is useful for optimisation analyses that involve non-smooth

and discontinuous functions, which are difficult to solve with the GRG Nonlinear method. However, its disadvantage is that it takes long computer times. While the GRG

Nonlinear method took less than a second to solve the above problem, the

Evolutionary method took one minute and 35 seconds.

3.1.4. The Simplex LP method

This option provides a method for solving small systems of linear equations that can be used instead of the method described in the Chapter 2 by using Excel‟s matrix

functions. The method will be illustrated by reconsidering the problem of Example 2-3.

Figure 3.11 shows a new Excel sheet for solving the problem with the present method.

Figure 3.11. Excel sheet for solving Example 2-3 with Solver

The top part of the sheet stores the coefficient matrix [A] and the right-hand vector {y} of the system of linear equations to be solved. The procedure starts with a guessed

solution which is stored as vector {x0} in cells F9:F13. All the elements of this vector

Page 70: Computer-Aided Thermofluid Analyses using Excel

Computer-Aided Thermofluid Analyses Using Excel

are given a value of 1 as shown in Figure 3.11. The coefficient matric [A] is then multiplied by the guessed vector {x0} using Excel‟s ”MMULT” function and the result

stored in cells H9:H13. If this initial guess is the correct answer, the multiplication

[A]{x0} will be the same as the true right-hand side vector, i.e,:

[A]{x0} = {y} (3.3)

However, Figure 3.11 shows that the vector [A]{x0} is different form the true right-

hand side vector {y} stored in cells H2:H6. Solver can now be used to adjust the

variable cells D9:D13 so that all elements of the vector [A]{x0} become equal to their

counterparts in vector {y}, i.e:

H9 = H2

H10 = H3

H11 = H4

H12 = H5

H13 = H6

Solver set-up for this task is shown in Figure 3.12.

Figure 3.12. Solver set-up for Example 2-3 with the Simplex LP method

Note that the objective cell is left blank and the Simplex LP method is selected as the

solution option. In this case, Solver will iterate to find the values of the decision

Page 71: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

variables that satisfy all the imposed constraints. The solution found by Solver using the above set-up is shown in Figure 3.13.

Figure 3.13. Solution of Example 2-3 with the Simplex LP method

All the elements of the [A]{x0} are now equal to their corresponding elements in the

vector {y}. The first element of the solution vector, which is -6.6x10-16

, is practically

zero. Therefore, the solution is [0,1,2,3,4], which is the same as that obtained in Example 2-3 by using the matrix-inversion method. The advantage of Solver compared

to the matrix-inversion method is that it can be used for solving systems of nonlinear

equations by following a similar procedure (Refer to Problem 3.5 in the Exercises).

3.1.5. The default settings of Solver options

Solver gives it user the chance to improve the performance of its three solution methods

by allowing alternative options for applying these methods. While some options are common to all three solution methods, others are particular to the GRG Nonlinear or

the Evolutionary method. By clicking the “Options” button in Solver‟s parameters

dialog box shown in Figure 3.14, the dialog box shown in Figure 3.15 will be shown.

Figure 3.14. Solver options in the Properties dialog box

Page 72: Computer-Aided Thermofluid Analyses using Excel

Computer-Aided Thermofluid Analyses Using Excel

Figure 3.15. Default Solver options adopted in the analyses for all solution methods

Figure 3.15 shows the default settings of the options that are common to all three

solution methods. Some of these default settings may have to be changed in order to reduce the computation time or increase the precision of the solution in certain

situations. Sometimes, Solver fails altogether to find the solution if the default options

are used. For example, certain analyses require the automatic-scaling (AS) option to be used while others require it not to be used. AS enables Solver to handle a poorly-scaled

model, i.e. a model in which the values of the objective and constraint functions differ

by several orders of magnitude. By using AS, the values of the objective and constraint functions are scaled internally in order to minimise the differences between them.

Figures 3.16.a and 3.16.b show the default settings which are particular to the GRG

Nonlinear method and to the Evolutionary method, respectively. The GRG Nonlinear method uses by default the forward difference (FD) approximation of derivatives. Most

of the analyses presented in later chapters of the book used the GRG Nonlinear

method for which the default FD approximation is used.

Page 73: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

(a) (b)

Figure 3.16. The default Solver options specific to: (a) the GRG Nonlinear method and

(b) the Evolutionary method

Figure 3.16.b shows the default settings used by the Evolutionary method. Note that

this method has more adjustable parameters than the GRG Nonlinear method.

According to the default set-up, the population size is 100 and the maximum allowable time without improvement is 30 seconds. The few cases in this book solved with the

Evolutionary method show that, with this set-up, the method needs long computer

times. Although the time required by the Evolutionary method can be reduced by reducing the population size, number of iterations, or the maximum allowable time, the

optimsation analyses presented in later chapters to do not show a clear advantage to this

method over the GRG Nonlinear method which is easier to apply.

3.2. VBA and the development of user-defined functions

Although Solver and the Goal Seek command enable Excel to deal with a wide range of

thermofluid analyses, there are situations where the analytical model requires the development of a customised user-defined function (UDF) that is not provided by

Excel. This arises, for example, in thermodynamic analyses that require functions that

determine the properties of fluids at various pressures and/or temperatures. This section

illustrates the process of activating VBA and using it to develop simple UDFs.

Page 74: Computer-Aided Thermofluid Analyses using Excel

Computer-Aided Thermofluid Analyses Using Excel

3.2.1. Activation of VBA As shown in Figure 3.17, VBA is found on the left side of the Developer tab. This tab

gives many other development tools. If the Developer tab is not shown in the ribbon of

your Excel sheet, then go to File , select Options , and then select to Customise Ribbon from the Backstage View shown in Figure 3.18.

Figure 3.17. Selection of VBA from the Developer tab

Figure 3.18. Adding VBA to the Developer tab

Page 75: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

From the Main Tabs , select the Developer check box and then click “OK”. The Developer tab will now be shown in the ribbon of your Excel sheet. To start writing

the UDF, go to Developer tab menu and select Visual Basic. The Visual Basic editor

will appear to you as shown in Figure 3.19. Select Insert → Module and the blank page shown in Figure 3.20 will be open for you to type the VBA code.

Figure 3.19. Inserting a new module

Figure 3.20. A new VBA module

Page 76: Computer-Aided Thermofluid Analyses using Excel

Computer-Aided Thermofluid Analyses Using Excel

3.2.2. Development of UDFs As a first example let us write a VBA function for determining the area (A) of a circle

given its diameter (D) using the following mathematical equation:

4/2DA (3.4)

The following UDF determines the circle‟s area according to Equation (3.4):

Function Circ_area(Dia)

Pi = 3.141593

Circ_area = Pi * Dia ^2 / 4 End Function

Note that the first line in the code starts with the word “Function” followed by the

name given to the function, which is “Circ_area”. The required input parameters are specified between two brackets after the function name. The present function has only

one input parameter, which is the diameter (Dia). As soon as you type the first line of

the code and press the “Enter” key, the editor will automatically add the End line of the function. Now, type the rest of the code as shown in Figure 3.21.

Figure 3.21. A UDF for caclcuating the area of a circle with a given diameter

After typing the code correctly, the function can be used via Excel UI just like any

built-in function as shown in Figure 3.22. Note that the formula bar in Figure 3.22

reveals the formula in cell B2 as:

= Circ_area(10)

Where the number 10 refers to the diameter of the circle, which is the only input to the

UDF. You can now check the answer of your user-defined function by calculating the

circle‟s area with a normal Excel formula by typing in any cell “=pi()*10^2/4”.

Page 77: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

Figure 3.22. Using the “Circ_area” function in Excel

For thermodynamic analyses, VBA is useful for developing UDFs for fluid properties.

As an example, let us develop a UDF that determines the molar specific-heat at constant

pressure ( pc~ ) for air. For an ideal gas, pc~ is given by the following polynomial [6]:

3

32

210~ TaTaTaac p [kJ/kmol.K] (3.5)

Where T is the absolute temperature and a0, a1, a2, and a3 are constants that have

different values for different gases. For air, the constants‟ values are 28.11, 0.1967x10-2

,

0.4802 x10-5

, and -1.966 x10-9

in this order.

The following VBA function, called “cp_air”, determines pc~ for air based on Equation

(3.5). The only input for the function is the absolute temperature (TempK).

Function cp_air(TempK)

a0 = 28.11

a1 = 0.00196

a2 = 0.000004802 a3 = -0.000000001966

M = 28.97

cpbar = a0 + a1 * TempK + a2 * TempK ̂2 + a3 * TempK ̂3 cp_air = cpbar / M

End Function

Figure 3.23 shows the VBA function and the formula bar in Figure 3.24 shows how the

function can be used in an Excel formula to determine pc~ for air at 300K. The value

returned by the function is 29.0771 kJ/kmol.K. By making suitable extensions, the

function can easily be used to determine the values of pc~ for other ideal gases in

addition to air (Refer to Exercise 3.8). The various functions provided by Thermax for the thermo-physical properties of water, refrigerants, etc., have been developed by

writing similar functions with VBA.

Page 78: Computer-Aided Thermofluid Analyses using Excel

Computer-Aided Thermofluid Analyses Using Excel

Figure 3.23. A UDF for caclcuating the molar specific-heat for air

Figure 3.24. Using the cp_air function in Excel

In writing the UDF for the circle‟s diameter shown in Figure 3.21 we assigned a value

for the constant π because VBA does not provide a built-in function for it like Excel. However, this is not necessary since it is possible to use the built-in functions PI

provided by Excel within the VBA function. This is very useful when built-in functions,

like MIN and MAX, can be used to minimise the programming effort needed for developing the required UDF. More information about this and other features of the

VBA language can be found in specialised references [7-9].

3.3. Thermax installation and use By providing custom functions for fluid properties, Thermax enables Excel to be used

as an educational platform for a wide range of thermofluid analyses [10]. Before

Thermax can be recognised by Excel you have to install it in your computer. To do that, open the Thermax.xla file and then save it as an “Excel Add-in”. Recent Excel

versions locate all add-ins in a certain folder in the computer and automatically direct

Page 79: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

you to that location when you want to save a new add-in. Save the Thermax add-in in the specified location and restart Excel in order to activate it. Open a new Excel sheet

and then do the following:

1. Go to File and then click Options .

2. Select Add-Ins . From the Manage ribbon at the bottom of the menu select

Excel Add-ins and then press Go. The pull-down menu shown in Figure 3.25 will appear to you.

3. To add Thermax to the add-ins menu, tick (√) the corresponding box.

4. If for any reason you saved the add-in in a location that is different from the

default folder, then click on Browse and search for it in the destination folder and select it.

Figure 3.25. Adding Thermax to the menu of Excel add-ins

Once installed, Thermax functions can be used in Excel's formulae just like the built-in

functions. For illustration, let us start a formula by entering the equal sign (=) in any cell (say cell B2). If you now press the fx button in the formula ribbon, the Function

Wizard shown in Figure 3.26 will be shown. The Function Wizard first lists the various

categories of built-in functions provided by Excel. Scroll down the list of function

categories and select the User-defined functions. Then, all the functions provided by Thermax will be listed alphabetically as shown in Figure 3.27.

Page 80: Computer-Aided Thermofluid Analyses using Excel

Computer-Aided Thermofluid Analyses Using Excel

Figure 3.26. Finding the add-in user-defined functions in the Function Wizard

Figure 3.27. Thermax functions listed alphabetically in the User Defined category

Page 81: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

The first function in the list, Air_Data, is the auxiliary function that stores the data for the thermo-physical properties of air at standard atmospheric pressure. This function is

called by other functions in the same to obtain the values of these properties at the

required temperature.

To start using the add-in functions, scrol down the list and select the function Airk_T

that determines the thermal conductivity (k) of air at a given temperature. Upon pressing the OK button, the Function Arguments box shown in Figure 3.28 will be

shown.

Figure 3.28. The Function Arguments box for the “Airk_T” function

Figure 3.28 shows that this function has one input parameter, which is the temperature

in oC “TempC”, and gives a brief description of its intended use. Let us use the function

to determine the thermal conductivity for air at 25oC. Fill the form by entering the value

of the temperature, 25, as shown in Figure 3.29.

Figure 3.29. Using the function “Airk_T” to determine the thermal conductivity of

atmospheric air at 25oC

Page 82: Computer-Aided Thermofluid Analyses using Excel

Computer-Aided Thermofluid Analyses Using Excel

Note that the formula ribbon now shows the formula in cell B2, which is “=Airk_T(25)”. The form also shows the calculated value of k , which is 0.02551

W/m.oC. When you press the “OK” button, this value will appear in the cell B2. You

can check this value with that given in Table A.1 and try other Thermax functions.

In certain situations the confinement of Excel‟s formula to one cell becomes too

restrictive for developing the analytical model. This situation arises, for example, when an iterative process involves a non-linear equation such as the Colebrook-White

equation or the Soave-Redlich-Kwong equation of state. In this case, a UDF is needed

solve the nonlinear equation and return the result to Excel‟s formula like any built-in

function. For such a case, Thermax provides a Newton-Raphson solver for nonlinear equations in addition to its property functions. Appendix B shows how to use this tool.

Appendix B also describes two interpolation functions provided by Thermax for

tabulated data which are useful for including additional fluid properties or other tabulated data needed in a thermofluid analysis.

3.4. Closure

This chapter introduced the three auxiliary components of the Excel-based modelling platform, Solver, VBA, and Thermax, that make it an effective platform for thermofluid

analyses. The chapter gave Examples of using the three solution methods provided by

Solver to deal with different types of problems. It also showed how VBA can be used for developing user-defined functions not provided by Excel and explained the

procedure for installing Thermax and using its functions in Excel formulae. Appendix B

demonstrates the use of the Newton-Raphson solver provided by Thermax for solving

nonlinear equations and its two interpolation functions for tabulated data.

References [1] Frontline Systems, internet: http://www.Solver.com/ (Last accessed November

23, 2015). [2] L.S. Lasdon, R.L. Fox, M.W. Ratner, Nonlinear optimization using the

generalized reduced gradient method, Revue Française d'Automatique,

Informatique et Recherche Opérationnelle, tome 8, V3 (1974), p. 73-103.

Available at: http://www.numdam.org/article/RO_1974__8_3_ 73_0.pdf [3] Wikkipedia, https://en.wikipedia.org/wiki/Gradient_method

[4] https://en.wikipedia.org/wiki/Evolutionary_algorithm

[5] Wikkipedia, https://en.wikipedia.org/wiki/Evolutionary_algorithm [6] Y. A. Cengel and M. A. Boles. Thermodynamics an Engineering Approach ,

McGraw-Hill, 7th

Edition, 2007

[7] J. Walkenbach, Excel 2013 Power Programming with VBA, Wiley Publishing, Inc. 2013.

[8] J. L. Latham, Programming in Microsoft Excel VBA, An Introduction, 2008.

Internet: http://ies.fsv.cuni.cz/default/file/download/id/21101 (Last accessed

November 29, 2015). [9] http://www.fontstuff.com/vba/vbatut01.htm (Last accessed November 26, 2017).

Page 83: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

[10] Thermax: An Excel add-in for Thermofluid Analyses. Available at: https://www.mendeley.com/library/fileproxy?id=04a975bf-59cf-cde5-

7abe54d5b118d1e6

[11] S.C. Chapra and R.P. Canale, Numerical Methods for Engineers, 6th

Edition, McGraw Hill, 2010.

Exercises 1. A system of algebraic equations can be expressed in matrix form as follows:

307

518

636

1040

1160

0170

c

b

a

Solve the system of equations by using Solver to determine the values of the three unknowns a, b, and c. This exercise is based on Example 9.11 in Chapra and

Canale [11]. The answer is: a = 8.5941, b=34.4118, and c = 36.7647.

2. Draw a line chart with Excel to show the variation of the following function in the

range 0 ≤ x ≤4:

f(x) = 2 sin x − x2/10

Use Solver to find the maximum of the function in the same range. Based on

Example 13.1 in Chapra and Canale [11]. The answer is: f(x) = 1.7757 at x

=1.4276.

3. The curve shown in Figure 3.P3 is a plot of the function:

2sinef

Figure 3.P3 A composite function

-14

-12

-10

-8

-6

-4

-2

0

2

4

0 100 200 300 400

Fun

ctio

n

Angle

Page 84: Computer-Aided Thermofluid Analyses using Excel

Computer-Aided Thermofluid Analyses Using Excel

Use Solver to find:

a) The minimum value of the function and the corresponding angle

b) The maximum value of the function and the corresponding angle c) The angle at which value of the function equals 4.0

4. Using the Excel sheet developed to solve Example 3-1 by the GRG Nonlinear method, study the effect of using central-difference approximation of derivatives

instead of the default forward-difference approximation on the solution.

5. Consider the following set of simultaneous nonlinear equations:

x2 + xy = 10 (A)

y +3xy

2 = 57 (B)

To solve the system with Solver, rearrange the equations as follows:

u(x, y) = x

2 + xy−10 = 0 (C)

v(x, y) = y + 3xy2 −57 = 0 (D)

Create two cells (B1 and B2) to hold initial guesses for x and y. Enter the function

values themselves, u(x, y) and v(x, y) into two other cells (B3 and B4). The initial

guesses may result in function values of u and v that are far from zero. Determine the sum of the function squares, i.e. u

2 + v

2, and store it in cell B5.

Use Solver to find the values of x and y in cells B1 and B2 (the Changing cells) that make the value in cell B5 (the objective cell) equal to zero. Using this

procedure, find the roots of the above system starting with initial guesses of x =1

and y = 3.5.

This exercise is based on Example 7.5 in Chapra and Canale [11]. The correct pair

of roots are x=2 and y=3.

6. The volume V of liquid in a spherical tank of radius r is related to the depth h of

the liquid by:

V = πh

2(3r −h)/3

Using VBA, develop a user-defined function that determines h at any given values

of r [m] and V [m3]. Check your function with r=1 m and V = 0.5 m

3. Answer: h =

0.431 m.

Page 85: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

7. Extend the UDF developed in Section 3.2 for determining the specific heat for air so that it can be used for other ideal gases as well. Note that in this case, the

function will have two input parameter: the name of the gas and the temperature.

8. Using suitable formulae for the thermodynamic properties of superheated steam, develop user-defined functions with VBA for determining the specific enthalpy

and entropy of superheated steam from its pressure and temperature.

9. Using suitable formulae for the thermodynamic properties of superheated refrigerant R134a, develop user-defined functions with VBA for determining

properties, e.g., enthalpy and entropy, of superheated R134a from its temperature

and pressure.

Page 86: Computer-Aided Thermofluid Analyses using Excel

Computer-Aided Thermofluid Analyses Using Excel

4

Iterative solutions

Page 87: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

The need for computer-aided iterative solutions is common to all three types of thermofluid analyses and arises for a number of reasons. This chapter gives examples of

such analyses and shows how they can be handled by using the two iterative tools

provided by Excel; the Goal Seek command and Solver. While the Goal Seek command can be used for the simplest type of iterative solutions that involve a single parameter,

Solver is needed for those involving multiple variables and requiring certain constraints

to be satisfied by the iterative solution. When the analytical model involves a nonlinear equation, such as the Colebrook-White equation, it becomes difficult to use only Goal

Seek and Solver. For such problems, the chapter shows how the Newton-Raphson

solver provided by Thermax can be used to deal with the nonlinear equation, leaving

the main iteration to Goal Seek or Solver.

4.1. Iterative solutions by using Goal Seek

Most thermofluid problems that require iterative solutions can be solved by using the Goal Seek command. This section presents three examples that demonstrate its use for typical analyses that require iterative solutions in fluid-dynamics, thermodynamics, and heat-transfer.

4.1.1. Type-2 and type-3 pipe-flow analyses The frictional head loss (hf) in a pipe depends on a number of factors that characterise

the pipe itself as well as the fluid being transported. For a straight pipe with no fittings

carrying a viscous Newtonian and incompressible fluid, the frictional head loss is determined by the following Darcy-Weisbach equation:

g

V

D

Lfh f

2

2

(4.1)

Where f is the Darcy friction factor, L the length of the pipe, D its diameter, V the fluid

velocity, and g the gravity acceleration constant. The friction factor can be obtained

from Equation (1.22) if the flow is laminar and from Equation (1.24) or (1.25) if it is

turbulent. Practical pipe-flow problems that involve Equation (4.1) can be divided into three types [1]:

1. Type-1 problems – require the determination of hf when both the pipe‟s diameter and fluid velocity (or flow rate) are known.

2. Type-2 problems – require the flow rate to be determined for a specified hf and

pipe diameter.

3. Type-3 problems – require the pipe diameter to be determined for a given hf and flow rate.

Type-1 problems can be solved in a straight-forward manner by using Equation (4.1) to determine the friction head loss. However, both type-2 and type-3 problems require

iterative solutions because the Reynolds number and, therefore, the friction factor, f,

Page 88: Computer-Aided Thermofluid Analyses using Excel

Computer-Aided Thermofluid Analyses Using Excel

cannot be determined without knowing D or V. For type-2 problems (i.e. unknown flow rate), the iterative procedure can be avoided by using extended Moody diagrams that

require the determination of the following dimensionless parameter [2]:

5.0

5.15.0

2Re

L

ghDf

f

. (4.2)

Apart from the inaccuracy of visual chart interpolation, the procedure is difficult to

adopt in optimisation or parametric analyses. By using the Goal Seek command, both type-2 and type-3 problems can be solved more accurately. The following example,

which is based on Example 8.4 in Cengel and Cimbala [1], shows how Goal Seek can

be used to solve a type-3 problem.

Example 4-1. Solution of type-3 pipe flow problems

Heated air at 1 atm and 35°C is to be transported in a 150-m-long circular plastic duct

(ε=0.045 mm) as shown in Figure 4.1 at a rate, Q, of 0.35 m3/s. If the head loss in the

duct is not to exceed 20 m, determine the smallest required diameter for the duct.

Figure 4.1. Schematic for Example 4-1 (adapted from Cengel and Cimbala [1])

Solution with Goal Seek

The problem can be solved by calculating the friction head loss at different diameters of the duct and then selecting the diameter that gives the required head loss which is 20 m.

The iterative solution proceeds as follows:

1. Select a diameter for the inner pipe (D) 2. Calculate the velocity of the hot air (V), V=Q/A, A=πD

2/4

3. Calculate the Reynolds number in the pipe (Re), Re=VD/ν

4. Calculate the friction factor (f) using Equation (1.22) or (1.24) 5. Calculate the friction head loss (hf) from Equation (4.1)

6. If hf ≠20 m, repeat steps 1 to 5

Figure 4.2 shows the Excel sheet developed for this example which is divided into three parts: (i) problem data (ii) calculations, and (iii) results. The data part shows the

information given in the question. The value of the kinematic viscosity of air at 35°C (ν

= 1.655x10-5

m2/s) was obtained from Cengel and Cimbala [1] and fixed throughout the

0.35 m3/s

air

150 m

D

Page 89: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

calculations. Cell-labelling is applied in the formulae and Figure 4.2 reveals the formulae used in each cell of the calculations part. Note the If-function in cell F10.

Figure 4.2. Excel sheet and Goal Seek set-up for Example 4-1

As Figure 4.2 shows, for an assumed duct diameter of 0.1 m the friction head loss

exceeds 2761 m. Figure 4.2 also shows the completed Goal Seek dialog box that requires Goal Seek to change the diameter in cell F2 and iterate until the friction head

loss in cell J2 attains the required value of 20 m. Figure 4.3 shows the answer found by

Goal Seek, which is D ≥ 0.27 m. This answer agrees with that given by Cengel and Cimbala [1]. A similar procedure can be used to solve type-2 flow problems by iterating

over the flow rate instead of the diameter.

Figure 4.3. Goal Seek solution for Example 4-1

4.1.2. Thermodynamic analyses involving ideal-gas mixtures

Without the usual simplifications and idealisations applied in thermodynamic analyses most of these analyses, if not all, would require iterative solutions. A commonly used

thermodynamic approximation is treating air as a pure gas even though it is known to

be a mixture of nitrogen, oxygen, and water vapour with small traces of other gases.

Page 90: Computer-Aided Thermofluid Analyses using Excel

Computer-Aided Thermofluid Analyses Using Excel

Computer-aided analyses with fluid property functions such as those provided by Thermax enable more realistic models to be used by treating air as a mixture of gases

instead of a single gas. However, if the temperature of the gas mixture is not known but

has to be determined, an iterative solution will be required by this model. The following example shows how the problem can be solved by using Goal Seek.

Example 4-2. Constant-pressure expansion of air Figure 4.4 shows a piston-cylinder device that initially contains a mixture of 21%

oxygen and 79% nitrogen by volume. Initially at 100 kPa, 330K, the gas mixture

occupies 0.1 m3. Fifty kJ of heat is then transferred to the gas causing it to expand at

constant pressure. Treating oxygen and nitrogen as ideal gases, determine the final temperature of the gas inside the cylinder.

Figure 4.4. Schematic diagram for Example 4-2

The analytical model

The solution procedure applies the first-law of thermodynamics to the expansion process. For a mixture of O2 and N2, the first law reads:

(4.3)

Where Q is the amount of heat added, mO2 and mN2 are the masses of oxygen and nitrogen in the device, h1_O2 and h2_O2 are enthalpies of oxygen at the initial and final

temperatures, respectively, and h1_N2 and h2_N2 are the corresponding enthalpies for

nitrogen. The correct value of the final temperature is that at which the amount of heat added as obtained from Equation (4.3) is equal to the given value, which is 50 kJ.

The values of enthalpy for O2 and N2 in Equation (4.3) can be determined by using the

relevant Thermax function for ideal gases, Gash_TK, and the masses mO2 and mN2 can be obtained from the ideal-gas law using the corresponding partial pressures as follows:

O2 21%, N2 79%

T1 = 330K

P1 = 100 kPa

V1 = 0.1 m3

Heat 50 kJ

2_12_222_12_22 NNNOOO hhmhhmQ

Page 91: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

12

112

21.0

TR

VPm

O

O (4.4)

12

112

79.0

TR

VPm

N

N (4.5)

Where RO2 and RN2 are the gas constants for oxygen and nitrogen, which are 0.2598 kJ/kg.K and 0.2968 kJ/kg.K, respectively.

Solution with Goal Seek Figure 4.5 shows the Excel sheet developed for this example. The data part includes the

initial pressure, temperature, and volume of the gas mixture together with the mole

fractions and gas constants of oxygen and nitrogen. The initial partial pressures of

oxygen and nitrogen, P1_O2 and P1_N2, are calculated from the total initial pressure (P_1) and the respective volume fractions, y_O2 and y_N2, as shown in cells E2 and

E3, respectively. The masses of the two gases in the mixture (m_O2 and m_N2) are

calculated in cells E5 and E6, respectively, and the total mass (m_total) in cell E8.

Figure 4.5. The Excel sheet developed for Example 4-2 by using Thermax functions

Starting with a guessed value for the final temperature, T_2g, which is 500K, the initial and final enthalpies of oxygen and nitrogen are determined by using Thermax function Gash_TK at the corresponding temperatures. Equation (4.3) is then used to determine the total amount heat added in the process (Q_g). With the guessed final temperature, Equation (4.3) determined the total amout of heat as 18.4 kJ, which is less than the actual values of 50 kJ. To find the appropriate final temperature, the guessed temperature T_2g has to be adjusted by Goal Seek so that the value of Q_2g equals 50 kJ. Figure 4.5 shows the required Goal Seek set-up and Figure 4.6 shows the solution obtained by Goal Seek, which is 780.444K. The value determined for T2 by treating air as a single pure gas and using the approximate constant specific-heat method (cp = 1.005 kJ/kg) is 801.2K, which is significantly different, but the value determined by using the exact method is 781.6K. Although these results confirm the accuracy of treating air as a single pure gas with the exact method of analysis, the deviation from the present model is expected to increase as T2 increases.

Page 92: Computer-Aided Thermofluid Analyses using Excel

Computer-Aided Thermofluid Analyses Using Excel

Figure 4.6. Goal Seek solution for Exampe 4.2 by using Thermax functions

4.1.3. Convection heat-transfer analyses Like the friction factor (f) in pipe-flow analyses, the convection heat-transfer coefficient

(h) is not constant but depends on the flow itself. Therefore, convection heat-transfer

analyses frequently involve iterative solutions. The following example shows how Excel‟s Goal Seek command can be used for such analyses. The example is based on

Example 10.1 in Holman [3].

Example 4-3. Overall heat-transfer coefficient for pipe in air

Hot water at 98oC flows through a 2-in schedule 40 horizontal steel pipe (k =54

W/m·◦C) and is exposed to atmospheric air at 20oC as shown in Figure 4.7. The water

velocity is 25 cm/s.

Figure 4.7. Schematic for Example 4-3 (adapted from Holman [3])

Calculate:

(a) the rate of heat-transfer through the pipe,

(b) the temperatures at the inside and outside surfaces of the pipe, and (c) the overall heat-transfer coefficient based on the outer area of the pipe.

Properties of water at 98oC are: ρ = 960 kg/m

3, μ = 2.82 x 10

-4 kg/m.s, k = 0.68 W/m.

oC,

Pr = 1.76. For a 2-in schedule 40 pipe, Di = 5.25 cm and Do = 6.033 cm.

The analytical model

Using the thermal-resistance concept, the rate of heat-transfer through the pipe, Q, is given by:

Water 98

oC

V = 25 cm/s

hi

Air, 20o

C, ho

Page 93: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

thw RTTQ / (4.6)

Where Tw and T∞ are the water temperature and air-temperature, respectively, and Rth is

the total thermal resistance that consists of the thermal resistances due to heat-transfer

by convection inside the pipe (Ri), by conduction through the steel pipe (Rp), and by convection outside the pipe (Ro). The three resistances are given by:

il

ihA

R1

(4.7)

k

DDR oi

p2

/ln (4.8)

oo

ohA

R1

(4.9)

Where Ai and Ao are the inside and outside areas of the pipe and hi and ho are the

corresponding heat-transfer coefficiens. The internal heat-transfer coefficien hi is

determined from the corresponding Nusselt number (Nu):

i

wi

D

kNuh (4.10)

Where, kw is the thermal conductivity of water. The Nusselt number is determined from

emprirical equations depending on the type of the flow, i.e., natural or forced, laminar or turbulent. For the turbulent forced internal flow (to be confirmed later), Nu is

obtained from the Dittus-Boelter equation, Equation (1.31), with n = 0.4 [3]:

4.08.0 PrRe023.0Nu (4.11)

Where, Re and Pr are the Reynolds number and Prandtl number, respectively. For the

external flow, Holman [3] used the following simplified equation for free laminar convection from a horizontal pipe to air at atmospheric pressure:

4/1

32.1

o

oo

D

TTh (4.12)

Both Ri and Rp can be determined directly from the given data, but Ro depends on ho

which cannot be determined directly since To is not known. Therefore, the problem has

to be solved by adopting an iterative approach by assuming a value for To based on

Page 94: Computer-Aided Thermofluid Analyses using Excel

Computer-Aided Thermofluid Analyses Using Excel

which ho is determined and, consequently, Q. The value of Q thus obtained can be used to calculate corresponding values for Ti and To from:

iwi RQTT . (4.13)

pio RQTT . (4.14)

If the guessed value for To is correct, then it will be the same as that obtained from Equation (4.14). Otherwise, a new guess for To has to be made repeatedly until this

condition is met. Once this is achieved, the overall heat-transfer coefficient (Uo) based

on the outside area (Ao) can be obtained from:

poio

oRRRA

U

1

(4.15)

Solution with Goal Seek

The Excel sheet developed for this example is shown in Figure 4.8. The given information about the pipe, water, and air properties are entered in the data part on the

left side of the sheet. The cells are labelled and the figure shows the formulae used in

the calculations. The calculations part at the central part of the sheet starts with a guessesd value for the pipe‟s outside temperature (T_og) of 50

oC. Based on this value,

the sheet determines the outside heat-transfer coefficient (h_o) from Equation (4.12)

and the thermal resistance associated with it (R_o) from Equation (4.9). Following the

analytical model described above, the sheet determines the three thermal resistances (R_i, R_p, and R_o), and then calculates the rate of heat-transfer (Q), inside

temperature (T_i), outside temperature (T_o), and overall-heat transfer coefficient (U).

Figure 4.8. Excel sheet developed for Example 4-3

As Figure 4.8 shows, the value of T_o calculated from Equation (4.14) is 97.876oC,

which is different from the initially guessed value (T_og = 50oC). The formula bar

reveals the formula entered in cell H12 that calculates the difference between the

Page 95: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

calculated exit temperature (T_o) and the guessd value (T_og) as a fraction of T_og. The exit temperature that makes the difference vanishes can be found by using the Goal

Seek command and Figure 4.8 shows the required set-up. The solution found by Goal

Seek is shown in Figure 4.9. Table 4.1 comapres the presents results with those given by Holman [3] to confirm the accuracy of the iterative solution with Goal Seek.

Figure 4.9. Solution obtained by Goal Seek for Example 4-3

Table 4.1. Comparison of the presnt Goal Seek solution with that given by Holman [3]

Holman

[3]

Goal Seek

solution

iT 97.65 97.64

oT 97.6 97.59

ih 1961.0 1960.56

oh 7.91 7.90

oU 7.87 7.86

4.2. Constrained iterative solutions with Solver

Solver offers greater flexibility than Goal Seek for dealing with iterative solutions

because it allows for multiple changeable cells and for constraints to be imposed on the

iterative solution. This section illustrates the need for these additional features in thermofluid analyses by means of two examples from the areas of fluid-dynamics and

thermodynamics.

Example 4-4. Determining the maximum water flow rate to avoid cavitation

Water at 20oC (γ = 9810 N/m

3 and ν =1.006x10

-6 m

2/s) is to be pumped from a large

reservoir via a pump-pipe system as shown in Figure 4.10. The pump is positioned vertically at a level which is 9 m above the surface of the reservoir and horizontally at 1

m from the vertical section of the pipe. The pipe is made of commercial steel pipe (ε =

0.046 mm) and has a 2″ nominal diameter.

Page 96: Computer-Aided Thermofluid Analyses using Excel

Computer-Aided Thermofluid Analyses Using Excel

Figure 4.10. Schematic for the pump-pipe system in Example 4-4

Determine the maximum allowable water flow rate (Q) such that:

1. The water velocity (V) is to be in the range 1.4-2.8 m/s for economic

considerations.

2. The pressure at the pump inlet must be greater than the saturation pressure of water at 20

oC, which is 2.338 kPa, to avoid cavitation.

This example, which is basically a type-2 pipe flow problem, is based on a similar example given by Schumack [4].

The analytical model

The energy equation between the pipe inlet (point 1) and the pump inlet (point 2) is:

fhg

VZ

p

g

VZ

p

22

22

22

21

11

(4.16)

Where γ stands for the specific weight of water, z for the elevation, V for the water velocity, g for the gravitational acceleration, and hf for the friction loss in the pipe. For a

large reservoir V1 = 0. Taking point 1 as a reference, i.e. Z1 = 0, and noting that the

water velocity in the pipe is uniform, i.e. V2 = V, the energy equation reduces to:

fh

g

VZ

pp

2

2

21

2

(4.17)

9 m

1 m

Q

1

2

2″ commercial steel pipe

Page 97: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

The velocity V is related to the pipe diameter (D) and water flow rate (Q) as follows:

2/4 DQV (4.18)

Neglecting minor losses, the friction loss can be calculated from the Darcy-Weisbach equation, Equation (4.1), which needs an auxiliary formula to determine the friction

factor (f) depending on whether the flow is laminar or turbulent.

Solution with Solver

Figure 4.11 shows the Excel sheet developed for this example. The data part on the left

side stores the problem data such as the diameter, roughness, and length of the pipe, etc. The central part stores a guessed value for the water velocity (V=1.0 m/s) in cell E2.

Based on the guessed water velocity, the sheet performs the necessary calculations

according to the analytical model given above. Figure 4.11 reveals the formulae used in

these calculations. Note that an IF-statement is used to calculate the friction factor (f) depending on the value of the Reynolds number (Re). Cell E6 calculates the friction

loss (hf). Based on the calculated value of friction loss, the pressure at point 2 (P_2) is

calculated from Equation (4.17) and stored in cell E7. The right side of the sheet contains the single cell I2 that determines the flow rate (Q). The formula in this cell is

shown in the formula bar.

Figure 4.11. Excel sheet developed for Example 4-4

Based on the assumed water velocity of 1.0 m/s, the calculated values of hf and P_2 are

0.2295 m and 8.958 kPa, respectively. Since the pressure at point 2 is higher than the minimum desired level of 2.338 kPa, while the water velocity (V) is less than the

minimum economic value of 1.4 m, there is room to increase the flow rate. The task can

be left to Solver and Figure 4.12 shows the set-up that requires Solver to maximise the value of the flow rate Q while satisfying the three constraints shown in the figure. The

first constraint on the iterative solution requires the value of P_2 in cell E7 to be higher

than or equal to 2.338 kPa. The two other constraints are to satisfy the limits on the

water velocity imposed by economic limits, i.e., 1.4 m ≤ V ≤ 2.8 m.

Page 98: Computer-Aided Thermofluid Analyses using Excel

Computer-Aided Thermofluid Analyses Using Excel

Figure 4.12. Solver parameters dialog box for Example 4-4

Pressing the “Solve” button will trigger Solver to search for the solution. The solution

found by the GRG Nonlinear method is shown in Figure 4.13. The value determined

for the water velocity is 1.90 m/s. Note that this velocity lies within the limits imposed

by the economic constraint. The pressure at point 2 is equal to 2.338 kPa which is the minimum pressure level required to prevent cavitation. Therefore, the corresponding

flow rate, which is 0.00413 m3/s, is the maximum flow rate to be recommended.

Figure 4.13. Solver solution for Example 4-4

Example 4-5. Restrained expansion of air inside a piston-cylinder device

Figure 4.14 shows a piston-cylinder device that initially contains 0.05 m3 of air at 200

kPa and 317K. At this state, a linear spring is touching the piston but exerting no force

on it before 72.7 kJ of heat is transferred to the air, causing the piston to rise and

compress the spring. If the cross-sectional area of the piston is 0.25 m2 and the spring‟s

constant (k) is 150 kN/m, determine the final volume, pressure, and temperature of the air inside the cylinder after the heat-addition.

Page 99: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

Figure 4.14. Schematic and pressure-volume diagrams for Example 4-5 (adapted from

Cengel and Boles [5])

Treat air as an ideal gas with a specific heat at constant volume (cv) that varies linearly with the temperature according to the formula:

cv = 0.645+0.0002T (4.19)

Where T is the temperature in K and cv is in kJ/kg.K.

Comment

This example is based of Example 4-4 given by Cengel and Boles [5]. However, unlike

the present example, Cengel and Boles [5] specified the final volume to be 0.1 m3

instead of specifying the amount of heat added. When the final volume (or final pressure) is given, the problem can be solved in a straightforward manner without

iteration. However, in the present example T2, V2, and P2 at the final state depend on the

amount of heat added. Another factor that makes the present example more difficult than that given by Cengel and Boles [5] is the use of Equation (4.19) to determine the

value of the specific heat cv for air. The specific value of 72.7 kJ given in this example

has been chosen such that the final volume will be 0.1 m3 as specified by Cengel and

Boles [5] so that the present final pressure on the piston and total work will be close to their corresponding values even though the data of the two examples are different.

The analytical model Like Example 4-2, the problem can be solved by using the first-law of thermodynamics

together with the ideal-gas law, but the variation of the specific heat with temperature

makes it necessary to adopt an iterative solution. Moreover, the addition of the linear

spring in this example introduces a new factor, which is the variation of pressure with air expansion. Since the present iteration process involves both the temperature and the

volume (or pressure), the Goal Seek command cannot be used. Therefore, this example

requires Solver to start the iterative procedure with assumed values for both the final

temperature (*

2T ) and the final volume (*

2V ).

T1 = 317K P1 = 200 kPa

V1 = 0.05 m3

Heat 72.7 kJ

k =150

kN/m

Page 100: Computer-Aided Thermofluid Analyses using Excel

Computer-Aided Thermofluid Analyses Using Excel

The final pressure 2P is given by:

A

xkPP

12 (4.20)

Where A is the base area of the piston and Δx is the reduction in the spring‟s length given by:

A

VVx 1

*

2 (4.21)

The total work (W), i.e., the summation of the air expansion work and the work done

against the spring, can now be obtained from:

1*

221

2VV

PPW

(4.22)

The final temperature can be determined by applying the first-law of thermodynamics

to the piston-cylinder device as a closed system:

1212 TTmcuumWQ v (4.23)

Where Q is the amount of heat added, u is the internal energy, m is the mass of air

inside the cylinder, and vc is the average specific heat of air at constant volume. The

mass and specific heat of air can be obtained from:

111 / RTVPm (4.24)

2/0002.06.0 *21 TTcv (4.25)

Rearranging Equation (4.23), the final temperature 2T is given by:

vcm

WQTT

12

(4.26)

Using the values obtained for T2 and P2, the final volume V2 can be determined from the

ideal-gas law:

222 / PmRTV (4.27)

Page 101: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

If the initially guessed volumes of *

2T and *

2V are correct, then they will be the same as

T2 and V2 obtained from Equation (4.24) and Equation (4.26), respectively. Otherwise,

new values for *

2T and *

2V have to be used until the differences between the calculated

and guessed values become negligibly small. This multi-variable iterative process can

be performed with Solver as shown below.

Solution with Solver

Figure 4.15 shows the Excel sheet developed for this example and reveals the formulae used in it. The left side of the sheet accommodates the problem data. The calculations

part start by an assumed values for the final temperature (T_2g = 500K) and final

volume V_2g = 0.15 m3. Based on the assumed final volume, the sheet determines the

compression of the spring (Δx), spring force (Fspring), final pressure (P_2), and total work involved (Work). The final temperature (T_2) is then calculated from the first-law

according to Equation (4.26), and the final volume (V_2) from the ideal-gas law,

Equation (4.27). As Figure, 4.15 shows, the calculated values T_2 and V_2 are different from the initial values T_2g and V_2g. Solver can now be used to adjust the guessed

value of T_2g and V_2g until they become the same as the calculated values.

Figure 4.15. Excel sheet developed for Example 4-5

Figure 4.16 shows the set-up that requires Solver to change the values of T_2g and

V_2g in cells F2 and F3, respectively, until the two specified constraints are satisfied: (i) T_2 = T_2g and (ii) V_2=V_2g. Note that the “Set Objective” option has been left

blank. The “Changing Variable Cells” are F2 and F3. Figure 4.17 shows the solution

obtained by the GRG Nonlinear method of Solver, which is T_2g = 1014.864K and V_2g = 0.1 m

3. At this state, the final pressure on the piston is 320.0 kPa and the total

work is 13.0 kJ. These values agree with their corresponding values given by Cengel

and Boles [5] whose analysis also gave P2 = 320 kPa and W = 13 kJ.

Page 102: Computer-Aided Thermofluid Analyses using Excel

Computer-Aided Thermofluid Analyses Using Excel

Figure 4.16. Solver set-up for Example 4-5

Figure 4.17. Solver solution for Example 4-5

4.3. Iterative solutions involving nonlinear equations

To determine the head loss due to friction (hf) in Example 4-1, the friction factor (f) for

the turbulent pipe flow was obtained from Equation (1.24) which is an explicit

equation. However, for a turbulent pipe flow f can be determined more accurately by using the Colebrook-White equation [1]:

f

D

f Re

51.2

7.3

/log0.2

1 (4.28)

Since the equation involves the friction factor f in both sides, it needs to be solved

iteratively in order to determine f. Therefore, for type-2 and type-3 flow problems using

this equation involves two nested iterations; an inside iteration to determine f and an outside iteration to determine the pipe‟s diameter or flow rate.

Page 103: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

The Newton-Raphson solver (NRM) provided by Thermax has been developed so as to allow nonlinear equations such as the Colebrook-White equation to be used in iterative

solutions and optimisation analyses. Appendix B illustrates the use of the NRM solver

by considering another nonlinear equation which is the Benedict-Webb-Rubin equation. In the present situation, the NRM solver will be used to solve the Colebrook-White

equation leaving the main iteration for Solver or Goal Seek. For illustration, let us

reconsider Example 4-1 and solve it by the using Equation (4.28) to determine f instead of Equation (1.24).

The NRM solver requires the intended nonlinear equation to be provided as a separate

user-defined function. The one needed for the Colebrook-White equation is listed below:

Function colebrook(x, e, Re) „ Colebrook equation for the friction factor

colebrook = 1/Sqr(x) + (2/log(10))*Log(e /3.7 + 2.51/Re/Sqr(x))

End Function

Note that in VBA syntax the term “log” is used for the natural logarithm “ln” which is

different from Excel. Figure 4.18 shows the Excel sheet developed for solving Example

4-1 with the Colebrook-White equation.

Figure 4.18. Excel sheet for Example 4-1 using the Colebrook-White equation

The only difference from the sheet shown in Figure 4.2 is the content of the cell F10 that calculates friction factor. Figure 4.18 shows the formula typed in this cell as:

=IF(Re<2300,64/Re,NRM("colebrook",0.004,ε_by_D,Re))

The first input to the NRM solver, “colebrook”, refers to the function that contains the

Colebrook-White equation while the second input, 0.004, is an initial guess for f. The

last two arguments, ε_by_D and Re , respectively, are labels for the cells F8 and F9 that store values of the roughness-diameter ratio (ε/D) and the Reynolds number (Re) at

Page 104: Computer-Aided Thermofluid Analyses using Excel

Computer-Aided Thermofluid Analyses Using Excel

which f is to be determined. Figure 4.18, which shows the calculations for a selected diameter of 0.1 m, shows that the value of the friction factor obtained by the Colebrook-

White equation is 0.018075 and the corresponding friction loss is 2744.2 m. These

values are slightly different from those obtained with Equation (1.24) as shown in Figure 4.2. The diameter that keeps the loss below 20 m can be determined by using

Goal Seek and Figure 4.18 also shows Goal Seek set-up for finding the value of D that

makes the friction head loss equal to 20 m. As Figure 4.19 shows, the answer found by Goal Seek is D ≥ 0.27 m, which is the same answer obtained earlier in Example 4-1.

Figure 4.19. Goal Seek solution for Example 4-1 using the Colebrook-White equation

4.4. Closure

This chapter dealt with thermofluid analyses that require iterative solutions and showed

how Excel‟s Goal Seek command and Solver can be used for solving typical problems from the areas of fluid dynamics, thermodynamics, and heat-transfer. While the Goal

Seek command can easily perform the simple type of iterative solutions that involve a

single parameter, Solver can perform the more difficult iterative solutions that involve

multiple changeable cells and require constraints to be applied to the iterative solution. The chapter also showed how the Newton-Raphson solver provided by Thermax can be

used to deal with the solutions that involve nonlinear equations such as the Colebrook-

White equation.

References

[1] Y. A. Cengel and J. M. Cimbala, Fluid Mechanics Fundamentals and

Applications, 3rd

edition, McGraw-Hill, 2006. [2] C. T. Crowe, D. F. Elger, B. C. Williams, and J. A. Roberson, Engineering Fluid

Mechanics, 9th

edition, John Wiley, 2009.

[3] J. P. Holman, Heat Transfer, 10th

edition, McGraw-Hill. 2010. [4] M. Schumack, Solution of complex pipe flow problems using spreadsheets in an

introductory fluid mechanics course, Proceedings of the 2004 American Society

for Engineering Education Annual Conference & Exposition, Session 3666, Pages 9.1108.1 - 9.1108.13. Available at https://peer.asae.org/solution-of-complex-pipe-

flow-problems-using-spreadsheets-in-an-introductory-fluid-mechanics-course

Page 105: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

[5] Y. A. Cengel, and M. A. Boles, Thermodynamics. An Engineering Approach. 5th

edition, McGraw-Hill, New York, 2006.

[6] M.J. Moran and H.N. Shapiro, Fundamentals of Engineering Thermodynamics, 5th

edition, John Wiley, & Sons. Inc. 2006. [7] M.M. El-Awad, Use of Excel's 'Goal Seek' feature for Thermal-Fluid Calculations,

the Electronic Journal of Spreadsheets in Education (eJSiE), Vol. 9, Iss. 1, Article

3, 2016. Available at: http://sie.scholasticahq.com/article/4657, last accessed Aug, 4, 2019.

Exercises

1. Consider the case in Example 4-1. Suppose that the only available pipe diameter is 20 cm and we want to maintain the same maximum limit on the friction head loss

of 20 m by reducing the water flow rate. Using the Goal Seek command, determine

the water flow rate that gives the required result. Answer: 0.157 m3.

2. Using the Excel sheet developed for Example 4-2, determine the final temperature

for air when the amount of heat added is 50, 100, 150, and 200 kJ. Also calculate

the final temperature from Equation (4.3) by using a constant specific heat (cp) of

1.043 kJ/kg.K. Plot the values obtained for the final temperature (T2) with the amount of heat added by the two methods and comment on the result.

3. A gas mixture consisting of O2 and CO2 with mole fractions 0.2 and 0.8,

respectively, expands isentropically and at steady state through a nozzle from 700 K, 500 kPa to an exit pressure of 100 kPa as shown in Figure 4.P3. Determine the

temperature at the nozzle exit, in K.

Figure 4.P3. Isentropic expansion in a nozzle

This exercise is based on Example 12.4 in Moran and Shapiro [6]. Using the

approximate constant-specific heat method, the exit temperature (T2) can be determined from:

k

k

PPTT1

1212 /

(A)

Where k is the ratio of the specific heats for the mixture. Using k = 1.304, the

resulting exit temperature is 480.9K. Using the exact variable specific heat

method, T2 is determined by requiring the total entropy change to be zero, i.e:

P1 = 500 kPa

T1 = 700K P

2 = 100

kPa

Page 106: Computer-Aided Thermofluid Analyses using Excel

Computer-Aided Thermofluid Analyses Using Excel

1

221

022

022 ln

P

PRTsTsy OOOO

0ln1

221

022

022

P

PRTsTsy COCOCOCO

(B)

Where yO2 and yCO2 are the volume fractions of O2 and CO2, respectively, and RO2

and RCO2 are the molar masses for O2 and CO2, respectively. The values of 02Os and

02COs can be determined by using the relevant function provided by Thermax.

Equation (B), that requires an iterative solution, can be solved by using the Goal

Seek command. Answer: T2 = 514.05K.

4. Steam is be condensed at 30°C on the shell side of the multi-pass shell-and-tube heat exchanger shown in Figure 4.P4. The condenser has 8-tube-passes with 50

tubes in each pass. Its overall heat transfer coefficient is 1000 W/m2·°C. Cooling

water (Cp = 4180 J/kg·°C) enters the tubes at 15°C at a rate of 55,000 kg/h. The

tubes are thin-walled, and have a diameter of 1.5 cm and length of 2 m per pass. Develp and Excel shhet to determine the outlet temperature of the cooling water by

using Goal Seek and the LMTD method instead of the ε-NTU method [7].

Figure 4.P4. A multi-pass shell-and-tube heat exchanger

5. Reconsider the case in Example 4-5. Show that an alternative solution of this problem that also takes into consideration the variation of specific heat for air with

temperature can be obtained by using the ideal-gas property functions provided by

Thermax instead of Equation (4.19). Show that this solution can be obtained by

using the Goal Seek command instead or Solver and compare your solution with that given in Example 4-5.

Hot

Cold

Page 107: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

6. Consider the semi-infinite slab shown in Figure 4.P6 that is suddenly exposed to convection environment at T∞. The temperature (T) at a depth x from the surface at

any time is given by [3]:

k

hXerf

k

h

k

hxXerf

TT

TT

i

i 1exp1

2

2

(A)

Where α and k are the diffusivity and thermal conductivity of the slap material,

respectively, Ti is the initial temperature of the solid, T∞ is the environmental

temperature, is the elapsed time in seconds, and 2X .

Figure 4.P6. Semi-infinite slab with convection heat-transfer

Equation (A) requires an iterative procedure because the time (τ) appears in both

terms on the right-hand side of the equation.

A large slab of aluminium (k = 215 W/m.oC, 5104.8 m

2/s) at a uniform

temperature of 200oC is suddenly exposed to a convection-surface environment of

70oC with a heat-transfer coefficient of 525 W/m

oC. Calculate the time required

for the temperature to reach 120oC at the depth of 4.0 cm for this circumstance.

This problem is based on Example 4-5 in Holman [3] whose answer is

approximately 3000 seconds.

7. Water at 60oC enters a tube of 3-cm diameter at a mean flow velocity of 1.2 cm/s.

If the tube is 3.0 m long and the wall temperature is constant at 80oC, what will be

the exit water temperature?

Use Goal Seek to perform the iterative solution of this problem. To determine the

viscosity of water at any temperature, develop a user-defined function based on the

data shown in Table A.2 in Appendix A. This exercise is based on Example 4-2 in

Holman [3]. Answer: 73.0oC.

T

h

T1

x

Page 108: Computer-Aided Thermofluid Analyses using Excel

Computer-Aided Thermofluid Analyses Using Excel

5

Hydraulic analyses of multi-pipe and

pump-pipe systems

Page 109: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

The pump-pipe systems used in various applications usually consist of multiple pipes and pumps connected in parallel or in series. The hydraulic analyses of multi-pipe

systems are based on the same principles of mass and energy conservation applicable

for a single pipe, but simultaneously satisfying the continuity and energy equations in all the pipes usually requires an iterative solution. An iterative solution is also needed

for determining the operating point for any pump-pipe system whether it involves a

single pump or multiple pumps. This chapter shows how Excel with its iterative tools, Goal Seek and Solver, can be used for analysing multi-pipe systems and determining

the operating point for a single pump with various pipe arrangements and for multiple

pumps arranged in parallel or in series.

5.1. Analyses of multi-pipe systems

Figure 5.1 shows three multi-pipe arragements in which three pipes are connected (a) in

series, (b) in parallel, and (c) at a junction. In general, the pipes may have different lengths, diameters, and roughness. The pipes may also have different elevations at their

entrance and exit points.

Figure 5.1. Three typical pipe arrangements in a pipe system (adapted from White [1])

(c)

(b)

ZA

1 2

3

ZB

ZC

A

B

C

D

1 2

3 A

B C

D

(a)

1

2

3

A B

Page 110: Computer-Aided Thermofluid Analyses using Excel

Computer-Aided Thermofluid Analyses Using Excel

5.1.1. Type-1 flow analyses As for the case of a single pipe discussed in Chapter 4, three types of flow problems can

arise with multi-pipe analyses depending on whether the pipe diameters and flow rates

are known in advance or to be determined. If both the pipe diameters and flow rates are known then the problem is classified as a type-1 flow problem, but if one of these is to

be determined, then the problem is classified as a type-2 or a types-3 flow problem.

Unlike the case a single pipe, type-1 flow problems for multi-pipe system also require iterative solutions. The following example, which is based on Example 8-7 in Cengel

and Cimbala [2], shows how Solver can be used to perform the iterative solution.

Example 5-1. Pumping water through two parallel pipes Water at 20°C is to be pumped from reservoir A to reservoir B through two 36-m-long pipes connected in parallel as shown in Figure 5.2. The elevation of reservoir A is 5 m while that of reservoir B is 13 m. The two pipes are made of commercial steel and their diameters of the two pipes are 4 and 8 cm as shown in the figure. Water is to be pumped by a 70% efficient motor-pump combination that draws 8 kW of electric power during operation. The minor losses and the head loss in the pipes that connect the parallel pipes to the two reservoirs can be neglected. Determine the total flow rate of the pump and the flow rate through each of the two parallel pipes.

Figure 5.2. The piping system in Example 5-1 (adapted from Cengel and Cimbala [2])

The analytical model

Since the fluid at both points A and B are open to the atmosphere, PA = PB = Patm. Also, the fluid velocities at both points are zero (VA = VB = 0) and, therefore, the energy

equation, Equation (1.20), between these two points simplifies to:

ABfp ZZhh (5.1)

Where hp is the pump head and hf is the total friction loss between the two reservoirs.

Since the pressures at the entrance and exit points of the two pipes are the same, the friction head losses in the two pipes must be the same:

A

B

Pump

2

1

5 m

13 m

D1 = 8 cm

D2 = 4 cm

L2 = 36 m

L1 = 36 m

Page 111: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

fff hhh 21 (5.2)

The friction head loss in each pipe is given by the Darcy-Weisbach equation:

g

V

D

Lfh f

2

21

1

111 (5.3)

g

V

D

Lfh f

2

22

2

222 (5.4)

Given the two flow rates Q1 and Q2, the water velocities in two pipes, V1 and V2, can be calculated from:

111 / AQV (5.5)

222 / AQV (5.6)

For steady flow of an incompressible fluid, the total flow-rate given by the pump (Q) is

the summation of the flow-rates in the two parallel pipes (Q1 and Q2), i.e.:

21 QQQ (5.7)

Finally, the power of the pump ( pW ) is given by the following power equation:

/pp hQW (5.8)

Where γ is the fluid‟s specific weight and η is the combined pump-motor efficiency. In the present case, the pump-power is known to be 8 kW. This can be used to determine

the unknown flow rate (Q) and the pump head (hp) by adopting the following iterative

procedure:

1. Assume the pipe flow rates Q1 and Q2

2. Calculate the corresponding velocities V1 and V2 from Equation (5.5) and

Equation (5.6), respectively. 3. Based on the two velocities, calculate the friction factors and friction head

losses in the two pipes from Equation (5.3) and Equation (5.4), respectively.

4. Calculate the pump power from Equation (5.8) 5. Compare the resulting pipe friction losses to each other, Equation (5.2), and

pump power to the specified value of 8 kW. If the pipe friction losses are

Page 112: Computer-Aided Thermofluid Analyses using Excel

Computer-Aided Thermofluid Analyses Using Excel

different or the pump power is not equal to 8 kW, go back to step 1 and repeat the procedure until the pump power becomes approximately zero.

Cengel and Cimbala [2] determined the friction factors f1 and f2 from the Colebrook-White formula. Chapter 4 showed how this implicit equation can be handled within an

iterative solution by using the Newton-Raphson solver provided by Thermax.

Excel implementation

Figure 5.3 shows the Excel sheet developed for this example. The data part, positioned

on the left-side of the sheet, shows the given information about the pump-pipe system

such as the lengths and diameters of the two pipes, density and viscosity of water, pump efficiency, etc. The calculations part begins at column E with assumed values for the

two pipe flow rates (Q_1 = Q_2 = 0.01 m3/s). Based on these assumed flow rates, the

sheet determines the corresponding velocities in the two pipes (V_1 and V_2), the Reynolds numbers (Re_1 and Re_2), and the friction factors (f_1 and f_2 ). For a

turbulent flow, the friction factor is obtained from the Colebrook-White formula. The

pipes friction losses, hf_1, and hf_2, are then calculated and the total pump power

(P_pump) is determined from Equation (5.8).

Figure 5.3. Excel sheet for Example 5-1

With the guessed pipe flow rates, Figure 5.3 shows that the pump power is only 2.734

kW, which is considerably less than the required value. Moreover, the values of hf1 and

hf2 are different and, consequently, Equation (5.2) is not satisfied. Solver can now be used to find the correct values of Q1 and Q2. Figure 5.4 shows the required set-up for its

parameters dialog-box. Note that the pump power is specified as the Set Objective and

required to have a value of 8 kW. In this case, Solver will iterate to satisfy the imposed

constraint, which is requirement to satisfy Equation (5.2). The solution found by Solver with this set-up is shown in Figure 5.5. According to this solution, the flow rates are Q1

= 0.0258 m3/s and Q2 = 0.00415 m

3/s, giving a total pump flow rate of 0.03 m

3/s. Table

5.1 compares the present solution with that obtained by Cengel and Cimbala [2]. The small deviations of the present values confirm the accuracy of the present solution.

Page 113: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

Figure 5.4. Solver‟s set-up for Example 5-1

Figure 5.5. Solver‟s solution for Example 5-1

Table 5.1. Comparison of the solution determined by Solver with their corresponding

values given by Cengel and Cimbala [2]

Parameter Cengel & Cimbala [2]

Present solution

Deviation (%)

Q1 0.0259 0.025861 -0.151 Q2 0.00415 0.004151 0.024

Re1 410,000 409,944.5 -0.014 Re2 131,600 131,615.3 0.012

f1 0.0182 0.018216 0.088 f2 0.0221 0.02209 -0.045

hf 11.1 11.05861 -0.373

Page 114: Computer-Aided Thermofluid Analyses using Excel

Computer-Aided Thermofluid Analyses Using Excel

5.1.2. Type-2 and type-3 flow analyses The recommended value for water velocity in commercial pipes lies in the range

between 1.4 and 2.8 m/s [3], but Figure 5.5 shows that the velocities in both pipes

exceed the upper limit particularly that in pipe 1. Therefore, the values obtained for the pipe flow rates are not acceptable for economic considerations even though they are

physically correct based on the given data. Suppose that we decided to replace pipe 2

by a new pipe that has a larger diameter so that the water velocities in the two pipes do not exceed the economic range while maintaining same total water flow rate. The

following example shows how Solver can be used to solve this type-3 flow problem.

Example 5-2. Determining the economic diameter for a pipe Pipe 2 in the system shown in Figure 5.2 is to be replaced by a new pipe which is also

36 m long and made of commercial steel. It is required to select the diameter of the new

pipe such that the water velocities in both pipes do not exceed 2.8 m/s. For the same data given in Example 5-1 for pipe 1, determine the diameter of pipe 2 and the required

pump power for the same total water flow rate of 0.03 m3/s.

Solution Figure 5.6 shows the Excel sheet developed for this example with minor modifications

to that developed for the previous example. Note that the data part now includes the

total flow rate, which is 0.03 m3/s. Also note that there are now two changing variables

which are Q_1 and D_2 given initial values of 0.01 m3/s and 0.04 m, respectively. The

sheet calculates the velocities, Reynolds numbers, friction factors, and friction head

losses in the two pipes and then determines the pump power (Power).

Figure 5.6. Excel sheet for Example 5-2

Note that the initial water velocities in the two pipes are above the recommended value

while hf1 ≠ hf2. Solver can be used to find the solution that satisfies the energy equation

while reducing the water velocities in the two pipes to the economic range. Figure 5.7 shows Solver‟s parameters dialog box for this task. By leaving the Set Objective slot

Page 115: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

blank, Solver will iterate to satisfy the three imposed constraints. Figure 5.8 shows the solution determined by Solver with this set-up by using the GRG Nonlinear method.

Figure 5.7. Solver set-up for Example 5-2

Figure 5.8. Solver solution for Example 5-2

According to this solution, the diameter of pipe 2 is 9.0 cm at which the water velocities

in the two pipes are V1=2.52 m/s and V2= 2.72 m/s. Note that the new diameter for pipe 2 is more than twice its initial diameter of 4 cm. Also note that, due to reduced

velocities in the two pipes, the pump power has reduced to 4.52 kW. Although the

larger diameter increases the pipe‟s initial cost, it reduces the overall lifetime cost by reducing the pump power and the required energy cost.

With the water velocities now within the economic range, the objective of our present

analysis has been achieved. However, the fact that resulting pump power barely exceeds half its capacity, which is 8 kW, raises another issue of practical concern.

Running the pump at half its full capacity is bound to reduce its efficiency because

Page 116: Computer-Aided Thermofluid Analyses using Excel

Computer-Aided Thermofluid Analyses Using Excel

every pump achieves its best efficiency within a certain zone of operating conditions in terms of flow rate and head. The determination of the operating point for a pump-pipe

system is dealt with in the following section.

5,2. The operating point for a pump-pipe system

The selection of the suitable type and size of a pump for meeting the required fluid flow

rate and delivery pressure depends on the characteristics of both the pipe-system and the pump. The operating point for a pump-pipe system is the point at which the fluid‟s

flow rate and pressure supplied by the pump match the required demand. To minimise

electricity consumption of a pump, its operating point should be within the zone of its

best efficiency. This section deals with the determination of operating point for a single centrifugal pump connected to a single pipe, to two pipes that branch at the pump‟s

discharge, or to a simple branched network that consists of three-pipes.

5.2.1. A centrifugal pump connected to a single pipe

Figure 5.9 shows a centrifugal pump that is connected to a single pipe. The pump

supplies the pressure needed to overcome friction losses through the pipe so as to

maintain the fluid flow.

Figure 5.9. Pump-pipe system with a single pipe

The pump head hp (in m) is defined as the head of fluid delivered by the pump, i.e.:

/iep PPh (5.9)

Where Pi and Pe are the inlet and exit pressures, respectively, and γ is the specific weight of the fluid. The pump head is not constant for all flow conditions, but depends

on the discharge. The curve that shows the relationship between the pump‟s head and

its discharge at a given motor-speed is known as the pump characteristic curve. Figure 5.10 shows a typical characteristic curve for a centrifugal pump. Pump characteristic

curves at different motor speeds are supplied by pump manufacturers or can be

prepared by direct measurement. Figure 5.10 shows that the maximum pump head is delivered at zero discharge and the head decreases as the discharge is increased. How

much pump head is actually needed to overcome the friction loss (hf) and circulate the

fluid through the pipe connected to it depends on:

Page 117: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

1. The flow rate of the fluid Q

2. The viscosity of the fluid ν (which may depend on the fluid‟s temperature)

3. The diameter of the pipe D 4. The length of the pipe L

5. The roughness (ε) of the pipe inside surface which depends on its material and

surface finish

Figure 5.10. The operating point for a centrifugal pump as determined by its

characteristic curve and the system curve

The relationship between the frictional losses through the pipe and the flow rate of the fluid being transported is called the system curve. The system curve is obtained by

calculating the friction loss hf at different fluid flow rates and plotting it versus Q as

shown in Figure 5.10. As the figure shows, the friction loss is zero at no discharge and increases as the discharge is increased. The operating point for the pump is that at

which its curve crosses the system curve. At the operating point:

cftotalfp hhhh , (5.10)

Where hf and hc refer to the friction head losses in the pipe and the components,

respectively, which are given by Equation (1.21) and Equation (1.29), respectively.

The power of the pump W at any given flow rate Q and pump head hp is given by the

power equation:

/pp QhW (5.11)

0

10

20

30

40

50

60

0 0.001 0.002 0.003 0.004

h,

m

Q, m3/s

Pump curve

System curve

Page 118: Computer-Aided Thermofluid Analyses using Excel

Computer-Aided Thermofluid Analyses Using Excel

Where is η is the pump efficiency. Although the same pump can be used to meet different system curves, the pump efficiency reaches its maximum value at a certain

flow rate and a certain head. If we try to operate the pump at load requirements (Q and

hp) which are different those values, then the pump efficiency will drop. Therefore, it is important to have the operating point of the pump-pipe system as close as possible to

the point of its best-efficiency.

The operating point of a pump-pipe system can be determined graphically by plotting

the pump curve and the system curve on the same graph as shown in Figure 5.10.

However, the point can be determined more accurately by representing the pump curve

by a mathematical relationship between the pump head hp and discharge Q. Using this hp-Q relationship, together with Equation (5.10), the operation point can be determined

by iteration. The following example illustrates how Excel‟s Goal Seek command can be

used to determine the operating point for a pump-pipe system that consists of a single pump connected to single pipe. The case is given by Suryanarayana and Arici [4].

Example 5-3. Operating point for centrifugal a pump connected to a single pipe

A centrifugal pump is to supply water at (ρ = 1000 kg/m3, ν = 1.02x10

-6) through a

single pipe that has the following specifications:

Length, 100 m Diameter, 2.5 cm

Roughness, 0.046 mm

According to the manufacturer, the characteristic curve of the pump is given by the following table:

Flow rate (m3/s) Pump head (m)

0.0 47.24

6.3080E-04 45.11

9.4620E-04 44.2

1.2316E-03 42.67

1.5770E-03 41.15

1.8924E-03 39.62

2.2078E-03 37.19

2.5232E-03 35.05

2.8386E-03 32.00

3.1540E-03 28.96

It is desired to determine the operating point and the required power for the pump while

ignoring component losses.

Page 119: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

The analytical model Since there are no component losses, the friction head is obtained from Equation (1.21)

after we establish whether the flow is laminar or turbulent from the value of the

Reynolds number. In order to obtain a solution via Goal Seek, the pump head has to be expressed as a function of the flow rate. From the pump data shown above,

Suryanarayana and Arici [4] obtained the following polynomial:

38253 10348.210549.110985.222.47 QQQhp (5.12)

The sought flow rate (Q) should be such that the calculated friction head loss in the pipe

is equal to pump head as obtained from Equation (5.12). The iterative solution goes as follows:

1. Given an initial guess for the discharge, calculate the water velocity (V = Q/A)

2. Calculate the Reynolds number and the friction factor f 3. Calculate the corresponding friction loss hf from Equation (1.21)

4. Determine the pump head from Equation (5.12)

5. Calculate the difference between the pump head and the friction losses, which is supposed to be zero at the operating point.

It is unlikely that our first guess will be the correct discharge at the operating point.

Therefore, the above procedure has to be repeated by using a new value for the discharge until the difference between hf and hp becomes sufficiently small.

Excel implementation Figure 5.11 shows the Excel sheet developed for solving this example. The data part of

the sheet shows the data provided for the pipe and the fluid which is water. Figure 5.11

shows how the calculation part of the Excel sheet executes the iterative procedure

described above with an initial guess for the discharge of Q= 1.0x10-3

m3/s. The figure

shows that there is a difference of 21.51 m between the system head (hf) and the pump

head (h_p).

Figure 5.11. Excel sheet and Goal Seek set-up for Example 5-3

Page 120: Computer-Aided Thermofluid Analyses using Excel

Computer-Aided Thermofluid Analyses Using Excel

Goal Seek can be used to find the value of Q at which the difference between hf and h_p becomes approximately zero. Figure 5.11 shows Goal Seek set-up for this task and

Figure 5.12 shows the solution obtained by it. As the figure shows, Goal Seek finds the

operating point at Q = 1.395x10-3

m3/s and h_p = 42.12 m. The corresponding power is

576.29 W. The flow rate is practically the same as that obtained by Suryanarayana and

Arici [4] which is 1.407x10-3

m3/s.

Figure 5.12. Solution obtained by Goal Seek for Example 5-3

5.2.2. A centrifugal pump connected to two branching pipes Figure 5.13 shows a pump that discharges into two branching pipes of different

diameters, lengths, and roughness. It is required to determine the operating point for the

pump and how the pump's discharge will be divided between the two pipes. To simplify

the analysis, it is assumed that the two pipes lie on a horizontal plane and that the two pipes discharge at the atmospheric pressure. This case is also given by Suryanarayana

and Arici [4].

Figure 5.13. A centrifugal pump connected to two parallel pipes

The analytical model

From the values of the flow rate in pipe 1 (Q1) and in pipe 1 (Q2), the total flow rate (Q) can be calculated as:

21 QQQ (5.13)

Pi = Patm

Q1, L1, D1, ε1

Q2, L2, D2, ε2

P1 = Patm

P2 = Patm

Q

Page 121: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

The friction head loss in each pipe can be obtained from Equation (1.21):

g

V

D

Lfh f

2

21

1

111 (5.14)

g

V

D

Lfh f

2

22

2

222 (5.15)

Since the pressures at both ends of the two pipes are the same, the friction head losses

in the two pipes must be the same and equal to the pump head, i.e.:

pff hhh 21 (5.16)

Excel implementation Equation (5.16) will be satisfied at the correct values of Q1 and Q2, but both flow rates

are unknown and, therefore, the following iterative solution is required:

1. Assume values for Q1 and Q2 2. Calculate the total flow rate Q from Equation (5.12)

3. Calculate V1 and V2 and determine the Reynolds number in the two pipes, Re1

and Re2 4. Determine the friction factors in the two pipes, f1 and f2, from the corresponding

Reynolds numbers using Equation (1.24)

5. Determine the friction losses in the two popes, hf1 and hf2

6. Determine the pump head hp from the pump curve, e.g., Equation (5.12) 7. If hf1 ≠ hf2, or hf1 ≠ hp, go back to step 1

After the operating point is determined, the power required by the pump can be obtained from the power equation as follows:

pp gQhW (5.17)

Alternatively, the pump power can be calculated from the pipes flow rates and friction

losses as follows:

2211 ffp hQhQgW (5.18)

Suryanarayana and Arici [4] analysed the performance of the pump-pipe systems shown

in Figure 5.13 by following a slightly different iterative process. They also adopted a different formula for the friction factor than Equation (1.24). The data of their example

will be used to demonstrate the procedure for using Excel-Solver in the analysis.

Page 122: Computer-Aided Thermofluid Analyses using Excel

Computer-Aided Thermofluid Analyses Using Excel

Example 5-4. Operating point for a pump with two parallel pipes A pump-two-pipe system as shown in Figure 5.13 has the following dimensions.

D1 = 0.025m L1 = 500m ε1=15x10-6

m

D2 = 0.05m L2 = 1,000m ε2=46x10-6

m

The system carries water (ρ = 1000 kg/m

3, ν = 1.02x10

-6). If the pump has the same

characteristic formula expressed by Equation (5.12), determine the flow rates in the two

branches and the power required by the pump.

The Excel sheet

The Excel sheet developed for this example is shown in Figure 5.14. The data part

contains the data for the two pipes and the transported fluid, which is water. The sheet shows the calculations based on assumed values of Q1 = Q2 = 0.001 m

3/s. The

velocities, Reynolds number, friction factors and friction head losses are calculated on

the basis of these assumed flow rates. With the guessed flow rates, the friction losses in

the tw pipes, hf1 and hf2, and the pump head, hp, have three different values. The formula bar shows the formula in cell M5 that calculates the difference between the head losses

in pipe 1 and the head produced by the pump as 58.066 m. Also, note that Equations

(5.17) and (5.18) give two different values for the pump power in cells M7 and M9.

Figure 5.14. Excel sheet developed for Example 5-4

The required flow rates Q1 and Q2 that satisfy Equation (5.16) can be found by using

Solver. Figure 5.15 shows the set-up for Solver that requires it to find values of Q1 and

Q2 that reduces the difference between hf1 and hp to zero while satisfying the constraint

that the head losses in the two pipes hf1 and hf2 are equal according to Equation (5.16). The solution found by the GRG Nonlinear method is shown in Figure 5.16 according to

which the two values of the power required by the pump at the operating point as

determined by Equations (5.17) and (5.18) are the same and equal to 894.04 W. The flow rates in the two pipes are Q1 = 0.000547 m

3/s and Q2 = 0.002279 m

3/s, and hp

=32.24 m. The corresponding values found by Suryanarayana and Arici [4] are Q1 =

Page 123: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

0.0005738 m3/s, Q2 = 0.002325 m

3/s, and hp = 32.85 m. The slight differences can be

attributed to the fact that Suryanarayana and Arici [4] used a different formula for

calculating the friction factor.

Figure 5.15. Solver set-up for Example 5-4

Figure 5.16. Solver solution for Example 5-4

It should be mentioned that it was necessary in this example to use the automatic-

scaling option of Solver with the GRG Nonlinear method so as to find the solution. Apparently, this is due to the use of Equation (5.12).

5.2.3. A centrifugal pump connected to a simple-pipe network Figure 5.17 shows a pump connected to a simple pipe network that consists of three

pipes meeting at a junction. Some fluid is discharged at the junction J as shown in the

figure which can either be specified or left to be determined by the analysis. For

simplification, the three network pipes are assumed to be in a horizontal plane but they can have different lengths, diameters, and roughness. The operating point for the pump

Page 124: Computer-Aided Thermofluid Analyses using Excel

Computer-Aided Thermofluid Analyses Using Excel

can be determined by simultaneously satisfying the principles of mass and energy conservation and the pump characteristic curve.

Figure 5.17. A centrifugal pump connected to a simple pipe-network

The analytical model

The conservation of mass for a steady-flow of an incompressible fluid gives:

JQQQQ 321 (5.19)

Where the flow rates Q1, Q2, Q3, and QJ are as shown in Figure 5.17. If three of the flow

rates are specified, the fourth can be calculated from the above equation.

Since the pressures at the inlet of pipe 2 and pipe 3 are the same, and the pressures at

their discharge points are both atmospheric, the energy equation leads to:

32 ff hh (5.20)

At the operating point, the power required by the pump to balance the friction losses in the network can be calculated from.

pp hgQW 1 (5.21)

Alternatively, it can be obtained from:

332211 fffp hQhQhQgW (5.22)

The requirement that the two values of the pump power determined by Equations (5.21)

and (5.22) should be equal provides another constraint on the iterative process besides

Equation (5.20). The following example shows how Solver can be used to solve the problem.

Pi = Patm

Q2, L2, D2, ε2

Q3, L3, D3, ε3

P1 = Patm

P3 = Patm

Q1, L1, D1, ε1

QJ

J

Page 125: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

Example 5-5. Centrifugal pump connected to a simple-pipe network The pump-system shown in Figure 5.17 carries water (ρ = 1000 kg/m

3, ν = 1x10

-6) and

its three pipes have the following dimensions.

D1 = 0.05m L1 = 500m ε1=46x10

-6m

D2 = 0.025m L2 = 500m ε2=15x10-6

m

D3 = 0.03m L3 = 500m ε3=46x10-6

m

The network supplies a demand of 0.0002 m3/s at the junction J. If the pump has the

same characteristic formula expressed by Equation (5.12), determine the operating

point and the power required by the pump.

The Excel sheet

The Excel sheet developed for this example is shown in Figure 5.18. The sheet extends

that developed for Example 5-4 by adding the data and the calculations relevant to the

third pipe and the flow rate at the junction (Q_J). The calculations start by guessed values for Q1 = 0.001 m

3/s and Q2= 0.0005 m

3/s. As the formula bar shows, Q3 is

determined from Equation (5.19). The sheet then calculates the velocities, Reynolds

numbers, friction factors and friction losses in the three pipes from the Darcy-Weisbach equation using the relevant data. At the guessed value of the flow rate (Q = Q1), the

sheet calculates pump power as “W_pump” on the basis of Equation (5.21) and as

“W_pipe” on the basis of Equation (5.22).

Figure 5.18. Excel sheet developed for Example 5-5

Values of hf1, hf2, hf3, and hp shown in Figure 5.18 indicate that Equation (5.20) is not satisfied with the guessed flow rates. The two values of the pump power determined by

Equations (5.21) and (5.22), i.e., W_pump and W_pipe, are also different. Solver can be

used in order to find the flow rates that satisfy these two conditions. Figure 5.19 shows

Page 126: Computer-Aided Thermofluid Analyses using Excel

Computer-Aided Thermofluid Analyses Using Excel

the set-up that requires Solver to find the values of Q1 and Q2 that makes the difference between hf2 and hf3 diminishes (Equation (5.20)) while making pump power determined

by Equation (5.21), which is W_pump, equal to that determined by Equation (5.22),

which is W_pipe.

Figure 5.19. Solver set-up for Example 5-5

A third constraint has been added that requires Q2 ≤ Q1 so as to ensure a physically

acceptable solution. By leaving the Set Objective blank, Solver will iterate so as to find the solution that satisfies the three specified constraints. Figure 5.20 shows the solution

found by Solver with the GRG Nonlinear method with the automatic-scaling option.

Figure 5.20. The solution determined by Solver for Example 5-5

According to this solution, Q1 = 0.001671, Q2 = 0.00058 and Q3 = 0.000892 m3/s.

Judging from the Reynolds numbers in the three pipes, all pipe flows are turbulent. At

Page 127: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

the flow rates obtained for the three pipes, the friction losses in pipe 2 and pipe 3 are both equal to 35.9247 m, while the total friction head to be provided by the pump is

40.70285 m. As should be the case, both Equations (5.21) and (5.22) determine the

pump power as 667.31 W.

In this example the discharge at the pipes junction has been specified, but it is also

possible to allow it to be determined by Solver. In such a case, there will be three adjustable cells for the three flow rates, Q2, Q2, and Q3 or QJ. Also note that the method

can be applied when the pipes are not on the same horizontal plane.

5.3. Centrifugal pumps in serial and parallel arrangements Practical considerations may require the use of two or more smaller pumps instead of a

single large pump. Proper application of the energy equation together with the

continuity equation and the pump characteristic equations also enables the pumps operating point to be determined. This section shows how Excel and Solver can be used

to determine the operating point for two centrifugal pumps in parallel and in series.

5.3.2. Two centrifugal pumps connected in parallel Figure 5.21 shows two identical pumps connected in parallel with the characteristic

curves for a single pump and for the two parallel pumps. As Figure 5.21.b shows, the

operating point shifts from point A for a single pump to point B for the two pumps. The two pumps give a larger flow rate and a higher head compared to the single pump.

Figure 5.21. Two centrifugal pumps connected in parallel and their characteristic curve

Example 5-6. Operating point for two pumps in parallel The pump-pipe system shown in Figure 5.21 carries water at 25

oC in a horizontal pipe.

The two pumps are identical and have the characteristic curve given by Equation (5.12).

The length and roughness of the pipe are 100 m and 0.046 mm, respectively. For

economic reasons it is desired to keep the water velocity in the pipe below 2.8 m/s by selecting a suitable diameter for the pipe. Determine the operating point of the system,

the diameter of the pipe, and the power requirement of the two pumps.

(b)

One pump

Two pumps

hp

Q

A

B

(a)

Check valves

Q

Q1

Q, L, D, ε

Q2

2

1

Page 128: Computer-Aided Thermofluid Analyses using Excel

Computer-Aided Thermofluid Analyses Using Excel

The analytical model For a steady flow of an incompressible fluid in the common pipe, mass conservation

leads to:

21 QQQ (5.23)

Parallel arrangement of pumps is referred to as "flow-rate additive" [3] because the

combined flow rate in the system is the addition of those of the individuals pump as indicated by Equation (5.23). For two identical pumps running at the same speed:

2/21 QQQ (5.24)

Neglecting the small loss in the pipe joining the two pumps and assuming no losses

within the two pumps, the energy equation applied between points 1 and 2 leads to:

ppp hhh 2,1, (5.25)

At the operating point, the friction head loss in the pipe equals the head delivered by

one pump, i.e.:

2,1, ppf hhh (5.26)

The Excel sheet The data part of the Excel sheet shown in Figure 5.22 gives the length of the main pipe,

but not its diamater. The calculations start with assumed values for flow rate, Q = 0.001

m3/s, and pipe-diameter, d = 0.025 m. Based on these initial values, the water velocity

in the pipe and the corresponding Reynolds number are determined.

Figure 5.22. Excel sheet developed for Example 5-6 (two pumps in parallel)

Page 129: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

Since the total flow rate is divided equally between the two pumps as stated by Equation (5.24), the heads delivered by the two pumps, h_p1 and h_p2, are equal as

required by Equation (5.25). However, the friction head loss in the main pipe (hf) is not

equal to the head supported by the pumps as required by Equation (5.26). Therefore, the flow rate, Q, and pipe diameter, d, have to be adjusted to values that satisfy Equation

(5.25) as well as Equation (5.26) together with the condition that V ≤ 2.8 m/s. This can

be done by using Solver and the required set-up is shown in Figure 5.23.

Figure 5.23. Solver set-up for Example 5-6 (two pumps in parallel)

Figure 5.24 shows the solution found by Solver that satisfied the two constraints. According to this solution, the flow rate is 0.001 m

3/s, the pipe diameter is 0.022 m, and

the power requirement is 467.08 W. Due to the reduced water velocity, the required

power is less than that of the single pump in Example 5-3 even though the pipe

diameter is smaller.

Figure 5.24. Solver solution to Example 5-6 (two pumps in parallel)

Page 130: Computer-Aided Thermofluid Analyses using Excel

Computer-Aided Thermofluid Analyses Using Excel

5.3.3. Two centrifugal pumps connected in series Two pumps are connected in series when the outlet of the first pump leads directly to

the inlet of the second one as shown in Figure 5.25.a. As shown in Figure 5.25.b, the

operating point of this arrangement also increases both the system‟s head and flow rate compared to those of a single pump.

Figure 5.25. Two centrifugal pumps connected in series and their characteristic curve

Example 5-7. Operating point for two pumps in series

Two pumps are connected in series to a horizontal pipe that carries water at 25oC. The

characteristic curve for both pumps is expressed by Equation (5.12). The pipe length

and roughness are 100 cm and 0.046 mm, respectively. For economic reasons, it is

desired to keep the velocity in the pipe below 2.8 m/s. Determine diameter of the pipe,

the operating point of the system, and the power requirement of the two pumps.

The analytical model

For steady flow of an incompressible fluid in the system, mass conservation leads to:

21 QQQ (5.27)

Neglecting the small loss in the pipe joining the two pumps and assuming no losses within the two pumps, the energy equation reduces to:

2,1, ppp hhh (5.28)

Pumps in series are called "pressure-additive" [3] because the total pressure in the pipe

system is the addition of those of the individual pumps as indicated by Equation (5.28).

At the operating point, the friction head loss in the pipe equals the head delivered by the two pumps, i.e.:

2,1, pppf hhhh (5.29)

(a) (b)

A

B

Two pumps

One pump

hp

Q

Q, L, D, ε

Q

Q 1

2

Page 131: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

Excel sheet The sheet developed for this example is shown in Figure 5.26. The data and

calculations parts are similar to those in Example 5-6 but, instead of two flow rates in

two pipes, in the present sheet the same flow rate Q passes through both pipes. Given initial values for the flow rate, Q, and pipe diameter, d, the sheet calculates the velocity

(V), Reynolds number (Re), friction factor and head losses in the two pipes (hf). The

sheet then determines the pumps heads h_p1 and h_p2, which are identical in this case.

Figure 5.26. Excel sheet developed for Example 5-7 (two pumps in series)

Figure 5.26 shows that there is a difference between the pumps' heads and the friction

loss in the pipe which indicates that the guessed values are incorrect. Figure 5.27 shows the set-up for Solver for finding the values of Q and d that make the friction loss (hf)

equals the pump head (hp) while keeping the velocity below 2.8 m/s. Figure 5.28 shows

the solution obtained by Solver according to which the water flow rate is 0.388 litre per second, the pipe diameter is 0.013 m, and the pump power is 350.4 kW.

Figure 5.27. Solver set-up for Example 5-7 (two pumps in series)

Page 132: Computer-Aided Thermofluid Analyses using Excel

Computer-Aided Thermofluid Analyses Using Excel

Figure 5.28. Solver solution for Example 5-7 (two pumps in series)

5.3.4. A comparison of serial and parallel pumps arrangements

Some general remarks on the performance characteristics of multiple pumps when they are arranged in parallel and in series can be extracted from the results obtained in the

previous sections. Table 5.2 compares the calculated values for the water flow rate, pipe

diameter, water velocity, friction loss, and pump power for the two pumps arranged in parallel and in series with those of a single pump. The results of shown in Table 5.2 for

the single were obtained by modifying the sheet developed in Example 5-3 so as to

determine the operating point and pipe diameter with the additional restriction that the pipe velocity does not exceed 2.8 m/s as required for the two pump arrangements. The

solution was found with a similar Solver set-up to that shown in Figure 5.23.

Table 5.2. Operating conditions for a single pump, two pumps in parallel, and two pumps in series

Arrangement L (m)

Q (l/s)

D (m)

V (m/s)

hp (m)

Power (W)

A single pump 100 1.04 0.022 2.68 43.667 447.295

Two pumps in parallel 100 1.04 0.022 2.72 45.585 467.078

Two pumps in parallel (2) 100 2.08 0.002 2.68 43.667 894.590

Two pumps in series 100 0.34 0.013 2.80 46.025 350.426

Two pumps in series (2) 181 1.06 0.022 2.80 87.168 910.168

The figures in Table 5.2 show that two pumps connected in parallel as shown in Figure 5.21give the same flow rate as that of the single pump and do not require the pipe

diameter to be changed. The slight increase in the water velocity lead to a slight increase in the pump head and, therefore, the required pump power increased from

447.3 W to 467.1 W, i.e., by 4.4 per cent. Since the second pump requires additional

initial and maintenance costs, these results indicate that this pump can only be used as a

stand-bye pump. However, the second pump can be allowed to discharge in a separate pipe. Table 5.2 shows this option as “Two pumps in parallel (2)”. In this case, the water

Page 133: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

velocity and pump-head will be the same as those of a single pump, but both the water flow rate and pump power will be doubled.

When the second pump is connected in series, the water flow rate dropped from 1.04 to only 0.34 litres per second and the required pipe diameter dropped from 22 cm to 13

cm. Although the pump-head increased by 5.4 per cent, the required pump power

dropped by more that 21 per cent due to the reduced flow rate in the pipe. These results indicate that the two pumps are underutilised with this arrangement under the specified

conditions. A more logical use for this pump arrangement is to keep the diameter of

pipe unchanged but allow the length of the pipe to increase. A separate Excel sheet was

developed for this scenario and its results with the imposed upper limit for the water velocity are shown in Table 5.2 as “Two pumps in series (2)”. As the figures show, the

pipe length in this case can be increased to 181 m with a slightly higher water flow rate.

However, both the pump head and power will be almost doubled.

5.4. Closure

This chapter presented hydraulic analyses of multi-pipe and pump-pipe systems that

require iterative solutions for simultaneously satisfying the continuity equation and the energy equation. The analyses that involved a single variable were solved by using

Goal Seek, while the analyses dealing with multiple changing cells were solved by

using Solver. All the analyses in this chapter applied the GRG Nonlinear method of Solver and required less than 5 iterations. Determining the operating point for a pump-

pipe system by using the third-order pump curve formula in Equation (5.12) required

the automatic-scaling feature of Solver to be used. In general, iterative solutions with

the GRG Nonlinear method may also require using the multi-start option.

References

[1] F. M., White, Fluid Mechanics, Seventh Edition, McGraw-Hill, 2011. [2] Y.A. Cengel and J.M. Cimbala, Fluid Mechanics Fundamentals and Applications,

McGraw- Hill, 2006.

[3] W.S. Janna, Design of Fluid Thermal Systems, 3rd

Edition, CENGAGE Learning,

2011. [4] N. N. Suryanarayana, and O. A. Arici, Design and Simulation of Thermal Systems,

McGraw-Hill, 2004.

Exercises

1. Water at 20°C (ρ = 998 kg/m3 and μ = 1.002×10

-3 kg/m⋅s) is to be pumped from

reservoir A (ZA = 2 m) to reservoir B (ZB = 9 m) through two 25-m-long pipes

connected in parallel as shown in Figure 5.P1. The diameters of the two pipes are 3

cm and 5 cm. The motor–pump unit draws 7 kW of electric power during operation at 68% efficiency. The minor losses and the head loss in the pipes that connect the

parallel pipes to the two reservoirs can be considered to be negligible.

Page 134: Computer-Aided Thermofluid Analyses using Excel

Computer-Aided Thermofluid Analyses Using Excel

Figure 5.P1. Schematic for problem 5.1

Modify Excel sheet developed for Example 5-1 and use Solver to determine the total flow rate between the reservoirs and the flow rates through each of the parallel

pipes for (a) plastic pipes, (b) commercial-steel pipes, and (c) cast-iron pipes.

This exercise is based on Problem 8-68 in Cengel and Cimbala [2]. 2. A certain part of cast iron piping of a water distribution system involves a parallel

section as shown in Figure 5.P2. Both pipes have a diameter of 30 cm and the flow

is fully turbulent. One of the branches (pipe A) is 1000 m long, while the other

branch (pipe B) is 3000 m long. The flow rate through pipe A is 0.4 m3/s and the

water temperature is 15°C (ρ = 999.1 kg/m3 and μ = 1.138×10

-3 kg/m⋅s).

Disregarding minor losses, develop an Excel sheet for analysing the system and use

Solver to determine the flow rate through pipe B. Use the Swamee-Jain formula for

the friction factor. This exercise is based on Problem 8-82 in Cengel and Cimbala [2]. Answer: 0.231 m

3/s.

Pump

Reservoir A

zA = 2 m

Reservoir B

zA = 9 m

3 cm

5 cm

30 cm

3000 m

30 cm

1000 m 0.4 m

3/s

A

B

Figure 5.P2. Schematic for problem 5.2

Page 135: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

3. Figure 5.P3 shows a pipeline that transports oil at 40°C (ρ = 876 kg/m3 and μ =

0.2177 kg/m⋅s) at a rate of 3 m3/s. The pipeline branches out into two parallel pipes

made of commercial steel that reconnect downstream. Pipe A is 500 m long and has

a diameter of 30 cm while pipe B is 800 m long and has a diameter of 45 cm. The

minor losses are considered to be negligible. Develop an Excel sheet to determine the flow rate through each of the parallel pipes. This exercise is based on Problem

8-123 in Cengel and Cimbala [2]. Solution: QA = 0.91 m3/s, QB = 2.09 m

3/s.

Figure 5.P3. Schematic for problem 5.3

4. The parallel galvanized-iron pipe system of Figure 5.P4 delivers gasoline at 20°C

(ρ = 680 kg/m3 and μ = 2.9×10

-4 kg/m⋅s) with a total flow rate of 0.036 m

3/s. If the

pump is wide open and not running, with a loss coefficient K =1.5, determine: (a)

the flow rate in each pipe and (b) the overall pressure drop.

Figure 5.P4. Schematic for problem 5.4

This exercise is based on Problem 6-113 in White [1].

500 m

800 m

Oil

3 m3/s

A

B

30 cm

45 cm

60 m

55 m

Gasoline 0.036 m3/s

A

B

5 cm

4 cm

Pump

Page 136: Computer-Aided Thermofluid Analyses using Excel

Computer-Aided Thermofluid Analyses Using Excel

5. Solve Problem 5.4 with the following modification. Let the pump be running and delivering 45 kW to the flow in pipe 2. The fluid is gasoline at 20°C (ρ = 680 kg/m

3

and μ = 2.9×10-4

kg/m⋅s). Determine (a) the flow rate in each pipe and (b) the overall pressure drop. This exercise is based on Problem 6-114 in White [1].

6. For the piping system shown in Figure 5.P6, all pipes are made of concrete with a roughness of 0.1 cm. Neglecting minor losses, compute the overall pressure drop p1

- p2 in kPa if Q = 0.54 m3/s. The fluid is water at 20°C (ρ = 998 kg/m

3 and μ =

1.002×10-3

kg/m⋅s). This exercise is based on Problem 6-118 in White [1].

Figure 5.P6. Schematic for problem 5.6

7. Modify Problem 5.6 as follows: Let the pressure drop p1 - p2 be 650 kPa.

Neglecting minor losses, determine the flow rate in m3/h.

8. Figure 5.P8 shows two commercial-steel pipes connected in parallel at points A and B. The pipe system transports water at 15

oC at a flow rate (Q) of 1.2 m

3/s. The

length and diameter of pipe 1 are 1000 m and 50 cm, respectively. The length of

pipe 2 is 1500 m. It is required to determine the diameter of pipe 2 such that the

total pumping power ( PW ) does not exceed 5 kW.

Figure 5.P8. Two pipes connected in parallel

Solve the problem by determining the friction factor (f) from the following options:

(a) Using a constant value for f = 0.015 (Answer: D2 ≈ 33 cm).

(b) Using the Swamee-Jain formula for the friction factor.

(c) Using the Colebrook-White formula for the friction factor.

D= 30 cm, L= 300 m D= 30 cm

L= 250 m

D= 20 cm, L = 450 m

D= 37.5 cm, L = 360 m

2 1

0.54 m3/s

A B

1

2

Q

Q2

Q1

Page 137: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

9. Using the pump characteristic curve given by Equation (5.12) and the Colebrook-White formula, develop an Excel sheet to determine the operating point for the

pump-pipe system described in Example 5-1.

10. Figure 5.P10 shows three pumps connected in parallel to a horizontal 100-m-long commercial-steel pipe that carries water at 25

oC. The three pumps are identical and

their characteristic curve is given by Equation (5.12). For economic reasons it is

desired to keep the water velocity in the common pipe below 2.8 m/s by selecting a suitable diameter for the pipe. Minor losses can be neglected. Use Excel and Solver

to determine the operating point of the system, the diameter of the common pipe,

and the power requirement of the three pumps.

Figure 5.P10. Three centrifugal pumps connected in parallel

11. Figure 5.P11 shows three pumps connected in series to a horizontal commercial-

steel pipe that has a diameter of 22 cm and carries water at 25oC. The characteristic

curve for the three identical pumps is expressed by Equation (5.12). For economic

reasons, it is desired to keep the velocity in the common pipe below 2.8 m/s. Minor

losses can be neglected. Determine length of the common the pipe, the operating

point of the system, and the power requirement of the three pumps.

Figure 5.P11. Three centrifugal pumps connected in series

Q

Q1

Q, L, D, ε

2

1

Q1 +Q2 3

Q

Q

1

2

Q, L, D, ε

Q

3

Page 138: Computer-Aided Thermofluid Analyses using Excel

Computer-Aided Thermofluid Analyses Using Excel

6

Hydraulic analyses of pipe networks

Page 139: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

Hydraulic analyses of pipe-network are based on the same principles applied in the previous chapter for analysing multi-pipe systems; which are the two principles of mass

and energy conservation coupled with auxiliary formulae for determining the pipe

friction. However, pipe-network analyses are more challenging because they involve more continuity equations and energy constraints to be simultaneously satisfied.

Therefore, the analyses of practical pipe-networks require computer-aided numerical

methods such as the Hardy-Cross method. Before introducing the Excel-aided method for pipe-network analyses, this chapter illustrates the limitation of mathematical

analysis of looped pipe-networks by considering a simple network with three pipes. The

chapter then presents the Excel-aided methodology that uses Solver to deal with the

analyses of looped, branched, and mixed pipe networks.

6.1. The methodology of looped pipe-network analysis

Figure 6.1 shows two types of pipe network arrangements: (a) looped networks and (b) branched networks. The flow in the pipe network can be driven by the effect of gravity

or by a motor-pump system. The connection points, called nodes, can be sources

(supply points), sinks (demand or load points), or just junctions. The looped network in

Figure 6.1.a has two sources, which are the reservoirs A and B, and six load points. The branched network in Figure 6.1.b has a single source, which is the pump A, and six load

points. According to the notation scheme used in Figure 6.1, a single letter refers to a

location or a pipe junction, e.g., A, B, etc., two letters refer to a pipe, e.g., AB, BC, etc., whereas numbers refer to pipe loops, e.g. loop 1, loop 2, etc.

(a) (b)

Figure 6.1. Pipe network arrangements: (a) looped and (b) branches networks

In a typical hydraulic analysis, the flow rates at the sources and outlets are given together with the lengths, diameters, and roughness of the pipes and the requirement is

to determine the flow rates and pressure levels at the different nodes.

A

B

C

D

E

F

G

H

Loop 1

Loop 2 Loop 3 B

C D

E

F G H

I J

M A

Page 140: Computer-Aided Thermofluid Analyses using Excel

Computer-Aided Thermofluid Analyses Using Excel

The analytical model for a looped network In order to analyse the looped pipe network shown in Figure 6.1.a that has eight pipes,

eight independent equations have to be formed from mass and energy balances. The

continuity equation can be applied at two levels; (i) to the whole pipe network, and (ii) to any junction (node) in the network. Applied to the whole network shown in Figure

6.1.a for a steady flow of an incompressible fluid, the continuity equation leads to:

QA + QB = QC + QD + QE + QF + QG+ QH (6.1) Applied to any junction in the network, the continuity equation requires the algebraic

sum of all the flow rates meeting at the junction to be zero. For example, at junction C

the equation becomes:

QC = QAC - QCD - QCE - QCF (6.2)

Application of the continuity equation at the six nodes in the network shown in Figure 6.1.a leads to five (number of nodes minus 1) independent linear equations. The

remaining three equations have to be obtained from the energy equation.

The general form of the energy equation, Equation (1.20), does not only account for the

friction losses in the pipes, but also for the differences in elevations between the end

points. However, for simplicity we will assume here that all pipes of the network under

consideration are on the same horizontal plane. A special form of the energy equation can be written for a closed loop in which point B in the equation coincides with point

A. In this case, the algebraic sum of the head losses in all the pipes forming a closed

loop is balanced by any heads generated by inline booster pumps in the loop, i.e.,

N

P

M

f hh11

(6.3)

Where M is the number of pipes forming the closed loop, N is the number of booster pumps in the loop, hf is the head loss in each pipe (including the minor losses), and hP is

the head produced by a booster pump. When there is no booster pump within the loop,

Equation (6.3) reduces to:

01

M

fh (6.4)

Friction loss in a pipe (hf) can be determined by using the Darcy-Weisbach equation or

the Hazen-Williams equation for pipes carrying water. Since we cannot be certain about the flow directions in the network pipes in advance, we have to assume them. The flow

Page 141: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

directions of pipes CD, CE and CF in Figure 6.1.a are assumed directions. The true directions can only be confirmed after the analysis is done.

Applying Equation (6.4) to the three loops in the network provides the three (equal to the number of loops) additional equations needed to solve the problem. The solution of

the eight equations should give the unknown values and directions of the flow rates in

the eight pipes of the network. A positive flow value means that the assumed direction is correct and a negative value means that it has to be reversed. The following example

illustrates the limitation of mathematical pipe-network analyses by considering a simple

network that consists of only three pipes forming a single loop.

Example 6-1. Mathematical analysis of a simple looped pipe network

Figure 6.2 shows a pipe network that distributes water from a single source to two

consumption points as shown in the figure. The friction factor for all three pipes can be taken as 0.025. Find the flow rates in the three pipes.

Figure 6.2. Pipe network in Example 6-1

Solution

For this simple network, there are only two possible flow arrangements depending on

the flow direction in pipe BC as shown in Figures 6.3.a and 6.3.b. Since there are only three flow rates that have to be determined, three independent equations are needed to

solve the problem. For this simple network, let us refer to pipe AB by pipe 1, pipe BC

by pipe 2, and pipe AC by pipe 3. Starting with the arrangement shown in Figure 6.3.a, mass conservation leads to the following two equations:

6012 QQ (6.5)

13 100 QQ (6.6)

40 L/s

100 L/s 60 L/s A B

C

L=200m

D=0.2m

L=600m

D=0.1m

L=400m

D=0.15m

Page 142: Computer-Aided Thermofluid Analyses using Excel

Computer-Aided Thermofluid Analyses Using Excel

Figure 6.3. The two possible flow arrangements in the simple network

The third equation can be obtained by applying the energy equation (Equation (6.4)).

03,2,1, fff hhh (6.7)

Equation (6.7) applies the sign convention that the two clockwise flows in pipes 1 and 2

are positive, while the counter clockwise flow in pipe 3 is negative. Using Equation

(1.21) and substituting for V by Q/A, the equation becomes:

0222 2

3

23

3

332

2

22

2

222

1

21

1

11

gA

Q

D

Lf

gA

Q

D

Lf

gA

Q

D

Lf (6.8)

This equation can be put in the following simpler form:

0233

222

211 QKQKQK (6.9)

Where,

211

111

2

1

gAD

LfK (6.10)

222

222

2

1

gAD

LfK (6.11)

233

333

2

1

gAD

LfK (6.12)

A B

C

A B

C

(a) (b)

Q1

40 L/s 40 L/s

100 L/s

60 L/s

100 L/s

60 L/s

Q3

Q2

Q3

Q2

Q1

Page 143: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

Now, substituting for Q2 and Q3 from Equations (6.5) and (6.6), Equation (6.9) becomes:

0100602

13

2

12211 QKQKQK (6.13)

Expanding and rearranging Equation (6.13) leads to:

0121 cbQaQ (6.14)

Where:

321 KKKa (6.15)

21 200120 KKb (6.16)

32

22 10060 KKc (6.17)

Equation (6.14) is a quadratic equation that can be solved for Q1 once the numeric

values of K1, K2, and K3 are provided. There are two solutions for the quadratic

equation, which are given by:

a

acbbQ

2

42

1

(6.18)

Where a = 114350.4, b = -1.3x107, and c = 3.37x10

8. Substituting for a, b, and c in

Equation (6.18) gives the following solutions:

First solution: Q1 = 66.99 l/s, Q2 = 6.99 l/s, and Q3 = 33.0 l/s

Second solution: Q1 = 44.04 l/s, Q2 = -15.96 l/s and Q3 = 55.96 l/s

The second solution, which leads to a negative value for Q2, cannot be accepted because

it either means that the magnitude of Q2 is negative, which is physically meaningless, or its direction is reversed, which goes against our initial assumption embedded in the

formation of Equation (6.7). Trying to solve the problem by adopting the flow

arrangement shown in Figure 6.3.b, i.e., by assuming that the flow in pipe BC goes in the opposite direction, leads to values of the flow rates in the pipes as complex

numbers, which is also a physically unacceptable solution. Therefore, the only

acceptable solution is the first solution shown above.

The pipe-network considered in this example could be analysed mathematically

because of its simplicity and because of using constant values for the friction factors in

Page 144: Computer-Aided Thermofluid Analyses using Excel

Computer-Aided Thermofluid Analyses Using Excel

Equations (6.10) – (6.12). In general, the friction factor depends on the Reynolds number and, therefore, on the unknown pipe flow rate. Therefore, the complex practical

pipe networks have to be analysed by using computer-aided methods [1]. In this

respect, the earliest and mostly used method for the analysis of looped pipe-networks is the Hardy-Cross (H-C) method described in Appendix C. The following section

presents an Excel-aided method for pipe-network analyses that is more general than the

H-C method because it can be used for both looped and branching networks [2, 3].

6.2. Analyses of looped pipe-networks with Excel-Solver

This method utilises the multi-variable iterative capability of Solver that can take into

consideration multiple constraints on the iterative process. The following example, which is based on Example 5-2 in Nalluri and Feather [4], demonstrates the method.

Example 6-2. Analysis of a two-loop network by Excel-Solver Figure 6.4 shows a network that consists of two pipe loops with one source and five

discharge (load) junctions. The valve in pipe BC is partially closed, which produces a

local head loss of 10.0 V2/2g. Table 6.1. gives the lengths and diameters of each pipes.

The roughness of all pipes is 0.06 mm. Determine the water flows in the network pipes.

Figure 6.4. The two-loop pipe network of Example 6-2

Table 6.1. Pipes‟ lengths and diameters Pipe AB BC CD DE EF AF BE

Length (m) 500 400 200 400 600 300 200

Diameter (mm) 250 150 100 150 200 250 150

The analytical model

The Excel-aided solution procedure starts with guessed values for selected pipe flows.

The remaining pipe flows are then calculated by Excel such that they satisfy the

continuity equation. Since these initial flows are unlikely to satisfy the energy equation, Solver is used to adjust the guessed pipe flow rates so that the energy equations are

satisfied for all the network loops while Excel recalculates the remaining pipe flows to

1 2

Valve

A B

F

C

D E

200 L/s

Page 145: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

ensure that the nodal continuity equations are simultaneously satisfied. We need to guess the flow rate in only one pipe in each loop since the flows in the other pipes can

be determined from the continuity equations. Let us guess the magnitude and direction

of flow rate in pipe AB (loop 1) and pipe BC (loop 2) and calculate the flow rates in the other pipes in the network by applying mass conservation at the nodes (junctions).

Accordingly, the flow rates in the other pipes are determined as follows:

Loop 1:

BCBABBE QQQQ (6.19)

ABAAF QQQ (6.20)

FAFEF QQQ (6.21)

Loop 2:

CBCCD QQQ (6.22)

BCBABBE QQQQ (6.23)

CDDDE QQQ (6.24)

Figure 6.5 shows the initial flows in the network for assumed values: QAB=120 l/s and QBC = 50 l/s. Your initial flows can be different from those shown in the figure provided

that they satisfy the nodal continuity equations. The final solution may change the

initial pipe flows in both magnitude and direction.

Figure 6.5. Initial flows and sign convention for the pipe network of Example 6-2

1 2

Valve

A B

F

C

D E

200 120 60

50

10

20

80

10

40

40

30

30

40

Page 146: Computer-Aided Thermofluid Analyses using Excel

Computer-Aided Thermofluid Analyses Using Excel

The second step in the procedure is to calculate the friction loss in each pipe of the network and calculate the net friction loss in each loop according to the assumed flow

direction in the relevant pipes. In the present analyses, the friction losses in all the pipes

are calculated using the Darcy-Weisbach equation, Equation (1.21). However, for pipe BC, the equation is modified to allow for the loss in the valve as follows:

g

V

g

V

D

Lfh BCf

210

2

22

, (6.25)

More likely the energy equation, Equation (6.4), will not be satisfied by using the

initially guessed flows. To satisfy the energy equation, Solver will be used to adjust the

flow rates in pipes AB and BC so as to satisfy the following constraints on the iterative process:

AFfEFfBEfABf hhhh ,,,, Loop 1 (6.26)

BEfDEfCDfBCf hhhh ,,,, Loop 2 (6.27)

Where ││ refers to the absolute value and ε is a prescribed positive tolerance that is

acceptably small.

By using the absolute value of the error, the positive direction for friction doesn‟t have

to be the same for all the loops, i.e., it can be clockwise or anti-clockwise for different

loops. The absolute value also takes into consideration that the flow may not be in the suggested direction or may change its direction during the solution process. Also note

that only the flow rates in pipes AB and BC need to be adjusted by Solver since the

other pipe flow rates are adjusted automatically by applying Equations (6.19) to (6.24) in the main Excel sheet.

Excel implementation Figure 6.6 show the Excel sheet developed for applying the Excel-aided method for

solving this example. The problems data (pipe lengths and diameters, roughness factor,

and water viscosity) are shown at the left part of the sheet. The two values for the flow

rates in pipe AB (Q_AB) and pipe BC (Q_BC) are guessed values while the flow rates in the other pipes (Q_CD – Q_BE) are calculated according to Equations (6.19) to

(6.24). The sheet then calculates the velocity (Q/A) and Reynolds number (Re) for each

pipe. Based on these values, the sheet determines the friction factor (f) and friction loss (hf) in the pipes. Finally, the sheet calculates the balance of friction losses in the two

loops as required by Equations (6.26) and (6.27). The formula bar shows how the

balance of friction losses in loop 1 is calculated according to Equation (6.26).

Page 147: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

Figure 6.6. Excel sheet developed for Example 6-2

Figure 6.6 shows that the imbalances in friction losses in the two loops with the initially

guessed flows are not small. Solver can now be used to find the values of QAB and QBC that make the friction imbalances in the two loops become less than a specified value.

Figure 6.7 shows the required set-up for this task.

Figure 6.7. Solver set-up for Example 6-2

With this set-up the friction balances in the two loops should be below 0.1. The sheet

automatically calculates the unknown flow rates by satisfying the continuity equations. Figure 6.8 shows the solution found by Solver. Note that the imbalances in friction

losses in the two loops have been reduced to 0.1 or less. As shown in Table 6.2,

Solver‟s solution shown in Figure 6.8 agrees closely with that given by Nalluri and Feather [4]. The following example applies the method to a pipe-network with three

loops which was used by Benjamin [5] to illustrate the Hardy-Cross method. His

solution will be used to verify the solution with Excel-Solver.

Page 148: Computer-Aided Thermofluid Analyses using Excel

Computer-Aided Thermofluid Analyses Using Excel

Figure 6.8. Solver solution for Example 6-2

Table 6.2. Verification of the solution obtained by the Excel-Solver method

Pipe Nalluri and Feather [4] Excel-Solver

AB 0.11152 0.1115

BC 0.03505 0.0350

CD 0.00495 0.0050

DE 0.03495 0.0350

EF 0.04848 0.0485

AF 0.08848 0.0885

BE 0.01648 0.0165

Example 6-3. Analysis of a three-loop network by Excel-Solver

Determine the flow rates in all the pipes in the network shown in Figure 6.9 according to the data given in Table 6.3. If the pressure head at point A is 40 m, find the pressure head at D (which might represent a fire-demand, for example).

Figure 6.9. Pipe-network for Example 6-3

15 L/s

A

B

E C D

F G H

60 L/s

30 L/s

15 L/s

Page 149: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

Table 6.3. Pipes‟ lengths and diameters

Pipe Length (m)

Diameter (m) Pipe

Length (m)

Diameter (m)

AB 250 0.3 DG 100 0.25

BE 100 0.2 FG 125 0.15

DE 125 0.2 CF 100 0.1

CD 125 0.2 EH 100 0.25

AC 100 0.15 GH 125 0.1

The analytical model

Following the procedure described above, the flow rate in one pipe in each loop is guessed and the flow rates in the other pipes are obtained from relevant mass balance

equations. Figure 6.10 shows the initially assumed values and directions of the flows.

Figure 6.10. Pipe-network for Example 6-3 with initial flows

The flows in pipes AB, CD, and DE are guessed and those in the other seven pipes are

determined as follows:

ABBE QQ (6.28)

ABAAC QQQ (6.29)

DCDDEDG QQQQ (6.30)

15 L/s

A

B

E C

D

F G H

60 L/s

30 L/s

15 L/s

1

2 3

10 L/s

50 L/s 10 L/s

20 L/s

30 L/s 10 L/s

0 L/s

5 L/s 15 L/s

10 L/s

Page 150: Computer-Aided Thermofluid Analyses using Excel

Computer-Aided Thermofluid Analyses Using Excel

FCFFG QQQ (6.31)

CDACCF QQQ (6.32)

DEBEEH QQQ (6.33)

EHHGH QQQ (6.34)

The three loops in the network provide the following energy constraints:

0,,,,, CDfACfDEfBEfABf hhhhh Loop 1 (6.35)

0,,,, FGfCFfDGgfCDf hhhh Loop 2 (6.36)

0,,,, GHfDGfEHfDEf hhhh Loop 3 (6.37)

Excel implementation

Figure 6.11 shows the Excel sheet developed for this example. The (coloured) flow rates for pipes AB, DE, and CD are guessed flow rates. The flow rates for the other

seven pipes are determined according to Equation (6.28) to (6.34). Based on the

guessed flow rates, the sheet calculates the Reynolds number (Re), friction factor (f), and friction loss (hf) in each pipe. Figure 6.11 shows that the guessed flow rates do not

satisfy the requirements of the energy equations, Equations (6.35), (6.36), and (6.37).

Figure 6.11. Excel sheet for Example 6-3

Solver can now be used to adjust the three guessed flow rates in pipes AB, DE, and CD until Equations (6.35) to (6.37) are satisfied and Figure 6.12 shows Solver set-up for

this problem.

Page 151: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

Figure 6.12. Solver set-up for Example 6-3

Note that Solver is only required to adjust the flow in the three pipes with the guessed

flows to satisfy the constraints that represent the three energy equations. Figure 6.13

shows the final result obtained by Solver. Table 6.4 compares this result with that given

by Benjamin [5] and proves their proximity to the Hardy-Cross solution.

Figure 6.13. Solver solution for Example 6-3

Table 6.4. Verification of Solver‟s solution for the pipe-network of Example 6-3

Pipe Benjamin [5] Present solution

Pipe Benjamin [5] Present solution

AB 0.0098 0.00978 DG 0.0082 0.00808

BE 0.0098 0.00978 FG 0.0035 0.00363

ED 0.0065 0.00649 CF 0.0185 0.01863

DC 0.0317 0.03159 EH 0.0033 0.00329

AC 0.0502 0.05022 HG 0.0117 0.01171

Page 152: Computer-Aided Thermofluid Analyses using Excel

Computer-Aided Thermofluid Analyses Using Excel

6.3. Analyses of branched pipe-networks with Excel-Solver The analysis of branched pipe-network with Excel and Solver basically follows the

same procedure applied for the analysis of looped-networks. The basic equations for the

analysis are the continuity and energy equations supplemented by an equation for determining the frictional losses. The following example, which is based on Example 5-

4 in Nalluri and Feather [4], illustrates the procedure.

Example 6-4. Branched network connecting multi-reservoirs

Neglecting minor losses, determine the gravity-driven discharges in the pipes of the

branched network shown in Figure 6.14 that carries water. The data of the pipes are given in Table 6.5 and the elevations of the three tanks A, B, C, and D are shown in the

figure.

Figure 6.14. The branched pipe-network in Example 6-4

Table 6.5. Pipes‟ lengths and diameters

Pipe Length (m) Diameter (mm)

AJ 10,000 450

BJ 2,000 350

CJ 3,000 300

DJ 3,000 250

The analytical model The energy equation requires that the friction loss between any two points (nodes) A

and B in the network to be balanced by the difference in potential and kinetic heads

between these two points in addition to the head produced by any booster pump along

the line. Therefore, the energy equation takes the following form:

g

VVZZhh BA

BAP

M

f2

22

1

(6.38)

200 m

75 m

100 m

120 m

J

A B

C

D

Page 153: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

Where M is the total number of pipes between the two points A and B. Without a booster pump along the line, the equation simplifies to:

g

VVZZh BA

BA

M

f2

22

1

(6.39)

Nalluri and Feather [4] solved the problem by using the quantity balance method (the

'nodal' method). Their solution started with an assumed value for the head at joint J

based on which the flow rate and head loss in each pipe were calculated. The guessed heat at joint J was then adjusted successively in order to satisfy the energy equation.

With the present method it is more convenient to follow the same procedure used in the

previous section by assuming the flow rates in each pipe, determining the friction losses, and then using Solver to adjust the flow rates until the energy equation is

satisfied within a specified tolerance. Figure 6.15 shows the magnitudes (litre/s) and

directions of the flow rates initially assumed in each pipe.

Figure 6.15. Assumed flows in the network

Three of the four flows at junction J have been assumed (AJ, BJ, and CJ), while the fourth (DJ) is left to satisfy continuity:

CJBJAJDJ QQQQ (6.40)

Since there are no booster pumps in the network, Equation (6.39) applies. For pipes that

have constant cross-sections, the velocities at both ends of the pipe are the same and,

therefore, Equation (6.39) can be simplified to produce the following equations:

0,, BABJfAJf ZZhh (6.41)

0,, CACJfAJf ZZhh (6.42)

200 m

75 m

100 m

120 m

J

A B

C

D

100 L/s

50 L/s

30 L/s

20 L/s

Page 154: Computer-Aided Thermofluid Analyses using Excel

Computer-Aided Thermofluid Analyses Using Excel

0,, DADJfAJf ZZhh (6.43)

Equations (6.41) – (6.43) will be used as constraints for Solver solution. Once the

friction losses in the different pipes are known, the elevation at the junction J can be

determined from any of the following equations:

AJfAJ hZZ , (6.44)

BJfBJ hZZ , (6.45)

CJfCJ hZZ , (6.46)

DJfDJ hZZ , (6.47)

The Excel sheet

Figure 6.16 shows the Excel sheet developed for this example. The flow rates in the

three coloured or shaded cells are assumed, but the flow rate in pipe DJ is calculated from the continuity equation, Equation (6.40). Note that the formula bar shows the

formula in cell E19 that applies this equation. Based on the assumed pipe flow rates, the

sheet calculates the relevant Reynolds numbers, friction factors, and friction losses.

Figure 6.16. Excel sheet developed for Example 6-4

The top four cells in column J (i.e. J15, J16, J17, and J18) show the height at the

junction J as calculated from Equations (6.44)-(6.47). These cells show different values

because the assumed flow rates in the pipes are not correct. This is also indicated by the bottom three cells in column J that show the imbalances in the energy equations,

Equations (6.41)-(6.43), which should be zeros. Since the assumed flow rates do not

satisfy the energy equations, the values shown in the sheet are relatively large. Solver

can now be used to find the correct flow rates (their magnitudes and directions) in the

Page 155: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

three pipes AJ, BJ, and CJ that satisfy the energy equation. The required Solver set-up is shown in Figure 6.17.

Figure 6.17. Solver set-up for Example 6-4

This set-up requires Solver to adjust the flow rates in the top three pipes such that the

last three entries in column J, i.e. J20, J21, and J22, are close to zero. Note that the flow in pipe DJ is automatically determined by the continuity equation. Figure 6.18 shows

the solution found by Solver that satisfies the energy equation as shown by the small

values of the three entries in cell J20, J21, and J22. Also note that the resulting head losses in all four pipes now yield the same value for the elevation at joint J, which is

125.5 m. Table 6.6, which compares the present solution with that given by Nalluri and

Feather [4], shows a close agreement between the two solutions.

Figure 6.18. Solver solution for Example 6-4

Page 156: Computer-Aided Thermofluid Analyses using Excel

Computer-Aided Thermofluid Analyses Using Excel

Table 6.6. Verification of the pipe flow rates in m3/s obtained by Solver with those

given by Nalluri and Feather [4]

Pipe Nalluri and Feather [4]

Present solution

AJ 0.344 0.344780

BJ 0.105 0.104696

CJ 0.127 0.127590

DJ 0.112 0.112606

6.4. Analysis of mixed pipe networks

To illustrate the application of the Excel-Solver method for the analyses of a general

pipe network that consists of branched pipes branches as well as looped pipes, consider

the pipe network shown in Figure 6.19 that distributes water and has two sources and six discharge points. This network was analysed by Rivas et al [6] who also used Excel

and Solver. Their solution will be used for verification.

Figure 6.19. Pipe network (adapted from Rivas et al [6])

All the network pipes are made of steel with a roughness of 0.3 mm. The lengths and

diameters of the 16 network-pipes are given in Table 6.7. The demand at the six nodes

in litres per second is shown in Table 6.8.

123 m

112 m

2

M

A

B C D

E

F G H

I J K L

1

3

4

Page 157: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

Table 6.7. Pipe data

Pipe

Pipe size Pipe

Pipe size Diameter

(mm) Length

(m) Diameter

(mm) Length

(m)

AB 250 200 CD 200 180 BJ 150 400 LM 250 140

IJ 200 300 KL 200 360 HI 300 190 FK 150 200

CH 80 210 FG 150 340 BC 200 300 GL 80 180

GH 150 160 EF 150 180

DG 300 200 DE 200 345

Table 6.8. Nodal demand

Node C D E I F K

Demand (l/s) 100 30 30 20 10 10

The analytical model

Since the network has sixteen pipes, its analysis involves sixteen unknown flow rates. Applying the continuity equation at the eleven nodes in the network provides eleven

linear equations. Four nonlinear equations can be formed by applying the energy

equations over the four loops in the network. The fifth nonlinear equation can be formed by applying the energy equation between the two tanks A and M, for which the

elevations are known. As for the analyses of looped and branched networks, the flows

in some pipes are assumed and those in the other pipes are calculated by satisfying the

continuity equation around each node. In this case, it is enough to assume the flow in five pipes, AB, BC, GH, KL and DE. The flows in the eleven remaining pipes are then

calculated from the continuity equation as follows:

BCABBJ QQQ (6.48)

BJIJ QQ (6.49)

IIJHI QQQ (6.50)

GHHICH QQQ (6.51)

DDECDDG QQQQ (6.52)

CHCBCCD QQQQ (6.53)

GLKLLM QQQ (6.54)

Page 158: Computer-Aided Thermofluid Analyses using Excel

Computer-Aided Thermofluid Analyses Using Excel

KKLFK QQQ (6.55)

FFKEFFG QQQQ (6.56)

DGFGGHGL QQQQ (6.57)

EDEEF QQQ (6.58)

Applying the energy equation to the four loops provides four additional equations.

Since there are no pumps in the system, the closed clockwise (or counter-clockwise)

summation of the friction losses in each loop must be zero:

0,,,,, IJfBJfBCfCHfHIf hhhhh Loop 1 (6.59)

0,,,, GHfCHfCDfDGf hhhh Loop 2 (6.60)

013,8,16,15, ffff hhhh Loop 3 (6.61)

0,,,, KLfGLfFGfFKf hhhh Loop 4 (6.62)

The 16

th equation is formed by applying the energy equation along any route that

connects points A and M. Selecting the route given by A-B-J-I-H-G-L-M:

0,,,,,,, MALMfGLfGHfHIfIJfBJfABf zzhhhhhhh (6.63)

Since the initial pipe flows are unlikely to satisfy the energy equations, Solver will be

used to adjust the five guessed pipe flows until the five energy equations are

approximately satisfied.

Excel implementation

The Excel sheet developed for this example is shown in Figure 6.20. The first columns on the left side of the sheet show the given network data that include the pipe roughness

(ε), the kinematic viscosity of water (visc), the discharges at the six demand nodes, and

the pipes diameters and lengths. Initial guesses are made for the flow rates of five pipes,

one pipe in each loop. These are shown in the figure by the coloured or shaded cells. The flow rates in the other eleven pipes are then calculated from the continuity

equations, Equations (6.48) to (6.58). The sheet then determines the velocity in each

pipe followed by the Reynolds number, friction factor, and friction loss.

Page 159: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

Figure 6.20. Excel sheet developed for the mixed pipe-network

Based on the calculated friction losses, the sheet determines the imbalance in the energy

equation in the four loops (cells R2:R6) and along the route between points A and M. The last column shows the head obtained at each node (U2:U12). The specified and

calculated pipe flows automatically satisfy continuity but, as the magnitudes of the

friction imbalances show, they do not satisfy the energy constraint, Equations (6.59) – (6.63). Also, note that some nodes acquired negative elevations based on the assumed

flow rates. Solver can now be used to search for the flows in the five pipes that satisfy

the specified energy constraints, which will also give the correct elevations. Figure 6.21 shows the set-up for this analysis that requires Solver to perform the iteration with

Equations (6.59) to (6.63) as constraints.

Figure 6.21. Solver set-up for analysing the mixed pipe-network

Figure 6.22 shows the solution determined by Solver that satisfied the five constraints

with a specified tolerance of 0.01. The solutions obtained for the flow rates in the 16

Page 160: Computer-Aided Thermofluid Analyses using Excel

Computer-Aided Thermofluid Analyses Using Excel

pipes and for the heads at the eleven nodes are compared with those given by Rivas et al [6] in Figure 6.23. The figure shows close agreements with their results.

Figure 6.22. Solver solution for the mixed pipe-network

(a) (b)

Figure 6.23. Comparison of the present results for the mixed pipe-network with those

given by Rivas et al [6] for (a) the pipe flow rates and (b) nodal elevations

6.5. Closure

This chapter presented a method for using Excel and Solver for conducting hydraulic

analyses of pipe networks. An important advantage of the Excel-Solver method for pipe-network analyses is that it can be applied to looped networks, branched networks,

and mixed networks. The method can also be applied for pipe networks with specified

heads as well as specified discharges. Apart from its generality, the method ensures that continuity is automatically satisfied as the iterative process approaches the correct

solution. Appendix D illustrates the ability of the Excel-Solver method to deal with

pipe-networks of practical complexity by considering a gravity-fed pipe network

described by Brkic [8] that has two supply sources and 8 loops. The method can also be used for optimisation analyses of pipe-networks by adding an objective function for the

economic optimisation.

-0.15

-0.1

-0.05

0

0.05

0.1

0.15

0.2

0 2 4 6 8 10 12 14 16 18Flo

w r

ate

(m3/s

)

Rivas [6]Present

80

90

100

110

120

0 2 4 6 8 10 12

Ele

vati

on

(m

)

Rivas [6]Present

Page 161: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

All the analyses presented in this chapter were performed with the GRG Nonlinear method of Solver without using the automatic-scaling option. The number of iterations

ranged from 5 for the two-loop network to 55 for the four-loop network.

References

[1] W.S. Janna, Design of Fluid Thermal Systems, third edition, CENGAGE Learning,

2011 [2] A. N. El–Bahrawy, A spreadsheet teaching tool for analysis of pipe networks,

Engineering Journal of University of Qatar, vol. 10, 1997, p. 33 – 50, the internet:

https://www.researchgate.net/profile/Aly_El-Bahrawy/contributions, last accessed

24/1/2018. [3] A. M. Elfeki, Pipe network analysis example with Excel Solver, Researchgate,

available at: https://www.researchgate.net/publication/258051650_Pipe_Network_ Analysis_Example_with_Excel_Solver, last accessed 20/6/2017.

[4] C. Nalluri and R.E. Feather, Civil Engineering Hydraulics, Fourth Edition,

Blackwell Publishing, 2008. [5] M.M. Benjamin, Analysis of complex pipe networks with multiple loops and inlets

and outlets, the internet: http://faculty.washington.edu/markbenj/CEE342/

Abbreviated%20Hardy-Cross.pdf, last accessed 20/6/2017. [6] A. Rivas, T. Gómez-Acebo, and J. C. Ramos. The application of spreadsheets to

the analysis and optimization of systems and processes in the teaching of hydraulic

and thermal engineering, Computer Applications in Engineering Education , Vol.

14, Issue 4, 2006, pp. 256-268. [7] White, Fluid Mechanics, Seventh Edition, McGraw-Hill, 2011.

[8] D. Brkic, Spreadsheet-Based Pipe Networks Analysis for Teaching and Learning Purpose, Spreadsheets in Education (eJSiE): Vol. 9: Iss. 2, Article 4, 2016. Available at: http://epublications.bond.edu.au/ejsie/vol9/iss2/4

[9] Chemical Engineer Guide (CheGuide), https://cheguide.com/pipe_network.html, (Last accessed July 27, 2019).

Exercise 1. All the five pipes in the network shown in Figure 6.P1 are horizontal and have a

friction factor f =0.025. For the given inlet and exit flow rate of 0.054 m3/s of water

at 20°C (ρ = 998 kg/m3 and μ = 1.002×10

-3 kg/m⋅s), determine the flow rate and

direction in all pipes. If pA = 800 kPa gage, determine the pressures at points B, C,

and D. This exercise is based on Problem 6.127 in White [7]. 2. Analyse the gravity-driven pipe network shown in Figure 6.P2 that distributes water

from one reservoir to five demand points via 19 cast iron pipes (ε = 0.00026 m).

The accompanying table shows the lengths and internal diameters of the network

pipes that are laid on a flat area with no variation in elevation. 3. Perform pipe network analysis and calculate water flow in all branches of the

network shown in Figure 6.P3 that has two sources, 14 discharge points, and 22

pipes. Hazen-Williams coefficient for each pipe is provided in the accompanying table.

Page 162: Computer-Aided Thermofluid Analyses using Excel

Computer-Aided Thermofluid Analyses Using Excel

Figure 6.P1. A pipe-network with two loops (adapted from White [7])

Figure 6.P2. A pipe-network with 8 loops (adapted from Brkic (8) with modifications)

Pipe Length (m) Diameter (m) Pipe Length (m) Diameter (m) AB 457.2 0.305 JK 304.8 0.152

BC 304.8 0.203 KL 335.3 0.254 CD 365.8 0.203 EL 304.8 0.254

DE 609.6 0.203 HJ 548.6 0.152 EF 853.4 0.203 BJ 335.3 0.152

FG 335.3 0.203 GK 548.6 0.152 GH 304.8 0.203 CK 365.9 0.254

HI 762.0 0.203 FL 548.6 0.152

AI 243.8 0.203 DL 396.2 0.152 IJ 396.2 0.152

L=900 m

20 cm

20 cm

15 cm 8 cm

0.054 m3/s

0.054 m3

/s

L=1200 m

23 cm

D

A

B

C

373.32 m3/h

113.4 m3/h

66.44 m3/h 66.44 m

3/h

90.72 m3/h

A B C D

E

F

QE

L K J I

G H

Page 163: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

Figure 6.P3. A pipe-network with seven loops (Adapted from CheGuide.com [9])

Pipe No. Pipe Diameter (mm) Length (m) C

1 AB 1000 1000 100 2 BO 750 925 100

3 NO 750 1000 100 4 AN 750 925 100

5 MN 500 350 100 6 LM 500 671 100

7 KL 500 400 100 8 KO 500 650 100

9 DO 750 1000 120

10 BC 1000 1000 120 11 CD 1000 925 120

12 DE 1000 800 120 13 EF 750 763 120

14 EP 1000 650 120 15 FP 750 400 120

16 FG 750 125 120 17 GH 750 400 120

18 HP 500 125 120 19 HI 500 800 120

20 IJ 500 125 120 21 JP 500 800 120

22 JK 500 1000 120

1 m3/s

1 m3/s

12 m3/s 1 m

3/s

1 m3/s 1 m

3/s

1 m3/s

1 m3/s 1 m

3/s 1 m

3/s

1 m3/s

1 m3/s

1 m3/s

2 m3/s

A B C

D E

F

G H I

J K L

M

N O

P

1 m3/s

1 m3/s

Page 164: Computer-Aided Thermofluid Analyses using Excel

Computer-Aided Thermofluid Analyses Using Excel

7

Finite-difference solution of the

steady heat-conduction equation

Page 165: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

Numerical solution methods, such as the finite-difference (FD) method and the finite-element (FE) method, enable us to deal with multi-dimensional heat-conduction in

complex geometries. A common feature in these methods is that they replace the

original conduction equation with a system of linear equations that can be solved using standard methods. Compared to the FE method, the FD method is easier to apply

because it directly replaces the derivatives in the equation by finite differences. This

chapter focuses on using the FD method for solving the steady heat-conduction equation. Before introducing the FD method, simple one-dimensional heat conduction

problems are solved with the analytical solution method and then with the FD method

so as to highlight the differences between the numerical and the analytical methods.

The FD method is then applied to the heat-conduction equation with various boundary conditions. The chapter presents two approaches for applying the FD method with

Excel. The first approach assembles the system of linear equations and uses Excel‟s

matrix functions to solve it, while the second approach uses circular calculations and, therefore, does not require the system of linear equations to be assembled.

7.1. Analytical solution of the steady one-dimensional conduction equation

The general equation that governs the heat transfer by conduction in a medium with a constant thermal conductivity is the following partial differential equation [1]:

t

T

k

e

z

T

y

T

x

T g

12

2

2

2

2

2 (7.1)

Where k is the thermal conductivity, ge the volumetric rate of heat-generation, and α

the thermal diffusivity of the medium (α = k/ρcp). For steady one-dimensional heat-

transfer by conduction without heat generation, the equation reduces to:

02

2

dx

Td (7.2)

The analytical solution of Equation (7.2) can be obtained by integrating it twice, i.e.:

1Cdx

dT (7.3)

21)( CxCxT (7.4)

Values of the two unknown constants C1 and C2 can then be determined if given two

independent boundary conditions. The following two examples illustrate the application

of the analytical solution method by using simple boundary conditions.

Page 166: Computer-Aided Thermofluid Analyses using Excel

Computer-Aided Thermofluid Analyses Using Excel

Example 7-1. One-dimensional heat-conduction with prescribed-temperatures The inner and outer sides of a large plane wall of thickness L = 0.3 m and thermal

conductivity k = 0.8 W/m2.oC are kept at constant temperatures of 20

oC and 5

oC,

respectively. Determine the temperatures at x = 0.1 m and x = 0.2 m during a steady heat transfer by conduction.

Solution In this case, the two constants in Equation (7.4) can be determined by applying the

boundary conditions as follows:

T = T0 at x = 0; Which leads to C2 = T0

T = TL at x = L; Which leads to C1 = (TL – T0)/L

Substituting the values obtained for C1 and C2 in Equation (7.4) yields:

00)( TTL

xTxT L (7.5)

Substituting for x/L = 1/3 and x/L = 2/3 in Equation (7.5), gives the two temperatures:

T0.1 = 10oC

T0.2 = 15

oC

This solution indicates that the temperature changes linearly between the two wall surfaces.

Example 7-2. One-dimensional heat-conduction with a specified heat-flux

Consider the steady heat conduction in a large plane wall of thickness L = 0.3 m and thermal conductivity k = 0.8 W/m

2.oC. Suppose that the inner side of the wall is

subjected to a constant heat flux q = 50 W/m2 while the outer side of the wall is kept

constant at 40oC. Determine the temperature at the inner side of the wall and at the

centre of the wall.

Solution

Equation (7.4) also applies for this case and values of the constants C1 and C2 can be

determined by applying the two boundary conditions:

500 q W/m2

TL = 40oC

Page 167: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

From the first boundary condition:

k

qC

dx

dT o

1 (7.6)

Substituting the given values for 0q and k gives:

C1 = -50/0.8 = - 62.5 [oC/m]

Applying the second boundary condition:

TL = C1L +C2 (7.7)

Substituting the values given for TL and L gives:

C2 = TL-C1L = 40+62.5x0.3 = 58.75 [oC]

Therefore, the equation that describes the temperature variation with x is:

xxT 5.6275.58)( (7.8)

By substituting x = 0 and x = 0.15 in Equation (7.8) we get:

T0 = 58.75oC, TL/2 = 49.375

oC

Generally speaking, the analytical method has an important advantage which is that it

yields continuous solutions that can be used to determine the temperature at any desired

value of x within the wall. However, its disadvantage is that these solutions are only

applicable for simple one-dimensional (1D) and two-dimensional (2D) geometries. Although, analytical solutions of the heat-conduction equation could also be obtained

for a number of unsteady 1D and 2D cases, these solutions usually involve complex

equations that require using tables of special functions.

7.2. Application of the FD method to the steady 1D conduction equation

Unlike the analytical solution method, the FD method and other numerical solution

methods for the heat-conduction equation do not provide continuous solutions like Equation (7.5) and Equation (7.8). Instead, they provide numerical values of the

temperature at selected points (called nodes) in the physical (special or temporal)

domain. These values are obtained by creating and then solving a system of algebraic equations that involve the unknown nodal temperatures and take care of the specified

boundary conditions. The advantage of the numerical solution methods is that they can

deal with three-dimensional (3D) geometries and complex boundary conditions easier

than the analytical solution method.

Page 168: Computer-Aided Thermofluid Analyses using Excel

Computer-Aided Thermofluid Analyses Using Excel

Having identified the relevant form of the conduction equation and boundary conditions, the procedure for applying the FD method is as follows [1, 2]:

1. Lay a grid of nodal points over the solution domain. 2. Write the FD equation relevant to the differential equation and apply it at each

internal node of the grid. This results in a difference equation for each node.

3. Assemble all the difference equations into a global system. This system will not have a unique solution before applying the boundary conditions.

4. Apply the boundary conditions by adding the relevant difference equation of

the boundary nodes or by modifying the global system.

5. Solve the resulting algebraic system of equations to determine the nodal values of the temperature.

The method will be illustrated by considering the case in Example 7-1 for which the relevant form of the conduction equation is Equation (7.2) and the relevant boundary

conditions are the two specified surface temperatures at x = 0 and x = L.

Step 1: The first step in applying the FD method is to divide the wall into nodes as shown in Figure 7.1. This choice makes nodes 1 and 2 coincide with the points at which

the temperatures are required, i.e. x = 0.1 and 0.2 m.

Figure 7.1. Node distribution for the wall in Example 7-1

Step 2: The second step is to replace the derivatives in the governing equation by finite differences. In general, the first derivative is approximated by:

x

T

dx

dT

(7.9)

0 1 2 3

∆x ∆x ∆x

0.0 0.1 0.2 0.3

Page 169: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

Where ∆x is the distance between two adjacent nodes. However, there are two ways to evaluate ∆T in the above approximation given by:

mm

mm

FW xx

TT

x

T

1

1 (7.10)

1

1

mm

mm

BW xx

TT

x

T (7.11)

Where m refers to the node number and can take the values 0, 1, 2, or 3. The first approximation is called forward difference, while the second approximation is called

backward difference. Similarly, the second derivative is approximated by:

2

11

2

2 2

x

TTT

dx

dT

dx

d

dx

Td mmm

(7.12)

The above approximation of the second derivative is called central difference. With this

approximation, the FD equivalent of Equation (7.2) is the following algebraic equation:

02

2

11

x

TTT mmm (7.13)

Step 3: Applying Equation (7.13) at the two interior nodes 1 and 2 gives the following equations:

02

2

210

x

TTT (node 1) (7.14)

02

2

321

x

TTT (node 2) (7.15)

Step 4: Multiplying both sides of Equations (7.14) and (7.15) by ∆x

2 and substituting

the numerical values for T0, T3, and ∆x leads to the following linear equations:

20 – 2T1 + T2 = 0 (7.16)

T1 - 2T2 + 5 = 0 (7.17)

Step 5: Simultaneous solution of Equations (7.16) and (7.17) for T1 and T2 gives T1 =

15oC and T2 = 10

oC, which is the same solution obtained earlier by using the analytical

method.

Page 170: Computer-Aided Thermofluid Analyses using Excel

Computer-Aided Thermofluid Analyses Using Excel

The formulation of the FD method described above is limited to:

1. One-dimensional heat-conduction

2. A simple boundary condition (specified-temperature on both sides of the wall) 3. Absence of heat generation in the medium

While the specified-temperature boundary conditions made the FD easy to apply, the lack of heat generation resulted in a linear temperature variation through the wall that

enabled it to give exact values. However, the following points have to be borne in mind

when dealing with more general cases:

1. The FD method only gives approximate solutions to the conduction equation

which may not be exact, e.g., when there is heat generation or a variable k .

2. The accuracy of the FD results can be improved by increasing the number of nodes that divide the physical domain.

3. ∆x does not always have to be uniform as shown in Figure 7.1, but can be

varied so as to make a better use of the computer time and memory.

4. The boundary conditions need not be specified values since the FD method can deal with specified heat flux, convective, or other boundary conditions.

5. In multi-dimensional heat-conduction analyses the FD equations involve Δy

and Δz and in unsteady conduction analyses they also involve Δt.

The following sections show how the FD method can be used to solve the conduction

equation with heat-generation and different boundary conditions and how to deal with

two-dimensional heat conduction. As the number of nodes increase, the size of the resulting algebraic system also increases and has to be solved by using a computer-

based numerical method. In this respect, the following sections illustrate two methods

offered by Excel for solving the algebraic system by using its matrix functions or its iterative-calculation option. More information about the FD method and its

approximations is given by Recktenwald [2].

7.3. Dealing with various boundary conditions Like the analytical solution method, the FD method can deal with boundary conditions

other than specified temperature such as:

1. Specified heat flux

2. Convection boundary condition

3. Radiation boundary condition 4. Insulated surface, symmetry surface, and mixed boundary condition

The FD equations for boundary nodes are obtained from energy balance around the node in question. For example, consider the wall shown in Figure 7.2 that experiences

uniform heat generation at the rate ge per unit volume.

Page 171: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

Figure 7.2. Treatment of boundary nodes with specified heat-flux

(adapted from Cengel and Ghajar [1])

For steady heat conduction, energy balance around any node gives:

0, elementgrightleft EQQ (7.18)

For node 0, the FD representation of Equation (7.18) is:

02/01

xAe

x

TTkAQ gleft

(7.19)

The first term in Equation (7.19) that accounts for the rate of heat transfer at the left

side of the element volume depends on the particular boundary condition being considered, which can be convection, radiation, flux, or other boundary condition. For

illustration, reconsider Example 7-2 that involves a boundary surface with a specified

heat flux. By dividing the thickness of the wall L into two equal sections, Δx = L/2 = 0.15 m, the positions of the three nodes involved are as shown in Figure 7.3.

Figure 7.3. Node distribution for Example 7-2

Volume

element

of node 0

x

L

0 1 2 Δx Δx

0

Δx

Δx

0 2 1

q = 50 W/m2

Page 172: Computer-Aided Thermofluid Analyses using Excel

Computer-Aided Thermofluid Analyses Using Excel

Being an interior node, the FD equation for node 1 is obtained from Equation (7.13) as:

02

2

210

x

TTT (7.20)

Multiplying Equation (7.20) by ∆x2 and substituting the value of T2 gives:

T0 = 2T1 – 40 (7.21)

The FD equation for node 0 is obtained by applying Equation (7.19) with ge =0:

001

x

TTkqo

(7.22)

Multiplying Equation (7.22) by ∆x and rearranging gives:

k

xqTT o

01 (7.23)

Substituting for T1 from Equation (7.23) in Equation (7.22) and rearranging gives:

4020

k

xqT o (7.24)

Substituting the values of oq , k, and ∆x in Equation (7.24) gives:

T0 = 58.75

oC

Substituting for T0 in Equation (7.23) gives:

T1 = 49.375oC

Note that the temperature values obtained by the FD method in this example are also the same as the exact values obtained analytically.

7.4. Conduction with heat generation For steady one-dimensional conduction heat-transfer in a medium with heat generation,

the conduction equation becomes:

02

2

k

e

dx

Td g

(7.25)

Page 173: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

The FD representation of Equation (7.25) for any interior node m is [1]:

02

2

11

k

e

x

TTT gmmm

(7.26)

Multiplying by ∆x2,

211 2 x

k

eTTT

g

mmm

(7.27)

The following example illustrates the application of the FD method for heat-conduction

with heat generation and prescribed-temperature boundary conditions. The example is

based on Example 2-20 in Cengel and Ghajar [1].

Example 7-3. FD solution of the steady 1D heat-conduction with heat generation

A plane wall of thickness 2L that is made of a material having a uniform thermal

conductivity k experiences a uniform heat generation at the rate ge where:

2L = 0.01 m;

k = 18.0 W/(m.oC);

ge = 7.2x107 W/m

3;

Figure 7.4. Nodal network for Example 7-3

Using the FD method with 6 equally-spaced nodes as shown in Figure 7.4,

(a) Determine the temperature profile for the boundary conditions: T-L = 50oC and

T+L = 235oC,

(b) Compare the FD results with the exact analytical solution.

5 0 1 2 3 4

T0 = 50oC T

5 = 235

oC

∆x

Page 174: Computer-Aided Thermofluid Analyses using Excel

Computer-Aided Thermofluid Analyses Using Excel

Solution Step 1: Figure 7.4 shows the solution domain divided into 5 equal portions. In this

case, ∆x = 0.01/5 = 0.002 m.

Step 2: Applications of Equation (7.27) at the four interior nodes give:

T0 – 2T1 + T2 = -R (7.28)

T1 – 2T2 + T3 = -R (7.29)

T2 – 2T3 + T4 = -R (7.30)

T3 – 2T4 + T5 = -R (7.31)

Where,

kxeR g /2 (7.32)

Steps 3 and 4: Since the temperatures at node 0 (T0) and node 5 (T5) are known, the

above system of linear equations can be put in the following matrix form:

5

0

4

3

2

1

2100

1210

0121

0012

TR

R

R

TR

T

T

T

T

(7.33)

Step 5: The above algebraic system can be solved by using the matrix inverse method

with Excel‟s matrix functions as described in Chapter 2. Figure 7.5 shows the Excel

sheet developed for this example.

Figure 7.5. Excel sheet developed for Example 7-3

Page 175: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

The left hand side of the sheet stores the given data of the wall based on which the values of ∆x and R are calculated and stored in cell F2 and F4, respectively. The

coefficient matrix is stored in cells E6:H9, while the right-hand side (r.h.s.) vector is

stored in cell K6: K9. The formula bar reveals the formula that calculates the first element of the r.h.s. vector. The inverse matrix is calculated using the “MINVERSE”

function in cells E11:H14. The inverse matrix is then multiplied by the r.h.s. vector and

the result is stored in cells J11:J14.

(a) According to the solution shown in Figure 7.5, the values of the four temperatures

are: T1 = 119oC, T2 = 172

oC, T3 = 209

oC, and T4 = 230

oC.

(b) The analytical solution for this example problem is given by [1]:

22)(

2

121222 ssssg TT

L

TTL

k

eT

, (7.34)

Where θ is related to x by:

θ = x - L/2 (7.35)

Note that the two surfaces at x = 0 and x = L correspond to θ = -L/2 and +L/2,

respectively. Figure 7.6 compares the FD solution to the exact analytical solution

obtained by substituting the different values of θ in Equation (7.34). As the figure shows, the FD solution agrees well with the analytical solution.

Figure 7.6. Comparison of the analytical and FD solutions of Example 7-3

7.5. Two-dimensional steady heat conduction

For a steady-state, two-dimensional heat conduction in a medium with uniform thermal properties and without heat generation, Equation (7.1) reduces to:

0

50

100

150

200

250

-0.005 -0.003 -0.001 0.001 0.003 0.005

Tem

pe

ratu

re (

oC

)

x

Analytical solution

FD solution

Page 176: Computer-Aided Thermofluid Analyses using Excel

Computer-Aided Thermofluid Analyses Using Excel

02

2

2

2

y

T

x

T (7.36)

The application of the FD method to Equation (7.36) basically follows the same steps

described above for the 1D equation. The following example that demonstrates the 2D

application was given by Karimi [3].

Example 7-4. FD solution of the steady two-dimensional heat conduction

The 30x30 cm2 solid section illustrated in Figure 7.7 has its right and bottom surfaces

maintained at 100oC and 150

oC, respectively. The left surface is insulated, while the top

surface is exposed to a convective environment at T∞ = 20oC and heat transfer

coefficient h = 30 W/(m2.oC). The thermal conductivity of the solid k = 5.0 W/(m.

oC)

and there is no heat generation. By dividing the solid into a nodal network in which Δx

= Δy = 10 cm, use the FD method to find the temperatures at nodal points 1 through 9.

Figure 7.7. The solution domain and nodal network for Example 7-4

Solution

For the internal nodes, the FD representation of Equation (7.36) is [1]:

022

2

1,,1,

2

,1,,1

y

TTT

x

TTT nmnmnmnmnmnm (7.37)

Where m and n refer to the node‟s locations in the x and y-directions, respectively.

Since for the present case Δx =Δy, Equation (7.37) can be simplified to:

04 ,1,1,,1,1 nmnmnmnmnm TTTTT (7.38)

1

9

TR =100oC

T∞ = 20oC, h = 5.0 W/(m.

oC)

2 3

4 5 6

7 8

Insulated

Δx=10 cm

Δy=10 cm

TB =150oC

Page 177: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

Applying Equation (7.38) to the four internal nodes, 5, 6, 8, and 9, we get the following four algebraic equations:

T4 + T2 + T6 + T8 – 4 T5 = 0 (7.39)

T5 + T3 + TR + T9 – 4 T6 = 0 (7.40)

T7 + T5 + T9 + TB – 4 T8 = 0 (7.41)

T8 + T6 + TR + TB – 4 T9 = 0 (7.42)

For nodes 4 and 7 that lie on the insulated surface, where q =0, energy balance gives:

T1 + 2T5 + T7 – 4T4 = 0 (7.43)

T4 + 2T8 + TB – 4T7 = 0 (7.44)

For nodes 1, 2, and 3 that lie on the top surface, energy balance that takes into account

the convection boundary condition gives [3]:

T2 + T4 + βT∞ – (2+β) T1 = 0 (7.45)

T1 + T3 + 2T5 + 2βT∞ - 2(2+β)T2 = 0 (7.46)

T2 + 2T6 + TR + 2βT∞ - 2(2+β)T3 = 0 (7.47)

Where β = hΔx/k .

The nine linear equations, Equations (7.39) to (7.47), can be put in matrix form as:

BR

B

B

R

R

TT

T

T

T

TT

T

T

T

T

T

T

T

T

T

T

T

0

0

2

2

410100000

141010000

024001000

100410100

010141010

001024001

0002002210

0000201221

000001012

9

8

7

6

5

4

3

2

1

(7.48)

This system of algebraic equations can be solved by using Excel‟s matrix inversion

function and Figure 7.8 shows the Excel sheet prepared for this purpose. The figure

Page 178: Computer-Aided Thermofluid Analyses using Excel

Computer-Aided Thermofluid Analyses Using Excel

shows the given data at the left hand side of the sheet based on which the sheet calculates the coefficients and right-hand side vector of the linear system.

Figure 7.8. Excel sheet developed for Example 7-4

Figure 7.9 shows the inverse matrix and the solution obtained by multiplying the

inverse matrix with the right-hand side vector. Table 7.1 compares the present solution

with that given by Karimi [3] who solved the algebraic system by using Solver as

shown in Chapter 3. The table shows that the two solutions are identical.

Figure 7.9. FD solution of Example 7-4

Table 7.1. Comparison of the present solution with that given by Karimi [3] oC Karimi [3] Present solution

T1 67.44 67.448

T2 68.46 68.469

T3 74.15 74.153

T4 94.89 94.896

T5 95.21 95.219

T6 96.56 96.562

T7 121.69 121.69

T8 120.95 120.949

T9 116.88 116.878

Page 179: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

7.6. Application of the FD method using Excel „s iterative calculation option In the two previous sections the FD method was applied by assembling the nodal

equations into a global system of linear equations that could be solved by using Excel‟s

matrix functions (or Solver). Although this approach of applying the FD method with Excel is straight-forward and simple to implement, Excel enables an alternative

approach for applying the method by using its iterative calculation option that doesn‟t

require the algebraic system to be assembled explicitly. Instead, the Excel sheet is developed in the shape of the heat-transfer medium and each node in the solution

domain is represented by a cell that stores the corresponding FD equation. The stored

FD equations are then solved simultaneously by activating Excel‟s iterative calculation

option. Apart from eliminating the need to assemble the algebraic system, this approach makes the FD model look more like a physical model than a mathematical one [4,5].

Example 7-4 will be used to illustrate this method and Figure 7.10 shows the Excel sheet prepared for this purpose. A 3x3 block of cells is reserved for the 9 nodes with

unknown temperatures, while the cells in the block boundaries store the values of the

ambient temperature (20oC) and the two surface temperatures (100

oC and 150

oC).

Figure 7.10. Excel sheet for Example 7-4 showing the 3x3 grid of nodes and the

boundary temperatures

Each cell of the 3x3 block stores the relevant nodal FD formula that determines its

temperature from those of the surrounding cells as given by the FD equations. When

entered into the coloured Excel cells, the interdependence between the different nodal equations will create circular references. By allowing iterative-calculations, Excel will

find the solution that satisfies all the inter-related nodal equations without having to

assemble the global system of equations.

Equation (7.38) for the four internal nods 5,6,8,9 can be written as:

Tnode = (Tleft + Ttop + Tright + Tbottom)/4 (7.49)

Page 180: Computer-Aided Thermofluid Analyses using Excel

Computer-Aided Thermofluid Analyses Using Excel

The formula bar in Figure 7.10 shows the formula typed in cell E5 that stores the FD equation for node 5 based on Equation (7.49), which is:

E5 = (D5 + E4 + F5 + E6)/4

Note that the usual reference by cell-location is used. For the other three internal nodes,

the above formula can be simply copied and pasted in the cells F5, E6, and F6, respectively. However, pasting the formula in cells F5 that correspond to node 6 will

cause a circular reference as shown in Figure 7.11. When this occurs, press the “OK”

button and proceed to paste the formula in cells E6 and F6 that correspond to nodes 8

and 9, respectively.

Figure 7.11. The circular-calculation warning message given by Excel when its

iterative-solution option is not active

We also have to enter the relevant FD equations for the boundary nodes 1, 2, and 3 that

lie on the top convection boundary in the respective cells. Taking node 1 as an example, the relevant FD equation is obtained by re-arranging Equation (7.45) as follows:

T1 = (T2 + T4 + βT∞)/(2+β) (7.50)

Using cell-location referencing, the above formula is entered in cell D4 as follows:

D4 = (E4 + D5 + β x D3)/(2 + β)

Similarly, the following formulae are entered in cells E4 and F4 for nodes 2 and 3,

respectively, based on Equations (7.46) and (7.47):

E4 = (D4 + F4 + D5+β x E3)/(2+(2 + β))

F4 = (E4 + G4 + E5+β x F3)/(2+(2 + β))

Page 181: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

The FD equations for node 4 and node 7 that lie on the insulated left side of the solid are to be obtained by rearranging Equations (7.43) and (7.44) following the same

procedure and typed in cells D5 and D6, respectively. Figure 7.12 reveals the complete

set of formulae for the nine cells. The simultaneous solution of the equations can now be found by using Excel‟s iterative calculation option. To do that, go to “File”→

“Options”→ “Formulas” and then select “Enable iterative calculation”.

Figure 7.12. The nine nodal FD equations entered in the corresponding cells

Figure 7.13 shows the solution determined by Excel for Example 7-4 with this method.

Comparison with the temperature values obtained earlier, confirms the solution‟s

accuracy.

Figure 7.13. The temperature distribution in the solid of Example 7-4

The solution was obtained with the default settings of 100 as the maximum number of iterations and 0.001 as the maximum change. In certain situations, these default values

may have to be adjusted so as to save computer time or to avoid solution divergence

[4]. Although Δx and Δy do not have to be equal for the application of this approach, it makes the application of the method easier. Also note that this approach suits 1D and

2D heat-conduction problems, but not 3D conduction problems unless the cells in the

third direction are stored in separate sheets of the workbook.

7.7. Closure

This chapter demonstrated the usefulness of Excel for applying the finite-difference

method to solve the steady heat-conduction equation. The basic technique of the numerical method was explained by considering the simple 1D steady conduction in a

plane wall with specified-temperature boundary conductions and did not involve heat

Page 182: Computer-Aided Thermofluid Analyses using Excel

Computer-Aided Thermofluid Analyses Using Excel

generation before showing how the method can deal with different boundary conditions, heat-generation, and 2D conduction.

As an educational tool, Excel has an important advantage compared to other computer software by offering two methods for applying the FD method. The first approach,

which is more conventional, explicitly forms the global system of linear equations and

uses the matrix-inversion method to solve the system with Excel‟s matrix functions. This approach, which suits the simple cases of steady 1D conduction equations, has

been used to introduce the FD method. The second approach avoids the explicit

formation of the algebraic systems by utilising Excel‟s iterative-calculations capability.

The advantage of this approach is that it makes the FD model look like a physical model of the conduction problem. As shown in the following chapter, this approach is

also useful for solving the transient 2D conduction equation with the FD method.

For the purpose of simplification, all the examples considered in the chapter solved the

heat conduction equation in simple 1D or 2D geometries. Appendix E describes a FD

analysis of the steady conduction heat-transfer in a triangular fin. This case shows how

the method can be used to deal with a more complex geometry.

References

[1] Y. A. Cengel and A. J. Ghajar, Heat and Mass Transfer: Fundamentals and Applications. 4

th edition, McGraw-Hill, 2011

[2] G. W. Recktenwald, Finite-Difference Approximations to the Heat Equation,

Mechanical Engineering, 10, 1-27, 2004

[3] A. Karimi, A compilation of examples for using Excel in solving heat transfer problems, American Society for Engineering Education Conference, AC 2009-

2284, University of Texas, San Antonio, 2009

[4] E. M. A. Mokheimer and M. A. Antar, On the use of spreadsheets in heat conduction analysis, International Journal of Mechanical Engineering Education

Vol 28 No 2, April 2000

[5] R. Edwards and M. Lobaugh, Using Excel to Implement the Finite Difference

Method for 2-D Heat Transfer in a Mechanical Engineering Technology Course, 121

st ASEE Annual Conference and Exposition, Indianapolis, June 15-18, 2014

Exercises 1. Figure 7.P1 shows a large uranium plate of thickness L = 4 cm and thermal

conductivity k = 28 W/m·K in which heat is generated uniformly at a constant rate

of ge = 5x106 W/m

3. One side of the plate is maintained at 0°C by iced water while

the other side is subjected to convection to an environment at T∞ = 30°C with a heat transfer coefficient h = 45 W/m

2·K. Considering a total of five equally spaced

nodes in the medium, two at the boundaries and three at the middle, develop three

Excel sheets to estimate the exposed surface temperature of the plate under steady conditions using the finite difference method with the following options:

Page 183: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

Figure 7.P1 Schematic for Problem 7.1 (adapted from Cengel and Ghajar [1])

(a) Using the explicit method

(b) Using the implicit method that assembles and solves the linear system (c) Using the implicit method with the iterative-calculation option

This exercise is based on Example 5-1 in Cengel and Ghajar [1]. 2. Develop an Excel sheet to Solve Example 7-3 with 10 equally-spaced nodes and

compare the FD solutions with 5 and 10 nodes with the exact analytical solution

given by Equation (7.34). 3. Consider the fin with an insulated tip shown in Figure 7.P3. The fin is of thermal

conductivity k , length L, constant cross-sectional area A, perimeter P, and specified

base temperature Tw. The heat transfer coefficient to ambient at T∞ is h.

Figure 7.P3 Schematic for Problem 7.3 (adopted from Recktenwald [2])

Neglecting the temperature variation over the cross-sectional area, for small Biot

numbers (Bi = hLc/k), the governing equation in a dimensionless form is:

02

2

2

mdX

d

Where,

Uranium

Plate

k = 28 W/m.K

W/m3

0oC

T∞

h

0 2 4

L

x 0 ∆x

1 3

Tw

T∞ , h

x

qcond,x

qconv

qcond,x+∆x

Page 184: Computer-Aided Thermofluid Analyses using Excel

Computer-Aided Thermofluid Analyses Using Excel

LxX / ,

TT

TT

w

, AkPhLm /2

Develop an Excel sheet for analysing the steady one dimensional heat conduction in

the fin subjected to the following boundary conditions:

,10

01

XdX

d

Compare your FD solution at the 5 nodes with the following analytical solution:

mCosh

XmCoshx

1

Page 185: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

8

Finite-difference solution of the

transient heat-conduction equation

Page 186: Computer-Aided Thermofluid Analyses using Excel

Computer-Aided Thermofluid Analyses Using Excel

This chapter extends the methodology presented in the previous chapter so as to solve the transient heat-conduction equation with the finite-difference (FD) method. The

chapter initially considers the 1D conduction-equation to demonstrate the application of

the method by using both the explicit forward-in-time central difference in space (FTCS) scheme and the implicit backward-in-time central difference in space (BTCS)

scheme. For the implicit scheme that requires a system of linear equations to be solved,

the chapter presents two methods for using Excel. The first method explicitly forms and solves the linear system using the tri-diagonal matrix algorithm (TDMA), while the

second method does not form the linear system but uses Excel‟s iterative-calculation

option to solve the nodal equations. For solving the 2D conduction equation that

requires a large system of linear equations to be solved with the first method, only the second method for applying the implicit FD scheme is used.

8.1. Transient 1D conduction: the explicit FTCS formulation The transient one-dimensional heat-transfer by conduction is governed by:

2

2

x

T

t

T

(8.1)

As shown in the previous chapter, the FD method replaces the spatial derivative (

22 / xT ) by the central difference defined by Equation (7.13). For the temporal term (

tT / ) either forward or backward differences can be used, i.e.:

t

TT

t

Ti

mi

m

FW

1

(8.2)

t

TT

t

Ti

mi

m

BW

1

(8.3)

Depending on whether Equation (8.2) or (8.3) is selected, two FD formulations for Equation (8.1) are possible: a forward-in-time central-difference in space (FTCS)

scheme and a backward-in-time central-difference in space (BTCS) scheme. This

section focuses on the first scheme.

By using Equation (8.2), the FD approximation of Equation (8.1) becomes:

2

111 2

x

TTT

t

TT im

im

im

im

im

(8.4)

Note that the temperatures at the two neighbouring nodes are evaluated at time level i.

Equation (8.4) can be rearranged as follows:

Page 187: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

im

im

im

im

im TTTTT 11

1 2 (8.5)

Where, τ is the dimensionless mesh Fourier number defined as:

2x

t

(8.6)

Equation (8.5) calculates the temperature at the current time step (i) from the known

values at the previous time step. Starting with a known temperature field, it can be used

directly to compute the new temperature field because all the values of 1imT can be

updated independently. The FTCS scheme is easy to implement, but it is only

conditionally stable by requiring the time step ∆t to be chosen such that [1]:

2

1 (8.7)

The following example shows how the scheme is applied.

Example 8-1. Solving the transient 1D conduction equation with the FTCS scheme

Transient heat-conduction occurs in a plate with length L = 0.1 m and diffusivity α =

0.1. The boundary conditions are T(0,t) = T(L,t) = 0 and the initial temperature

distribution is given by:

T(x) = sin(πx/L) (8.8)

The exact temperature variation is given by [1]:

2

2

expsin,L

t

L

xtxT

(8.9)

Use the FD method with a grid of 21 equally-spaced nodes and a suitable time step to

determine the temperature variation at t = 0.2 s.

Solution By dividing the length of the plate into 21 equally-spaced nodes, ∆x= 0.1/20 = 0.05 m.

According to Equation (8.7), the maximum allowable time step ∆t is given by:

1.0/05.05.0 2t = 0.0125 s

Therefore, we can use a time step of 0.01 s. The following procedure for implementing

the FD solution with Excel follows that described by Anthony [2]. Figure 8.1 shows the

Page 188: Computer-Aided Thermofluid Analyses using Excel

Computer-Aided Thermofluid Analyses Using Excel

sheet into which the specified values of α, ∆x, and ∆t are entered at the top part of the sheet.

Figure 8.1. The Excel sheet with the nodal coordinates and initial temperatures for

Example 8-1

The x-values of the 21 nodes are entered in cells B4 to V4. The following row of cells,

i.e., cells B5 to V5 store the initial temperature profile as obtained from Equation (8.8). The formula bar reveals the formula that calculated the initial temperature at x =0.5 cm.

Cells B6 and V6 store the specified boundary conditions at x=0 and x=L. Next, we aim

to determine the temporal temperature variation by dividing the required time span (0.2 s) into equal time levels Δt long. Enter the first 10 time-levels in column A in the Excel

sheet, as shown in Figure 8.2.

Figure 8.2. Calculating the time levels and inserting the two boundary conditions

Each time level is calculated by adding ∆t to the previous time level. In Figure 8.2, the

expression in the formula bar in cell A6 shows the specific Excel formula used to

compute the new time level, 𝑡2, by adding the fixed time increment (∆t) to the previous time level, t1, stored in the cell immediately above it, i.e., cell A5. The time levels at

other periods are obtained by simply copying the formula in cell A6 and pasting it in

cells A7 to A25 as shown in Figure 8.3. The boundary conditions at x = 0 and x = L are then inserted in columns B6:B25 and V6:V25. For clarification, these two columns are

given a blue colour. Equation (8.5) is then applied in cell C6 to calculate the

temperatures at time level 2 (t =Δt) and x = Δx as shown in the formula bar of Figure

8.3. This formula is then copied and pasted in all other cells in the same row (D6:U6) and the following rows (C7:U25).

Page 189: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

Figure 8.3. Excel sheet prepared for solving Example 8-1 with the FTCS scheme

Figure 8.3 shows the temperatures determined by the FD formula at different nodes and

time levels. Figure 8.4 shows the initial temperature profile and the temperature profiles

at time t=0.2 s as determined by the FTCS scheme and by the exact analytical solution given by Equation (8.9). A close agreement is achieved between the two solutions

because the time step used is sufficiently small. Figure 8.5 shows the solution at t = 1.0

s with a larger time step Δt = 0.05. In this case, τ = 2 and as the figure show the FTCS

scheme becomes unstable.

Figure 8.4. Comparison of the FTCS solution with the exact analytical solution

(t = 0.2 s, ∆t = 0.01s)

0

0.2

0.4

0.6

0.8

1

1.2

0 0.2 0.4 0.6 0.8 1

T

x

Initial temperature profile

FD solution at t =0.2 s

Exact solution at t =0.2 s

Page 190: Computer-Aided Thermofluid Analyses using Excel

Computer-Aided Thermofluid Analyses Using Excel

Figure 8.5. Comparison of the FTCS solution with the exact analytical solution

(t = 1.0 s, ∆t = 0.05 s)

8.2. Transient 1D conduction: the implicit BTCS formulation Substituting Equation (8.3) into the left-hand side of Equation (8.1) and substituting

Equation (7.13) into the right-hand side of the equation gives;

2

111 2

x

TTT

t

TT im

im

im

im

im

(8.10)

Here also, the temperatures at the two neighbouring nodes are evaluated at time level i.

Equation (8.10) can be rearranged as follows:

dcTbTaT im

im

im 11 (8.11)

Where, 2/ xa

2/2/1 xtb

2/ xc

1/1 imTtd

Unlike Equation (8.5), Equation (8.11) is not a simple algebraic formula for computing

imT from its value at the previous time level,

1imT because

imT and its neighbours,

imT 1

-2

-1.5

-1

-0.5

0

0.5

1

1.5

2

2.5

0 0.2 0.4 0.6 0.8 1

T

x

Initial temperature profile

FD solution at t =1.0 s

Exact solution at t =1.0 s

Page 191: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

and imT 1 , are at the same time level. Thus, Equation (8.11) is one equation in a system

of equations for the values of T at the internal nodes of the spatial mesh. Equations

similar to Equation (8.11) can be written for each node, thus, forming a system of

algebraic equations that can be written as [1]:

N

N

iN

iN

i

i

i

NN

NNN

d

d

d

d

d

T

T

T

T

T

ba

cba

cba

cba

cb

1

3

2

1

1

3

2

1

111

333

222

11

0000

000

000

000

000

0000

(8.12)

The above system of linear equations has to be solved at every time level in order to determine the temperatures at that time level. Note that the coefficient matrix does not

change with time, but the r.h.s. vector does. Also note that the algebraic system of

equations has only three non-zero diagonals and, therefore, can be solved by using the

tri-diagonal matrix algorithm (TDMA) which is more efficient than the matrix inversion method [3].

Although the BTCS scheme requires solving the system of linear equations in Equation (8.12) at each time step, the additional development effort and computer time are

compensated for by the improved stability of the scheme that allows larger time steps to

be used compared to the explicit FTCS scheme. As shown in the previous chapter,

Excel offers two options for solving the system of linear equations one of which explicitly assembles and then solves the system, while the other uses the iterative-

calculation option of Excel to solve the systems without assembling it. The two

methods are presented below.

8.2.1. Application of the BTCS scheme by assembling the linear system

Figure 8.6 shows the Excel sheet prepared for solving Example 8-1 by using the BTCS

scheme. To make the sheet look like that used for applying the FTCS scheme, the linear system of Equation (8.12) has to be solved externally for the temperature values shown

at each time level. This has been achieved by writing a custom VBA function called

“FDimplicit” that determines the coefficient matrix given by Equation (8.12) and solves the resulting system by calling a TDMA solver, called “TDMA”. Both the

“FDimplicit” function and the “TDMA” solver are listed in Appendix F. Figure 8.7

compares the FD solution obtained with ∆t = 0.01 s with the exact solution at t = 0.2 s. The figure shows a close agreement between the two solutions. Figure 8.8, that

compares the temperature values obtained at t = 1.0 s with ∆t = 0.05 s with the exact

solution, does not show any sign of solution instability with this scheme for which the

time step is limited by the required accuracy rather than the scheme‟s stability.

Page 192: Computer-Aided Thermofluid Analyses using Excel

Computer-Aided Thermofluid Analyses Using Excel

Figure 8.6. Excel sheet prepared for solving Example 8-1 with the BTCS scheme

Figure 8.7. Comparison of the BTCS solution with the exact analytical solution

(t = 0.2 s, ∆t = 0.01 s)

Figure 8.8. Comparison of the FTCS solution with the exact analytical solution

(t = 1.0 s, ∆t = 0.05 s)

0

0.2

0.4

0.6

0.8

1

1.2

0 0.2 0.4 0.6 0.8 1

T

x

Initial temperature profile

FD solution at t = 0.2 s

Exact solution at t= 0.2 s

0

0.2

0.4

0.6

0.8

1

1.2

0 0.2 0.4 0.6 0.8 1

T

x

Initial temperature profile

FD solution at t= 1.0 s

Exact solution at t = 1.0 s"

Page 193: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

8.2.2. Application of the BTCS scheme by using iterative calculations Mokheimer and Antar [4] applied the BTSC scheme with the alternative method that

does not require the algebraic system to be formed, i.e., by allowing the iterative-

solution option of Excel to solve the nodal equations. To use their method, Equation (8.10) is rearranged as follows:

21

111

im

im

imi

m

TTTT (8.13)

Where, τ is defined by Equation (8.6). Figure 8.9 shows the Excel sheet developed for

this method. The data part at the top of the sheet adds the calculation of the Fourier

number τ from Equation (8.6) in cell O1. The formula bar reveals the formula in cell C5 that uses Equation (8.13) to determine the temperature at x = Δx:

C5 = (C4 + τ * (B6 + D5))/(1 + 2 * τ)

This formula is copied and pasted in cell D5:U5 at the same row. Figure 8.9 shows the

nodal temperatures calculated by this method when the iterative calculation option of

Excel is active. The figure shows that the calculated temperatures are the same as their corresponding values shown in Figure 8.6.

Figure 8.9. Application of the BTCS scheme by allowing Excel‟s circular calculations

8.3. Transient 2D heat-conduction: A general formulation

The transient 2D heat-conduction with heat generation and a constant thermal

conductivity is governed by the following equation:

t

T

k

e

y

T

x

T g

12

2

2

2 (8.14)

The FD equations for solving the equation can be developed by following one of the two schemes described in the previous section for the transient 1D conduction. While

the two special derivatives are approximated by central-differences, either the forward-

difference or the backward-difference can be used for the temporal derivative. This section presents the formulation part that is common to both schemes.

Page 194: Computer-Aided Thermofluid Analyses using Excel

Computer-Aided Thermofluid Analyses Using Excel

Consider the two-dimensional metal plate shown in Figure 8.10 that is initially at a uniform temperature of 90

oC, while its top and right sides are exposed to heat-transfer

by convection and the left side in insulated. Heat is then generated in the plate at a rate

of ge , but the temperature at the bottom side of the plate is held constant at 90oC.

Figure 8.10. Geometry and boundary conditions

For the internal node, node 5, energy balance in the surrounding element gives:

t

EEQQQQ element

elementgenbelowcondrightcondabovecondleftcond

,,,,,

(8.15)

Substituting for the six terms in Equation (8.15) by relevant expressions:

y

TTxk

x

TTyk

y

TTxk

x

TTyk nodebelownoderightnodeabovenodeleft

t

TTceyx

inode

inode

pg

1

... (8.16)

Since ∆x =∆y, dividing by k and substituting for ∆x and ∆y with l:

inode

inode

gnodebelowrightaboveleft

TTe

k

lTTTTT

12

4 (8.17)

Sunstituting the numbers of the nodes surrounding node 5, the equation becomes:

ii

gB

TTe

k

lTTTTT 5

15

2

5624 4

(8.18)

From Figure 8.11 that shows the energy transfer in the zone surrounding node 2 energy

balance gives:

TB = 90oC

1 2 3

4 5 6

7 8 9

∆x

Insulated

∆y

Convection y

T∞

h

Page 195: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

Figure 8.11. The energy-balance zone for node 2

tEEQQQQ elementelementgenbelowcondrightcondaboveconvleftcond /,,,,, (8.19)

Evaluating the six terms in Equation (8.19) from relevant expressions, we get:

y

TTxk

x

TTykTTxh

x

TTyk nodebelownoderight

xode

nodeleft

t

TTceyx

inode

inode

pg

1

... (8.20)

Specifying the relevant temperatures around node 2, the equation becomes:

t

TTcelTTkTTkTThlTTk

it

pg

2

122

2523221 .. (8.21)

Following the same procedure, the FD equations for the other boundary nodes can be

obtained from energy balance around each node. Note that no time level has been assigned to the temperatures on the left side of Equations (8.18) and (8.21). The

appropriate time level depends on whether the scheme to be used is explicit or implicit

as explained in the following two sections

8.4. The explicit FTCS scheme for 2D conduction

With this scheme, the temperatures in the left side of the nodal equations represented by

Equation (8.20) are taken at the old time-level (i). The example that illustrates application of the scheme is based on one given by Cengel and Ghajar [5] who also

solved the problem by using the explicit scheme.

Example 8-2. Transient 2D heat-conduction with heat-generation

Two-dimensional transient heat transfer takes place in an L-shaped solid body as shown

in Figure 8.12. The thermal conductivity and diffusivity of the body are k = 15 W/m·°C

and α = 3.2x10-6

m2/s, respectively. The left surface of the body is insulated, while the

6

1 3

4 5

Qcond,left Qcond,right

Qcond,below

Qconv, above

G

Page 196: Computer-Aided Thermofluid Analyses using Excel

Computer-Aided Thermofluid Analyses Using Excel

right surface is subjected to heat flux at a uniform rate of Rq = 5000 W/m

2 and the

entire top surface is subjected to convection to ambient air at T∞= 25°C with a

convection coefficient of h = 80 W/m2·°C. Heat is generated in the body at a rate of ge

= 2x106 W/m

3. The body is initially at a uniform temperature of 90°C, which is then

maintained at the bottom surface at all times.

Figure 8.12. Geometry and boundary conditions of Example 8-2

Using the FD method with a nodal network consisting of 15 equally spaced nodes,

determine the temperature at the top corner (node 3) of the body after 1, 3, 5, and 10

minutes.

The analytical model

Noting the similarity between Figures 8.10 and 8.12, Equation (8.18) gives:

ii

gi

Biii TT

ek

lTTTTT 5

15

2

5624 4

(8.22)

Rearranging:

k

leTTTTTT

g

Biiiii

2

64251

5 41

(8.23)

Similalrly, for node 2 Equation (8.21) takes the following form:

k

leT

k

hlTTTT

k

hlT

giiiii

2

53121

2

22241

(8.24)

With appropriate modifications, Equation (8.24) can be applied to nodes 7 and 8:

15

1 2 3

4 5 6 7 8 9

10 11 12 13 14

∆x

Insulated

∆y 9

Convection y

x

TB = 90oC

T∞

= 25oC

h = 80 W/m2

Page 197: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

k

leT

k

hlTTTT

k

hlT

g

Biiii

2

8671

7

22241

(8.25)

k

leT

k

hlTTTT

k

hlT

g

Biiii

2

9781

8

22241

(8.26)

The FD equations for the remaining 5 nodes as obtained by energy balance around the

respective node are as follows [5]:

k

leT

k

hlTTT

k

hlT

giiii

22241

2

4211

1

(8.27)

k

leT

k

hlTTT

k

hlT

giiii

2

22441

2

6231

3

(8.28)

k

leTTTTT

g

Biiii

2

5141

4 241

(8.29)

k

leT

k

hlTTTTT

k

hlT

g

Biiiii

2

75361

6

344242

33441

(8.30)

k

leT

k

hl

k

lqTTT

k

hlT

gRB

iii

22241

2

891

9

(8.31)

Stability considerations limit the time step for the explicit FTCS scheme by requiring

that the primary coefficient, i.e., the coefficient of i

mT in the respective nodal equation,

to be greater than or equal to zero for all nodes. Since the smallest coefficient is that of

Equation (8.28) for node 3, this requirement leads to [5]:

khl

lt

/14

2

(8.32)

According to Equation (8.32), the maximum time step for l = 1.2 cm is given by:

15/012.08011012.34/012.0 62 t = 10.6 s

Cengel and Ghajar [5] used ∆t =10 s, which will also be used in the present analysis.

Page 198: Computer-Aided Thermofluid Analyses using Excel

Computer-Aided Thermofluid Analyses Using Excel

Excel implementation The approach adopted for applying the explicit scheme for the 2D transient heat

conduction equation closely follows that described by Mokheimer and Antar [4]. Figure

8.13 that shows the Excel sheet developed for applying the scheme. The data part on the left side of the sheet stores the given information about the thermal conductivity and

diffusivity of the solid, the rate of heat-generation, the specified boundary temperatures,

etc. The temperatures at nodes 10, 11, 12, 13, 14, and 15 that lie at the bottom surface are fixed to 90

oC. Based on these data, the formula in cell G2 determines the Fourier

number τ that appears in the FD equations of the different nodes.

Figure 8.13. Excel sheet developed for Example 8-2 by the explicit scheme

Figure 8.13 shows two L-shaped cell configurations that represent the 15 nodes in the

FD grid at two consecutive time levels. The top configuration stores the initial solution

(e.g., t = 0), while the bottom configuration stores the solution at the new time level

(e.g., t = ∆t) as obtained by applying Equations (8.23) to (8.31) to the values stored in the top configuration. The formula bar shows the formula that calculates the

temperature at node 6 using Equation (8.30). To obtain the temperatures at the next

time level, i.e., t = 2Δt, the values of the temperature in the bottom block are copied and pasted in the corresponding cells of the top block (use the special “paste-values”

feature). This procedure needs to be repeated until the required time level is reached.

The repetitive copy-and-paste action can be automated by recording a macro for these two steps as explained in Appendix F. Figure 8.13 shows a “Solve” button that is linked

to the recorded macro to activate it. Pressing the “Solve” button once will advance the

time by Δt. In order to keep record of the time, the following formula was entered in cell K11:

K11 = K4 + ∆t

Page 199: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

The initial value of cell K4 was set to zero as shown in Figure 8.13. Therefore, the corresponding value calculated in cell K11 is equal to ∆t, which is 10 s. The values in

cells K4 and K11 will be automatically updated after every paste-values step to become

10 and 20 s, respectively. The FD solutions determined by the Excel sheet at time = 1, 3, 5, and 10 minutes are shown in Figure 8.14. The calculated temperature values at

node 3 shown in the figure, which are 100.2, 105.9, 106.5, and 106.6°C, agree with the

corresponding values obtained by Cengel and Ghajar [5].

(a)

(b)

(c)

(d)

Figure 8.14. FD solutions by the explicit scheme after time 1, 3, 5, and 10 minutes

8.5. The implicit BTCS scheme for 2D conduction

In the implicit scheme, the temperatures in the left side of the nodal FD equations are evaluated at the new time level (i+1). As for 1D conduction, the BTCS scheme can

either by applied by assembling and then solving the linear system of equation or by

using iterative calculations to directly solve the equations. Since the first option leads to

Page 200: Computer-Aided Thermofluid Analyses using Excel

Computer-Aided Thermofluid Analyses Using Excel

a large system of linear equations to be solved, only the second option will be used in following analysis. Accordingly, Equation (8.18) for node 5 becomes:

ii

gi

Biii TT

ek

lTTTTT 5

15

21

51

61

21

4 4

(8.33)

Rearranging the equation:

41/

2

16

12

145

15

k

leTTTTTT

g

Biiiii

(8.34)

The FD equations for the other nodes can also be obtained by rearranging those of the

explicit scheme as follows:

k

hl

k

leT

k

hlTTTT

giiii 241/2

2

2

14

121

11

(8.35)

k

hl

k

leT

k

hlTTTTT

giiiii 241/2

2

2

15

13

112

12

(8.36)

k

hl

k

leT

k

hlTTTT

giiii 441/2

22

2

16

123

13

(8.37)

41/2

2

15

114

14

k

leTTTTT

g

Biiii

(8.38)

k

hl

k

leT

k

hlTTTTTT

g

Biiiii

3441/

344242

3

2

75361

6

(8.39)

k

hl

k

leT

k

hlTTTTT

g

Biiii 241/

22

2

18

167

17

(8.40)

k

hl

k

leT

k

hlTTTTT

g

Biiii 241/

22

2

9781

8

(8.41)

k

hl

k

leT

k

hl

k

lqTTTT

gRB

iii 241/2

2

2

189

19

(8.42)

Page 201: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

Excel implementation The Excel sheet for the implicit scheme can be devoped from that of the explicit

scheme by modifying the nodal FD equations written in bottom block of cells with

those given by Equations (8.34) to (8.42). Since the right-hand sides of these equations involve temperatures at the new time level i+1, the iterative-calculations option of

Excel must be active. Figure 8.15 shows the resulting sheet using the same spacial and

time steps l =0.012 m and ∆t = 10 s. The formula bar reveals that for node 6 based on Equation (8.39). The figure shows slighlly different temperature values from those

obtained with the explicit scheme as shown in Figure 8.13. As for the explicit scheme,

pressing the “Solve” button once will advance the time by Δt.

Figure 8.15. Excel sheet developed for Example 8-2 by the implicit scheme

Table 8.2 compares the temperature values at node 3 as determined by the explicit and the implict schemes after ½, 1, 3, 5, and 10 minutes. As the figures show, the

percentage deviation between the values obtained with the two schemes just after ½

minute is more than 4.3%, but decrease with time and diminishes after 10 minutes.

Table 8.2. Comparison of the solutions obtained with the explicit and the implicit

schemes for the temperature at node 3

Time (s) FTCS (oC) BTCS (

oC) Deviation (%)

30 97.2 93.1 4.304

60 100.2 99.02 1.178

180 105.9 105.3 0.567

300 106.5 106.4 0.094

600 106.6 106.6 0.000

Figure 8.16 compares the solution obtained with the implicit scheme for the

temperature at node 3 at different times with those obtained with the explicit scheme using three values of the time step; 2, 5, and 10 s. The figure shows that the temperature

approaches a steady-state value of about 106.6oC after 6 minutes. Figure 8.16 also

indicates that the solution obtained with explicit scheme depends on the time step and

Page 202: Computer-Aided Thermofluid Analyses using Excel

Computer-Aided Thermofluid Analyses Using Excel

approaches that obtained with implicit scheme as the time step is reduced. The effect of the spatial step l=∆x=∆y can also be investigated.

Figure 8.16. Values of the temperature at node 3 obtained with the explicit scheme

using three time-steps compared to those obtained with the implicit scheme

8.6. Closure The chapter showed how Excel can be used to solve the transient 1D and 2D heat-

conduction equations with the FD method. Both explicit and implicit FD formulations

of the method were considered. For the explicit formulations of the FD method, the chapter highlighted the need for selecting reasonably small time steps in order to ensure

the solution‟s stability. For the implicit scheme, the chapter illustrated the usefulness of

Excel‟s iterative-calculation option for solving the transient 1D and 2D conduction

equations. Although the schemes discussed in the chapter can be applied to solve the full 3D conduction equation, application of the FD method for solving 3D heat-

conduction problems with complex geometries and boundary conditions is better done

with dedicated computer programs [6].

References

[1] G. W. Recktenwald, Finite-Difference Approximations to the Heat Equation,

Mechanical Engineering, 10, 1-27, 2004 [2] P. Anthony, Solutions of One Dimensional Heat Equation Using Excel

Worksheet , Imperial Journal of Interdisciplinary Research (IJIR) Vol-2, Issue-8,

2016 ISSN: 2454-1362, available at: http://www.onlinejournal.in, Last access 21/9/2019

[3] Wikipedia, http://en.wikipedia.org/wiki/Tridiagonal_matrix_algorithm. Last

access 21/9/2019

[4] E. M. A. Mokheimer and M. A. Antar, On the use of spreadsheets in heat conduction analysis, International Journal of Mechanical Engineering Education

Vol 28 No 2, April 2000

103

104

105

106

107

0 100 200 300 400

Tem

pe

ratu

re (

oC

)

Time (s)

Implicit ∆t = 10s

Explicit ∆t = 10s

Explicit ∆t = 5s

Explicit ∆t = 2s

Page 203: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

[5] Y. A. Cengel and A. J. Ghajar, Heat and Mass Transfer: Fundamentals and Applications. 4

th edition, McGraw-Hill, 2011

[6] G. W. Recktenwald, Introduction to Numerical Methods and MATLAB:

Implementations and Applications, Pearson Higher Ed, 2000

Exercises 1. Figure 8.P1 shows a large uranium plate of thickness L = 4 cm, thermal

conductivity k = 28 W/m·°C, and thermal diffusivity α = 12.5 x 10-6

m2/s that is

initially at a uniform temperature of 200°C. Heat is generated uniformly in the

plate at a constant rate of ge = 5 x106 W/m

3. At time t = 0, one side of the plate is

brought into contact with iced water and is maintained at 0°C at all times, while the other side is subjected to convection to an environment at T∞ = 30°C with a

heat transfer coefficient of h = 45 W/m2· °C.

Figure 8.P1 Schematic for Problem 8.1 (adapted from Cengel and Ghajar [1])

Considering a total of five equally spaced nodes in the medium, two at the

boundaries and three at the middle, develop three Excel sheets to estimate the

exposed surface temperature of the plate 2.5 min after the start of cooling using:

(a) the explicit method,

(b) the implicit method that uses the iterative-calculation option, (c) the implicit method that assembles and solves the linear system.

This exercise is based on Example 5-5 in Cengel and Ghajar [1].

2. When time-accurate solutions of the conduction equation are important, the Crank-Nicolson (C-N) scheme has significant advantages over the FTCS and BTCS

schemes. The C-N scheme is implicit like BTCS and also unconditionally stable.

The scheme is not significantly more difficult to implement than the BTCS scheme. Develop an Excel sheet for solving Example 8-1 by using the C-N scheme. For more information about the C-N scheme refer to Recktenwald [1].

3. Develop the general FD equations for node 3 and node 6 in Figure 8.10.

Uranium plate

k = 28 W/m.K

W/m3

α = 12.5x10-6

m2/s

0oC

T∞

h

0

2 4

L

x 0 ∆x

1 3

Page 204: Computer-Aided Thermofluid Analyses using Excel

Computer-Aided Thermofluid Analyses Using Excel

4. Solve the two-dimensional transient heat transfer in an L-shaped solid body given in Example 8-2 by using a finer nodal network that consists of equally spaced

nodes with ∆x = ∆y = 0.6 cm, as shown in Figure 8.P4. Using the explicit FD

method, determine the temperature at the top corner (node 5) of the body after 1, 3, 5, and 10 min. Compare your solution with that obtained with the original grid.

Figure 8.P4. FD grid for problem 8.4

Hint: You do not have to develop new equations except for nodes 10 and 32. The

equations developed in Example 8-2 can be used for the other nodes, but you have

to use a smaller time step.

5. Repeat the above exercise by using the implicit BTCS scheme. Use either the iterative-calculation option of Excel or the matrix-inversion method to solve the

resulting system of algebraic equations. Compare your solution with ∆t = 10, 15,

and 20 s with that obtained with the coarser grid for the temperature at node 3.

6. A hot surface is to be cooled by attaching aluminium fins (k = 237 W/m·°C

and α =97.1x10-6

m2/s) that have triangular cross sections as shown in Figure

9P.6. Each fin has length L= 5 cm, base thickness t = 1 cm, and very large width

w. The temperature of the surrounding medium is 15°C, and the heat

transfer coefficient on the surfaces is 35 W/m2·°C. Initially, the fins are at a

uniform temperature of 30°C, and at time t = 0, the temperature of the hot

surface is suddenly raised to 120°C. Assuming one-dimensional heat

conduction along the fin, use the finite difference method with six equally

spaced nodes to determine the nodal temperatures after 2 min by using:

(a) The explicit finite-difference formulation

(b) The implicit finite-difference formulation

Also, determine how long it will take for steady conditions to be reached.

Hint. Refer to Appendix E for the solution of the steady heat conduction

equation on the triangular fin with similar boundary conditions.

1 5

6 10

11 15 21

22 32

33 43

Page 205: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

Figure 8.P6. The dimensions and initial and boundary conditions of the triangular fin

Tb,o =

120oC

T∞ = 15

o

C

h = 35 W/m2.oC

L= 5 cm

t = 1 cm w

Tf,0

=

30o

C

Page 206: Computer-Aided Thermofluid Analyses using Excel

Computer-Aided Thermofluid Analyses Using Excel

9

Thermodynamic analyses of gas

power cycles

Page 207: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

Energy-conversion cycles that involve phase changes of the working fluid, like the Rankine cycle, require the determination of fluid properties at different phases of the

fluid. For the analyses of these cycles, computer-aided methods that use property

functions are more convenient than traditional methods that use property tables and charts. For gas cycles that do not involve phase changes computer-aided methods are

also more accurate because they allow the application of the variable specific-heat

method of analysis instead of the approximate constant specific-heat method. This chapter shows how Thermax functions can be used to analyse two important gas power-

generation cycles which are the Brayton cycle and the Otto cycle. The results obtained

for the Brayton cycle by using the ideal-gas property functions provided by Thermax

are compared to those obtained by using the Ideal-Gas add-in developed at the University of Alabama [1]. For the Otto cycle, energy as well as exergy analyses are

presented. The values obtained for the key parameters of the cycles are also verified

against the relevant values given in standard thermodynamics textbooks.

9.1. The ideal Brayton cycle

The Brayton cycle is the ideal cycle for gas-turbines. Unlike real gas-turbine cycle, it is

a closed cycle with a constant mass of the working fluid going through the system‟s components as shown in Figure 9.1. The cycle consists of four processes; compression

in an ideal gas compressor, heat-addition from a high-temperature source, expansion in

an ideal gas turbine, and heat-rejection to a low-temperature sink. Figure 9.2 shows the cycle on a T-s diagram. Although the working fluid can be any suitable gas, in the

following analysis it is assumed to be air.

Figure 9.1. Schematic diagram of the closed-cycle gas-turbine

1

Compressor Turbine

2 3

qin

4

qout

wc

wt

Heat exchanger

Heat

exchanger

Page 208: Computer-Aided Thermofluid Analyses using Excel

Computer-Aided Thermofluid Analyses Using Excel

Figure 9.2. T-s diagram for the ideal Brayton cycle

Referring to Figure 9.2, the compressor work (wc) and turbine work (wt), per unit mass flow rate of the air, are determined from:

12 hhwc (9.1)

43 hhwt (9.2)

Where h1, h2, h3, and h4 are values of the enthalpy at states, 1, 2, 3, and 4, respectively.

The amount of heat addition (qin) per unit mass flow of the air is given by:

23 hhqin (9.3)

Therefore, the net work (wnet), back-work ratio (BWR), and thermal efficiency (η) of the cycle are determined from:

ctnet www (9.4)

tc wwBWR / (9.5)

innet qw / (9.6)

Given the compressor‟s inlet temperature, T1, and the turbine‟s inlet temperature, T3, the

discharge temperature from the compressor (T2) and the discharge temperature from the

turbine (T4) are determined by using the variable specific-heat method of analysis from the corresponding relative pressures Pr2 and Pr4 given by:

T

s

2

4

1

3

Page 209: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

1

212

P

PPP rr (9.7)

3

434

P

PPP rr (9.8)

Where Pr1 and Pr2 are the relative pressures at states 1 and 2, respectively. For the ideal

cycle without pressure losses, P3 = P2 and P4 = P1. The following example, which is based on Example 9.5 in Cengel and Boles [2], illustrates the procedure of using

Thermax property functions for analysing the cycle with Excel.

Example 9-1. Analysis of the simple ideal Brayton cycle

A gas-turbine power plant that operates on an ideal Brayton cycle with air as the

working fluid has a pressure ratio of 8. The gas temperature at the compressor inlet is

300 K and at the turbine inlet is 1300 K. Determine (a) the net work per unit mass flow rate of the working fluid, (b) the back work ratio, and (c) the thermal efficiency.

Solution Figure 9.3 shows the Excel sheet developed for this example using Thermax property

functions. The figure shows the general layout adopted in this book for sheet

arrangement according to which the sheet is divided from left to right into three main

parts: (i) Input data, (ii) Intermediate calculations, and (iii) Final results. In the present case, the input data include the given values of the two temperature values at states 1

and 3 (T_1 and T_3) and the pressure ratio (rp). The middle part of the sheet, which is

reserved for the calculation of intermediate results, shows the calculated values of the two unknown temperatures T_2 and T_4 and the enthalpy values at the four states in the

cycle. The final results are the compressor work (w_c), the turbine work (w_t), the heat

input (Q_in), the back work ratio (BWR), and thermal efficiency (η) as shown on the

right side of the sheet.

Figure 9.3. The Excel sheet developed for Example 9-1

Page 210: Computer-Aided Thermofluid Analyses using Excel

Computer-Aided Thermofluid Analyses Using Excel

Table 9.1 shows the formula entered in each cell of the calculations part using Thermax functions. Only three Thermax functions from the Gas-group have been used in the

Excel model with air as the gas which are: GasPr_TK, GasTK_Pr, and Gash_TK. For

the purpose of comparison, a similar Excel sheet was developed by using the IdealGas add-in developed at the University of Alabama [1]. Figure 9.4 shows the Excel sheet

and Figure 9.5 reveals the function used in it.

Table 9.1. Usage of Thermax functions in the analysis

Cell Parameter Excel formulae and Thermax functions

E2 Pr_2 =GasPr_TK("Air";T_1) * rp E4 T_2 =GasTK_Pr("Air";Pr_2)

E6 Pr_4 =GasPr_TK("Air";T_3)/rp

E8 T_4 =GasTK_Pr("Air";Pr_4) H2 h_1 =Gash_TK("Air";T_1)

H4 h_2 =Gash_TK("Air";T_2)

H6 h_3 =Gash_TK("Air";T_3) H8 h_4 =Gash_TK("Air";T_4)

Figure 9.4. Excel sheet for Example 9-1 using the IdealGass add-in

Figure 9.5. IdealGas functions used in the Excel sheet of Example 9-1

Page 211: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

Table 9.2 shows the values determined by the two property add-ins for the key cycle parameters and their corresponding values given by Cengel and Boles [2]. The figure of

the table show only minor differences between the values obtained by the two property

add-ins and those given by Cengel and Boles [2].

Table 9.2. Verification of the two add-ins‟ results with those of Cengel and Boles [2]

Parameter Cengel and Boles [2] Thermax IdealGas

cw 244.16 243.69 243.69

tw 606.60 606.01 606.01

qin 851.62 852.52 852.52

BWR 0.403 0.402 0.402

0.426 0.425 0.425

9.2. The regenerative Brayton Cycle Gas turbines can sustain higher combustion temperatures than those typically met in

internal-combustion engines, but the high combustion temperatures lead to high exhaust

temperatures as well. By adding a regenerator to the simple gas-turbine system as shown in Figure 9.6, the energy in the hot exhaust gases that can reach more than 500

oC

is utilised to preheat the compressed air before it goes to the combustion chamber; a

process called regeneration. Regeneration reduces the fuel combustion and improves

the plant‟s thermal efficiency, but the cost of the heat-exchanger increases that of the modified system. The economic benefit due to regeneration depends not only on the

cost of the heat-exchanger, but also on the system‟s pressure ratio. While the cost of the

heat-exchanger depends on its size and effectiveness, there is a certain value for the pressure ratio that maximises the system‟s thermal efficiency.

Figure 9.6. Schematic diagram of the regenerative gas-turbine

Figure 9.7 shows the T-s diagram for the regenerative Brayton cycle assuming zero pressure losses in the combustion chamber and heat-exchanger. Due to friction losses in

both compressor and turbine, the actual exit temperatures from these devices (i.e., T2

1

Compressor

C.C.

Turbine G

2 3

Regenerator

5

4

6

Page 212: Computer-Aided Thermofluid Analyses using Excel

Computer-Aided Thermofluid Analyses Using Excel

and T4) are different from the ideal values obtainable by the isentropic compression and expansion processes (T2s and T4s).

Figure 9.7. T-s diagram for the regenerative Brayton cycle

As for the simple Brayton cycle considered earlier, the thermal efficiency (η) is given

by:

innet qw / (9.9)

Where, wnet is the net output work from the plant and qin is its heat input. The net output work for the gas-turbine power plant is the difference between the turbine work output

(wt) and the compressor work input (wc). Using the numbering scheme of Figures 9.6

and 9.7 to indicate the state of the working fluid entering and leaving the compressor and turbine, the net output work in terms of fluid enthalpies is given by:

1243 hhhhwnet (9.10)

The heat input to the power plant is given by the difference in enthalpies of the

combustion gases and the preheated air entering the combustion chamber, i.e.:

53 hhqin (9.11)

Given the temperature and pressure of air at the compressor inlet, the ideal relative

pressure after the compressor (Pr,2s) is determined from [2]:

prrsr rPP

PPP .1

1

212 (9.12)

s

T

2s

4s

1

3

4

2

5

Page 213: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

Where, rp stands for the pressure ratio. Pr2s is then used to find T2s, which is the temperature after an ideal isentropic compression process. Once T2s is found, h2s can be

determined by using the property function. The actual enthalpy (h2) is then found from:

cs hhhh /1212 (9.13)

Where, ηc is the compressor‟s isentropic efficiency. Similarly, the relative pressure after

the expansion process (Pr,4s) is determined from:

prrsr rPP

PPP /3

3

434 (9.14)

Pr4s is then used to find the temperature after an ideal expansion process T4s, from which h4s can be determined. The actual enthalpy (h4) is then found from:

tshhhh 4334 (9.15)

Where, ηt is the turbine‟s isentropic efficiency. The temperature of the compressed air

entering the combustion chamber (T5) and, therefore, the saving in fuel consumption,

depends on the effectiveness of the regenerator (ε) which is defined as:

2425 / TTTT (9.16)

Given an estimate for ε, Equation (9.16) can be rearranged to get:

)( 2425 TTTT (9.17)

Example 9-2. Analysis of the regenerative Brayton cycle A gas-turbine power plant operates on a regenerative Brayton cycle with air entering

the compressor at 100 kPa, 300 K. Combustion gases leave the combustion chamber at

1400 K. The regenerator effectiveness is 80% and the isentropic efficiency of both the compressor and the turbine is 80%. Determine the pressure ratio that yields the

maximum net work output and the maximum thermal efficiency of the plant.

Solution Figure 9.8 shows the Excel sheet prepared for this example using Thermax functions.

The input data shown in the left-side of the sheet includes the air intake temperature

(T_1) and pressure (P_1), the pressure ratio (Pratio), and the combustion temperature (T_3). The data part also includes the isentropic efficiency of the compressor (Eff_c),

the isentropic efficiency of the turbine (Eff_t), and the regenerator effectiveness

(Eff_regen). The middle part of the sheet shows the calculated values of T2 and T4. The

figure shows the enthalpy values as obtained by using Thermax functions. The formula

Page 214: Computer-Aided Thermofluid Analyses using Excel

Computer-Aided Thermofluid Analyses Using Excel

used in each cell is inserted next to it. The right-side of the sheet shows the main results, which include values of the input compression work, the output expansion

work, the net work output, the heat input, and the thermal efficiency.

Figure 9.8. The Excel sheet developed for the regenerative Brayton cycle

The sheet shows the results at a pressure ratio of 10 at which the corresponding values

of the net output work and thermal efficiency are 216.19 kJ/kg and 0.346, respectively.

The value of the pressure-ratio (Pratio) in cell C4 was changed from 2 to 16 and Figure 9.9 shows the calculated values for the net specific work and thermal efficiency plotted

against the pressure ratio. The figure shows that the net output work and thermal

efficiency reach their maximum values at different pressure ratios. While the maximum

net work output occurs at a pressure ratio of about 8, the maximum thermal efficiency occurs much earlier at a pressure ratio of about 5 or less.

Figure 9.9. Variation of the net specific work and thermal efficiency of the regenerative

Brayton cycle with the turbine‟s pressure ratio

0

0.05

0.1

0.15

0.2

0.25

0.3

0.35

0.4

0.45

0

50

100

150

200

250

0 5 10 15 20

The

rmal

eff

icie

ncy

Ne

t sp

eci

fic

wo

rk (

kJ/k

g)

Pressure ratio

w_net

η

Page 215: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

9.3. Energy analysis of the Otto cycle The Otto cycle and the Diesel cycle are two ideal cycles used for modelling the cycles

in internal combustion (I.C.) engines. While the Otto cycle is used for modelling spark-

ignition I.C. engines, the Diesel cycle is used for modelling compression-ignition I.C.

engines. Figure 9.10 shows the four processes that constitute the Otto cycle, which are:

Process 1-2: Adiabatic and reversible compression of air

Process 2-3: Constant-volume heat addition Process 3-4: Adiabatic and reversible expansion of air

Process 4-1: Constant-volume heat rejection

Figure 9.10. The Otto cycle (Adapted from Cengel and Boles [2])

The P-v diagram of the Otto cycle is shown in Figure 9.11. Processes 1-2 and 3-4 are

isentropic processes because they are both adiabatic and reversible. The following

analysis of the Otto cycle, which is based on the first law of thermodynamics, is called an “energy analysis” of the cycle.

Figure 9.11. P-v diagram of the Otto cycle (Adapted from Cengel and Boles [2])

Air Air Air

Air

1-2: Isentropic

compression

2-3: Heat addition

at constant v

3-4: Isentropic

expansion 4-1: Heat rejection

at constant v

qin qout

1

2 2,3

4,1

3

4

v

P

1

3

4 2

BDC TDC

qin

qout

Page 216: Computer-Aided Thermofluid Analyses using Excel

Computer-Aided Thermofluid Analyses Using Excel

The analytical model For the ideal Otto-cycle shown in Figures 9.10 and 9.11 with air as an ideal-gas [3]:

111 / PRTv (9.18)

rvv /12 (9.19)

23 vv (9.20)

14 vv (9.21)

Where, R is the gas constant (for air R= 0.287 kJ/kg.K) and r is the compression ratio of

the cycle (for modern spark-ignition engines 8 ≤ r ≤ 11). For or the isentropic compression and expansion processes:

rv

v

v

v

r

r /11

2

1

2 (9.22)

rv

v

v

v

r

r 3

4

3

4 (9.23)

Where, vr is the relative specific volume. The last two relationships can be used to

determine the two temperatures after the compression and expansion processes. The amount of heat added in process 2-3 per kg of the working fluid (qin) is calculated from:

23 uuqin (9.24)

The amount of heat removed per kg of the working fluid (qin) is calculated from:

14 uuqout (9.25)

Applying the first-law of thermodynamics, the net work from the cycle is given by:

outinnet qqw (9.26)

Therefore, the thermal efficiency of the Ott cycle (ηOtto) is given by:

in

netOtto

q

w (9.27)

Page 217: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

The cycle‟s mean-effective pressure (MEP) is defined as:

21minmax vv

w

vv

wMEP netnet

(9.28)

Although the above model uses the usual air-standard assumptions, Equations (9.22)

and (9.23) take into consideration the variation of the specific heat with temperature.

Therefore, the model yields more realistic results than those obtained by using the

approximate constant specific heat method which is more convenient for hand calculations.

Example 9-3. Energy analysis of the Otto cycle An ideal Otto cycle has a compression ratio of 8. At the beginning of the compression

process, air is at 100 kPa and 17°C. During the constant-volume heat-addition process,

800 kJ/kg of heat is transferred to air. Accounting for the variation of specific heats of

air with temperature, conduct an energy analysis of the cycle to determine:

(i) the net work output and thermal efficiency,

(ii) the mean effective pressure for the cycle.

This example is based on Examples 9-2 in Cengel and Boles [2].

Solution Figures 9.12 and 9.13 show the Excel sheets developed for the analysis of the Otto

cycle using property functions for ideal gases provided by Thermax and IdealGAs,

respectively. The sheets show the formulae used in the calculation parts and the formula window in each sheet reveals the formula used for the calculation of the mean effective

pressure according to Equation (9.28). Since the IdealGas add-in does not provide a

function for determining the gas temperature from its internal energy, the temperature

T_3 in Figure 9.13 has been found by using the Goal-Seek command. Table 9.3 compares the values obtained by the two add-ins to those given by Cengel and Boles

[2]. The figures in the table show good agreement between the three solutions.

Figure 9.12. Excel sheet developed for Example 9-3

Page 218: Computer-Aided Thermofluid Analyses using Excel

Computer-Aided Thermofluid Analyses Using Excel

Figure 9.13. Excel sheet developed for Example 9-3 using the IdealGas add-in

Table 9.3. Key parameters in the energy analysis

Parameter Cengel and Boles [2] Thermax IdealGas

T2 652.4 648.7 648.7

T3 1575.1 1572.6 1572.6

T4 795.6 793.1 793.1

P2 1799.7 1789.6 1789.6

P3 4345.0 4338.2 4338.2

qout 381.83 381.91 381.91

wnet 418.17 418.09 418.09

ηOtto 0.523 0.523 0.523

MEP 574.0 574.1 574.1

Using the approximate method of analysis with fixed values of the specific heat, it can

be shown that the thermal efficiency of the Otto cycle is given by [3]:

1/11

k

cotto r (9.29)

Where, k is the ratio of specific heats cp/cv for air. Substituting rc = 8 and k = 1.4 in

Equation (9.29), the calculated thermal efficiency is 0.565. Although values of the thermal efficiency obtained by both the exact and the approximate methods are

exaggerated compared to that of actual engines that of the variable specific heat

method, which is 0.523, is more realistic.

9.4. Exergy analysis of the Otto cycle Energy analyses, such as that presented in the previous section, evaluate the general

performance of energy-conversion systems using overall performance indicators such

as the thermal efficiency for power-producing systems and the coefficient of performance (COP) for refrigeration systems. By comparison, the analyses based on the

second-law of thermodynamics, which are called exergy analyses, enable the locations,

types, and true magnitudes of waste and loss to be determined. Therefore, exergy

analyses can be used in design analyses of thermofluid systems to further the goal of achieving more efficient use of resources [4].

Page 219: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

The analytical model Exergy (ϕ) is a thermodynamic property that measures the ability of the working fluid

to do useful work. Per unit mass in a closed system like that of the engine shown in

Figure 9.10, exergy is given by [2]:

gzV

vvPssTuu o 2

2

0000 (9.30)

Where u is the internal energy and u0, s0, and P0, respectively, refer to the values of the internal energy, entropy and pressure at the dead state which is the surroundings.

Neglecting changes in the kinetic and potential energies, and taking into consideration

that v3 = v2 in this case, the exergy input in process 2-3 is determined from:

2302323 ssTuuinput (9.31)

Exergy of the working fluid can be destroyed in a process because of irreversibilities such as friction losses and heat-transfer over a finite-temperature difference. In general,

the exergy destruction (xdest) in a process is determined from:

outinsysgendest sssTsTx 00

outb

out

inb

in

sysT

q

T

qssT

,,

120 (9.32)

Where, sgen refers to the entropy generated in the process. In the Otto cycle, processes 1-

2 and 3-4 are both adiabatic and reversible. Therefore, for these two processes:

0destx (9.33)

However, processes 2-3 and 4-1 both involve heat transfer with the surroundings and that makes them externally irreversible processes. While process 2-3 involves heat

addition only, process 4-1 involves heat rejection only. For these two processes, exergy

destructions are obtained from:

H

in

destT

qssTx 230 Process 2-3 (9.34)

L

outdest

T

qssTx 410 Process 4-1 (9.35)

Page 220: Computer-Aided Thermofluid Analyses using Excel

Computer-Aided Thermofluid Analyses Using Excel

The exergy destruction of the whole Otto cycle is the sum of the exergy destructions in

the heat-addition and heat-rejection processes. Since12 ss and

34 ss , the exergy

destruction in the Otto cycle becomes:

H

in

L

outdest

T

q

T

qTx 0 (9.36)

Example 9-4. Exergy analyses of the Otto cycle

Accounting for the variation of specific heats of air with temperature, conduct an

exergy analysis for the Otto cycle considered in Example 9-3 to determine:

(i) the exergy destruction associated with the Otto cycle (all four processes as

well as the cycle), assuming that heat is transferred to the working fluid from

a source at 1700 K and heat is rejected to the surroundings at 290 K, and (ii) the exergy of the exhaust gases when they are purged.

This example is based on Example 9-10 in Cengel and Boles [2] and therefore, the present results can be compared with their calculations for verification of the relevant

Thermax functions.

Solution The two sheets developed for Example 9-3 were extended for this exergy analysis and

Figure 9.14 shows the extension that is needed in the lower part of the one using

Thermax functions. Table 9.4 shows the functions used in this extension. The sheet using the IdealGas add-in was extended in a similar way. The additional data needed for

exergy analysis include the temperature and pressure of the surroundings, temperature

of the heat source, and the sink temperature. By obtaining the required entropy values at

the different states from the energy part, the two sheets determine the exergy destructions in the four processes of the cycle, the total exergy destruction, and the

exergy lost in the heat-rejection process. Table 9.5 compares the calculated values to

those given by Cengel and Boles [2]. The figures in the table show a good agreement between the results of the two add-ins and those given by Cengel and Boles [2].

Figure 9.14. Excel sheet developed for Example 9-4 using Thermax

Page 221: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

Table 9.4. Thermax functions used in exergy analysis of the Otto cycle

Cell Formula F30 =gass0_1TK("air",T_2)-gass0_1TK("air",T_3)-

R_air*LN(P_2/P_3)

F31 =T_0*(-Dels23-Q_in/T_source)

F33 =Dels23

F34 =T_0*(Dels14+q_out/T_sink)

I27 =Ed_23+Ed_41

I29 =v_1

I30 =gasu_1TK("air",T_0)

I31 =-Dels14

I33 =(u_4-u_0)-T_0*Dels40-P_0*(v_4-v_0)

Table 9.5. Results of the Otto cycle exergy analysis

Cengel and Boles [2] Thermax IdealGas

32, destx 82.2 82.8 82.79

14, destx 163.2 162.7 162.65

Ottodestx , 245.4 245.4 245.44

4 163.2 162.6 162.65

The figures in Table 9.5 show that two thirds of the total exergy supplied to the engine is lost during the heat-rejection process. Therefore, any design efforts that aim to

minimise the loss of exergy in the heat-rejection process can effectively improve the

performance of the Otto cycle. For example, the lost exergy can be used in a cogeneration system that utilises the heat for producing steam for industrial applications

or for air-conditioning purposes. The figures in Table 9.5 also show that the exergy

destruction in the heat-addition process are about one third of the total exergy

destruction. While increasing the heat-addition temperature improves the thermal efficiency of the cycle, it increases the rate of exergy destruction in this process.

Therefore, the selection of this temperature requires a careful consideration of the two

factors among other practical considerations.

9.5. Closure

This chapter illustrated the use of the two property add-ins, Thermax and IdealGas [1],

for the analyses of two basic power-generation cycles which are the Brayton cycle and the Otto cycle. With respect to such gas cycles, property functions enable the excat

variable specific-heat method to be used; which gives more realistic estimations than

the approximate constant-specific heat method. The analyses show that the functions provided by Thermax and IdealGas give identical results. While the IdealGas functions

have the advantage of allowing the two systems of units to be used, Thermax functions

are more general because the same function can be used for different gases. Thermax

Page 222: Computer-Aided Thermofluid Analyses using Excel

Computer-Aided Thermofluid Analyses Using Excel

also provides additional functions not provided by IdealGas such as the GasTK_1u and GasTK_1h functions that determine the temperature from a given value of internal

energy or enthalpy, respectively.

Although not demonstrated in this chapter, the automation of property calculations by

using property functions also enables Excel to be used for iterative solutions and

optimisation analyses of various types of energy-conversion systems using its two “What-if analysis” tools; Goal-Seek and Solver. The scope of thermodynamic analyses

with the Excel-based platform can be widened by using a number of other educational

and research-oriented Excel add-ins that have been developed by academic institutions

and individuals [5-7].

References

[1] The University of Alabama, Mechanical Engineering, Excel for Mechanical Engineering project, Internet: http://www.me.ua.edu/excelinme/index.htm (Last

accessed July 19, 2018)

[2] Y. A. Cengel and M. A. Boles. Thermodynamics an Engineering Approach,

McGraw-Hill, 8th

Edition, 2015 [3] W.W. Pulkrabek, Engineering Fundamentals of the Internal Combustion Engine,

Second Edition, Pearson Prentice Hall, 2004.

[4] A. Bejan, G. Tsatsaronis, M. Moran, Thermal Design & Optimization, John Wiley $ Sons, 1996.

[5] D. G. Goodwin, "TPX: thermodynamic properties for Excel",

http://termodinamicaparaiq.blogspot.com/p/tpx_12.html (Last accessed July 11,

2019) [6] The University of Virginia, Free Excel/VBA Spreadsheets for Thermodynamics:

Rankine, Brayton, Otto and Diesel Cycles, Internet:

http://www.faculty.virginia.edu/ribando/ modules/xls/Thermodynamics/ (Last accessed July 1, 2019)

[7] I. Bell, CoolProp. Available at https://sourceforge.net/projects/coolprop/files/

CoolProp/ (Last accessed July 11, 2019)

[8] M.J. Moran and H.N. Shapiro, Fundamentals of Engineering Thermodynamics, 5

th edition, John Wiley, & Sons. Inc. 2006

Excersises 1. Figure 9.9 shows that the net output work and thermal efficiency of the regenerative

Brayton cycle reach their maximum values at different pressure ratios; which is

about 8 for the maximum net work output and about 5 or less for the maximum thermal efficiency. Use Solver to determine the exact values of the pressure ratios.

2. A regenerative gas turbine with intercooling and reheat operates at steady state. Air

enters the compressor at 100 kPa, 300 K with a mass flow rate of 5.8 kg/s. The

pressure ratio across the two-stage compressor is 10. The pressure ratio across the two-stage turbine is also 10. The intercooler and reheater each operate at 300 kPa.

At the inlets to the turbine stages, the temperature is 1400 K. The temperature at the

Page 223: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

inlet to the second compressor stage is 300 K. The isentropic efficiency of each compressor and turbine stage is 80%. The regenerator effectiveness is 80%. Figure

9.P2 shows the T-s diagram of the regenerative gas turbine cycle.

Figure 9.P2. T-s diagram for the regenerative gas turbine with intercooling

Develop an Excel sheet to determine: (a) the thermal efficiency, (b) the back work ratio, (c) the net power developed, in kW. Compare your solution with that of

Example 9-11 in Moran and Shapiro [8].

3. The air-standard Diesel cycle shown in Figure 9.P3 operates with a compression ratio of 18. At the beginning of the compression process the temperature is 300 K

and the pressure is 0.1 MPa. The cutoff ratio for the cycle is 2. Using Thermax or

any other property add-in, develop and Excel sheet to determine (a) the temperature

and pressure at the end of each process of the cycle, (b) the thermal efficiency, (c) the mean effective pressure, in MPa. Compare your solution with that of Example

9-2 in Moran and Shapiro [8].

Figure 9.P3. P-v diagram of the Diesel cycle

T

s

10

6

4s

1

2s 2

3

4

5

7s 7

8

9s 9

v

P

1

3

4

2

BDC TDC

qin

qout

Cut-off

Page 224: Computer-Aided Thermofluid Analyses using Excel

Computer-Aided Thermofluid Analyses Using Excel

10

Analyses of simple and multi-stage

compression VCR cycles

Page 225: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

The vapour-compression refrigeration (VCR) refrigeration systems used in various residential, commercial, and industrial applications are the main contributor to the

ozone-layer depletion problem and a major contributor to the global-warming problem.

Therefore, improving the performance of these systems is a critical matter. The performance of the simple single-stage VCR system deteriorates when there is a large

difference between the evaporator and condenser temperatures. In this case, multi-stage

compression VCR systems that split the refrigeration cycle into low-pressure and high-pressure stages become more attractive. However, these systems are more expensive

and, in order to get their best performance, their stages have to be optimised. The

chapter presents optimisation analyses of two-stage and three-stage compression cycles

using refrigerant R134a. The results obtained by the property functions provided by Thermax and by the add-in developed for R134a at the University of Alabama (UA) [1]

are verified against the relevant values given by Moran and Shapiro [2] and Cengel and

Boles [3].

10.1. The ideal vapour-compression refrigeration cycle

Figure 10.1 shows a schematic diagram of the basic VCR system and Figure 10.2

shows the T-s diagram for the ideal VCR cycle that consists of the following four processes:

1. Process 1-2: reversible adiabatic compression process 2. Process 2-3: constant-pressure heat-rejection process in the condenser

3. Process 3-4: expansion in an expansion value or a capillary tube

4. Process 4-1: constant-pressure heat-addition process in the evaporator

Figure 10.1. Schematic diagram of the single-stage vapour-compression

refrigeration system

1

Compressor

2 3

qout

4

qin

win

Expansion

valve

Condenser

Evaporator

Page 226: Computer-Aided Thermofluid Analyses using Excel

Computer-Aided Thermofluid Analyses Using Excel

Figure 10.2. T-s diagram for the ideal vapour-compression refrigeration cycle

The ideal cycle does not account for the irreversibility and pressure losses in the system components and the compressor is assumed to be adiabatic and reversible. Therefore,

the compression process is isentropic as shown in Figure 10.2. Assuming steady

operation of all the system components and neglecting changes in kinetic and potential energy across each component, the energy interactions with the surroundings in the

different components per unit mass flow rate of the refrigerant in the system are

described by the following relationships.

Compressor input work:

12 hhwc (10.1)

Heat rejection in the condenser:

32 hhqout (10.2)

Heat input in the evaporator:

41 hhqin (10.3)

Adiabatic process in the expansion valve or capillary tube:

34 hh (10.4)

s

T

3

4 1

2

Te

Tc

Page 227: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

Three parameters measure the performance of the VCR systems; which are its coefficient of performance (COP), cooling capacity (CC) in ton of refrigeration, and the

compressor power (cW ):

c

in

w

qCOP (10.5)

211

60 inqmCC

(10.6)

12 hhmWc (10.7)

Where m is the mass flow rate of the refrigerant in the system in kg/s. The following

example, which is based on Example 10-1 in Moran and Shapiro [2], illustrates the use of Thermax and the UA add-in “R134a” for analysing the cycle.

Example 10-1. Analysis of the ideal vapour-compression refrigeration cycle

An ideal VCR cycle thermally connected to a cold region at 0oC and a warm region at

26oC uses refrigerant R134a as the working fluid. The refrigerant enters the compressor

as saturated vapour at 0oC and leaves the condenser as saturated liquid at 26

oC. The

mass flow rate of the refrigerant is 0.08 kg/s. Determine (a) the compressor power, in kW, (b) the refrigeration capacity, in tons, and (c) the coefficient of performance.

Solution

Figure 10.3 shows the Excel sheet developed for this example using Thermax. The given data for the evaporator and condenser temperatures and refrigerant mass flow rate

are shown on the left side of the sheet as T_e, T_c, and m_ref, respectively. The middle

part of the sheet shows the formulae used for determining the different enthalpy values using functions from Thermax. The enthalpy at state 1, h_1, is determined by using the

function Refh_Tx that returns the enthalpy of saturated vapour (hv) at a given

temperature. The entropy at this point (s_1) is found by using another function, Rehs_Tx, that determines the entropy of saturated vapour at a given temperature (T)

and quality (x).

The right-hand side of the sheet calculates the compressor power, w_c, according to Equation (10.7), the cooling capacity, CC, according to Equation (10.6), and the

coefficient of performance (COP) according to Equation (10.5). A similar sheet was

developed by using property functions from the R134a add-in provided by the University of Alabama [1]. Table 10.1 that compares the calculated values for the key

cycle parameters by the two add-ins shows a good agreement between the add-in results

with their corresponding values given by Moran and Shapiro [2].

Page 228: Computer-Aided Thermofluid Analyses using Excel

Computer-Aided Thermofluid Analyses Using Excel

Figure 10.3. Excel sheet developed for the ideal VCR cycle of Example 10-1

Table 10.1. Comparison of the ideal VCR cycle key parameters given by the two add-

ins with their values given by Moran and Shapiro [2]

Parameter Moran &

Shapiro [2]

Thermax UA Add-in

R134a

Compressor work [kW] 1.40 1.409 1.409

Refrigeration capacity (ton) 3.67 3.700 3.700

COP 9.24 9.237 9.235

10.2. The actual vapour-compression refrigeration cycle

In actual VCR cycles, all four processes are irreversible because of friction losses in the

compressor and heat-transfer with finite temperature differences in the evaporator and condenser. Some degree of subcooling also occurs at the condenser discharge. These

modifications to the ideal cycle affect both the cooling capacity and COP of the VCR

system. Figure 10.4 shows the T-s diagram for the actual VCR cycle.

Figure 10.4. T-s diagram for the actual VCR cycle

s

T

3

4 1

2s

2

Tc

Te

Page 229: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

For simplification, it is assumed that saturated vapour refrigerant enters the compressor where it is compressed to a pressure that matches the required condenser temperature .

The actual exit temperature at state 2 is higher than the corresponding temperature in

the ideal cycle at state 2s, while the actual exit temperature from the condenser at state 3 is lower than the corresponding temperature in the ideal cycle, which is Tc. Referring

to Figure 10.4, the relationships that determine the specific compressor work and heat-

rejection in the condenser become:

12 hhwc (10.8)

32 hhqout (10.9)

The enthalpy at state 2 can be determined from:

cs hhhh /1212 (10.10)

Where ηc is the isentropic efficiency of the compressor. The enthalpy at state 3 is

approximately taken as the enthalpy of the saturated refrigerant at the given

temperature. The following example, which illustrates the use of the Thermax and

R134a add-ins for analysing the actual VCR cycle, is based on Example 10-3 in Moran and Shapiro [2].

Example 10-2. Analysis of the actual vapour-compression refrigeration cycle A VCR system thermally connected to a cold region at 0

oC and a warm region at 26

oC

uses refrigerant R134a as the working fluid. The refrigerant temperature in the

evaporator is -10oC, while the condenser pressure is 9 bars, which corresponds to a

saturation temperature of 36oC for R134a. The refrigerant exits the condenser as

subcooled liquid at 30oC. Analyse the cycle to determine its COP and cooling capacity

taking the isentropic efficiency of the compressor as 80%.

Solution

Figure 10.5 shows the Excel sheet developed for analysing the cycle with Thermax.

Note the additional entries in the data and calculations parts. In the data part, the

condenser pressure is entered instead of the condenser temperature. The data part also added the subcooled fluid temperature, T_3, and the compressor efficiency (η_c). The

calculations part adds a new formula for determining the compressor discharge

enthalpy, h_2. Also, note that the enthalpy at state 3 is now evaluated at 30oC and not at

the saturation temperature corresponding to the condenser pressure, which is 36oC.

A similar Excel sheet was developed using the UA add-in for R134a. Table 10.2 compares values of the three cycle parameters wc, CC, and COP as determined by the

two add-ins with their corresponding values given by Moran and Shapiro [2]. The

figures in the table show that the results obtained by the two add-ins are slightly

Page 230: Computer-Aided Thermofluid Analyses using Excel

Computer-Aided Thermofluid Analyses Using Excel

different from those given by Moran and Shapiro [2]. It should be noted that the work input in the actual cycle is more than that of the ideal cycle of Example 10-1, while the

cooling capacity is lower. Therefore, the COP dropped from 9.235 in the ideal cycle to

3.83 in the actual cycle, which is more realistic.

Figure 10.5. Excel sheet developed for the actual VCR cycle of Example 10-2

Table 10.2. Comparison of the actual VCR cycle key parameters with their values given

by Moran and Shapiro [2]

Parameter Moran &

Shapiro [2]

Thermax UA add-in

R134a

Compressor work [kW] 3.10 3.154 3.153 Refrigeration capacity (ton) 3.41 3.434 3.433

COP 3.86 3.828 3.830

10.3. Optimisation analysis of the ideal two-stage compression cycle A number of industrial refrigeration applications have very low evaporator

temperatures. In such cases, the two-stage cascade refrigeration system shown in Figure

10.6 becomes more feasible. In this system, a flash-chamber is added at an intermediate pressure. Part of the refrigerant evaporates during the flashing process and mixed with

the refrigerant leaving the low-pressure compressor. The mixture is then compressed to

the condenser pressure by the high-pressure compressor. The liquid in the flash

chamber is throttled to the evaporator pressure to cool the refrigerated space as it vaporizes in the evaporator. Figure 10.7 shows the T-s diagram for the ideal cycle.

10.3.1. The analytical model The refrigerant is assumed to leave the evaporator as a saturated vapour and both

compression processes are assumed to be isentropic. The refrigerant leaves the

condenser as a saturated liquid and is throttled to a flash chamber pressure.

Page 231: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

Figure 10.6. Schematic diagram for a two-stage compression VCR system

Figure 10.7. T-s diagram for a two-stage compression VCR system

Taking the mass flow rate of the refrigerant in the condenser as m , the fractions of this

flow rate that are separated after the flash chamber as saturated vapour vm and saturated

liquid lm are given by:

mxmv

6 (10.11)

6

Condenser

Evaporator

HPC

LPC 1

2

3

8

9

4 5

7

Page 232: Computer-Aided Thermofluid Analyses using Excel

Computer-Aided Thermofluid Analyses Using Excel

mxml

61 (10.12)

Where x6 is the quality at state 6. Therefore, the rates of heat removal in the evaporator

eQ and heat rejection in the condenser cQ are given by:

81 hhmQ le (10.13)

54 hhmQc (10.14)

The compression work cW which has two parts one in the low-temperature cycle and

another in the high-temperature cycle, is given by.

9412 hhmhhmW lc (10.15)

The COP of the system is then given by:

94126

816

1

1

hhhhx

hhx

W

QCOP

c

e

(10.16)

10.3.2. The optimisation analysis

Cengel and Boles [3] considered a two-stage VCR system with refrigerant R134a as the

working fluid. In what follows, their data and analysis results will be used to verify the

results obtained by using Excel and property functions provided by Thermax and the add-in developed at the University of Alabama (UA) for refrigerant R134a [1].

Example 10-3. Optimisation of the ideal two-stage compression cycle An ideal two-stage compression VCR system operates between evaporator and

condenser pressures of 0.14 and 0.8 MPa, respectively, and its flash chamber has a

pressure of 0.32 MPa.

Solution

Figure 10.8 shows the Excel sheet developed for analysing the two-stage compression

cycle using property functions. The three values of the evaporator, condenser, and flash-chamber pressures are stored in the data part that occupies the left side of the

sheet. Calculations of the enthalpy values and the quality at state 6 are done in the two

central columns using Thermax functions. Based on the calculated values of state enthalpies, the sheet determines the amount of heat absorbed in the evaporator (q_E),

the heat rejected in the condenser (q_C), the total compression work (w_comp), and the

cycle‟s COP (COP). Figure 10.9 shows the formulae entered in the three columns that

calculate the intermediate and final results and Thermax functions they use. In addition

Page 233: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

to the three Thermax functions shown in Table 10.1, this analysis requires the function “Refs_Ph(“R134a”,P_flash,h_9)” to determine the entropy s9 from the known pressure

and enthalpy values at state 9.

Figure 10.8. The Excel sheet developed for the two-stage compression VCR system

Figure 10.9. Excel formulae and Thermax functions used in the Excel sheet

A similar Excel sheet was also developed using the relevant property functions

provided by the add-in developed at the University of Alabama for refrigerant R134a [1]. Table 10.4 compares the values of various cycle parameters obtained by the two

Excel sheets with their corresponding values given by Cengel and Boles [3]. The

figures in the table show that the values of eQ , cW , and COP given by both add-ins are

very close to those given by Cengel and Boles [3]. The COP of the two-stage compression cycle can be improved by suitably adjusting the pressure at the flash-

chamber. The results obtained by changing the value of this pressure are shown in

Figure 10.10. The figure shows that the cycle‟s COP can reach 5.49 at a flash-chamber pressure of around 400 kPa.

Page 234: Computer-Aided Thermofluid Analyses using Excel

Computer-Aided Thermofluid Analyses Using Excel

Table 10.4. Analysis results for the two-stage compression cycle

Cengel and

Boles [3]

Thermax UA add-in

R134a

Error (%)

1h 239.16 387.3095 387.3244 -0.0038

1s 1.740259 1.740194 0.0037

2h 255.93 404.0627 404.0133 0.0122

3h 251.88 400.0385 400.0513 -0.0032

4h 274.48 422.611 422.6194 -0.0020

5h 95.47 243.6307 243.6611 -0.0125

6h 95.47 243.6307 243.6611 -0.0125

6x 0.2049 0.204904 0.204879 0.0122

7h 55.16 203.3228 203.364 -0.0203

8h 55.16 203.3228 203.364 -0.0203

9h 255.10 403.2381 403.2016 0.0091

9s 1.737308 1.737218 0.0052

eQ 146.3 146.287 146.2708 0.0111

cW 32.71 32.69327 32.68758 0.0174

COP 4.47 4.47453 4.474811 -0.0063

Figure 10.10. Variation of the COP with the flash-chamber pressure in the two-stage

compression VCR system

The maximum COP and corresponding flash-chamber pressure can be determined more

precisely by using Solver and Figure 10.11 shows the completed Solver Parameters

dialog box for this task.

4.1

4.2

4.3

4.4

4.5

4.6

0 200 400 600 800

CO

P

Flach-chamber pressure (kPa)

Page 235: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

Figure 10.11. Solver Parameters dialog box for optimisation of the two-stage

compression cycle

Two constraints have been imposed so as to keep the value of the flash-chamber pressure, P_flash, between the specified values of the evaporator and condenser

pressures. Figure 10.12 shows that the solution reached by Solver by using the GRG

Nonlinear method. According to this solution the maximum COP is 4.49 and occurs at a flash-chamber pressure of 375.45 kPa. Further improvement of the system‟s COP is

still possible by using more than one flash chamber at different pressure levels as show

in the following section.

Figure 10.12. Solver solution for optimisation of the two-stage compression cycle

10.4. Optimisation analysis of the three-stage compression cycle

By using two flash chambers instead of one chamber, three-stage compression VCR

systems can be more cost-effective than two-stage compression systems if the

temperature lift is sufficiently high. Figure 10.13 shows a schematic diagram for such a system and Figure 10.14 shows its ideal T-s diagram.

Page 236: Computer-Aided Thermofluid Analyses using Excel

Computer-Aided Thermofluid Analyses Using Excel

Figure 10.13. Scematic of the three-stage compression VCR system

Figure 10.14. T-s diagram for the ideal three-stage compression VCR cycle

Depending on the refrigerant used in the system, there are certain values of the two

flash-chamber pressures that maximise the system‟s COP. However, unlike the two-stage compression system, the determination of these pressures requires the use of an

optimisation software since it is not as easy to find them by varying the flash-chamber

pressures as in the case of a single flash chamber. In what follows, the optimum flash-

chamber pressures will be determined by using Solver.

Condenser

HPC

4

11

5

Evaporator

LPC 1 8

6 IPC

2

3 9

7

12

13 14 10

Page 237: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

10.4.1. The analytical model

Taking the mass flow rate of the refrigerant in the condenser to be m , the mass flow

rates of the vapour and liquid fractions after the high-pressure flash chamber are given by:

mxm 1314

(10.17)

mxm 135 1

(10.18)

Accordingly, the mass flow rates of the vapour and liquid fractions after the low-

pressure flash chamber are given by:

mxxm 1363 1

(10.19)

mxxm 1367 11

(10.20)

The total compression work and the rate of heat rejection in the condenser are now

given by:

10119473127 hhmhhmmhhmWct (10.21)

1211 hhmQc (10.22)

Therefore, the system‟s COP is given by:

ctc WQCOP / (10.23)

10.4.2. The optimisation analysis The advantage of the three-stage compression cycle over the simple and the two-stage

compression cycles is illustrated by the following example in which the evaporator and

condenser pressures in the three systems are identical.

Example 10-4. Optimisation of the ideal three-stage compression cycle

The system to be analysed has the same evaporator and condenser pressures as in the

two-stage cycle considered earlier, i.e., 0.14 and 0.8 MPa, respectively. It is required to determine values of the two flash-chamber pressures that maximise the system‟s COP.

Solution Figure 10.15 shows the Excel sheet prepared for this example by extending that of the

two-stage compression cycle shown in Figure 10.6. The data part now includes two

Page 238: Computer-Aided Thermofluid Analyses using Excel

Computer-Aided Thermofluid Analyses Using Excel

flash-chamber pressures, P_fc1 and P_fc2 instead of one. The two flash-chamber pressures are initially assigned values of 320 kPa and 520 kPa. A third column has also

been added to the calculations part to determine the enthalpy and entropy values in the

high-pressure stage.

Figure 10.15. Excel sheet for analysing the three-stage compressipon VCR cycle

Figure 10.15 shows that at the specified values of the pressures at the two flash chambers, the COP is 4.65. Although this COP is higher than the optimum pressure

obtained earlier for the two-stage compression cycle, which is 4.49, it is still not the

maximum possible value for the COP of the three-stage cycle. The maximum COP can be determined by optimising the two flash-chamber pressures by using Solver. Solver

Parameters dialog box is show in Figure 10.16.

Figure 10.16. Solver Parameters box for the optimisation of the three-stage cycle

Page 239: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

As Figure 10.16 shows, three constraints have been imposed so as to keep the value of the two flash-chamber pressures, P_fc1 and P_fc2, between the specified values of the

evaporator pressure P_evap, and the condenser pressure, P_cond, i.e.:

P_evap < P_fc1

P_fc1 < P_fc 2

P_fc2 < P_cond

Figure 10.17 shows the solution determined by Solver according to which the maximum COP is reached when the flash-chamber pressures are 283.465 kPa and

498.434 kPa. Comparison of the cycle‟s overall parameters shown in Figure 10.17 with

those shown in Figure 10.12 indicates that the cooling rate per unit flow rate of the refrigerant (q_E) has increased from 146.388 kJ for the two-stage system to 147.158 kJ

for the three-stage system, while the corresponding compressors work decreased from

32.595 kJ to 31.579 kJ. As a result, the COP of the three-stage system reached 4.66;

which is higher than that of the two-stage compression cycle (COP=4.49) by about 3.23% and higher than that of the simple VCR cycle (COP=3.97) by about 14.44%. The

advantage of the three-stage system over the simple and the two-stage compression

systems becomes more profound as the temperature lift increases.

Figure 10.17. Solution determined by Solver for the three-stage compression VCR

cycle

10.5. Closure This chapter illustrated the use of Thermax functions for the analyses of basic

refrigeration cyclesincluding the ideal VCR cycle and the actual VCR cycle. The results

obtained by using Thermax functions for refrigerant R134a were verified with those given in standard textbooks or determined by another property add-in developed at the

Page 240: Computer-Aided Thermofluid Analyses using Excel

Computer-Aided Thermofluid Analyses Using Excel

Mechanical Engineering Department at the University of Alabama [1]. The chapter also showed how the Excel-based modelling platform can be used for analysing and

optimising two-stage cascade and multi-stage compression VCR systems.

Most of the fluid states in the analysed VCR analyses lie in the compressed liquid or

saturated mixture regions and, therefore, the accuracy of Thermax functions for these

states is not questionable because they calculate the refrigerants properties using the data provided by ASHRAE. Regarding the accuracy of estimating the fluid properties in

the superheated region by the relevant Thermax functions, the analyses presented in this

chapter showed that the accuracy of these functions has a minor effect on the accuracy

of estimating the overall cycle parameters determined by Thermax. Therefore, Thermax function can be used to analyse the effects of other improvements to the simple VCR

cycle such as adding a suction-line heat excahnger to the system [4].

A number of Excel add-ins have been developed by academic and research institutions

that can be used to widen the scope of analyses of VCR systems by using the Excel-

based platform. A good example of these add-ins is the REFPROP add-in developed by

the National Institute of Standards and Technology (NIST). REFPROP provides properties of a large number of conventional and alternative refrigerants including

refrigerants mixtures [5]. A free-source alternative to REFPROP is the CoolProp

software developed by Bell [6].

References

[1] The University of Alabama, Website of Excel in Mechanical Engineering,

https://www.me.ua.edu/ExcelinME/ [2] M.J. Moran and H.N. Shapiro, Fundamentals of Engineering Thermodynamics, 5

th

edition, John Wiley & Sons, Inc, 2006. [3] A. Cengel, and M.A. Boles, Thermodynamics an Engineering Approach,

McGraw-Hill, 8th

Edition, 2015 [4] M.M. El-Awad, Effect of Suction-Line Heat Exchangers on the Performance of

Alternative Refrigerants to R-22, IOSR Journal of Mechanical and Civil

Engineering (IOSR-JMCE), Volume 13, Issue 3 Ver. IV (May- Jun. 2016), PP

109-117 [5] E.W. Lemmon, M.L. Huber, M.O. McLinden, NIST Reference Fluid

Thermodynamic and Transport Properties— REFPROP Version 8.0, User‟s

Guide, National Institute of Standards and Technology, Physical and Chemical Properties Division, Boulder, Colorado 80305, 2007.

[6] I. Bell, CoolProp. Available at https://sourceforge.net/projects/coolprop/files/

CoolProp/ (Last accessed July 11, 2019)

Exercises

1. It is required to compare the performance of refrigerant R134a as an alternative

fluid to refrigerant R22 for air-conditioning (air-cooling) applications. By suitably modifying the Excel sheet developed for Example 10-1, compare the compressor

Page 241: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

power (kW), refrigeration capacity (ton), and coefficient of performance of the vapour-compression refrigeration cycle with both refrigerants for an evaporator

temperature of 10oC and various condenser temperatures typical to your

environment. 2. It is required to compare the performance of refrigerant R134a as an alternative

fluid to refrigerant R22 for air-conditioning (air-heating) applications. By suitably

modifying the Excel sheet developed for Example 10-1, compare the compressor power (kW), heating capacity (kW), and coefficient of performance of the vapour-

compression refrigeration cycle with both refrigerants for a condenser temperature

of 40oC and various evaporator temperatures typical to your environment.

3. Modify the Excel sheet developed for Example 10-2 to model the performance of the actual VCR cycle with R22 as refrigerant. Take the evaporator temperature as -

10oC, the condenser pressure as 1390 kPa (at which the saturation temperature is

36oC), the compressor exit temperature as 30

oC, and the compressor isentropic

efficiency as 80%.

4. Repeat Exercise 10.3 with R410A or R717 as the refrigerant.

5. By making suitable extensions to the Excel sheet developed for Example 10-2,

determine the rates of exergy destruction within the compressor and expansion valve, in kW, for T0 = 299K (26

oC). (Answer: 0.58 kW and 0.39 kW).

Page 242: Computer-Aided Thermofluid Analyses using Excel

Computer-Aided Thermofluid Analyses Using Excel

Appendices

Page 243: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

Appendix A: Properties of air and water at atmospheric pressure

Table A.1. Properties of air at at various temperatures†

T oC

ρ

kg/m3

cp

kJ/kg.K

μ

kg/m.s

ν

m2/s

k

W/m·oC

α

m2/s

Pr

-150 2.866 0.983 8.636x10-6

3.013x10-6

0.01171 4.158x10-6

0.7246

-100 2.038 0.966 1.189x10-5

5.837x10-6

0.01582 8.036x10-6

0.7263

-50 1.582 0.999 1.474x10-5

9.319x10-6

0.01979 1.252x10-5

0.7440

-40 1.514 1.002 1.527x10-5

1.008x10-5

0.02057 1.356x10-5

0.7436

-30 1.451 1.004 1.579x10-5

1.087x10-5

0.02134 1.465x10-5

0.7425

-20 1.394 1.005 1.630x10-5

1.169x10-5

0.02211 1.578x10-5

0.7408

-10 1.341 1.006 1.680x10-5

1.252x10-5

0.02288 1.696x10-5

0.7387

0 1.292 1.006 1.729x10-5

1.338x10-5

0.02364 1.818x10-5

0.7362

5 1.269 1.006 1.754x10-5

1.382x10-5

0.02401 1.880x10-5

0.7350

10 1.246 1.006 1.778x10-5

1.426x10-5

0.02439 1.944x10-5

0.7336

15 1.225 1.007 1.802x10-5

1.470x10-5

0.02476 2.009x10-5

0.7323

20 1.204 1.007 1.825x10-5

1.516x10-5

0.02514 2.074x10-5

0.7309

25 1.184 1.007 1.849x10-5

1.562x10-5

0.02551 2.141x10-5

0.7296

30 1.164 1.007 1.872x10-5

1.608x10-5

0.02588 2.208x10-5

0.7282

35 1.145 1.007 1.895x10-5

1.655x10-5

0.02625 2.277x10-5

0.7268

40 1.127 1.007 1.918x10-5

1.702x10-5

0.02662 2.346x10-5

0.7255

45 1.109 1.007 1.941x10-5

1.750x10-5

0.02699 2.416x10-5

0.7241

50 1.092 1.007 1.963x10-5

1.798x10-5

0.02735 2.487x10-5

0.7228

60 1.059 1.007 2.008x10-5

1.896x10-5

0.02808 2.632x10-5

0.7202

70 1.028 1.007 2.052x10-5

1.995x10-5

0.02881 2.780x10-5

0.7177

80 0.9994 1.008 2.096x10-5

2.097x10-5

0.02953 2.931x10-5

0.7154

90 0.9718 1.008 2.139x10-5

2.201x10-5

0.03024 3.086x10-5

0.7132

100 0.9458 1.009 2.181x10-5

2.306x10-5

0.03095 3.243x10-5

0.7111

120 0.8977 1.011 2.264x10-5

2.522x10-5

0.03235 3.565x10-5

0.7073

140 0.8542 1.013 2.345x10-5

2.745x10-5

0.03374 3.898x10-5

0.7041

160 0.8148 1.016 2.420x10-5

2.975x10-5

0.03511 4.241x10-5

0.7014

180 0.7788 1.019 2.504x10-5

3.212x10-5

0.03646 4.593x10-5

0.6992

200 0.7459 1.023 2.577x10-5

3.455x10-5

0.03779 4.954x10-5

0.6974

250 0.6746 1.033 2.760x10-5

4.091x10-5

0.04104 5.890x10-5

0.6946

300 0.6158 1.044 2.934x10-5

4.765x10-5

0.04418 6.871x10-5

0.6935

350 0.5664 1.056 3.101x10-5

5.475x10-5

0.04721 7.892x10-5

0.6937

400 0.5243 1.069 3.261x10-5

6.219x10-5

0.05015 8.951x10-5

0.6948

450 0.4880 1.081 3.415x10-5

6.997x10-5

0.05298 1.004x10-4

0.6965

500 0.4565 1.093 3.563x10-5

7.806x10-5

0.05572 1.117x10-4

0.6986

600 0.4042 1.115 3.846x10-5

9.515x10-5

0.06093 1.352x10-4

0.7037

700 0.3627 1.135 4.111x10-5

1.133x10-4

0.06581 1.598x10-4

0.7092

800 0.3289 1.153 4.362x10-5

1.326x10-4

0.07037 1.855x10-4

0.7149

900 0.3008 1.169 4.600x10-5

1.529x10-4

0.07465 2.122x10-4

0.7206

1000 0.2772 1.184 4.826x10-5

1.741x10-4

0.07868 2.398x10-4

0.7260

1500 0.1990 1.234 5.817x10-5

2.922x10-4

0.09599 3.908x10-4

0.7478

2000 0.1553 1.264 6.630x10-5

4.270x10-4

0.11113 5.664x10-4

0.7539 †

Adopted from Y. A. Cengel and A. J. Ghajar, Heat and Mass Transfer: Fundamentals and Applications. 5

th edition, McGraw-Hill, 2015.

Page 244: Computer-Aided Thermofluid Analyses using Excel

Computer-Aided Thermofluid Analyses Using Excel

Table A.2: Properties of water (saturated liquid) at various temperatures

oC

cp

kJ/kg.oC

ρ kg/m

3

μ ×104

kg/m.s k W/m·

oC

Pr

0 4.225 999.8 17.90 0.566 13.25

5 4.207 999.7 15.26 0.576 11.15

10 4.195 999.2 13.10 0.585 9.40

15 4.187 998.7 11.39 0.594 8.03

20 4.180 997.6 10.08 0.602 7.00

25 4.179 996.3 8.96 0.611 6.13

30 4.176 995.3 8.03 0.619 5.41

35 4.174 994.0 7.24 0.627 4.83

40 4.174 992.0 6.56 0.633 4.33

45 4.174 990.1 6.00 0.639 3.92

50 4.175 988.2 5.52 0.645 3.57

55 4.179 985.5 5.09 0.650 3.27

60 4.179 983.3 4.71 0.654 3.01

65 4.183 980.6 4.34 0.659 2.76

70 4.185 977.9 4.07 0.664 2.57

75 4.189 974.8 3.81 0.667 2.39

80 4.193 971.6 3.57 0.671 2.23

90 4.201 965.3 3.19 0.676 1.98

100 4.211 958.3 2.83 0.682 1.76

110 4.223 950.9 2.56 0.685 1.59

120 4.237 942.9 2.34 0.685 1.45

140 4.276 926.1 1.96 0.685 1.23

160 4.326 907.0 1.74 0.681 1.11

180 4.382 886.7 1.54 0.676 1.02

200 4.452 864.3 1.39 0.667 1.00

230 4.576 828.4 1.21 0.648 0.86

260 4.731 785.2 1.07 0.616 0.83

Page 245: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

Appendix B: The numerical tools provided by Thermax

The Thermax add-in provides, in addition to its functions for fluid properties, a

Newton-Raphson solver for non-linear equations and two interpolation functions for tabulated data. This appendix shows why these numerical tools are needed in

thermofluid analyses and how they are used with the help of relevant examples.

B.1. The Newton-Raphson solver “NRM”

Excel‟s cell formulae become too restrictive and inconvenient to use when dealing with

iterative solutions and optimisation analyses that involve implicit equations. This

occurs, for example, when dealing with type-2 or type-3 pipe-flow problems, which themselves require iterative solutions, by using the following Colebrook-White (C-W)

equation that determines the Darcy friction factor (f) in a turbulent pipe flow:

f

D

f Re

51.2

7.3

/log0.2

110

(1.25)

In this case, Excel has to deal with two nested iterations; an inner iteration to determine

f and an outer iteration to determine the pipe‟s diameter or the flow rate.

Another nonlinear equation in thermofluid analyses is the following Benedict-Webb-

Rubin (BWR) equation of state [1]:

P = 2~/

2236322

0

00 ~1~~~~1

~vu

u

u evTv

c

v

a

v

aTbR

vT

CATRB

v

TR

(B.1)

Where Ru is the universal gas constant, P is the absolute pressure, T is the absolute

temperature, and v~ is the molar specific volume. The BWR equation is one of the most

accurate equations of state, but it is implicit in v~ and requires an iterative solution to

determine the molar specific volume. Therefore, its use in thermodynamic optimisation

analyses faces a similar problem to that of the C-W equation in type-2 or type-3 flow

problems.

The Newton-Raphson solver provided by Thermax is a custom function developed with

VBA for solving nonlinear equations such as the C-W equation and the BWR equation. To illustrate the use of this “NRM” solver, let us use it to determine the error of the

ideal-gas law compared to the BWR equation of state by calculating the specific

volume of carbon dioxide (CO2) at 0.2 MPa and temperatures in the range 273 – 373K.

Figure B.1 shows the Excel sheet developed for this purpose and Table B.1 reveals the formulae used in the sheet.

Page 246: Computer-Aided Thermofluid Analyses using Excel

Computer-Aided Thermofluid Analyses Using Excel

Figure B.1. Excel sheet for determining the specific volume by the ideal-gas law

compared to the BWR equation of state

Table B.1. The formulae used in the Excel sheet using the NRM solver

T v_ideal v_BWR error_v_ideal

273 =Ru*D3/P =NRM("BWR",E3,P,D3) =ABS(F3-E3)/F3*100

283 =Ru*D4/P =NRM("BWR",E4,P,D4) =ABS(F4-E4)/F4*100

293 =Ru*D5/P =NRM("BWR",E5,P,D5) =ABS(F5-E5)/F5*100

303 =Ru*D6/P =NRM("BWR",E6,P,D6) =ABS(F6-E6)/F6*100

313 =Ru*D7/P =NRM("BWR",E7,P,D7) =ABS(F7-E7)/F7*100

323 =Ru*D8/P =NRM("BWR",E8,P,D8) =ABS(F8-E8)/F8*100

333 =Ru*D9/P =NRM("BWR",E9,P,D9) =ABS(F9-E9)/F9*100

343 =Ru*D10/P =NRM("BWR",E10,P,D10) =ABS(F10-E10)/F10*100

353 =Ru*D11/P =NRM("BWR",E11,P,D11) =ABS(F11-E11)/F11*100

363 =Ru*D12/P =NRM("BWR",E12,P,D12) =ABS(F12-E12)/F12*100

373 =Ru*D13/P =NRM("BWR",E13,P,D13) =ABS(F13-E13)/F13*100

The formula bar in Figure B.1 reveals the following Excel formula in cell F3 that uses

the NRM solver to calculate v~ at 273K:

=NRM("BWR",E3,P,D3)

Note that the function NRM requires four input arguments: "BWR", E3, P, and D3. The

first argument, “BWR”, is the name of another user-defined VBA function for the

particular nonlinear equation to be solved; which in this case is the BWR equation. The second argument, E3, is an initial guess for the dependent variable in the nonlinear

Page 247: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

equation; i.e., v~ in Equation (B.1). The third and fourth arguments, P and D3, are values of two independent variables in the nonlinear equation; which are P and T in

Equation (B.1). For the C-W equation, they are the values of ε/D and Re. The function

“BWR” that applies the BWR equation is listed below:

Function BWR(x, P, T)

Dim Ru, a, A0, b, B0, c, C0, alfa, gama

'Carbon dioxide, CO2 Ru = 8314

a = 13.86

A0 = 277.3 b = 0.00721

B0 = 0.04991

c = 1511000.0

C0 = 14040000.0 alfa = 0.0000847

gama = 0.00539

BWR = P - Ru * T / x + (B0 * Ru * T - A0 - C0 / T ̂2) / (x ̂2) + (b * Ru * T - a) / x ̂3 + a * alfa / x ̂6 + c / (x ̂3 * T ̂2) * (1 + gama / x ̂2) * Exp(-

gama / x ̂2)

End Function

The different constants given in the BWR function are those of carbon dioxide (CO2).

Note that the value determined by the ideal-gas law in cell E3 is used as an initial guess

for the BWR equation. Figure B.2 shows the deviation of the ideal-gas law from the BWR equation in estimating the specific volume.

Figure B.2. Errors in the specific volume estimations by the ideal-gas law compared to

the BWR equation of state for carbon-dioxide

0.30

0.35

0.40

0.45

0.50

250 300 350 400

Erro

r of

the

idea

l gas

law

(%)

Temperature (K)

Page 248: Computer-Aided Thermofluid Analyses using Excel

Computer-Aided Thermofluid Analyses Using Excel

B.2. The interpolation functions “Interpol1” and “Interpol2” The two functions provided by Thermax for the interpolation of tabulated data, called

Interpol1 and Interpol2, use linear and quadratic equations, respectively. These

functions enable tabulated fluid properties to be used in parametric studies and optimisation analyses. For example, Figure B.3 shows an Excel sheet in which three

properties of engine oil are given at various temperatures: the density (ρ), specific heat

(cp), and kinematic viscosity (ν).

Figure B.3. Using the interpolation functions for tabulated data

The interpolation functions can be used to calculate the three oil properties at any

temperature within the range of tabulated data. Both Interpol1 and Interpol2 require

four input arguments referred to as: X, XX, YY, and Ndata. Their meanings are as

follows:

- X passes the value of the independent property (i.e. temperature) at which the

value of the dependent property (i.e. viscosity) is to be determined. - XX and YY are vectors that store the tabulated data (in this case, the

temperature, B5:B13, and viscosity values, E5:E13.

- Ndata passes the number of entries in the tabulated data. For the oil properties

shown in Figure B.3, Ndata = 9.

The formula bar in Figure B.3 reveals the formula in which the linear interpolation

function Interpol1 is used to determine the viscosity at 90oC. The following example

shows how the interpolation functions can be used in a typical analysis.

Page 249: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

Example B-1. Effect of oil temperature on the drag force over a flat plate Engine oil at 20°C flows over the upper surface of a 5-m-long flat plate as shown in

Figure B.4. If the oil velocity is 2 m/s, plot the variation of the total drag force (FD) per

unit width of the entire plate FD with oil temperatures in the range 40 - 150oC.

Figure B.4. Flow of oil over a flat plate (adapted from Cengel and Ghajar [2])

The analytical model

The drag force (FD) over a flat plate is due to friction, which is given by [2]:

2/2VACF fD (B.2)

Where Cf is the friction coefficient (not to be confused with the friction factor f), A is

the surface area of the plate, and ρ and V are the density and velocity of oil,

respectively.

The value of the friction coefficient depends on whether is flow is laminar or turbulent

as indicated by the Reynolds number (ReL). For the flow over a flat plate, the critical Reynolds number above which the flow becomes turbulent is about 5x10

5. For laminar

flows, the friction coefficient is given by:

5.0Re328.1 LfC 5105Re L (B.3)

For turbulent flows, it is given by:

2.0Re074.0 LfC 75 10Re105 L (B.4)

Note that fluid properties are evaluated at the average temperature (Ts+T∞)/2, e.g., if the

oil temperature is 60oC, the oil viscosity and density are evaluated at 40

oC.

Oil FD

T∞ = 40 – 150oC

V = 2 m/s

Ts = 20oC A

L = 5 m

Page 250: Computer-Aided Thermofluid Analyses using Excel

Computer-Aided Thermofluid Analyses Using Excel

Solution with Excel Figure B.5 shows the Excel sheet developed for this example. The data part shows the

given information concerning the oil temperature (T_oil), plate temperature (T_plate),

oil velocity (Velocity), and plate length (Length). Based on the specified oil temperature, the sheet calculates the average temperature (T_average) and the

corresponding oil density (ρ_oil) and kinematic viscosity (ν_oil). The sheet then

calculates the Reynolds number (Re) and friction coefficient (Cf). The single final result, which is the drag force (F_D), is shown on the right-side of the sheet. The figure

reveals the formulae entered in each cell in the calculations part and the formula bar

reveals that used for determining the drag force in cell I2.

Figure B.5. The Excel sheet developed for Example B-1

The friction coefficient is calculated depending on the value of the Reynolds number by using the following nested-If formula in cell F7:

Cf=IF(Re<500000,1.328*Re^-0.5,0.074*Re^-0.2)

The above formula determines whether to use Equation (B.3) or Equation (B.4) to

calculate the friction coefficient depending on the value of the Reynolds number.

Figure B.5 shows the calculations at an oil temperature of 40

oC, which is the initial oil

temperature in the required range. At the average temperature, which is 30oC, the sheet

uses the linear interpolation function Iinterpol1 to determine the values of the oil

density and viscosity. At this temperature the calculated drag force, F_D, is 88.445 N. By inserting a different value for the oil temperature, say 50

oC, the sheet automatically

updates its calculations. Figure B.6 shows a plot of the drag force determined at

different oil temperatures in the range 40oC to 150

oC.

The linear and quadratic interpolation functions are useful in thermofluid analyses not

only for determining fluid properties, but also for the interpolation of other types of

tabulated data that is required by such analyses. Table B.2 shows the cost per metre of galvanised-steel air-conditioning ducts for different diameters of the duct. By

permitting automatic determination of the duct diameter from the tabulated data, the

Page 251: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

interpolation functions are useful for optimisation analyses that aim to determine the optimum duct diameter.

Figure B.6. Variation of the drag force with oil temperature

Table B.2. Cost of galvanised-steel air-conditioning ducts

Duct diameter

(m)

Cost per linear

metre ($)

0.10 9.0

0.15 11.5

0.20 14.5

0.25 17.0

0.30 22.5

0.35 29.0

0.40 34.0

0.45 40.0

0.50 50.0

References

[1] Y.A. Cengel, and M.A. Boles, Thermodynamics an Engineering Approach ,

McGraw-Hill, 7th

Edition, 2007 [2] Y.A. Cengel and A.J. Ghajar. Heat and Mass Transfer: Fundamentals and

Applications. McGraw Hill, 2011

0

20

40

60

80

100

0 50 100 150 200

Dra

g fo

rce

(N

)

Oil temperature (oC)

Page 252: Computer-Aided Thermofluid Analyses using Excel

Computer-Aided Thermofluid Analyses Using Excel

Exercises 10. Using the data for properties of air at atmospheric pressure given in Appendix A,

develop an Excel sheet that can be used to determine the kinematic viscosity of air

at any given temperature in the range 200 – 1000K by using:

a. The trendline feature of Excel

b. The linear-interpolation function (Interpl) provided by Thermax.

11. Develop a VBA function to determine the friction factor from the Colebrook-

White equation and use it with the NRM solver to determine the frictional losses

(hf) in a circular pipe that carries air at 20oC with the following data:

D = 25 cm, L = 150 m, V = 7 m/s, k s = 0.045 mm.

Page 253: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

Appendix C: Application of the Hardy-Cross method with Excel

This appendix supplements Chapter 6 by presenting the Hardy Cross (H-C) method for

the analyses of looped pipe-networks. The appendix shows how the method can be

applied by using Excel. To illustrate the method, consider the single-loop network shown in Figure C.1. There is one source at node A and three discharge points at the

other three nodes B, C, and D. It is required to determine the magnitudes and directions

of the four pipe flows that satisfy both the conservation of mass and the conservation of energy.

Figure C.1. A pipe network with a single-loop

The Hardy-Cross method

For steady, incompressible flow in a looped pipe-network, the two principles can be

expressed by the following equations:

NPipes

iQ1

0 (C.1)

MPipes

jfh1

, 0 (C.2)

Where NPipes is the number of pipes connected to the particular node (2 in the present

case) and MPipes is the number of pipes in each loop (4 in the present case).

The solution procedure starts by assuming the flow rates and directions in the pipes

such that they satisfy the continuity equation, Equation (C.1), at all the pipe-junctions.

Suppose that we assume the flow directions to be as shown in Figure C.2 and we

assume that the flow rate in pipe AB to be 50 litre/s. Then the flow rates in the other pipes can be determined by the continuity equation as shown in the figure.

10 l/s

100 l/s

60 l/s

30 l/s

L=200m

D=0.20m

L=300m

D=0.15m

L=500m

D=0.15m

L=400m

D=0.20m

Page 254: Computer-Aided Thermofluid Analyses using Excel

Computer-Aided Thermofluid Analyses Using Excel

Figure C.2. Assumed flow rates in the network

The assumed pipe flows are unlikely to satisfy the energy equation. Therefore, they are corrected in steps until they practically satisfy the energy equation as follows:

QQQ oldnew (C.3)

Where Qnew and Qold, refer to the initial and the adjusted flow rates, respectively, and

∆Q is a correction term that depends on the energy equation. The correction procedure

has to be repeated a number of times until the energy equation is satisfied. It remains to show how the correction term ∆Q is determined.

The Darcy-Weisbach equation for the friction head, Equation (1.21), can be written as:

2KQh f (C.4)

Where K is given by:

322

2

2 Dg

Lf

gDA

LfK

(C.5)

Applying Equation (C.4) to the corrected flow rate given by Equation (C.3), we get:

2QQKh f (C.6)

Expanding the right-hand side of Equation (C.6):

100 l/s

60 l/s

10 l/s

30 l/s

50 l/s

50 l/s

10 l/s

40 l/s

B A

D

C

Page 255: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

22 .2 QQQQKh f (C.7)

Neglecting the term (ΔQ2), the equation becomes:

QQQKh f .22 (C.8)

Applied to all four pipes in the loop, Equation (C.2) leads to:

0.22 QQQK (C.9)

Rearranging the equation, it becomes:

022 QKQKQ (C.10)

Or,

Q

hh

QK

KQQ

f

f 2/2

2

(C.11)

When applying Equation (C.11), a sign convention must be adopted to take into

consideration the flow direction in the particular pipe. In the following discussion, the friction losses in the clockwise direction are taken as positive while those in the

counter-clockwise direction are taken as negative. In general, this sign convention

means that the friction loss in a pipe that is common to two loops (or more) will be

given a negative sign with one loop but a positive sign with the other loop(s).

The steps of applying the H-C method are as follows:

1. Make a guess for the flow rate (magnitude and direction) in one pipe of each loop

and calculate the flow rates in the other pipes in the network by applying the

continuity equation at the respective nodes. 2. Calculate the friction loss hf in each pipe of the network and determine the net

friction loss in each loop according to the flow direction in the relevant pipes

(clockwise positive and counter-clockwise negative). Most likely, these will not

be zeros at the initially guessed pipe flows. 3. Calculate a correction increment ΔQi for the flows in loop i from Equation

(C.11). The summations in Equation (C.11) are performed over the number of

pipes in each loop. 4. Obtain new pipe flows in each loop by modifying the old ones according to

Equation (C.3).

Page 256: Computer-Aided Thermofluid Analyses using Excel

Computer-Aided Thermofluid Analyses Using Excel

5. Repeat steps 2, 3, and 4 until the correction increments become small and the variations in the flow rates become negligible.

A number of articles and videos in the internet explain how the H-C method can be implemented in Excel [1,2]. The following example demonstrates its application to

analyse the single-loop pipe-network shown in Figure C.1.

Example C-1. Analysis of a simple pipe-network by the H-C method

Figure C.1 shows a pipe network that distributes water to three consumption points as

shown in the figure. Determine the flow rates in the four pipes if a friction factor for all

pipes can be taken as 0.025.

Solution

Step 1: The first step is to assume flow rates in the four pipes that satisfy continuity. It is enough to assume the value of the flow rate in one pipe since the other flow rates

must follow the continuity equation. Let us assume that the flow in pipe AB is 50 l/s in

the direction shown in Figure C.2. The magnitudes and directions of other flow rates

are automatically determined by applying the continuity equation at the four nodes. Figure C.2 shows the magnitudes and directions of the flow rates in the network that

satisfy the continuity equation at all the nodes based on the assumed flow in pipe AB.

Step 2: The second step is to determine the resulting velocities and friction head losses

in the different pipes. Figure C.3 shows the sheet developed for these calculations. The

given information about the network pipes, i.e., their lengths and diameters, are entered

on the left side of the sheet. Values of the gravity acceleration (gc) and friction factor (f) are entered at the top left-side of the sheet. These two parameters are labelled.

Figure C.3. Excel sheet developed for Example C-1

The cross-sectional areas of the different pipes are calculated in column E so as to determine the fluid velocities in column G. Based on these velocities the friction losses

are determined in column G. Table C.1 shows the formulae in columns G and H that

calculate the pipe velocities and friction head losses. Note that in the formula for the

friction head loss (hf), the head loss is multiplied by SIGN(Q) so as to account for the direction of the flow in the pipe – which can change during the iteration process.

Page 257: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

Table C.1. Formulae in columns G to K

V Hf hf/Q ΔQ Qnew

=F5/E5 =f*(B5/C5)*G5^2/(2*gc)*SIGN(F5) =H5/F5 =-SUM(H5:H8)/SUM(I5:I8)/2 =F5+$J$5

=F6/E6 =f*(B6/C6)*G6^2/(2*gc)*SIGN(F6) =H6/F6 =F6+$J$5

=F7/E7 =f*(B7/C7)*G7^2/(2*gc)*SIGN(F7) =H7/F7 =F7+$J$5

=F8/E8 =f*(B8/C8)*G8^2/(2*gc)*SIGN(F8) =H8/F8 =F8+$J$5

Step 3: The third step is to determine ΔQ according to Equation (C.11) which requires

the determination of hf/Q. Table C.1 also reveals the formulae that calculate hf/Q in column I and ΔQ in column J. Since ΔQ is the same for all pipes, it is calculated for

pipe AB only but used for the other pipes as well as shown in the last column of Table

C.1. As shown in Figure C.3, the value obtained for this first iteration is ΔQ =0.0157.

Step 4: New values for the flow rates in the four pipes according to Equation (C.3).

Column K in the sheet shown in Figure C.3 shows the new values of the flow rates.

Step 5: The adjusted flow rates obtained in step 4 can now be used as initial values for

the second iteration. Table C.2 shows the calculations in the second iteration which are

based on the new values of the flow rates following the same steps described for the first iteration. Note that the ΔQ has dropped to 0.0047. Table C.2 also shows the new

values of the flow rates after the second iteration. These new values of the flow rates

can now be used as initial values for the third iteration. As shown in Table C.3, calculations of the third iteration yield a very small value for ΔQ of 0.0001.

Table C.2. Results of the second iteration

Pipe Q V hf hf/Q ΔQ Qnew

AB 0.066 2.092834 5.5809832 84.88403 0.004707 0.070

BC 0.006 0.325289 0.2696557 46.91027

0.010

CD -0.024 -1.37236 -7.999415 329.8501

-0.020

AD -0.034 -1.09026 -3.029247 88.44087

-0.030

Table C.3. Results of the third iteration

Pipe Q V hf hf/Q ΔQ Qnew

AB 0.070 2.242649 6.4086065 90.96041 0.000144 0.071

BC 0.010 0.591626 0.8920015 85.31902

0.011

CD -0.020 -1.10603 -5.195783 265.8355

-0.019

AD -0.030 -0.94045 -2.25394 76.2881

-0.029

Figure C.4 shows the variation of ΔQ with the iteration number. The figure indicates that the change in the flow rates after the third iteration is small and, therefore, the flow

rates obtained after the third iteration can be taken as the final solution. The plus sign

Page 258: Computer-Aided Thermofluid Analyses using Excel

Computer-Aided Thermofluid Analyses Using Excel

with the flows in AB and BC means that their direction is clockwise, while the minus sign with the flows in CD and AD means that their direction is counter-clockwise. Note

that the flow in pipe BC was initially assumed to be in the counter-clockwise direction,

but the final solution showed that it is clockwise.

Figure C.4. Variation of ΔQ with iteration number

Example C-2. Application of the H-C method to pipe-networks with multiple loops

Determine the flow rates in the pipe-network shown in Figure C.5. The valve in pipe

BC is partially closed, which produces a local head loss of 10.0 V2/2g. The roughness of

all pipes is 0.06 mm.

Figure C.5. The two-loop pipe network of Example C-2

This case is based on Example 5-2 in Nalluri and Feather [3].

Solution

Pipe networks with multiple loops will have pipes that are common to two or more loops such as Pipe BE in Figure C.5. In this case, the pipe will have a different ΔQ in

each loop. Suppose that the two values of ΔQ are ΔQ1 for loop 1 and ΔQ2 for loop 2.

The effective ΔQ for pipe BE is calculated from [1]:

0

0.004

0.008

0.012

0.016

0.02

0 2 4 6

ΔQ

Iteration number

1 2

Valve

A B

F

C

D E

200 l/s

Page 259: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

211, QQQBE Loop 1 (C.12.a)

122, QQQBE Loop 2 (C.12.b)

Note that the two values of ΔQ have the same magnitude but opposite signs.

Figure C.6 shows the Excel sheet developed for this example. As usual, the left side of

the sheet shows the problem data that consist of the pipes lengths (L) and diameters

(D), the roughness factor of the pipe material (ε), and the viscosity of the fluid (visc).

Column E shows the flow rates in the pipes; two of which are guessed (QAB and QBC) and the rest are calculated by applying the continuity equation at the different nodes.

Figure C.6. Excel sheet developed for solving Example C-2 by the Hardy Cross method

Based on these initial flow rates, the sheet determines the Reynolds numbers, friction

factors, and friction losses. The friction factors are determined by using the Swamee-Jain formula (Equation (1.25)). The formula bar reveals the formula that applies

Equation (1.25). The flow rate adjustment (ΔQ) in each loop is determined according to

Equation (C.11). For loop 1, ΔQ =-0.0057251 and for loop 2, ΔQ =-0.011222. For pipe BE, which is common to both loops, the effective values of ΔQ have the same

magnitude for both loops, which is 0.0054965. The new flow rates in the different pipes

are obtained according to Equation (C.3).

To avoid repetition of the whole procedure for the following iterations, the new Q

values in column (N) can be copied and pasted (using the "Paste Values" option) in

column (E) that stores the old values. This is to be repeated until ΔQ became reasonably small so that there was no significant change in Q in all the network pipes. Figure C.7

shows the result after 5 iterations when ΔQ dropped to small values in both loops. The

minus sign before the flow rates in pipes EF, AF, CD, DE, and BE means that their

directions are counter-clockwise relative to the respective loop. Note that, the flow in pipe BE, which is common to the two loops, has the same magnitude (0.01645 m

3/s)

Page 260: Computer-Aided Thermofluid Analyses using Excel

Computer-Aided Thermofluid Analyses Using Excel

but opposite directions. While its direction is clockwise (+) in loop 1, it becomes counter-clockwise (-) in loop 2.

Figure C.7. The Excel sheet for Example C-2 with the adjusted flows after five

iterations

Table C.4 compares the present pipe flows, in m3/s, with those given by Nalluri and

Feather [3]. The table shows a good agreement between the two solutions. The same

problem was solved in Example 6.2 by using the Excel-Solver method and the solution

obtained is also shown in the table.

Table C.4. Comparison of the pipe flow rates obtained by the H-C method with those

obtained by Nalluri and Feather [3]

Pipe Nalluri and Feather [3] H-C solution Excel-Solver

AB 0.11152 0.11150 0.1115

BC 0.03505 0.03505 0.0350

CD 0.00495 0.00495 0.0050

DE 0.03495 0.03495 0.0350

EF 0.04848 0.04850 0.0485

AF 0.08848 0.08850 0.0885

BE 0.01648 0.01645 0.0165

References [1] TM‟s Channel, Pipe network analysis in Excel using Hardy Cross method,

Video, available at: https://www.youtube.com/watch?v=M8f1FNgeq7o, last accessed 20/6/2017.

[2] A. M. Elfeki, Pipe network analysis example with Excel Solver, Researchgate, available at: https://www.researchgate.net/publication/258051650_Pipe_Network_ Analysis_Example_with_Excel_Solver, last accessed 20/6/2017.

[3] C. Nalluri and R.E. Feather, Civil Engineering Hydraulics, Fourth Edition.

Page 261: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

Appendix D: Analyses of a gravity-driven network with eight loops

This appendix applyies the Excel-Solver method presented in Chapter 6 for hydraulic

analyses of pipe-networks to a network of practical complexity. The case considered is the gravity-driven network presented by Brkic [1] shown in Figure D.1. The network

distributes water from two reservoirs to four demand points via 19 cast iron pipes (ε =

0.00026 m) that are laid on a flat area with no variation in elevation. Table D.1 shows the lengths of the 19 network pipes.

Figure D.1. A pipe-network with eight loops (adopted from Brkic [1])

This network will be analysed by using the same initial pipe diameters used by Brkic

[1] so that comparison can be made with his solution for the pipe flow rates shown in

Table D.1. In the present analysis the effect of the method used to evaluate friction factor on the results obtained by Solver is assessed by using both the Swamee-Jain

formula and the Colebrook-White formula.

D.1. The analytical model

Following the procedure described in Chapter 6 for the analysis of pipe networks using

Excel and Solver, the flow rates in 8 selected pipes were specified and those in the

remaining 11 pipes were determined by applying the continuity equation at each junction. Solver is then used to adjust the initial flow rates in order to satisfy the energy

equation. The assumed flow-directions for all the pipes are shown in Figure D.1. The

initially assumed flow rates are those for pipes AB, BC, CD, DE, EF, HI, JK, and KL. The flow rates in the remaining 11 pipes are calculated from continuity as follows:

GHGKFG QQQ (D.1)

HJHIGH QQQ (D.2)

Page 262: Computer-Aided Thermofluid Analyses using Excel

Computer-Aided Thermofluid Analyses Using Excel

Table D.1. Pipe data and initial flow rates in the 8-loop network [1]

Brkic [1] notation

Pipe Length (m) Initial

diameter (m) Initial flow rate (m

3/h)

/1/ AB 457.2 0.305 173.32

/2/ BC 304.8 0.203 150 /3/ CD 365.8 0.203 130

/4/ DE 609.6 0.203 6.6 /5/ EF 853.4 0.203 100

/6/ FG 335.3 0.203 0.28 /7/ GH 304.8 0.203 16.88

/8/ HI 762.0 0.203 13.56

/9/ AI 243.8 0.203 200 /10/ IJ 396.2 0.152 50

/11/ JK 304.8 0.152 70 /12/ KL 335.3 0.254 51.96

/13/ EL 304.8 0.254 32.96 /14/ HJ 548.6 0.152 3.32

/15/ BJ 335.3 0.152 23.32 /16/ GK 548.6 0.152 17.16

/17/ CK 365.9 0.254 20 /18/ FL 548.6 0.152 9

/19/ DL 396.2 0.152 10

QIA = 373.32 - QAB (D.3)

HIAIIJ QQQ 44.136 (D.4)

EFDELE QQQ 36.126 (D.5)

JKBJIJJH QQQQ (D.6)

BCABBJ QQQ (D.7)

CKKLJKGK QQQQ 12.159 (D.8)

CDBCCK QQQ (D.9)

FGEFFL QQQ 72.90 (D.10)

DECDDL QQQ 4.113 (D.11)

The energy equation imposes 8 constraints on the iterative solution, one for each loop.

Taking the clockwise flow direction as positive, the constraints are:

0,,,, IJfAIfBJfABf hhhh Loop 1 (D.12)

Page 263: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

0,,, HIfHJfIJf hhh Loop 2 (D.13)

0,,,, JKfBJfCKfBCf hhhh Loop 3 (D.14)

0,,,, HJfGHfGKfJKf hhhh Loop 4 (D.15)

0,,,, CKfKLfDLfCDf hhhh Loop 5 (D.16)

0,,,, FLfKLfGKfFGf hhhh Loop 6 (D.17)

0,,, DLfELfDEf hhh Loop 7 (D.18)

0,,, ELfFLfEFf hhh Loop 8 (D.19)

D.2. The hydraulic analysis

To investigate the effect of the formula for the friction-factor on the analysis results,

two Excel sheets were developed for the hydraulic analyses of this network one of which applies Darcy-Weisbach equation with the Swamee-Jain (S-J) formula, while the

other applies the Colebrook-White (C-W) formulae. Figure D.2 shows the sheet that

uses the S-J formula.

Figure D.2. The Excel sheet developed for analysing the pipe-network with eight loops

by using the Swamee-Jain formula

The data part stores the water density (ρ) and viscosity (visc), the gravity constant (g),

and the pipe roughness (ε). The length and diameter for the 19 pipes are stored in

columns E and F, respectively. The sheet calculates the cross-sectional area for each pipe in column G. Column H stores the initial flow rates in the pipes. The 8 coloured

(shaded) cells in this column store the assumed flow rates while those determined

according to Equation (D.1) – (D.11) are not coloured. Note that the calculated pipe

Page 264: Computer-Aided Thermofluid Analyses using Excel

Computer-Aided Thermofluid Analyses Using Excel

flow rates are the same as those given by Brkic [1] and Table D.1. The calculated pipe friction losses are stored in column L. The formula bar in Figure D.2 reveals the

formula for determining the error in satisfying the energy equation in loop 1 according

to Equation (D.12).

Since the initially assumed flow rates in the pipes satisfy only the continuity equation

but not the energy equation, most of the errors calculated by Equations (D.12) – (D.19) in column O are not close to zero. The flow rates that minimise the errors in the energy

equations to sufficiently small values can be found by Solver and the set-up for the task

is shown in Figure D.3.

Figure D.3. Solver set-up for the analysis of the pipe-network with eight loops

Note that the “Set Objective” slot is left blank and the variables to be changed are the

flow rates in the 8 selected pipes. There are 8 constraints which require the absolute

values of the errors in satisfying Equations (D.12) – (D.19) to be reduced to a maximum tolerance (Maxerror) of 0.001. Attempts were made to use the Evolutionary method of

Solver for the present analyses, but the method failed to converge to a solution even

with the different numerical options offered by Solver. The GRG Nonlinear method also failed to converge to a solution with automatic-scaling. Figure D.4 shows the

solution found with GRG Nonlinear method but without automatic-scaling. Note that

all the 8 constraints are now satisfied. Figure D.5 compares the flow rates with Solver

with those obtained by Brkic [1]. The figure shows that the values calculated by the S-J formula agree well with those obtained by Brkic [1] who used the node-loop method

and solved the resulting linear system with Excel matrix functions.

Page 265: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

Figure D.4. Solver solution for the pipe-network using the Swamee-Jain formula

The second sheet that uses the Colebrook-White formula was developed following a

similar procedure and Solver was used to determine the flow rates that satisfy the energy equations. Figure D.6 shows the solution obtained with the GRG Nonlinear

method of Solver with this formula. Figure D.5 that also shows the flow rates calculated

by this formula shows that their values are close to those obtained with the Swamee-Jain formula and agree well with those obtained by Brkic [1].

Figure D.5. Comparison of the flow rates obtained by the present analyses for the eight-

loop pipe-network with those given by Brkic [1]

-50

0

50

100

150

200

AB

BC

CD DE EF FG GH HI AI IJ

JK KL EL

HJ

BJ

GK

CK FL DL

Flo

w r

ate

e (m

3/h

)

Brkic[1]

S-J

C-W

Page 266: Computer-Aided Thermofluid Analyses using Excel

Computer-Aided Thermofluid Analyses Using Excel

Figure D.6. Hydraulic solution found with Solver using the Colebrook-White formula

References

[1] D. Brkic, Spreadsheet-Based Pipe Networks Analysis for Teaching and Learning Purpose, Spreadsheets in Education (eJSiE): Vol. 9: Iss. 2, Article 4, 2016.

Available at: http://epublications.bond.edu.au/ejsie/vol9/iss2/4

Page 267: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

Appendix E: Finite-difference analysis of the heat transfer from a triangular fin

This appendix supplements Chapter 7 that deals with the numerical solution of the

steady conduction equation using the finite-difference (FD) method. The appendix

demonstrates the application of the FD method for solving the conduction equation in complex geometries by considering the case of the heat-conduction in a triangular fin

given by Cengel and Ghajar [1] in Example 5-2.

Case description

An aluminium alloy fin (k=180 W/m.K) has a triangular cross section as shown in

Figure E.1. The fin has length L=5 cm, base thickness t = 1 cm, and very large width w. The base of the fin is maintained at a temperature of To=200

oC. The fin losses heat to

the surrounding medium at T∞ = 25oC with a heat transfer coefficient of h = 15 W/m

2.K.

Using the finite difference method with six equally spaced nodes along the fin in the x-

direction, determine the temperature variation in the fin along its length.

Figure E.1. The dimensions and boundary conditions of the triangular fin

Developing the FD equations As discussed in Chapter 7, for steady one-dimensional conduction heat-transfer in a

medium without heat generation, the conduction equation reduces to:

02

2

dx

Td (E.1)

Two boundary conditions are given, which are: (i) specified temperature at the base and

(ii) convection boundary condition at the top and bottom surfaces as shown in Figure E.1. To develop the relevant FD equations, the fin is divided into five segments of equal

length (Δx) as shown in Figure E.2.

Tb =

200oC

T∞ =

25o

C

L= 5 cm

t = 1 cm w

Page 268: Computer-Aided Thermofluid Analyses using Excel

Computer-Aided Thermofluid Analyses Using Excel

Figure E.2. Numerical mesh of nodes for the triangular fin

At steady state, the rate of heat transfer by conduction entering each segment from its

left side is balanced by the rate of heat transfer leaving the segment by conduction through its right side and by convection through the top and bottom surface areas, i.e.

convRcondLcond QQQ ,, (E.2)

Where, LcondQ , and RcondQ ,

refer to the heat transfer by conduction through left and

right sides of the fin segment, respectively, while convQ refers to the heat transfer by

convection from the top and bottom sides of the segment. Applying Fourier law for

conduction for LcondQ , and RcondQ ,

and Newton‟s law of cooling for convQ , the

following equation is obtained based on Equation (E.2):

TThAdx

dTkA

dx

dTkA conv

xR

R

xL

L (E.3)

The temperature derivatives in Equation (E.3) are now replaced by the respective finite

temperature differences across the segment. For node 1, these are given by:

x

TT

dx

dT

xL

01 (E.4)

x

TT

dx

dT

xR

12 (E.5)

Substituting in Equation (E.3), the resulting FD equation for node 1 is:

TThA

x

TTkA

x

TTkA convRL 1

1201 (E.6)

0 Δx 2Δx 3Δx 4Δx 5Δx

Tb=200oC T

∞=25

o

C

T1 T

2 T3 T

4 T

5

m=0 m=1 m=2 m=3 m=4 m=5

Page 269: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

Where the three areas AL, AR and Aconv are calculated from:

L

wtxLAL

2/ (E.7)

L

wtxLAR

2/3 (E.8)

cos2

xwAconv

(E.9)

Where L, w, and t are the three dimensions of the fin shown in Figure E.1 and θ is the fin‟s angle (θ = tan

-1(t/2L).

Equations similar to Equation (E.6) can be obtained for nodes 2, 3, and 4 by replacing the temperature derivatives and side areas with the respective values for each node.

However, node 5 requires a slightly different treatment because there is no heat transfer

by conduction from its right side and also because its convection area is half the value

at the other segments. Table E.1 shows the corresponding terms in Equation (E.6) for the five nodes as described in more details by Cengel and Ghajar [1].

Table E.1. Terms in Equation (E.3) corresponding to each node

Node 1 Node 2 Node 3 Node 4 Node 5

xLdx

dT

x

TT

)( 01 x

TT

)( 12 x

TT

)( 23 x

TT

)( 34 x

TT

)( 45

xRdx

dT

x

TT

)( 12 x

TT

)( 23 x

TT

)( 34 x

TT

)( 45 0

AL

L

wtxL 2/

L

wtxL 2/3

L

wtxL 2/5

L

wtxL 2/7

L

wtxL 2/9

AR

L

wtxL 2/3

L

wtxL 2/5

L

wtxL 2/7

L

wtxL 2/9 0

Aconv cos2

xw

cos2

xw

cos2

xw

cos2

xw

cos

2/2

xw

The FD equations for the five nodes can be written as:

0)()()( ,31,21,1 mmmmmmmm TTCTTCTTC (E.10)

Where, m = 1, 2, 3, 4, or 5. For nodes 1 to 4 the constants C1,m, C2,m and C3,m are

obtained from:

Page 270: Computer-Aided Thermofluid Analyses using Excel

Computer-Aided Thermofluid Analyses Using Excel

L

xmC m )

2

1(1,1

(E.11)

L

xmC m )

2

1(1,2

(E.12)

sin

2

,3kL

xhC m

(E.13)

For node 5, the three constants are obtained from:

tan5,1 C (E.14)

C2,5 = 0 (E.15)

cos5,3

k

xhC

(E.16)

Substituting for each node the respective values in Equation (E.10) leads to the

following system of linear equations that can be solved to determine the five unknown

temperatures:

0)()()( 11,3121,2101,1 TTCTTCTTC (E.17)

0)()()( 22,3232,2212,1 TTCTTCTTC (E.18)

0)()()( 33,3343,2323,1 TTCTTCTTC (E.19)

0)()()( 44,3454,2434,1 TTCTTCTTC (E.20)

0)(0)( 55,3545,1 TTCTTC (E.21)

Excel implementation

The algebraic system of Equations (E.17) – (E.21) can be rearranged in a matrix form and then solved by using the matrix-inversion method as shown in Chapter 2.

Alternatively, the system can be solved by using Solver and Figure E.3 shows the Excel

sheet developed for this method. The left part of the sheet shows the given data for the fin. Cells C5 stores the base temperature (Tb=200

oC), while cell C6 stores the ambient

temperature (T∞=25oC). Cells H3 to L3 contain guessed values of the temperatures T1

to T5.

Page 271: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

Figure E.3. Excel sheet prepared for FD solution of the triangular fin

Cells H5 to L5 store the values of m corresponding to each node. The following three

rows store values of the three constant C1,m, C2,m and C3,m that correspond to each node. The bottom row (cells H10 to L10) stores values of the residuals in the right-hand-sides

of the algebraic equations resulting from the substitution of the guessed values of the

temperatures in Equations (E.17) – (E.21). The formula bar reveals the formula used for the calculation of R4. Note that, since the guessed temperatures are not correct, the

residuals are not zeros.

Solver can now be used to adjust values of the five temperatures until the five

corresponding residuals become approximately zeros. Figure E.4 shows the set-up of

Solver for this task.

Figure E.4. Solver set-up for FD solution of the triangular fin

Note that the target cell is left blank. The adjustable cells are the guessed temperature

stored in cells H3 to L3. The constraints added require that values of the residuals

stored in cells H10 to L10 become approximately zeros. In this case, Solver will iterate

Page 272: Computer-Aided Thermofluid Analyses using Excel

Computer-Aided Thermofluid Analyses Using Excel

until all the constraints are satisfied. Figure E.5 shows the sheet with Solver solution which is: T1 = 198.6

oC, T2 = 197.1

oC, T3 = 195.7

oC, T4 = 194.3

oC, and T1 = 192.9

oC.

The same solution was given by Cengel and Ghajar [1].

Figure E.5. Solver solution of the FD equations of the triangular fin

References [1] Y. A. Cengel and A. J. Ghajar, Heat and Mass Transfer: Fundamentals and

Applications. 4th

edition, McGraw-Hill, 2011

Page 273: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

Appendix F: Macros and VBA functions for applying the finite -difference method with Excel

This appendix supplements Chapter 8 that deals with the numerical solution of the

transient heat-conduction equation with the finite-difference (FD) method. It describes

the procedure of recording the macro needed for implementing the explicit FTCS scheme in Example 8-2 and provides the two VBA functions, Fdimplicit and TDMA,

needed for implementing the implicit BTCS scheme in Example 8-1. A macro is a

useful feature for performing parametric analyses and repetitive calcaulations. It allows Excel to record the sequence of actions for the initial value of the targetted parameter

and then repeat them for other values by a push of a button. The TDMA solver is also

useful for solving systems of linear equations that arise in other types of thermofluid

analyses.

F.1. Recording a macro

The procedure of creating the macro can be demonstrated by describing that needed for applying the explicit finite-difference scheme (FTCS) in Example 8-2. Figure F.1

shows the Excel sheet developed for this example.

Figure F.1. Advancing the FD solution by copying the temperature values after one

time-step from the bottom cells and pasting them in the coressponding top cells

Figure F.1 shows the FD solution at two consecutive time levels. The cells in the

bottom block store the temperature values at the current time level i , while those in the

top block calculate the temperatures at the new time level i+1 after one time-step (∆t).

To update the temperature values in the top block, the values in the bottom cells are copied and pasted in the coressponding top cells. This procedure is repeated until the

targetted time level is reached. To create the macro for this repetetive procedure:

Page 274: Computer-Aided Thermofluid Analyses using Excel

Computer-Aided Thermofluid Analyses Using Excel

1. Go to the Developer tab and select “Record Macro” as shown in Figure F.2. The form shown in Figure F.3 will appear to you. The first macro will

automatically be given the name “Macro 1”. You can change this name and

give it a description if you like. Press “OK”. 2. Copy the values in the bottom block of cells, i.e. cells F11:K13

3. Use Paste-special to paste the values in the top cells; F4:K6 (Figure F.1)

4. Go back to the Developer tab and select “Stop Recording” (Figure F.4)

Figure F.2. Initiating the macro by selecting “Record Macro” from the Developer tab

Figure F.3. Form for selecting the macro, adding a description to the macro, and

chaninging its name if needed

Figure F.4. Ending the micro recording by selecting the “Stop Recording” function

Page 275: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

To create a button for the new macro, go to the Developer tab and insert a “button

form control” as shown in Figure F.5. Place the button in a suitable location in the

sheet and the form shown in Figure F.6 will appear to you. As the figure shows, the

button will automatically be given the name “Button1_Click”.

Figure F.5. Creating a button for the new macro

Figure F.6. Assigning “Button 1” to “Macro 1”

This button should now be linked to the macro and the form shown in Figure F.6 gives you a list of the available macros to select from. Since Macro1 is the only macro we

have created so far, the list only includes it. Select “Macro1” and press “OK”. The new

button will then appear in the Excel sheet with the name “Button 1“ as shown in Figure F.7. Your macro is now ready to use and you by pressing the button once, Excel

will automatically advance the explicit solution by one time step.

Page 276: Computer-Aided Thermofluid Analyses using Excel

Computer-Aided Thermofluid Analyses Using Excel

Figure F.7. The Excel sheet with the new button “Button 1”

To change the button‟s name to a more meaningful one like “Solve” as shown in Figure

F.1, or “Run”, “Advance solution”, etc, place the cursor on the button and click the right side of your mouse. The form shown in Figure F.8 will then appear to you. Select

“Edit Text” and change the name as desired. For more information about this feature,

the reader can refer to specialised references or the internet [1,2].

Figure F.8. Changing the name “Button 1” to a more indicative one

F.2. The VBA functions The function Fdimplicit determines the coefficient matrix given by Equation (9.12), while the TDMA function applies the tri-diagonal matrix algorithm for solving the resulting system of linear-equations. The two functions are listed below.

The function Fdimplicit Function Fdimplicit(Dx, Dt, alfa, N, M, L, Temp) Dim A As Variant Dim B As Variant Dim C As Variant Dim D As Variant Dim Sol As Variant ReDim A(150), B(150), C(150), D(150), Sol(1 To 150)

Page 277: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

Ai = -alfa / (Dx * Dx) Bi = (1 / Dt) + (2 * alfa / Dx / Dx) Ci = -alfa / Dx / Dx For ic = 1 To N A(ic) = Ai B(ic) = Bi C(ic) = Ci D(ic) = (1 / Dt) * Temp(ic) Next ic B(1) = 1# C(1) = 0# D(1) = 0# A(N) = 0# B(N) = 1# D(N) = 0# Temp = tdma(A, B, C, D, N, Sol) Fdimplicit = Sol End Function

The function TDMA Function tdma(A, B, C, X, N, XX) As Variant With Worksheets("Sheet1") Dim AA, BB, CC, DD As Variant Dim ic As Integer ReDim AA(1 To N) ReDim BB(1 To N) ReDim CC(1 To N) ReDim DD(1 To N) ReDim XX(1 To N) For ic = 1 To N AA(ic) = A(ic) BB(ic) = B(ic) CC(ic) = C(ic) XX(ic) = X(ic) Next ic CC(1) = CC(1) / BB(1) XX(1) = XX(1) / BB(1)

Page 278: Computer-Aided Thermofluid Analyses using Excel

Computer-Aided Thermofluid Analyses Using Excel

' loop from 1 to N - 1 For ic = 2 To (N - 1) M = 1# / (BB(ic) - AA(ic) * CC(ic - 1)) CC(ic) = CC(ic) * M XX(ic) = (XX(ic) - AA(ic) * XX(ic - 1)) * M Next ic M = 1# / (BB(N) - AA(N) * CC(N - 1)) XX(N) = (XX(N) - AA(N) * XX(N - 1)) * M ' loop from N - 1 to 1 For ic = (N - 1) To 1 Step -1 XX(ic) = XX(ic) - CC(ic) * XX(ic + 1) Next ic tdma = XX End With End Function

References [1] J. Walkenbach, Excel 2010 Formulas, Wiley Publishing Inc., 2010

[2] J. Walkenbach, Excel 2007 Charts, Wiley Publishing Inc., 2007

Page 279: Computer-Aided Thermofluid Analyses using Excel

Mohamed M. El-Awad (UTAS)

Subject Index

Activation of Solver, 52, 55 Adiabatic process, 229 air-conditioning, 6, 45, 255 backward difference, 168 boundary conditions, 164, 165, 167,

169, 170, 173, 181, 184, 187, 188, 195, 197, 203, 205, 206, 272, 273

Brayton cycle, 208, 209, 210, 213, 215, 216

built-in function, 24, 25, 68 Cascade refrigeration, 234 cavitation, 88, 89, 91 central difference, 168, 186 centrifugal pump, 38, 111, 112, 113,

115, 116, 119 Chezy-Manning equation, 9 Coefficient of performance, 220, 230,

245 Colebrook equation, 9, 15, 79, 95, 96,

97, 98, 249 Constrained iterative solutions, 88 continuity equation, 2, 123, 129, 137,

142, 152, 153, 155, 257, 259, 260, 263, 266, 269

convection heat-transfer, 10, 101 Convection heat-transfer analyses, 85 cross-flow, 13, 14 Darcy-Weisbach equation, 8, 9, 31, 79,

90 Diesel cycle, 14, 216, 225, 226 Dittus-Boelter equation, 11, 86 economic diameter, 109 energy equation, 8, 89, 105, 110, 120,

123, 124, 126, 129, 137, 139, 142, 143, 150, 152, 153, 155, 156, 157, 258, 266, 267, 269

Evolutionary method, 54, 57, 58, 59, 62, 63, 64

Excel built-in functions, 29 Excel formula, 24, 31, 41, 68, 69, 96,

211, 249, 250 Exergy, 19, 208, 220, 221, 222, 223,

245 feed-water, 5, 6

Fin, 12, 48, 49, 182, 183, 184, 205, 206, 272, 273, 274, 276, 277

Finite Difference Method, 182 formula bar, 23, 24, 25, 28, 29, 39, 68,

87, 90, 250, 253, 254 forward difference, 63, 168 forward-in-time, 186 Fourier number, 187, 194, 199 friction coefficient, 254, 255 friction factor, 8, 9, 15, 16, 79, 80, 90,

95, 96, 97, 132, 249, 254 Functions for matrix operations, 32 global minimum, 57 Goal Seek

Iterative solution, 18, 19, 23, 38, 39, 40, 41, 43, 44, 47, 50, 52, 79, 80, 81, 82, 84, 85, 87, 88, 93, 97, 98, 100, 101

GRG Nonlinear method, 54, 55, 57, 58, 59, 62, 63, 64, 76

Hardy Cross, 257, 263, 265 Hazen-Williams equation, 9 heat conduction equation, 36, 182, 199,

205 Heat generation, 164, 169, 170, 172,

173, 175, 176, 181, 194, 272 heat-exchanger, 13, 212, 213 heat-exchangers

Optimisation, 13 ideal gas

law, 15, 20, 69, 92 Ideal-gas mixtures, 82 insulation, 11, 12, 16, 55 interpolation functions, 18, 74, 252,

253, 255 iterative solution

Constrained, 80, 82, 88, 91, 93, 98, 100, 101

Iterative solutions Goal Seek, 16, 95

labelling, 23, 27, 47, 81 linear systems, 23, 33, 36 LMTD method, 100 Logical functions, 31

Page 280: Computer-Aided Thermofluid Analyses using Excel

Computer-Aided Thermofluid Analyses Using Excel

macros, 18 major friction, 8 matrix functions, 23, 59 matrix inversion, 18, 33, 36, 177, 191 Mean effective pressure, 219, 225 minor friction, 8, 9 Moody diagram, 8 Multi-stage cycle, 20 Newton-Raphson solver, 18, 74, 79, 98,

249 NTU method, 100 Nusselt number, 10, 11, 86 objective function, 55, 158 optimisation analyses

Solver, 5, 14, 16, 17, 52, 55, 74, 252 Optimisation analyses, 16 Otto cycle, 14, 19, 208, 216, 217, 218,

219, 220, 221, 222, 223, 224 Pipe network, 17, 119, 120, 136, 137,

138, 141, 143, 154, 158, 159, 257, 260, 262

Prandtl number, 11, 86 Pump curve, 10, 113, 117, 129

R134a, 15, 16, 25, 26, 77, 230, 232, 233, 244

R22, 233, 244, 245 Rankine cycle, 16, 208 Raphson, 14, 15, 18, 74, 79, 98, 249 Reynolds number, 8, 11, 16, 31, 80, 86,

90, 97, 254, 255 shell-and-tube, 13, 100 Simplex LP method, 59, 61 Soave-Redlich-Kwong equation, 74 TDMA, 186, 191, 192, 278, 281, 282 Thermal resistance, 12, 85, 87 Thermax, 18, 19, 51, 52, 70, 71, 74, 75,

82, 84, 96, 107, 208, 210, 211, 212, 215, 219, 222, 223, 224, 225, 228, 230, 231, 232, 233, 236, 237, 243, 244, 249, 252, 256

Tri-diagonal matrix algorithm, 186, 191, 281

vapour-compression refrigeration Cycle, 228, 229, 230, 231, 232, 245

VBA, 18, 64, 65, 66, 67, 69, 74, 75, 77, 96, 224