Professional Documents
Culture Documents
CVFD2D Slides 2up
CVFD2D Slides 2up
CVFD2D Slides 2up
Motivation
Numerical solution of the 2D Poisson equation is the next step in developing our
knowledge of CFD technique.
Overview
Goals for this unit
Model Problem
The two dimensional diusion equation in Cartesian coordinates is
@
@
@
@
+
+S =0
@x
@x
@y
@y
where
(1)
= k, thermal conductivity or
k
=
cp
"%+'
"$%+'
#-%!#.&'
!#
!"(!#
#%,'
#-%,'
Interior node
Boundary node
j=0
i=0
!"+1
!"+2
!"
y
x
xw
xe
N
yn
yn
P
E
y
ys
ys
xw
xe
xw
xe
N
yn
xP
xw
xe
yP
ys
yn
yn
P
E
y
x
2
y
yP =
2
xP =
ys
ys
xw
xe
S
ME 448/548: 2D Diusion Equation
xw
x e = xE
xP 6= xw = xP
y n = yN
yP 6= ys = yP
xe
xW
yS
N
yn
yn
P
x e = xE
xP
6=
x w = xP
y n = yN
yP
6=
y s = yP
y
ys
yS
ys
xw
xW
xe
S
ME 448/548: 2D Diusion Equation
yn
ys
xe
xw
@
@x
@
@x
yn
ys
@
@x
dx dy
xe
@
@x
xe
yn
@
@x
E
e
xw
@
@x
E
y
dy
ys
ys
xw
xe
P
w
yn
xw
The final step is obtained by using central dierence approximations for the derivatives at
the interfaces.
ME 448/548: 2D Diusion Equation
xe
xw
yn
ys
S dy dx SP
(2)
Note: The Control Volume Finite Dierence (CVFD) method treats the source term and
diusion coefficients as piecewise constants. This is a rather crude approximation, say,
compared to allowing the source term and diusion coefficient to vary linearly within the
control volume.
However, piecewise constant profiles of S and allow the method to be conservative,
i.e., conserving mass or energy, automatically. The conservative nature of the CVFD
method is one of its primary strengths.
10
aS
aW
+ aP
aE
aN
(3)
=b
where
aE =
x xe
aW =
x xw
aN =
y yn
aP = aE + aW + aN + aS
b = SP
aS =
y ys
(4)
(5)
11
Non-uniform
Continuity of fluxes at the interface requires
P
@
@x
xe
@
@x
xe +
material 1
@
@x
xe
material 2
xe
E
(6)
xe
xe-
xe
xe
(7)
xe+
xe+
12
Non-uniform
Equations 6 and 7 can be rearranged as
e
xe
xe
xe+
xe
material 1
(8)
P)
material 2
(9)
P)
xe
xe
P)
P)
xe
P
xe
xe+
xe
xe+
xe+
e/
xe to get
xe
+ xe+
.
P
13
Non-uniform
Thus, the diusion coefficient at the interface that results in flux continuity is
e
=
E
where
+ (1
xe
xe
=
xe
xE
w,
n,
(10)
P
xP
xP
and
(11)
s.
14
aS
aW
+ aP
aE
aN
=b
(12)
To set up the matrix for this system of equations, we need to re-number the unknowns.
Important: i and j subscripts for the mesh are not the same as the row and
column indices in the system Ax = b.
15
"$%&'()(*
"$%!".&'
"%+'
n = i + (j
"$%+'
1)nx
#-%!#.&'
!#
!"(!#
#%,'
#-%,'
Interior node
Boundary node
!"+1
!"+2
j=0
i=0
!"
16
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
@
1,1
2,1
...
nx,1
1,2
2,2
...
i,j
...
nx,ny
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
A
()
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
@
1
2
...
nx
nx+1
nx+2
...
...
1
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
A
(13)
17
A=
aS
a W ap
aE
aN
18
19
Structured Mesh
The CVFD Matlab codes use structured meshes. in size.
Uniform Mesh
Ly3, ny3
y
Ly2, ny2
Ly1, ny1
y
Lx1, nx1
Lx2, nx2
20
Boundary
Condition
Post-processing in fvpost
Specified T
Specified q 00
21
Convection
Post-processing in fvpost
From specified h and T1 , compute boundary temperature and heat flux
through the cell face on the boundary. Continuity of heat flux requires
T
k b
xb
Ti
= h(Tb
xi
Tamb )
Tb =
where xe = xb
4
Symmetry
xi
22
Core Routines
fvUniformMesh or
fvUniBlockMesh
fvcoef
fvbc
fvAmatrix
Solve
Compute boundary values and/or fluxes
fvpost
Plot results
ME 448/548: 2D Diusion Equation
23
Model Problem 1
Choose a source term that may be physically unrealistic, but one that gives an exact
solution that is easy to evaluate
" 2 2#
2
x
2y
S=
+
sin
sin
Lx
Ly
Lx
Ly
The exact solution is
= sin
x
Lx
sin
2y
Ly
24
Model Problem 1
The exact solution is
2
= sin
x
Lx
sin
2y
Ly
1.5
0.5
0
1
0.5
0
x
0.8
0.6
0.4
0.2
25
e2i
Measured
Theoretical error ~ ( x)3
10
10
Measured error
kek2
=
N
qP
10
N e2
e
=p .
N
N
10
10
10
10
10
10
10
10
10
O L2x/(nx + 1)2
kek2
e
O( x2)
p =
=
O
N
nx
nx
N
1
nx
= O( x ).
26
Model Problem 2
0.07
0.06
0.05
0.04
0.03
0.02
0.01
0
1
0.5
0
x
0.8
0.6
0.4
0.2
27
Model Problem 3
Heat conduction in a rectangle consisting of
two material regions.
0.5Ly
Ly
2 = 1
1 = 1
S2 = 1000
S1 = 0
0.25Ly
0.5Lx
0.25Lx
Lx
The discontinuity and dierence in material properties can be used to stress the solution
algorithm.
2
28
Model Problem 3
0.5Ly
2 = 1
1 = 1
S2 = 1000
S1 = 0
30
25
0.25Ly
20
0.25Lx
0.5Lx
15
Lx
10
5
0
1
0.5
0
x
0.8
0.6
0.4
0.2
29
For simple fully-developed flow the governing equation for the axial velocity w is
"
#
@ 2w
@ 2w
dp
+
=0
2
2
@x
@y
dz
This corresponds to the generic model equation with
= (= constant),
= w,
S=
dp
.
dz
30
Quarter Duct
Ly
Ly
y
x
y
Lx
x
Lx
For the full duct simulation depicted on the left hand side, the boundary conditions are no
slip conditions on all four walls.
(full duct)
31
Quarter Duct
Ly
Ly
y
x
y
Lx
x
Lx
For the quarter duct simulation depicted on the right hand side, the boundary conditions
are no slip conditions on the solid walls (x = Lx and y = Ly )
(quarter duct)
@u
@x
ME 448/548: 2D Diusion Equation
=
x=0
@u
@y
= 0.
y=0
32