Newton's Method For A Finite Element Approach To The Incompressible Navier-Stokes Equations
Newton's Method For A Finite Element Approach To The Incompressible Navier-Stokes Equations
Michael Brandl
Contents iii
List of Figures v
List of Algorithms ix
1 Introduction 1
1.1 General Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.2 Summary of Main Results . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.3 Previous Work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.4 Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
2 Theory 5
2.1 The Incompressible Navier-Stokes Equations . . . . . . . . . . . . . . . . 5
2.2 The Finite Element Method . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.2.1 Weak Form . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.2.2 Tessellation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.2.3 Computing the Approximate Solution . . . . . . . . . . . . . . . 8
2.2.4 Further Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.3 The cG(1)dG(0) Method . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
2.3.1 Time-discretization . . . . . . . . . . . . . . . . . . . . . . . . . . 10
2.3.2 Relation to Backward Euler . . . . . . . . . . . . . . . . . . . . . 10
2.3.3 Stabilization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
2.4 The cG(1)cG(1) Method . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
2.4.1 Relation to Implicit Midpoint . . . . . . . . . . . . . . . . . . . . 11
2.4.2 Modified cG(1)cG(1) with Least Squares Stabilization . . . . . . 12
2.5 Fixed-Point Iteration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
2.5.1 General Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 12
2.5.2 Linear Convergence . . . . . . . . . . . . . . . . . . . . . . . . . 13
2.5.3 Application to the cG(1)cG(1)-method . . . . . . . . . . . . . . . 13
iii
iv CONTENTS
3 Method 19
3.1 Newton’s Method for cG(1)cG(1) . . . . . . . . . . . . . . . . . . . . . . 19
3.2 Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
3.2.1 Code and Numerical Libraries . . . . . . . . . . . . . . . . . . . . 21
3.2.2 Hardware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
3.2.3 Analysis of Results . . . . . . . . . . . . . . . . . . . . . . . . . . 21
5 Conclusion 35
5.1 Achievements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
5.2 Shortcomings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
5.3 Future Work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
6 Acknowledgments 37
References 39
List of Figures
2.1 Channel with different boundary conditions on inflow, walls and outflow.
Arrows indicate velocity. . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.2 Triangulation of circle for FEM using Matlab. . . . . . . . . . . . . . . . 8
2.3 Hat functions on 1D domain, with center at -1, -0.3 and 1, respectively,
which together form a basis for the space of continuous piecewise linear
functions on the mesh {-1,-0.3,1}. . . . . . . . . . . . . . . . . . . . . . . 9
v
vi LIST OF FIGURES
List of Tables
4.1 Table additive constants in pressure results for fixed-point method and
Newton’s method, for several values of ν. . . . . . . . . . . . . . . . . . 28
4.2 Table over convergence of u using fixed-point method and Newton’s method,
for ν = 0.001 and t = 4.419 (after 100 time steps). . . . . . . . . . . . . 30
4.3 Table over convergence of u using fixed-point method and Newton’s method,
for ν = 0.001 and t = 44.19 (after 1000 time steps). . . . . . . . . . . . . 30
4.4 Table over convergence of p using fixed-point method and Newton’s method,
for ν = 0.001 and t = 4.419 (after 100 time steps). . . . . . . . . . . . . 31
4.5 Table over convergence of p using fixed-point method and Newton’s method,
for ν = 0.001 and t = 44.19 (after 1000 time steps). . . . . . . . . . . . . 31
4.6 Table over convergence of u and p using Newton’s method with a time
step ∆t = 0.004419s being 1/10th of the one used in the other examples,
and with 10 iterations, for ν = 0.001 and at t = 0.08838 (after 20 out
of 10000 time steps). Only the first 4 iterations are shown, since values
oscillate around 1.0E-12 then. . . . . . . . . . . . . . . . . . . . . . . . . 31
4.7 Table over computation times for simulations using fixed-point method
and Newton’s method, for several values of ν. . . . . . . . . . . . . . . . 32
vii
viii LIST OF TABLES
List of Algorithms
ix
x LIST OF ALGORITHMS
Chapter 1
Introduction
1
2 Chapter 1. Introduction
is discretized in both space and time, and then solved numerically using computers.
Computer simulation allows also for testing of virtual prototypes of machines and vehi-
cles. Depending on the size of the problem and the desired accuracy, computations can
involve many processors and take long time to complete.
One way to discretize the problem is to reformulate it in a weak formulation by using
the Finite Element Method. Here, a non-linear term within the incompressible Navier-
Stokes equations poses a challenge. One can approach the non-linearity using splitting
schemes (see [27] for an example), or use techniques for solving non-linear equations,
such as fixed-point iteration (also called Picard iteration) or Newton’s Method. Also,
stabilization methods are applied in order to make the discretized problem numerically
stable.
One method involving stabilization is the cG(1)cG(1)-method introduced by Eriksson
([12, chapter 86.5]). This thesis will analyze an existing fixed-point iteration scheme for
resolving the non-linear terms, and try to improve on it by introducing an application
of Newton’s method.
The goal is to be able to obtain higher accuracy in the solution, and to reduce
computation time.
More recently, Elman et. al.[10] summarize the current status of solving Navier-
Stokes equations using finite element method and discuss strategies involving conver-
gence of Newton’s method and Picard iteration.
Several methods of improving run-time, and sometimes convergence, have been con-
sidered. Clift and Forsyth [7] investigate the possibility to avoid a full update of the
Newton matrix when solving the Navier-Stokes equations by freezing coefficients in or-
der to improve diagonal dominance. Orkwis [24] compares performance of Newton’s and
Quasi-Newton’s method. Persson [25] uses line-based discontinuous Galerkin and Quasi-
Newton’s with an implicit stepping method in order to increase sparsity in the matrix
and thus improve run-time performance. Shadid et al. [28] use an inexact Newton’s
method, while using backtracking for global convergence. Sheu and Lin [29] propose a
variation of the Newton-based linearization, increasing both run-time and convergence.
Selim et al. [27] investigate adaptive resolution for a method splitting pressure and
velocity solve.
There has been work on finding good preconditioners for this problem. Kim et al.
[18] show that a solution to Stokes equations can under certain circumstances be used as
a preconditioner to the Navier-Stokes equations. Elman et al. [9] investigate a number
of preconditioning techniques for Newton’s method, developed earlier [11] for the Oseen
solver, for the incompressible Navier-Stokes equations.
Pulliam [26] analyzes the time accuracy when using implicit time-stepping methods
and Newton’s method.
Bengzon introduces in his PhD-thesis [4] a priori and a posteriori error estimates that
can be used for local mesh refinement for the finite element method, and applies this to
several application domains, amongst others fluid dynamics. Parts of these results are
used by Olofsson’s master’s thesis [23] for a parallel implementation of a finite element
solution for a coupled fluid-solid system. Parts of Olofsson’s code and work-flow were
reused in the present thesis.
1.4 Structure
The remaining part of the thesis is structured as follows:
• Chapter 2 introduces theory and background by first defining the incompressible
Navier-Stokes equations and then the general Finite Element Method. These con-
cepts are then used to introduce the cG(1)dG(0)-method and its derivate, the
cG(1)cG(1)-method, which will be used in the thesis. Then, the concepts of fixed-
point iteration (with its application to the cG(1)cG(1)-method) and Newton’s
method will be introduced.
• Chapter 3 elaborates on the algorithms and implementations used, by applying
Newton’s method on the cG(1)cG(1)-method, and giving details on the technical
implementation and hardware.
• Chapter 4 provides results of the implementation, which stem from applying the
implementation on the benchmark test case of the lid-driven cavity. The velocity-
and pressure-solutions resulting from the fixed-point and Newton’s method will be
compared, as well as computation time and convergence, and the results will be
discussed.
• Chapter 5 summarizes achievements and shortcomings, and presents possible fu-
ture work.
4 Chapter 1. Introduction
Chapter 2
Theory
∂u
+ u · ∇u − ν∆u + ∇p = f in Ω × I, (2.1a)
∂t
∇·u=0 in Ω × I, (2.1b)
u = gD on ΓD × I, (2.1c)
νn · ∇u − pn = 0 on ΓN × I, (2.1d)
0
u (·, 0) = u in Ω, (2.1e)
where u0 is the initial velocity and I = (0, T ) the time interval, and the following
abbreviation is used: u · ∇u = (u · ∇) u. The boundary Γ is divided into the regions ΓD
with no-slip boundary conditions, where gD is a constant velocity, and ΓN with natural
(also called do-nothing) boundary conditions, where n is the boundary normal.
Boundary Conditions
In Partial Differential Equations (PDEs), boundary conditions describe the value of
the functions on the boundary of the domain. Within fluid dynamics, the following types
of boundary conditions are common (see [20, Page 292] for a more thorough treatment):
5
6 Chapter 2. Theory
gD = 0
νn · ∇u − pn = 0
gD = g0
gD = 0
Figure 2.1: Channel with different boundary conditions on inflow, walls and outflow.
Arrows indicate velocity.
Together with parameters such as viscosity and external forces, variations in the
geometry and boundary conditions make it possible to use the incompressible Navier-
Stokes equations to model fluid dynamics in various scenarios.
One example would be a channel section with gD = 0 on the walls, gD = g0 for the
given inflow velocity, and ΓN being the outflow region (see picture 2.1). Another one is
the so-called lid-driven cavity, which will be investigated in section 4.1.
Non-Linearity
Note that the term u·∇u introduces a non-linearity. This non-linearity makes it possible
to model effects such as turbulent flow, but it makes it also hard to solve the incom-
pressible Navier-Stokes equations. Analytical solutions are only known for some special
cases. The question if an analytical solution exists for the general case is not answered
yet and is one of the Millennium Prize Problems[13].
For practical purposes, numerical methods are usually applied for solving the incom-
pressible Navier-Stokes equations, using computers.
One such numerical method is the Finite Element Method (FEM).
sufficiently regular, it can usually be shown that a solution to the weak form is also a
solution to the strong one [4, page 14].
Assume the differential equation is given as
Lu = f, in Ω (2.2a)
u = 0, on δΩ (2.2b)
2.2.2 Tessellation
From a weak form, a finite element method is obtained by replacing the infinite vec-
tor space V by a finite dimensional subspace Vh ⊂ V , often the space of piecewise
polynomials (up to a certain given degree).
The computational domain is tessellated into a mesh κ = {K} which is defined as a
set of geometrical simplices K such as triangles in 2D (see e.g. figure 2.2) or tetrahedra
in 3D. The resolution of the mesh influences the quality of the approximation.
For measuring the size of a triangle or tetrahedron K, let hK be its longest side. One
way of measuring the quality of K is by defining its chunkiness parameter cK = hsK K
,
where sK is K’s shortest side. Another way to define the chunkiness parameter is
cK = hdKK
, where dK is the diameter of the triangle’s inscribed circle/the tetrahedron’s
inscribed sphere [20, page 46]. A tesselation κ is called shape-regular if ∃c0 : cK >
c0 ∀K. Shape-regularity is a quality measure of a tesselation, and can be used in several
theorems and proofs with regard to error estimations (e.g. [20, chapter 3.3.1]).
8 Chapter 2. Theory
Figure 2.3: Hat functions on 1D domain, with center at -1, -0.3 and 1, respectively,
which together form a basis for the space of continuous piecewise linear functions on the
mesh {-1,-0.3,1}.
∑
n
ξj a(φj , φi ) = l(φi ), i = 1, . . . , n. (2.9)
j=1
Aξ = L, (2.10)
where Aij = a(φi , φj ) and Li = l(φi ) are constant and can be computed exactly, or
approximated by means of numerical integration.
Solving
∑n this linear system of equations gives the coefficients for constructing uh , since
uh = i=1 φi ξi .
The matrix A is usually large and sparse, which makes the use of dedicated sparse
linear algebra software libraries advisable.
2.3.1 Time-discretization
The time-dependence in the term ∂u ∂t in equations (2.1) makes it necessary to also dis-
cretize time. Let 0 = t0 < t1 < · · · < tN = T be a sequence of discrete time levels, with
time steps kn = tn − tn−1 , 1 ≤ n ≤ N . Let the approximations U (x, t) of velocity u and
P (x, t) of pressure p be piecewise constant and discrete in t, which gives the method the
second part of its name: dG(0). Thus, for each n = 1, . . . , N one seeks U n ∈ Vh0 , with
Vh0 = Wh0 × Wh0 × Wh0 , and P n ∈ Wh . Define
U −U n n−1
The term ∂u ∂t can be discretized as kn . By choosing all other occurring u-
n n
terms to be U , the p-terms to be P , and modifying the equations (2.1a) and (2.1b)
accordingly, multiplying with a test function v ∈ Vh0 and q ∈ Wh respectively, taking
the integral over the domain Ω, and integrating the diffusion-term by parts, one obtains
( )
U n − U n−1
, v + (U n · ∇U n + ∇P n , v) + ν(∇U n , ∇v) = (f n , v) ∀v ∈ Vh0 ,
kn
(2.11a)
(∇ · U , q) = 0
n
∀q ∈ Wh ,
(2.11b)
dy
= f (t, y), (2.12)
dt
2.4. The cG(1)cG(1) Method 11
y n − y n−1
= f (tn , y n ). (2.13)
h
Using the values of the new time step in the right-hand side gives better numerical
stability than the obvious alternative of using the old ones (as in forward Euler), but
introduces the necessity to solve for the unknown y n , and introduces artificial damping.
The truncation error is O(h2 ), which can be seen by deriving backward Euler from a
Taylor-expansion and truncating at the second order term.
2.3.3 Stabilization
From the equations (2.11a) and (2.11b), the stabilized version of the cG(1)dG(0)-method
is obtained by adding the two equations, and introducing stabilization by replacing v
with v + δ(U n · ∇v + ∇q) in the terms (U n · ∇U n + ∇P n , v) and (f n , v):
( n )
U − U n−1
, v + (U n · ∇U n + ∇P n , v + δ(U n · ∇v + ∇q)) + (∇ · U n , q) + ν(∇U n , ∇v)
kn
= (f n , v + δ(U n · ∇v + ∇q)) ∀(v, q) ∈ Vh0 × Wh ,
(2.14)
where δ is defined as
For more background on the reasoning for the introduction of the stabilization terms,
see [12, page 1169].
dy
= f (t, y), (2.16)
dt
12 Chapter 2. Theory
y n − y n−1 h 1
= f (tn−1 + , (y n + y n−1 )). (2.17)
h 2 2
Implicit Midpoint makes it necessary to do slightly more computations than backward
Euler. However, the symmetry lets even-ordered error terms cancel, leading to a trun-
cation error of O(h3 ) and thus higher accuracy (similar derivation to backward Euler).
This method will be used for simulating the incompressible Navier-Stokes equations
in this thesis. However, the difficulty of resolving the non-linear term remains.
Note that the original stabilization factor δ is now called δ1 , and the new term has
a factor δ2 .
Here, the size of the increment was chosen as a termination criteria; other ones might
be considered, such as the residual size.
The Banach fixed-point theorem states that this approach converges if X is a metric
space (with metric d) and g is a contraction mapping, i.e.
As a proof for the latter version, note that x̄ = g(x̄). Subtracting that from equation
(2.20) and taking the norm gives
∥xi+1 − x̄∥ = ∥g(xi ) − g(x̄)∥ ≤ L∥xi − x̄∥ ≤ Li+1 ∥x0 − x̄∥. (2.23)
One can see directly that this holds for any Lipschitz-constant of g, thus giving linear
convergence for fixed-point iteration.
Similarly, letting q vary and setting v = 0, one obtains the discrete pressure equation
in this thesis do not contain external forces (f = 0). The general arguments made are
still valid, and since the external force-terms depend only linearly on Û n , the division of
terms for the fixed-point could be followed through on it in the same manner. Removing
the f -terms yields
( )
U n − U n−1
, v + (Û n · ∇Û n + ∇P n , v + δ1 (Û n · ∇v)) + ν(∇Û n , ∇v)
kn (2.27)
+δ2 (∇ · Û , ∇ · v) = 0
n
∀v ∈ Vh0 ,
and
δ1 (∇P n , ∇q) = −δ1 (Û n · ∇Û n , ∇q) − (∇ · Û n , q) ∀q ∈ Wh . (2.28)
( )
Ukn − U n−1 n
, v + (Ûk−1 · ∇Ûkn + ∇Pk−1
n n
, v + δ1 (Ûk−1 · ∇v)) + ν(∇Ûkn , ∇v)
kn (2.29)
+δ2 (∇ · Ûkn , ∇ · v) = 0 ∀v ∈ Vh0 .
In the pressure equation, one can use the newer velocity iterate since it has now already
been computed:
Writing Ûkn as 21 (Ukn + U n−1 ) and collecting only terms involving Ukn on the left hand
side
( )
Ukn 1 n 1 1
, v + (Ûk−1 · ∇Ukn , v + δ1 (Ûk−1
n
· ∇v)) + ν(∇Ukn , ∇v) + δ2 (∇ · Ukn , ∇ · v)
kn 2 2 2
( n−1 )
U 1 n 1
= , v − ( Ûk−1 · ∇U n−1 + ∇Pk−1 n n
, v + δ1 (Ûk−1 · ∇v)) − ν(∇U n−1 , ∇v)
kn 2 2
1
− δ2 (∇ · U n−1 , ∇ · v) ∀v ∈ Vh0 .
2
(2.31)
The pressure equation (2.30) remains the same, since there is only one term with the
new iterate Pkn which is already the only term on the left hand side.
2.6. Newton’s Method 15
Then, the system of equations can be solved using fixed-point iteration in the fol-
lowing manner:
Algorithm 2: Fixed-point iteration for cG(1)cG(1)
Choose initial starting guess (U 0 , P 0 ), and desired maximum increment size ϵ;
for n = 1, 2, . . . do
/* Next time step. */
Set U0n = U n−1 , P0n = P n−1 ;
for k = 1, 2, . . . do
/* Iteration steps within a time step. */
Solve equation (2.31) for Ukn ;
Solve equation (2.30) for Pkn , treating Ukn as given;
if ∥Ukn − Uk−1n
∥ + ∥Pkn − Pk−1
n
∥ < ϵ then
Exit For;
end
end
end
There are different ways to approach this iteration scheme.
One can devise other criteria for leaving the iteration than the sum of the norm of
velocity and pressure - for the experiments run in this thesis, a fixed number of iterations
was done.
Also, other splitting-methods with iteration for the incompressible Navier-Stokes
equations exist, such as Chorin’s method (see [20, pages 318f.]).
g(x) = 0. (2.33)
x̄ = x0 + δx. (2.34)
Assuming that δx is small (if the guess x0 is close to x̄), a Taylor expansion of g(x)
around x̄ can be done:
Rearranging gives
δx ≈ −g(x0 )/g ′ (x0 ). (2.37)
Adding this δx to x0 gives x̄ due to equation (2.34).
By iterating this approach, algorithm 3 is derived.
Algorithm 3: Newton’s method for a scalar non-linear function
Choose initial starting guess x0 , and desired maximum increment size ϵ;
for k = 0, 1, 2, . . . do
Compute δxk = −g(xk )/g ′ (xk );
Derive new guess xk+1 = xk + δxk ;
if |δxk | < ϵ then
Stop.
end
end
For vector-valued functions, Newton’s method can be derived quite similarly. The
main difference is that instead of having to divide by the scalar derivate g ′ (xk ), one has
to multiply by the inverse of the Jacobian matrix (the matrix of all first-order partial
derivatives of g at xk ) J −1 , or equivalently - and preferably! solve the linear system of
equations Jk δxk = −g(xk ).
Newton’s method is not guaranteed to converge - it needs a non-zero derivative at
the iterates, and a smooth surface. For difficult cases, methods such as line search have
been developed. See [22] for details.
Apart from its relative ease of implementation, Newton’s method is popular for its
convergence properties.
Let, similar to equations (2.2a) and (2.2b), a partial differential equation in its strong
form be defined by
N L(u) = f, in Ω (2.39a)
u = 0, on δΩ (2.39b)
Method
Based on the theoretical background presented above, the following derivations and
implementations have been made:
1. Newton’s method has been applied to a modified cG(1)cG(1)-method.
2. The resulting equations have been implemented in a C++ framework.
3. Numerical experiments have been run on both this implementation, and an existing
one using fixed-point iteration, and compared to each other.
Now, let the set {U n , P n } be the true solution of the equation at time step n.
Since the equation depends in a non-linear manner on U n , Newton’s method will
be derived by representing U n as the sum of the guess U0n and a correction term. In
subsection 2.6.1, this correction term for the variable x was called δx. Since the letter δ
already occurs in the current equations, the correction term will instead be called ϵ, so
that
U n = U0n + ϵ. (3.2)
One can then write Û n as Û n = 12 (U n + U n−1 ) = 12 (U0n + ϵ + U n−1 ) = Û0n + 12 ϵ,
where
1
Û0n = (U0n + U n−1 ). (3.3)
2
This will then be used in an iteration scheme, where for the k-th iteration,
Ukn = Uk−1
n
+ ϵk , (3.4)
19
20 Chapter 3. Method
and
n 1 n
Ûk−1 =
(U + U n−1 ). (3.5)
2 k−1
Also, let Pkn be the k-th pressure-iterate.
Inserting this and equations (3.4) and (3.5) into equation (3.1) gives
( n )
Uk−1 + ϵk − U n−1 1 1
n
, v + ((Ûk−1 + ϵk ) · ∇(Ûk−1
n
+ ϵk ) + ∇Pkn , v + δ1 (Ûk−1
n
· ∇v + ∇q))
kn 2 2
1 1 1
+(∇ · (Ûk−1
n n
+ ϵk ), q) + ν(∇(Ûk−1 + ϵk ), ∇v) + δ2 (∇ · (Ûk−1
n
+ ϵk ), ∇ · v)
2 2 2
= 0 ∀(v, q) ∈ Vh0 × Wh ,
(3.6)
n
where the ϵk -term was dropped in the term δ1 (Ûk−1 · ∇v + ∇q) since this term would in-
volve more complexity and is likely small due to the product with the small stabilization
factor δ1 .
Similarly, when bringing all terms except for the ones involving ϵk or pn onto the
left hand side, products of the type ϵk · ∇ϵk are dropped since they are likely small:
( )
ϵk 1 n 1
, v + ( Ûk−1 · ∇ϵk + ϵk · ∇Ûk−1
n
+ ∇Pkn , v + δ1 (Ûk−1
n
· ∇v + ∇q))
kn 2 2
1 1 1
+ (∇ · ϵk , q) + ν(∇ϵk , ∇v) + δ2 (∇ · ϵk , ∇ · v)
2 2 2 (3.7)
( n−1 )
U − Uk−1
n
= , v − (Ûk−1
n
· ∇Ûk−1
n n
, v + δ1 (Ûk−1 · ∇v + ∇q))
kn
−(∇ · Ûk−1
n
, q) − ν(∇Ûk−1
n
, ∇v) − δ2 (∇ · Ûk−1
n
, ∇ · v) ∀(v, q) ∈ Vh0 × Wh .
This leads to the following algorithm for the cG(1)cG(1) with Newton’s method:
Algorithm 4: Newton’s Method for cG(1)cG(1)
Choose initial starting guess (U 0 , P 0 ), and maximum desired increment size γ;
for n = 1, 2, . . . do
/* Next time step. */
Set U0n = U n−1 , P0n = P n−1 ;
for k = 1, 2, . . . do
/* Iteration steps within a time step. */
Solve equation (3.7) for the variables {ϵk , Pkn };
Set Ukn = Uk−1 n
+ ϵk ;
if ∥Uk − Uk−1 ∥ + ∥Pkn − Pk−1
n n n
∥ < γ then
Exit For;
end
end
end
Similar to the fixed-point method, one can devise other criteria for leaving the itera-
tion than the sum of the norm of velocity and pressure - for the experiments run in this
thesis, a fixed number of four iterations was done. The number was chosen by balancing
run-time against accuracy.
Note that the difference between the method introduced in subsection 2.5.3 and in
this current section is two-fold: One difference is the use of Newton’s method instead
3.2. Implementation 21
of fixed-point iteration, the other difference is the solve of the complete system at each
iteration instead of a splitting scheme.
3.2 Implementation
3.2.1 Code and Numerical Libraries
An existing C++ code for running the fixed-point method as derived in subsection 2.5.3
has been extended for running Newton’s method.
The code was set up in a similar fashion to the related project CMLFET[17], which
was developed in the Computational mathematics[32]-research group at Umeå Uni-
versity.
The following tools and libraries where used:
• PETSc[2] for parallel data structures and algorithms for scientific computations
involving partial differential equations,
3.2.2 Hardware
All development and computations where done on a Intel(R) Core(TM) i7-4700HQ ma-
chine with 8 cores with 2.40GHz each (four cores with hyper-threading), with 16313964
kB RAM and running Ubuntu 15.10, using mpiexec with four cores. Only four cores
where used since extra cores due to hyper-threading might not perform well on numerical
tasks.
It had also been considered to run the simulation on the Medusa-cluster of the Com-
putational mathematics[32]-research group at Umeå University in order to get higher
speedup. However, since Johansson[17, page 14] found out when running CMLFET on
this setup that using more than one node did not yield higher execution due to latency
of the ethernet, this idea was not followed up.
23
24 Chapter 4. Results and Discussions
0.8
velocity ramp function
0.6
0.4
0.2
0
0 10 20 30 40 50
time [s]
- here, h will be defined as the longest edge length of the smallest tetrahedron (where
the size of a tetrahedron shall be defined by its longest edge).
The stabilization factors introduced in equation (2.18) where set for each tetrahedron
to δ1 = 1.0∗hi /uD and δ2 = 2.5∗hi respectively, where hi is the respective tetrahedron’s
largest edge.
4.2.2 Meshing
In all the numerical experiments run here, the same meshing was chosen using the library
tetgen, with the following properties:
The spatial resolution h is 0.0441942m, and the time step ∆t was chosen as h/uD ,
so for the case of uD = 1m/s, ∆t = 0.0441942s.
The finite element type used was order 1 Lagrange elements, which consist of simple
hat functions as shown for the 2D-case in section 2.2. See [20, Chapter 8.12] for a
definition and details.
4.3 Velocity
The velocity results of the approach using the fixed-point method and Newton’s method
appear qualitatively similar, when considering figure 4.3 for streamline visualization
plots of the velocity for simulations run with ν = 0.01, ν = 0.001 and ν = 0.0001, and
figure 4.4 for a slice of the xz-plane through point (0.5, 0.5, 0.5) of the same simulations.
It can be seen that at ν = 0.01, the laminar flow dominates, whereas at lower ν (and
thus higher Reynolds number), the flow becomes more turbulent, as is to be expected.
26 Chapter 4. Results and Discussions
(a) Velocity from fixed-point method for (b) Velocity from Newton’s method for ν =
ν = 0.01. 0.01.
(c) Velocity from fixed-point method for (d) Velocity from Newton’s method for ν =
ν = 0.001. 0.001.
(e) Velocity from fixed-point method for (f) Velocity from Newton’s method for ν =
ν = 0.0001. 0.0001.
(a) Velocity from fixed-point method for (b) Velocity from Newton’s method for ν =
ν = 0.01. 0.01.
(c) Velocity from fixed-point method for (d) Velocity from Newton’s method for ν =
ν = 0.001. 0.001.
(e) Velocity from fixed-point method for (f) Velocity from Newton’s method for ν =
ν = 0.0001. 0.0001.
Figure 4.4: Velocity profile at the xz-plane through point (0.5, 0.5, 0.5) of velocity using
ParaView. Simulations run of the lid-driven cavity with lid-velocity uD = 1m/s in x-
direction, and several values of ν, at t = 44.19s. Note that the scale ends at 0.3m/s
instead of 1.0m/s in order to highlight the flow inside the cavity.
28 Chapter 4. Results and Discussions
4.4 Pressure
Like the velocity results mentioned above, the pressure results from Newton’s method
and the fixed-point method are qualitatively similar. See figure 4.5 for pressure plots
for ν = 0.01, ν = 0.001 and ν = 0.0001.
As a side note: Since the lid-driven cavity test case used here does not introduce
any boundary conditions for the pressure, the pressure can only be determined up to an
additive constant. When presenting the results in figure 4.5, the pressure results from
the simulation had been averaged to zero first. This has been done by integrating over
the pressure resulting directly from the simulation, and reducing the resulting additive
constant from the pressure. The additive constants can be seen in table 4.1. The additive
constants for Newton’s Method are constant with regard to ν and quite close to zero,
whereas the ones for the fixed-point method are farter from zero and differ slighly with
ν.
Table 4.1: Table additive constants in pressure results for fixed-point method and New-
ton’s method, for several values of ν.
Given that both the velocity and the pressure results from fixed-point iteration and
Newton’s Method agree well, it is interesting to compare them with regards to their
respective convergence properties and computation time.
4.5 Convergence
Both fixed-point iteration and Newton’s method are iterative methods.
For comparing the convergence of the two approaches, their respective convergence
rates can be considered. See subsection 2.5.2 for a definition of linear convergence, and
subsection 2.6.2 for a definition of quadratic convergence.
For simplicity, the i-th iteration update |∆ui | for the velocity will be used as ap-
proximation instead of |xi − x̄| from equation (2.24) (and similarly, the pressure i-th
iteration update |∆pi | will be used for measuring the convergence of the pressure).
The update errors for velocity and pressure for both methods are presented in the
tables 4.2, 4.3, 4.4 and 4.5 for two points in time, together with the quotient between
each iteration update. Note that for the both methods, four iterations were done per
time step.
In table 4.6, a simulation was run with a time step of ∆t = 0.004419s, 1/10th of
the one in the other runs, and with 10 Newton iterations, in order to have a closer
look on the convergence process. For practical purposes, this high resolution would be
impractical, since simulations would take several days to complete. By considering the
steady decrease in the iteration update size for both u and p, it can be seen that the
Newton process converges. When reaching iteration update sizes of about 1E-11, the
convergence rate decreases drastically - this is most likely due to round-off issues so close
to machine precision. The following things can be noted:
4.5. Convergence 29
(a) Pressure from fixed-point method for (b) Pressure from Newton’s method for
ν = 0.01. ν = 0.01.
(c) Pressure from fixed-point method for (d) Pressure from Newton’s method for
ν = 0.001. ν = 0.001.
(e) Pressure from fixed-point method for (f) Pressure from Newton’s method for ν =
ν = 0.0001. 0.0001.
Figure 4.5: Pressure visualization using ParaView of simulations run of the lid-driven
cavity with lid-velocity uD = 1m/s in x-direction, and several values of ν, at t = 44.19s.
Note the different scales.
30 Chapter 4. Results and Discussions
1. The fixed-point method converges after three steps for the velocity, and one step
for the pressure, so that a convergence rate as above cannot be defined for the
latter - however, the convergence is faster than can be hoped for when using the
fixed-point method, which generally converges linearly (see section 2.5).
2. Newton’s method converges here linearly or slightly less than that (similar to the
fixed-point method with regards to velocity), since a µ as in equation (2.24) cannot
be defined. This is not what is expected from section 2.6.
3. Since Newton’s method converges worse than expected here, more iterations would
be needed in some of the time steps in order to get a satisfactory result. Instead
of a fixed number of iterations, a tolerance-based termination criterion would be
preferable, but has not been tested due to lack of time - simulations of this size
with a high number of iterations would take several days to complete.
However, it should be noted that Newton’s method here considers the complete sys-
tem, whereas the fixed-point method treats a split system, and its convergence numbers
which we get here are only for the sub-parts of the system. In order to compare the two
approaches, a different measure should be used, such as e.g. the residual when inserting
the found solution into the complete equation.
Table 4.2: Table over convergence of u using fixed-point method and Newton’s method,
for ν = 0.001 and t = 4.419 (after 100 time steps).
Table 4.3: Table over convergence of u using fixed-point method and Newton’s method,
for ν = 0.001 and t = 44.19 (after 1000 time steps).
Table 4.4: Table over convergence of p using fixed-point method and Newton’s method,
for ν = 0.001 and t = 4.419 (after 100 time steps).
Table 4.5: Table over convergence of p using fixed-point method and Newton’s method,
for ν = 0.001 and t = 44.19 (after 1000 time steps).
Newton’s Method
|∆ui | |∆pi |
iteration i |∆ui | |∆ui−1 | |∆pi | |∆pi−1 |
0 2.5680E-01 - 5.3917E-04 -
1 7.0315E-07 2.7381E-06 1.1657E-05 2.1620E-02
2 2.0098E-12 2.8582E-06 5.6144E-11 4.8164E-06
3 7.7833E-13 3.8727E-01 9.4996E-13 1.6920E-02
4 ... ... ... ...
Table 4.6: Table over convergence of u and p using Newton’s method with a time
step ∆t = 0.004419s being 1/10th of the one used in the other examples, and with 10
iterations, for ν = 0.001 and at t = 0.08838 (after 20 out of 10000 time steps). Only the
first 4 iterations are shown, since values oscillate around 1.0E-12 then.
The fixed-point method uses a splitting scheme, and computes thus only two smaller
matrices, whereas the approach using Newton’s method assembles one large matrix.
Given the meshing described above with 8382 points, the matrix sizes are like this:
3. The complete system matrix (used in Newton’s method) has 33312 x 33312 entries.
Assuming the same sparsity pattern, and a best-case linear scaling of the iterative solver,
the ratio between the number matrix entries in matrix 3, and sum of the matrix entries
in matrices 1 and 2 is 1109689344
693555840 = 1.6. On top of this factor, however, the complete
matrix seems harder to solve: GMRES needs usually 50-800 Krylov subspace iterations
on it (depending on time step and Newton iteration), whereas the two solves for the
smaller matrices take usually between 10 and 100 Krylov subspace iterations.
32 Chapter 4. Results and Discussions
This result makes the use of this approach based on Newton’s method less attractive
in the general case, it might however still be useful if correct pressure computations are
of interest, as shown above.
While there was hope that using Newton’s Method would lead to better convergence
and thus optimization of the run-time, low-level optimization of the implementation for
execution time has not been a focus of the thesis, which makes it likely that there is
room for improvement on that end.
Table 4.7: Table over computation times for simulations using fixed-point method and
Newton’s method, for several values of ν.
100
Kinetic Energy Fixed-Point Method[J]
Kinetic Energy Newton’s Method[J]
80
60
Kinetic Energy [J]
40
20
0
0 10 20 30 40 50
time [s]
Figure 4.6: Kinetic Energy in fixed-point method vs. Newton’s method, for ν = 0.001
and uD =1m/s.
34 Chapter 4. Results and Discussions
Chapter 5
Conclusion
5.1 Achievements
This thesis introduced an implementation of Newton’s method for the cG(1)cG(1)-
method of numerically solving the incompressible Navier-Stokes equations, and com-
pared it to an earlier version using fixed-point iteration.
The velocity and pressure results from both methods correspond closely, as inves-
tigated by qualitative analysis by considering streamlines and xz velocity profiles, as
well as considering the kinetic energy as a quantitative measure for velocity. For the
pressure, surface visualizations have been used for quantitative comparisons.
Newton’s Method in this implementation does not converge quadratically as hoped
for, and has a much higher computation time than the existing method using splitting
and fixed-point iteration.
5.2 Shortcomings
The following shortcomings have been found and could be addressed in future work:
• Low number of test cases - More test cases should be investigated, both regard-
ing geometry, boundary conditions, and parameters such as viscosity and external
force.
35
36 Chapter 5. Conclusion
• Update to a newer version of PETSc - The version used is quite old, and a
newer version might bring improvements in performance and stability.
Acknowledgments
I would like to thank my supervisor Mats G. Larson for his support and patience, Fredrik
Bengzon for his support and help with implementation details, and Mats Johansson with
his support with infrastructure and a work desk at Umit research lab.
I would also like to thank my wife Elena Brandl for her love and support.
37
38 Chapter 6. Acknowledgments
References
39
40 REFERENCES
[27] K. Selim, A. Logg, and M. G. Larson. “An Adaptive Finite Element Splitting
Method for the Incompressible Navier–Stokes Equations”. In: Computer Methods
in Applied Mechanics and Engineering 209-212 (2011), pp. 54–65. issn:
00457825. doi: 10.1016/j.cma.2011.10.002. arXiv: 1205.3096. url:
http://linkinghub.elsevier.com/retrieve/pii/S0045782511003148.
[28] J. N. Shadid, R. S. Tuminaro, and H. F. Walker. “An inexact Newton method
for fully coupled solution of the Navier-Stokes equations with heat and mass
transport”. In: Journal of Computational Physics 137 (1997), pp. 155–185. issn:
00219991. doi: 10.1006/jcph.1997.5798.
[29] T. W. H. Sheu and R. K. Lin. “Newton linearization of the incompressible
Navier-Stokes equations”. In: International Journal for Numerical Methods in
Fluids 44.3 (2004), pp. 297–312. issn: 02712091. doi: 10.1002/fld.639.
[30] H. Si. “TetGen, a Quality Tetrahedral Mesh Generator”. In: AMC Transactions
on Mathematical Software 41.2 (2015), p. 11. issn: 00983500. doi:
10.1007/3-540-29090-7\_9.
[31] L. Q. Tang, T. Cheng, and T. T. H. Tsang. “Transient solutions for
three-dimensional lid-driven cavity flows by a least-squares finite element
method”. In: International Journal for Numerical Methods in Fluids 21.5 (1995),
pp. 413–432. issn: 0271-2091. doi: 10.1002/fld.1650210505. url:
http://doi.wiley.com/10.1002/fld.1650210505.
[32] Computational Mathematics Research Group at Umit. Computational
mathematics. Accessed: 2016-05-26. url:
http://www.org.umu.se/umit/english/about-umit/research-
groups/computational-mathematics/.
[33] Z. Žunič et al. “3D Lid Driven Cavity Flow By Mixed Boundary and Finite
Element Method”. In: European Conference on Computational Fluid Dynamics
(2006), pp. 1–12.