lecture 25 ordinary differential equations (3)_2.pdf

Upload: irfananjum

Post on 22-Feb-2018

226 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/24/2019 Lecture 25 Ordinary Differential Equations (3)_2.pdf

    1/5

    4/8/20

    Lecture 25 Ordinary DifferentialEquations (3)

    Stiffness

    stiff equation involves rapidly changing

    parts and slowly changing parts

    xeydx

    dy 399820008000

    xxeey

    24 2000

    Solution is

    0

    0.5

    1

    1.5

    2

    2.5

    3

    3.5

    4

    0 0.5 1 1.5 2 2.5

    0

    0.5

    1

    1.5

    2

    2.5

    3

    - 0.0 01 0 .0 01 0 .0 03 0 .0 05 0 .0 07 0 .0 09 0 .0 11 0 .0 13 0 .0 15

    Look at homogeneous part of equation

    ydx

    dy2000

    aydx

    dy

    In general

    Explicit Eulers method

    hayyhdx

    dyyy ii

    i

    ii 1

    ahy

    hayyy

    i

    iii

    1

    1

    Look at what happens to y over long time -

    stability

    If then y goes to infinity

    So for explicit method to work -

    small h

    11 ah

    11 ah

    Need to use implicit methods, rather than

    explicit

    Implicit form of the Euler method

    hayy

    h

    dt

    dyyy

    ii

    iii

    1

    1

    1

    Can solve to getah

    yy ii

    11

  • 7/24/2019 Lecture 25 Ordinary Differential Equations (3)_2.pdf

    2/5

    4/8/20

    Implicit Euler is always stable -

    as i increases y goes to 0

    ah

    yy ii

    11 Example: xey

    dx

    dy 399820008000

    Explict solution:

    since a is 2000, let h=0.0001

    0

    0.5

    1

    1.5

    2

    2.5

    0 0.01 0.02 0.03 0.04 0.05 0.06

    y

    yExplicit

    1 1 8000 2000 3998 *

    ixi

    i i i i i

    dyy y h y y y e h

    dx

    Stability limit is h=0.0005

    Try h=0.0007

    0

    0.5

    1

    1.5

    2

    2.5

    3

    3.5

    0 0 .0 02 0 .0 04 0 .0 06 0 .0 08 0 .0 1 0 .0 12 0 .0 14 0 .0 16 0 .0 18 0 .0 2

    y

    yExplicit

    Try h=0.001

    0

    0.5

    1

    1.5

    2

    2.5

    3

    3.5

    4

    4.5

    0 0.005 0.01 0.015 0.02

    y

    yExplicit

    h=0.002

    -15

    -10

    -5

    0

    5

    10

    15

    0 0.005 0.01 0.015 0.02 0.025

    sign

    ofy

    *

    ln

    ofabs(y

    value)

    lny

    lnyExplicit

    Implicit approach:

    h

    hehy

    y

    heyy

    ydx

    dyyy

    i

    i

    x

    i

    i

    x

    ii

    ii

    ii

    20001

    39988000

    *399820008000

    1

    1

    1

    1

    11

    1

  • 7/24/2019 Lecture 25 Ordinary Differential Equations (3)_2.pdf

    3/5

    4/8/20

    h=0.002

    0

    0.5

    1

    1.5

    2

    2.5

    3

    3.5

    4

    4.5

    0 0.005 0.01 0.015 0.02

    0

    0.5

    1

    1.5

    2

    2.5

    3

    3.5

    4

    4.5

    0 0.5 1 1.5 2 2.5 3

    y

    yImplicit

    Higher order ODEs and systems of ODEs

    Recall: any higher ODE a system of first order

    ODEs

    How to solve? - same as before only more steps

    Example: xydx

    yd

    2

    2

    Using

    dx

    dyy

    yy

    2

    1

    Leads to

    12

    21

    xydx

    dy

    ydx

    dy

    Use 4th order Runge-Kutta

    initial conditions

    1

    00

    0

    dx

    dy

    y

    Can be rewritten 10

    00

    2

    1

    y

    y

    First calculate ks

    1

    2212

    21

    211

    ,,

    ,,

    xydx

    dyyyxf

    ydx

    dyyyxf

    Normally, k1=f(x,y)

    Use k1,1 and k1,2

    12122,1

    22111,1

    ,,

    ,,

    xyyyxfk

    yyyxfk

    Normally

    12

    2,

    2k

    hy

    hxfk

    With two ys

    2,121,1122,2

    2,121,1111,2

    2,

    2,

    2

    2,

    2,

    2

    kh

    ykh

    yh

    xfk

    kh

    ykh

    yh

    xfk

  • 7/24/2019 Lecture 25 Ordinary Differential Equations (3)_2.pdf

    4/5

    4/8/20

    The same is true for k3 and k4

    2,221,2122,3

    2,221,2111,3

    2,

    2,

    2

    2,

    2,

    2

    kh

    ykh

    yh

    xfk

    kh

    ykh

    yh

    xfk

    2,321,3122,4

    2,321,3111,4

    2,

    2,

    2

    2,

    2,

    2

    kh

    ykh

    yh

    xfk

    kh

    ykh

    yh

    xfk

    Now advance both ys

    2,42,32,22,1,21,2

    1,41,31,21,1,11,1

    226

    226

    kkkk

    h

    yy

    kkkkh

    yy

    ii

    ii

    Can extend to many more ys

    Back to our example

    10

    00

    2

    1

    y

    y

    1212

    2211

    ,,

    ,,

    xyyyxf

    yyyxf

    k1s

    00*01,0,0

    11,0,0

    212

    111

    fk

    fk

    Because of starting values, all ks for y1 are 1

    and all ks for y2 are 0

    h 0.5

    x y1 y2 k11 k12 y1+hk11/2 y2+hk12/2k2 1 k2 2

    0 0 1 1 0 0.25 1 1 0

    0.5 0.5 1 1 -0.25 0.75 0 .94 0.94 - 0.38

    y1+hk21/2y2+hk22/2k 31 k 32 y1+hk31 y1+hk32 k4 1 k4 2

    0.25 1 1 0 0.25 1 1 0

    0.73 0.91 0.91 -0.37 0.73 0.91 0.91 -0.36

    -25

    -20

    -15

    -10

    -5

    0

    5

    10

    15

    20

    25

    0 2 4 6 8 10 12 14 16 18

    y1

    y2

    Another example problem:

    Deflection of cantilever beam

    z

    Ly

  • 7/24/2019 Lecture 25 Ordinary Differential Equations (3)_2.pdf

    5/5

    4/8/20

    Vertical deflection due to weight

    221

    23/1

    2

    2

    2LL

    zzdz

    dyg

    dz

    ydJE

    J moment of inertia of beam cross section

    about principle axis

    E Youngs modulus

    r density of beam

    0,000

    zdz

    dyy

    g=-9.8 m/s2

    As before, set up as two first order equations

    Let

    dz

    dyx

    yx

    2

    1

    then

    00

    00

    221

    2

    1

    23/12

    22

    2

    1

    x

    x

    LLzzx

    JE

    g

    dz

    dx

    xdz

    dx

    Set this up as system in RK

    Need some parameters. Let

    m1.0

    m2

    kg/m10

    /m-kg240023

    h

    L

    sJE

    Another example: viscous damping

    Fkxdt

    dxc

    dt

    xdm

    2

    2

    If mkc 2

    then the analytical solution is

    tn netk

    Ftx

    11

    Set up system of equations

    212

    21

    2

    1

    ym

    cy

    m

    k

    m

    F

    dt

    dy

    y

    dt

    dy

    dt

    dxy

    xy

    with initial conditions

    00

    00

    2

    1

    y

    y

    Run the same three methods as before, and

    compare with analytic solution, given

    m=1

    k=4

    F=1

    Try this yourself