CFD Lecture 3: Dr. Thomas J. Barber
CFD Lecture 3: Dr. Thomas J. Barber
CFD Lecture 3: Dr. Thomas J. Barber
c
(
+ - =
c
- = V-
c
+ V- =
c
c
(
+V- =
(
c
c
+V-
c
} }
} }
} }
}
0 . . V F D =
General Conservation Law
0 . .
' /
0
0 . .
Integral QdV H n dA FV
t
Apply Green s Divergence Theorem
H ndA H dV
F G
QdV H dV QdV dV
t t x y
or integro differential equation
Q
H dV F E
t
or partial
c
(
+ - =
c
- = V-
( c c c c
+ V- = + +
(
c c c c
c
(
+V- =
(
c
} }
} }
} } } }
}
0 . .
differential equation
Q
H F D
t
c
+V- =
c
Finite Volume
Basic conservation laws of fluid dynamics are expressed in
terms of mass, momentum and energy in control volume
form.
Shocks and other discontinuities do not have sufficient
regularity to convert to P.D.E. format.
F.V. method: on each cell, conservation laws are applied at
a discrete point of the cell [node].
Cell centered
Corner centered
Piecewise constant
interpolation
Piecewise linear
Interpolation
Finite Difference of Flux Equations
Solves differential form of the governing equations
Mesh used to define nodal points
Uses Taylor series approximation
0
Q Q F
H
t t x
c c c
+ V- = + =
c c c
| |
1 1
( ) ( )
i i i i
t
Q Q F F
x
+
A
=
A
Finite Volume for Flux Equation
Solves integral form of governing equation
Uses quadrature methods: Trapezoidal, etc...
Mesh used to define flux conservation cells
0 QdV H ndA
t
c
+ - =
c
} }
1 i i
t
Q Q H n A
V
+
A
= - A
A
Cell - Centered Node - Centered
2D Steady Flux Equation
w e
n
s
A X
w e
n
s
A X
N
E
S
W
I,j+1
I, j-1
i+1,j
i-1,j
2D Steady Flux Equation
1, 1, 2
,
, 1, , 1, 2
,
1, 1, 2
0
( )
2
( )
2 2
( )
2
i j i j
i j
i j i j i j i j
e w
i j
i j i j
F G
x y
Classical view
F F
F
O x
x x
Alternative view
F F F F
F F F
O x
x x x x
F F
O x
x
+
+
+
c c
+ =
c c
( c
| |
= + A
| (
c A
\ .
+ +
( ( c
| |
= + A =
| ( (
c A A A
\ .
(
= + A
(
A
Finite-difference: centered in space scheme
w e
n
s
A X
2D Steady Flux Equation
Finite-difference: centered in space scheme
w e
n
s
A X
, 1, , 1,
, , 1 , , 1
1, 1, , 1 , 1
0
2 2
0
2 2
0
2 2
i j i j i j i j
i j i j i j i j
i j i j i j i j
F G
x y
F F F F
x x
G G G G
y y
F F G G
x y
+
+
+ +
c c
+ =
c c
+ +
( (
( (
A A
+ +
( (
+ =
( (
A A
+
( (
+ =
( (
A A
2D Steady Flux Equation
| |
1 1
1 1
Q
H dA H n ds dA
t
Q F G
dA H dA
t A x y A
H ds Fdy Gdx
x y x y
c
(
( (
V- = - =
(
c
( c c c
(
(
= + = V- =
(
(
c c c
= - =
A A A A
} } }
} }
} }
w e
n
s
A X
e w n s
n i n i n j n j = = = =
| |
1 1
e n w s
Q
H ds F dy G dy F dy G dy
t x y x y
c
(
= - = +
(
c A A A A
} }
2D Steady Flux Equation
| |
1, , , 1,
1, , , 1,
1, 1,
2 2
1
2 2
2
i j i j i j i j
e w
i j i j i j i j
e w
i j i j
F F F F
F F
Midpoint integration
F F F F
y y
F dy F dy
x y x y x y
F F
x
+
+
+
+ +
= =
+ +
( ( ( A A
=
( ( (
A A A A A A
(
=
(
A
}
Finite volume:
- Cartesian mesh with uniform spacing,
- Trapezoidal rule same as centered scheme
w e
n
s
A X
Finite-Difference Discretization
Poisson Equation
Finite-difference: centered in space scheme [2
nd
Order Accurate]
I
J
2
0 G T Steady state heat conduction
G source
V + = =
=
1, , 1, , 1 , , 1
2 2
2 2
0
i j i j i j i j i j i j
G
x y
+ +
+ +
( (
+ + =
( (
A A
Finite Volume Discretization
Poisson Equation
| |
2
2
2
0 0
xx yy
G dA G dA
But
G dA n dl GdA dl GdA
n
( ( V + = = + + =
V = V- V
c
(
(
( V + = V - + = +
(
c
} }
} } } } }
Integral Form
Finite Volume Discretization
Poisson Equation
dl GdA
n
c
(
+
(
c
} }
Integral Form
1 1 1 1
2 2 2 2
, 1, , , 1 1, , , 1 ,
i j i j
i j i j i j i j i j i j i j i j
dl dy dx dy dx
n x y x y
y x y x
x y x y
+ +
+ +
( ( c c c c c
( ( (
= + + +
( (
( ( (
c c c c c
( ( ( (
= A A + A + A
( ( ( (
A A A A
} } } } }
Finite volume: Cell centered, Cartesian mesh with uniform spacing,
Trapezoidal rule same as centered scheme
Same as for finite difference method
Finite Element (FEM, FEA)
Method for solving P.D.E.s in integral form
Domain divided into cells or elements
Typically uses unstructured topology
Solution for P.D.E. assumed to have a given functional form
Historically applied to structures problems, i.e. PDE is
replaced integral / variational problem [minimum energy]
Method of weighted residuals:
Galerkin method:
1
'
( )
N
k k k
Lu f
u u where s are basis or shape functions
L u f R residual
=
=
= =
0 1....
i i
wRdV i N where w weighting functions = = =
}
i i
w =
Finite Element Nethod
Solves moment integrals of differential eqns
Uses quadrature methods
Uses mesh to define nodal points
For uniform mesh and parabolic polynomials
Finite Difference = Finite Volume = Finite Element
( ) ( ) 0
( )
m
j
m
j
Q
H x dV
t
weighting function
H polynomial function
|
|
c
(
+V- =
(
c
=
=
}
Finite Element
Flux Equation
0 ) , (
) ( ) ( ) ( ) (
0
) ( ) ( ) , (
2 1 2 1
2 1 0 0
=
(
(
c
u u c
+
c
u u c
=
(
c
c
+
c
c
u u + = + =
}
}
dA y x
y
y x G
x
y x F
dA
y
G
x
F
y x w w y x w w w
j
i i i i i i
i i i i i
Finite element
Based on method of weighted residuals (assumes functional approximation for solution
Functions typically bi-linear interpolating functions
If moment function in integral is same form as approximating function: Galerkin method
If interpolating function linear, I.e. proportional to x and y, then for Cartesian grid,
method reduces to other approaches
0 0 1 2
2 2
1 2 1 2
2 2
( , ) ( ) ( )
0
( ) ( ) ( ) ( )
( , ) 0
/ 6 .
6
i i i i i
xx yy
i
i i i i i i
j
j
w w w x y w w x y
dA
w x y w x y
x y dA
x y
A second order function parabola has unknown coefficients Will need
relationships to define unk
= + = + u u
( + =
( c u u c u u
+ =
(
c c
(
}
}
nown constants
Finite Element
Poisson Equation
2
0
, , .
i
G dA
At each node is an assumed polynomial function in x y
( V + =
}
Finite Element
Same as for finite difference method
Finite Element (FEM, FEA)
Given ODE / PDE : Approach (1) [Next example]
Choose
i
(x) functional form, e.g. power series, Fourier,
Select
m
(x) to produce M equations.
Use single functional form over given domain [ab]
Given ODE / PDE : Approach (2)
Assume linear functional form
1 1 2 2
2 1
1 2
2 1 2 1
( )
&
f x mx b
f mx b f mx b
x x x x
f f f
x x x x
= +
= + = +
( (
= +
( (
Element 1
Element 2
1 2 3
N1
N2
f1
f2
Finite Element (FEM, FEA)
| |
1
2 1
1 2 1 1 2 2 1 2
2 2 1 2 1
f
x x x x
f f f f f
f x x x x
( ( (
= + = + =
( ( (
i
i+1
/ / /
2 1
1 1 2 2 1 2
/
1 0
1 0
/ / /
2 0
1 1
1
1 1
1
0.5 0.5
2
i
i
i i i
f f
f f f f f i to i part
h h h
f f
f f f i to i part
h h h
f f
f f f
h
+
( (
= + = + = +
( (
( (
= + =
( (
= + =
Equivalent to 2
nd
order
accuracy F.D. form
Numerical Concepts
Discretization: Finite Element
Example: O.D.E. Single function over whole domain
/
0
1
1
1
1
1
0
1
1 1
1
0
0 0 1 (0) 1
: ( ) exp[ ]
1 1 . .
1
0 ( )
1 0
N
j
j
j
N
j j
j
j
m
m j m
N
m j j
j
j
Ly y y x y
Exact solution y x x
Choose y a x where y is chosen to match BC
Ly a jx x
w Ly dx Choose w x x
x a jx x dx
For second order
=
=
= = < < =
=
= + =
( = +
= =
(
( + =
(
}
2
1 2
( 2) ; 1 N solution y a x a x = = + +
Numerical Concepts
Discretization: Finite Element
Example: O.D.E.
2
1 2
1 1
2
1 2
2 2 1 2
1
0 0
1 1
2
1 2 3
2 2 1 2
1
0 0
1 2 1 2
( 2) ; 1
1 1 0 ( 1 ) (2 )
1 0 ( 1 ) (2 )
2 5
1
2 3 6 12
j j
j
j
j j
j
j
For second order N solution y a x a x
a jx x dx a x a a x a dx
x a jx x dx a x x a a x a dx
or
a a a a
=
= = + +
(
( ( + = + +
(
(
( ( + = + +
(
+ = +
} }
} }
1
2
1/ 2 2 / 3 1
1
1/ 6 5/12 1/ 2 2
a
a
( ( (
= =
( ( (
Numerical Concepts
Discretization: Finite Element
Example: O.D.E.
x Exact N=1 Error N=2 Error N=3 Error
0.00 1.0000 1.0000 0.0000 1.0000 0.0000 1.0000 0.0000
0.20 1.2214 1.4000 14.6226 1.2057 -1.2854 1.2220 0.0491
0.40 1.4918 1.8000 20.6596 1.4800 -0.7910 1.4913 -0.0335
0.60 1.8221 2.2000 20.7398 1.8229 0.0439 1.8214 -0.0384
0.80 2.2251 2.6000 16.8487 2.2349 0.4404 2.2259 0.0360
1.00 2.7183 3.0000 10.3631 2.7143 -0.1472 2.7183 0.0000