fdm

5
Derivative Boundary Conditions Specied values of the function f are the most common type of boundary conditions (called essential boundary conditions). In many cases, it is also common to specify values of the function derivative (natural boundary conditions). This will require a nite dierence approximation to this derivative. Example 5 Solve the dierential equation d 2 f dx 2 f =0 with boundary conditions f = 0 at x = 0, df /dx = 1 at x = 1, using a xed interval x =1/3.

Transcript of fdm

  • Derivative Boundary Conditions

    Specified values of the function f are the most common type ofboundary conditions (called essential boundary conditions). Inmany cases, it is also common to specify values of the functionderivative (natural boundary conditions). This will require afinite dierence approximation to this derivative.

    Example 5

    Solve the dierential equation

    d2f

    dx2 f = 0

    with boundary conditions f = 0 at x = 0, df/dx = 1 at x = 1,using a fixed interval x = 1/3.

  • Solution

    The central dierence approximation to the dierential equationis of the form:

    f(xi+1) 2f(xi) + f(xi1)h2

    f(xi) = 0

    (h2 + 2)f(xi) + f(xi+1) + f(xi1) = 0

    Applying the above expression at the points x = 1/3 and x =2/3 gives:

    2.1111f(1/3) + f(2/3) = 0

    2.1111f(2/3) + f(1) + f(1/3) = 0

    A backward finite dierence approximation to the derivativeboundary condition at x = 1 gives:

    df

    dx

    x=1

    =f(1) f(2/3)

    1/3= 1

  • f(1) f(2/3) = 1/3

    The above three equations can now be solved for f(1/3), f(2/3)and f(1), producing the result:

    f(1/3) = 0.2477 f(2/3) = 0.5229 f(1) = 0.8563

    The corresponding exact solutions in this case are 0.2200, 0.4648and 0.7616.

    There is an inconsistency in the previous analysis in that thedierential equation has been approximated using central dier-ences, with a truncation error O(h2), while the derivative bound-ary condition was approximated using a backward scheme withtruncation error O(h). This can be made more consistent byhandling the boundary condition in a dierent manner which re-quires the introduction of a fictitious point at a position x = 4/3,with an associated value of f which has no physical significancesince it lies outside the region of interest.

  • Example 6

    Solve the previous problem using a central dierence approxima-tion to the derivative boundary condition.

    Solution

    Applying the central dierence approximation to the dierentialequation at the points x = 1/3, x = 2/3 and x = 1 gives:

    2.1111f(1/3) + f(2/3) = 0

    2.1111f(2/3) + f(1) + f(1/3) = 0

    2.1111f(1) + f(4/3) + f(2/3) = 0

  • A central finite dierence approximation to the derivative bound-ary condition at x = 1 gives:

    df

    dx

    x=1

    =f(4/3) f(2/3)

    2/3= 1

    f(4/3) f(2/3) = 2/3

    The solution of the equation set is now:

    f(1/3) = 0.2168 f(2/3) = 0.4576 f(1) = 0.7493

    The above solution is considerably more accurate than the pre-vious one.