ISTANBUL TECHNICAL UNIVERSITY FACULTY OF...
Transcript of ISTANBUL TECHNICAL UNIVERSITY FACULTY OF...
ISTANBUL TECHNICAL UNIVERSITY FACULTY OF AERONAUTICS AND ASTRONAUTICS
GRADUATION PROJECT
JULY, 2020
A VERTEX BASED VELOCITY
FORMULATION FOR THE INCOMPRESSIBLE
NAVIER-STOKES EQUATIONS
Thesis Advisor: Prof. Dr. Mehmet ŞAHİN
Atakan OKAN
Department of Astronautical Engineering
Atakan OKAN
GRADUATION PROJECT
JULY, 2020
A VERTEX BASED VELOCITY
FORMULATION FOR THE INCOMPRESSIBLE
NAVIER-STOKES EQUATIONS
Thesis Advisor: Prof. Dr. Mehmet ŞAHİN
Atakan OKAN
(ID: 110150114)
Department of Astronautical Engineering
ISTANBUL TECHNICAL UNIVERSITY FACULTY OF AERONAUTICS AND ASTRONAUTICS
Thesis Advisor : Prof. Dr. Mehmet ŞAHİN ..............................
İstanbul Technical University
Jury Members : Prof. Dr. Mehmet ŞAHİN .............................
İstanbul Technical University
Asst. Prof. Dr. Ayşe Gül GÜNGÖR ..............................
İstanbul Technical University
Asst. Prof. Dr. Bayram ÇELİK ..............................
İstanbul Technical University
Atakan OKAN, student of ITU Faculty of Aeronautics and Astronautics student ID
110150114, successfully defended the graduation project entitled “A Vertex Based
Velocity Formulation For The Incompressible Navier-Stokes Equations”, which
he/she prepared after fulfilling the requirements specified in the associated
legislations, before the jury whose signatures are below.
Date of Submission : 13 July 2020
Date of Defense : 22 July 2020
iv
To my family and the scientific community of the world,
v
FOREWORD
Purpose of this thesis is to make a numerical discretization of incompressible
Navier-Stokes equations on a uniform, structured and collocated grid, practice some
basic and advanced concepts in partial differential equations, numerical methods and
linear algebra in the context of computational fluid dynamics, gain experience in
scientific computation practices and post-processing software.
I would like to thank Prof. Dr. Mehmet Şahin for his excellent support during
the preparation of this thesis as he answered all my questions on any day of the week,
troubleshooted my programming related issues and last but not the least, gave me a
“relatively simple, but challangeing enough” subject in the context of CFD which
helped me get familiar with many advanced topics and learn a great deal. I will always
remember this thesis as the first steps of my future CFD career in engineering.
I also would like to thank my family as they were always supportive of me and hoping
for my mental well-being while preparing my thesis during this unfortunate and
stressful times of our lives due to COVID-19. Therefore, I also salute all the essential
workers and health personnel of our world for their incredible selfless sacrifices they
had to perform for the world’s sake.
July 2020
Atakan OKAN
vi
vii
TABLE OF CONTENTS
Page
FOREWORD .................................................................................................v
TABLE OF CONTENTS ............................................................................ vii ABBREVIATIONS .................................................................................... viii
LIST OF TABLES ....................................................................................... ix LIST OF FIGURES .......................................................................................x
SUMMARY .................................................................................................. xi
ÖZET ......................................................................................................... xiii
1. INTRODUCTION......................................................................................1 2. GOVERNING EQUATIONS AND ASSUMPTIONS ..............................2
2.1 Non-dimensionalization of Navier-Stokes Equations ............................. 2 2.2 Stokes Flow ........................................................................................... 4
3. NUMERICAL TREATMENT OF THE EQUATIONS ...........................5 3.1 Grids ..................................................................................................... 5
3.2 Discretization of Momentum Equations ................................................. 6 3.3 Discretization of Continuity Equation .................................................... 9
4. SOLUTION OF SYSTEM OF EQUATIONS ......................................... 13 4.1 Linear Systems .....................................................................................13
4.2 Solution Methods .................................................................................15
5. NUMERICAL APPLICATION TO A BENCHMARK PROBLEM .... 16
5.1 Plane Pouseuille Flow ..........................................................................16 5.2 Programming of Numerical Algorithm .................................................17
5.2 Post-processing of Solution ..................................................................19
6. VALIDATION OF RESULTS AND CONCLUSION ............................ 23 6.1 Closed-form solution of plane Pouiseuille flow ....................................23 6.2 Conclusion ...........................................................................................25
REFERENCES ............................................................................................ 26 APPENDICES .............................................................................................. 28
APPENDIX A ............................................................................................28
CURRICULUM VITAE .............................................................................. 33
viii
ABBREVIATIONS
App : Appendix
BC : Boundary condition
CFD : Computational Fluid Dynamics
Eq : Equation
FDM : Finite Difference Method
Fig : Figure
FVM : Finite Volume Method
GMRES : Generalized Minimum Residual
KSP : Krylov subspace
MPI : Message Parsing Interface
PDE : Partial Differential Equation
PETSc : Portable Extensible Toolkit for Scientific Computation
RHS : Right hand side
ix
LIST OF TABLES
Page
Table 2.1 : Non-dimensionalization for flow variables. ............................................3
Table 5.1: Iteration parameters for solution on different grids…………….……... 19
x
LIST OF FIGURES
Page
Figure 3.1 : Simple 5x5 grid. ................................................................................... 5
Figure 3.2 : Grid for discretization of viscous terms. ................................................ 6
Figure 3.3 : Grid for discretization of dp/dx term.. ........................................................ 7
Figure 3.4 : Grid for discretization of dp/dx term. ......................................................... 7
Figure 3.5 : Grid for discretization of dp/dy term.. ........................................................ 8
Figure 3.6 : Grid for discretization of dp/dy term. ......................................................... 8 Figure 3.7 : Control volumes near the corner node.. .................................................... 10
Figure 3.8 : Discretization of Eq.3.14 for node-1. ....................................................... 11
Figure 5.1 : Physical domain representation of plane Pouseuille flow. ................... 16
Figure 5.2 : Solution for u component of velocity for a 11x11 grid.. ...................... 19
Figure 5.3 : Solution for v component of velocity for a 11x11 grid... ..................... 20
Figure 5.4 : Solution for pressure field on a 11x11 grid.......................................... 21
Figure 5.5 : Solution for pressure field on a 21x21 grid.......................................... 21
Figure 5.6 : Solution for u velocities on a 21x21 grid. ............................................ 22
Figure 5.7 : Solution for v velocities on a 21x21 grid. ............................................ 22
Figure A.1 : Declaration of variables and matrix/vector creation.… ....................... 28
Figure A.2 : Programming of x and y momentum equations.….............................. 29
Figure A.3 : Programming of continuity equation.… ............................................. 30
Figure A.4 : Solution step of algorithm.… ............................................................. 31
Figure A.5 : Printing the solution in Tecplot format.… .......................................... 32
xi
A VERTEX BASED VELOCITY FORMULATION FOR THE
INCOMPRESSIBLE NAVIER-STOKES EQUATIONS
SUMMARY
Advances in computing power has made CFD a favorable complement to the
theoretical and experimental work in fluid dynamics. proper application of CFD
theory to fluid flow problems require solid knowledge of numerical analysis and
linear algebra. Analysis of viscous incompressible flows are tricky since Navier-
Stokes equations govertn the flow and they are coupled, non-linear set of partial
differential equations where the velocity and pressure is “decoupled” and has to be
treated specially. In this thesis, a subset of viscous incompressible Navier-Stokes
equations are numerically investigated with “Re<<1” assumption. Although the flow
is considered viscous, only the frictional dissipation phenomenon is taken into
account. After writing in non-dimensional form, Stokes equations are a linear set of
equation system where each equation is elliptic and of Poisson type. Stokes flow
governed by the Stokes equations is encountered in many applications of
engineering, medicine and life sciences research. Due to the characteristic of elliptic
partial differential equations, a “marching solution” typical of parabolic and
hyperbolic partial differential equations encountered in some CFD problems is not
possible and a “simultaneous solution” has to be obtained at once for every point in
the domain of Stokes flow. In order to create a well-posed problem, proper boundary
conditions need to be provided. For numerical solution of PDEs, these continuous
equations have to be transformed by numerical approximations. In this thesis, finite
difference and finite volume approaches are used.
Momentum equations for Stokes flow are discretized using finite difference scheme.
Viscous force terms of momentum equations are discretized around inner nodes
using a second-order centered difference formula with a five-point discretization
stencil. For the pressure gradient terms, a hybrid approach is adopted where the inner
nodes that are closest to the boundary use a second order centered finite difference
scheme and rest of the inner nodes use a fourth-order centered finite difference
scheme. This is done in order to eliminate a potential checkerboard distribution
caused by odd-even decoupling of pressure field. As implied by the title of the thesis,
here also a collocated grid approach is preferred with ui,j, vi,j and pi,j all being
calculated at the same node or cell vertex for simplicity. These discretizations are of
fully implicit form since an explicit discretization of a steady system does not make
sense numerically as the time term does not exist. For discretization of continuity
equation, a finite volume approach 4 cells bounded by 4 nodes are utilized where the
Green’s theorem is also used for obtaining line integrals. By means of linear
interpolation of velocity variables u and v at the middle of each four cell’s edges
using the variables at grid nodes, equations are discretized for each node at the outer
corners of inner 4 cells.
As a result of discretization of momentum and continuity equations for the Stokes
flow, a linear system of algebraic equations is formed which can be shown with a
matrix-vector product notation. If “n” is taken as the number of nodes in both x and y
direction for a uniform square grid, A is the (3n2) x (3n2) coefficient matrix obtained
from discretized equations, x is the (3n2) x 1 solution vector that contains all
xii
unknown variables in a chosen order and b is the (3n2) x 1 right-hand-side vector that
contains boundary conditions. A is square, non-symmetric, singular, sparse matrix
that can also be shown in block form which corresponds to the generalized saddle
point problem encountered in Stokes flow problems in CFD. For solution of
algebraic equation systems, direct and iterative methods are used. In this thesis, due
to the singular nature of matrix, a direct method is not viable.
Steady and laminar plane Poiseuille flow is investigated as a benchmark problem.
For the laminar flow considered, no-slip boundary conditions were applied on the top
and bottom surfaces. Inlet and outlet boundary conditions are a parabolic u velocity
profile where u=u(y) and v=0. No pressure B.C. was provided. All BCs are Dirichet
type.
The implementation of the numerical algorithm was done with the FORTRAN
programming language while utilizing PETSc data structures and routines package
for the numerical solution of PDEs. As an iterative solver for non-symmetric linear
systems and considering it can converge even in some singular cases, GMRES
method is chosen for the solution. No preconditioning is applied. Results of
numerical algorithm are visualized with Tecplot 360 post-processing software.
Results are validated with the existing analytical solution for plane Poiseuille flow
given by Hagen-Pouiseuille equation. Therefore, it is verified that the algorithm
developed is stable and converges within a tolerance in finite number of iterations.
xiii
SIKIŞTIRILABİLİR NAVIER-STOKES DENKLEMLERİ İÇİN VERTEKS
ODAKLI BİR HIZ FORMÜLASYONU
ÖZET
Hesaplama gücündeki ilerlemeler hesaplamalı akışkanlar dinamiğini teorik ve
deneysel çalışma için uygun bir tamamlayıcı haline getirmiştir. HAD teorisinin akış
problemlerine düzgün bir şekilde uygulanması, sayısal analiz ve doğrusal cebir
konusunda sağlam bilgi gerektirir. Özellikle viskoz sıkıştırılamaz akışların analizi
zordur çünkü Navier-Stokes denklemleri akışı yönetir ve bunlar, hız ve basıncın
bağlantısız olduğu ve özel olarak ele alınması gereken, doğrusal olmayan kısmi
diferansiyel denklemler kümesidir. Bu tezde, viskoz sıkıştırılamaz Navier-Stokes
denklemlerinin bir alt kümesi “Re << 1” varsayımı ile sayısal olarak incelenmiştir.
Akış viskoz olarak kabul edilmesine rağmen, sadece sürtünme kökenli dissipatif
etkiler dikkate alınmıştır. Boyutsuz formda yazıldıktan sonra Stokes denklemleri, her
denklemin eliptik ve Poisson tipi olduğu doğrusal bir denklem sistemi kümesi haline
gelir. Stokes denklemleri tarafından yönetilen Stokes akışına mühendislik, tıp ve
yaşam bilimleri araştırmalarının birçok uygulamasında rastlanmaktadır. Eliptik kısmi
diferansiyel denklemlerin karakteristiği nedeniyle, bazı HAD problemlerinde
karşılaşılan parabolik ve hiperbolik kısmi diferansiyel denklemlerin tipik bir
“adımlama çözümü” mümkün değildir ve Stokes akışının her noktası için bir defada
“eşzamanlı bir çözüm” elde edilmesi gerekmektedir. İyi konumlanmış bir problem
yaratmak için uygun sınır koşullarının sağlanması gerekir. Kısmi diferansiyel
denklemlerin sayısal çözümü için, bu sürekli denklemlerin sayısal yaklaşımlarla
ayrıklaştırılması gerekir. Bu tezde sonlu farklar ve sonlu hacim yaklaşımları
kullanılmıştır.
Stokes akışı için momentum denklemleri sonlu farklar şeması kullanılarak ayrıştırılır.
Momentum denklemlerinin viskoz kuvvet terimleri beş noktalı ayrıklaştırma
şablonuna sahip ikinci dereceden merkezi bir fark formülü kullanılarak iç noktalar
etrafında ayrıklaştırılır. Basınç gradyanı terimleri için, sınıra en yakın iç noktaların
ikinci derece merkezli sonlu fark şeması kullandıkları ve iç noktaların geri kalanının
dördüncü dereceden merkezli sonlu fark şeması kullandığı hibrit bir yaklaşım
benimsenmiştir. Bu, basınç alanının tek-çift ayrışmasının neden olduğu potansiyel bir
“dama tahtası” dağılımını ortadan kaldırmak için yapılır. Tezin başlığında da
belirtildiği gibi, burada aynı zamanda daha basit olduğundan, akış değişkenlerinin
hücre verteks noktasında hesaplandığı “kolokasyonlu” da denen bir ızgara tercih
seçilmiştir. Daimi bir sistemin açık çözüm yöntemi ile ayrıştırılması, zaman terimi
olmadığı için sayısal olarak mantıklı olmadığından, bu ayrıklaştırma “örtük” şekilde
yapılmıştır. Süreklilik denkleminin ayrıklaştırılması için, 4 noktayla sınırlandırılmış
4 hücrenin kullanıldığı sonlu hacimler yaklaşımı kullanılmıştır. Green teoremi
kullanılarak da ayrıklaştırmanın yapıldığı çizgi integralleri elde edilmiştir. Izgara
noktalarındaki değişkenleri kullanarak, içteki her dört hücrenin de kenarlarının
ortasındaki u ve v hız değişkenlerinin doğrusal enterpolasyonu ile denklemler
ayrıklaştırılır.
Stokes akışı için momentum ve süreklilik denklemlerinin ayrıklaştırılmasının bir
sonucu olarak, bir matris-vektör çarpımı ile gösterilebilen doğrusal bir cebirsel
denklem sistemi oluşturulur. Düzgün bir kare ızgara için hem x hem de y'deki nokta
xiv
sayısı olarak “n” alınırsa A, ayrıklaştırılmış denklemlerden elde edilen (3n2) x (3n2)
katsayı matrisidir, x ise bilinmeyen tüm değişkenleri içeren (3n2) x 1 çözüm
vektörüdür ve b, sınır koşullarını içeren (3n2) x 1 sağ taraf vektörüdür. A matrisi
kare, simetrik olmayan, tekil, seyrek bir matristir. Aynı zamanda Stokes akış
problemlerinde karşılaşılan genel “eyer noktası problemi”ne karşılık gelen blok
formda da gösterilebilir. Cebirsel denklem sistemlerinin çözümü için doğrudan ve
iteratif yöntemler kullanılır. Bu tezde, matrisin tekil yapısı nedeniyle, doğrudan bir
yöntem kullanılamamaktadır.
Daimi ve laminer düzlem Poiseuille akışı bir kıyaslama problemi olarak
incelenmiştir. Ele alınan laminer akış için, üst ve alt yüzeylere “kaymazlık“sınır
koşulları uygulanmıştır. Giriş ve çıkış sınır koşulları, u = u (y) ve v = 0 olan bir
parabolik u hız profilidir. Basınç içen sınır koşulu verilmemiştir. Tüm sınır koşulları
Dirichet tipindedir.
Sayısal algoritmanın pratik uygulaması, kısmi diferansiyel denklemlerin sayısal
çözümü için PETSc veri yapıları ve algoritmaları paketi kullanılarak ve FORTRAN
programlama dili ile yapıldı. Simetrik olmayan doğrusal sistemler için iteratif bir
çözücü, bazı tekil durumlarda bile çözüme yakınsadığı göz önüne alınıp GMRES
yöntemi olarak seçilmiştir. Hiçbir "ön koşullandırıcı” uygulanmamıştır. Sayısal
algoritmanın sonuçları Tecplot 360 post-proses yazılımı ile görselleştirilmiştir.
Sonuçlar Hagen-Pouiseuille denklemi ile verilen düzlem Poiseuille akışı için analitik
çözüm ile doğrulanmıştır. Bu nedenle, geliştirilen algoritmanın kararlı olduğu ve
sınırlı sayıda iterasyonda bir tolerans dahilinde sonuca yakınsadığı görülmektedir.
1
1. INTRODUCTION
Owing to the advance in computing power since 1960s for numerical
calculations on computers, computational fluid dynamics (CFD) has almost become a
discipline of its own along the fluid dynamics and aerodynamics branches of physics.
It has become a favorable complement to the common issues in fluid dynamics and
aerodynamics research when either analytical solutions either do not exist or difficult
to obtain to a problem or the practical wind/waterr tunnel experiments are costly.
However, proper application of CFD theory to fluid flow problems require significant
effort in obtaining sufficient knowledge of numerical analysis and linear algebra
concepts. CFD is by no means equal to “clicking buttons and obtaining colorful
results” by commercial/open-source software programs. This is evident in the analysis
of viscous incompressible flows where the compressibility effects are neglected and
energy equation is not necessary to solve the velocity and pressure field. This
seemingly “innocent” type of flow is governed by the Navier-Stokes equations which
are coupled, non-linear set of partial differential equations where the velocity and
pressure is “decoupled” and usually has to be treated specially by means of choosing
special higher-order discretization methods that result in stable divergence-free
solutions [7] or by using pressure correction methods that utilize the momentum
equations where the pressure field satisfies the continuity equation as found in the CFD
literature [6].
This thesis also tries to obtain a stable and divergence-free numerical solution
to the steady incompresible Navier-Stokes equations on a uniform, square and
collocated grid. Thesis is outlined as follows: in 2nd section, Navier-Stokes are non-
dimensionalized and Stokes flow assumption is made. In 3rd section, momentum and
continuity equations are discretized on collocated grids. In 4th section, solution
methods of the discretized set of algebraic equations and matrix properties are
discussed. In 5th section, plane Poiseuille flow is considered as a practical numerical
application case and programming of numerical algorithm is described. Finally, in the
6th section numerical solutions are validated with closed-form analytical solutions.
2
2. GOVERNING EQUATIONS AND ASSUMPTIONS
2.1. Non-dimensionalization of Navier-Stokes Equations
Governing equations for a viscous, incompressible flow are the Navier-Stokes
equations for momentum conservation and continuity equation for mass conservation.
Assuming a steady flow of a Newtonian fluid in the absence of body forces, the
equations in 2D can be written in Cartesian form as follows:
𝜌 ( 𝑢𝜕𝑢
𝜕𝑥+ 𝑣
𝜕𝑢
𝜕𝑦 ) = −
𝜕𝑝
𝜕𝑥+ 𝜇 (
𝜕2𝑢
𝜕𝑥2 + 𝜕2𝑢
𝜕𝑦2 ) (2.1)
𝜌 ( 𝑢𝜕𝑣
𝜕𝑥+ 𝑣
𝜕𝑣
𝜕𝑦 ) = −
𝜕𝑝
𝜕𝑦+ 𝜇 (
𝜕2𝑣
𝜕𝑥2 + 𝜕2𝑣
𝜕𝑦2 ) (2.2)
𝜕𝑢
𝜕𝑥+
𝜕𝑣
𝜕𝑦= 0 (2.3)
where u (m/s) and v (m/s) are the x and y components of velocity vector u = ui + vj, 𝜌
(𝑘𝑔
𝑚3 ) is the density, p (𝑁
𝑚2 ) is the pressure and 𝜇 (𝑘𝑔
𝑚.𝑠 ) is the dynamic viscosity with
a constant value (no temperature dependence). Due to this assumption, the energy
equation is decoupled from the above set of equations and it is not required for velocity
and pressure field solutions. Eqs 2.1 to 2.3 are a system of coupled partial differential
equations whose “general” analytical solution hasn’t been found yet.
Here, the non-linear momentum conservation equations (2.1-2.2) are
essentially “force balance” equations where the convective terms on the left-hand side
are inertial terms (acceleration), whereas the pressure and viscous terms on the right-
hand side denote the force terms. Although the flow is considered viscous, only the
frictional dissipation is taken into account. Other dissipative phenomena such as
thermal conduction or mass diffusion are assumed to be non-existent. Furthermore, for
this thesis flows where viscous effects are much more strong compared to inertial
forces (Re<<1 or creeping flows) are considered as a special case.
3
Based on this, a non-dimensionalization procedure can be applied to the
equations above to get rid of the need for dealing with consistent units during
programming of numerical analysis. For flows where viscous effects are dominant, the
appropriate characteristic scaling factors [1] for non-dimensionalization are shown in
Table 2.1.
Table 2.1: Non-dimensionalization for flow variables.
Characteristic scale Dimensionless form of variables
Velocity U (free-stream) u* = u/U , v* = v/U
Length L (characteristic length) x* = x/L, y* = y/L
Pressure 𝜇𝑈
𝐿 (for Re<<1 flows) p* =
𝑝𝐿
𝜇𝑈
After substituting the characteristic scales into the above equations, the intermediate
step for x-momentum equation is given by Eq. 2.4:
( 𝜌𝑈2
𝐿 ) ( 𝑢∗ 𝜕𝑢∗
𝜕𝑥∗+ 𝑣∗ 𝜕𝑢∗
𝜕𝑦∗ ) = (
𝜇𝑈
𝐿2 ) (− 𝜕𝑝∗
𝜕𝑥∗) + (
𝜇𝑈
𝐿2 ) ( 𝜕2𝑢∗
𝜕𝑥∗2 + 𝜕2𝑢∗
𝜕𝑦∗2 ) (2.4)
Following through by grouping terms similarly for y-momentum equation and
continuity equation, result is the following non-dimensional versions of the Navier–
Stokes and continuity equations in Cartesian form:
𝑅𝑒 ( 𝑢∗ 𝜕𝑢∗
𝜕𝑥∗ + 𝑣∗ 𝜕𝑢∗
𝜕𝑦∗ ) = − 𝜕𝑝∗
𝜕𝑥∗ + ( 𝜕2𝑢∗
𝜕𝑥∗2 + 𝜕2𝑢∗
𝜕𝑦∗2 ) (2.5)
𝑅𝑒 ( 𝑢∗ 𝜕𝑣∗
𝜕𝑥∗ + 𝑣∗ 𝜕𝑣∗
𝜕𝑦∗ ) = − 𝜕𝑝∗
𝜕𝑦∗ + ( 𝜕2𝑣∗
𝜕𝑥∗2 + 𝜕2𝑣∗
𝜕𝑦∗2 ) (2.6)
𝜕𝑢∗
𝜕𝑥∗ +𝜕𝑣∗
𝜕𝑦∗ = 0 (2.7)
where the dimensionless Reynolds number denoted by Re is calculated as:
𝑅𝑒 =𝜌𝑈𝐿
𝜇 (2.8)
4
For flows where viscous effects are dominant, taking the limit Re → 0 in Eqs. 2.5 and
2.6. leads to the non-dimensional steady Stokes equations written below.
− ( 𝜕2𝑢∗
𝜕𝑥∗2 + 𝜕2𝑢∗
𝜕𝑦∗2 ) + 𝜕𝑝∗
𝜕𝑥∗ = 0 (2.9)
− ( 𝜕2𝑣∗
𝜕𝑥∗2 + 𝜕2𝑣∗
𝜕𝑦∗2 ) + 𝜕𝑝∗
𝜕𝑦∗ = 0 (2.10)
In contrast to the non-linear nature of full Navier-Stokes equations, Stokes
equations are in linear form due to the fact that convective terms which are the source
of non-linearity are neglected in the limit Re 0. This provides a great simplification
of the discretization of equations. In addition, according to the quasi-linear partial
differential equation classification method [2], Eqs 2.9-2.10 are of elliptic type, in the
form of the Poisson equation.
2.2. Stokes Flow
Stokes flow or creeping flow governed by the Stokes equations is encountered
in many applications of engineering, medicine and life sciences research. Medical
applications [1], swimming of microorganisms [3], microfluidic device flows, viscous
polymer flows, lava flow and lubrication [4] are noteworthy examples.
It should be noted that due to the characteristic of the governing elliptic partial
differential equations, any disturbance in the Stokes flow domain is felt by all other
points immediately which implies that the solution which is sought is also influenced
by the entire boundary of the flow domain. This is significant since in this case, a
“marching solution” typical of parabolic and hyperbolic partial differential equations
encountered in some CFD problems is not possible and a “simultaneous solution” has
to be obtained at once for every point in the domain [5,6]. Therefore, in order to create
a well-posed problem, proper boundary conditions need to be provided and these can
be either of Dirichet, Neumann or mixed type [6]. Finally, since the steady Stokes flow
is of concern, this is a simple equilibrium boundary value problem - not an initial value
problem - and initial conditions are not required.
5
3. NUMERICAL TREATMENT OF THE EQUATIONS
3.1. Grids
For numerical solution of partial differential equations on computers, these
continuous equations have to be transformed into the discrete realm of computers by
numerical approximations. This can be accomplished by widely used methods such as
finite difference, finite volume, finite element methods and spectral methods. In this
thesis, finite difference and finite volume approaches are used.
For discretization of PDEs, a computational grid which consists of a finite number
of nodes is needed to represent the physical flow domain. Depending on the nature of
equation, grid nodes that lie on the same line (either vertically or horizontally) can be
thought of indicating a layer of either spatial direction (x, y) or time (n). Each unknown
or known variable can be assigned to a distinct node after discretization. In the case of
steady Stokes flow, since there is no concept of time evolution, all nodes indicate the
spatial coordinates of flow variables such as velocity and pressure on the discrete
domain. As shown in Fig. 3.1. for a simple square flow domain, while the outer blue
nodes indicate the known boundary conditions of the physical flow domain, inner
orange nodes are used for housing the unknown variables to be solved.
Figure 3.1: Simple 5x5 grid.
6
The choice of grid is not limited to the orthogonal and structured grid shown in
Fig. 3.1. For flow domains with involving more complex geometries, unstructured
grids provide flexibility and avoid Cartesian grids’ limitations encountered with
curvilinear boundaries [6]. In addition, stretched grids are preferred where the
gradients of certain flow variables are large in very small distances (i.e. boundary layer
flows) and non-uniform spacing is needed in certain regions of the computational flow
domain for finer solution [5]. This is accomplished by coordinate transformation where
the irregular physical coordinate system is mapped into a computational Cartesian
coordinate system [6].
3.2. Discretization of Momentum Equations
Momentum equations for Stokes flow are discretized using finite difference
scheme. Eqs. 2.8 and 2.9 are repeated below. The goal is to discretize the PDEs such
that the flow variables u(x,y), v(x,y) and p(x,y) are represented by their discrete and
approximate counterparts ui,j , vi,j and pi,j at each node and create a system of
algebraic equations to be solved simultaneously.
− ( 𝜕2𝑢∗
𝜕𝑥∗2 + 𝜕2𝑢∗
𝜕𝑦∗2 ) + 𝜕𝑝∗
𝜕𝑥∗ = 0 (3.1)
− ( 𝜕2𝑣∗
𝜕𝑥∗2 + 𝜕2𝑣∗
𝜕𝑦∗2 ) + 𝜕𝑝∗
𝜕𝑦∗ = 0 (3.2)
Figure 3.2: Grid for discretization of viscous terms.
Δx
Δy i,j
i+1,j
i,j-1
i,j+1
i-1,j
7
As shown by the commonly used five-point finite difference stencil on Fig.
3.2., viscous force terms of x and y momentum equations are discretized around
inner nodes using a second-order centered difference formula as in Eq. 3.3 and 3.4.
Star (*) notation for non-dimensional variables are dropped for easier reading.
− ( 𝝏𝟐𝒖
𝝏𝒙𝟐 + 𝝏𝟐𝒖
𝝏𝒚𝟐 ) = − (𝒖𝒊+𝟏,𝒋 − 𝟐𝒖𝒊,𝒋 + 𝒖𝒊−𝟏,𝒋
∆𝒙𝟐 +𝒖𝒊,𝒋+𝟏 − 𝟐𝒖𝒊,𝒋 + 𝒖𝒊,𝒋−𝟏
∆𝒚𝟐) + 𝑶(∆𝒙𝟐, ∆𝒚𝟐) (3.3)
− ( 𝝏𝟐𝒗
𝝏𝒙𝟐 + 𝝏𝟐𝒗
𝝏𝒚𝟐 ) = − (𝒗𝒊+𝟏,𝒋 − 𝟐𝒗𝒊,𝒋 + 𝒗𝒊−𝟏,𝒋
∆𝒙𝟐 +𝒗𝒊,𝒋+𝟏 − 𝟐𝒗𝒊,𝒋 + 𝒗𝒊,𝒋−𝟏
∆𝒚𝟐) + 𝑶(∆𝒙𝟐, ∆𝒚𝟐) (3.4)
Taking advantage of the uniform grid (Δx = Δy), Eqs 3.3-3.4 can be further
simplified by combining terms as follows where O(Δx2) is order of approximation.
− ( 𝝏𝟐𝒖
𝝏𝒙𝟐 + 𝝏𝟐𝒖
𝝏𝒚𝟐 ) = − (𝒖𝒊+𝟏,𝒋 + 𝒖𝒊,𝒋+𝟏− 𝟒𝒖𝒊,𝒋 + 𝒖𝒊,𝒋−𝟏+ 𝒖𝒊−𝟏,𝒋
∆𝒙𝟐) + 𝑶(∆𝒙𝟐) (3.5)
− ( 𝝏𝟐𝒗
𝝏𝒙𝟐 + 𝝏𝟐𝒗
𝝏𝒚𝟐 ) = − (𝒗𝒊+𝟏,𝒋 + 𝒗𝒊,𝒋+𝟏− 𝟒𝒗𝒊,𝒋 + 𝒗𝒊,𝒋−𝟏+ 𝒗𝒊−𝟏,𝒋
∆𝒙𝟐) + 𝑶(∆𝒙𝟐) (3.6)
For the pressure gradient term discretization, a hybrid approach is adopted where the
inner nodes that are closest to the boundary use a second order centered finite
difference scheme as in Eqs. 3.9. and 3.10 and rest of the inner nodes use a fourth-
order centered finite difference [7] as in Eqs. 3.7. and 3.8. As shown in Figs. 3.3. to
3.6 for a 7x7 uniform grid in the discretization of pressure gradient terms, nodes in
red are where higher order difference scheme is centered at and the green nodes are
where the lower order scheme is centered at.
8
Red and green nodes are not used in the difference schemes themselves. The pink
shades denote the area that includes all the nodes for centering the schemes at based
on whether the nodes are close to boundary or not.
𝝏𝒑
𝝏𝒙=
( −𝒑𝒊+𝟐,𝒋 + 𝟖 𝒑𝒊+𝟏,𝒋 − 𝟖 𝒑𝒊−𝟏,𝒋 + 𝒑𝒊−𝟐,𝒋 )
𝟏𝟐(∆𝒙)+ 𝑶(∆𝒙𝟒) (3.7)
𝝏𝒑
𝝏𝒚=
(−𝒑𝒊,𝒋+𝟐 + 𝟖 𝒑𝒊,𝒋+𝟏− 𝟖 𝒑𝒊,𝒋−𝟏+ 𝒑 𝒊,𝒋−𝟐)
𝟏𝟐(∆𝒚)+ 𝑶(∆𝒚𝟒) (3.8)
𝝏𝒑
𝝏𝒙=
( 𝒑𝒊+𝟏,𝒋 − 𝒑𝒊−𝟏,𝒋 )
𝟐(∆𝒙)+ 𝑶(∆𝒙𝟐) (3.9)
𝝏𝒑
𝝏𝒚=
( 𝒑𝒊,𝒋+𝟏 − 𝒑𝒊,𝒋−𝟏 )
𝟐(∆𝒚)+ 𝑶(∆𝒚𝟐) (3.10)
9
Reason for using a fourth-order scheme for some nodes in pressure terms is to
eliminate a potential checkerboard distribution caused by odd-even decoupling of
pressure field when both continuity and pressure gradient in the momentum equation
are discretized with second-order centered differences [7,8]. One way of organizing
variables in the grid is placing all variables at the same node.
As implied by the title of the thesis, here also this collocated grid approach is
preferred with ui,j, vi,j and pi,j all being calculated at the same node or cell vertex for
simplicity, although it may lead to nonsensical pressure and velocity oscillations in
incompressible flows [6]. Using a staggered grid where pressures could be placed at
the middle of cell edges and velocities at the vertices could help, however it is more
difficult to program [2]. Finally, these discretizations are of fully implicit form since
an explicit discretization of a steady system does not make sense numerically as the
time term does not exist.
3.3. Discretization of Continuity Equation
Non-dimensional continuity equation which is repeated below (without the star
notation) is discretized with finite volume approach.
𝝏𝒖
𝝏𝒙+
𝝏𝒗
𝝏𝒚= 𝟎 (3.11)
In order to utilize the cell partition approach near the corner node of a zoomed
portion of a uniform grid as shown in Fig. 3.7, Green’s theorem was used as follows.
Green’s theorem relates a line integral around a closed curve C and a double integral
(the convention of positive orientation is anti-clockwise as in Fig. 3.7), Green’s
theorem is given by Eq. 3.12. over the region S bounded by that curve. In the case
10
there are functions P and Q with continous partial derivatives over that region and
the curve is positively oriented [9]
∮ 𝑷(𝒙, 𝒚)𝒅𝒙 + 𝑸(𝒙, 𝒚)𝒅𝒚 = ∬ ( 𝝏𝑸
𝝏𝒙𝑺
𝑪−
𝝏𝑷
𝝏𝒚 ) 𝒅𝒙𝒅𝒚 (3.12)
Figure 3.7: Control volumes near the corner node.
Variables u and v in continuity equation are assumed to have continuous
partial derivatives and can be used in place of P and Q functions since the right hand
of Green’s theorem is similar to the form of Eq. 3.11. It can be cast into the form of
the left hand side of Eq. 3.12 by multiplying Eq. 3.11 with “dxdy” in both sides and
taking the surface integral. Since the surface integral is a definite integral over each
cell, the right hand side “0” is unaffected and we can write:
∮ −𝒗𝒅𝒙 + 𝒖𝒅𝒚 = ∬ ( 𝝏𝒖
𝝏𝒙𝑺
𝑪−
𝝏(−𝒗)
𝝏𝒚 ) 𝒅𝒙𝒅𝒚 = 𝟎 (3.13)
∮ 𝒖𝒅𝒚 − ∮ 𝒗𝒅𝒙 𝑪
𝑪
= 𝟎 (3.14)
Therefore, by means of linear interpolation of velocity variables u and v at the middle
of each four cell’s edges (shown in Fig. 3.8 as “thick” red arrows by utilizing
interpolated values at white nodes) using the variables at grid nodes as shown by the
Node - 1
(i=1, j=1)
Cell - 3
Cell - 2 Cell - 1
Cell - 4 Node - 3
(i=2, j=2)
Node - 4
(i=1, j=2)
Node - 2
(i=2, j=1)
11
thinner arrows in Fig. 3.8., Eq. 3.14 can be discretized using finite volume approach
as follows. (For easier reading, here “ij” index notation is dropped and node based
notation is used. i.e. u1,1 = u1 and u2,2 = u3 etc.)
Figure 3.8: Discretization of Eq.3.14 for cell-1.
For node-1 based on Fig. 3.6. and Eq. 3. 14 using anti-clockwise positive
orientation for the line integrals over the cell edges:
1
2[
𝑢1+𝑢2
2+
𝑢1+𝑢2 + 𝑢3+𝑢4
4 ] ∆𝑦 –
1
2[ 𝑢1 +
𝑢1+𝑢4
2 ] ∆𝑦
− 1
2[ 𝑣1 +
𝑣1+𝑣2
2 ] ∆𝑥 +
1
2[
𝑣1+𝑣4
2+
𝑣1+𝑣2 + 𝑣3+𝑣4
4 ] ∆𝑥 = 0 (3.15)
Cell-1
v1
u1 u2
u4 u3
v3 v4
v2
12
Rearranging terms in Eq. 3.15 gives the discretized continuity equation for Node-1:
Node-1: 𝑢1
2(
∆𝑦
4− ∆𝑦) +
𝑢2
2(
∆𝑦
2+
∆𝑦
4) +
𝑢3
2(
∆𝑦
4) +
𝑢4
2(
∆𝑦
4−
∆𝑦
2) +
𝑣1
2(−∆𝑥 +
∆𝑥
4 ) +
𝑣2
2(−
∆𝑥
2+
∆𝑥
4) +
𝑣3
2(
∆𝑥
4) +
𝑣4
2(
∆𝑥
2+
∆𝑥
4) = 0 (3.16)
Using similar linear interpolation approach with their respective cells for nodes 2,3
and 4 and skipping intermediate steps, the resultant discretized continuity equations
are shown in Eqs. 3.17 to 3.19.
Node-2 : 𝑢1
2(−
∆𝑦
2−
∆𝑦
4) +
𝑢2
2(∆𝑦 −
∆𝑦
4) +
𝑢3
2(
∆𝑦
2−
∆𝑦
4) +
𝑢4
2(−
∆𝑦
4) +
𝑣1
2(−
∆𝑥
2+
∆𝑥
4 ) +
𝑣2
2(−∆𝑥 +
∆𝑥
4) +
𝑣3
2(
∆𝑥
2+
∆𝑥
4) +
𝑣4
2(
∆𝑥
4) = 0 (3.17)
Node-3: 𝑢1
2(−
∆𝑦
4) +
𝑢2
2(
∆𝑦
2−
∆𝑦
4) +
𝑢3
2(∆𝑦 −
∆𝑦
4) +
𝑢4
2(−
∆𝑦
2−
∆𝑦
4) +
𝑣1
2(−
∆𝑥
4 ) +
𝑣2
2(−
∆𝑥
4−
∆𝑥
2) +
𝑣3
2(−
∆𝑥
4+ ∆𝑥) +
𝑣4
2(−
∆𝑥
4+
∆𝑥
2)= 0 (3.18)
Node-4: 𝑢1
2(
∆𝑦
4−
∆𝑦
2) +
𝑢2
2(
∆𝑦
4) +
𝑢3
2(
∆𝑦
4+
∆𝑦
2) +
𝑢4
2(
∆𝑦
4− ∆𝑦) +
𝑣1
2(−
∆𝑥
2−
∆𝑥
4) +
𝑣2
2(−
∆𝑥
4) +
𝑣3
2(−
∆𝑥
4+
∆𝑥
2) +
𝑣4
2(−
∆𝑥
4+ ∆𝑥)=0 (3.19)
13
4. SOLUTION OF SYSTEM OF EQUATIONS
4.1. Linear Systems
As a result of discretization of momentum and continuity equations for the Stokes
flow, a linear system of algebraic equations is formed which can be shown with a
matrix-vector product notation as in Eq. 4.1.
[𝑨] ∗ 𝒙 = 𝒃 (4.1)
If “n” is taken as the number of nodes in both x and y direction for a uniform square
grid, in Eq. 4.1 [A] is the (3n2) x (3n2) coefficient matrix obtained from discretized
equations, x is the (3n2) x 1 solution vector that contains all unknown variables ui,j , vi,j
and pi,j in the desired order and b is the (3n2) x 1 right-hand-side vector that contains
boundary conditions applied to the discretized equations.
In this case, vector x also contains variables on boundary nodes although they
are already known. Since a uniform square grid which involves the boundary nodes is
used for the discretization of equations, [A] is also a square matrix. For clarity, [A] in
Eq. 4.1 can be shown as a collection of square sub-matrices in the block matrix form
as in Eq. 4.2:
[𝑨𝟏𝟏 𝟎 𝑨𝟏𝟑
𝟎 𝑨𝟐𝟐 𝑨𝟐𝟑
𝑨𝟑𝟏 𝑨𝟑𝟐 𝟎] [
𝒖𝒗𝒑
] = [𝒃𝒄𝒃𝒄𝟎
] (4.2)
14
where A11 and A22 contain the coefficients of viscous terms in discretized momentum
equations, A13 and A23 contain the pressure term coefficients, A31 and A32 contain
continuity equation coefficients. This form also fits the generalized saddle point
problem classification usually encountered in the solution of linearized Navier-Stokes
equations [12] of which Stokes equation is a subset.
In addition, [A] is non-symmetric for reasons such as different choices of
numerical schemes for momentum and continuity equations (FDM vs FVM),
discretization of various terms in the momentum equations with changing order of
approximation (4th vs 2nd order in pressure terms) and finally the involvement of
boundary nodes during the discretization instead of using only the inner nodes.
Furthermore, [A] is a singular matrix due to the fact that during the discretization of
momentum equations, neither viscous nor pressure terms involve the corner nodes (in
contrast to the finite volume approach used in the continuity equation) which results
in 4 columns of matrix [A] being all zeros – hence the determinant of [A] being 0 -
due to lack of contribution from the 4 corner nodes.
Another property of [A] is that – as commonly encountered in many CFD
problems – it is a sparse matrix with very few non-zero elements compared to its size.
This can be easily seen as during the discretization with finite difference for
momentum equations, viscous terms use a 5-point stencil and pressure terms use a 4-
point stencil for inner nodes (at maximum). This means that for each row of the
coefficient matrix [A] resulting from discretization of Stokes flow, number of nonzeros
can be no more than “9”, compared to the row length of [A] which is 3n2. Considering
the fact that “n” has to be at least 5 in order to use a 4th order difference scheme for
inner nodes, minimum row length of [A] is “75” which shows how sparsely distributed
the nonzero elements are. As will be utilized during the next chapter, efficient
strategies of storage schemes are utilized on many CFD solvers which take advantage
of the sparse nature of the matrices, since storing large amount of zeros is considered
unnecessary especially as the matrix sizes get larger [10].
15
4.2. Solution Methods
Two basic approaches for solving Eq. 4.1 are direct and iterative methods.
Although the direct methods give an exact solution up to the machine epsilon in finite
number of steps [6], common methods like Gauss elimination can be computationally
very expensive as the matrix sizes get larger (unless the matrix has a special band-
diagonal structure that can be efficiently utilized by methods such as Thomas
algorithm) and they are prone to rounding-error accumulations (unless pivoting
methods are used) [11]. In this thesis, due to the singular nature of matrix, a direct
method is not viable (unless a pressure fixing method is applied to the bottom-right
“zero” block of coefficient matrix [A] to get rid of singularity). On the other hand,
iterative methods rely on providing an initial guess as an approximate solution, try to
converge to an approximate solution of equations iteratively until the convergence
criterion is met for a given tolerance. They tend to use the sparsity of matrices more
efficiently, reducing computational costs as well [6].
16
5. NUMERICAL APPLICATION TO A BENCHMARK PROBLEM
5.1. Plane Poiseuille Flow
For this thesis, numerical application of the discretized equations was made on a
CFD benchmark problem commonly used for testing new solution algorithms due to
its simplicity: laminar steady plane Poiseuille flow. This flow describes a pressure-
driven steady, incompressible flow of a Newtonian fluid between two infinitely-long
flat plates. Physical domain with appropriate boundary conditions for the application
of numerical analysis to the problem is shown in Fig. 5.1.
Figure 5.1: Physical domain representation of plane Pouseuille flow.
Although the plane Pouiseuille flow equations which will be derived in the next
chapter is for flow between infinitely-flat plates, for practical analysis purposes a finite
domain -which can be thought of as a small portion of the infinitely long hypothetical
domain- needs to be used. A unit square domain is preferred for simplicity, where
length and height is donated by L and H, respectively, as in Fig. 5.1. As mentioned in
the previous sections, an elliptic equation requires proper B.Cs on all boundary points.
H = 1
L = 1
No-slip B.C.:
u = v = 0
v=0 v=0 Parabolic
inlet B.C.
for “u”
Parabolic
outlet B.C.
for “u”
No-slip B.C.:
u = v = 0
y=H
y=0
17
For the laminar flow considered, no-slip boundary conditions were applied on the
top and bottom surfaces. In addition, as will be verified in next chapter, a laminar
steady plane Poiseuille flow has a parabolic velocity profile and essentially a one-
dimensional flow. Therefore, the choice for the inlet and outlet boundary condition are
not no-slip BCs since domain has no rigid boundaries, instead they are special: a
parabolic u velocity profile where u=u(y) and v=0. No pressure B.C. was provided. It
should be noted that all the BCs that were provided are Dirichet type.
5.2. Programming of Numerical Algorithm
The implementation of the numerical algorithm was done with the FORTRAN
programming language while utilizing PETSc data structures and routines package
developed by Argonne National Laboratory for the numerical solution of PDEs. The
package is used especially for large-scale applications that run on parallel processes
for efficiency [13]. It provides matrix and vector assembly routines and linear system
solvers based on the iterative Krylov subspace methods. The full source-code for
numerical application to plane Poiseuille flow problem which is provided in
Appendix-A is briefly described below.
In App.-A, lines 1-25 in Fig. A-1 shows the declaration of variables for sizes and
names of coefficient matrix and right hand side vector, index variables for looping
over discretized momentum and continuity equations, and variables for certain
PETSc objects that handle matrix/vector assembly routines and Krylov subspace
solvers, and include files for all these objects.
In lines 27-50 after custom initialization of PETSc and message parsing interface
MPI (although a parallel process is not used), vectors, matrices and the numerical
domain are sized. Then, a sparse matrix assembly routine is called to create the
square coefficient matrix [A] which utilizes the efficient storage schemes
(compressed sparse raw format [13]) mentioned before and finally the vectors for
right-hand-side and eigenvalue calculations are created.
18
In Fig. A-2, lines 53-132 show the programming-wise very similar x and y
momentum conservation equations for steady Stokes flow, applied to the laminar
plane Pouiseuille flow. Firstly, the boundary nodes are handled in lines 53-67 by
applying the parabolic velocity profile BCs at the inlet and outlet nodes and the no-
slip BCs at the top and bottom nodes (including the corner nodes of numerical
domain). It is of critical importance that a great attention should be payed while
handling the indices of looping since the node numbering indices of numerical
domain and programming indices for matrix elements do not correspond to each
other. For instance, the top-left corner (0,0) index of [A] matrix in computer
programming sense is the same as the bottom-left corner of the numerical domain
where imin =1 and jmin = 1.
After boundary nodes, the inner nodes where the equations are discretized are
handled. Programming of Eqs. 3.5-3.6 for Laplace equation of viscous terms are
shown in lines 107-112 and Eqs. 3.7 and 3.9 for pressure gradient term of x-
momentum equation are shown in lines 114-132. Details of y-momentum equation
are omitted due to its similarity to the programming of x-momentum equation.
Biggest difference to note is the lack of a need for velocity profile BC in y-
momentum equation due to the all-zero BCs for v velocities.
In Fig. A-3, lines 134-189 show the programming of continuity equation with
finite volume method discretization. Although rest of the nodes are not shown in this
thesis for brevity, Eqs. 3.15-3.19 that describe the discretization for bottom-left node
are shown in lines 134-152. Since no pressure boundary conditions are used for the
problem, corresponding 0 elements of the RHS of continuity equation do not need to
be explicitly set to 0 in PETSc and thus deliberately omitted in programming.
In Fig. A-4, lines 191-207 show the custom calls for assembly of coefficient
matrix and right-hand-side vector after the elements corresponding to the discretized
equations are assigned in Figs. A-2 & A-3. Then, in lines 209-228, linear system
solver is chosen from KSP methods in PETSc. As an iterative solver for non-
symmetric linear systems and considering it can converge even in some singular
cases [15], GMRES method [14] is chosen for the solution. No preconditioning is
applied as it is usually preferred in the solution of linear systems for accelerating the
convergence rate [8,10].
19
Lines 230-247 show the solution is obtained to the Eq. 4.1 using [A] and RHS
vector. Terms related to iterative methods such as iteration number where upper limit
is set as 5000 and residual norm which is used for convergence criteria based on the
tolerance set above as 10E-10 are also calculated. Finally, eigenvalues are computed
for the [A] and it is confirmed that matrix in singular -as mentioned before- due to
the zero eigenvalues appearing in the solution. In lines 249-261, after the system is
solved, the solution vector “RH1” is cast into another vector for writing into files and
all the variables, vectors, matrices and objects used for the solution are destroyed.
Finally, the solution has to be converted into “.dat” format in a special way used by
Tecplot 360 post-processing software described in [16].
5.3. Post-processing of Solution
Figure 5.2: Solution for u component of velocity for a 11x11 grid.
20
Using Tecplot 360, solutions obtained for the non-dimensional flow variables
u, v and p (dropping the * notation) on a 11x11 and a finer 21x21 grid are shown
in Figs. 5.2 to 5.7. Although all plots are contour plots, u-velocity plots in Figs.
5.2 and 5.7 are combined with vector plots to show the parabolic u-velocity profile
better. One thing to consider is the corner nodes of the grid which shows abrupt
changes in pressure values since discretization do not involve those nodes, hence
their values are disconnected from the rest of pressure field due to lack of
communication. Table 5.1 shows the iteration and convergence related parameters
for the solution. As expected, a finer grid takes longer for the algorithm to converge
to a solution. Results shown in the plots are verified in the next chapter.
Table 5.1: Iteration parameters for solution on different grids.
Grid size Maximum set
tolerance
Maximum set
iteration
number
Residual norm
of solution
Iteration number
at convergence
11 x 11 1E-10 5000 9.4742E-011 493
21 x 21 1E-10 5000 1.15422E-011 1747
Figure 5.3: Solution for v component of velocity for a 11x11 grid.
21
Figure 5.4: Solution for pressure field on a 11x11 grid.
Figure 5.5: Solution for pressure field on a 21x21 grid.
22
Figure 5.6: Solution for u velocities on a 21x21 grid.
Figure 5.7: Solution for v velocities on a 21x21 grid.
23
6. VALIDATION OF RESULTS AND CONCLUSION
6.1. Closed-form solution of plane Poiseuille flow
The original set of Navier-Stokes equations are a coupled set of non-linear partial
differential equations and there exists only a few special cases where a closed-form
analytical expression for flow variables can be obtained [17]. This usually occurs due
to geometric properties of the flow domain which allow certain terms to become 0 in
the equations, therefore lend the system to a simpler treatment beyond numerical
discretization and linear algebra solution methods which the current thesis tries to
implement. The originally derived non-dimensional governing equations of steady
Stokes flow in 2D (Eqs. 2.8-2.9) are repeated below.
0 = − 𝜕𝑝∗
𝜕𝑥∗ + ( 𝜕2𝑢∗
𝜕𝑥∗2 + 𝜕2𝑢∗
𝜕𝑦∗2 ) (6.1)
0 = − 𝜕𝑝∗
𝜕𝑦∗ + ( 𝜕2𝑣∗
𝜕𝑥∗2 + 𝜕2𝑣∗
𝜕𝑦∗2 ) (6.2)
𝜕𝑢∗
𝜕𝑥∗ +𝜕𝑣∗
𝜕𝑦∗ = 0 (6.3)
Plane Poiseuille flow is also one of those special cases where due to the the fact that it
is a flow between “infinitely-long” parallel plates, the velocity component u and v do
not change in the x-direction (the flow direction). Therefore, for a plane Poiseuille
flow all the partial derivative terms of velocity components with respect to x become
zero. After cancelling terms and dropping the star notation, Eqs. 6.1-6.3 reduce to:
𝜕𝑝
𝜕𝑥= (
𝜕2𝑢
𝜕𝑦2 ) (6.4)
0 = − 𝜕𝑝
𝜕𝑦 (6.5)
0 = 𝜕𝑣
𝜕𝑦 (6.5)
24
Eq. 6.5 shows that in the y-direction, the pressure is constant which verifies
that the pressure field plots in Figs. 5.4 - 5.5. Eq. 6.4 shows that pressure gradient in x
direction is also a constant since both sides of the equation depends on different
variables. Also, Eq 6.6 shows that, in combination with the no-slip conditions, v=0
everywhere in domain and verifies our approximate results in v-plots.
If Eq 6.4 is integrated twice from both sides, result is given by Eq. 6.6.
𝑢 =1
2(
𝜕𝑝
𝜕𝑥 ) 𝑦2 + 𝐶1𝑦 + 𝐶2 (6.6)
Applying BCs as u(0) = 0 and u(H) = 0 based on physical domain given in Fig. 5.1 for
plane Poiseuille flow to find C1 and C2 , Eq. 6.6 after grouping terms becomes:
𝑢(𝑦) = − ( 𝜕𝑝
𝜕𝑥 )
[ 𝑦(𝐻−𝑦) ]
2 (6.7)
It can be seen that for y=0 and y=H for the bottom and top plates respectively, u
becomes zero as found in results of velocity plots. In addition, pressure gradient term
is denoted by a constant in Eq. 6.8 where pressure gradient is negative for a pressure
driven flow in the positive x-direction. Therefore, Eq. 6.7 becomes after setting H=1
and L=1 for the unit square domain:
∆𝑃
𝐿= −
𝜕𝑝
𝜕𝑥 (6.8)
𝑢(𝑦) =∆𝑃
2 𝑦(1 − 𝑦) (6.9)
Clearly, this is a parabolic velocity profile which we used as a basis for our BCs and
at the center of flow channel, Eq. 6.7 becomes:
𝑢(0.5) =∆𝑃
8 (6.10)
Therefore, the velocity profile plots are also verified by this result which satisfies the
pressure difference of ∆𝑃 = 2 and u(0.5) = 0.25 shown in the Tecplot figures before.
25
6.2.Conclusion
In this thesis, steady incompressible Navier-Stokes equations with the assumption
of Re<<1 (Stokes flow) were numerically evaluated for plane Poiseuille flow on a
uniform unit square grid with no-slip BCs at the walls and parabolic velocity profile
BCs at the inlet and exit. Discretization of momentum equations used finite difference
scheme, while continuity equation used finite volume approach. Results were obtained
with FORTRAN by using PETSc package and GMRES method, visualized with
Tecplot 360 and verified with a closed-form analytical expression.
26
REFERENCES
[1] Trombley C.I., Ekiel-Jeżewska M.L. (2019) Basic Concepts of Stokes Flows. In: Toschi
F., Sega M. (eds) Flowing Matter. Soft and Biological Matter. Springer, Cham. DOI:
https://doi.org/10.1007/978-3-030-23370-9_2
[2] Hoffman, J. D. (2001). Numerical methods for engineers and scientists. New York: CRC
Press. doi:https://doi.org/10.1201/9781315274508
[3] Childress, S. (2009). An Introduction to Theoretical Fluid Mechanics, Courant Lecture
Notes Vol. 19 (American Mathematical Society, Providence). Retrieved from:
https://www.math.nyu.edu/faculty/childres/chpseven.PDF
[4] “Stokes flow”. Retrieved from: https://en.wikipedia.org/wiki/Stokes_flow
[5] Anderson, J. D. (1995). Computational fluid dynamics: The basics with applications.
McGraw-Hill.
[6] Zikanov, O. (2019). Essential computational fluid dynamics. Hoboken, NJ: John Wiley
& Sons.
[7] Russell, P. A & Abdallah, S. (1997). Dilation-Free Solutions for the Incompressible Flow
Equations on Nonstaggered Grids, AIAA J., vol. 35, no. 3, pp. 585–586.
[8] M. Sahin, A preconditioned semi-staggered dilation-free finite volume method for the
incompressible Navier-Stokes equations on all-hexahedral elements. Int. J. Numer. Meth.
Fluids 49, (2005), 959–974.
[9] “Chapter 5 : Line and surface integrals“ (n.d.)
Retrieved from: http://www.maths.gla.ac.uk/~cc/2A/2A_notes/2A_chap5.pdf
[10] Saad, Y. Iterative Methods for Sparse Linear Systems; SIAM, 2003.
Retrieved from: https://www-users.cs.umn.edu/~saad/IterMethBook_2ndEd.pdf
[11] Chapra, S.C. (2014). Numerical methods for engineers. New York, McGraw-Hill.
[12] Benzi, M., Golub, G., Liesen, J.: Numerical solution of saddle-point problems. Acta
Numerica 14, 1–137 (2005).
Retrieved from: http://page.math.tu-berlin.de/~liesen/Publicat/BenGolLie05.pdf
27
[13] Balay S, Buschelman K, Eijkhout V, Gropp WD, Kaushik D, Knepley MG, McInnes LC,
Smith BF, Zhang H. PETSc Users Manual, ANL-95=11, Mathematics and Computer Science
Division, Argonne National Laboratory, 2004.
Retrieved from: https://www.mcs.anl.gov/petsc/petsc-current/docs/manual.pdf
[14] Saad Y, Schultz MH. GMRES: a generalized minimal residual algorithm for solving
nonsymmetric linear systems. SIAM Journal on Scientific and Statistical Computing 1986;
7:856–869. DOI: 10.1137/0907058
[15] P. N. Brown & H. F. Walker, GMRES on (nearly) singular systems, SIAM J. Matrix
Anal. Appl., 18 (1997), pp. 37–51.
[16] Tecplot 360 User Manual: Release-1 (2013)
Retrieved from: https://www.scc.kit.edu/downloads/sca/tpum.pdf
[17] Anderson, J. D. (2017) Fundamentals of Aerodynamics (6th Ed.). New York, McGraw-
Hill.
28
APPENDIX-A: FORTRAN code for numerical solution of plane Pouiseuille flow
Figure A-1: Declaration of variables and matrix/vector creation.
29
Figure A-2: Programming of x and y momentum equations.
30
Figure A-3: Programming of continuity equation.
31
Figure A-4: Solution step of algorithm.
32
Figure A-5: Printing the solution in Tecplot format.
33
CURRICULUM VITAE