Uploaded by Ernest kwablah Kweitsu

9 PDEs

advertisement
SOLUTION OF
Partial Differential Equations
(PDEs)
Mathematics is the Language of Science
PDEs are the expression of processes that occur
across time & space: (x,t), (x,y), (x,y,z), or (x,y,z,t)
1
Partial Differential Equations (PDE's)
A PDE is an equation which
includes derivatives of an unknown
function with respect to 2 or more
independent variables
2
Partial Differential Equations (PDE's)
PDE's describe the behavior of many engineering phenomena:
– Wave propagation
– Fluid flow (air or liquid)
Air around wings, helicopter blade, atmosphere
Water in pipes or porous media
Material transport and diffusion in air or water
Weather: large system of coupled PDE's for momentum,
pressure, moisture, heat, …
– Vibration
– Mechanics of solids:
stress-strain in material, machine part, structure
– Heat flow and distribution
– Electric fields and potentials
– Diffusion of chemicals in air or water
– Electromagnetism and quantum mechanics
3
Partial Differential Equations (PDE's)
Weather Prediction
• heat transport & cooling
• advection & dispersion of moisture
• radiation & solar heating
• evaporation
• air (movement, friction, momentum, coriolis forces)
• heat transfer at the surface
To predict weather one need "only" solve a very large systems of
coupled PDE equations for momentum, pressure, moisture, heat,
etc.
4
Modelización Numérica del Tiempo
360x180x32 x nvar
resolución
Conservación de energía, masa,
momento, vapor de agua,
ecuación de estado de gases.
v = (u, v, w), T, p, ρ = 1/α y q
∝ 1/Δt
Duplicar la resolución espacial supone incrementar el tiempo
de cómputo en un factor 16
Condición inicial
H+0
D+0
sábado 15/12/2007 00
H+24
D+1
D+2
D+3
D+4
D+5
5
Partial Differential Equations (PDE's)
Learning Objectives
1) Be able to distinguish between the 3 classes of 2nd order, linear
PDE's. Know the physical problems each class represents and
the physical/mathematical characteristics of each.
2) Be able to describe the differences between finite-difference and
finite-element methods for solving PDEs.
3) Be able to solve Elliptical (Laplace/Poisson) PDEs using finite
differences.
4) Be able to solve Parabolic (Heat/Diffusion) PDEs using finite
differences.
6
Partial Differential Equations (PDE's)
Engrd 241 Focus:
Linear 2nd-Order PDE's of the general form
∂ 2u
∂ 2u
∂ 2u
A 2 +B
+C 2 +D =0
∂x∂y
∂x
∂y
u(x,y), A(x,y), B(x,y), C(x,y), and D(x,y,u,,)
The PDE is nonlinear if A, B or C include u, ∂u/∂x or ∂u/∂y,
or if D is nonlinear in u and/or its first derivatives.
Classification
B2 – 4AC < 0 ––––> Elliptic
(e.g. Laplace Eq.)
B2 – 4AC = 0 ––––> Parabolic
(e.g. Heat Eq.)
B2 – 4AC > 0 ––––> Hyperbolic (e.g. Wave Eq.)
• Each category describes different phenomena.
• Mathematical properties correspond to those phenomena.
7
Partial Differential Equations (PDE's)
Elliptic Equations (B2 – 4AC < 0) [steady-state in time]
• typically characterize steady-state systems (no time derivative)
– temperature
– torsion
– pressure
– membrane displacement
– electrical potential
• closed domain with boundary conditions expressed in terms of
∂u
∂u
(in terms of
∂η
∂x
u(x, y),
and
∂u
)
∂y
Typical examples include
0
⎧
Laplace Eq.
∂ u ∂ u ⎪
∇2u ≡
+
=
∂u ∂u
2
2 ⎨ − D(x, y, u,
, ) Poisson Eq.
∂x
∂y
⎪
∂x ∂y
⎩
2
2
A = 1, B = 0, C = 1
==> B2 – 4AC = – 4 < 0
8
Elliptic PDEs
Boundary Conditions for Elliptic PDE's:
Dirichlet:
u provided along all of edge
Neumann:
∂ u provided along all of the edge (derivative
∂η
in normal direction)
Mixed:
u provided for some of the edge and
∂u
for the remainder of the edge
∂η
Elliptic PDE's are analogous
to Boundary Value ODE's
9
Elliptic PDEs
u(x,y =1) or ∂u/∂y given on boundary
y
u(x=0,y)
or
∂u/∂x
given
on
boundary
Estimate
u(x)
from
Laplace
Equations
u(x=1,y)
or
∂u/∂x
given
on
boundary
u(x,y =0) or ∂u/∂y given on boundary
x
10
Parabolic PDEs
Parabolic Equations (B2 – 4AC = 0) [first derivative in time ]
• variation in both space (x,y) and time, t
• typically provided are:
– initial values:
u(x,y,t = 0)
– boundary conditions:
u(x = xo,y = yo, t) for all t
u(x = xf,y = yf, t) for all t
• all changes are propagated forward in time, i.e., nothing goes
backward in time; changes are propagated across space at
decreasing amplitude.
11
Parabolic PDEs
Parabolic Equations (B2 – 4AC = 0)
[first derivative in time ]
• Typical example: Heat Conduction or Diffusion
(the Advection-Diffusion Equation)
∂u
∂ 2u
∂u
1D :
= k 2 + D(x, u, )
∂t
∂x
∂x
A = k, B = 0, C = 0 –> B2 – 4AC = 0
⎡ ∂ 2u ∂ 2u ⎤
∂u ∂u
∂u
2D :
= k ⎢ 2 + 2 ⎥ + D(x, y, u, , )
∂x ∂y
∂t
∂ y ⎦⎥
⎢⎣ ∂ x
= k ∇2u + D
12
Parabolic PDEs
u(x=0,t)
given
t
on
boundary
for all t
Estimate
u(x,t)
from
the Heat
Equation
u(x=1,t)
given
on
boundary
for all t
u(x,t =0) given on boundary
as initial conditions for ∂u/∂t
x
13
Parabolic PDEs
c(x,t) = concentration
at time, t, and distance, x.
x=0
Δx
x=L
• An elongated reactor with a single entry and exit point
and a uniform cross-section of area A.
• A mass balance is developed for a finite segment Δx
along the tank's longitudinal axis in order to derive a
differential equation for concentration (V = A Δx).
14
Parabolic PDEs
x=0
Δx
x=L
⎡
Δc
∂ c(x) ⎤
∂ c(x)
V
= Q c(x) − Q ⎢c(x) +
Δx ⎥ − D A
Δt
∂x
∂x
⎣
⎦
Flow in
Flow out
Dispersion in
⎡ ∂c(x) ∂ ∂c(x) ⎤
+ DA⎢
+
Δx ⎥ − k V c(x)
∂x ∂x
⎣ ∂x
⎦ Decay
Dispersion out
reaction
As Δt and Δx ==> 0
Δc
∂c
∂ 2c Q ∂c
==>
=D 2 −
− kc
A ∂x
Δt
∂t
∂x
15
Hyperbolic PDEs
Hyperbolic Equations (B2 – 4AC > 0)
[2nd derivative in time ]
• variation in both space (x, y) and time, t
• requires:
– initial values: u(x,y,t=0), ∂u/∂t (x,y,t = 0) "initial velocity"
– boundary conditions:
u(x = xo,y = yo, t) for all t
u(x = xf,y = yf, t) for all t
• all changes are propagated forward in time, i.e., nothing goes
backward in time.
16
Hyperbolic PDEs
[2nd derivative in time]
Hyperbolic Equations (B2 – 4AC > 0)
• Typical example: Wave Equation
1D :
∂ 2u
∂x
2
−
1 ∂ 2u
2
c ∂t
2
+ D(x, y, u,
∂u ∂u
,
∂x ∂t
)=0
A = 1, B = 0, C = -1/c2 ==> B2 – 4AC = 4/c2 > 0
• Models
– vibrating string
– water waves
– voltage change in a wire
17
Hyperbolic PDEs
u(x=0,t)
given
t
on
boundary
for all t
Estimate
u(x,t)
from
the Wave
Equation
u(x=1,t)
given
on
boundary
for all t
x
u(x,t =0) and ∂u(x,t=0)/∂t
given on boundary
as initial conditions for ∂2u/∂t2
Now PDE is second order in time
18
Numerical Methods for Solving PDEs
Numerical methods for solving different types of PDE's reflect the different
character of the problems.
• Laplace - solve all at once for steady state conditions
• Parabolic (heat) and Hyperbolic (wave) equations.
Integrate initial conditions forward through time.
Methods
• Finite Difference (FD) Approaches (C&C Chs. 29 & 30)
•
Based on approximating solution at a finite # of points, usually
arranged in a regular grid.
Finite Element (FE) Method (C&C Ch. 31)
Based on approximating solution on an assemblage of simply shaped
(triangular, quadrilateral) finite pieces or "elements" which together
make up (perhaps complexly shaped) domain.
In this course, we concentrate on FD
applied to elliptic and parabolic equations.
19
Finite Difference for Solving Elliptic PDE's
Solving Elliptic PDE's:
• Solve all at once
• Liebmann Method:
– Based on Boundary Conditions (BCs) and finite
difference approximation to formulate system of
equations
– Use Gauss-Seidel to solve the system
0
Laplace Eq.
⎧
∂ u ∂ u ⎪
∂u ∂u
+
=
⎨
− D(x, y, u, , ) Poisson Eq.
2
2
∂x
∂y
⎪⎩
∂x ∂y
2
2
20
Finite Difference Methods for Solving Elliptic PDE's
1. Discretize domain into grid of evenly spaced points
2. For nodes where u is unknown:
∂ 2u
∂ x2
∂ 2u
∂ y2
=
=
u i −1, j − 2u i, j + u i +1, j
( Δx ) 2
u i, j−1 − 2u i, j + u i, j+1
(Δ y) 2
+ O( Δ x 2 )
+ O( Δ y 2 )
w/ Δ x = Δ y = h, substitute into main equation
2
∂ u
∂x
2
+
2
∂ u
∂y
2
=
u i −1, j + u i +1, j + u i, j−1 + u i, j+1 − 4u i, j
h
2
+ O(h 2 )
3. Using Boundary Conditions, write, n*m equations for
u(xi=1:m, yj=1:n) or n*m unknowns.
4. Solve this banded system with an efficient scheme. Using
Gauss-Seidel iteratively yields the Liebmann Method.
21
Elliptical PDEs
The Laplace Equation
The Laplace molecule
∂
2
u
∂x
2
+
2
u
∂y
2
∂
=0
j+1
j
j-1
If Δx = Δy then
i-1
i
i+1
Ti+1, j + Ti−1, j + Ti, j+1 + Ti, j−1 − 4Ti, j = 0
22
Elliptical PDEs
The Laplace molecule: Ti+1, j + Ti−1, j + Ti, j+1 + Ti, j−1 − 4Ti, j = 0
T = 100o C
T = 0o C
1,1
1,2
1,3
2,1
2,2
2,3
3,1
3,2
3,3
The temperature distribution
can be estimated by discretizing
the Laplace equation at 9 points
and solving the system of linear
equations.
T = 100o C
T = 0o C
T11
T12
T13
T21
T22
⎡-4
⎢1
⎢
⎢0
⎢1
⎢0
⎢0
⎢
⎢0
⎢0
⎢⎣ 0
1
-4
1
0
1
0
0
0
0
0
1
-4
0
0
1
0
0
0
1
0
0
-4
1
0
1
0
0
0
1
0
1
-4
1
0
1
0
T23
0
0
1
0
1
-4
0
0
1
T31
0
0
0
1
0
0
-4
1
0
T32
0
0
0
0
1
0
1
-4
1
T33
⎧
⎫
0 ⎤⎥ ⎧⎪ T11 ⎫⎪ ⎪-100 ⎪
0 ⎥ ⎪ T12 ⎪ ⎪-100 ⎪
0 ⎥ ⎪ T13 ⎪ ⎪-200 ⎪
0 ⎥ ⎪⎪ T21 ⎪⎪ ⎪⎪ 0 ⎪⎪
0 ⎥ ⎨T22 ⎬ = ⎨ 0 ⎬
1 ⎥⎥ ⎪T23 ⎪ ⎪-100 ⎪
0 ⎥ ⎪⎪ T31 ⎪⎪ ⎪⎪ 0 ⎪⎪
1 ⎥ ⎪T32 ⎪ ⎪ 0 ⎪
-4⎥⎦ ⎪⎩T33 ⎪⎭ ⎪-100 ⎪
⎩
⎭
Excel
23
Solution of Elliptic PDE's: Additional Factors
• Primary (solve for first):
u(x,y) = T(x,y) = temperature distribution
• Secondary (solve for second):
∂T
∂T
and q y = − k ′
heat flux: q x = −k ′
∂x
∂y
obtain by employing:
∂ T Ti+1, j − Ti−1, j
∂ T Ti, j+1 − Ti, j−1
≈
≈
∂x
∂y
2Δx
2Δy
then obtain resultant flux and direction:
⎛ qy ⎞
2
2
−
1
qn = qx + q y
θ = tan ⎜ ⎟
qx > 0
⎝ qx ⎠
−1 ⎛ q y ⎞
θ = tan ⎜ ⎟ + π
qx < 0
⎝ qx ⎠
(with θ in radians)
24
Elliptical PDEs: additional factors
T = 100o C
50.0 71.4 85.7
T = 0o C
28.6
50
14.3 28.6
T = 0o C
71.4
50
T = 100o C
Ti +1, j − Ti−1, j
∂T
≈ −k′
q x = −k′
∂x
2Δx
Ti, j+1 − Ti, j−1
∂T
≈ −k′
q y = −k′
∂y
2Δy
k' = 0.49 cal/s⋅cm⋅°C
At point 2,1 (middle left):
qx ~ -0.49 (50-0)/(2⋅10cm) = -1.225 cal/(cm2⋅s)
qy ~ -0.49 (50-14.3)/(2⋅10cm) = -0.875cal/(cm2⋅s)
q n = q x 2 + q y 2 = 1.2252 + 0.8752 = 1.851 cal /(cm 2 ⋅ s)
−1 ⎛ q y
⎞
−1 ⎛ −0.875 ⎞
o
o
o
θ = tan ⎜ ⎟ = tan ⎜
=
+
=
35.5
180
215.5
⎟
⎝ −1.225 ⎠
⎝ qx ⎠
25
Solution of Elliptic PDE's: Additional Factors
Neumann Boundary Conditions (derivatives at edges)
– employ phantom points outside of domain
– use FD to obtain information at phantom point,
T1,j + T-1,j + T0,j+1 + T0,j-1 – 4T0,j = 0 [*]
If given
∂T
∂x
then use
to obtain
∂ T T1, j − Ti −1, j
=
∂x
2Δ x
T−1, j = T1, j − 2 Δ x
Substituting [*]: 2T1, j − 2 Δ x
∂T
∂x
∂T
+ T0, j+1 + T0, j−1 − 4 T0, j = 0
∂x
Irregular boundaries
• use unevenly spaced molecules close to edge
• use finer mesh
26
Elliptical PDEs: Derivative Boundary Conditions
The Laplace molecule: Ti+1, j + Ti−1, j + Ti, j+1 + Ti, j−1 − 4Ti, j = 0
T = 100o C
T = 75o C
1,1
1,2
1,3
2,1
2,2
2,3
3,1
3,2
3,3
Derivative (Neumann) BC at (4,1):
∂T T3,1 - T5,1
=
∂y
2Δy
T = 50o C
∂T
T5,1 = T3,1 − 2Δy
∂y
Insulated ==> ∂T/ ∂y = 0
Substitute into:
T4,2 + T4,0 + T3,1 + T5,1 − 4T4,1 = 0
To obtain:
∂T
T4,2 − T4,0 + 2T3,1 − 2Δy
− 4T4,1 = 0
∂y
0
27
Parabolic PDE's: Finite Difference Solution
Solution of Parabolic PDE's by FD Method
• use B.C.'s and finite difference approximations to formulate
the model
• integrate I.C.'s forward through time
• for parabolic systems we will investigate:
– explicit schemes & stability criteria
– implicit schemes
- Simple Implicit
- Crank-Nicolson (CN)
- Alternating Direction (A.D.I), 2D-space
28
Parabolic PDE's: Heat Equation
Prototype problem, Heat Equation (C&C 30.1):
1D
∂T
∂ 2T
=k 2
∂t
∂x
Find T(x,t)
⎛ ∂ 2T ∂ 2T ⎞
∂T
2D
= k⎜ 2 + 2 ⎟
Find T(x,y,t)
⎜
⎟
∂t
∂y ⎠
⎝∂x
Given the initial temperature distribution
as well as boundary temperatures with
k'
= Coefficient of thermal diffusivity
k=
Cρ
⎧⎪k' = coefficient of thermal conductivity
where: ⎨C = heat capacity
⎪⎩ ρ = density
29
Parabolic PDE's: Finite Difference Solution
Solution of Parabolic PDE's by FD Method
1. Discretize the domain into a grid of evenly spaces points
(nodes)
2. Express the derivatives in terms of Finite Difference
Approximations of O(h2) and O(Δt) [or order O(Δt2)]
∂ 2T
∂ 2T
∂x 2
∂ y2
∂T
∂t
Finite
Differences
3. Choose h = Δx = Δy, and Δt and use the I.C.'s and B.C.'s
to solve the problem by systematically moving ahead in
time.
30
Parabolic PDE's: Finite Difference Solution
Time derivative:
• Explicit Schemes (C&C 30.2)
Express all future (t + Δt) values, T(x, t + Δt), in
terms of current (t) and previous (t - Δt)
information, which is known.
• Implicit Schemes (C&C 30.3 -- 30.4)
Express all future (t + Δt) values, T(x, t + Δt), in
terms of other future (t + Δt), current (t), and
sometimes previous (t - Δt) information.
31
Parabolic PDE's: Notation
Notation:
Use subscript(s) to indicate spatial points.
Use superscript to indicate time level: Tim+1 = T(xi, tm+1)
Express a future state, Tim+1, only in terms of the present state, Tim
∂T
∂2T
1-D Heat Equation:
=k
∂t
∂x 2
∂ 2 T Tim−1 − 2Tim + Tim+1
2
=
+
O(
Δ
x)
Centered FDD
2
2
∂x
(Δx)
∂ T Tim+1 − Tim
=
+ O(Δt)
Forward FDD
∂t
Δt
Solving for Tim+1 results in:
Tim +1 = Tim + λ(Ti-1m − 2Tim + Ti+1m)
with λ = k Δt /(Δx)2
Tim +1 = (1-2λ) Tim + λ (Ti-1m + Ti+1m )
32
Parabolic PDE's: Explicit method
t = 6 10
10
t = 5 10
10
t = 4 10
10
t = 3 10
10
t = 2 10
10
t=1
t=0
10
10
10
10
15
20
15
10
Initial temperature
10
10
33
Parabolic PDE's: Example - explicit method
∂T
∂2T
=k
Example: The 1-D Heat Equation
∂t
∂x 2
100° C
I.C.'s: T(0 < x < 10, t = 0) = 0°
B.C.'s: T(x = 0, all t) = 100°
T(x = 10, all t) = 50°
with λ = k Δt / (Δx)2 = 0.262
Tim +1 = Tim + λ
(
Tim−1 − 2Tim + Tim+1
t
X=0
t
Heat Eqn.
Example
0° C
50° C
k = 0.82 cal/s·cm·oC, 10-cm long rod,
Δt = 2 secs, Δx = 2.5 cm (# segs. = 4)
X = 10 cm
)
34
Parabolic PDE's: Example - explicit method
∂T
∂2T
=k
Example: The 1-D Heat Equation
∂t
∂x 2
Tim +1 = Tim + λ Tim−1 − 2Tim + Tim+1
(
)
Starting at t = 0 secs. (m = 0), find results at t = 2 secs. (m = 1):
T11 = T10 + λ(T00 +T10 +T20 ) = 0 + 0.262[100–2(0)+0] = 26.2°
T21 = T20 + λ(T10 +T20 +T30 ) = 0 + 0.262[0–2(0)+0] = 0°
T31 = T30 + λ(T20 +T30 +T40 ) = 0 + 0.262[0–2(0)+50] = 13.1°
From t = 2 secs. (m = 1), find results at t = 4 secs. (m = 2):
T12 = T11 + λ(T01 +T11 +T21 ) = 26.2+0.262[100–2(26.2)+0] = 38.7°
T22 = T21 + λ(T11 +T21 +T31 ) = 0+0.262[26.2–2(0)+13.1] = 10.3°
T32 = T31 + λ(T21 +T31 +T41 ) =13.1 + 0.262[0–2(13.1)+50] = 19.3°
35
Parabolic PDE's: Explicit method
t=6
t=4
t=2
Left
Bndry
100°C
26.2°
0°
13.1°
Right
Bndry
50°C
t=0
0 °C
Initial temperature
T11 = T10 + λ(T00 – 2T10 +T20 ) = 0 + 0.262[100–2(0)+0] = 26.2°
T21 = T20 + λ(T10 – 2T20 +T30 ) = 0 + 0.262[0–2(0)+0] = 0°
T31 = T30 + λ(T20 – 2T30 +T40 ) = 0 + 0.262[0–2(0)+50] = 13.1°
36
Parabolic PDE's: Explicit method
t=6
t=4
t=2
Left
Bndry
100°C
38.7° 10.3° 19.3°
26.2°
0°
13.1°
Right
Bndry
50°C
t=0
0 °C
Initial temperature
T12 = T11 + λ(T01 – 2T11 +T21 ) = 26.2 + 0.262[100–2(26.2)+0] = 38.7°
T22 = T21 + λ(T11 – 2T21 +T31 ) = 0 + 0.262[26.2–2(0)+13.1] = 10.3°
T32 = T31 + λ(T21 – 2T31 +T41 ) = 13.1 + 0.262[0–2(13.1)+50] = 19.3°
37
Parabolic PDE's: Stability
We will cover stability in more detail later, but we will show that:
The Explicit Method is Conditionally Stable :
For the 1-D spatial problem, the following is the stability condition:
1
(Δx) 2
λ=
≤
or
Δt ≤
2
2
2k
(Δx)
λ ≤ 1/2
can still yield oscillation (1D)
λ ≤ 1/4
ensures no oscillation (1D)
λ = 1/6
tends to optimize truncation error
kΔt
We will also see that the Implicit Methods are unconditionally
stable.
Excel: Explicit
38
Parabolic PDE's: Explicit Schemes
Summary: Solution of Parabolic PDE's by Explicit Schemes
Advantages: very easy calculations,
simply step ahead
Disadvantage: – low accuracy, O (Δt)
accurate with respect to time
– subject to instability; must use "small" Δt's
Î requires many steps !!!
39
Parabolic PDE's: Implicit Schemes
Implicit Schemes for Parabolic PDEs
• Express Tim+1 terms of Tjm+1, Tim, and possibly also Tjm
(in which j = i – 1 and i+1 )
• Represents spatial and time domain. For each new time,
write m (# of interior nodes) equations and simultaneously
solve for m unknown values (banded system).
40
The 1-D Heat Equation:
∂T
∂2T
=k
∂t
∂x 2
Simple Implicit Method. Substituting:
∂2T
∂x
2
=
Tim−1+1 − 2Tim+1 + Tim+1+1
(Δx)
2
+ O(Δx) 2
∂ T Tim+1 − Tim
=
+ O(Δt)
∂t
Δt
Centered FDD
Backward FDD
results in: −λTim−1+1 + (1 + 2λ )Tim +1 − λTim+1+1 = Tim
with λ = k
Δt
(Δx) 2
1. Requires I.C.'s for case where m = 0: i.e., Ti0 is given for all i.
2. Requires B.C.'s to write expressions @ 1st and last interior
nodes (i=0 and n+1) for all m.
41
Parabolic PDE's: Simple Implicit Method
t = 6 10
10
t = 5 10
10
t = 4 10
10
t = 3 10
10
t = 2 10
10
t=1
t=0
10
10
10
10
15
20
15
10
Initial temperature
10
10
42
Parabolic PDE's: Simple Implicit Method
Explicit Method
m+1
(
Tim +1 = Tim + λ Tim+1 − 2Tim + Tim−1
m
i-1
i
)
i+1
Simple Implicit Method
m +1
Tim = −λTim−1+1 + (1 + 2λ ) Tim +1 − λTim+1+1
m
i-1
i
i+1
with λ = k
Δt
(Δx)
2
for both
43
Parabolic PDE's: Simple Implicit Method
t=6
t=4
t=2
Right
Bndry
50°C
Left
Bndry
100°C
t=0
0 °C
Initial temperature
At the Left boundary:
(1+2λ)T1m+1 - λT2m+1 = T1m + λ T0m+1
Away from boundary: -λTi-1m+1 + (1+2λ)Tim+1 - λTi+1m+1 = Tim
At the Right boundary: (1+2λ)Tim+1 - λTi-1m+1 = Tim + λ Ti+1m+1
44
Parabolic PDE's: Simple Implicit Method
m = 3; t = 6
Left
Bndry
m = 1; t = 2 100°C
m = 2; t = 4
T11
m = 0; t = 0
Let λ = 0.4
T21
T31
0 °C
Initial temperature
T41
Right
Bndry
50°C
⎧ 1⎫
0 ⎤ ⎪ T1 ⎪ ⎧40 ⎫
⎡ 1.8 -0.4 0
⎢-0.4 1.8 -0.4 0 ⎥ ⎪T 1 ⎪ ⎪ 0 ⎪
⎢
⎥ ⎪⎨ 2 ⎪⎬ = ⎪⎨ ⎪⎬
⎢ 0 -0.4 1.8 -0.4 ⎥ ⎪T 1 ⎪ ⎪ 0 ⎪
⎢
⎥⎪ 3 ⎪ ⎪ ⎪
0
0
-0.4
1.8
⎣
⎦ ⎪T 1 ⎪ ⎩20 ⎭
⎩ 4 ⎭
⎧ T11 ⎫
⎪ ⎪ ⎧27.6 ⎫
⎪⎪T21 ⎪⎪ ⎪⎪6.14 ⎪⎪
⎨ 1⎬ = ⎨
⎬
⎪T3 ⎪ ⎪4.03 ⎪
⎪ 1 ⎪ ⎪⎩12.0 ⎪⎭
⎩⎪T4 ⎭⎪
At the Left boundary: (1+2λ)T11 - λT21 = T10 + λT01
1.8 T11 – 0.4 T21 = 0 + 0.8*100 =
Away from boundary:
-λTi-11 + (1+2λ)Ti1 – λTi+11 = Ti0
-0.4 T11 + 1.8 T21 – 0.4 T31 = 0 =
-0.4 T21 + 1.8 T31 – 0.4 T41 = 0 =
At the Right boundary: (1+2λ)T31 – λT21 = T30 + λT41
1.8 Tim+1 – 0.4 Ti-1m+1 = 0 + 0.4*50) =
40
0
0
20
45
Parabolic PDE's: Simple Implicit Method
m = 3; t = 6
Left
Bndry
m = 1; t = 2 100°C
m = 2; t = 4
T12
m = 0; t = 0
Let λ = 0.4
23.6
T22
6.14
T3
1
4.03
0 °C
Initial temperature
T4
1
12.0
Right
Bndry
50°C
⎧ 2⎫
0 ⎤ ⎪ T1 ⎪ ⎧78.5 ⎫
⎡ 1.8 -0.4 0
⎢-0.4 1.8 -0.4 0 ⎥ ⎪T 2 ⎪ ⎪6.14 ⎪
⎪
⎢
⎥ ⎪⎨ 2 ⎪⎬ = ⎪⎨
⎬
⎢ 0 -0.4 1.8 -0.4 ⎥ ⎪T 2 ⎪ ⎪4.03 ⎪
⎢
⎥⎪ 3 ⎪ ⎪
0 -0.4 1.8 ⎦
32.0 ⎪⎭
2
⎣ 0
⎪⎩T4 ⎪⎭ ⎩
⎧ T12 ⎫
⎪
⎪ ⎧38.5 ⎫
⎪⎪T22 ⎪⎪ ⎪⎪14.1 ⎪⎪
⎨ 2⎬= ⎨
⎬
⎪T3 ⎪ ⎪9.83 ⎪
⎪ 2 ⎪ ⎪⎩20.0 ⎪⎭
⎪⎩T4 ⎪⎭
2
At the Left boundary: (1+2λ)T12 - λT22 = T11 + λT0
1.8 T12 – 0.4 T22 = 23.6+ 0.4*100 =
Away from boundary:
-λTi-12 + (1+2λ)Ti2 – λTi+12 = Ti1
-0.4*T12+ 1.8*T22 – 0.4*T32 = 6.14 =
-0.4*T22 + 1.8*T32 – 0.4*T42 = 4.03 =
At the Right boundary: (1+2λ)T32 – λT42 = T31 + λT42
1.8*T32 – 0.4*T42 = 12.0 + 0.4*50 =
Excel: Implicit
78.5
6.14
4.03
32.0
46
Parabolic PDE's: Crank-Nicolson Method
Implicit Schemes for Parabolic PDEs
Crank-Nicolson (CN) Method (Implicit Method)
Provides 2nd-order accuracy in both space and time.
Average the 2nd-derivative in space for tm+1 and tm.
∂2T
∂x 2
1 ⎡ Tim−1 − 2Tim + Tim+1 Tim−1+1 − 2Tim+1 + Tim+1+1 ⎤
2
O(
x)
= ⎢
+
+
Δ
⎥
2
2
2 ⎢⎣
(Δx)
(Δx)
⎥⎦
∂ T Tim+1 − Tim
=
+ O(Δt 2 )
∂t
Δt
(central difference in time now)
−λTim−1+1 + 2(1 + λ )Tim +1 − λTim+1+1 = λTim−1 + 2(1 − λ)Tim − λTim+1
Requires I.C.'s for case where m = 0: Ti0 = given value, f(x)
Requires B.C.'s in order to write expression for T0m+1 & Ti+1m+1
47
Parabolic PDE's: Crank-Nicolson Method
xi-1
tm+1
tm+1/2
tm
xi
xi+1
Left
Bndry
100°C
Right
Bndry
50°C
0 °C
Initial temperature
−λTim−1+1 + 2(1 + λ )Tim +1 − λTim+1+1 = λTim−1 + 2(1 − λ)Tim − λTim+1
Crank-Nicolson
48
Parabolic PDE's: Implicit Schemes
Summary: Solution of Parabolic PDE's by Implicit Schemes
Advantages:
• Unconditionally stable.
• Δt choice governed by overall accuracy.
[Error for CN is O(Δt2) ]
• May be able to take larger Δt Î fewer steps
Disadvantages:
• More difficult calculations,
especially for 2D and 3D spatially
• For 1D spatially, effort ≈ same as explicit
because system is tridiagonal.
49
Stability Analysis of Numerical Solution to Heat Eq.
Consider the classical solution of the Heat Equation:
∂T
∂ 2T
=k 2
∂t
∂x
To find the form of the solutions, try:
T(x, t) = e − at sin(ωx)
Substituting this into the Heat Equation yields:
- a T(x,t) = - k ω2 T(x,t)
OR
a = k ω2
⇒ T(x, t) = e
− kω2 t
sin(ωx)
Each sin component of the initial temperature distribution
decays as
exp{- k ω2 t)
50
Stability Analysis
Consider FD schemes as advancing one step with a
"transition equation":
{Tm+1} = [A] {Tm}
with
{ }
with [A] a function of λ = k Δt / (Δx)2
Tm = ⎢T1m ,T2m ,L ,Tim ,L ,Tnm ⎥ T
⎣
⎦
with zero boundary conditions
First step can be written:
{T1} = [A] {T0}
w/ {T0} = initial conditions
Second step as:
{T2} = [A] {T1} = [A]2{T0}
and mth step as:
{Tm } = [A] {Tm-1} = [A]m{T0}
(Here "m" is an exponent on [A])
51
Stability Analysis
{Tm } = [A]m{T0}
• For the influence of the initial conditions and any rounding
errors in the IC (or rounding or truncation errors introduced
in the transition process) to decay with time, it must be the
case that || A || < 1.0
• If || A || > 1.0, some eigenvectors of the matrix [A] can grow
without bound generating ridiculous results. In such cases
the method is said to be unstable.
• Taking r = || A || = || A ||2 = maximum eigenvalue of [A] for
symmetric A (the "spectral norm"), the maximum
eigenvalue describes the stability of the method.
52
Stability Analysis
Illustration of Instability of Explicit Method (for a simple case)
Consider 1D spatial case: Tim+1 = λTi-1m + (1- 2λ)Tim + λTi+1m
Worst case solution: Tim = r m(-1) i
(high frequency x-oscillations
in index i)
Substitution of this solution into the difference equation yields:
r m+1 (-1) i = λ r m (-1) i-1 + (1-2λ) r m (-1) i + λ r m (-1) i+1
r = λ (-1) -1 + (1-2λ) + λ (-1) +1
or
r=1–4λ
If initial conditions are to decay and nothing “explodes,” we need:
–1 < r < 1 or
0 < λ < 1/2.
For no oscillations we want:
0< r <1
or
0 < λ < 1/4.
53
Stability of the Simple Implicit Method
Consider 1D spatial:
Worst case solution:
+1
m+1
m+1
m
−λTim
+
(1
+
2
λ
)T
−
λ
T
=
T
i
i +1
i
−1
i
Tim = r m ( −1)
Substitution of this solution into difference equation yields:
i −1
−λr m+1 ( −1)
i
i +1
+ (1 − 2λ ) r m+1 ( −1) − λr m+1 ( −1)
i
= r m ( −1)
r [–λ (–1)–1 + (1 + 2λ) – λ (–1)+1] = 1
or
r = 1/[1 + 4 λ]
i.e.,
0 < r < 1 for all λ > 0
54
Stability of the Crank-Nicolson Implicit Method
Consider:
+1
m+1
m+1
m
m
m
−λTim
+
2(1
+
λ
)T
−
λ
T
=
λ
T
+
2(1
−
λ
)T
+
λ
T
−1
i
i+1
i−1
i
i+1
Worst case solution:
i
Tim = r m ( −1)
Substitution of this solution into difference equation yields:
i −1
−λr m+1 ( −1)
i +1
i
+ 2 (1 + λ ) r m+1 ( −1) − λr m+1 ( −1)
λr
m
i −1
( −1)
+ 2 (1 − λ ) r
m
=
i
( −1)
+ λr
m
i +1
( −1)
r [–λ (–1)–1 + 2(1 + λ) – λ (–1)+1] = λ (–1)–1 + 2(1 – λ) + λ (–1)+1
or
r = [1 – 2 λ ] / [1 + 2 λ]
i.e.,
| r | < 1 for all λ > 0
55
Stability Summary, Parabolic Heat Equation
Roots for Stability Analysis of Parabolic Heat Eq.
1.00
r(explicit)
r(implicit)
r(C-N)
analytical
0.50
r
0.00
0
0.25
0.5
0.75
1
1.25
-0.50
-1.00
λ
56
Parabolic PDE's: Stability
Implicit Methods are Unconditionally Stable :
Magnitude of all eigenvalues of [A] is < 1 for all values of λ.
Î Δx and Δt can be selected solely to control the overall accuracy.
Explicit Method is Conditionally Stable :
kΔt
1
(Δx) 2
≤
or Δt ≤
Explicit, 1-D Spatial: λ =
2
2
2k
(Δx)
λ ≤ 1/2
can still yield oscillation (1D)
λ ≤ 1/4
ensures no oscillation (1D)
λ = 1/6
tends to optimize truncation error
Explicit, 2-D Spatial:
λ=
kΔt
h2
1
≤
4
h2
or Δt ≤
4k
(h = Δx = Δy)
57
Parabolic PDE's in Two Spatial dimension
2D
⎛ ∂ 2T ∂ 2T ⎞
∂T
= k⎜ 2 + 2 ⎟
⎜∂x
∂t
∂ y ⎟⎠
⎝
Explicit solutions :
Stability criterion
Find T(x,y,t)
(Δx) 2 + (Δy)2
Δt ≤
8k
if h = Δx = Δy ==>
λ=
kΔt
h
2
1
≤
4
or
h2
Δt ≤
4k
Implicit solutions : No longer tridiagonal
58
Parabolic PDE's: ADI method
Alternating-Direction Implicit (ADI) Method
• Provides a method for using tridiagonal matrices for solving
parabolic equations in 2 spatial dimensions.
• Each time increment is implemented in two steps:
first direction
second direction
59
Parabolic PDE's: ADI method
• Provides a method for using tridiagonal matrices for solving
parabolic equations in 2 spatial dimensions.
• Each time increment is implemented in two steps:
tγ+1
Explicit
Implicit
yi+1
yi
yi-1
xi-1
yi+1
yi
yi-1
xi-1
tγ+1/2
xi
xi+1
tγ
xi
xi+1
first half-step
second half-step
ADI example
60
Download