Table Of ContentNumerical Methods for
Partial Differential
Equations
Finite Difference and Finite
Volume Methods
Sandip Mazumder
The Ohio State University
AMSTERDAM • BOSTON • HEIDELBERG • LONDON
NEW YORK • OXFORD • PARIS • SAN DIEGO
SAN FRANCISCO • SINGAPORE • SYDNEY • TOKYO
Academic Press is an imprint of Elsevier
Academic Press is an imprint of Elsevier
125, London Wall, EC2Y 5AS, UK
525 B Street, Suite 1800, San Diego, CA 92101-4495, USA
225 Wyman Street, Waltham, MA 02451, USA
The Boulevard, Langford Lane, Kidlington, Oxford OX5 1GB, UK
Copyright © 2016 Elsevier Inc. All rights reserved.
No part of this publication may be reproduced or transmitted in any form or by any means, electronic or
mechanical, including photocopying, recording, or any information storage and retrieval system, without
permission in writing from the publisher. Details on how to seek permission, further information about the
Publisher’s permissions policies and our arrangements with organizations such as the Copyright Clearance
Center and the Copyright Licensing Agency, can be found at our website: www.elsevier.com/permissions.
This book and the individual contributions contained in it are protected under copyright by the Publisher
(other than as may be noted herein).
Notices
Knowledge and best practice in this field are constantly changing. As new research and experience
broaden our understanding, changes in research methods, professional practices, or medical treatment
may become necessary.
Practitioners and researchers must always rely on their own experience and knowledge in evaluating and
using any information, methods, compounds, or experiments described herein. In using such information
or methods they should be mindful of their own safety and the safety of others, including parties for whom
they have a professional responsibility.
To the fullest extent of the law, neither the Publisher nor the authors, contributors, or editors, assume any
liability for any injury and/or damage to persons or property as a matter of products liability, negligence
or otherwise, or from any use or operation of any methods, products, instructions, or ideas contained in
the material herein.
Library of Congress Cataloging-in-Publication Data
A catalog record for this book is available from the Library of Congress
British Library Cataloguing-in-Publication Data
A catalogue record for this book is available from the British Library
ISBN: 978-0-12-849894-1
For information on all Academic Press publications
visit our website at http://store.elsevier.com/
To my teachers
About the Author
Sandip Mazumder was born in Calcutta, India. Following his bachelor’s degree in
Mechanical Engineering from the Indian Institute of Technology, Kharagpur, he
started his graduate education in the autumn of 1991. In 1997, he graduated with
a PhD in Mechanical Engineering from the Pennsylvania State University. After
graduation, he joined CFD Research Corporation, where he was one of the architects
and early developers of the commercial computational fluid dynamics code CFD-
ACE +. In 2004, he joined the Ohio State University, where he presently teaches both
graduate and undergraduate courses in heat and mass transfer, thermodynamics, nu-
merical methods, and computational fluid dynamics. He is the author of over 50 jour-
nal publications, which have been cited more than 2000 times. Dr Mazumder is the
recipient of several research and teaching awards, and is a Fellow of the American
Society of Mechanical Engineers.
xi
Preface
The desire to write this book has stemmed from the realization of the undeniable ben-
efits of formalizing, organizing, and cataloging material that I have developed and,
to some extent, collected, for more than a decade as part of an annual ritual – that of
teaching an entry-level graduate course entitled “Intermediate Numerical Methods.”
Through this book, I also intend to pay tribute to many great teachers who taught me
the fundamentals of numerical methods in graduate school, but have never had the
time or inclination to put their deep knowledge of the subject in writing.
Tremendous advancement in computer hardware over the past two decades has
resulted in the proliferation of scientific and engineering analysis, and powerful user-
friendly tools that enable such analysis. Modeling and simulation has now permeated
the industry and is slowly beginning to occupy a position of importance in the design
cycle of many products. Students graduating today with a degree in engineering or
applied sciences are almost mandated by their recruiters to have a working knowl-
edge of the preferred analysis tool in their discipline.
At the heart of many engineering and scientific analyses is the solution of differ-
ential equations – both ordinary and partial differential equations (PDEs). The solu-
tion of the latter type of equation can be very challenging, depending on the type of
equation, the number of independent variables, the boundary and initial conditions,
and other factors. A variety of broadly applicable methods have been developed to
this end. Among the deterministic methods for solving differential equations, the
most popular ones are the finite element method, the finite difference method, and the
finite volume method. Each method has its own pros and cons, and shines for a cer-
tain class of problems, for reasons that are deeply rooted in the mathematical founda-
tion of the method. Although trends are slowly changing, the finite element method
has been traditionally used for solving problems in solid mechanics, while the finite
difference and finite volume methods have been traditionally used to solve problems
involving fluid flow and heat transfer. These boundaries, though, are strictly defined
by history, not by the underlying mathematics.
Although this book is supposedly a general book on numerical methods for solv-
ing PDEs, and therefore, quite rightly, is expected to cover all relevant topics, certain
practical constraints, such as the size of the book, as well as assessment of what mate-
rial exists in other texts, has prompted me to exclude many topics. For example, I have
chosen to adhere to deterministic methods only, and stochastic methods for solving
PDEs have been excluded. Perhaps, the most important topic that has been excluded
is the finite element method. This important decision was prompted by the fact that
the finite element method has a deep-rooted history, and several well-written, high-
quality texts already exist on this topic. Thus, in this book, I have chosen to focus
on the finite difference and finite volume methods. In my quest for finding a book
that adequately covers all aspects of the finite difference and finite volume methods,
I have found that either the coverage is incomplete or too primitive. For example,
xiii
xiv Preface
many books cover the finite difference method in great detail, with a passing refer-
ence to the finite volume method, almost as if these methods are synonymous, when,
in fact, the two methods are fundamentally of different philosophies. Similarly, most
existing books rarely go beyond a Cartesian stencil and, in some cases, coordinate
transformations (body-fitted mesh). The all-important topic of finite volume formu-
lation for an unstructured mesh, which is the foundation, for example, of modern
computational fluid dynamics codes, is usually missing from most texts.
The finite difference and finite volume methods have their early roots in compu-
tational fluid dynamics and computational heat transfer areas. Most texts on compu-
tational fluid dynamics commence with a discussion of these two methods. However,
it is uncommon to find ample coverage of the application of these two methods to
elliptic PDEs. Such texts, for example, dwell at length on treatment of the time-
derivative and explicit time-marching methods as applied to the Euler equation with
little or no coverage of the implicit solution of the algebraic equations that might re-
sult from discretization of an elliptic operator. While linear algebra is a routine topic
in applied mathematics texts, in my opinion, there is a dearth of textbook literature
that teaches an entry-level graduate student how to solve a relatively large system
of algebraic equations by iterative methods. It is true that with the advent of linear
algebraic equation solver suites (libraries) such as PetSc, it is no longer necessary to
develop solvers from the ground up. However, in many instances, use of these librar-
ies is overkill, and a student would, arguably, benefit from developing a simple solver
from the ground up in some situations. If nothing else, fundamental knowledge of
how iterative sparse matrix solvers and preconditioners function can be of great value
to a budding numerical analyst. After all, when all is said and done, the computer is
set the task of solving a system of linear algebraic equations, no matter what the un-
derlying method of discretization. Therefore, I consider solution of a system of linear
algebraic equations by iterative methods an important and all-encompassing topic,
and have devoted significant coverage to it.
The sequence of topics covered in this text is one that I have converged upon after
numerous iterations of teaching the aforementioned course. Chapter 1 commences
with an overview of PDEs, and the various popular methods for solving them. Chap-
ter 2 covers the fundamentals of the finite difference method. It introduces the reader
to the basic methodology of using Taylor series expansions to develop algebraic
approximations to derivatives, estimation of discretization errors, and other related
concepts. The presentation is easy enough for an entry-level graduate student in sci-
ence or engineering – one who is equipped with a basic knowledge of calculus and
algebra. All of the concepts developed in this chapter are general and also carry over
to the finite volume method in later chapters. The step that immediately follows the
derivation of the linear system of equations is their solution. Thus, Chapter 3 dwells
on solution of the linear system with an emphasis on iterative solvers. The sequence
followed here is one that increases in degree of complexity starting from point-wise
(Jacobi) iterations to conjugate gradient solvers. A benchmark boundary value prob-
lem is considered to demonstrate the pros and cons of each solver. Chapter 4 covers
the theory behind the stability and convergence of iterative solvers – the objective
Preface xv
being to elucidate the reader on the “why” of each method that was covered in the
preceding chapter. The discussion in the first half of Chapter 4, in fact, lays the
foundation for the multigrid method, which is discussed in the second half of the
same chapter. Chapter 5 switches gears and delves into parabolic and hyperbolic
PDEs, with particular emphasis on the treatment of the time derivative. Both explicit
and implicit methods are covered, and accompanied by formal stability analysis of
each method. Chapter 6 introduces the reader to the finite volume method. Bench-
mark problems are explored to demonstrate the conservation properties of the fi-
nite volume method – an issue that is often overlooked in many numerical methods
texts. Chapter 7 extends the idea of the finite volume method to control volumes
of arbitrary shape (unstructured mesh). Mathematical formulations and algorithmic
steps needed to develop an unstructured finite volume code from the ground up are
systematically laid out in this chapter. The book could have ended after Chapter 7
since Chapters 1–7 take the reader all the way from discretization of the govern-
ing PDE to the solution of the resulting algebraic equations. However, in the final
chapter (Chapter 8), I decided to include a few important topics that are encountered
routinely by practicing numerical analysts for postprocessing of solutions and for
treatment of nonlinearities: interpolation, numerical integration, and root finding of
nonlinear equations. Chapter 8 also introduces the reader to the solution of coupled
PDEs – a situation that is often encountered in practical problems. Clearly, Chapter 8
can be treated independently of the other chapters. As far as the other chapters are
concerned, I have tried to present the material in a manner that allows the chapters
to be grouped into modules. For example, Chapters 3 and 4 may be thought of as the
“solution” module, and an instructor, who may be teaching a finite element course,
may find this material useful and suitable for his or her students. One does not need
to read through Chapters 1 and 2 in order to benefit from Chapters 3 and 4. Also,
rather than focus on any particular programming language or paradigm, I have pre-
sented algorithms as bulleted lists, and in some cases, Matlab-style code snippets
that can be easily understood even by readers who have little programming experi-
ence. A conscious effort has been made to emphasize the “ground up” approach to
learning the concepts. Rather than choose examples that “advertise” methods, I have
chosen example problems that are simple enough for the reader to replicate, while
still demanding a decent level of understanding and aptitude in numerical methods
and computer programming.
Throughout the process of writing this book, my endeavor has been to present
methods and concepts that are applicable to canonical PDEs of the three types,
namely elliptic, parabolic, and hyperbolic, rather than equations with a distinctive
disciplinary flavor. For example, it is my opinion that detailed discussion of advec-
tion and the treatment of the advective flux are best suited to texts on computational
fluid dynamics rather than a text such as this one. That being the case, wherever pos-
sible, I have attempted to make a connection between the canonical PDEs and equa-
tions commonly encountered in physics and engineering. Since my own background
is in thermofluid sciences, perhaps, involuntarily, I have drawn more examples from
this discipline than any other. For that, I take full responsibility.
xvi Preface
This book is not intended for advanced numerical analysts. On the other hand, it
is not intended for undergraduate students who are encountering numerical analysis
for the very first time. It is intended for beginning graduate students in physical sci-
ences and engineering disciplines, although advanced undergraduate students may
find it equally useful. The material in this text is meant to serve as a prerequisite for
students who might go on to take additional courses in computational mechanics,
computational fluid dynamics, or computational electromagnetics. The notations,
language, and technical jargon used in the book are those that can be easily under-
stood by scientists and engineers who may not have completed graduate-level ap-
plied mathematics or computer science courses. Readers with a strong applied math-
ematics background may find this book either too slow or dilute in rigor. On the other
hand, readers with an engineering or science background are likely to find both the
pace and rigor optimum for their taste. It is my earnest desire to see this book serve
as a lifelong companion to graduate students in science and engineering disciplines.
The greatest critic of the contents of this book and the style of presentation has
been the graduate students in my classroom. Over the years, their feedback has not
only led to improvement of the technical content, but, most importantly, also pro-
vided a solid perception of the logical sequence of topics, the depth at which they
need to be covered, as well as the presentation style. I am deeply indebted to all
my students for their constructive criticism. My parents have sacrificed a lot for my
education. For that, and their unconditional love and support, I am eternally grateful.
Finally, I would like to thank my wife, Srirupa, and my son, Abhik, for their endless
love, support, and understanding during the process of writing this book. They have
always been, and will always be, the joy of my life.
Sandip Mazumder
Columbus, Ohio
2015
List of Symbols
a Coefficients in polynomial or spline [−]
i
a Subdiagonal elements of tridiagonal matrix [−]
i
a Link coefficients [−]
i
A Area [m2]
A Elements of coefficient matrix [−]
i,j
A Link coefficients [−]
k
[A] Generic coefficient matrix [−]
A, B, C Constants in general form of partial differential equation [−]
[B] Iteration or amplification matrix [−]
c Speed of wave [m/s]
c Superdiagonal elements of tridiagonal matrix [−]
i
C Amplitude of mth Fourier mode [−]
m
d Diagonal elements of tridiagonal matrix [−]
i
[D] Direction vector (CG and related methods) [−]
E, F, D, B, H Diagonals in Stone’s method [−]
G Component of mass flux vector [kg/s/m2]
I Value of integral [−]
I Integral evaluated using trapezoidal rule [−]
T
[J] Jacobian matrix of forward transformation [−]
J Determinant of Jacobian matrix of forward transformation [−]
J Components of flux vector [s−1m−2]
[J] Jacobian matrix in Newton’s method [−]
J Flux vector [s−1m−2]
K Total number of equations in linear system [−]
l Vector joining two adjacent cell centers [m]
L Length of 1D computational domain [m]
L Lagrange basis function [−] L
M Number of nodes in y direction [−]
M Number of cells in y direction [−]
c
nˆ Outward pointing unit surface normal vector [−] nˆ
N Total number of nodes or number of nodes in x direction [−]
N Total number of cells or number of cells in x direction [−]
c
p(x) Polynomial function [−]
Pe Peclet number
[Q] Source or right-hand side vector in linear system [−]
r Radial coordinate (cylindrical or spherical) [m]
r Outer radius (cylindrical coordinates) [m]
o
R Courant or CFL number [−]
[R] Residual vector [−]
R2 L2 Norm of residual vector [−]
s(x) Local spline function [−]
i
xvii