+ All Categories
Home > Documents > PDEs - Slides (4)

PDEs - Slides (4)

Date post: 06-Apr-2018
Category:
Upload: scribd6289
View: 223 times
Download: 0 times
Share this document with a friend

of 57

Transcript
  • 8/3/2019 PDEs - Slides (4)

    1/57

    Part IV

    20401

    Modelparabolic

    problem

    Uniqueness

    Method oflines

    Euler method

    Finite

    differences forheat equation

    Part IV

    20401

    Tony Shardlow

    1 / 5 7

  • 8/3/2019 PDEs - Slides (4)

    2/57

    Part IV

    20401

    Modelparabolic

    problem

    Uniqueness

    Method oflines

    Euler method

    Finite

    differences forheat equation

    Outline

    1 Model parabolic problem

    2 Uniqueness

    3 Method of lines

    4 Euler method

    5 Finite differences for heat equation

    2 / 5 7

  • 8/3/2019 PDEs - Slides (4)

    3/57

    Part IV

    20401

    Modelparabolic

    problem

    Uniqueness

    Method oflines

    Euler method

    Finite

    differences forheat equation

    Outline

    1 Model parabolic problem

    2 Uniqueness

    3 Method of lines

    4 Euler method

    5 Finite differences for heat equation

    3 / 5 7

  • 8/3/2019 PDEs - Slides (4)

    4/57

    Part IV

    20401

    Modelparabolic

    problem

    Uniqueness

    Method oflines

    Euler method

    Finite

    differences forheat equation

    Model parabolic PDE

    Consider the heat equation for t > 0 and x [0, 1],

    ut =uxx

    u(0, t) =u(1, t) = 0,

    with initial condition u(x, 0) = u0(x).

    We study

    1 Uniqueness of soln

    2 Finite difference method

    3 Stability of time discretisation.

    4 / 5 7

  • 8/3/2019 PDEs - Slides (4)

    5/57

    Part IV

    20401

    Modelparabolic

    problem

    Uniqueness

    Method oflines

    Euler method

    Finite

    differences forheat equation

    Outline

    1 Model parabolic problem

    2 Uniqueness

    3 Method of lines

    4 Euler method

    5 Finite differences for heat equation

    5 / 5 7

  • 8/3/2019 PDEs - Slides (4)

    6/57

    Part IV

    20401

    Modelparabolic

    problem

    Uniqueness

    Method oflines

    Euler method

    Finite

    differences forheat equation

    Uniqueness of soln

    ut uxx = 0

    u(0, t) = u(1, t) = 0u(x, 0) = u0(x)

    (H)Multiply the PDE by u and integrate over x [0, 1],

    Define the energy : E(t) =

    1

    0 u2(x, t) dx

    and differentiate

    E(t) =d

    dt

    10

    u2 dx =

    10

    t(u2) dx = 2

    10

    uut dx

    =21

    0uuxx dx.

    6 / 5 7

  • 8/3/2019 PDEs - Slides (4)

    7/57

    Part IV

    20401

    Modelparabolic

    problem

    Uniqueness

    Method oflines

    Euler method

    Finite

    differences forheat equation

    E(t) =

    10

    u2 dx; E(t) = 2

    10

    uuxx dx.

    Integrate by parts

    E(t) = 2

    uux

    10

    2

    10

    (ux)2 dx

    = 2

    10

    (ux)2 dx 0 ,

    where we apply the boundary conditions u(0, t) = u(1, t) = 0.

    We deduce that E(t) E(0) for all t > 0. That is,10

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

    10

    u20(x) dx.

    7 / 5 7

  • 8/3/2019 PDEs - Slides (4)

    8/57

    Part IV

    20401

    Modelparabolic

    problem

    Uniqueness

    Method oflines

    Euler method

    Finite

    differences forheat equation

    E(t) =

    10

    u2 dx; E(t) = 2

    10

    uuxx dx.

    Integrate by parts

    E(t) = 2

    uux

    10

    2

    10

    (ux)2 dx

    = 2

    10

    (ux)2 dx 0 ,

    where we apply the boundary conditions u(0, t) = u(1, t) = 0.

    We deduce that E(t) E(0) for all t > 0. That is,10

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

    10

    u20(x) dx.

    8 / 5 7

  • 8/3/2019 PDEs - Slides (4)

    9/57

    Part IV

    20401

    Modelparabolic

    problem

    Uniqueness

    Method oflines

    Euler method

    Finite

    differences forheat equation

    Uniqueness of soln

    Theorem

    The solution to (H) is unique.

    Proof.

    Let v, u be two solutions. By linearity, w = u v satisfies

    wt =wxx, w(0, t) = w(1, t) = 0,

    w(x, 0) =0.

    E(t) = 1

    0 w(x, t)2

    dx

    is a decreasing function.

    But E(0) = 0, so E(t) = 0 for all t. Hence w = 0 for all t andu = v and the solution is unique.

    9 / 5 7

  • 8/3/2019 PDEs - Slides (4)

    10/57

    Part IV

    20401

    Modelparabolic

    problem

    Uniqueness

    Method oflines

    Euler method

    Finite

    differences forheat equation

    A model parabolic PDE problem

    HOMEWORK

    You can now try Problem 1

    Evolution of the temperature profiles for specific initialconditions ..

    0 0.5 10

    0.2

    0.4

    0.6

    0.8

    1

    x

    temperature

    Problem 2.1

    0 0.5 10

    0.2

    0.4

    0.6

    0.8

    1

    x

    temperature

    Problem 2.2

    10/57

  • 8/3/2019 PDEs - Slides (4)

    11/57

    Part IV

    20401

    Modelparabolic

    problem

    Uniqueness

    Method oflines

    Euler method

    Finite

    differences forheat equation

    A model parabolic PDE problem

    HOMEWORK

    You can now try Problem 1

    Evolution of the temperature profiles for specific initialconditions ..

    0 0.5 10

    0.2

    0.4

    0.6

    0.8

    1

    x

    temperature

    Problem 2.1

    0 0.5 10

    0.2

    0.4

    0.6

    0.8

    1

    x

    temperature

    Problem 2.2

    11/57

  • 8/3/2019 PDEs - Slides (4)

    12/57

    Part IV

    20401

    Modelparabolic

    problem

    Uniqueness

    Method oflines

    Euler method

    Finite

    differences forheat equation

    Outline

    1 Model parabolic problem

    2 Uniqueness

    3 Method of lines

    4 Euler method

    5 Finite differences for heat equation

    12/57

  • 8/3/2019 PDEs - Slides (4)

    13/57

    Part IV

    20401

    Modelparabolic

    problem

    Uniqueness

    Method oflines

    Euler method

    Finite

    differences forheat equation

    Heat equation

    Consider the Fourier series

    u(x, t) =

    j=1

    uj(t) sin(jx)

    Notice that u(0, t) = u(1, t) and boundary conditions aresatisfied.Substitute into the heat equation ut = uxx. Then

    ut(x, t) =

    j=1uj(t) sin(jx)

    uxx(x, t) =

    j=1

    uj(t) (j22)sin(jx).

    13/57

  • 8/3/2019 PDEs - Slides (4)

    14/57

    Part IV

    20401

    Modelparabolic

    problem

    Uniqueness

    Method oflines

    Euler method

    Finite

    differences forheat equation

    Heat equation

    Consider the Fourier series

    u(x, t) =

    j=1

    uj(t) sin(jx)

    Notice that u(0, t) = u(1, t) and boundary conditions aresatisfied.Substitute into the heat equation ut = uxx. Then

    ut(x, t) =

    j=1uj(t) sin(jx)

    uxx(x, t) =

    j=1

    uj(t) (j22)sin(jx).

    14/57

  • 8/3/2019 PDEs - Slides (4)

    15/57

    Part IV

    20401

    Modelparabolic

    problem

    Uniqueness

    Method oflines

    Euler method

    Finite

    differences forheat equation

    Decoupling the heat equation

    After substitution into the heat equation,

    j=1

    uj(t)j22 sin(jx) =

    j=1

    uj(t) sin(jx).

    and equating coefficients of sin(jx),

    ODEs for Fourier coefficients uj(t)

    uj = j22uj , j = 1, 2, . . . .

    The system is decoupled, as the solution uj can be found inde-pendently of uk for j = k.

    From u(0, x) =

    j=1 uj(0) sin(jx) = u0(x), the initial data

    uj(0) = 2

    0u0(x)sinjx dx.

    15/57

  • 8/3/2019 PDEs - Slides (4)

    16/57

    Part IV

    20401

    Modelparabolic

    problem

    Uniqueness

    Method oflines

    Euler method

    Finite

    differences forheat equation

    Method of lines

    Replace infinite system of ODEs

    u

    j = j2

    2

    uj, j = 1, 2, . . . ,

    with finite system of ODEs

    uj = j22uj, j = 1, 2, . . . , J

    where J is size of system and solve to determine uj(t),j = 1, . . . , J.

    Method of lines approximation is

    v(x, t) =J

    j=1

    uj

    (t) sin(jx).

    For large J, u(x, t) v(x, t).Finite difference methods are often used to solve the ODEs foruj(t). We study finite difference methods for ODEs.

    16/57

  • 8/3/2019 PDEs - Slides (4)

    17/57

    Part IV

    20401

    Modelparabolic

    problem

    Uniqueness

    Method oflines

    Euler method

    Finite

    differences forheat equation

    Outline

    1 Model parabolic problem

    2 Uniqueness

    3 Method of lines

    4 Euler method

    5 Finite differences for heat equation

    17/57

    Finite difference method for

  • 8/3/2019 PDEs - Slides (4)

    18/57

    Part IV

    20401

    Modelparabolic

    problem

    Uniqueness

    Method oflines

    Euler method

    Finite

    differences forheat equation

    Finite difference method forODE

    Consider the following initial value problem for the ODE:

    dXdt

    = f(X), X(0) = X0

    For k > 0 (the time step), we can approximate

    dX

    dt =

    X(t+ k) X(t)

    k + O(k)

    Example: X(t) = et

    dX

    dt=

    det

    dt= et =

    et+k et

    k+ O(k)

    As a numerical example, put t = 1 and k = 0.1, then X(t) =et = e = 2.7183 and

    et+k et

    k =e1.1 e1

    0.1 = 2.8588 18/57

    Finite difference method for

  • 8/3/2019 PDEs - Slides (4)

    19/57

    Part IV

    20401

    Modelparabolic

    problem

    Uniqueness

    Method oflines

    Euler method

    Finite

    differences forheat equation

    Finite difference method forODE

    Consider the following initial value problem for the ODE:

    dXdt

    = f(X), X(0) = X0

    For k > 0 (the time step), we can approximate

    dX

    dt=

    X(t+ k) X(t)

    k+

    O(k)

    Example: X(t) = et

    dX

    dt=

    det

    dt= et =

    et+k et

    k+ O(k)

    As a numerical example, put t = 1 and k = 0.1, then X(t) =et = e = 2.7183 and

    et+k et

    k =e1.1 e1

    0.1 = 2.8588 19/57

    Finite difference method for

  • 8/3/2019 PDEs - Slides (4)

    20/57

    Part IV

    20401

    Modelparabolic

    problem

    Uniqueness

    Method oflines

    Euler method

    Finite

    differences forheat equation

    Finite difference method forODE

    Consider the following initial value problem for the ODE:

    dXdt

    = f(X), X(0) = X0

    For k > 0 (the time step), we can approximate

    dX

    dt=

    X(t+ k) X(t)

    k+ O(k)

    Example: X(t) = et

    dX

    dt=

    det

    dt= et =

    et+k et

    k+ O(k)

    As a numerical example, put t = 1 and k = 0.1, then X(t) =et = e = 2.7183 and

    et+k et

    k =e1.1 e1

    0.1 = 2.8588 20/57

  • 8/3/2019 PDEs - Slides (4)

    21/57

    Part IV

    20401

    Modelparabolic

    problem

    Uniqueness

    Method oflines

    Euler method

    Finite

    differences forheat equation

    Explicit Euler method

    Put t = nk and substitute

    X(t+ k) X(t)

    k= f(X(t)) + O(k)

    into ODE.

    X((n + 1)k) X(nk)

    k= f(X(nk)) + O(k)

    Drop the error term and approximate X(nk) by Xn, gives the

    Explicit Euler method

    Given X0 and time step k, compute Xn X(nk) by

    Xn+1 = Xn + kf(Xn)

    It is possible to show that |X(nk) Xn| = O(k) for nk = T,under assumptions on f. The method is first order accurate.

    We do not prove this. 21/57

  • 8/3/2019 PDEs - Slides (4)

    22/57

    Part IV

    20401

    Modelparabolic

    problem

    Uniqueness

    Method oflines

    Euler method

    Finite

    differences forheat equation

    Example: explicit Euler method

    Consider the ODE

    dX

    dt= X, X(0) = X0

    with X0 = 2 and = 3. In this case, exact solution is

    X(t) = e3t2 .

    We find explicit Euler approximation for time step k = 0.1,

    Xn+1 = Xn + kf(Xn), X0 = 2.

    X1 = 2 + 0.1(3 2) = 1.4 ,

    X2 = 1.4 + 0.1(3 1.4) = 0.98

    The exact solution X1 X(0.1) = 2e0.3 = 1.4816,

    X2 1.0976 = X(0.2).

    Can get more accurate approximation by taking k smaller 22/57

    E l li i E l h d

  • 8/3/2019 PDEs - Slides (4)

    23/57

    Part IV

    20401

    Modelparabolic

    problem

    Uniqueness

    Method oflines

    Euler method

    Finite

    differences forheat equation

    Example: explicit Euler method

    Consider the ODE

    dX

    dt= X, X(0) = X0

    with X0 = 2 and = 3. In this case, exact solution is

    X(t) = e3t2 .

    We find explicit Euler approximation for time step k = 0.1,

    Xn+1 = Xn + kf(Xn), X0 = 2.

    X1 = 2 + 0.1(3 2) = 1.4 ,

    X2 = 1.4 + 0.1(3 1.4) = 0.98

    The exact solution X1 X(0.1) = 2e0.3 = 1.4816,

    X2 1.0976 = X(0.2).

    Can get more accurate approximation by taking k smaller 23/57

    I li i E l h d

  • 8/3/2019 PDEs - Slides (4)

    24/57

    Part IV

    20401

    Modelparabolic

    problem

    Uniqueness

    Method oflines

    Euler method

    Finite

    differences forheat equation

    Implicit Euler method

    Approximating dX/dt by (X(t) X(t k))/k and repeating

    gives X(nk) X((n 1)k)

    k= f(X(nk)) + O(k)

    Drop the error term and approximate X(nk) by Xn, gives the

    Implicit Euler method

    Given X0 and time step k, compute Xn X(nk) by

    Xn = Xn1 + kf(Xn)

    A nonlinear system of equations must be solved to determineXn. Hence the method is implicit.

    Again possible to show that |X(nk) Xn| = O(k) for nk = T,under assumptions on f. The method is first order accurate.

    Not proved. 24/57

    Li ODE

  • 8/3/2019 PDEs - Slides (4)

    25/57

    Part IV

    20401

    Modelparabolic

    problem

    Uniqueness

    Method oflines

    Euler method

    Finite

    differences forheat equation

    Linear test ODE

    Linear test equation

    dXdt

    = X = X, X(0) = X0.

    The solution is easily found to be

    X(t) = e

    t

    X0.

    Note that X(t) 0 as t if < 0 ( means real part).

    What about numerical methods?For what values of , do the numerical approximations Xn 0

    as n Hope that the set of such is also { R : < 0}.

    25/57

    Stability condition for Explicit

  • 8/3/2019 PDEs - Slides (4)

    26/57

    Part IV

    20401

    Modelparabolic

    problem

    Uniqueness

    Method oflines

    Euler method

    Finite

    differences forheat equation

    Stab ty co d t o o p c tEuler

    1 For the case f(X) = X, the explicit Euler method is

    Xn+1 = Xn + kXn

    2 Rearrange,Xn+1 = (1 + k)Xn.

    and the solution Xn = (1 + k)nX0 .

    3 Hence as n

    Xn 0 |1 + k| < 1

    if and only if k belongs tocircle of radius 1 in complex plane with centre at 1.

    4 The set of k C such that Xn 0 as n is knownas the region of absolute stability.

    26/57

    Stability condition for Explicit

  • 8/3/2019 PDEs - Slides (4)

    27/57

    Part IV

    20401

    Modelparabolic

    problem

    Uniqueness

    Method oflines

    Euler method

    Finite

    differences forheat equation

    y pEuler

    1 For the case f(X) = X, the explicit Euler method is

    Xn+1 = Xn + kXn

    2 Rearrange,Xn+1 = (1 + k)Xn.

    and the solution Xn = (1 + k)nX0 .

    3 Hence as n

    Xn 0 |1 + k| < 1

    if and only if k belongs tocircle of radius 1 in complex plane with centre at 1.

    4 The set of k C such that Xn 0 as n is knownas the region of absolute stability.

    27/57

    Time step restriction for explicit

  • 8/3/2019 PDEs - Slides (4)

    28/57

    Part IV

    20401

    Modelparabolic

    problem

    Uniqueness

    Method oflines

    Euler method

    Finite

    differences forheat equation

    p pEuler

    1 Recall for the ODE, then

    X(t) 0 as t

    if < 0.2 The numerical method decays for all initial data if and

    only if |1 + k| < 1 if and only if

    timestep k < 2/|| .

    That is, there is a restriction on the time step.3 For the method of lines method, = j22 where

    j = 1, 2, . . . , J.4 Hence, the time step restriction is

    timestep k < 2/J22 .

    For large J, the time step condition is very restrictive!

    Leads to inefficient method. 28/57

    Time step restriction for explicit

  • 8/3/2019 PDEs - Slides (4)

    29/57

    Part IV

    20401

    Modelparabolic

    problem

    Uniqueness

    Method oflines

    Euler method

    Finite

    differences forheat equation

    p pEuler

    1 Recall for the ODE, then

    X(t) 0 as t

    if < 0.2 The numerical method decays for all initial data if and

    only if |1 + k| < 1 if and only if

    timestep k < 2/|| .

    That is, there is a restriction on the time step.3 For the method of lines method, = j22 where

    j = 1, 2, . . . , J.4 Hence, the time step restriction is

    timestep k < 2/J22 .

    For large J, the time step condition is very restrictive!

    Leads to inefficient method. 29/57

    Time step restriction for explicit

  • 8/3/2019 PDEs - Slides (4)

    30/57

    Part IV

    20401

    Modelparabolic

    problem

    Uniqueness

    Method oflines

    Euler method

    Finite

    differences forheat equation

    p pEuler

    1 Recall for the ODE, then

    X(t) 0 as t

    if < 0.2 The numerical method decays for all initial data if and

    only if |1 + k| < 1 if and only if

    timestep k < 2/|| .

    That is, there is a restriction on the time step.3 For the method of lines method, = j22 where

    j = 1, 2, . . . , J.4 Hence, the time step restriction is

    timestep k < 2/J22 .

    For large J, the time step condition is very restrictive!

    Leads to inefficient method. 30/57

    Implicit Euler

  • 8/3/2019 PDEs - Slides (4)

    31/57

    Part IV

    20401

    Modelparabolic

    problem

    Uniqueness

    Method oflines

    Euler method

    Finite

    differences forheat equation

    Implicit Euler

    Put f(X) = X into the implicit Euler method.

    Implicit Euler method

    Xn Xn1k

    = Xn

    It becomes

    Xn =1

    (1 k)Xn1 .

    and the soln Xn = (1 k)nX0 .

    HenceXn 0 |1 k| > 1

    if and only if k isoutside the circle of radius 1 in complex plane with centre at 1

    .

    31/57

    Implicit Euler

  • 8/3/2019 PDEs - Slides (4)

    32/57

    Part IV

    20401

    Modelparabolic

    problem

    Uniqueness

    Method oflines

    Euler method

    Finite

    differences forheat equation

    Implicit Euler

    Put f(X) = X into the implicit Euler method.

    Implicit Euler method

    Xn Xn1k

    = Xn

    It becomes

    Xn =1

    (1 k)Xn1 .

    and the soln Xn = (1 k)nX0 .

    HenceXn 0 |1 k| > 1

    if and only if k isoutside the circle of radius 1 in complex plane with centre at 1

    .

    32/57

    No stability restriction for

  • 8/3/2019 PDEs - Slides (4)

    33/57

    Part IV

    20401

    Modelparabolic

    problem

    Uniqueness

    Method oflines

    Euler method

    Finite

    differences forheat equation

    implicit Euler

    1 For implicit Euler, the region of absolute stability is

    |1 k| > 1 and this holds for all with < 0.2 When the ODE is stable ( < 0), the implicit Euler is

    stable too and |Xn| 0 as n .

    3 There is no timestep restriction for the implicit Euler

    method.This is important for the heat equation, where is large.

    4 The implicit Euler is a better method for the timediscretisation of the heat equation.

    33/57

    No stability restriction for

  • 8/3/2019 PDEs - Slides (4)

    34/57

    Part IV

    20401

    Modelparabolic

    problem

    Uniqueness

    Method oflines

    Euler method

    Finite

    differences forheat equation

    implicit Euler

    1 For implicit Euler, the region of absolute stability is

    |1 k| > 1 and this holds for all with < 0.2 When the ODE is stable ( < 0), the implicit Euler is

    stable too and |Xn| 0 as n .

    3 There is no timestep restriction for the implicit Euler

    method.This is important for the heat equation, where is large.

    4 The implicit Euler is a better method for the timediscretisation of the heat equation.

    34/57

    Explicit vs Implicit

  • 8/3/2019 PDEs - Slides (4)

    35/57

    Part IV

    20401

    Modelparabolic

    problem

    Uniqueness

    Method oflines

    Euler method

    Finite

    differences forheat equation

    Explicit vs Implicit

    To understand the names implicit and explicit, apply the

    methods to dX

    dt= f(X), X(0) = X0

    for f(x) a nonlinear function. The explicit Euler method is

    Xn+1 = Xn + kf(Xn)

    so that Xn+1 is determined explicitly from Xn and evaluation off.The implicit Euler method is

    Xn = Xn1 + kf(Xn)

    so that Xn is determined implicitly by a solution of a nonlinearequation involving f.

    HOMEWORK

    You can now try Problem 24

    35/57

    Explicit vs Implicit

  • 8/3/2019 PDEs - Slides (4)

    36/57

    Part IV

    20401

    Modelparabolic

    problem

    Uniqueness

    Method oflines

    Euler method

    Finite

    differences forheat equation

    Explicit vs Implicit

    To understand the names implicit and explicit, apply the

    methods to dX

    dt= f(X), X(0) = X0

    for f(x) a nonlinear function. The explicit Euler method is

    Xn+1 = Xn + kf(Xn)

    so that Xn+1 is determined explicitly from Xn and evaluation off.The implicit Euler method is

    Xn = Xn1 + kf(Xn)

    so that Xn is determined implicitly by a solution of a nonlinearequation involving f.

    HOMEWORK

    You can now try Problem 24

    36/57

    Examination

  • 8/3/2019 PDEs - Slides (4)

    37/57

    Part IV

    20401

    Modelparabolic

    problem

    Uniqueness

    Method oflines

    Euler method

    Finite

    differences forheat equation

    Examination

    The material from here on is not covered on the exam.

    37/57

    Outline

  • 8/3/2019 PDEs - Slides (4)

    38/57

    Part IV

    20401

    Modelparabolic

    problem

    Uniqueness

    Method oflines

    Euler method

    Finite

    differences forheat equation

    Outline

    1 Model parabolic problem

    2 Uniqueness

    3 Method of lines

    4 Euler method

    5 Finite differences for heat equation

    38/57

    Discretisation of (x, t) space :m ( t )

  • 8/3/2019 PDEs - Slides (4)

    39/57

    Part IV

    20401

    Modelparabolic

    problem

    Uniqueness

    Method oflines

    Euler method

    Finite

    differences forheat equation

    um

    j u(xj, tm)

    Grid spacing in x direction is h.

    Grid spacing in t direction is k.

    6 6

    s s s s s s

    c

    c

    c

    c

    c

    c

    c

    c

    c

    c

    0 = x0 xj xn = 1j1 j j+1h

    h =1

    n -

    k

    mtm

    m+1

    6

    ?

    umj

    39/57

    Explicit approximation

  • 8/3/2019 PDEs - Slides (4)

    40/57

    Part IV

    20401

    Modelparabolic

    problem

    Uniqueness

    Method oflines

    Euler method

    Finite

    differences forheat equation

    p pp

    ut (xj, tm) = uxx (xj, tm)

    Approximate

    uxx(xj, tm) 1

    h22xu(xj, tm)

    = 1h2

    u(xj h, tm) 2u(xj, tm) + u(xj + h, tm)

    ut(xj, tm) 1

    k+t u(xj, tm)

    =

    1

    ku(xj, tm + k) u(xj, tm).

    40/57

    Finite difference methodexplicit

  • 8/3/2019 PDEs - Slides (4)

    41/57

    Part IV

    20401

    Modelparabolic

    problem

    Uniqueness

    Method oflines

    Euler method

    Finite

    differences forheat equation

    ut (xj, tm) = uxx (xj, tm)j = 1, 2, . . . , n 1m = 0, 1, 2, . . .

    .

    Substitute difference approximations to derive the finitedifference method

    1

    k+t u

    mj =

    1

    h22xu

    mj

    or1k

    um+1j u

    mj

    = 1

    h2

    umj1 2um

    j + um

    j+1

    s s s

    j 1 j j + 1m

    m + 1

    Given umj1, um

    j , um

    j+1, um+1

    j is given explicitly by

    um+1j = um

    j1 + (1 2)um

    j + um

    j+1, where = k/h2.

    41/57

    Linear system of equations

  • 8/3/2019 PDEs - Slides (4)

    42/57

    Part IV

    20401

    Modelparabolic

    problem

    Uniqueness

    Method of

    lines

    Euler method

    Finite

    differences forheat equation

    t t t

    j 1 j j + 1

    m

    m + 1

    For = k/h2

    u

    m+1

    j = u

    m

    j1 + (1 2)u

    m

    j + u

    m

    j+1,

    j = 1, 2, . . . , n 1

    m = 0, 1, 2, . . .

    This is a matrix-vector multiply at each time level:

    um+11...

    um+1j...

    um+1n1

    =

    1 2 0.. .

    .. .

    1 2 . . .

    . . .

    0 1 2

    um1...

    umj...

    umn1

    .

    42/57

    Consistency I

  • 8/3/2019 PDEs - Slides (4)

    43/57

    Part IV

    20401

    Modelparabolic

    problem

    Uniqueness

    Method of

    lines

    Euler method

    Finite

    differences forheat equation

    Is the explicit approximation consistent?

    Theorem (consistency)

    The local error at the grid point (xj, tm),

    Tmj =1

    k

    +t u(xj, tm) 1

    h2

    2xu(xj, tm) j = 1, 2, . . . , n,

    is bounded from above:

    Tmj

    = O(k) + O(h2)

    HOMEWORKYou can now try Problem 5

    43/57

    Consistency I

  • 8/3/2019 PDEs - Slides (4)

    44/57

    Part IV

    20401

    Modelparabolic

    problem

    Uniqueness

    Method of

    lines

    Euler method

    Finite

    differences forheat equation

    Is the explicit approximation consistent?

    Theorem (consistency)

    The local error at the grid point (xj, tm),

    Tmj =1

    k

    +t u(xj, tm) 1

    h2

    2xu(xj, tm) j = 1, 2, . . . , n,

    is bounded from above:

    Tmj

    = O(k) + O(h2)

    HOMEWORKYou can now try Problem 5

    44/57

    Explicit Approximation II

  • 8/3/2019 PDEs - Slides (4)

    45/57

    Part IV

    20401

    Modelparabolic

    problem

    Uniqueness

    Method of

    lines

    Euler method

    Finite

    differences forheat equation

    1 Is the explicit approximation stable?

    It all depends on = r

    0 0.5 10

    0.2

    0.4

    0.6

    0.8

    1Explicit FD Scheme: r is 0.48

    x

    temperature

    0 0.5 10

    0.2

    0.4

    0.6

    0.8

    1Explicit FD Scheme: r is 0.52

    x

    temperature

    45/57

  • 8/3/2019 PDEs - Slides (4)

    46/57

    Part IV

    20401

    Modelparabolic

    problem

    Uniqueness

    Method of

    lines

    Euler method

    Finite

    differences forheat equation

    TheoremIf 1 2 0 1/2 then the explicit approximation

    um+1j = um

    j1 + (1 2)um

    j + um

    j+1,

    is non-increasing:

    maxj

    um+1j max

    j

    umj . ()HOMEWORK

    You can now try Problem 6

    46/57

  • 8/3/2019 PDEs - Slides (4)

    47/57

    Part IV

    20401

    Modelparabolic

    problem

    Uniqueness

    Method of

    lines

    Euler method

    Finite

    differences forheat equation

    TheoremIf 1 2 0 1/2 then the explicit approximation

    um+1j = um

    j1 + (1 2)um

    j + um

    j+1,

    is non-increasing:

    maxj

    um+1j max

    j

    umj . ()HOMEWORK

    You can now try Problem 6

    47/57

  • 8/3/2019 PDEs - Slides (4)

    48/57

    Part IV

    20401

    Modelparabolic

    problem

    Uniqueness

    Method of

    lines

    Euler method

    Finite

    differences forheat equation

    Proof.Let um = maxj |u

    mj |.

    |um+1j | = |um

    j1 + (1 2)um

    j + um

    j+1|

    |umj1| + |(1 2)um

    j | + |um

    j+1|

    >0

    um + (1 2) 0

    um + ()>0

    um

    = um + (1 2)um + u

    m = u

    m .

    This establishes () since |um+1

    j | um for all j.

    48/57

    Implicit Approximation

  • 8/3/2019 PDEs - Slides (4)

    49/57

    Part IV

    20401

    Modelparabolic

    problem

    Uniqueness

    Method of

    lines

    Euler method

    Finite

    differences forheat equation

    ut (xj, tm) = uxx (xj, tm)Approximate

    uxx(xj, tm) 1

    h22xu(xj, tm)

    =1

    h2u(xj h, tm) 2u(xj, tm) + u(xj + h, tm)

    ut(xj, tm) 1

    kt u(xj, tm)

    =1

    ku(xj, tm) u(xj, tm k).

    where

    2xu(xj, tm) = u(xj h, tm) 2u(xj, tm) + u(xj + h, tm)

    t u(xj, tm) = u(xj, tm) u(xj, tm k).49/57

    Implicit Approximation II

  • 8/3/2019 PDEs - Slides (4)

    50/57

    Part IV

    20401

    Modelparabolic

    problem

    Uniqueness

    Method of

    lines

    Euler method

    Finite

    differences forheat equation

    ut (xj, tm) = uxx (xj, tm)j = 1, 2, . . . , n

    1

    m = 0, 1, 2, . . . .

    1

    kt u

    mj =

    1

    h22xu

    mj

    1

    kum

    j um1

    j =1

    h2 um

    j1

    2umj + um

    j+1

    t

    j 1 j j + 1

    m 1

    m

    Thus umj1 + (1 + 2)um

    j um

    j+1 = um1

    j ,

    where = k/h2.50/57

    Linear system of eqns

  • 8/3/2019 PDEs - Slides (4)

    51/57

    Part IV

    20401

    Modelparabolic

    problem

    Uniqueness

    Method of

    lines

    Euler method

    Finite

    differences forheat equation

    t

    j 1 j j + 1

    m 1

    m

    For = k/h2

    umj1 + (1 + 2)um

    j um

    j+1 = um1

    j

    j = 1, 2, . . . , n 1m = 0, 1, 2, . . .

    This is a tridiagonal matrix solve at each time level:

    1 + 2 0. . . . . .

    1 + 2 . . .

    . . .

    0 1 + 2

    um1...

    umj...

    umn1

    =

    um11...

    um1j...

    um1n1

    51/57

    Consistency

  • 8/3/2019 PDEs - Slides (4)

    52/57

    Part IV

    20401

    Modelparabolic

    problem

    Uniqueness

    Method of

    lines

    Euler method

    Finite

    differences forheat equation

    Theorem

    The local error at the grid point (xj, tm),

    Tmj =1

    kt u(xj, tm)

    1

    h22xu(xj, tm) j = 1, 2, . . . , n,

    is bounded from above:Tmj = O(k) + O(h2).HOMEWORK

    You can now try Problem 78

    52/57

    Consistency

  • 8/3/2019 PDEs - Slides (4)

    53/57

    Part IV

    20401

    Modelparabolic

    problem

    Uniqueness

    Method of

    lines

    Euler method

    Finite

    differences forheat equation

    Theorem

    The local error at the grid point (xj, tm),

    Tmj =1

    kt u(xj, tm)

    1

    h22xu(xj, tm) j = 1, 2, . . . , n,

    is bounded from above:Tmj = O(k) + O(h2).HOMEWORK

    You can now try Problem 78

    53/57

    Implicit Approximation II

  • 8/3/2019 PDEs - Slides (4)

    54/57

    Part IV

    20401

    Modelparabolic

    problem

    Uniqueness

    Method of

    lines

    Euler method

    Finite

    differences forheat equation

    1 Is the implicit approximation stable?

    Yes for any = r

    0 0.5 10

    0.2

    0.4

    0.6

    0.8

    1Implicit FD Scheme: r is 0.48

    x

    temperature

    0 0.5 10

    0.2

    0.4

    0.6

    0.8

    1Implicit FD Scheme: r is 0.52

    x

    temperature

    54/57

  • 8/3/2019 PDEs - Slides (4)

    55/57

    Part IV

    20401

    Modelparabolic

    problem

    Uniqueness

    Method of

    lines

    Euler method

    Finite

    differences forheat equation

    Theorem

    The implicit approximation

    umj1 + (1 + 2)um

    j um

    j+1 = um1

    j

    is non-increasing: maxj um+1j maxj umj . ()

    55/57

    Proof

  • 8/3/2019 PDEs - Slides (4)

    56/57

    Part IV

    20401

    Modelparabolic

    problem

    Uniqueness

    Method of

    lines

    Euler method

    Finite

    differences forheat equation

    Proof.

    Proof. Let um = maxj |um

    j |.

    | (1 + 2) >0

    umj | = |umj1 + um

    1j + umj+1|.

    (1 + 2) |umj | = |um

    j1 + um1

    j + um

    j+1|

    |umj1| + |um1

    j | + |um

    j+1|

    um + |um1

    j | + um = 2u

    m + |u

    m1j |.

    (1 + 2) um 2um + |u

    m1k |

    This establishes () since um |um1k | maxj |u

    m1j |.

    56/57

    Summary

  • 8/3/2019 PDEs - Slides (4)

    57/57

    Part IV

    20401

    Modelparabolic

    problem

    Uniqueness

    Method of

    lines

    Euler method

    Finite

    differences forheat equation

    1 We have looked at two finite difference approximations for

    the heat equation. An explicit and an implicit method.2 The explicit method is easier to implement as it does NOT

    involve solving a linear system of equations.

    3 Both implicit and explicit methods are consistent with thesame order of accuracy (|Tm

    j

    | = O(k) + O(h2)). Secondorder accurate in space; first order accurate in time.

    4 Stability depends on a step size condition for the explicitmethod ( = k/h2 1/2). The implicit method is alwaysstable.

    5 Stable+consistency gives convergence for both methods.The implicit method is preferred in practice due to betterstability.

    57/57


Recommended