Anda di halaman 1dari 44

1

Hydroinformatics y
Module 4:Numerical Methods I
Lecture 5 and 6: PDE, Hyperbolic
PDE, Stability, Accuracy, Parabolic
PDE, Eliptic PDE
1/25/2012 Numerical Methods 1
I.Popescu
5.4. Hyperbolic PDE-MoC schemes
0 =
c
c
+
c
c
x
u
a
t
u
const t x u = ) , ( ) , ( t x a
dt
dx
= along
MoC theory
x A
1 + n
t
t A
u=ct
n
A
n
j
u A u u = =
+
) (
1
n
j
n
n
A
u and u
u
between
ed interpolat
1/25/2012 Numerical Methods 2
1 j
0
j
1 + j
0
x
n
A
j
j
u and u
1

2
5.4. Hyperbolic PDE-MoC schemes
0 =
c
c
+
c
c
x
u
a
t
u
n
j
n
j
n
A
u and u u
1
between ion interpolat liniar

Ax
1
t
At
aAt j-1
A
j
n+1
n
x
t a x x A =
x
t a
Cr
A
A
=
x
j-1
x
1/25/2012 Numerical Methods 3
n
j
j j
A j n
j
j j
j A n
A
U
x x
x x
U
x x
x x
U
1
1 1
1

=
t a x x
j A
A =
( )
n
j
n
j
n
A
n
j
CrU U Cr U U
1
1
1

+
+ = =
x
u
x
A
x
j
5.4.Hyperbolic PDE-MoC schemes
Special remarks
The MoC numerical method is stable for Cr<1
For Cr>1 extrapolation takes place For Cr>1 extrapolation takes place
Ax
At
A
n+1
n
t
Cr<1
Cr>1
1/25/2012 Numerical Methods 4
Important: The formula is
valid for positive values of a.
aAt
j-1 j
n
x
( )
n
j
n
j
n
A
n
j
CrU U Cr U U
1
1
1

+
+ = =
3
Accuracy/consistency
The discretised equations are not the
real ones
Th h d l h l
x
u
c
c
real
The scheme does not solve the real
equations !
1/25/2012 Numerical Methods 5
approximate
x
u
c
c
Important Properties of Numerical Schemes
Convergence
numerical scheme solution is convergent if it comes closer and
closer to the analytical solution of the real ODE/PDE when the
ti t d
Consistency
Convergence
Stability
time step decreases;
LaxTheorem: 2conditions neededfor convergence
Consistency
A scheme is consistent if it gives a correct approximation
of the ODE/PDE as the time/space step is decreased
verified using Taylor Series expansion
Stability
A scheme is stable if any initially finite perturbation
remains boundedas time grows
Verification: Matrix method, Fourier method, Domain of
dependence
1/25/2012 I.Popescu: Numerical Methods 6
4
Accuracy/consistency
To reduce the truncation error :
Decrease both At and Ax
(i e the Courant number must lie in a
Consistency
Convergence
Stability
(i.e. the Courant number must lie in a
reasonable range)
If the truncation error is small:
the discretised equation is consistent
x
t a
Cr
A
A
=
1/25/2012 Numerical Methods 7
q
with the real one.
Accuracy and suitability
Consistency of schemes for PDEs
( )
n
j
n
j
n
j
U Cr CrU U + =

+
1
1
1
0 =
c
c
+
c
c U
a
U
Consistency
Convergence
Stability
( )
j j j 1
c c x t
u
Initial profile of u
Exact solution, (Cr=1)
Cr=0.5, dx=100m
Cr=0.5, dx=50m
Numerical diffusion
1/25/2012 Numerical Methods 8
x
Numerical diffusion
causes amplitude error
5
Numerical diffusion : profile smearing
1.2 Initial
Analytical
Accuracy/consistency
Consistency
Convergence
Stability
0.4
0.6
0.8
1
u
Numerical
1/25/2012 Numerical Methods 9
0
0.2
0 2 4 6 8 10 12 14 16 18 20
x
Accuracy and suitability
Consistency of explicit schemes
( )
n
j
n
j
n
j
U Cr CrU U + =

+
1
1
1
0 =
c
c
+
c
c U
a
U
Consistency
Convergence
Stability
( )
j j j 1
c c x t
Taylor series expansions gives
( )
3
2
2 2
1
2
x O
x
U x
x
U
x U U
n
j
n
j
A +
c
c A
+
c
c
A =

( )
3
2
2 2
1
2
t O
t
U t
t
U
t U U
n
j
n
j
A +
c
c A
+
c
c
A + =
+
1/25/2012 Numerical Methods 10
2 t t c c
( ) ( )
n
j
n
j
n
j
U
x
t
a
x
t
a x O
x
U x
x
U
x U t O
t
U t
t
U
t U |
.
|

\
|
A
A
+
A
A
(

A +
c
c A
+
c
c
A = A +
c
c A
+
c
c
A + 1
2 2
3
2
2 2
3
2
2 2
Into the equation this gives:
6
Accuracy and suitability
Consistency of explicit schemes
After dividing with dt we obtain:
Consistency
Convergence
Stability
( ) ( ) a x O
x
U x
x
U
t O
t
U t
t
U
(

A +
c
c A
+
c
c
= A +
c
c A
+
c
c
2
2
2
2
2
2
2 2
or:
( ) ( )
2 2
2
2
2
2
2 2
t O x O a
x
U x
t
U t
x
U
a
t
U
A A +
(

c
c A
+
c
c A
=
c
c
+
c
c
1/25/2012 Numerical Methods 11
Since
2
2
2
2
2
x
U
a
t
U
c
c
=
c
c
( ) ( ) ( )



TE
TE TE
TE
t O x O
x
U x a
Cr
x
U
a
t
U
3 2
1
2 2
2
2
2
1 A A +
c
c A
=
c
c
+
c
c
Accuracy and suitability
Consistency of explicit schemes
( ) ( ) ( ) t O x O
U x a
Cr
U
a
U
2 2
2
1 A A +
c A
=
c
+
c
Consistency
Convergence
Stability
( ) ( ) ( )



TE
TE TE
TE
t O x O
x
Cr
x
a
t
3 2
1
2
2
1 A A +
c c
+
c
-TE
1
cancels for Cr=1 ;
- first order accurate in x;
1/25/2012 Numerical Methods 12
- consistent up to the second order;
7
What you want to solve :
0 =
c
+
c u
a
u
Accuracy/consistency
Consistency
Convergence
Stability
What the scheme sees :
0 =
c
+
c x
a
t
...
3
2
2
2
1
+
c
A +
c
A =
c
+
c u
x k
u
x k
u
a
u
Numerical
diffusion
1/25/2012 Numerical Methods 13
...
3
2
2
1
+
c
A +
c
A
c
+
c x
x k
x
x k
x
a
t
Truncation error
Numerical
dispersion
Accuracy and suitability
Stability of schemes for PDEs
( )
n
j
n
j
n
j
U Cr CrU U + =

+
1
1
1
0 =
c
c
+
c
c U
a
U
Consistency
Convergence
Stability
( )
j j j 1
c c x t
u
Initial profile of u
Exact solution, (Cr=1)
Cr=0.5, dx=100m
Cr=0.5, dx=50m
Numerical diffusion
1/25/2012 Numerical Methods 14
x
Numerical diffusion
causes amplitude error
8
Accuracy and suitability
Stability of schemes for PDEs
Because of numerical diffusion we try to use a better scheme,
like for instance Preismann scheme with psi=0.5;
a dispersion equation
Consistency
Convergence
Stability
p q
0 =
c
c
+
c
c
x
U
a
t
U
3
3
x
U
k
x
U
a
t
U
c
c
=
c
c
+
c
c
Dispersion equation
u
Initial
profile
Analytical profile,
Advected
downstream
Numerical dispersion
1/25/2012 Numerical Methods 15
x
Computational
result
Numerical dispersion
Due to derivatives estimation
Sharper profiles and oscilations
Create phase errors
Numerical dispersion
Numerical diffusion : profile smearing
1.2 Initial
Analytical
Accuracy/consistency
Consistency
Convergence
Stability
0.4
0.6
0.8
1
u
Numerical
1/25/2012 Numerical Methods 16
0
0.2
0 2 4 6 8 10 12 14 16 18 20
x
9
Numerical dispersion : oscillations
1.2
Initial
Analytical
Accuracy/consistency Consistency
Convergence
Stability
0.2
0.4
0.6
0.8
1
u
Analytical
Numerical
1/25/2012 Numerical Methods 17
-0.4
-0.2
0
0 2 4 6 8 10 12 14 16 18 20
x
Accuracy and suitability
Stability of explicit schemes
Von Neumann stability method (Using Fourier
analysis)
Consistency
Convergence
Stability
Same principle: amplitude factor is less than 1
1/25/2012 Numerical Methods 18
10
Stability
Stability of explicit schemes
Von Neumann stability method (Using Fourier analysis)
Same principle: amplitude factor is less than 1
( ) x ij t n n
j
e U U
A + A
=
0
0
( ) ( ) ( ) | | ( ) ( ) | | x j i x j t n i t n t n U U
i i r
n
j
A + A A + A A = sin cos sin cos exp
0
0
( )
n
j
n
j
n
j
n
j
N
U
U
Cr Cr
U
U
A
1
1
1

+
+ = =

R
i
1 -1
Ax
1/25/2012 Numerical Methods 19
( ) ( )
( )
( ) x i
x ij t n U
x j i t n U
U
U
n
j
n
j
A =
A + A
A + A
=



exp
exp
1 exp
0
0
0
0
1
( ) ( ) | |Cr x i x Cr A
N
A A + = sin cos 1
R
Cr
Unit
circle
-i
-Ax
Amplitude and phase portraits
Wave amplitude
Amplification factor =1
Propagation of Fourier waves phase speed Propagation of Fourier waves phase speed
Any difference between the numerical phase speed
and true phase speed is the phase error
The graph that shows how the Fourier
components are amplified is called an
amplitude portrait.
1/25/2012 Numerical Methods 20
The graph that shows at what speed the
Fourier components travel is called a phase
portrait.
11
Amplitude and phase portraits
M
x
t

2
= A
M- The wave number - represents the
number of grid intervals needed to cover
one period of the wave
M
one period of the wave
0.75
0.8
0.85
0.9
0.95
1
1.05
1 10 100
A
1
1.2
1/25/2012 Numerical Methods 21
( )
( )
t 2
M
A Arg
Cr
a A Arg
c
N
N
N
= =
Cr
M
i
M
Cr A
N (

|
.
|

\
|
|
.
|

\
|
+ =
t t 2
sin
2
cos 1
1 10 100
M
0
0.2
0.4
0.6
0.8
1
1 10 100
M
c
/
u
Phase and amplitude errors
1/25/2012 Numerical Methods 22
12
(B)Parabolic PDEs
1/25/2012 Numerical Methods 23
Parabolic Equations Initial Value Problems
A 1D time-dependent parabolic eqn (b=c=0)
2
2
u
a
u c
=
c
T t
L x
s s
s s
0
0
t
Computational
T
2
x t c c
T t s s 0
) ( ) 0 , ( x f x u =
) ( ) , (
) ( ) , 0 (
t h t L u
t g t u
=
=
x
Computational
domain
0 L
With I.C
With B.C
1/25/2012 Numerical Methods 24
x
u
0 L
t=0
f(x)
t
u
0 T
x=0
g(t)
t
u
0 T
x=L
h(t)
13
Example : Heat Conduction
Equation governing transfer of heat is:
2
2
x
T
k
t
T
c
p
c
c
=
c
c

T(x,t) temperature
density
c specific heat capacity
is also known as the thermal diffusivity
x t
p
c c
c
p
specific heat capacity
k thermal conductivity
p
c
k
a

=
t
1 + n
n
i
u
n
i
u
1 +
n
i
u
1
1 + n
i
u N
L
x = A
1/25/2012 Numerical Methods 25
x
1 n
i
u
i 1 + i 1 i
1 n
n
i i 1 + i 1
M
T
t = A
Parabolic PDE: Solution Methods Explicit Methods
2
2
x
u
a
t
u
c
c
=
c
c
t
n
1 + n
n
i
u
n
i
u
1 +
n
i
u
1
1 + n
i
u
2
1 1
2
2
2
x
u u u
x
u
n
i
n
i
n
i
A
+
=
c
c
+
CS:
1 1
1
2 u u u u u
n
i
n
i
n
i
n
i
n
i
+
+
x
1 n
i
u
i
1 + i 1 i
1 n
1/25/2012 Numerical Methods 26
t
u u
t
u
n
i
n
i
A

=
c
c
+1
2
1 1
2
x
u u u
a
t
u u
i i i i i
A
+
=
A
+
FT:
( )
n
i
n
i
n
i
n
i
n
i
u u u r u u
1 1
1
2
+
+
+ + =
2
x
t a
r
A
A
=
14
2
2
x
u
a
t
u
c
c
=
c
c
( )
n n n n n 1
2
+
+ +
t
n
1 + n
n
i
u
n
i
u
1 +
n
i
u
1
1 + n
i
u
Parabolic PDE:Solution Methods Explicit Methods
2
( )
n
i
n
i
n
i
n
i
n
i
u u u r u u
1 1
1
2
+
+
+ + =
x
1 n
i
u
i
1 + i 1 i
1 n
I.C.: ) (
0
x i f u
i
A =
B.C.:
) (
0
t n g u
n
A =
1/25/2012 Numerical Methods 27
) (
) (
0
t n h u
g
n
N
A =
We can calculate the unknown values of from the known
values of starting from the initial condition
1 + n
i
u
n
i
u
0
i
u
Parabolic PDE: Stability of the Explicit Method
The explicit method is unstable if the time
step is too large.
Stability condition for fixed boundary Stability condition for fixed boundary
conditions is
Stability condition for derivative boundary
conditions is
2
1
0 s < r
a
x
t
2

2
A
s A
1/25/2012 Numerical Methods 28
for ) (
f
u u
n
u
k =
c
c
o
x
r
k
A +
s <
o
2
1
0
15
Parabolic Equation An example calculation
Solve
for
2
2
x
u
a
t
u
c
c
=
c
c
s s
s s x
0
1 0
(Where u represents temperature)
with initial condition
x t c c
t s s t 0

s s
s s
=
0 . 1 5 . 0 for ) 1 ( 2
5 . 0 0 for 2
) 0 , (
x x
x x
x u
u
1
0 5 0
1/25/2012 Numerical Methods 29
and boundary conditions
0 ) , 1 (
0 ) , 0 (
=
=
t u
t u
x
1 0.5 0
Parabolic Equation An example calculation
2
Solve
for
2
2
u
a
t
u
c
c
=
c
c
s s
s s x
0
1 0
(Where u represents temperature)
with initial condition
2
x t c c t s s t 0

s s
s s
=
0 . 1 5 . 0 for ) 1 ( 2
5 . 0 0 for 2
) 0 , (
x x
x x
x u
u
1
0 5 0
1/25/2012 Numerical Methods 30
and boundary conditions
0 ) , 1 (
0 ) , 0 (
=
=
t u
t u
( )
( ) ( )


=
1
2
1
2 2 2
2
sin sin x
exp 8
) , (
n
x n n
t n n
t x u
t t
t
t
Analytical (exact) solution
x
1 0.5 0
16
Parabolic Example : Case 1 (r<0.5)
001 . 0
1 . 0
= A
= A
t
x
1 . 0
2
=
A
A
=
x
t a
r
) 2 (
1 n n n n n+
1 = a
Values for a, space and time discretisation are:
...
2 . 0 ) 0 . 0 4 . 0 4 . 0 ( 1 . 0 2 . 0
1
1
= + + = u
.... , 8 . 0 , 0 . 1 , 8 . 0 , .. . , 4 . 0 , 2 . 0 , 0
0
6
0
5
0
4
0
2
0
1
0
0
= = = = = = u u u u u u
) 2 (
1 1
1 n
i
n
i
n
i
n
i
n
i
u u u r u u
+
+
+ + =
n=0
t=0
n=1
1/25/2012 Numerical Methods 31
96 . 0 ) 8 . 0 0 . 2 8 . 0 ( 1 . 0 0 . 1
...
1
5
= + + = u
928 . 0 ) 8 . 0 92 . 1 8 . 0 ( 1 . 0 96 . 0
...
2 . 0 ) 0 . 0 4 . 0 4 . 0 ( 1 . 0 2 . 0
2
5
2
1
= + + =
= + + =
u
u
t=0.001
n=2
t=0.002
Parabolic Example : Case 1 (r<0.5)
i = 0 1 2 3 4 5
x = 0 0. 1000 0. 2000 0. 3000 0. 4000 0. 5000
First 10 time steps
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
n=0 0 0. 2000 0. 4000 0. 6000 0. 8000 1. 0000
n=1 0 0. 2000 0. 4000 0. 6000 0. 8000 0. 9600
n=2 0 0. 2000 0. 4000 0. 6000 0. 7960 0. 9280
n=3 0 0. 2000 0. 4000 0. 5996 0. 7896 0. 9016
n=4 0 0. 2000 0. 4000 0. 5986 0. 7818 0. 8792
n=5 0 0. 2000 0. 3998 0. 5971 0. 7732 0. 8597
n=6 0 0. 2000 0. 3996 0. 5950 0. 7643 0. 8424
m
m
e
t
r
i
c
a
l

a
b
o
u
t

x
=
0
.
5
1/25/2012 Numerical Methods 32
n=7 0 0. 1999 0. 3992 0. 5924 0. 7551 0. 8268
n=8 0 0. 1999 0. 3986 0. 5893 0. 7460 0. 8125
n=9 0 0. 1998 0. 3978 0. 5859 0. 7370 0. 7992
n=10 0 0. 1996 0. 3968 0. 5822 0. 7281 0. 7867
s
y
m
17
1
Evolution of temperature distribution
Parabolic Example : Case 1 (r<0.5)
Plot of the temperature distribution every 10
discretisation points in space for 100 time steps
0.4
0.5
0.6
0.7
0.8
0.9
t
e
m
p
e
r
a
t
u
r
e
t=0
STABLE
solution
1/25/2012 Numerical Methods 33
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
0
0.1
0.2
0.3
x
t=0.1
& analytic solution
Parabolic Example : Case 2 (r=0.5)
Plot of the temperature distribution every 10
space step for 20 time steps
0.5
0.6
0.7
0.8
0.9
1
t
e
m
p
e
r
a
t
u
r
e
Evolution of temperature distribution
t=0
005 . 0
1 . 0
= A
= A
t
x
5 . 0
2
=
A
A
=
x
t a
r
1/25/2012 Numerical Methods 34
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
0
0.1
0.2
0.3
0.4
x
t=0.1
& analytic solution
STABLE
solution but
not very
accurate
18
1
Evolution of temperature distribution
Parabolic Example : Case 3 (r>0.5)
Plot of the temperature distribution at 0 and 18
time steps
0.5
0.6
0.7
0.8
0.9
1
t
e
m
p
e
r
a
t
u
r
e
t=0
t=0.1
0055 . 0
1 . 0
= A
= A
t
x
55 . 0
2
=
A
A
=
x
t a
r
analytic
solution
1/25/2012 Numerical Methods 35
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
0
0.1
0.2
0.3
0.4
x
solution
UNSTABLE
solution is
meaningless
Parabolic Example :
Evolution of maximum temperature (r=0.1)
0.9
1
Evolution of maximumtemperature
exact solution
r=0.1 solution
0.5
0.6
0.7
0.8
m
a
x
im
u
m

t
e
m
p
e
r
a
t
u
r
e
STABLE
solution
1/25/2012 Numerical Methods 36
0 0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08 0.09 0.1
0.3
0.4
time
19
0.9
1
Evolution of maximumtemperature
exact solution
r=0.5 solution
Parabolic Example :
Evolution of maximum temperature (r=0.5)
0.5
0.6
0.7
0.8
m
a
x
i
m
u
m

t
e
m
p
e
r
a
t
u
r
e
STABLE
solution but
not v.
accurate
1/25/2012 Numerical Methods 37
0 0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08 0.09 0.1
0.3
0.4
time
Parabolic Example :
Evolution of maximum temperature (r=0.55)
0.9
1
Evolution of maximumtemperature
exact solution
r=0.55 solution
0.5
0.6
0.7
0.8
m
a
x
im
u
m

t
e
m
p
e
r
a
t
u
r
e
UNSTABLE
solution is
meaningless
1/25/2012 Numerical Methods 38
0 0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08 0.09 0.1
0.3
0.4
time
20
Parabolic Example : Explicit Method Error
r M u % error
Comparison of temperature values at x=0.5 and t=0.1 (for N=11)
analytic - 0.3021 -
0.001 10000 0.3071 1.65
0.01 1000 0.3070 1.60
0.1 100 0.3056 1.16
0.5 20 0.3071 1.64
need to
increase N
to reduce
1/25/2012 Numerical Methods 39
0.55 18 0.6336 109
0.6 16 7.2340 2294
error
further
unstable
(C)Eliptic PDEs
1/25/2012 Numerical Methods 40
21
Elliptic Equations No time variable
With the particular cases:
) , , ( ) , (
2
2
2
2
y x u f y x u
x
u
y
u
= +
c
c
+
c
c

y
x
L y
L x
s s
s s
0
0
With the particular cases:
- Poisson equation
- Laplace equation
) , , ( 0
2
2
2
2
y x u f
x
u
y
u
=
c
c
+
c
c
=
0 0 0
2
2
2
2
=
c
c
+
c
c
= =
x
u
y
u
f and
With different typs of B.C.:
Dirichlet : u is specified at the boundary
d f f d h b d
1/25/2012 Numerical Methods 41
t
Neumann : derivative of u is specified at the boundary
Mixed(robin): both u and its derivative is specified at
the boundary
Example : Laplace equation
Equation is:
Lx
x = A
0
2
2
2
2
=
c
c
+
c
c
x
u
y
u
y
1 , j i
u
1 j
j
1 + j
j i
u
, j i
u
, 1 + j i
u
, 1
1 , + j i
u
N
Ly
y = A
M
x = A
1/25/2012 Numerical Methods 42
x
i 1 + i 1 i
Approximate solution determined at all grid points
simultaneously by solving single system of algebraic
equations
22
Elliptic PDE:Solution Methods Explicit Methods
y
j
1 + j
j i
u
, j i
u
, 1 + j i
u
, 1
1 , + j i
u
0
2
2
2
2
=
c
c
+
c
c
x
u
y
u
2
, 1 , , 1
2
2
2
x
u u u
x
u
j i j i j i
A
+
=
c
c
+
x
1 , j i
u
i 1 + i 1 i
1 j
2 2 + + u u u u u u
1/25/2012 Numerical Methods 43
0 4
, 1 , 1 , , 1 , 1
= + + +
+ + j i j i j i j i j i
u u u u u
2
1 , , 1 ,
2
2
2
y
u u u
y
u
j i j i j i
A
+
=
c
c
+
0
2 2
2
1 , , 1 ,
2
, 1 , , 1
=
A
+
+
A
+
+ +
y
u u u
x
u u u
j i j i j i j i j i j i
Holds for all interior points of the domain
Finite difference methods
What you should remember
1/25/2012 Numerical Methods 44
23
What you should remember
Numerical solutions to PDEs can be
obtained by discretising both space and
time.
Explicit numerical schemes for PDEs are
subject to stability constraints.
Implicit numerical schemes for PDEs are
always stable.
Iterations are also needed for the implicit
1/25/2012
Numerical Methods
45
Iterations are also needed for the implicit
solution of non-linear PDEs.
The notions of consistency, stability and
convergence also hold for numerical
schemes for PDEs.
What you should remember
First-order accurate schemes produce
numerical diffusion; numerical profiles
obtained are smoothed and may lead to
peak underestimation. Numerical
diffusion leads to amplitude error.
Second-order accurate schemes produce
numerical dispersion; numerical profiles
exhibit artificial oscillations. Undesirable
1/25/2012 Numerical Methods 46
behaviours (such as negative
concentrations) may appear. Numerical
dispersion causes phase error.
24
What you should remember
Decreasing At or Ax alone is not sufficient to
reduce the truncation error : At and Ax should
be reduced together.
Th MOC i ifi ki d f i l h d The MOC is a specific kind of numerical method
used for advection modelling. Its main
drawback is that it is generally not conservative
(some water, pollutant, or energy, may be lost
artificially).
At least three points in space are needed to
1/25/2012 Numerical Methods 47
solve a diffusion equation.
The design of 2-D and 3-D computational grid
should be carried out with care, long and
narrow grids should be avoided.
6 Finite volume methods
(FVM)
1/25/2012 Numerical Methods 48
25
FVM principle
(1)
FVMs are applicable to conservative equations, i.e. equations of the
form
problems) (1D 0 =
c
c
+
c
c
x
F
t
U
problems) (3D 0
problems) (2D 0
=
c
c
+
c
c
+
c
c
+
c
c
=
c
c
+
c
c
+
c
c
z
H
y
G
x
F
t
U
y
G
x
F
t
U
F, G, H : Fluxes in x, y and z
U : Conserved variable
|
|

| c c c c c c
n n n
U U U U U U
(5.1)
1/25/2012 Numerical Methods 49
|
|
.
|

\
|
c
c
c
c
c
c
c
c
c
c
c
c
=
|
|
.
|

\
|
c
c
c
c
c
c
c
c
c
c
c
c
=
|
|
.
|

\
|
c
c
c
c
c
c
c
c
c
c
c
c
=
n
n
n
n
n
n
n
n
n
n
n
n
n n n
z
U
y
U
x
U
z
U
y
U
x
U
U H H
z
U
y
U
x
U
z
U
y
U
x
U
U G G
z
U
y
U
x
U
z
U
y
U
x
U
U F F
, , , , , ,
, , , , , ,
, , , , , ,

Eqs. (5.1) express the conservation of U over any bounded volume of


space
(5.2)
( ) 0 = + + V +
c
c
z H y G x F
t
U
FVM principle
(2)
V : Divergence operator
By definition of the divergence, Eq. (5.2) can be rewritten as
( ) 0 d . d d d = + + +
c
c
} }
I O
n z H y G x F z y x U
t
n
1/25/2012 Numerical Methods 50
F
O
I
26
Application:
1) Discretise space into volumes
2) Compute the fluxes at the edges between the volumes
3) D t i th h i U i b l ti
FVM principle
(3)
3) Determine the changes in U via a balance equation
(5.3)
( )
V
t
U U
n n
A
+ =
+
out in
1
Flux Flux
1/25/2012 Numerical Methods 51
V
The conservation law together with piecewise constant data
having a single discontinuity is known as the Riemann problem.
0 if s
FVM application
(1)
0
0
if
if
l
x
r
q x
q
q x
s
=

>

h
us
Q
us
h
ds
h
us
Q
us
h
ds
Q
h-discontinuity
1/25/2012 Numerical Methods 52
Q
ds
Q
ds
27
h
us
Q
us
h
ds
Q
h
us
Q
us
h
ds
Q
h-discontinuity
FVM application
(2)
Q
ds
Q
ds
Three possible patterns:
zones of constant state (depth and velocity are
homogeneous over such zones),
a shock wave (information coming from upstream catches
di f i d )
1/25/2012 Numerical Methods 53
and information downstream),
a rarefaction wave (information downstream travels faster
than the information upstream).
Transport equations
( )
2 / 1 2 / 1
1
+
+

A
A
+ =
j j
j
n
j
n
j
F F
x
t
C C
0 = |
.
|

\
|
c
c

c
c
+
c
c
x
C
D uC
x t
C
F
FVM applications
(3)
C
Ax
j
F
j-1/2
F
j+1/2
F
1/25/2012 Numerical Methods 54

s
A + A

>
A + A

0 if 2
0 if 2
1
1
1
1
1
2 / 1
u
x x
C C
D uC
u
x x
C C
D uC
F
j j
n
j
n
j n
j
j j
n
j
n
j n
j
j
28
Applications in 1D
Discontinuous flows
PDE) (scalar 0 =
c
c
+
c
c
x
U
t
U
FVM applications
(4)
When F [F] is a non-linear function of U [U], the solution
may become discontinuous
Ex. Burgers equation
PDEs) of (system 0 =
c
c
+
c
c
x t
F U
form) ion (conservat 0
2
2
u
x t
u
=
|
|
.
|

\
|
c
c
+
c
c
1/25/2012 Numerical Methods 55
invariant) Riemann a is (
d
d
along 0
D
D
form) istic (character 0
2
u u
t
x
t
u
x
u
u
t
u
x t
= =
=
c
c
+
c
c
|
.

\
c c
Applications in 1D
Burgers Eq. (continued): formation of shocks from initially
smooth profiles
FVM applications
(5)
t
A B
U
x
A
B
A
B
Shock (u travels faster
behind than ahead)
1/25/2012 Numerical Methods 56
x
t
0
t
1
A
A
B
B
dx/dt =u
u =Cst
29
Applications in 1D (4)
In finite volume methods: the flux is calculated from the
solution of a Riemann problem
FVM applications
(6)
U
x
Initial
Final
U =Cst here
1/25/2012 Numerical Methods 57
x
t
x
The characteristics are straight
lines in the phase space
Applications in 1D
The solution of the Riemann problem exists even though the
initial profile is discontinuous
FVM applications
(7)
Algorithm
1) At each interface j-1/2, define the Riemann problem
2) Solve it =>solution U
j-1/2
3) Compute the flux
( )
n
j
n
j
U U ,
1
( )
2 / 1 2 / 1
=
j j
U F F
1/25/2012 Numerical Methods 58
4) For each cell, carry out balance for U
( )
2 / 1 2 / 1
1
+
+

A
A
+ =
j j
j
n
j
n
j
F F
x
t
U U
30
Multidimensional problems
Wave splitting (scalar equations)
0 =
c
c
+
c
c
+
c
c
y
U
v
x
U
u
t
U
FVM applications
(8)
M (x
i1/2
, y
M
)
uAt
M(x
i1/2
uAt, y
M
)
Cell (i, j) Cell (i 1, j)
Interface (i 1/2, j)
c c c y x t
1/25/2012 Numerical Methods 59
vAt
x
M(x
i1/2
uAt, y
M
vAt )
Multidimensional problems (2)
Wave splitting (systems of equations)
c c c G F U
FVM applications
(9)
Decomposed into
0 =
c
c
+
c
c
+
c
c
y x t
G F U
by followed
0 0
c c c c
=
c
c
+
c
c
=
c
c
+
c
c
x t x t
U U G U
U
A
U F U
1/25/2012 Numerical Methods 60
=>Decompose the Riemann problem into 2 R.Ps: 1 along x
and 1 along y
0 0 =
c
c
+
c
c
=
c
c
+
c
c
y t y t
U
B
U G U
31
Multidimensional problems (3)
Wave splitting (2)
FVM applications
(10)
t
p
x
A
) (

t
p
y
A
) 1 (

P
(p, 1)
N
(p)
M
B
U
(p)
1/25/2012 Numerical Methods 61
t
p
y
A
) 2 , (

P
(p, 2)
A
What you should remember
Finite Volume Methods (FVMs) are well-
suited for the solution of conservative
PDEs. The weak solution of the PDE is
sought.
FVMs ensure mass conservation
automaticly and can handle shocks and
discontinuities.
The solution of the advection PDE by the
1/25/2012 Numerical Methods 62
The solution of the advection PDE by the
Godunov-type FVMs involves the
definition and the solution of a Riemann
problem.
32
7. Finite Element Method
(FEM) - useful for problems with
complicated geometries and
discontinuities, where analytical
1/25/2012 Numerical Methods 63
y
solutions can not be obtained
What is it FEM?
The finite element method is a numerical method
for solving problems of engineering and
mathematical physics, useful for problems with
li t d t i d di ti iti complicated geometries and discontinuities,
where analytical solutions can not be obtained.
1/25/2012 Numerical Methods 64
33
Principle of the method -(1)
Methodology
Approximating the field of a dependent variable by a finite series
expansion in terms of linearly independent analytical functions.
The form of the expansion functions in the finite-element method is in a
such way that they are only locally non zero
O
( ) 0 = U f
1/25/2012 Numerical Methods 65
O
( ) 0 =
}
O
e wd U f
Principle of the method -(2)
Methodology:Two basic steps in the finite-element:
expand the dependent variables in terms of a set of low-
order polynomials (the basis functions) which are only locally
non-zero;
insert these expansions into the governing equations and insert these expansions into the governing equations and
orthogonalize the error with respect to some test functions.
( ) 0 = U f

=
=
e
N
j
j j
U N y x U
1
) , (
1/25/2012 Numerical Methods 66
( ) 0 =
}
O
e wd U f
34
Principle of the method -(3)
Discretization
Model the domain by dividing it into an equivalent system of
smaller domains or units (finite elements) interconnected at
points common to two or more elements (nodes or nodal points)
and/or boundary lines and/or surfaces.
1/25/2012 Numerical Methods 67
Principle of the method -(4)
Discretization

e
N
U N y x U ) (

=
=
j
j j
U N y x U
1
) , (
N
1
and N
2
are called Shape Functions or Interpolation Functions.
They express the shape of the assumed U.
For a linear representation of 1D elements:
N
1
=1 N
2
=0 at node 1
N
1
N
1/25/2012 Numerical Methods 68
N
1
1 N
2
0 at node 1
N
1
=0 N
2
=1 at node 2
N
1
+ N
2
=1
1 2
N
1
L
1 2
N
2
L
1 2
N
1
N
2
L
35
Methodology
Obtain a set of algebraic equations to solve for unknown
nodal quantity (displacement).
Principle of the method -(5)
Secondary quantities (stresses and strains) are expressed
in terms of nodal values of primary quantity
History
Hrennikoff [1941] - Lattice of 1D bars
McHenry [1943] - Model 3D solids
Courant [1943] - Variational form
1/25/2012 Numerical Methods 69
Levy [1947, 1953] - Flexibility & Stiffness
Argryis and Kelsey [1954] - Energy Prin. for Matrix
Methods
Turner, Clough, Martin and Topp [1956] - 2D elements
Clough [1960] - Term Finite Elements
Applications
Fluid Flow
Heat Transfer
Structural/Stress Analysis
Electro-Magnetic Fields
Soil Mechanics
Acoustics
1/25/2012 Numerical Methods 70
36
Advantages
Irregular Boundaries
Boundary Conditions Boundary Conditions
Variable Element Size
Easy Modification
Dynamics
Nonlinear Problems (Geometric or
1/25/2012 Numerical Methods 71
Material)
General Loads
Different Materials
Algorithm
Discretize and Select Element Type
Select a Function Representation for U
Define Relationships between U and other physical
elements ( where applicable) elements ( where applicable)
Derive Element Stiffness Matrix & Eqs.
Assemble Equations and Introduce B.C.s
Solve for the Unknown the system (obtain U)
Solve for the other elemnts ( depending on U-where
applicable)
Interpret the Results
1/25/2012 Numerical Methods 72
37
Application -1D advection equation
0 =
c
c
+
c
c
x
U
a
t
U
) , ( 0 .
0
y x w dx w
x
y
c
t
y
L
= |
.
|

\
|
c
c
+
c
c
}

0 .
0
* 1
1
=
|
|
.
|

\
|
c
c
+
A

}

+
+
L
j
i
i n
i
i
n
i
n
i
dx N
x
N
U c
t
U U
0 . .
0 0
* 1 *
1
=
c
c
+
A

} }

+
+
L L
j
i
i n
i j i
i
n
i
n
i
dx N
x
N
U c dx N N
t
U U
1/25/2012 Numerical Methods 73
( )
1
1
1
1
0
1
2
1
+

+
+
+
=
c
c
}

n
j
n
j
L
i
j
i n
i
U U dx N
x
N
U
Application - 1D advection equation
0 =
c
c
+
c
c
x
U
a
t
U
( )
1 1 1
1
+ + +
=
c
}

n n
L
i n
U U dx N
N
U ( )
1 1
0
2
+
=
c
}

j j
i
j i
U U dx N
x
U
j
n
j j
n
j j
n
j j
d y c y b y a = + +
+
+
+ +

1
1
1 1
1
1
2 / 1
+
A
=

x
a
j
j
x x
b
j j
A + A
=
+ 2 / 1 2 / 1
2
1
2 / 1

A
=
+
x
c
j
j
1/25/2012 Numerical Methods 74
1
3
+
At c
a
j
t c
b
j
A
=
3
1
3 At c
c
j
|
|
.
|

\
| A
+
A + A
+
A
A
=
+
+ +

n
j
j n
j
j j n
j
j
j
U
x
U
x x
U
x
t c
d
1
2 / 1 2 / 1 2 / 1
1
2 / 1
6 3 6
2
38
Modeling Considerations
Solve the tridiagonal system [A]Y=B
Symmetry - means correspondence in size, shape and position of U and
boundary conditions that are on opposite sides of a dividing line or
plane;
Use of symmetry allows us to consider a reduced problem instead of the actual
problem.
The order of the total (global) stiffness matrix and the total number of equations can be
reduced.
Solution time is reduced!
Bandwidth - An envelope that begins with the first
nonzero component in each column of the [A] matrix
1/25/2012 Numerical Methods 75
7
4
1
2
2P
L
8
6
5
3
2
1
4
3
5
L
1/25/2012 Numerical Methods 76
3
L L
39
4
1
2
L
P
5
3
2
1
4
3
L
1/25/2012 Numerical Methods 77
3
L L
(
(
(
(
(
(
(

0 0 0 0 X 0 X X X X X 0
0 0 0 0 0 X 0 X X 0 X X
0 0 0 0 0 0 X X 0 X X 0
0 0 0 0 0 0 0 X X X X X
0 0 0 0 0 0 0 0 X 0 X X
(
(
(
(
(
(
(
(
(
(

0 0 X 0 X X 0 0 0 0 0 0
X X 0 X X 0 X 0 0 0 0 0
0 X X X X X X X 0 0 0 0
0 0 X 0 X X 0 X X 0 0 0
0 0 0 X X 0 X X 0 X 0 0
0 0 0 0 X 0 X X X X X 0
1/25/2012 Numerical Methods 78
(
(
(

X 0 0 X 0 0 0 0 0 0 0 0
0 X 0 X X 0 0 0 0 0 0 0
X is a nonzero 2 x 2 block
n
b
40
Bandwidth
n
b
= n
dof
( m + 1 )
Wh Where:
n
b
is the semibandwidth
n
dof
is the number of degrees of freedom per node.
m is the maximum difference in node
numbers for any element.
1/25/2012 Numerical Methods 79
Poor Shapes
b
h
b >> h
|
o
o >> |
Large aspect ratio
Very large and
Large aspect ratio
Very large and
very small corner
angles
41
Poor Shapes
Quadrilateral degenerating
h
1
h
2
h
1
>> h
2
Q g g
into triangular shape
Quadrilateral approaching
triangular shape
Flowchart for a Flowchart for a
Finite Element Program.
1/25/2012 Numerical Methods 82
42
START
Input Data
Zero [K] and {F}
Do JE=1,NELE
Compute element stiffness [k]
Assemble Global stiffness [K] and forces {F}
Apply B.C.s
Solve [K]{d}={f}
Compute element quantities
Output Results
END
INPUT
Control parameters
Number of Elements
Number of Nodes Number of Nodes
Number of B.C.s
Geometry
x,y,z location of each node
Element connectivity (which nodes are
associated with which elements)
1/25/2012 Numerical Methods 84
)
43
INPUT
Element Properties p
Area
Moment of Inertia
Thickness
Location of Neutral Axis
Physical parameters Information
1/25/2012 Numerical Methods 85
Programs
ALGOR
ANSYS ANSYS
COSMOS/M
STARDYNE
IMAGES-3D
MSC/NASTRAN
SAP90
1/25/2012 Numerical Methods 86
SAP90
ADINA
NISA
44
What you should remember
Finite Element Methods (FEMs) seek a
weak solution to the PDEs.
The solution is sought as the sum of a The solution is sought as the sum of a
set of basis or shape functions. Those
can be piecewise linear, or parabolic, etc.
The Galerkin technique uses a weighting
of the solution by functions that are the
same as the shape functions
1/25/2012 Numerical Methods 87
same as the shape functions

Anda mungkin juga menyukai