Documente Academic
Documente Profesional
Documente Cultură
Outline
1. Introduction to Numerical Methods 2. Components of Numerical Methods
2.1. Properties of Numerical Methods 2.2. Discretization Methods 2.3. Application of Numerical methods in PDE 2.4. Numerical Grid and Coordinates 2.5. Solution of Linear Equation System 2.6. Convergence Criteria Methods for Unsteady Problems Solution of Navier-Stokes Equations Example
3. 4. 5.
Stability: does not magnify the errors that appear in the course of numerical solution process.
1. Iterative methods: not diverge 2. Temporal problems: bounded solutions 3. Von Neumann s method 4. Difficulty due to boundary conditions and non-linearities present.
Convergence: solution of the discretized equations tends to the exact solution of the differential equation as the grid spacing tends to zero.
4
Boundedness:
1. Numerical solutions should lie within proper bounds (e.g. nonnegative density and TKE for turbulence; concentration between 0% and 100%, etc.) 2. Difficult to guarantee, especially for higher order schemes. Realizability: models of phenomena which are too complex to treat directly (turbulence, combustion, or multiphase flow) should be designed to guarantee physically realistic solutions. Accuracy: 1. Modeling error 2. Discretization errors 3. Iterative errors
5
x
! *xi
x xi
x* x xi
* xx i 2!
x xx i
i 1 i
x 2 * x xi 3 x 3* x xi n x n * H n 3 ... 2 xx xx n! xx i 3! i i i
xi 1 xi
xi 1 xi x 2 2 2 xx
xi 1
2 xi x 3 3 xx 6
H i
Higher order derivatives are unknown and can be dropped when the distance between grid points is small. By writing Taylor series at different nodes, xi-1, xi+1, or both xi-1 and xi+1, we can have:
x* * i 1 * i } xi 1 xi xx i x* * i 1 * i 1 } xi 1 xi 1 xx i
Forward-FDS Central-FDS
x* * i * i 1 } xi xi 1 xx i
Backward-FDS
1st order, order of accuracy Pkest=1 2nd order, order of accuracy Pkest=2 8
2nd order truncation error on any grid. For uniform meshing, it reduced to the CDS approximation given in previous slide. Compact schemes: Depending on the choice of parameters , , and , 2nd order and 4th order CDS, 4th order and 6th order Pade scheme are obtained. * i 1 * i 1 * i 2 * i 2 x* x* x* E K E !F 2(x 4(x xx i 1 xx i xx i 1 Non-Uniform Grids: to spread the error nearly uniformly over the domain, it will be necessary to use smaller (x in regions where derivatives of the function are large and larger (x where function is smooth
9
(xi ! xi xi 1
Estimate the outer derivative by FDS, and estimate the inner derivatives using BDS, we get
x 2 * * i 1 xi xi 1
* i 1 xi 1 xi
* i xi 1 xi 1
2 } xx xi 1 xi
2 xi xi 1
i
Higher-order approximations for the second derivative can be derived by including more data points, such as xi-2, and xi+2, even xi-3, and xi+3
10
N n
NE EE
SW
ne ne E (y P e s se SE
fdS ! fdS
k Sk
11
LT T ! 0
IC : T x, t ! 0 ! GT x
BC : T xB , t ! H T t A1
LM M ! 0
Analytical and CFD approaches formulate the IBVP by selection of the PDE, IC, and BC to model the physical phenomena
IC : M x, t ! 0 ! GM x
BC : M xB , t ! H M t A2
LN S ! +1
Using numerical methods, the continuous IBVP is reduced to a discrete IBVP (computer code), and thus introduce numerical errors:
I : S x, t ! 0 ! g N x
BC : S xB , t ! hN t
A3
Numerical errors can be defined and evaluated by transforming A4 the discrete IBVP back to a continuous IBVP. i J g x
i LModified S
! LM S
! +N BC : S xB , t
! H Modified t
( j xS J S ! S C i i! xx j +N ! +1 + j j !1 i !1 IC : S x, t ! 0
! x
j !1
Modified
Truncation error
12
x
M x
BC :H SN xB , t
! H Modified t
H M t
Modified
j !1
A5
An IBVP for the modeling error M-T can be obtained by subtracting A1 and A2: LM ( M T ) ! LM H SM ! +M ! LM T
IC :H SM x, t ! 0
! GM x
GT x
BC :H SM xB , t
! H M t
H T t
A6 Adding A5 and A6 LM ( S T ) ! LM H S
! +N +M IC :H S x,0
! GModified x
GT x
H S ! S T ! H SN H SM
BC : H S xB , t
! H Modified t
H T t
13
A* ! Q
For non-linear case, the system must be solved using iterative methods, i.e. initial guess iterate converged results obtained. The matrices derived from partial differential equations are always sparse with the non-zero elements of the matrices lie on a small number of well-defined diagonals
15
Qn *n ! Ann
Qi
*i !
k ! i 1
A *
ik
Aii LU Decomposition: the factorization can be performed without knowing the vector Q
A ! LU
U* ! Y
LY ! Q
i i AW AE1 i i AP ! AP i AP1
i AW Qi*1 Qi* ! Qi Ai 1
Qi* Ai * i 1 *i ! Ai
16
A* ! Q
A* n ! Q V n
AI ! V
n n
I n ! * *n
V n residual
17
18
! Qi Aij * kj
j !1
i ! 1,2,..., n
Gauss-Seidel method: similar to Jacobi method, but most recently computed values of all * i are used in all computations.
Rik * ik 1 ! * ik Aii
i 1
i ! 1,2,..., n
f x
} f x0
f x0
x x0
'
f xk 1 xk ! xk 1 ' f xk 1
2. Global: guarantee not to diverge but slower, such as sequential decoupled method
21
(for all i, j)
(* ik,j1 I
I f i ,kj
n
(for all i, j)
(*
i, j
k 1 i, j
i, j
(* ik,j1 * ik, j
(* ik,j1 i, j
12
Inner iterations can be stopped when the residual has fallen by one to two orders of magnitude. Details on how to estimate iterative errors have been presented in CFD lecture.
22
23
d* t ! f t , * t dt
* t0 ! * 0
Application to the Generic Transport Equation 1. Explicit methods 2. Implicit methods 3. Other methods
x* x* + x 2 * ! u xt xx V xx 2
24
explicit * n 1 ! * n f n , * n t t (
* n 1 ! * n f t n 1 , * n 1 (t implicit
Methods for Initial Value Problems in ODEs (4th order Runge-Kutta method) (t * n * 1 !* f tn , * n n 2 2 (t ** n t 1 , ** 1 * 1 !* f n 2 n 2 n 2 2
t 1 , * ** 1 * ! * (tf n n 2 2 (t n 1 n n * t 1 , * 1 2 f t 1 , * ** 1 f t n 1 , * * 1 * ! * f tn , * 2 f n n n n n 6 2 2 2 2
* n 1 n
25
n 1 i
c n c n 1 ! 2d
* d * i 1 d * i 1 2 2
n i
1 2d
* in 1 c d * in11 c d * in11 ! * in
2 2
Advantage: Use of the implicit Euler method allows arbitrarily large time steps to be taken Disadvantage: first order truncation error in time and the need to solve a large coupled set of equations at each time step.
27
28
x2w x 2w x2w xw xw xw xw xp Vu Vv Vw ! Q 2 2 2 V xt xx xy xz xz xy xz xx
Local acceleration
Convection
Discretization of Convective, pressure and Viscous terms Conservation properties: 1. Guaranteeing global energy conservation in a numerical method is a worthwhile goal, but not easily attained; 2. Incompressible isothermal flows, significance is kinetic energy; 3. heat transfer: thermal energy>>kinetic energy
29
Colocated Staggered
30
u=UTOP, v=0
UTOP
u=v=0 y o x u=v=0
u=v=0
33
^ !
xv xu xx xy
x 2v x 2v xv xv xv xp u v ! R 2 2 xx xt xx xy xy xy
x] !u xy x] ! v xx
x^ x^ x^ 1 x 2^ x 2 ^ 2 2 u v ! xt xx xy Re l xx xy x 2] x p x p 2 ! 2 2 2 xx xy xx
2 2
x 2] x 2] 2 ! ^ 2 xx xy
x ] 2 xy
2
x] xxxy
2
Ul Re l ! R
x^ x^ x u^ x v^ u v ! xx xy xx xy
34
( w o n
2
? A
3
^ i , NJ !
xp xs
i , NJ
(y
(y
w
i , NJ 1
^w !
(n 2
w1
1 x^ ! Re l xn
1 ! Re l
3^ s , w 4^ s , w1 ^ s , w 2 2(n
For wall pressures, using the tangential momentum equation to the fluid adjacent to the wall surface, get: * s is measured along the wall surface and n is normal to it * Pressure at the lower left corner of the cavity is assigned 1.0
35
uin1, j^ in 1, j uin1, j^ in 1, j 2 (x
1 ! Re l
( (x ) 2
pin1, j 2 p in, j p in1, j ( (x )
2
( (y ) 2
2nd order central difference scheme used for all spatial derivatives
36
Specify the geometry and fluid properties Specify initial conditions (e.g. u=v= ^ = ] =0). Specify boundary conditions Determine (t n 1 Solve the vorticity transport equation for ^ n 1 Solve stream function equation for ] Solve for un+1 and vn+1 Solve the boundary conditions for ^ n 1 on the walls Continue marching to time of interest, or until the steady state is reached.
37
n 1 i, j
^
n i, j
e 1v 10
8
and
i !1, j !1
1 NI v NJ
i ! NI , j ! NJ i !1, j !1
^ in 1 ^ in j e 1v 10 8 ,j ,
38
0.9
27 25 21 23
0.8 0.7
29
25 19 17 15 13 1 1
9
29 23 21
27
23
29
23 21 19
evel psi 31 0.0018 29 -0.0009 -0.0064 -0.0119 -0.0174 -0.0228 -0.0283 -0.0338 -0.0393 -0.0448 -0.0502 -0.0557 -0.0612 -0.0667 -0.0721 -0.0776
14
7
19
0.6
15 17 21 19 23 25 27 29
y 0.5
0.4 0.3 0.2 0.1 0 0
1 0.9
5
3
11 13
13
11
27
13
28
25
23
29
21 19
17
25
15
29
27
1
1
14 16 19
x
15
11
25
Level 29
p 1.1905 1.1754 1.1604 1.1454 1.1303 1.1153 1.1003 1.0852 1.0702 1.0552 1.0401 1.0251 1.0101 0.9950 0.9800
27 25
17 1 9 21
23
27
29
19
13
9
15
17
21
21 23
11
13
27 25 23 21 19 17 15 13 11 9 7 5 3 1
5
9
y 0.5
0.4 0.3 0.2 0.1 0 0
0.1 0
21
9 7 5 3 1
17
27 25 23 21 19 17 15 13 11
13 11 9
y 0.5
0.4 0.3 0.2 0.1 0 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 1.1
17
15
2 3 25 27
21
7
3
x
9 11
17
13 15 19
4 8
17
Level 29 27 25 23 21 19 17 15 13 11 9 7
zeta 11.2711 8.3232 5.3753 2.4273 -0.5206 -3.4686 -6.4165 -9.3644 -12.3124 -15.2603 -18.2082 -21.1562 -24.1041 -27.0521 -30.0000
21 21
19
y 0.5
0.4 0.3 0.2
21
29 27 25
21
5 3 1
24
25
23
39
40