Professional Documents
Culture Documents
9 PDEs
9 PDEs
(PDEs)
1
Partial Differential Equations (PDE's)
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
4
Modelización Numérica del Tiempo
Learning Objectives
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 ∂x∂y ∂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 ∂u
u(x, y), (in terms of and )
∂η ∂x ∂y
Typical examples include
2 2 ⎧ 0
∂ u ∂ u ⎪ Laplace Eq.
∇2u ≡ 2
+ =
2 ⎨ − D(x, y, u,
∂u ∂u
∂x ∂y ⎪ , ) Poisson Eq.
⎩ ∂x ∂y
8
Elliptic PDEs
Boundary Conditions for Elliptic PDE's:
9
Elliptic PDEs
u(x,y =1) or ∂u/∂y given on boundary
Estimate
u(x=0,y) u(x=1,y)
u(x)
or or
y ∂u/∂x from ∂u/∂x
given Laplace given
on Equations on
boundary boundary
10
Parabolic PDEs
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
∂u ⎡ ∂ 2u ∂ 2u ⎤ ∂u ∂u
2D : = k ⎢ 2 + 2 ⎥ + D(x, y, u, , )
∂t ⎢⎣ ∂ x ∂ y ⎦⎥ ∂x ∂y
= k ∇2u + D
12
Parabolic PDEs
Estimate
u(x=0,t) u(x=1,t)
u(x,t)
given given
t from on
on
boundary the Heat boundary
for all t Equation for all t
13
Parabolic PDEs
c(x,t) = concentration
at time, t, and distance, x.
x=0 Δx x=L
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
Δc ∂c ∂ 2c Q ∂c
As Δt and Δx ==> 0 ==> =D 2 − − kc
Δt ∂t ∂x A ∂x
15
Hyperbolic PDEs
16
Hyperbolic PDEs
Hyperbolic Equations (B2 – 4AC > 0) [2nd derivative in time]
• Models
– vibrating string
– water waves
– voltage change in a wire
17
Hyperbolic PDEs
Estimate
u(x=0,t) u(x=1,t)
u(x,t)
given given
t from on
on
boundary the Wave boundary
for all t Equation 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
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 u i −1, j − 2u i, j + u i +1, j
= + O( Δ x 2 )
∂ x2 ( Δx ) 2
∂ 2u u i, j−1 − 2u i, j + u i, j+1
= + O( Δ y 2 )
∂ y2 (Δ y) 2
w/ Δ x = Δ y = h, substitute into main equation
2 2
∂ u ∂ u u i −1, j + u i +1, j + u i, j−1 + u i, j+1 − 4u i, j
2
+ 2
= 2
+ O(h 2 )
∂x ∂y h
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
2 2
∂ u ∂ u
The Laplace Equation 2
+ 2
=0
∂x ∂y
j-1
i-1 i i+1
22
Elliptical PDEs
The Laplace molecule: Ti+1, j + Ti−1, j + Ti, j+1 + Ti, j−1 − 4Ti, j = 0
T = 100o C
The temperature distribution
1,1 1,2 1,3 can be estimated by discretizing
T = 0o C
2,1 2,2 2,3
T = 100o C the Laplace equation at 9 points
3,1 3,2 3,3
and solving the system of linear
equations.
T = 0o C
T11 T12 T13 T21 T22 T23 T31 T32 T33
⎧ ⎫
⎡-4 1 0 1 0 0 0 0 0 ⎤⎥ ⎧⎪ T11 ⎫⎪ ⎪-100 ⎪
⎢1
⎢ -4 1 0 1 0 0 0 0 ⎥ ⎪ T12 ⎪ ⎪-100 ⎪
⎢0 1 -4 0 0 1 0 0 0 ⎥ ⎪ T13 ⎪ ⎪-200 ⎪
⎢1 0 0 -4 1 0 1 0 0 ⎥ ⎪⎪ T21 ⎪⎪ ⎪⎪ 0 ⎪⎪
⎢0 1 0 1 -4 1 0 1 0 ⎥ ⎨T22 ⎬ = ⎨ 0 ⎬
⎢0 0 1 0 1 -4 0 0 1 ⎥⎥ ⎪T23 ⎪ ⎪-100 ⎪
⎢
⎢0 0 0 1 0 0 -4 1 0 ⎥ ⎪⎪ T31 ⎪⎪ ⎪⎪ 0 ⎪⎪
⎢0 0 0 0 1 0 1 -4 1 ⎥ ⎪T32 ⎪ ⎪ 0 ⎪
⎢⎣ 0 0 0 0 0 1 0 1 -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
heat flux: q x = −k ′ and q y = − k ′
∂x ∂y
obtain by employing:
∂ T Ti+1, j − Ti−1, j ∂ T Ti, j+1 − Ti, j−1
≈ ≈
∂x 2Δx ∂y 2Δy
then obtain resultant flux and direction:
2 2 − ⎛ qy ⎞
qn = qx + q y 1
θ = tan ⎜ ⎟ qx > 0
⎝ qx ⎠
−1 ⎛ q y ⎞
θ = tan ⎜ ⎟ + π qx < 0
⎝ qx ⎠
(with θ in radians) 24
Elliptical PDEs: additional factors
T = 100o C ∂T Ti +1, j − Ti−1, j
q x = −k′ ≈ −k′
∂x 2Δx
50.0 71.4 85.7
∂T Ti, j+1 − Ti, j−1
T = 0o C T = 100o C q y = −k′ ≈ −k′
28.6 50 71.4
∂y 2Δy
14.3 28.6 50
k' = 0.49 cal/s⋅cm⋅°C
T = 0o C
−1 ⎛ q y
⎞ −1 ⎛ −0.875 ⎞ o o o
θ = tan ⎜ ⎟ = tan ⎜ ⎟ = 35.5 + 180 = 215.5
⎝ qx ⎠ ⎝ −1.225 ⎠
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
then use ∂ T T1, j − Ti −1, j
=
∂x ∂x 2Δ x
∂T
to obtain T−1, j = T1, j − 2 Δ x
∂x
∂T
Substituting [*]: 2T1, j − 2 Δ x + 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
Derivative (Neumann) BC at (4,1):
1,1 1,2 1,3 ∂T T3,1 - T5,1
=
T = 75o C
2,1 2,2 2,3
T = 50o C ∂y 2Δy
3,1 3,2 3,3 ∂T
T5,1 = T3,1 − 2Δy
Insulated ==> ∂T/ ∂y = 0 ∂y
28
Parabolic PDE's: Heat Equation
Prototype problem, Heat Equation (C&C 30.1):
∂T ∂ 2T
1D =k 2 Find T(x,t)
∂t ∂x
∂T ⎛ ∂ 2T ∂ 2T ⎞
2D = k⎜ 2 + 2 ⎟ Find T(x,y,t)
∂t ⎜ ⎟
⎝∂x ∂y ⎠
Given the initial temperature distribution
as well as boundary temperatures with
k'
k= = Coefficient of thermal diffusivity
Cρ
⎧⎪k' = coefficient of thermal conductivity
where: ⎨C = heat capacity
⎪⎩ ρ = density
29
Parabolic PDE's: Finite Difference Solution
∂ 2T ∂ 2T ∂T Finite
∂x 2 ∂ y2 ∂t Differences
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
2
= 2
+ O( Δ x) Centered FDD
∂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
10 10
t=0
10 10 15 20 15 10 10 10
Initial temperature
33
Parabolic PDE's: Example - explicit method
∂T ∂2T
Example: The 1-D Heat Equation =k
∂t ∂x 2
k = 0.82 cal/s·cm·oC, 10-cm long rod,
t
Δt = 2 secs, Δx = 2.5 cm (# segs. = 4) t
100° C
B.C.'s: T(x = 0, all t) = 100°
50° C
T(x = 10, all t) = 50°
34
Parabolic PDE's: Example - explicit method
∂T ∂2T
Example: The 1-D Heat Equation =k
∂t ∂x 2
( )
Tim +1 = Tim + λ Tim−1 − 2Tim + Tim+1
35
Parabolic PDE's: Explicit method
t=6
36
Parabolic PDE's: Explicit method
t=6
37
Parabolic PDE's: Stability
We will cover stability in more detail later, but we will show that:
39
Parabolic PDE's: Implicit Schemes
40
∂T ∂2T
The 1-D Heat Equation: =k
∂t ∂x 2
t = 5 10 10
t = 4 10 10
t = 3 10 10
t = 2 10 10
t=1
10 10
t=0
10 10 15 20 15 10 10 10
Initial temperature
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
t=0
0 °C
Initial temperature
44
Parabolic PDE's: Simple Implicit Method
⎧ 1⎫
m = 3; t = 6 ⎡ 1.8 -0.4 0 0 ⎤ ⎪ T1 ⎪ ⎧40 ⎫
⎢-0.4 1.8 -0.4 0 ⎥ ⎪T 1 ⎪ ⎪ 0 ⎪
⎢ ⎥ ⎪⎨ 2 ⎪⎬ = ⎪⎨ ⎪⎬
m = 2; t = 4 Left Right ⎢ 0 -0.4 1.8 -0.4 ⎥ ⎪T 1 ⎪ ⎪ 0 ⎪
Bndry Bndry ⎢ ⎥⎪ 3 ⎪ ⎪ ⎪
⎣ 0 0 -0.4 1.8 ⎦ ⎪T 1 ⎪ ⎩20 ⎭
m = 1; t = 2 100°C 50°C ⎩ 4 ⎭
T11 T21 T31 T41 ⎧ T11 ⎫
⎪ ⎪ ⎧27.6 ⎫
m = 0; t = 0 ⎪⎪T21 ⎪⎪ ⎪⎪6.14 ⎪⎪
0 °C ⎨ 1⎬ = ⎨ ⎬
Let λ = 0.4 Initial temperature ⎪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 = 40
Away from boundary: -λTi-11 + (1+2λ)Ti1 – λTi+11 = Ti0
-0.4 T11 + 1.8 T21 – 0.4 T31 = 0 = 0
-0.4 T21 + 1.8 T31 – 0.4 T41 = 0 = 0
0 °C
Initial temperature
Crank-Nicolson
48
Parabolic PDE's: 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
− kω2 t
⇒ T(x, t) = e 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 [A] a function of λ = k Δt / (Δx)2
with { }
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}
i
Worst case solution: Tim = r m ( −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
−λTim
−1 + 2(1 + λ )Ti − λTi+1 = λT m
i−1 + 2(1 − λ )Ti
m
+ λT m
i+1
i
Worst case solution: Tim = r m ( −1)
Substitution of this solution into difference equation yields:
i −1 i i +1
−λr m+1 ( −1) + 2 (1 + λ ) r m+1 ( −1) − λr m+1 ( −1) =
i −1 i i +1
λr m
( −1) + 2 (1 − λ ) r m
( −1) + λr m
( −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)
0.50
analytical
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.
57
Parabolic PDE's in Two Spatial dimension
∂T ⎛ ∂ 2T ∂ 2T ⎞
2D = k⎜ 2 + 2 ⎟ Find T(x,y,t)
∂t ⎜∂x ∂ y ⎟⎠
⎝
Explicit solutions :
(Δx) 2 + (Δy)2
Stability criterion Δt ≤
8k
kΔt 1 h2
if h = Δx = Δy ==> λ= 2
≤ or Δt ≤
h 4 4k
58
Parabolic PDE's: ADI method
Explicit tγ+1
Implicit
yi+1
yi tγ+1/2
yi-1
xi-1 xi xi+1
yi+1
yi tγ
yi-1
xi-1 xi xi+1
first half-step second half-step
ADI example
60