Vous êtes sur la page 1sur 4

The Heat Equation in 1D

remember the heat equation:

Scientic Computing I
Module 6: The 1D Heat Equation Michael Bader
Lehrstuhl Informatik V

Tt = T we examine the 1D case, and set = 1 to get: ut = uxx for x (0, 1), t > 0

using the following initial and boundary conditions: u(x, 0) = f(x), x (0, 1) t>0

Winter 2005/2006 u(0, t) = u(1, t) = 0,

Computing Analytic Solutions


First steps: try to nd some solution of the PDE try to satisfy boundary conditions (but not the initial condition) Ansatz: Separation of Variables assumption: u(x, t) = X(x) T(t) insert this assumption into the heat equation

Separation of Variables
insert u(x, t) = X(x) T(t) into PDE: 2 (X(x) T(t)) = (X(x) T(t)) t x2 or X(x) Tt (t) = T(t) Xxx (x) divide by X(x)T(t), and get: Tt (t) Xxx (x) = T(t) X(x) true for all x and all t, only if: Tt (t) Xxx (x) = = T(t) X(x)

Transforming the PDE into two ODEs


separation of variables leads to: Tt (t) Xxx (x) = = T(t) X(x) thus, we obtain two ODEs: Xxx (x) + X(x) = 0 Tt (t) + T(t) = 0 solve X(x)-part: Xk (x) = sin(kx) k = (k)2 , k = 1, 2, . . . X(0) = X(1) = 0, (1) (2)

Fouriers Method
the functions uk (x, t) := Tk (t)Xk (x) = e(k) t sin(kx), solve the 1D heat equation PDE for the initial and boundary conditions: uk (0, t) = uk (1, t) = 0, t>0 x (0, 1).
2

k = 1, 2, . . . ,

uk (x, 0) = sin(kx),

use Fourier sine series for initial condition: f(x) =


k=1

ck sin(kx).
2

solve T(t)-part (compare Model of Maltus): Tk (t) = e


k t

and obtain solution for uk (x, 0) = f(x): u(x, t) =


k=1

=e

(k)2 t

cke(k) t sin(kx),

Fouriers Method A Recipe


1

Numerical Solution 1 Discretisation


Discretisation similar to ODEs: compute approximations vj
(m)

Find coefcients ck such that the initial condition f(x) can be represented as f(x) =

k=1
2

ck sin(kx).
(k)2 t

u(xj , tm )

Verify that the solution candidate u(x, t) := ck e


k

at grid points xj and time points tm : xj := j h tm := m ,

sin(kx)

3 4

converges to a well-dened function u Verify that u solves the differential equation ut = uxx Verify that u satises the boundary conditions u(0, t) = u(1, t) = 0 Verify that u satises the initial condition u(x, 0) = f(x)

approximate equation ut = uxx by vj


(m+1)

vj

(m)

vj1 2vj

(m)

(m)

+ vj+1

(m)

h2

(3)

for j = 1, . . . , n 1, and m 0.

An Explicit Scheme
add initial and boundary conditions:
(m) v0 (0) vj (m) vn

Solutions of the Explicit Scheme


Observations: m 0, rst order accurate in : ut (x, t) = u(x, t + ) u(x, t) + O()

= 0, for

for all

= f(xj ),

j = 1, . . . , n 1.

and obtain an explicit scheme:


(m+1) vj (m) = vj +

second order accurate in h: uxx (x, t) = u(x h, t) 2u(x, t) + u(x + h, t) + O(h2 ) h2

(m) (m) (m) v 2vj + vj+1 h2 j1


(m)

we can, step by step, compute all values vj

for all time steps (m), (0) starting with the initial conditions vj = f(xj ).

stability condition of the step size! (similar to ODE) examine conservation of energy

explicit time stepping scheme

Energy of the Analytic Solution


u(x, y) a solution of (uk )t = (uk )xx , uk (0, t) = uk (1, t) = 0, x (0, 1), t > 0

Energy of the Analytic Solution (2)


1

E (t) =
0

2 u (x, t) dx = t
1

1 0

2u(x, t)ut (x, t) dx

t>0 x (0, 1).

= 2
0

u(x, t)uxx (x, t) dx


1 0

uk (x, 0) = f(x),

= 2 [u(x, t)ux (x, t)]1 2 0


1

(ux (x, t))2 dx

dene the energy of the solution:


1

= 2 u2 (x, t) dx
0

(ux (x, t))2 dx 0

E(t) :=
0

for conservation of energy, analyse E (t) := d dt


1 0

Therefore: E(t) E(0) (energy never increases) compare to initial condition u(x, 0) = f(x):
1 0

u2 (x, t) dx

u2 (x, t) dx = E(t) E(0) =

1 0

f 2 (x) dx

Corrollaries
assume: both u1 (x, t) and u2 (x, t) are solutions for initial conditions f1 (x) and f2 (x) let w(x, t) := u1 (x, t) u2 (x, t), then wt (x, t) = (u1 )t (x, t) (u2 )t (x, t) = (u1 )xx (x, t) (u2 )xx (x, t) = wxx (x, t) w(0, t) = w(1, t) = 0 w(x, 0) = u1 (x, 0) u2 (x, 0) = f1 (x) f2 (x) therefore, w(x, t) is a solution of the heat equation for initial condition fw (x) = f1 (x) f2 (x)

Corrollary 1 Uniqueness
if f1 = f2 , then fw (x) = 0 energy is decreasing:
1 0 1 0 1 0

(u1 u2 )2 (x, t) dx =

w2 (x, t) dx (f1 f2 )2 (x) dx = 0

therefore:
1 0

w2 (x, t) dx 0

w=0

u1 = u2 .

proof of uniqueness of the solution!

Corrollary 2 Stability
now: f2 = f1 + ( small), then
1 0 1 0 1

Energy of the Numerical Solution


we introduce the discrete energy: E(m) := h
n1 j=1

w2 (x, t) dx =

(f1 f2 )2 (x) dx (x) dx 1

vj

(m) 2

we would like to show that: E(m+1) E(m) for m 0.

therefore:
if is small, the difference between u1 and u2 also has got to be small, i.e. small perturbations in the initial conditions lead to small perturbations in the solution.

thus, we will compute E(m) := E(m+1) E(m) : E(m) = h


n1 j=1

vj

(m+1) 2

vj

(m) 2

stability estimate for the solution!

Energy of the Numerical Solution (2)


lengthy computation leads to stability condition: E
(m+1)

Numerical Solution 2 An Implicit Scheme


apply implicit Euler: vj
(m+1)

(m)

0,

or

(m+1)

(m)

vj

(m)

vj1

(m+1)

2vj

(m+1)

+ vj+1

(m+1)

h2

is only correct, if 1 h2 2 or h2 . 2

for j = 1, . . . , n 1, and m 0. boundary conditions: v0


(m)

= vn

(m)

= 0,

for all

m 0,

otherwise: increasing energy (physically incorrect), leads to large oscillations in the solution

initial conditions: vj
(0)

= f(xj ),

for

j = 1, . . . , n 1.

Implicit Time Stepping


solve implicit scheme for vj vj
(m+1) (m+1)

System of Linear Equations:


: the matrix of the linear system of equations is given by I + rA, where A = tridiag(1, 2, 1). system is tridiagonal, solving requires O(n) operations. solution:
(m)

(m+1) (m+1) (m+1) (m) 2vj + vj+1 v = vj . h2 j1

with the ratio r := /h2 , we can write it as rvj1


(m+1)

+ (1 + 2r)vj

(m+1)

rvj+1

(m+1)

= vj

v(m) = (I + rA)1 v(m1) ; with M := (I + rA)1 , we get

for j = 1, . . . , n 1, and m 0 solve a system of linear equations to obtain vj in every step


(m+1)

v(m) = Mm v(0)

Energy for the Implicit Scheme


analyse discrete energy E(m) := h
n1 j=1

Energy for the Implicit Scheme (2)

vj

(m) 2

= h vj

(m) T (m) vj .

energy for the implicit scheme: E(m) = h v(m)


T

change of energy in each time step: E(m) = h = h = h v(m+1) Mv(m) v(m)


T T T

MT M I v(m)

v(m+1) v(m) Mv(m) v(m)

v(m)

examine eigenvalues of matrix MT M I result:


all eigenvalues < 0 therefore E(m) 0 implicit scheme stable for any and h

v(m)
T

MT Mv(m) v(m) MT M I v(m)

v(m)

= h v(m)

Vous aimerez peut-être aussi