Professional Documents
Culture Documents
5-Jan-14
Review of FDM
j+1
ui,j
j
O(x)
x i , j
x
ui , j ui 1, j
u
O(x)
x i , j
x
ui 1, j ui 1, j
u
O(x 2 )
x i , j
2x
j -1
i -1
i+1
- Forward difference
- Backward difference
- Central difference
ui 1, j 2ui , j ui 1, j
2u
- Central difference (2nd
O(x 2 )
2
2
order)
x i , j
x
5-Jan-14
16
Scalar fields
A scalar field is a function in which the scalar property
(e.g. Temperature) can be expressed in terms of x
and y.
For example the following are scalar fields
T ( x, y ) x 2 y 2
U ( x, y) xe
x2 y 2
0.5
-0.5
1
0
-1 -2
1/5/2014
5-Jan-14
17
Vector fields
A vector field is a vector quantity which is a function of
position. An example is the velocity of a fluid.
Consider the following two vectors over the following
domains.
5
-5
-5
-5
-5
v = [x,y]
v = [-y,x]
18
x
y
x y
Example:
Consider flow of water in a pipe.
(2)
(1)
If the velocity is the same at (1) and (2) then divergence is
zero.
In physical terms the divergence measures the extent to
which a vector field behaves like a source or a sink.
1/5/2014
5-Jan-14
19
Solution:
v x, y .v
( y ) ( x) 0 0 0
x
y
.v
(3 x 2 3 y 2 ) (6 xy ) 6 x 6 x 0
x
y
( x) ( y ) 1 1 2
x
y
v [ y, x] .v
v 3 x 2 3 y 2 ,6 xy
v 3 x 2 3 y 2 ,6 xy
20
x y
1/5/2014
5-Jan-14
21
T [2 x,2 y ]
T T
Grad(T ) T
,
x
y
11
0.50.5
00
-0.5
-0.5
-1-1
-1.5-1
-1
-0.5 -0.5
00
0.50.5
5-Jan-14
1 1.5
22
Fluid flow
Fluid flows (air, water, etc) that are incompressible,
non-viscous, and do not rotate to form vortices can be
represented by the Laplace Equation, where:
0
2
or
2
2
0
x 2
y 2
1/5/2014
5-Jan-14
23
Example
Consider the following function for velocity potential
( x, y ) x3 3xy 2
Derivatives are:
6 xy
y
3x 2 3 y 2
x
2
6x
x 2
2
6 x
y 2
0
x 2 y 2
5-Jan-14
Example
24
( x, y ) x3 3xy 2
Velocity 3x 2 3 y 2 ,6 xy
1.5
1
0.5
0
-0.5
-1
-1.5
-1.5
-1
-0.5
0.5
1.5
1/5/2014
5-Jan-14
26
Divergence theorem
A
u u
v u ,
x y
.v dA v. dS
But
.u 2u so
2u 2u
A x 2 y 2 dA
x n
( x)
u
n( y ) dS
y
5-Jan-14
27
Divergence theorem
2u 2u
A x 2 y 2 dA
x n
( x)
u
n( y ) dS
y
1/5/2014
5-Jan-14
28
5-Jan-14
29
Grid generation
First generate the grid by placing nodes across a
domain and constructing control volumes around
them.
Example:
Consider following 1-dimensional domain between A
and B.
W
B
Control Volumes
Nodes
1/5/2014
5-Jan-14
30
Grid generation
W
B
Control Volumes
Nodes
5-Jan-14
31
Grid generation 2D
Similar to 1D, the boundaries are on the
control volume surfaces.
1/5/2014
5-Jan-14
FVM 1D
32
2u
g 0
x 2
x x dx gdx 0
A
u
u
gh 0
x e x w
2u 2u
A x 2 y 2 dA
u
x n
( x)
u
n( y ) dS
y
5-Jan-14
FVM 1D
33
Discretization in 1D
2u
g 0
x 2
u
u
gh 0
w
e
10
1/5/2014
5-Jan-14
34
0.5h
u
U U P
h
x e
h
x e
U UW
u
P
h
x w
5-Jan-14
35
u
u
gh 0
w
e
U U P U P UW
E
gh 0
h
h
AE AW 1 h ,
AP AE AW , S gh
Here UP, is the dependent variable at P and UE, UW are the East
and West neighbours. AP, AE & AW are the respective coefficients.
We write it in this standard form because it applies even when the
control volumes do not have equal width.
11
1/5/2014
5-Jan-14
38
Boundary condition
If the boundary condition is Dirichlet then we have U given at the
boundary. Let this be UB.
UB
A
APU P AEU E S
u
u
gh 0
w
e
AE
U P U B
0.5h
U E U P
1
,
h
S gh
AP AE
2U B
h
5-Jan-14
Example
2
h
39
1
U(0)
x/2
U(0.02)
13
1/5/2014
5-Jan-14
Solution
40
P
x e
To give
x w
U U P U P UW
E
Qh 0
h
h
APU P AEU E AW U W S
Rearranging
AE AW
1
,
h
AP AE AW , S Qh
5-Jan-14
Solution
41
Solving at nodes:
14