You are on page 1of 171

CFD I

Computational Fluid Dynamics I

CFD I

Computational Fluid Dynamics I


Pablo Rodrguez-Vellando Fernndez-Carvajal

Hochschule Magdeburg-Stendal
Fachbereich Wasser und Kreislaufwirtschaft

Universidad de A Corua
Escuela Tcnica Superior de Ingenieros de Caminos, Canales y Puertos

CFD I
Computational Fluid Dynamics I

First term, MSc International Master in Water Engineering, 6 ECTS

Lectures timetable: Tuesday and Thursday 12:45-14:35

Grades: Attendance + Courseworks

Lecturers

Pablo Rguez-Vellando (Coord)

Acacia Naves

Jaime Fe Marqus

CFD I
Computational Fluid Dynamics I
Main Bibliography

Taylor, C.C., Hughes T.G., Finite element programming of the Navier-Stokes equations.
Pineridge, 1981

Thomasset, Franois. Implementation of finite element methods for Navier-Stokes


equations / Franois Thomasset. Springer-Verlag, 1981.

G. Carey, J. Oden, Finite Elements, Prentice-Hall,1984

A. Chadwick, Hydraulics in Civil Engineering, Allen&Unwin, 1986

T.J. Chung, Computational Fluid Dynamics, Cambridge University Press, 2002

J. Donea, Finite Element Methods for Flow Problems Wiley, 2003

CFD I
Computational Fluid Dynamics I
Main Bibliography

J. Ferziger, M. Peric, Computational methods for Fluid Dynamics

P. Gresho, R Sani, Incompressible flow and the finite element method, Wiley, 2000

O. Pironneau, Finite Element Methods for Fluids, Wiley, 1989

J. Puertas Agudo, Apuntes de Hidrulica de Canales, Nino, 2000

Singiresu Rao, The Finite Element Method in Engineering, Elsevier 2005

O. C. Zienkiewicz, R.L. Taylor& P. Nithiarasu, The Finite Element Method for Fluid
Dynamics, Elsevier 2005

CFD I
Computational Fluid Dynamics I
0.

Introduction to CFD. Revision of concepts (4h)

1.

MATLAB (8h)

2.

Saint-Venant equations. Step Method CW1

2.

HEC-RAS (6h) CW5

2.

Introduction to CFD

3.

Mathematical preliminaries

Governing equations (4h)


1. Navier-Stokes
2. Potential, stream function, stokes flow
3. Shallow Water equations
4. Convection-diffusion eq

2.

Finite elements and fluids hydrodynamics (12 h)


1. Finite elements and fluids
2. Variational and weighted residuals methods CW2
3. Discretization
4. Potential flow CW3 ,CW4
5. Stokes flow
6. Stable velocity-pressure pairs
7. Unsteady convective flow
8. Penalty methods
9. Shallow water equations
10. Stabilizing techniques
11. Flow in porous media
12. Conservative transport
13. Non-isothermal transport of reactives

3.

End user programmes (26h)

Open channel flow. A revision

1.

1.

4.

Introduction to Finite Volumes (8h)

3.

SMS//RMA2 (6h) CW6

4.

EPANET (6h) CW7

CFD I
Computational Fluid Dynamics I

i I y
1 Fr 2 y

5
4
3
2
1
0

-12000

-10000

-8000

-6000
x

-4000

2 2
2 2 0
x
y
2

-2000

Example 1
0

CFD I
Computational Fluid Dynamics I
u v w

0
x y z

2u 2u 2u
u
u
u
u
1 p
fx
2 2 2
u
v w
y
z
t
x
x x y z
2v 2v 2v
v
v
v
v
1 p
2 2 2
u v w fy
t
x
y
z
y x y z
2w 2w 2w
1 p
w
w
w
w
2 2 2
fz
w
v
u
z
z
y
z
y
x
t
x

CFD I
Computational Fluid Dynamics I

CFD I
Computational Fluid Dynamics I

CFDI 1. Introduction to CFD

CFD I
Computational Fluid Dynamics I

In previous subjects we have regarded the Open Channel and Pipe flows
In the pipe flow the geometry is given and the unknowns are the pressure p(x,t)
and the velocity v(x,t). Some computational approaches apply (e.g. EPANET)

In the open channel flow there is a hydrostatic distribution of pressures, the


unknowns are the shape (depth y(x,t)) and the velocity. Some computational
approaches apply (e.g. HEC-RAS)

p(z)
y

CFD I
Computational Fluid Dynamics I

As we can recall, the one dimensional flow in channels depends on space


(x) and time (t) and can be characterized as
Gradually varied
Unsteady
Rapidly varied
Open channel

Gradually varied flow


Flow profiles (Curvas de remanso)

Non-uniform
Steady flow

Rapidly varied flow

/ t 0

Uniform (i=I)
/ x 0

Broadcrested weir, hydraulic


jump, sudden discharge
variations,

CFD I
Computational Fluid Dynamics I

The open channel flow takes place into natural channels and also in irrigation,
navegation, spillways, sewers, culverts and drainage ditches
Prismatic channels are assumed (all the cross sections are equal)
Basic notation
B
y(x,t)
h

v(x,t)

Depth (y), Stage (h) height from datum, Area (A), Wetted perimeter (P), Surface
width (B), Ground height from datum (z)
Hydraulic radius (R), (R=A/P)
Hydraulic mean depth (Dm), (D=A/B)

CFD I
Computational Fluid Dynamics I

Saint-Venant equations allow for a resolution of the one dimensional flow


The continuity equation is given by the conservation of mass as

y
y A v
v
0
t
x B x
The dynamic equation is given by the conservation of momentum as

v
v
y
v g g I i 0
t
x
x
In these differential equations the unknowns are the velocity v and the depth y for a given horizontal
direction x
i is the geometric slope (i=-dz/dx)
I is the friction slope (I=- dE/dx)
E is the Energy per unit weight given by Bernoullis eq as, E=z+y+v2/2g= z+pgv2/2g

CFD I
Computational Fluid Dynamics I

Saint-Venant equations assume :

The slope is small i<0.1


Flow straight and parallel. Hydrostatic distribution of pressures
Turbulent flow fully developed
Uniform velocity within the section (Coriolis factor, =1)
Non-erodible boundaries
Prismatic channel

Finding the value of dv/dx in the steady continuity equation and substituting it in the
steady dynamic equation we obtain

dy
iI
iI

2
dx 1 Bv / gA 1 v 2 / gy
That can also be written as

i I y
1 Fr 2 y

Slow regime (Fr<1), fast regime (Fr>1)

CFD I
Computational Fluid Dynamics I

The friction slope can be obtained from the Manning coefficient as


2 2
43

The equation

i I y
1 Fr 2 y

has no analytic solution and has to be solved by a numerical method


The solution of which will be an expression of the form y y x
M1

yn

yc

M2
M3

CFD I
Computational Fluid Dynamics I

CFD I
Computational Fluid Dynamics I

The solution to the equation

f f
df x
k 1 k
x
dx

can be solved on a finite element

Fr* Frk 1 Frk / 2

where
and

Frk

i I y
1 Fr 2 y

basis, to obtain

1 Fr *2
xk 1 y
xk
iI*

I * I k 1 I k / 2

Q
yk B gyk

I k n 2Q 2

2 yk B 4 / 3
Byk 10 / 3

The finite difference problem can be completed by using an initial condition x y0 x0

yn

y9

yn=y10

x10

y0

x9

x8

x7

x6

x5

x4

x3

x2 x1 x0=0

CFD I
Computational Fluid Dynamics I
First proposed in XIX c. by Boudine (1861) and further developed by Bakhmeteff (1932)
Assuming that the initial condition is given downstream (y0 ) and that he stretch is long
enough for the normal depth to be reached, the iterative expression can be used N times
varying the value of y from y0 up to yn at vertical equidistant intervals, and finally obtaining
the x for which the depth is the normal one
2009_10

Tramo 3
k

fr

fr*

I*

0
1
2
3
4
5
6
7
8
9
10

1,54
1,632
1,724
1,816
1,908
2
2,092
2,184
2,276
2,368
2,46

1,0023876
0,9188329
0,8462737
0,7827859
0,7268574
0,6772855
0,6331028
0,5935233
0,5579026
0,5257075
0,4964941

0,00364198
0,00309299
0,00265301
0,00229591
0,00200275
0,0017596
0,00155607
0,00138424
0,00123806
0,00111282
0,00100482

0,9606102
0,88255329
0,8145298
0,75482162
0,70207141
0,65519413
0,61331306
0,57571295
0,54180505
0,51110081

0,003367485
0,002873
0,002474459
0,002149326
0,001881175
0,001657836
0,001470155
0,001311153
0,001175445
0,001058825

0
-3,00106646
-13,8612733
-34,8600141
-69,2997436
-122,243592
-202,060268
-324,134734
-521,80908
-892,257412
-2047,68149

Tramo 4

Calado

2,7
2,5
2,3
2,1
1,9
1,7
1,5
1,3
1,1
0,9
0,7
-2500

-2000

-1500

-1000
Distancia

-500

Tra

CFD I
Computational Fluid Dynamics I

Even the one-dimensional Saint-Venant equations are difficult to resolve and


some numerical procedure is to be needed. Step, characteristics, finite
differences, finite volumes and finite elements are some of those
The extension of the Saint-Venant equations to the three dimensions are called
the Navier-Stokes. They are also made up of continuity and dynamic equation
u v w

0
x y z

2u 2u 2u
u
u
u
u
1 p

u
v w
fx

t
x
y
z
x x 2 y 2 z 2
2v 2v 2v
v
v
v
v
1 p

u v w fy

t
x
y
z
y x 2 y 2 z 2
2w 2w 2w
1 p
w
w
w
w
2 2 2
fz
w
v
u
z
y
z
z
y
x
t
x

the unknowns in these equations will be the velocities u(t,x,y,z), v(t,x,y,z), w(t,x,y,z)
and the presure p(t,x,y,z)

CFD I
Computational Fluid Dynamics I
That is
u v w

0
x y z

u i ,i 0

2u 2u 2u
u
u
u
u
1 p
u
v w

2 2 2 f x
t
x
y
z
x x y z

2v 2v 2v
1 p
v
v
v
v
u v w
2 2 2 f y
y
z
y x y z
t
x

ui ,t u j ui , j f i

p,i ui , jj

2w 2w 2w
w
w
w
w
1 p
u
v
w

2 2 2 f z
y
z
y
z
t
x
z
x

with boundary conditions:

Dirichlet ui bi in (prescribed velocity)


Newman ij n j ti in 2 (prescribed normal stress )

with initial conditions (unsteady flow)

ui x j ,0 ui 0 x j

CFD I
Computational Fluid Dynamics I

Anyway, in most of the cases some other equations are used to provide a
simplified but meaningful solution to the flow problems. Among these we can
quote as some of the most important

Potential and stream function equations


Stokes flow eqs.
Shallow water flow eqs. (SSWW)

CFD I
Computational Fluid Dynamics I

The potential flow equation is a simplification that uses the potential variable to
solve the continuity equation

In the stream/vorticity formulation the u and p variables are written in terms of


the variables and , obtaining in this way simplified N-S equations

In the Stokes equations the convective term is dropped

The Shallow Water equations are the result of the integration in depth of the
three dimensional equations, therefore a two dimensional model is obtained

CFD I
Computational Fluid Dynamics I

The flow in a porous media simplifies Navier-Stokes eq. and is also to be


considered

Once the velocity field is obtained, we can use it as an input value to resolve the
transport equation that gives the concentration of a given species in the flow

The transport equation can be also considered for non-isothermal reactives

The equations of the transport of sediments are also needed for the case in
which non-soluble substances are included in the flow

For convective enough flows, a turbulent model is to be required

CFD I
Computational Fluid Dynamics I

With respect to the dynamic macroscopic behaviour, flows can be regarded


as laminar or turbulent

The laminar flow is ordered and it takes place in layers

In the turbulent flow, particles move on an irregular, fluctuant and erratic


way -> turbulents models are required

This situation takes place for a Reynolds number Re(=UL/ > 2000

The Reynolds number indicates the weight of the convection with respect to
the viscous losses

CFD I
Computational Fluid Dynamics I

When the Reynolds number is large enough, the velocity unknown is split
into a mean velocity U and a fluctuating term that depends on time u(t),
leading to u(t)=U+u(t)

The most common models are the algebraic, de one equation models
(Prandtl's, Baldwin-Barth, etc...) and the two eq. (k k,...)

CFD I
Computational Fluid Dynamics I

The FEM was developed in the 50s to be applied to the aeronautic


engineering

Advantages:
Suitable to model complex geometries
Consistent treatment of b.c.
Possibility of being programmed in a flexible and general way

Fluid materials change their shape and that leads to a important


complexity

Structural or heat problems lead to a diffusive equation that turns into a


symmetric stiffness matrices

For those cases, Galerkin formulation leads to convergent iterative


solutions in an easy way

CFD I
Computational Fluid Dynamics I

The presence of a convective acceleration in the fluids formulation leads to the


obtaining of non-symmetric stiffness matrices
That is the reason of the Galerkin formulation not being appropriate anymore.
When using it, spurious wiggles show up in the solution

CFD I
Computational Fluid Dynamics I

In order to do avoid these oscillations, some techniques have been developed since the
70s which are known as stabilization techniques. The most important of which are
SUPG (Streamline Upwind Petrov-Galerkin)
GLS (Galerkin Least Squares)
FIC (Finite Increment Calculus),...

A correct coupling in the selection of the pressure and velocity variables is required for
convergence
The heterogeneity of the unknowns require the use of the so-called mixed and penalized
methods
The mesh refinement also leads to the stabilization (but means high computational
costs)

introduction to CFD
derivative operators
computational fluid dynamics I

f (x,t) is a 1D scalar field

f (x,t) is a 3D vector field

= scalar product

Index notation

Gradient , divergence

Laplacian

ab a j b j a1b1 a2b2 a3b3

ui , j

ui
x j


, ,
x y z

2 2 2
2 , 2 , 2
x y z

introduction to CFD
Reference System
computational fluid dynamics I

Lagrangian coordinates (the net follows the particle)


Not able to model big deflections (even in structures)
Allows to follow the interface between different materials

Eulerian coordinates (the net is fixed and the fluid moves


with respect to it)
Allows for a characterization of big deflections (fluids)
Difficulties to evaluate interfaces and free surfaces

ALE coordinates (mixture of both)


The net moves with an independent velocity from that of the
particles

introduction to CFD
eulerian coordinates
computational fluid dynamics I

In the Lagrangian coordinates there are no convective effects and the material
derivative is just a temporal derivative

In the Eulerian coordinates there is a relative movement of the material


coordinates with respect to the spatial ones, and the material derivative of an
scalar field f is given by

df f f x j

dt t x j t

df f

uf
dt t

df ( xi , t ) f f dx f dy f dz f
f

uj
t x dt y dt z dt t
dt
x j

introduction to CFD
eulerian coordinates
computational fluid dynamics I

The total derivative of a vector field is given by

df i f i f i x j

dt t x j t

df f
u f
dt t

df1 ( xi , t ) f1 f1 dx f1 dy f1 dz f1
f1

uj
dt
x j
t x dt y dt z dt t
df 2 ( xi , t ) f 2 f 2 dx f 2 dy f 2 dz f 2
f

uj 2
dt
x j
t x dt y dt z dt t
df 3 ( xi , t ) f 3 f 3 dx f 3 dy f 3 dz f 3
f 3

uj
dt
x j
t x dt y dt z dt t

introduction to CFD
eulerian coordinates
computational fluid dynamics I

The compact integral forms are:


a(u,v ) u v d

a(u, v ) u :v d

( w, q ) w q d

b(u, q ) qv d

c( v; w, u ) w( vu ) d

( w, h)N w h d
N

where

u i u

xi

u v

u v
xi xi

c( v; w , u ) w (v )u d

u ij ui

x j

u : v

ui vi
x j x j

w v u wi v j

ui
x j

CFD I
Computational Fluid Dynamics I
0.

Introduction to CFD. Revision of concepts (6h)

1.

MATLAB (8h)

2.

Saint-Venant equations.

2.

HEC-RAS (4h)

2.

Introduction to CFD

3.

SMS//RMA2 (8h)

3.

Mathematical preliminaries

Governing equations (6h)


1. Navier-Stokes
2. Potential, stream function, stokes flow
3. Shallow Water equations
4. Convection-diffusion eq

2.

Finite elements and fluids hydrodynamics (24 h)


1. Finite elements and fluids
2. Variational and weighted residuals methods
3. Discretization
4. Potential flow
5. Stokes flow
6. Stable velocity-pressure pairs
7. Unsteady convective flow
8. Penalty methods
9. Shallow water equations
10. Stabilizing techniques
11. Flow in porous media

12. Conservative transport


13. Non-isothermal transport of reactives
3.

End user programmes (20h)

Open channel flow. A revision

1.

1.

4.

Introduction to Finite Volumes (8h)

governing equations
computational fluid dynamics I

CFDI2. Governing Equations

governing equations
stress() and strain() of fluids
computational fluid dynamics I

For solids, Hookess law states E


For Newtonian fluids (air and water are included) Newtons viscosity law
states

du
dn

kg is the dynamic viscosity

where

m2
and
is the cinematic viscosity

For non-newtonian fluids (plastics, coloidal suspensions, emulsions,...) the


viscosity is not a constant
For the non-frictional flow or non-viscous flow (inviscid) viscosity is
negligible
In what follows, the Navier-Stokes eq., governing the viscous flow, are
described for compressible fluids (gases is not a constant) and for noncompressible fluids (liquids, c)

governing equations
continuity equation
computational fluid dynamics I

The principle of conservation of mass states that in any time interval and for any
control volume the volume of mass entering must equal the volume of mass
leaving, i.e.

inQin out Qout

in uin Ain out uout Aout


As velocity and density depend on time and space, the equilibrium of mass in a
differential volume dxdydz can be stated from

udydz

u x u dx dydz

governing equations
continuity equation
computational fluid dynamics I

The flux of mass per second, this is

dxdydz ,
t

is equal to (subtract in figure)

dxdydz u dxdydz v dxdydz wdxdydz


z
t
x
y

Since the control volume is independent of time

u v w
t x
y
z

For incompressible fluids is a constant and the continuity equation results into
u v w

u ui ,i 0
x y z

governing equations
dynamic equation
computational fluid dynamics I

Newtons second law states that

d mv dm

v ma
dt
dt

In the control volume there is no variation in mass, and therefore

dFi dxdydzai
The equilibrium of forces gives
yx

yx
dy dxdz
y

zx dxdy

xx

xx x dx dydz

xx dydz

yx dxdz

zx

dz dxdy
zx
z

governing equations
dynamic equation
computational fluid dynamics I

Newtons second law can be written for the x direction as


xx

dFx dxdydzBx xx dydz xx


dx dydz
x

yx

dy dxdz
yx dxdz yx
x

zx

dz dxdy
zx dxdy zx
x

where Bx are the body forces in the x direction


Dividing by the control volume and making the same operations for the three
dimensions in space it is obtained
xx yx zx

y
x
z

a y B y xy yy zy
y
x
z

a z Bz xz yz zz
x
y
z

a x Bx

governing equations
stresses in solids
computational fluid dynamics I

Which is the value of ij ?

Let us see first how solids behave

In solids the strains are related to the stresses as


xx

1
xx yy zz ,...
E
xy
xy
,...
G

where E is the Young Modulus or Elasticity Modulus, is the Poisson Ratio and G
is the Modulus of Rigidity or Shear Modulus

governing equations
stresses in solids
computational fluid dynamics I

The volume of expansion e can be defined as follows


e

V 1 xx 1 yy 1 zz dxdydz dxdydz

V
dxdydz

e xx yy zz

1 2
xx yy zz 1 2 3
E
E

where is the mean of the three normal stresses


The first strain can therefore be expressed as
xx

1
1
1
xx yy zz xx xx yy zz xx xx 3 xx
E
E
E

xx

E
3
xx

1
1

governing equations
stresses in solids
computational fluid dynamics I

Therefore, writing in terms of e

xx

E
E
Ee
3
xx

xx
1 1 2
1
1
1

Noting that Youngs and shear modulus and Poissons ratio are related as
G

it is obtained

E
21

xx 2G xx

2G
e
1 2

governing equations
stresses in solids
computational fluid dynamics I

Subtracting from both sides of the former equation we obtain


xx 2G xx

2G
2G
E
e
e 2G xx

1 2

1
2

3
1
2

2G 2G 1
2G 1
2G 2 1
e 2G xx

e

e 2G xx

1
2
3
1
2
1
2
3

1
2

3 3

xx 2G xx

e
3

e
3

e
3

Or

xx 2G xx

Similarly

yy 2G yy
zz 2G zz

For the shear stresses it is already known that


xy G xy
yz G yz
zx G zx

governing equations
stresses in fluids
computational fluid dynamics I

Up to this point we have been concerned with solids. It has been shown
empirically that stresses in fluids are related not to strain but to time rate of strain
We have just shown that
e

xx 2G xx

Replacing the rigidity modulus by a quantity in terms of its dimensions (kg/s/m), the
stresses in fluids would be of the form
xx 2kg/(s m)

e
xx
t
3

Where the proportionality constant is known as the dynamic viscosity and has
the dimensions (kg/(s m))
The equations result into
xx 2

xx 2 e
,...
t
3 t

xy

xy
t

,...

governing equations
stresses in fluids
computational fluid dynamics I

Taking the mean pressure as p, the equations are

xx p 2

yy p 2
zz p 2

xx 2 e

t
3 t

yy

xy

2 e

t
3 t

yz

zz 2 e

t
3 t

zx

xy
t
yz
t

zx
t

Let us now find out the value of the time derivatives of xy and e in terms of
u,v and w

governing equations
stresses in fluids
computational fluid dynamics I

If the coordinates of a point before deformation are x,y,z and after


deformations are x y+, z+the strains are given by
xx

yy

zz

xy

y x

yz

z y

zx

x z

The rate of strain and volume of expansion would be therefore


xx u

,...
t
t x x t x
xy
t

u v

,...
t y x y t x t y x

e
u v w
xx yy zz

u
t t
x y z

governing equations
dynamic equation
computational fluid dynamics I

And consequently the stresses result into

u 2
2 e
xx p 2 xx p 2 u
3 t
t
x 3
v 2
yy p 2 u
y 3

zz p 2

w 2
u
z 3

v u

t
x y
w v


y z

xy
yz

xy

u w

zx

It is obtained for the first dimension


ax

1 xx 1 yx 1 zx
u
u
u
u

Bx

v w
u
x
y
z
z
y
x
t

1
u 1 v u 1 u w
u
u
u
u


Bx
v w
u

p 2
x
x y x y z z x
z
y
x
t

governing equations
dynamic equation
computational fluid dynamics I

The first dynamic equation is transformed into


1
u 1 v u 1 u w
u
u
u
u


Bx
v w
u

p 2
x
x y x y z z x
z
y
x
t

1 p
2v
2u
2u
2w
u
u
u
2u
u
Bx
2 2
2 2
u
v w
x
x
yx
y
z
zx
t
x
y
z

u
u
u
u
2u
2u
2u
u v w
1 p

u
v w
Bx
2 2 2
t
x
y
z
x
y
z
x x y z
x
2u 2u 2u
u
u
u
u
1 p

Bx

u
v w
y
z
t
x
x x 2 y 2 z 2

Proceeding in the same way for for y and z, the 3D Navier equations are finally

ui ,t u j ui , j f i

p,i ui , jj

1
u
u u p u f
t

governing equations
dynamic equation
computational fluid dynamics I
That is

u v w

0
x y z
2u 2u 2u
u
u
u
u
1 p
fx
u
v w

x x 2 y 2 z 2
t
x
y
z

2v 2v 2v
1 p
v
v
v
v
fy

u v w

y x 2 y 2 z 2
t
x
y
z
2w 2w 2w
1 p
w
w
w
w

2 2 2 f z
u
v
w
z
t
x
y
z
y
z
x

with boundary conditions:

Dirichlet ui bi in (prescribed velocity)


Newman ij n j ti in 2 (prescribed normal stress )

with initial conditions (unsteady flow)

ui x j ,0 ui 0 x j

When the flow is non-isothermal, the temperature of the fluid has to be solved making use of
the energy equation, which represents the conservation of energy

governing equations
stokes flow
computational fluid dynamics I

The Stokes flow simplification is obtained when the flow is taken as steady and
the convective term is dropped. For the two dimensional case leads to
u v

0
x y

1 p
u f x 0
x

1 p
v f y 0
y

The equation can be solved in terms of the variables as


Stream function formulation
Stream-vorticity function formulation
Potential function formulation
Velocity-pressure formulation

governing equations
potential flow
computational fluid dynamics I

A flow is said to be inviscid (or non-viscous) when the effect of viscosity is small
compared to the other forces (convection). The viscosity is therefore assumed to be
null. No fluid is really inviscid, but this can be assumed for instance in flow through
orifices, over weirs or in channels
A flow is said to be irrotational when its particles do not rotate and maintain the same
orientation wherever along the streamline

irrotational

rotational

governing equations
potential flow
computational fluid dynamics I

In irrotational flows the rotational of the velocity vector is zero

rot u
x
u

y
v

k
w v u w v u

i
j k 0
z y z z x x y
w

Therefore in irrotational flows it is verified that

w v
0
y z

u w

0
z x

v u

0
x y

Far from the boundaries, most of the flows of fluids with low viscosity (such as air and
water) behave as irrotational and these simplification can be assumed, that is why the
inviscid flow can be considered in certain occasions as irrotational

governing equations
potential flow
computational fluid dynamics I
The potential flow equations are a simplified version of the N-S equations in which the
potential function is used to solve the continuity equation
We define in such a way that its partial derivatives with respect to the space, give the
velocity in that direction

u
v
v
y
x
Substituting this expression into the 2-D continuity equation it is obtained

u v

0
x y

2 2
2 2 0
y
x
2

It is also verified that

u v

y x



y x x y

and the assumption of a velocity potential requires the flow to be irrotational

governing equations
potential flow
computational fluid dynamics I
With this formulation we can solve problems such as flow around a cylinder, flow out of an
orifice or around an airfoil
The flow through a saturated homogeneous porous media results as well in a
Laplacian, as the Darcys law is given by u k dh dx , where h is the water level, can be
written as

u k
where k is the hydraulic conductivity
Taking this equation to the continuity equation it is obtained

k k f
assuming k as a constant

governing equations
potential flow
computational fluid dynamics 1

The governing equations of the two dimensional potential flow are therefore given by

2 2
2 2 0
y
x
2

where the velocity components are given by u


with the boundary conditions
0
Dirichlet
Newman

Vn

lx
l y V0
n x
y

in

in
in 2

were lx and ly are the direction cosines of the outward unit vector n to 2

governing equations
stream function
computational fluid dynamics 1

The stream function ( formulation is an alternative way of describing the motion of


the fluid that has some important advantages compared to the velocity-pressure
formulation

The streamline is a line that connects points at a given instant whose velocity
vectors are tangent to the line

The path line connects points through which a fluid particle of fixed identity passes
as it moves in space

In steady flow both lines are the same

Since the velocity vector meets the streamlines tangentially no fluid can cross the
streamline

In the stream-function formulation the unknown is defined as. Proof follows

u
y

v
x

governing equations
stream function
computational fluid dynamics I

If a unit thickness of the fluid is considered, is defined as the volume rate


(volume per unit distance/time) (discharge) of fluid between streamlines AB and
CD. Let CD be a streamline very close to CD. Let the flow between CD and CD
be d
D
u
dy
D
P
v dx
C
C
B
A
At a point P (with velocities u and v), the distance between CD and CD is
denoted by dx and dy
Since no fluid crosses the streamlines, the volume rate of flow across dy is u and
the volume rate across dx is v, therefore

d udy vdx

governing equations
stream function
computational fluid dynamics I

Therefore

v
x

u
y

And the continuity equation is automatically satisfied by the stream function


u v


x y x y

y
x

If the flow is irrotational, the equation to be satisfied is


v u

0
x y
Substituting u and v by its values in terms of it is obtained

u
0


x x y x

And therefore
2 2
2 2 0
y
x
2

governing equations
shallow waters
computational fluid dynamics I

The equations governing the steady 2-D Newtonian flow are


u v

0
x y
u
u
u
1 p
u
v

u f x
t
x
y
x
v
v
v
1 p
u v
v f y
t
x
y
y

or identically

u
1
u u f p u
t

ui ,i 0

i 1,2

But this is just a theoretical example in which the flow is assumed to have
null thickness
If we want to make a more adequate approach that takes into account the
third dimension we have to use the Shallow Water equations (SSWW)

governing equations
shallow waters
computational fluid dynamics I

The assumptions to be made are


The distribution of the horizontal velocity along the vertical direction is assumed
to be uniform
An integration in height is carried out, and the horizontal velocity is taken as the
mean value of the horizontal velocities along the vertical direction
The main direction of the flow is the horizontal one, and only very small flows
take place on vertical planes
The acceleration in the vertical direction is negligible compared to gravity and a
hydrostatic distribution of the pressure is assumed

governing equations
shallow waters. continuity eq.
computational fluid dynamics I

Integrating the continuity equation along the z-axis


h
u v w

0
x y z

h
hb

u
v
dz

h x h y dz wh whb 0
h

As the Leibniz rule to bring the derivatives into the integral sign gives
u
h
h
h
h x dz x h udz uh x uhb xb 0
h

it is obtained
h
h
hb h
h
hb

udz

u
h

u
h

vdz

v
h

v
h
wh whb 0
b
b
x h
x
x y h
y
y
b

H=h+hb

governing equations
shallow waters. continuity eq.
computational fluid dynamics I

w(h), (vertical component of the velocity on the surface) is given by


wh

dh h h
h

u h vh
dt t x
y

Substituting in the former equation


h
h
h hb

0
udz
vdz

x h
y h
t t
b

Noting that

hb
0 , and taking and renaming the main velocities as
t
h
h
u

1
udz u
H hb

1
vdz v
H hb

the continuity equation is obtained as


h uH vH

0
t
x
y

governing equations
shallow waters. dynamic eq.
computational fluid dynamics I

As the vertical acceleration is negligible, the third dynamic equation


2w 2w 2w
1 p
w
w
w
w
u
v
w

2 2 2 f z
z
y
z
y
z
t
x
x

can be written as

1 p
fz 0
z

Integrating this equation in depth and assuming the atmospheric pressure


to be zero it is obtained
h
h p
f z dz
hb

hb

dz

f z h hb ph phb p

Deriving with respect to x and y


fz

h
1 p

x
x

fz

h
1 p

y
y

governing equations
shallow waters. dynamic eq.
computational fluid dynamics I

The first dynamic equation results into


2u 2u 2u
u
u
u
h
u
fx fz
2 2 2
u
v w
x
y
z
t
x
y
z
x

Adding the continuity equation multiplied by u, it is obtained


2u 2u 2u
u v w
u
u
u
u
h
f x f z
u
v w u
2 2 2
z
x
y
z
t
x
y
x y z
x

this is
as

2u 2u 2u
h
u u 2 uv uw
fx fz
2 2 2

z
t x
y
z
x
y
x

u u 2 uv uw u
u u
v u
w

2u
vu
wu
t x
y
z
t
x y
y z
z

governing equations
shallow waters. dynamic eq.
computational fluid dynamics I

Integrating in depth the former expression

2u 2u 2u
h
u u 2 uv uw
2 2 2

fx fz
y
z
y
z
x
t x
x

hb
h h 2
h
h
2
2

u
h
udz
u
h
u
dz
u
h
b
t hb
t x hb
x
x
h
hb
h
h
h

uvdz

u
h
v
h

u
h
v
h

u
h
w
h

u
h
w
h

f
H

udz
x

b
b
b
b
z

hb
y hb
y
y

dh h h
h

u h vh , it is obtained
dt t x
y
hb
h
h
h h 2
2
2

udz
u
h
u
dz
u
h

u
h

h
h
b
b
t
t x
x
x

Taking into account that wh

h
h h

h h

h
h
h
h
h
h
uvdz u h vh u hb vhb b u h u h vh u hb b b u hb b vhb f x f z H udz

hb
y
x
y
x
y hb
y
y
t x

Cancelling terms
h
h
h 2
h
h

udz
u
dz
uvdz

f
H

udz
x

h
h
h
h
b
b
b
b
t
x
y
x

governing equations
shallow waters. dynamic eq.
computational fluid dynamics I

Taking mean velocities it is obtained


h
h
uH u 2 H uvH

f x f z H udz

hb
x
y
x
t

The viscosity effects can be evaluated as


2u 2u
hbudz x 2 y 2 H sx bx
h

where v is the turbulent viscosity


Where s x , bxare the shear stresses acting on the surface (due to the wind action)
and on the bottom (due to the roughness of the channel)
s
i

Cw a W Wi

CW = Wind drag coefficient


n = Manning coefficient
Wi = Wind velocity components
a = Air density

b H
i

gn 2 V ui
H h4 3

governing equations
shallow waters. dynamic eq.
computational fluid dynamics I

Developing the derivatives in the left hand side


H
u
v
H
H
u
uH u 2 H uvH u
H u
H u2
( v u ) H uv

2u

y
y
t
x
x
y
t
x
y
t

Taking into account the continuity eq.


h uH vH h u
H v
H

H u
H v
0
x
y
t x
y
t
x y

the former eq becames


H u
H v
H
u
uH u 2 H uvH u
u
H u
H u(
H u

H v
) vH
t
x
t x
x y
y
y
t
x
y
uH u 2 H uvH u
u
u

H u
H 0 vH
t
x
y
t
x
y

governing equations
shallow waters. dynamic eq.
computational fluid dynamics I

The derivatives of the depth with respect to x and y are


H h hb h

x
x
x

Carrying out the same operations for the y dimension, and developing the
derivatives taking into account the last expression it is obtained
2u 2u Cw a W Wx gn 2 V u
u
u
u
h

f c v 2 2
u
v
g
x
y

H
H h4 3

t
x
y
x

2 v 2 v Cw a W W y gn 2 V v
v
v
v
h
f c u 2 2

u v g
x

H
H h4 3
t
x
y
y

where fc is the Coriolis factor

governing equations
shallow waters
computational fluid dynamics I

The shallow water equations result into


h uH vH

0
t
x
y
2u 2u Cw a W Wx gn 2 V u
u
u
u
h

f c v 2 2
u
v
g
x
y

H
H h4 3

t
x
y
x

2 v 2 v Cw a W W y gn 2 V v
v
v
v
h

f c u 2 2
u v g
x
y

H
H h4 3

t
x
y
y

with boundary conditions


impermeability u N 0 , uT 0 (no slip)
discharge Hu N ds Q
contour stresses N N , T T
water level ht h t
0

governing equations
convection-diffusion equation
computational fluid dynamics I

If in the N-S dynamic equation we substitute the non-linear velocities by a known


velocity field and the rest of the velocities by the a scalar unknown we arrive to
the convection diffusion equation that rules the transport of substances by
convective and diffusive actions.
The equations are
2 2 2

U
V
W
k 2 2 2 f
y
z
y
z
t
x
x

,t U j, j k, jj Q 0
or in 1D


U
k
Q 0
x x x
t

where is the quantity being transported, k is the diffusion coefficient, Ui is the


known velocity field, and Q are the external sources of the quantity. These are
also known as the Transport Equations

finite elements in fluids


computational fluid dynamics I

CFDI

3. Finite Elements in Fluids

finite elements in fluids


general issues
computational fluid dynamics I

There is no analytical solution for most engineering problems such as


fluid flow

The determination of the velocity and pressure field is required in a


domain of infinite degrees of freedom

The Finite Element Method (developed about 1950 for structures)


substitutes the domain by another with a finite number of freedom
degrees, thus an approximation of the solution is obtained

Some important names in the finite element history are Courant, Turner,
Clough, Zienkiewicz, Brookes, Hughes,

Now it is used not only in structural mechanics but also in heat


conduction, seepage flow, electric and magnetic fields, and of course
in fluid dynamics

finite elements in fluids


general issues
computational fluid dynamics I

sms.avi

finite elements in fluids


general issues
computational fluid dynamics I

largo modulos.avi

2D h zoom at the mine.avi

3D H(x,y), water depth colour (only 600 days).avi

finite elements in fluids


general issues
computational fluid dynamics I

250
VEL
1.78125
1.6625
1.54375
1.425
1.30625
1.1875
1.06875
0.950002
0.831252
0.712501
0.593751
0.475001
0.356251
0.237501
0.11875
1.69975E-06
9.60324E-07
4.19696E-07
8.11084E-08

200

150

100

50

0
0

100

200

2D H (water level).avi

finite elements in fluids


general issues
computational fluid dynamics I

finite elements in fluids


general issues
computational fluid dynamics I

The main way of solving continuum problems in the finite element method are the
following
The direct approach (matrix analysis), by using a direct physical reasoning to establish
the element properties. Requires very simple basic elements (bars, pipelines,)
Variational approach (e.g. Rayleigh-Ritz based method), in this method the stiffness
matrix is obtained as a result of the resolution of a variational problem
Weighted residual approach (e.g. Galerkin Method), as a result of weighting the
differential equations and integrating them in the domain

finite elements in fluids


general issues
computational fluid dynamics I

Main steps of the finite element method


1. Subdivide the domain in a finite number of elements interconnected at the nodes,
where the unknowns (p, u) are going to be determined
2. It is assumed that the variation of the unknowns can be approximated by a simple
function
3. The approximation functions are defined in terms of the values of the field
variables at the nodes
4. When the equilibrium or variational equation has been obtained, the new finite
unknowns are introduced into the equations
5. The system of equations is solved and the unknowns are determined at the
nodes
6. The approximation functions give the solution in the rest of the domain
points

Following, the fem solution of the one simple 1-D problem is to be considered
on a 6-step basis

finite elements in fluids


general issues
computational fluid dynamics I

'...as the nature of the universe is the most perfect and the work of the
Creator is wiser, there's nothing that takes place in the universe in
which the ratio of maximum and minimum does not appear. So there is
no doubt whatsoever that any effect of the universe can be explained
satisfactorily because of its final causes, through the help of the method
of maxima and minima, as can be by the very causes taking place

Leonhard Euler
(Basel,1707- Saint Petersburg,1783)

In the traditional Rayleigh-Ritz methods the interpolating functions have to be


defined over the entire domain and have to satisfy the boundary conditions.
Meanwhile in the FEM the interpolating trial functions are defined on a finite element
basis, being more versatile when the shape is not simple enough
The limitation is that the FEM

trial functions have to satisfy in addition some

convergence conditions (continuity and completeness and compatibility)

finite elements in fluids


variational approach
computational fluid dynamics I

When using a variational approach, the aim is to find the vector function of
unknowns, that makes a minimum or a maximum of the functional I (typically
the energy)



I F , ,...dV g , ,... dS
x
x

After the discretization has been carried out in terms of E smaller parts the
piecewise approximation is introduced so that

aprox

or in terms of the so called shape functions Ni


e

e N11 N 2 2
where i are the values of the unknowns at the nodes

finite elements in fluids


variational approach
computational fluid dynamics I

Afterwards, the condition of extremezation of I with respect to i is imposed


I 1

I
I 2

0

i

I
M

Adding all those element contributions it is obtained


E
I
I e

0
i e 1 i

Assuming I to be a quadratic functional of the element equation results in


I e
e e
e
e K P

finite elements in fluids


variational approach
computational fluid dynamics I

After the assembling process it is obtained

K P
K K and
E

where

e 1

P P e
e 1

After applying the boundary conditions the system is solved for the nodal
unknowns i
Once i are known, we can obtain other variables as a post-processing value

finite elements in fluids


variational approach, example
computational fluid dynamics I

Example. Find the velocity distribution of an inviscid fluid flowing trough a


varying cross section pipe shown in the figure
The governing equations are defined by finding the potential that minimizes the
energy integral equation

1 L d
I A dx
2 0
dx
2

with the boundary condition u(x=0)=u0, where the cross section area is

A0
A1
u0

A2

2
l(1)

3
l(2)

A A0 e x L

finite elements in fluids


variational approach, example
computational fluid dynamics I

1st step. Discretization


Divide the continuum into two finite elements. The values of the potential
function at the three nodes will be the unknowns of the fem
2nd step. Select an interpolation model, easy but leading to convergence
The potential function will be taken as linear

x a bx
and can be evaluated at each element as

e x 1e 2e 1e
where l(e) is the length of the e element

l e

finite elements in fluids


variational approach, example
computational fluid dynamics I

3rd step. Derivation of stiffness matrices K(e) and load vectors P(e) by using
a variational principle
Deriving the interpolating function with respect to x it is obtained

e
1 l e 2e 1e
A 2e 1e 2 2e 1e
d
e 1 l
l e

I A dx A
dx
x

o
2

2 0
2 0
l e
dx
2l e

A 2e 1e 2 2e 1e
2

2l e

1
2

e
1

1 1e 1 e T e e
1 1 e 2 K

A 1
e

where the cross sectional areas can be taken for the first and second element
as

A0 A1
2

and

A1 A2
2

where the nodal unknowns are respectively (1)

2
1 and
( 2)


3
2

finite elements in fluids


variational approach, example
computational fluid dynamics I

3rd step. (cont)


The minimal potential energy principle gives I 0, if we take into account the
i
external inflow
2
2
A 2e 1e 2 2e 1e
e
e e
e e 1 e T e e
e T e
I

2l

1 Q2 2
2

where Q is the mass flow rate across section Q Au


therefore, if we derive the functional I for each basic element

2
2
I e

A
A
e
2e 1e 2 2e 1e
Q1( e ) 1e Q2( e ) 2e e 1e 2e Q1( e ) 0
1 2l 1
1
l

2
2

I e
A
A
e
2e 1e 2 2e 1e
Q1( e ) 1e Q2( e ) 2e e 2e 1e Q2( e ) 0
2 2l 2
2
l

or in matrix form

T
T
I e 1
e K e e e Q e K e e Q e 0

i 2 i

finite elements in fluids


variational approach, example
computational fluid dynamics I

4th step. Assembly of the stiffness and load vectors


Once we have obtained the matrices for all the basic elements as
K

A1 1
l 1

1
1 1

A2 1
l 2

A1u1
Q 1

1
1 1

0
Q 2

A3u2

we can assemble the system K Q to obtain


A1
1
l 1
A
l 1

A1
l 1

A1
l 1

A2
l 2

A2
l 2

A0u0
2 1
A
2 2 0
l
A2 3 A2u2

l 2
0

finite elements in fluids


variational approach, example
computational fluid dynamics I

5th step. Resolution of the system


As we need a reference value for the potentials (u3 is an unknown) we can set
equal to 0
Taking A(1) as 0.80 A0 and A(2) as 0.49 A0, and l(1)= l(2)=L/2, the system of two
equations with two unknowns gives

1 1.65u0 L

2 1.027u0 L

6th step. Computation of the results


Once we have obtained the potentials, the velocities can be derived by using
the equivalence
u

d 2 1

dx
l 1

which gives the velocities at elements 1 and 2 as

u 1 1.25u0

u 2 2.05u0

finite elements in fluids


weighted residuals
computational fluid dynamics I

In this method the FE equations can be directly obtained from the governing
equations (or equilibrium equations)

F G
The discretization is made and the field variable is approximated as
n

x i N i x
~

i 1

where i are constants and Ni(x) are linearly independent functions chosen
such that the boundary conditions are satisfied
A quantity R known as the residual or error is defined as

~
~
RG F

The weighted function of the residual is taken as

where f(R)=0 when R=0

wf R dV 0

finite elements in fluids


weighted residuals
computational fluid dynamics I

There are several approaches to the weighted residuals method such as the
collocation method, the Least Squares method and the most commonly used of
all, the Galeking method
In the Galerkin method the weighting functions are chosen to be equal to the
trial functions and f(R) is taken as R

N RdV 0
i

with i=1,2,,n

In the rest of the aspects the method is similar to the variational

finite elements in fluids


weighted residuals
computational fluid dynamics I

Example. Find the velocity distribution of an inviscid fluid flowing trough a


varying cross section tube shown in the figure
The governing equations are given by the continuity equation

d 2
0
dx 2
with the boundary condition u(x=0)=u0, where the cross section area is

A1
A2
u0

A3

2
l(1)

3
l(2)

A A1e x L

finite elements in fluids


weighted residuals
computational fluid dynamics I

1st step. Discretization


Divide the continuum into two finite elements. The values potential function in
the three nodes will be the unknowns of the fem
2nd step. Select an interpolation model, easy but leading to convergence
The potential function will be taken as linear

x a bx
and can be evaluated at each element as

x 1e 2e 1e
where l(e) is the length of element e

l e

finite elements in fluids


weighted residuals
computational fluid dynamics I

This can also be obtained through the shape functions which have to be 1 at its
node and zero at the others, that is

N1 1

1
l(e)

x 1 N1 x 2 N 2 x

1
l(e)
this is

x
x
x

x 1 1 e 2 e 1 2 1 e
l
l
l
(the same as obtained before)

N2

l e

l e

finite elements in fluids


weighted residuals
computational fluid dynamics I

3rd step. Derivation of stiffness matrices K(e) and load vectors P(e) by using
equilibrium. Obtaining of a weak form
The integral of the weighted residual is

l e

integrating by parts

l e

d 2
wi 2 dx 0
dx

d 2
dv 2 dx
dx

u wi

du dwi

d
dx

l e

e
l e d

d
d 0 l e d dwi
d
e d l

wi 2 dx wi
dwi wi l
dx 0

wi 0

0
0
dx
dx
dx
dx
dx
dx
dx 0

l e

dwi d
dx wi l e u2 wi 0 u1
dx dx

finite elements in fluids


weighted residuals
computational fluid dynamics I

This is

l e

l e dw dN
dwi d
i
1
N11 N 2 2 dx 0

dx dx
dx dx

dN 2 1
e
dx

w
l
u 2 wi 0 u1
i

dx 2

The elementary matrices result into


K e e P e 0

As
where
dN1
dN

K e dx 1
dN
2 dx
dx

dN1

dN 2
dx dx

dx
dN 2

dx

As the derivatives are

dN1
dx
dN1
dx

dN1
1

dx
L

the elementary matrices result into


1

2
e l e
K
1
e 2
l

dN1
dx
dN 2
dx

dN 2

dx dx
dN 2

dx

dN 2 1

dx
L

1
2 e
l e l dx 1 1 1
1 0
l e 1 1
2
l e

u
P e 1
u2


(1) 1
2


( 2 ) 2
3

finite elements in fluids


weighted residuals
computational fluid dynamics I

4th step. Assembly of the stiffness and load vectors


Once we have obtained the matrices for all the basic elements as
K 1

1 1 1
l 1 1 1

K 2

1 1 1
l 2 1 1

u
P 1 0
0

we can assemble the system K Q to obtain


1
l 1
1
1
l
0

l 1

1
l

l 2
1

l 2

0
1 u 0
1
2 2 0
l
1 3 u2
l 2

0
P 2
u2

finite elements in fluids


weighted residuals
computational fluid dynamics I

5th step. Resolution of the system

6th step. Computation of the results

As can be seen, the system of equations obtained by the weighted residuals


method is the same as in the variational method except for the absence of the
density (which can be removed as it is a constant), and the cross section areas.

The areas are not present in the second formulation as the system is solved in
velocities and not in flow rates. To avoid this fact a two dimensional model
should be considered.

finite elements in fluids


discretization
computational fluid dynamics I

Finite elements = Piecewise approximation of the solution by dividing the


region into small pieces
This approximation is usually made in terms of a power series (polynomial) which
is easy to integrate and easy to be improved in accuracy by increasing the order,
fitting in this way the shape of the polynomial to that of the solution (see figure)
When the polynomial is of higher order (bigger than one) the midside and/or
interior nodes have to be used in addition to the corner nodes
Some other approximations such as Fourier series could also be used
Problems involving curved boundaries can be solved using isoparametric
elements which are not straight-sided

finite elements in fluids


discretization
computational fluid dynamics I

finite elements in fluids


discretization
computational fluid dynamics I

The mesh can be improved by

Subdividing selected elements (h-refinement)

Increasing the order of the polynomial of selected elements (p-refinement)

Moving node points (r-refinement)

Defining a new mesh

In higher order elements the midside and/or interior nodes have to be used in
addition to the corner nodes in order to match the number of nodal degrees of
freedom with the number of constants

As it will be shown a different interpolation for the velocity and pressure


unknowns is required for fem in fluids

Basic elements to be considered

Triangular linear

Quadrilateral linear

Triangular linear (natural)

Triangular quadratic

finite elements in fluids


discretization, convergence
computational fluid dynamics I

The FEM is an approximation that converges to the exact solution as the element
size is reduced if:
i. The field variable and its derivatives must have representation as the element
size reduces to zero
For example, second derivatives cannot be represented with linear functions
Then the elements are said to be complete
ii. The field variable and its derivatives should be continuous within the element (Cr
piecewise differentiable, where r is the maximum order of derivatives within the
integrand)
r

d
dx r dx

(The polynomials are inherently continuous and satisfy this requirement)


The field variable and its derivatives, up to the r-1-th, must be continuous at the
element boundaries
Then the elements are said to be compatible or conforming

finite elements in fluids


discretization, convergence
computational fluid dynamics I

If we had for instance, flat penthouses as interpolating functions, the


interpolating surface would be discontinuous (would break and split up)

Still, there are many fem basic elements that not verifying the former properties
still provide meaningful solutions (such as the checker board pressure mode)

100.00

55.00
90.00

50.00
80.00

45.00
70.00

40.00
60.00

35.00

50.00

30.00

40.00

25.00

20.00

30.00

15.00
20.00

10.00
10.00

5.00
0.00
0.00

10.00

20.00

30.00

40.00

50.00

60.00

70.00

80.00

90.00

100.00

5.00

10.00

15.00

20.00

25.00

30.00

35.00

40.00

45.00

50.00

55.00

finite elements in fluids


discretization, triangular linear b.e.
computational fluid dynamics I

Let the basic linear triangular element connecting nodes 1, 2,and 3 be

The equation that gives the


surface (plane) is

x , y 1 2 x 3 y

3
1

x2 , y 2
x

x3 , y3

x1 , y1

that leads to the following


equations

1 1 2 x1 3 y1
2 1 2 x2 3 y 2
3 1 2 x3 3 y3

(1)

finite elements in fluids


discretization, triangular linear b.e.
computational fluid dynamics I

The solution of the former system gives


1

where

1
a11 a22 a33
2A

1
b11 b22 b33
2A

1
c11 c22 c33
3
2A

1 x1
1
A 1 x2
2
1 x3

y1
y2
y3

(2)

a1 x2 y3 x3 y2

b1 y2 y3

c1 x3 x2

a2 x3 y1 x1 y3

b2 y3 y1

c2 x1 x3

a3 x1 y2 x2 y1

b3 y1 y2

c3 x2 x1

substituting (2) in (1) and rearranging terms it is obtained

finite elements in fluids


discretization, triangular linear b.e.
computational fluid dynamics I

The interpolating function results


x, y N1 x, y 1 N 2 x, y 2 N 3 x, y 3

where
N1 x , y

1
a1 b1 x c1 y 1 x2 y3 x3 y2 x y2 y3 yx3 x2
2A
2A

N 2 x, y

1
a2 b2 x c2 y 1 x3 y1 x1 y3 x y3 y1 yx1 x3
2A
2A

N 3 x, y

1
a3 b3 x c3 y 1 x1 y2 x2 y1 x y1 y2 yx2 x1
2A
2A

(3)
The shape functions take the value of 1 at its node and cero at the rest
These expressions are complicated and depend on x and y

finite elements in fluids


discretization, triangular linear
computational fluid dynamics I

For an A element matrix equal to


N i N j N i N j
dxdy

x
y y
x

A e Aij

The integrals are


N1

x
N
A e 2
x
e
N 3
x

N1 N1 N1

x
y y
N1 N 2 N1

y y
x
N1 N 3 N1

x
y y

N1
x
N 2
x
N 3
x

N 2 N1 N 2

x
y y
N 2 N 2 N 2

y y
x
N 2 N 3 N 2

x
y y

N1 N 3 N1 N 3

x x
y y
N 2 N 3 N 2 N 3

dxdy
y y
x x
N 3 N 3 L3 N 3

x x
y y

As the integrand is a constant there is no need to integrate numerically


y2 y3 2 x3 x2 2

A e
e 2

4A
sim

y2 y3 y3 y1 x3 x2 x1 x3 y2 y3 y1 y2 x3 x2 x2 x1
y3 y1 2 x1 x3 2
y3 y1 y1 y2 x1 x3 x2 x1 dxdy

y1 y2 2 x2 x1 2

finite elements in fluids


discretization, triangular linear
computational fluid dynamics I

The basic element matrix results


y2 y3 2 x3 x2 2

A e
4 A e

sim

y2 y3 y3 y1 x3 x2 x1 x3 y2 y3 y1 y2 x3 x2 x2 x1
y3 y1 2 x1 x3 2
y3 y1 y1 y2 x1 x3 x2 x1

y1 y2 2 x2 x1 2

That now can be assembled


in the stiffness matrix to yield
6

2
9

1 f1
f
2 2
3 f3

4 f4
5 f5

6 f6
f
7 7
8 f8
f
9 9
10 f10

finite elements in fluids


discretization, triangular natural
computational fluid dynamics I

The need of integrating the shape functions and their derivatives over
the domain in connection with the use of quadratic basic elements
leads to the use of the natural (local) coordinates, which allows for an
element based integration that simplifies the calculations
The natural triangular system of reference is defined with the linear
dependent coordinates L1, L2, and L3
3
L1

A1
A

L2

A2
A

L3

L1 L2 L3 1

A2 A1
P
A3

A3
A

where Ai is the area defined by the point P and the opposite side
(The shape functions for the triangular linear element would be)
N i Li

i 1,2,3

finite elements in fluids


discretization, triangular quadratic
computational fluid dynamics I

When the basic triangular element is quadratic


2

4
6

x2 , y 2
x

x3 , y3

x1 , y1

It is more convenient to express the shape functions in terms of the local (or
natural) coordinates which are referred to every single basic element.

finite elements in fluids


discretization, triangular quadratic
computational fluid dynamics I

For natural coordinates in triangles one of the three coordinates is


linear dependant and can be dropped from the integration leading to a
change in the integration limits
L2
(0,1)

L1 L2 L3 1

L1+L2=1
L1
(1,0)

1 1 L1

f x, y dxdy

0 0

1 1 L1

J f x, y dL2 dL1

0 0

g L1 , L2 dL2 dL1

finite elements in fluids


discretization, triangular quadratic
computational fluid dynamics I

The unknown function is now expressed as

x, y N11 N 2 2 N 6 6
The shape functions for this triangular quadratic elements result
N i Li 2 Li 1
N 4 4 L1 L2
i 1,2,3

N 5 4 L2 L3 4 L2 (1 L1 L2 ) 1

N 3 1 L1 L2 1 2 L1 2 L2 N 6 4 L1 L3 4 L1 (1 L1 L2 )
4

4
4

4
4

4
4

3
8

finite elements in fluids


discretization, triangular natural
computational fluid dynamics I

If we had used the natural coordinates for the linear elements, the
shape functions would have been
1 xj

N i Li

1
1 xk
2A
1 x

N i x, y Li x, y

yj

2A
yk i
2A
y

1
x j yk xk y j xy j yk yxk x j
2A

A2 A1
P
A3

Or in matrix form
L1
x2 y3 x3 y2
1
L

2 2 A x3 y1 x1 y3
L3
x1 y2 x2 y1

y2 y3 x3 x2 1
y3 y1 x1 x3 x
y1 y2 x2 x1 y

Through the inverse matrix

1 1
x x
1
y y1

1
x2
y2

1 L1
x3 L2
y3 L3

1 x1
1
A 1 x2
2
1 x3

y1
y2
y3

finite elements in fluids


discretization, triangular natural
computational fluid dynamics I

The derivatives of x and y with respect of of L1, L2 being


x
( x1 x3 )
L1

x
( x2 x3 )
L2

y
( y1 y3 )
L1

y
( y 2 y3 )
L2

Where the Jacobian determinant is

2A

x y
x y

2A
L1 L2 L2 L1

finite elements in fluids


discretization, triangular quadratic
computational fluid dynamics I

For a A matrix equal to


N N j N i N j
N i N j N i N j
J dL2 dL1

dxdy i

A Aij

y y
y y
x x
x x

Ne Ne Ne Ne Ne Ne Ne Ne
1 1
1 2 1 2
1 1

y y
x x y y
x x
e
e
e
e
N N N N Ne Ne Ne Ne
2 1 2 1
2 2 2 2
A J
x x
y y
x x y y

e e
e
e
e
e
e
e
N6 N1 N6 N1 N6 N2 N& N2

x x y y

y y
x
x

Ne Ne Ne Ne

1 6 1 6
x x y y
Ne Ne Ne Ne
2 6 2 6

dL dL
x x y y 2 1

e
e
e
e
N N N N
6
6
6
6

x x y y

The integrals are


N i 1 N i y N i y
(

)
x
J L1 L2 L2 L1

N i 1
N x N i x
( i

)
J
L1 L2 L2 L1
y

finite elements in fluids


discretization, triangular quadratic
computational fluid dynamics I

Because

N i N i x N i y

x L1 y L1
L1
N i N i x N i y

x L2 y L2
L2

And inverting the matrix


N i 1 N i y N i y
(

)
x
J L1 L2 L2 L1

N i 1
N x N i x
( i

)
J
L1 L2 L2 L1
y

finite elements in fluids


discretization, triangular quadratic
computational fluid dynamics I

For elementary triangles the numerical integration in terms of the


natural coordinates gives
I
Order


f L , L , L d w f L , L , L
n

Triang. Coord.

Weights

Linear (O(h2))

1 1 1
, ,
3 3 3

Quad, (O(h3))

1 1
, ,0
2 2

1
3

1 1
0, ,
2 2
1 1
,0 ,
2 2

1
3
1
3

i 1

i
1

i
2

i
3

for instance, if a four point Gauss rule is used it is obtained


I

11
1
1
1 1

1 1

0
0
f
L
,
L
,
L
f
,
,
f

,0 ,
1
2
3
2 3
2
2
2
2

2 2

finite elements in fluids


discretization, triangular natural linear
computational fluid dynamics I

For an A element matrix equal to


L L j Li L j

N i N j N i N j
dL2 dL1
A e Aij
dxdy 2 A i

x
x x

x
y
y
y
y

The integrals of the linear element lead to


L1

x
1 1 L1
L
A e 2 Ae 2
x
0 0
L3
x

L1 L1 L1

x y y
L1 L2 L1

x y y
L1 L3 L1

x y y

L1
x
L2
x
L3
x

L2 L1 L2

x y y
L2 L2 L2

x
y y
L2 L3 L2

y y
x

L1
x
L2
x
L3
x

L3 L1 L3

x y y
L3 L2 L3

dL2 dL1
x
y y
L3 L3 L3

x y y

As the integrand is a constant there is no need to integrate numerically


y2 y3 2 x3 x2 2
2A
A e

4 A2

sim

y2 y3 y3 y1 x3 x2 x1 x3 y2 y3 y1 y2 x3 x2 x2 x1 1 1 L
y3 y1 2 x1 x3 2
y3 y1 y1 y2 x1 x3 x2 x1 dL2 dL1
0 0
y1 y2 2 x2 x1 2

finite elements in fluids


discretization, triangular natural linear
computational fluid dynamics I

Integrating the basic element area it is obtained


1 1 L1

dL dL L
1

1 L1
2 0

L12
1
dL1 1 L1 dL1 L1
0
2 0 2

(it is a half of the area of the square)


The integrals are
y2 y3 2 x3 x2 2

e

A
4 A e

sim

y2 y3 y3 y1 x3 x2 x1 x3 y2 y3 y1 y2 x3 x2 x2 x1
y3 y1 2 x1 x3 2
y3 y1 y1 y2 x1 x3 x2 x1

y1 y2 2 x2 x1 2

which, as can be seen gives the same result as the one obtained with
the global linear coordinates

finite elements in fluids


discretization, quadrilateral linear b.e.
computational fluid dynamics I

(-1,1)

(-1,-1)

(1,1)

(1,-1)

finite elements in fluids


discretization, quadrilateral linear b.e.
computational fluid dynamics I

For linear quadrilateral elements The unknown function is now


expressed as
4

, N , j
h

j 1

where the quadrilateral natural coordinates are given by the lines that
join the midpoints of opposite lines
The shape functions for this triangular quadratic elements result
1
N 1 1 1
4
N2

1
1 1
4

1
N 3 1 1
4
N4

1
1 1
4

(-1,1)

(-1,-1)

(1,1)

(1,-1)

finite elements in fluids


discretization, quadrilateral linear b.e.
computational fluid dynamics I

The derivatives that show up in the integrals leading to the basic


matrices are made in terms of the global coordinates

f x, y dxdy f x, y J dd g , dd
where the jacobian determinant is
J

x y x y

finite elements in fluids


discretization, quadrilateral linear b.e.
computational fluid dynamics I

f(x,y) is a function of Ni and its derivatives, where its derivatives with


respect to global coordinates can be written in terms of the local
coordinates as
N i 1 N i y N i y

J
x
N i 1 N i x N i x

J
y
where Cartesian and natural coordinates are related as follows
4

x N k xk
i 1

y N k yk
k 1

N k
x
xk

N k
x
xk

N k
y
yk

N k
y
yk

finite elements in fluids


discretization, quadrilateral linear b.e.
computational fluid dynamics I

For a A matrix equal to

A Aij


N i N j N i N j
dxdy

x
y y
x

N e N e
1 1

x x
N e N e
2 1
x x
A J
e e
N3 N1

x x
N e N e
4 1
x x

N i N j N i N j
J dd

y y
x x

N e N e N e N e N e N e N e N e N e N e N e N e N e N e

1 1
1 2 1 2
1 3 1 3
1 4 1 4

y y
x x
y y
x x
y y
x x
y y
N e N e N e N e N e N e N e N e N e N e N e N e N e N e
2 2 2 2
2 3 2 3
2 4 2 4
2 1
y y
x x
y y
x x
y y
x x
y y
dd
N e N e N e N e N e N e N e N e N e N e N e N e N e N e
3 2 3 2
3 3 3 3
3 4 3 4
3 1

y y
x x
y y
x x
y y
x x
y y
N e N e N e N e N e N e N e N e N e N e N e N e N e N e
4 2 4 2
4 3 4 3
4 4 4 4
4 1
y y
x x
y y
x x
y y
x x
y y

The integrals are


Aij

1
J

N i

N i

yk
k 1

x
k 1

N k N i

N k N i

x
K 1

yk
K 1

N k

N k N j

N j

x
k 1

yk
k 1

N k N j

N k N j

x
K 1

N k

y
K 1

dd

N k

finite elements in fluids


discretization, quadrilateral linear b.e.
computational fluid dynamics I

The integration of the elementary matrices has to be done in terms of


a numerical procedure the most common of which is the Gauss
integration. The integrals are evaluated as
I
n
1

f , dd H H f
1

1 1

j i

Hi=Hj

2.0

0.57735

1.0

0
0.77459

0.88888
0.55555

i 1 j 1

,i

-1

-1

for instance, if a four point Gauss rule is used it is obtained


I (1.00)(1.00) f 0.57, 0.57 f 0.57,0.57 f 0.57,0.57 f 0.57,0.57

A Gauss surface integration with nxn Gauss points will be enough to


obtain the exact solutions for polynomials of grade up to 2n-1 in each
direction of the space.

finite elements in fluids


2D potential flow
computational fluid dynamics 1

The governing equation of the two dimensional potential flow is therefore given by

2 2
2 2 0
x
y
2

where the velocity components are given by u


with the boundary conditions
0
Dirichlet
x

in

Newman Vn nx n y V0
n

in

in 2

were nx and ny are the direction cosines of the outward unit vector n to 2

finite elements in fluids


2D potential flow, Galerkin approach
computational fluid dynamics 1

1.- Divide the region into E finite elements of p nodes each


2.- Assume a suitable interpolation model for e in element e as

x, y N i x, y ie
i 1

3.- Set the integral of the weighted (with weights equal to the interpolation
functions (Galerkin)) residue over the regions of the elements equal to zero
2 e 2 e

I Ni
d 0
2
2

x
y

i=1,2,,p

4.- Integration by parts (Green-Gauss theorem)

N i e N i e
e
e

nx
n y d 0
d N i
x x
y y
y
x

e
e

finite elements in fluids


2D potential flow, green-gauss integ.
computational fluid dynamics I

The first second derivative in the integral, i.e.


2
I Ni

x 2

xL

can be integrated by parts making


I N i


dxdy udv dy
x x

yT

N i

I
N
dy
this results in
i
yB x x
x x dxdy
L

and therefore

yT

yB

xR

I Ni

dy

d
xR

v dx
x x
x

u Ni

with

dy nx d

N i

nx d
d
x x
x

2 e
N i e
e
e N i x 2 d e x x d e N i x nx d 0

or
Carrying out the same procedure for the derivatives with respect to y

finite elements in fluids


2D potential flow, integral equation
computational fluid dynamics I

and writing the contour integral in terms of the boundary conditions as


e
e
N i
nx
n y d N iV0 d2

y
e
e
e
x

1 2
2

the integral equation results

N i e N i e
e x x y y d e N iV0 d2

2
therefore, the Newman boundary conditions are naturally introduced

K e

In matrix form
with

B B d
T

V0 N d2
2

finite elements in fluids


2D potential flow, matrix formulation
computational fluid dynamics I

where

N1
x
B N
1
y

N 2
x
N 2
y

N 3
x
N 3
y

N 2 N 2
1 1
x y

T
B B

sim.

N1 N 2 N1 N 2

x x
y y
N 2 N 2

x
y

(for a linear triangular basic element)


Assembling the elementary matrices it is obtained

K P

N1 N 3 N1 N 3

x x
y y
N 2 N 3 N 2 N 3

x x
y y
2
2
N 3 N 3


x
y

finite elements in fluids


2D potential flow, matrix formulation
computational fluid dynamics I

for a linear triangular basic element the elementary stiffness matrix results in
1
ai bi x ci y
Ni
2A

and the source matrix

bi2 ci2
1
K e B T B d
4 Ae

sim

b b
b
i

j
2
j

ci c j
c 2j

bibk ci ck

b b
b
j

c
c

k
j k
2
2

k ck

1
V
s
e
0 ij
P V0 N d2
1
2
2
0
T

when the fluid is entering the edge ij of length sij with a velocity V0 normal to the
edge
If the fluid is entering the edges jk or ik the elementary vectors are

0
V
s
e
0 jk
1
P

2
1

1
e V s
P 0 ik 0
2
1

finite elements in fluids


2D potential flow, example
computational fluid dynamics I

Let us apply the so-obtained formulation to the obtaining of the confined flow
around a cylinder. Due to its symmetry, the domain can be chosen to be a forth
of the total area
n 0
2

3
4

2
3
1

n 1

11

12
13

10

12

8
9

8
13

10

11

n 0

The boundary conditions will be:


An inlet constant velocity V0=1 normal to boundary 1-9
Constant potential in boundary 4-13 due to the symmetry (taken as cero for
convenience
Tangential velocity (V0=0) in the rest of the boundaries

finite elements in fluids


2D potential flow, example
computational fluid dynamics I

For the nodes coordinates shown the node-1 basic stiffness matrices are
obtained as
5
Nodo

9.17

12

9.17

5.5

12

5.5

10

11

12

9.17

2.83

13

12

1.025 0.4 0.625


0.4
0
K 1
sim
0.625
2
1
P 0
2

5
6
1

5
6
1

finite elements in fluids


2D potential flow, example
computational fluid dynamics I

Notes
As the potentials 4= =0, the corresponding rows and columns can be
eliminated from the system of equations to be solved for 1, 5, ,
9, , 12.
The velocity can be obtained as a post-process value making
ui j

j i

x j xi
x

vi j

j i

y j yi
y

finite elements in fluids


2D laminar NS, preliminary issues
computational fluid dynamics I

Up to this point some simple flow problems have been solved, but there are
many flow problems in which the Navier-Stokes equations have to be solved
The Navier-Stokes equations present two important problems that did not
arise before i.e.:
The presence an heterogeneous set of unknowns (velocity and pressure) that
requires special treatment.
This has to do with the verification of the continuity equation and causes
instabilities in the pressure field, no matter the Reynolds number is.
Therefore a proper combination of the velocity and pressure field is required
unless special formulation to circumvent this is added
The non-linear convective term appears, turns the stiffness matrix into a nonsymmetric one and leads to a certain amount of instability.
The Galerkin formulation lacks stability when convective effects dominate (this
is for large Reynolds numbers, Re=uL/v) and alternative stabilizing techniques
have to be used (Petrov-Galerkin, Characteristics Galerkin, GLS, SUPG, Finite
Increment Calculus, Bubble functions,...)

finite elements in fluids


2D laminar NS, velocity & pressure
computational fluid dynamics I

The need of verifying the continuity condition (divergence free


condition) together with the existence of two different types of
variables is mainly solved in two different ways:
Keeping both variables and both sets of equations leads to the socalled mixed formulation, the stiffness matrix becomes a partitioned
one with a null submatrix in the diagonal and a proper selection of the
basic elements has to be made to verify the LBB condition or
circumvent it
The penalty formulation takes

u p

instead of the continuity condition, where is a very small parameter,


and takes it into the dynamic equation.
The selection of is a difficult task as being too small may cause a loss
of accuracy and being too big may prevent the convergence

finite elements in fluids


2D laminar NS, algebra issues
computational fluid dynamics I

Some kind of functions to which the velocity and pressure fields must belong
to are presented

L2
H k

L20
H 01

Sobolev space of square integrable functions within


Hilbert space, subspace of L2 of functions whose
derivatives up to the k-th also belong to L2
Subspace of L2 with a null mean in the domain (to be
used in relation to the pressure. Can be avoided by
setting a given pressure at a certain point)
Subspace of functions that, belonging to H1, are
cancelled at the boundary

finite elements in fluids


2D laminar NS, algebra issues
computational fluid dynamics I

With respect to the velocity, u, the space of trial solutions is denoted by


S, which must be a subspace of H1 that satisfies the Dirichlet
conditions on the boundary

The weighting functions of the velocity, w, will belong to the V spaces


which belong to H1 and vanish on the boundary where the velocity is
prescribed

Finally the subspace Q will be introduced for the pressure. As no


explicit boundary conditions are prescribed for pressure and no
derivatives of the pressure show up in the weighted formulation as it
will be seen, it is only required that Q belongs to L2 for both the trial
and weighting functions

finite elements in fluids


2D laminar NS, weighted residuals
computational fluid dynamics I

Once weve got the governing Navier-Stokes differential equation, we are


going to solve it by using the finite element method, that is, to obtain the
n
approach
u u i N i
1

where Ni are the shape functions defined on a local basis for each element
and where the coefficients i are the unknowns for each of the nodes

In order to do so, we need to express the governing equation as

G ud g ud
m

e 1

G j d e g j d

so as to obtain the integral forms, we can apply the weighted residuals


method (de Galerkin) or the variational

finite elements in fluids


2D laminar NS, weighted residuals
computational fluid dynamics I

The 2D equations to be solved are

u i ,t u j u i , j

p,i ui , jj f i 0

ui ,i 0

Multiplying the equation by the weighting functions and integrating within the
domain, it is obtained

1
wi u i ,t u j u i , j p,i u i , jj f i d 0

qu

i ,i

d 0

if these integral expressions are verified for any wi, q, then, the differential
equations will be satisfied within the whole domain

finite elements in fluids


2D laminar NS, weighted residuals
computational fluid dynamics I

The viscous term is

2 ui 2 ui
wi ui , jj d wi 2 2
y
x

Integrating the first term by parts(in 2D)


I wi

ui

dxdy udv dy
x x

u wi

ui
u

dx i
x x
x

The integral b.p. results into


I

ui
wi
dy
yB
x

xL

xR

yT

wi

ui
n x d
x

n
xL

d
xR

wi ui
dxdy
x x

wi ui
d
x x

dy

yT

yB

dy n x d

finite elements in fluids


2D laminar NS, Green theorem
computational fluid dynamics I

Proceeding in an analogous way with the second term, it is obtained

wi

ui

y y

wi

ui
n y d
y

wi ui
d
y y

therefore

wi ui , jj d wi , j ui , j d wi ui , j n j d

Proceeding in an analogous way with the pressure term


1

wi p,i d

wi ,i pd

w pn d
i

The viscous component of the boundary integral is small compared to


the pressure component and its often dropped

finite elements in fluids


2D laminar NS, weak form
computational fluid dynamics I

The stationary formulation that also ignores the convective terms gives

wi , j ui , j d

wi ,i pd wi f i d ti wi d2
2

qu

i,i

d 0

ui 1 bi

q Q

wi V

ij n j ti
2

or in vectorial notation
u : wd

pwd w f d t wd2

qud 0

finite elements in fluids


2D laminar NS, matrices
computational fluid dynamics I

The Stokes simplification can be written as


B x T

B x u f x

B y v f y
p

where

Aij

wi N j wi N j

d
x x y y

Bxij

f xi wi f xi d wi t xi d
e

wi
j d
x

B yij

wi
j d
y

f yi wi f yi d wi t yi d
e

finite elements in fluids


2D laminar NS, LBB
computational fluid dynamics I

As stated before, the selection of the basic functions N and is not trivial, as it
involves different types of equations and unknowns
The matrix expression of the stationary flow results into

K
T
B

B u f

0 p 0

nxn

nxm

mxn

where the dimension of K is nxn (n range) and the dimension of B is nxm. In


order to obtain a unique solution, the stiffness matrix (with dimensions
(n+m)x(n+m)) must be non-singular and in order to achieve so, it is required
(although not sufficient) that
h
h

dim Q dim V

in other case the range of matrix B would be n (its range cannot be bigger than
n) there would be more equations than unknowns, and the system would be
non-compatible

finite elements in fluids


2D laminar NS, LBB
computational fluid dynamics I

The sufficient condition is the so called LBB (Ladyzhenskaya -BabuskaBrezzi) condition, that sets that for a given value of regardless of the
mesh size, the existence of an approximate solution (uh, ph), requires an
election for subspaces Vh, Qh, so that

inf sup
q Q
h

wih V h

from the system

q h wih,i d

h
i 1

Ku Bp f

BT u 0
solving first equation for u gives

u K 1 f Bp
that once introduced at the second one gives

B K B p B K
T

finite elements in fluids


2D laminar NS, LBB
computational fluid dynamics I

If the velocity-pressure pair verifies the LBB condition, that is, it ensures
that ker B = 0, the matrix BTK-1B is positive definite, the stiffness matrix
is regular (non-null determinant) and the problem of finding u h V h p h Q h
verifying the equations is univocally determined
We are going to illustrate this condition with some particular examples
of velocity-pressure pairs. After that, the most popular pairs for fluid
problems will be presented
In order to do so the particular case of a square domain of n by n nodes
(like the one being used to evaluate the cavity flow) will be presented
400
Level
19
18
17
16
15
14
13
12
11
10
9
8
7
6
5
4
3
2
1

350
300
250

200
150
100

vel
0.95
0.9
0.85
0.8
0.75
0.7
0.65
0.6
0.55
0.5
0.45
0.4
0.35
0.3
0.25
0.2
0.15
0.1
0.05

50
0

50

100

150

200

250

300

350

400

450

500

1
2
3
:

..

finite elements in fluids


2D laminar NS, LBB
computational fluid dynamics I

For a domain divided into P1P0 (linear velocity/constant pressure)


triangular elements of nxn nodes, the number of equations/unknowns
in the continuity equation is
Equations (pressure unknowns): 2(n-1)2-1
Unknowns (velocities): 2(n-2)2
1

..

2
3
:

As the number of equations is bigger than the number of unknowns


the only possible solution is the trivial and the problem is locked

finite elements in fluids


2D laminar NS, LBB
computational fluid dynamics I

For a domain divided into P2P1 (quadratic velocity/linear pressure)


triangular elements of nxn corner nodes, the number of equation and
unknowns in the continuity equation is
Equations (pressure unknowns): n2-1
Unknowns (velocities): 2(2n-3)2
1

..

2
3
:

As the number of equations is smaller than the number of unknowns (n>2),


the pair allows for a solution different from the trivial

finite elements in fluids


2D laminar NS, LBB
computational fluid dynamics I

Similarly, for a domain divided into Q1P0 (bilinear velocity/constant


pressure) triangular elements of nxn corner nodes, the number of
equations/unknowns in the continuity equation is
Equations (pressure unknowns): (n-1)2-1
Unknowns (velocities): 2(n-2)2
1

..

2
3
:

As the number of equations is smaller than the number of unknowns (n>4),


the pair allows for a solution different from the trivial, but not necessarily
exact as it leads to a discontinuous checkerboard pressure mode

finite elements in fluids


2D laminar NS, LBB
computational fluid dynamics I

Some of the most popular velocity-pressure pairs are


;
Q1P0 (bi-linear velocity constant
pressure)
LBB is not verified , discontinuous pressure

P1P0 (linear velocity - constant pressure)


LBB is not verified , discontinuous pressure
Q1Q1 (bi-linear velocity bi-linear pressure)
LBB is not verified
P1P1 (linear velocity - linear pressure)
LBB is not verified

finite elements in fluids


2D laminar NS, LBB
computational fluid dynamics I

P2P1 (quadratic velocity linear pressure)


;
LBB is verified

Q2Q1 Taylor-Hood(bi-quadratic velocity, bi-linear pressure)


LBB is verified

Q2Q1 Taylor-Hood serendipity (bi-linear velocity and pressure)


LBB is verified

finite elements in fluids


2D laminar NS
computational fluid dynamics I

Taking the unsteady convective flow equations

wi ui ,t u j ui , j f i d wi , j ui , j d

qu

i,i

wi ,i pd t i wi d2 0
2

d 0

wi V

q Q

u i x j ,0 u i 0 x j

ui 1 bi

or in vector notation
1

w
u

u
f
d

u
:

w
d

qud 0

pw d ti wi d2 0
2

finite elements in fluids


2D laminar NS, matrices
computational fluid dynamics I

When the transient convective flow is being used, a finite different approach can
be considered to integrate the differential equation. The derivatives with respect to
time can be taken as
n n 1

M
M

t
t

where n 1 are the velocities obtained for the previous temporal step

1
1
n
n
n
n 1
M C u n , v n A Bp n f
M
t
t
BT 0
n

finite elements in fluids


2D laminar NS, matrices
computational fluid dynamics I

When the convective term is included a non-linear convective term is obtained that
can be evaluated making use of Newton-Raphson or a successive approximation
technique, the former leading to

C u n , v n C u n 1 , v n 1
n

where u n 1 , v n 1 are the velocities obtained for the previous convection step and
can be estimated as zero for the first step

1
1
n
n
n
n 1
M C u n 1 , v n 1 A Bp n f M
t
t
BT 0
n

For each time step the iterations for convection should be carried out

finite elements in fluids


2D laminar NS, matrices
computational fluid dynamics I

When the transient and convective flows are taken into account it is obtained

n
n 1
n 1
M u C u , v
1
vn


t
p n


B x T

C u n 1 , v n 1

u n

v n
p n

n 1
B x u n f x
M u
1

v n1
M

B y v n f y

t
n

n
1
p
p

where

M ij wi N j d
e

N j
N j

d
N k vk
Cij wi N k uk

x
y

finite elements in fluids


2D laminar NS, solver
computational fluid dynamics I

The direct solvers are one-step methods that give an exact solution to the
systems. Nevertheless, the memory requirements involved are very high even
with skyline storing and specially for fluids
The sparse storage allows to drop all the non-zero elements but cannot be used
in combination with a direct solver due to the fact that some elements could be
thrown out of the sparse stencil

The row-indexed sparse storage mode requires a memory space of only twice the
number of the non-zero matrix elements uses an integer pointer vector (p) and a
real vector (v), where the sparse elements are loaded
An iterative solver of the Kryliov type, such as the (PBCG or the GMRES) can be
used in connection with the sparse matrix storing

finite elements in fluids


2D laminar NS, benchmark
computational fluid dynamics I

400

400

350

350

300

300

250

250

200

200

Benchmark problem: Cavity flow Re uL / 10000

150

150

100

100

50

50

50

100

150

200

250

300

350

400

450

500

Level
19
18
17
16
15
14
13
12
11
10
9
8
7
6
5
4
3
2
1

50

100

150

200

250

300

350

400

450

vel
0.95
0.9
0.85
0.8
0.75
0.7
0.65
0.6
0.55
0.5
0.45
0.4
0.35
0.3
0.25
0.2
0.15
0.1
0.05

500

finite elements in fluids


2D laminar NS, benchmark
computational fluid dynamics I

Benchmark problem: Cavity flow Re uL / 10000

Re = 10000
55

66

66

66

55

14
61732
15
111

54
5

55

400

16
1101
9
8 9

33

300

350

5 5

44

200

5
4

100

3
5

1.2
1
0.8
Ghia 129x129
Present 41x41

0.6
0.4
0.2

50

55

150

66

6
6

07
0

250

Level
h
19
0.0380309
18
0.0350167
17
0.0320026
16
0.0289885
15
0.0259744
14
0.0229602
13
0.0199461
12
0.016932
11
0.0139179
10
0.0109037
9
0.00788962
8
0.0048755
7
0.00186137
6
-0.000170322
5
-0.00115275
4
-0.00286752
3
-0.00416688
2
-0.00550366
1
-0.0062906

100

200

300

400

500

-0.5

0.5

1.5

finite elements in fluids


2D laminar NS, benchmark
computational fluid dynamics I

Benchmark problem: Backward step Re uD / 1200


8
7
6

5
4
3
2
1
0

10

15

20

25

30

35

40

45

50

8
7
VEL
0.937568
0.875064
0.812559
0.750055
0.68755
0.625046
0.562541
0.500036
0.437532
0.375027
0.312523
0.250018
0.187514
0.125009
0.0625046

5
4
3
2
1
0

10

20

30

40

50

8
7
15
14
13
12
11
10
9
8
7
6
5
4
3
2
1

5
4

25

30

15

11

11
11

10

99 9

7
88
99
10

4 4
5

15

20

14

8
99

13

10
11

1515

14

13 13

15

12 12 12 12

10

4
3

11

10

4
5
3344 5
5
3
2 3 4

2
1

35

40

45

50

-0.00618127
-0.0126782
-0.0191752
-0.0256722
-0.0321692
-0.0386661
-0.0451631
-0.0516601
-0.0581571
-0.064654
-0.071151
-0.077648
-0.084145
-0.0906419
-0.0971389

finite elements in fluids


2D laminar NS, benchmark
computational fluid dynamics I

Benchmark problem: Backward step Re uD / 1200

s3
s2

s1

Reattachment length s3
30
25
20

s3 Armaly exp
s3 Armaly cal

15

Present
10
5
0
0

200

400

600

800

1000

1200

1400

finite elements in fluids


penalty formulation
computational fluid dynamics I

The penalty method can be interpreted as enabling a relaxation of the


incompressibility constraint so that the incompressible problem is
approached by a slightly compressible formulation
The pressure unknown is removed from the mixed formulation and
therefore the only unknowns of the problem will now be the velocities

finite elements in fluids


penalty formulation
computational fluid dynamics I

The penalty formulation is based upon substituting the incompressibility condition


by

ui ,i p

where tends to zero, and drive it into the dynamic equation to obtain

1
(
u
w

f
w

i , j i , j i i ui ,i wi ,i )d 0

equation that does not depend upon the pressure unknown, so avoiding the
problems found in the mixed formulation

finite elements in fluids


penalty formulation
computational fluid dynamics I

In order to impose the incompressibility condition, is required to be very small,


but not to much, because in that case, the penalty term (if it leads to a regular
matrix) promotes the obtaining of a unique trivial solution
In order to avoid it, it is required to carry out a reduced integration or selective
integration, that is to carry out a roughly approximating of the penalized term,
leading to a similar effect to that obtained for the mixed elements verifying the
LBB condition
It is recommended to chose as

c max ,Re

with c=107

finite elements in fluids


penalty formulation, reduced integrat.
computational fluid dynamics I

Q1P0 (2x2, reducida 1)

P1P0 (1, reducida 1)

P2P1 (3, reducida 1)

Q2Q1 (3x3, reducida 2x2)

Q2Q1 (3x3, reducida 2x2)

finite elements in fluids


penalty formulation, matrices
computational fluid dynamics I

Proceeding in the same way as in the mixed formulation it is obtained

h
h
h h
h
h
h
w
u

u
u

w
u

i
i
t
j
i
j
i
i
j
i
,
,
,
, j d

uih,i wih,i d t ih wih d2 0


2

or in matrix notation
M

1
C u, v A B f
t

u A u 1 B x
M u Cu, v

T
M t v
Cu, v v A v D

D u f x

B y v f y

finite elements in fluids


penalty formulation, matrices
computational fluid dynamics I

Where the basic matrices are


1
t

M u n C u n , v n
M n

u n A u n 1 B x

T
C u n , v n v n A v n D

M ij wi N j d
e

Aij

wi N j wi N j

d
x x y y

Bxij

wi N j
d
y y

f xi wi f xi d wi t xih d
e

D u n f x 1 M u n 1

B y v n f y t M v n 1

N j
N j

d
N k vk
Cij wi N k uk

B yij

wi N j
d
x x

Dij

wi N j
d
x y

f yi wi f yi d wi t yih d
e

finite elements in fluids


ssww equations
computational fluid dynamics I

As we know, the Shallow Water equations are


h uH vH

0
t
x
y
2u 2u C w a W Wx gn 2 V u
u
u
h
u
u
v
g
f c v 2 2

H
H h4 3
t
x
y
x

2 v 2 v Cw a W W y gn 2 V v
v
v
h
v
u v g
f c u 2 2

H
H h4 3
t
x
y
y

finite elements in fluids


ssww equations
computational fluid dynamics I

Following a similar procedure as the one carried out for the 2D laminar equations
in the continuity equation it is obtained
h uH vH

0
t
x
y

qh Hu d 0
,t

i ,i

qh d q Hu d qHu d
,t

,i

qh

,t

Hq,i ui d qHu N d

finite elements in fluids


ssww equations
computational fluid dynamics I

Identically, with the dynamic equation, it is obtained


2u 2u C w a W Wx gn 2 V u
h
u
u
u
g
f c v 2 2

u
v
x
y

H
H h4 3
y
x

t
x

2 v 2 v Cw a W W y gn 2 V v
v
v
v
h
u v g
f c u 2 2

t
x
y
y

H
H h4 3

u,t u, j ui , j ui , jj gh,i gh,i Si

w u
h
i

h
i ,t

u hj uih, j S i d wih, j uih, j d g wih,i h h d h tih wih d2


h

finite elements in fluids


ssww equations
computational fluid dynamics I

And the matrix expressions are

B x u f x

u A
Cu, v

A
B
C
u
v
y v f y

h D x h D y h h f h
N j
N j

d
Cij wi N k u k
N k vk

e
Bxij g

f xi wi S xi d wi t xi d
e

wi
j d
x

Dxij H k k
e

Aij

wi N j wi N j

d
x x y y

B yij g

i
N j d
x

wi
j d
y

D yij H k k
e

f yi wi S yi d wi t yi d
e

i
N j d
y
f hi qi Hu N d
e

You might also like