• No results found

Numerical method using cubic B-spline for the heat and wave equation

N/A
N/A
Protected

Academic year: 2021

Share "Numerical method using cubic B-spline for the heat and wave equation"

Copied!
7
0
0

Loading.... (view fulltext now)

Full text

(1)

Contents lists available atSciVerse ScienceDirect

Computers and Mathematics with Applications

journal homepage:www.elsevier.com/locate/camwa

Numerical method using cubic B-spline for the heat and wave equation

Joan Goh

, Ahmad Abd. Majid, Ahmad Izani Md. Ismail

School of Mathematical Sciences, University Sains Malaysia, 11800 Pulau Pinang, Malaysia

a r t i c l e i n f o Article history:

Received 14 April 2011

Received in revised form 10 October 2011 Accepted 10 October 2011 Keywords: Heat equation Wave equation Truncation error Cubic B-spline Interpolation function

a b s t r a c t

In the present paper, the cubic B-splines method is considered for solving one-dimensional heat and wave equations. A typical finite difference approach had been used to discretize the time derivative while the cubic B-spline is applied as an interpolation function in the space dimension. The accuracy of the method for both equations is discussed. The efficiency of the method is illustrated by some test problems. The numerical results are found to be in good agreement with the exact solution.

© 2011 Elsevier Ltd. All rights reserved.

1. Introduction

In 1968, Bickley [1] originated an idea to obtain better accuracy for a linear ordinary differential equation by using a chain of low-order approximation (cubic splines) than a global high-order approximation. Following this, Albasiny and Hoskins [2] applied the cubic spline interpolation which was introduced by Ahlberg et al. [3] to solve a two-point boundary value problem. They obtained a tri-diagonal matrix system instead of upper Hessenberg form which was obtained by Bickley [1]. At about the same time, Fyfe [4] examined the method suggested by Bickley [1] and carried out the error analysis. Fyfe concluded that the spline method is better than the usual finite difference method as the spline method has the flexibility to get the solution at any point in the domain with more accurate results. Thus, it had been of preference to many authors [5–8]. Here, cubic B-splines are used to construct the numerical solutions to solve the problems. Consider a partition of

[

a

,

b

]

that is equally divided by knots xiinto N subinterval

[

xi

,

xi+1

]

, where i

=

0

,

1

, . . . ,

N

1 such that a

=

x0

<

x1

< · · · <

xN

=

b.

Hence, an approximation uji to the exact solution u

(

x

,

t

)

at the point

(

xi

,

tj

)

based on the collocation approach can be

expressed as [9] uji

=

N+1

i=−1 CijB3,i

(

x

)

(1)

where Cijare time dependent quantities to be determined and B3,i

(

x

)

are third-degree B-spline functions which are defined

by the relationship [10] B3,i

(

x

) =

1 6h3

(

x

xi−2

)

3

,

x

∈ [

xi−2

,

xi−1

]

h3

+

3h2

(

x

xi−1

) +

3h

(

x

xi−1

)

2

3

(

x

xi−1

)

3

,

x

∈ [

xi−1

,

xi

]

h3

+

3h2

(

xi+1

x

) +

3h

(

xi+1

x

)

2

3

(

xi+1

x

)

3

,

x

∈ [

xi

,

xi+1

]

(

xi+2

x

)

3

,

x

∈ [

xi+1

,

xi+2

]

(2) ∗Corresponding author.

E-mail address:joangoh.usm@gmail.com(J. Goh).

0898-1221/$ – see front matter©2011 Elsevier Ltd. All rights reserved.

(2)

Table 1 Values of Bi,Biand B ′′ i. xi−2 xi−1 xi xi+1 xi+2 Bi 0 16 4 6 1 6 0 Bi 0 1 2h 0 − 1 2h 0 B′′ i 0 1 h2 − 2 h2 1 h2 0

where h

=

(

b

a

)/

N. To obtain the approximations of the solutions, the values of B3,i

(

x

)

and its derivatives at the knots are

needed. Since the values vanish at all other knots, they are omitted fromTable 1.

In this paper, the one-dimensional heat and wave equations are solved by a combination of the finite difference approach and cubic B-spline method. A typical finite difference scheme is applied to discretize the time derivative while cubic B-spline is used to interpolate the solutions at time t. The error analysis of the method is described. The approximated solutions and the numerical errors are presented and compared with analytical solutions.

2. Governing equation and numerical methods 2.1. Heat equation

The heat equation describes the variation temperature in a given region over a period of time. Suppose the heat flows through a thin rod which is perfectly insulated, its position in the rod is denoted as x. Let u

(

x

,

t

)

represent the temperature at point x during time t. Then, the partial differential equation can be written as [11]

ut

=

α

uxx

,

a

x

b

,

t

0 (3)

where

α >

0, denotes the thermal diffusivity of the rod. The approximations of the solutions of Eq.(3)at tj+1th time level

can be considered by [12]

(

ut

)

ji

=

θ

f j+1 i

+

(

1

θ)

f j i (4)

where 0

θ ≤

1

,

fij

=

α(

uxx

)

ji and the superscripts j and j

+

1 are successive time levels and j

=

0

,

1

,

2

, . . .

. Now,

discretizing the time derivative by a first order accurate forward difference scheme and rearranging the equation, we obtain

uji+1

θ

1tfij+1

=

uji

+

(

1

θ)

1tfij (5)

where1t is the time step. Note that the system becomes an explicit scheme when

θ =

0, a fully implicit scheme when

θ =

1 and a mixed scheme of Crank–Nicolson when

θ =

0

.

5 [12]. Here, the Crank–Nicolson approach is used. Hence, Eq.(5)

takes the form

uji+1

0

.

51tfij+1

=

uji

+

0

.

51tfij (6)

for i

=

0

,

1

, . . . ,

N at each level of time. 2.2. Wave equation

The propagation of a waves with speed

β

in one-dimensional is in the form of [11]

utt

=

β

2uxx

.

(7)

By using the central difference scheme for the time derivative, the wave displacement, u at time t

=

tj+1can be

approxi-mated as

2uji+1

1t2gij+1

=

4uji

+

1t2gij

2uji−1 (8) where gij

=

β

2

(

u

xx

)

jiand i

=

0

,

1

, . . . ,

N. Once the initial vector C0has been calculated from the initial conditions [13], the

approximation solution uji+1at each level of time tj+1can be determined by solving the recurrence system repeatedly.

3. Error analysis 3.1. Truncation error

Suppose S

(

x

)

is the cubic B-spline interpolating u

(

xi

,

tj

)

at the jth time level, then by collocation approach [9] S

(

x

) =

N+1

i=−1

(3)

Thus, the approximation at the point, xican be simplified to

S

(

xi

) =

Ci−1Bi−1

(

xi

) +

CiBi

(

xi

) +

Ci+1Bi+1

(

xi

) ≈

u

(

xi

),

(10a)

and we can easily get

Sx

(

xi

) =

Ci−1Bi′−1

(

xi

) +

CiBi

(

xi

) +

Ci+1Bi+1

(

xi

) ≈

ux

(

xi

),

(10b) Sxx

(

xi

) =

Ci−1B′′i−1

(

xi

) +

CiB′′i

(

xi

) +

Ci+1B′′i+1

(

xi

) ≈

uxx

(

xi

),

i

=

0

,

1

,

2

, . . . ,

N

.

(10c)

By substituting the blending function(2)into Eqs.(10a)–(10c), we have

S

(

xi

) =

1 6

Ci−1

+

2 3

Ci

+

1 6

Ci+1 Sx

(

xi

) =

1 2h

Ci−1

+

1 2h

Ci+1 Sxx

(

xi

) =

1 h2

Ci−1

+

2 h2

Ci

+

1 h2

Ci+1

.

Then, the following relationships can be obtained:

h



1 6

Sx

(

xi−1

) +

2 3

Sx

(

xi

) +

1 6

Sx

(

xi+1

)

=

1 2[S

(

xi+1

) −

S

(

xi−1

)

] (11a) h2Sxx

(

xi

) =

6 [S

(

xi+1

) −

S

(

xi

)

]

2h [2Sx

(

xi

) +

Sx

(

xi+1

)

]

.

(11b)

By using the operator notation E

(

S

(

xi

)) =

S

(

xi+1

)

, Eq.(11a)can be written as [14]

h



1 6

E−1

+

2 3

+

1 6

E

Sx

(

xi

) =

1 2

E

E−1

u

(

xi

).

(12)

Since E

=

ehDwhere D

d

/

dx, notation E can be written in the expansion form of powers hD, and we can get ehD

+

ehD

=

2

1

+

h 2D2 2

!

+

h4D4 4

!

+

h6D6 6

!

+ · · ·

ehD

ehD

=

2

hD

+

h 3D3 3

!

+

h5D5 5

!

+

h7D7 7

!

+ · · ·

.

Therefore, the above Eq.(12)can be expressed as [14]

h

2 3

+

1 3

1

+

h 2D2 2

!

+

h4D4 4

!

+

h6D6 6

!

+ · · ·



Sx

(

xi

) =

hD

+

h 3D3 3

!

+

h5D5 5

!

+

h7D7 7

!

+ · · ·

u

(

xi

)

or

1

+

1 3

h2D2 2

!

+

h4D4 4

!

+

h6D6 6

!

+ · · ·



Sx

(

xi

) =

D

+

h 2D3 3

!

+

h4D5 5

!

+

h6D7 7

!

+ · · ·

u

(

xi

).

And, it can be simplified into

Sx

(

xi

) =

D

+

h 2D3 3

!

+

h4D5 5

!

+ · · ·

 

1

+

h2D2 6

+

h4D4 72

+

h6D6 2160

+ · · ·



−1 u

(

xi

)

=

D

+

h 2D3 3

!

+

h4D5 5

!

+ · · ·

 

1

h2D2 6

+

h4D4 72

+

h6D6 2160

+ · · ·

+

h2D2 6

+

h4D4 72

+ · · ·

2

+ · · ·

u

(

xi

)

=

D

+

h 2D3 3

!

+

h4D5 5

!

+ · · ·

 

1

h 2D2 6

+

h4D4 72

h6D6 2160

− · · ·

u

(

xi

)

=

D

h 4D5 180

+

h6D7 1512

− · · ·

u

(

xi

).

(4)

Hence, Sx

(

xi

) =

ux

(

xi

) −

1 180

h4uxxxxx

(

xi

) +

O

(

h6

).

(13a)

By using the same approach for Eq.(11b), we can derive

Sxx

(

xi

) =

uxx

(

xi

) −

1 12

h2uxxxx

(

xi

) +

1 360

h4uxxxxxx

(

xi

) +

O

(

h6

).

(13b)

3.2. Truncation error of heat equation

For the uniform interior point of cubic B-spline interpolation, the second spatial derivative, Sxx at point xi can be

estimated as

(

Sxx

)

i

=

(

uxx

)

i

1 12

h2

(

uxxxx

)

i

+

1 360

h4

(

uxxxxxx

)

i

+

O

(

h6

).

(14)

As the time derivative of the heat equation is discretized by the finite difference approach, the associated truncation error can be found as a typical finite-difference formulation. Consider [15]

ut

=

f

(

x

,

t

)

(15)

with

uij+1

=

uji

+

1t

θ

fij+1

+

(

1

θ)

fij

 .

(16) Applying Taylor series expansion about

(

j

+

θ)

1t to Eq.(16)and rearranging the equation leads to

(

ut

)

i

=

fi

1

2

θ

2

1tft

+

6

θ −

6

θ

2

1 6

1t2ftt

+ · · ·

.

(17)

Thus, the truncation error which is defined as ei

=

ut

α

uxx, can be estimated as ei

=

2

θ −

1 2

1tutt

+

α

1 12h 2

uxxxx

+

O

(

1t2

,

h4

).

(18)

We found that ei

=

O

(

1t

) +

O

(

h2

)

and since in our case,

θ =

0

.

5 it reduces to O

(

1t2

) +

O

(

h2

)

. By using Von Neumann’s

method, it can be proved that this presented scheme for the heat problem is unconditionally stable [16].

3.3. Truncation error of wave equation

By using the same approach as above, uttat point xican be approximated as

(

utt

)

i

=

fi

+

θ

1tft

+

6

θ −

12

θ

2

1 12

1t2ftt

+

O

(

1t3

).

(19)

Hence, the truncation error is given by

ei

=

θ

1tuttt

+

α

2

1 12h 2

uxxxx

+

O

(

1t2

,

h4

).

(20)

Thus, it is O

(

1t

) +

O

(

h2

)

accurate for the wave equation. We summarize our results as follows:

Theorem. By using the combination of the finite difference approximation and cubic B-spline method,

(i) the truncation error for the heat equation is O

(

1t2

) +

O

(

h2

)

,

(ii) the truncation error for the wave equation is O

(

1t

) +

O

(

h2

)

.

4. Numerical experiment 4.1. Test 1

Suppose the one-dimensional heat equation is as below [17,18]

ut

=

1

π

2uxx 0

<

x

<

1

,

t

>

0

with initial and boundary conditions

u

(

x

,

0

) =

sin

x

)

u

(

0

,

t

) =

u

(

1

,

t

) =

0

.

(5)

(a) h=1/16,T=2. (b) h=1/16,T=5.

(c) h=1/20,T=2. (d) h=1/20,T=5.

Fig. 1. The comparison of the errors in the numerical solutions for Test 1 with analytical solution at the last time step(1t=0.01).

The exact solution is known to be u

(

x

,

t

) =

exp

(−

t

)

sin

x

)

. This problem is tested by different values of the step size in the x-direction (h) and last time step (T ) with the time step size as a constant (1t

=

0

.

01).Fig. 1shows the numerical errors between cubic B-spline (CuBS) method and the well-known forward time centered space (FTCS) approach compared to the analytical solution, for the cases N

=

16 and N

=

20. Comparisons are made for the time, T

=

2 and T

=

5.

Fig. 2depicts the maximum absolute errors obtained at each time step for the FTCS approach and also CuBS formulation with1t

=

0

.

01 and h

=

0

.

05. The errors of the CuBS scheme are smaller than those obtained by the FTCS scheme at every time step. It should be noted that the space and time step sizes need to be adjusted such that the stability requirement for the FTCS scheme is satisfied.

4.2. Test 2

Consider the one-dimensional wave equation in the form [19]

utt

=

uxx

,

0

x

1

,

t

0

subject to the initial and boundary conditions

u

(

x

,

0

) =

cos

x

),

ut

(

x

,

0

) =

0 u

(

0

,

t

) =

cos

t

),

1

0

u

(

x

,

t

)

dx

=

0

.

The exact solution is known as u

(

x

,

t

) =

12

(

cos

(π(

x

+

t

))+

cos

(π(

x

t

)))

. Absolute errors obtained for time step1t

=

0

.

01 and the various space steps at the final time T

=

5 are tabulated inTable 2. It can be seen that the solutions become more accurate with the smaller space steps.Fig. 3illustrates the space–time graph of the approximated solution for this problem over a time period, t

∈ [

0

,

5

]

along x.

(6)

Fig. 2. Maximum absolute errors of FTCS and CuBS schemes at each time step for Test 1 by using1t=0.01 and h=0.05.

Fig. 3. Space–time graph for Test 2 with h=1t=0.02 and T=5.

Table 2

Numerical errors at the grid points for various mesh sizes with1t=0.01 at T=5.

x Exact value h=0.1 h=0.02 h=0.01 0.1 −0.95106 1.96×10−3 1.39×10−4 7.97×10−5 0.2 −0.80902 2.87×10−3 2.09×10−4 1.21×10−4 0.3 −0.58779 2.69×10−3 1.99×10−4 1.15×10−4 0.4 −0.30902 1.60×10−3 1.19×10−4 6.88×10−5 0.5 0.00000 3.45×10−13 6.18×10−14 2.03×10−13 0.6 0.30902 1.60×10−3 1.19×10−4 6.88×10−5 0.7 0.58779 2.69×10−3 1.99×10−4 1.15×10−4 0.8 0.80902 2.87×10−3 2.09×10−4 1.21×10−4 0.9 0.95106 1.96×10−3 1.39×10−4 7.97×10−5

(7)

5. Conclusions

A numerical method incorporating a finite difference scheme with cubic B-spline had been described in the previous section for solving one-dimensional heat and wave equations. A usual difference scheme approach had been applied to discretize the time derivative and cubic B-spline had been used to interpolate the solutions at each level of time. From the heat problem, the obtained results show that the cubic B-spline give better solutions than the typical finite difference approach with smaller space steps. However, it can be found that both solutions are well approximated. The advantage of using the cubic B-spline method is that it can give the solutions at any intermediate point in the space direction. In conclusion, the cubic B-spline method is capable of solving one-dimensional heat and wave equations accurately.

References

[1] W.G. Bickley, Piecewise cubic interpolation and two-point boundary problems, The Computer Journal 11 (2) (1968) 206–208.

[2] E.L. Albasiny, W.D. Hoskins, Cubic spline solutions to two-point boundary value problems, The Computer Journal 12 (2) (1969) 151–153. [3] J.H. Ahlberg, E.N. Nilson, J.L. Walsh, The Theory of Splines and their Applications, Academic Press, 1967.

[4] D.J. Fyfe, The use of cubic splines in the solution of two-point boundary value problems, The Computer Journal 12 (2) (1969) 188–192.

[5] E.A. Al-Said, The use of cubic splines in the numerical solution of a system of second-order boundary value problems, Computers & Mathematics with Applications 42 (6–7) (2001) 861–869.

[6] S. Jator, Z. Sinkala, A high order B-spline collocation method for linear boundary value problems, Applied Mathematics and Computation 191 (1) (2007) 100–116.

[7] C.G. Zhu, W.S. Kang, Numerical solution of Burgers–Fisher equation by cubic B-spline quasi-interpolation, Applied Mathematics and Computation 216 (9) (2010) 2679–2686.

[8] C.G. Zhu, R.H. Wang, Numerical solution of Burgers’ equation by cubic B-spline quasi-interpolation, Applied Mathematics and Computation 208 (1) (2009) 260–272.

[9] P.M. Prenter, Splines and Variational Methods, John Wiley & Sons, 1989. [10] C. de Boor, A Practical Guide to Splines, Springer-Verlag, 1978.

[11] R.L. Burdern, J.D. Faires, Numerical Analysis, eighth ed., Brooks Cole, 2004.

[12] I. Dag, D. Irk, B. Saka, A numerical solution of the Burgers’ equation using cubic B-splines, Applied Mathematics and Computation 163 (1) (2005) 199–211.

[13] J. Goh, A.A. Majid, A.I.M. Ismail, A numerical solution of one-dimensional wave equation using cubic B-splines, in: Proceedings of National Conference of Application Science and Mathematics SKASM, December 2010, pp. 117–122.

[14] S.S. Sastry, Introductory Methods of Numerical Analysis, fourth ed., PHI Learning, 2009.

[15] S.G. Rubin, R.A. Graves Jr., Viscous flow solutions with a cubic spline approximation, Computers & Fluids 3 (1) (1975) 1–36.

[16] J. Goh, A.A. Majid, A.I.M. Ismail, A comparison of some splines-based methods for the one-dimensional heat equation, Proceedings of World Academy of Science, Engineering and Technology 70 (2010) 858–861.

[17] A. Mohebbi, M. Dehghan, High-order compact solution of the one-dimensional heat and advection–diffusion equations, Applied Mathematical Modelling 34 (10) (2010) 3071–3084.

[18] H.W. Sun, J. Zhang, A high-order compact boundary value method for solving one-dimensional heat equations, Numerical Methods for Partial Differential Equations 19 (6) (2003) 846–857.

[19] F. Shakeri, M. Dehghan, The method of lines for solution of the one-dimensional wave equation subject to an integral conservation condition, Computers & Mathematics with Applications 56 (9) (2008) 2175–2188.

References

Related documents

The absence of clear data control policies will result in confusion, both for the police and the public, about who has access to see, share, and delete data produced

hydrodynamic model necessary for interpretation of results of their spectral analysis in terms of geophysical hydrodynamics. one horizon), taking into account the

Phaco 2015 Capsulorhexis - Curved/Sharp Capsulorhexis - Straight/Sharp Capsulorhexis - X-Action/Curved Capsulorhexis - X-Action/Curved/Sharp Capsulorhexis - Curved Capsulorhexis

(1) when Ravi is in neglected stage in Tula (Libra) &amp; Vrishab (Taurus) like wise if it is in enemy territory then the enemies of Ravi i.e., Shukra (Venus) and Shani(Saturn)

5.8 Pore-Water Pressure-Measurement Device—The speci- men pore-water pressure shall also be measured to the toler- ances given in 5.6. During undrained shear, the pore-water

Previous studies have reported on isolated human dental stem cells, and among the stem cells, dental pulp stem cell (DPSC) is commonly used in stem cells research.. 14 DPSC showed

Investigators: Relationship between ivabradine treatment and cardiovascular outcomes in patients with stable coronary artery disease and left ventricular systolic dysfunction