Download as pdf or txt
Download as pdf or txt
You are on page 1of 13

Applied Mathematics and Computation 171 (2005) 358–370

www.elsevier.com/locate/amc

Solution of two point boundary


value problems using orthogonal
collocation on finite elements
Shelly Arora, S.S. Dhaliwal, V.K. Kukreja *

Department of Mathematics, Sant Longowal Institute of Engineering and Technology,


Longowal, Punjab 148106, India

Abstract

A convenient computational algorithm to solve boundary value problems (BVP)


using orthogonal collocation on finite elements (OCFE) is presented. The algorithm is
the conjunction of finite element method (FEM) and orthogonal collocation method
(OCM). OCM discretize BVPÕs conveniently where as FEM provides accuracy to the
solution. The method is applied to the boundary value problems having mixed RobbinÕs
and DirichletÕs boundary conditions. The numerical results are compared with the ana-
lytic solution.
 2005 Elsevier Inc. All rights reserved.

Keywords: Orthogonal collocation on finite elements; DirichletÕs boundary conditions; Mixed


RobbinÕs boundary conditions

*
Corresponding author.
E-mail address: vkkukreja@lycos.com (V.K. Kukreja).

0096-3003/$ - see front matter  2005 Elsevier Inc. All rights reserved.
doi:10.1016/j.amc.2005.01.049
S. Arora et al. / Appl. Math. Comput. 171 (2005) 358–370 359

1. Introduction

Basically in OCM an unknown function y(x) is considered, which satisfies


the differential equation LV(y) = 0 with boundary conditions LB(y) = 0, where
B is the boundary adjoining the volume V. An unknown trial function yN is
used to discretize the dependent variable y. This unknown trial function yN
is represented by a series of orthogonal polynomials and the residual is defined
by LV(yN) and LB(yN) over its region.
Villadsen and Stewart [1] have used the matrix Q with ½1 xi x2i    xNi  as its
ith row to construct the discretization matrices A and B. Q1 is post multiplied
with the matrices containing the first and second order derivatives of the mono-
mials xk to give A and B. This procedure is convenient but Q becomes nearly
singular for large N and the matrices A and B match poorly with the colloca-
tion abscissa x. For large N the matrices A and B can be found, without matrix
manipulations, by using Lagrangian interpolation polynomial [2].
In OCFE the whole domain is divided into small subdomains of finite length
Dx, called elements. Then the orthogonal collocation is applied with in each ele-
ment. In this process it is mandatory that the trial function and its first derivative
should be continuous at the nodal points or the boundaries of the elements. OCFE
was first proposed by Patterson and Cresswell [3]. Carey and Finlayson [4] have
used this technique for solving effectiveness factor problem for large Thiele mod-
ulus. Ma and Guiochon [5] have used OCFE for calculation of chromatographic
elution band profiles for different components. Onah [6] has checked the asymp-
totic behavior of parabolic PDEÕs using finite element collocation method. Liu
and Jacobsen [7] have carried out the bifurcation analysis of heat integrated fixed
bed reactor by reducing the order of distributed model using OCFE.
OCFE may be considered as an extension to the double collocation method
proposed by Villadsen and Sorenson [8]. In the double collocation method the
time domain is divided into small subdomains of length Dt and OCM is applied
in each subdomain to integrate from tf to tf+1 but in case of nonlinear equations
the algebraic equations involve terms only in one of the Dt and not for large t.
In OCFE the time variable is replaced by the space variable x and the solution
at x = 1 influences the solutions even at small values at x. Thus the differential
algebraic equations for an element Dx are coupled with those of all the other
elements. The computer programs are much simpler to develop for the colloca-
tion equations, written in terms of the solutions at the collocation points or
grid points. The accuracy in case of OCFE is higher than OCM but at the cost
of computation time.
The present work highlights the features of OCFE to solve a two point
boundary value problem of the form:
o2 c oc oc
b1 þ b2 ¼ b3 ; x 2 ð0; 1Þ ð1Þ
ox2 ox ot
360 S. Arora et al. / Appl. Math. Comput. 171 (2005) 358–370

with boundary conditions as:

oc
a 1 c þ a2 ¼ k1 at x ¼ 0; ð2aÞ
ox
oc
a 3 c þ a4 ¼ k2 at x ¼ 1: ð2bÞ
ox

The method of orthogonal collocation has been used widely for two point
boundary value problems. Most of the investigators [1,4,8,9] have discussed
the initial and boundary value problems for the zeros of Jacobi polynomials
with a = b = 0.

2. Discretized function representation


PN
The trial function expansion is y N ðx; tÞ ¼ i¼0 ai ðtÞP i ðxÞ; where yN is the Nth
order approximation of y and Pi(x) are the orthogonal polynomials, orthogo-
nal with respect to the weight function W(x) such that:
Z 1
hP N ðxÞ; P M ðxÞiW ¼ P N ðxÞP M ðxÞW ðxÞ dx:
0

The polynomial Q P1N(x) can be arranged as an interpolating polynomial


wðxÞ ¼ xð1  xÞ Nj¼1 ðx  xj Þ; where xjÕs are the zeros of the orthogonal polyno-
mial PN(x), x1 = 0 and xN+1 = 1. Lagrangian interpolation formula using w(x)
as node polynomial is:
X
N þ1
y N ðxÞ ¼ li ðxÞyðxi Þ; ð3Þ
i¼1

where li(x) = w(x)/[(x  xi)w 0 (xi)].

2.1. Discrete differentiation operations

The interpolating polynomial yN(x) is differentiated to obtain accurate and


discrete differentiation of quadrature arrays. The kth order derivative of the
Lagrangian interpolation polynomial (3) is given by:
X
N þ1
ðkÞ
y N ðkÞ ðxÞ ¼ li ðxÞyðxi Þ: ð4Þ
i¼1

The formulae for derivatives of the trial functions are valid for all xi;
i = 1, 2, . . . , N + 1 as Lagrangian interpolation polynomial are continuous and
differentiable.
S. Arora et al. / Appl. Math. Comput. 171 (2005) 358–370 361

In a discrete ordinate formulation, differentiation is a matrix operation. The


first and second order derivatives at the jth collocation point can be written as:
dy N d2 y N
¼ Ay and ¼ By; ð5Þ
dx dx2
where A ¼ Aij ¼ l0i ðxj Þ and B ¼ B ij ¼ l00i ðxj Þ; i = 1, 2, . . . , N + 1. The elements in
each array at the jth collocation point can be computed by the following recur-
rence formula:
h i
ðkÞ ðk1Þ
wðkÞ ðxj Þ ¼ w0 ðxi Þ li ðxj Þðxj  xi Þ þ kli ðxj Þ : ð6Þ

For i = j first and second order derivatives of li(x) are obtained by substituting
k = 2 and 3, respectively, in equation (6), i.e.,
l0i ðxj Þ ¼ w00 ðxj Þ=2w0 ðxj Þ and l00i ðxj Þ ¼ w000 ðxj Þ=3w0 ðxj Þ: ð7Þ
For i 5 j these derivatives are obtained by putting k = 1 and 2, respectively, in
equation (6):

w0 ðxj Þ w00 ðxj Þ 2l0 ðxj Þ


l0i ðxj Þ ¼ 0 and l00i ðxj Þ ¼ 0  i : ð8Þ
w ðxi Þðxj  xi Þ w ðxi Þðxj  xi Þ ðxj  xi Þ

The discretization matrices A and B can be computed only when the derivatives
of different order of w(x) at xj are known. The formulae for finding different
derivatives of w(xj) are:
!
0
XN þ1
1 Y
N þ1
w ðxÞ ¼ ðx  xi Þ ; ð9aÞ
m ¼1
ðx  xm1 Þ i¼1
1

( !)
X
N þ1
1 X
N þ1
1 Y
N þ1
w00 ðxÞ ¼ 2! ðx  xi Þ ;
ðx  xm2 Þ m1 ¼1
ðx  xm1 Þ i¼1 ð9bÞ
m2 ¼ 1
m2 6¼ m1
8 9
>
> ( !)>
>
X
N þ1 >
< X
N þ1 X
N þ1 Y
N þ1 >
=
1 1 1
w000 ðxÞ ¼ 3! ðx  xi Þ :
ðx  xm3 Þ >
> ðx  xm2 Þ m ¼1 ðx  xm1 Þ i¼1 >
>
m3 ¼ 1 >
: m2 ¼ 1 1 >
;
m3 6¼ m2 ;m1 m2 6¼ m1

ð9cÞ

2.2. Collocation points and quadrature weights

The discretization end points are fixed as u1 = 0 and uN+1 = 1. The zeros of
shifted Chebyshev polynomials have been used as collocation points, because
362 S. Arora et al. / Appl. Math. Comput. 171 (2005) 358–370

these polynomials have the tendency to keep the error down to a minimum [10]
and yield satisfactory results for the unsymmetrical BVPÕs. The collocation
points are obtained by mapping the computational domain of the interval
[1, 1] to [0, 1] with the help of following relationship:
rj 1
uN þ2j ¼ þ ; ð10Þ
2 2
where rj is the jth collocation point in the interval [1, 1]. The N + 1 interpola-
tion points are chosen to be the extreme values of an Nth order shifted Cheby-
shev polynomial
pðj  1Þ
rj ¼ cos ; j ¼ 1; 2; . . . ; N þ 1:
N
The quadrature abscissa weights wi are calculated using the formula given by
[2,11].

3. Description of the method

The domain 0 6 x 6 1 is divided into small sub intervals by placing the


dividing points at x‘ where ‘ = 1, 2, 3, . . . , n + 1 with x1 = 0 and xn+1 = 1 for
the two point BVP represented by Eqs. (1)–(2b). Within each element a new
x  x‘
variable u is introduced as u ¼ such that as x varies from x‘ to x‘+1,
x‘þ1  x‘
u varies from 0 to 1. By applying the orthogonal collocation directly on u with
in each element, one gets the collocation equations in terms of the solutions at
the collocation points. For ‘th element the following set of equations is
obtained:
dc‘ 1 d2 c‘ 1 dc‘
¼ 2
 ; ð11aÞ
dt P Dx‘ du2 Dx‘ du

a2 dc1
a1 c1 þ ¼ k1 at x ¼ 0; ð11bÞ
Dx1 du

a4 dcn
a3 cn þ ¼ k2 at x ¼ 1: ð11cÞ
Dxn du
Since the function and its first derivative must be continuous at the boundary
of the elements, therefore,
c‘ ¼ c‘þ1 ; ð12aÞ

1 dc‘ 1 dc‘þ1
¼ : ð12bÞ
Dx‘ du Dx‘þ1 du
S. Arora et al. / Appl. Math. Comput. 171 (2005) 358–370 363

The detailed set of equation with application of orthogonal collocation method


within each element is presented in Appendix A. Block diagonal matrix struc-
ture for OCFE is given in Fig. 8.
The combined set of equations can be written as DC = MC; where the ma-
trix M on the right-hand side represents the coefficient matrix of the collocation
solutions c‘i , the matrix C represents the unknown solution values at the collo-
cation points and the element end points and the matrix DC represents the time
derivatives of c‘i . The relation between the global and local solutions at the col-
location points is defined as:

CðN ð‘  1Þ þ iÞ ¼ c‘i ; where ‘ ¼ 1; 2; 3; . . . ; n


and i ¼ 1; 2; 3; . . . ; N þ 1: ð13Þ

4. Convergence criterion

When the domain is divided into n elements with each element consisting of
N  1 interior collocation points, a set of (nN) + 1 coupled differential
algebraic equations (DAE) appear. The set of coupled DAEÕs is solved using
MATLAB with ode15s subroutine. The subroutine uses backward differentia-
tion formula to solve the system of equations. The convergence of the method
for steady state is checked by the following formula:
2
L ¼ ðDx‘ Þ kM 1 kC with kLk < 1: ð14Þ

Since for large values of P, as considered in Sections 6.1 and 6.2, the value of C
increases, therefore the value of Dx‘ should be small enough to make kLk < 1,
thus more elements should be inserted. With the increase in number of elements
the method converges asymptotically [6,8].

5. Error calculation

The relative error is calculated using the formula CexCC


ex
nm
, where Cex is the
analytic value obtained by conventional method like Laplace transforms and
Cnm is the numerical value calculated using OCFE. The graphs are plotted
for different number of elements. It is observed that with the increase in the
number of elements the relative error decreases very sharply. It is also observed
that with the increase in the number of collocation points within each element,
the method gives accurate results even for small number of elements. The dis-
cretization error is proportional to (Dx)2, where Dx = 1/n, for collocation
points distributed uniformly within each element.
364 S. Arora et al. / Appl. Math. Comput. 171 (2005) 358–370

6. Numerical examples

The technique of OCFE is applied on two transport problems of a packed


bed reactor. First involves mixed boundary conditions and second is based
on DirichletÕs boundary conditions.

6.1. Problem 1

Consider a diffusion reaction problem with mixed boundary conditions as:


oC 1 o2 C oC
¼  ; ð15Þ
ot P ox2 ox
1 oC
C ¼0 at x ¼ 0; for all t P 0; ð16Þ
P ox
oC
¼0 at x ¼ 1; for all t P 0; ð17Þ
ox
C¼1 at t ¼ 0; for all x: ð18Þ
The problem is solved using the method of OCFE. From Fig. 1 it is clear that
at outer boundary layer, i.e., at x = 1 the solution profiles are very steep for
small values of P and the results obtained from OCFE exactly matches with
the analytic ones of [13]. The main reason is that for small value of P the trans-
port by axial dispersion becomes stronger than the convective transport and
the each differential element of the solution introduced into the bed instanta-
neously mixes with the bed and vice versa. As the value of P increases the solu-

1.0
P=0 analytical
P=0 OCFE
P=10 analytical
0.8 P=10 OCFE
P=40 analytical
P=40 OCFE
0.6
C

0.4

0.2

0.0
0.0 0.5 1.0 1.5 2.0
Time

Fig. 1. Comparison of analytic and numerical values calculated by using OCFE for different values
of P.
S. Arora et al. / Appl. Math. Comput. 171 (2005) 358–370 365

tion profiles follow a Gaussian curve. The solution profile for large values of P
was obtained by introducing more than 20 elements in the spatial domain as
compared to the small values of P where the solution profiles were obtained
only for 5–7 elements.
Fig. 2 shows the relative error for different values of P. When P = 8, mag-
nitude of the relative error is less than 1.5 · 104, but for large values of,
i.e., P = 40 it is 6.02 · 104 for 20 elements. The relative error decreases by
increasing the number of elements, e.g., for P = 40, 15% error was observed
in case of five elements which changes to 0.05% approximately if 25 elements
are taken instead of five. Fig. 3 gives the relation between relative error and
number of elements for P = 40. When the number of elements is 14, the mag-
nitude of the relative error is approximately 2.3 · 103 which decreases upto
4.85 · 104 for 25 elements. Therefore, in order to reduce the relative error
the number of elements must be increased.
Various investigators [4,5,7] have followed the OCFE but none of them have
considered the effect of collocation points on the solution profiles. For P = 80
and number of elements 17 the relative error with respect to analytic solutions
is compared for five and nine collocation points (Fig. 4). However, in case of
nine collocation points the number of equations increases as compared to
the five collocation points but this increment in the computation time is com-
pensated by the reduction in the magnitude of relative error. The main reason
of the fluctuation of the results in case of five collocation points is that the dif-
ference between two consecutive collocation points is very large near the cor-
ners causing fluctuation in the solution profile at the outlet. As the degree of
the approximation increases over nine, the need of additional collocation

0.0004

0.0002

0.0000
Relative Error

0.0 0.5 1.0 1.5 2.0


-0.0002

-0.0004

-0.0006
For P=8

For P=40
-0.0008
Time

Fig. 2. Comparison of error for P = 8 and 40.


366 S. Arora et al. / Appl. Math. Comput. 171 (2005) 358–370

0.005

0.000
0.0 0.5 1.0 1.5 2.0
-0.005
Relative Error

-0.010

-0.015

For n=14
-0.020
For n=17
For n=25
-0.025
Time

Fig. 3. Comparison of error for different number of elements.

0.004

0.000
0.0 0.5 1.0 1.5 2.0
Relative Error

-0.004

-0.008

-0.012
For N=5
For N=9
-0.016
Time

Fig. 4. Comparison of error for five and nine collocation points with 17 elements.

points required for higher degree polynomials becomes less important since no
significant change in the results is observed.

6.2. Problem 2

The diffusion reaction problem represented by Eq. (15) is also solved for
DirichletÕs boundary conditions, i.e., C = 0 at x = 0, for all t P 0. The solution
profile has steep gradients near the boundary. In this case, the system of equa-
tions is solved by taking seven interior collocation points within each element
for large values of parameter. For 10 or more elements the results are matching
exactly with the analytic ones of [14] for P P 40.
S. Arora et al. / Appl. Math. Comput. 171 (2005) 358–370 367

0.003

0.002

0.001
Relative Error

0.000
0.0 0.5 1.0 1.5 2.0
-0.001

-0.002
For P=40
For P=100
-0.003
Time

Fig. 5. Relative error for P = 40 and P = 100 for 15 elements.

Fig. 5 shows the relative error for P = 40 and 100 for 15 number of elements.
For P > 100 the method gives convincing results for 19 elements. Since for
large values of P the effect of convective transport becomes negligible, which
makes the system of equations stiffer and therefore more elements are intro-
duced. Fig. 6 shows the comparison of the error for P = 40 for different number
of elements varying from 7 to 17. The magnitude of error is 4 · 104 approx-
imately for seven numbers of elements which reduces upto 3.25 · 105 for 17
numbers of elements. Therefore, a sufficient accuracy for the numerical solu-
tions can be obtained by increasing the number of elements. However, in such
a situation computation time also increases.

0.00015

0.00000
0.0 0.5 1.0 1.5 2.0
Relative Error

-0.00015

-0.00030
For n=7

For n=10

For n=17
-0.00045
Time

Fig. 6. Relative error for different number of elements for P = 40.


368 S. Arora et al. / Appl. Math. Comput. 171 (2005) 358–370

8.0
For OCFE
For OCM

Percentage Error 6.0

4.0

2.0

0.0
0.0 0.5 1.0 1.5

-2.0
Time

Fig. 7. Percentage error of OCM and OCFE with respect to analytic solution.

The problem has also been solved by different investigators [3,4,9,10,12] by


using OCM. It is observed that for the limiting case when P ! 1, OCM does
not give good result even for 500 collocation points [15] whereas in such type of
situations OCFE is giving very fine results. Fig. 7 gives the comparison of per-
centage error with respect to analytic solutions of [14] for OCM and OCFE for
P ! 1. The numerical solutions for OCM fluctuate at the initial stage and
even goes down to negative as the time increases, but results obtained from
OCFE are more accurate as compared to the OCM.

7. Conclusions

The accuracy and compatibility of the FEM makes it convenient to apply


OCM with in the elements of the spatial domain of stiff system of differential
equations. In OCFE, the discretization of the trial function is carried out using
Lagrangian interpolation polynomial. Zeros of the Chebyshev polynomials are
taken as the collocation points since Chebyshev polynomials emphasizes more
at the corners than the center. The effect of single parameter is checked for dif-
ferent number of elements. It is found that OCFE gives accuracy, as compara-
ble to the analytic solutions even for very large values of the parameter. The
method can be extended to two or three physical domains for solving linear
and nonlinear BVPÕs.

Acknowledgments

This work is supported by Council of Scientific and Industrial Research,


New Delhi, India in the form of research project Grant No. 25(0123)/02/
S. Arora et al. / Appl. Math. Comput. 171 (2005) 358–370 369

EMR-II. Ms. Shelly Arora is thankful to CSIR for providing Junior Research
Fellowship F. No. 9/797(3)/2002-EMR-I.

Appendix A

By applying the orthogonal collocation directly on u with in each element,


one gets the collocation equations in terms of the solutions at the collocation
points. For lth element the following set of equations is obtained:
dc‘ 1 d2 c‘ 1 dc‘
¼ 2 2
 :
dt P Dx‘ du Dx‘ du
For lth element and jth interior collocation point the following set of equations
is obtained:
dc‘j 1 X N þ1
1 XN þ1
¼ 2
Bji c‘i  Aji c‘i ; ‘ ¼ 1; 2; . . . ; n; j ¼ 2; 3; 4; . . . ; N ;
dt P Dx‘ i¼1 Dx‘ i¼1

where c‘i ¼ cðu‘i Dx‘ þ x‘ Þ and B and A represents the second and first order
derivatives, respectively. Since the solution profiles and their first derivatives
are assumed to be continuous at the boundaries, the collocation equations
for the boundaries are:
c‘N þ1 ¼ c‘þ1
1 ;

1 XN þ1
1 X N þ1
AN þ1i c‘i ¼ A1i c‘þ1
i :
Dx‘ i¼1 Dx‘þ1 i¼1
The boundary conditions are satisfied as:
X
N þ1 X
N þ1
a1 c11 þ a2 A1i c1i ¼ k 1 and a3 cnN þ1 þ a4 AN þ1i cni ¼ k 2 :
i¼1 i¼1

M D

B.C. at x= 0 ooooooooo
0
xxxxxxxxxx

Continuity Condition ooooooooo

xxxxxxxxxx
0
B.C. at x=1 ooooooooo

Fig. 8. Block diagonal matrix structure for OCFE, the crosses arise after the application of OCM
with in each element. The single column on the right-hand side arises from the time derivatives of
the C and the boxes represented by empty circles are for boundary conditions and continuity
conditions.
370 S. Arora et al. / Appl. Math. Comput. 171 (2005) 358–370

The resulting set of DAEÕs appearing in a block diagonal matrix structure gi-
ven in Fig. 8 is solved using ode15s.

References

[1] J. Villadsen, W.E. Stewart, Solution of boundary value problems by orthogonal collocation,
Chem. Eng. Sci. 22 (1967) 1483–1501.
[2] M.L. Michelsen, J. Villadsen, A convenient computational procedure for collocation
constants, Chem. Eng. J. 4 (1971) 64–68.
[3] W.R. Paterson, D.L. Cresswell, A simple method for the calculation of effectiveness factor,
Chem. Eng. Sci. 26 (1971) 605–616.
[4] G.F. Carey, B.A. Finlayson, Orthogonal collocation on finite elements, Chem. Eng. Sci. 30
(1975) 587–596.
[5] Z. Ma, G. Guiochon, Application of orthogonal collocation on finite elements in the
simulation of non-linear chromatography, Comput. Chem. Eng. 15 (6) (1991) 415–426.
[6] S.E. Onah, Asymptotic behavior of the Galerkin and the finite element collocation methods for
a parabolic equation, Appl. Math. Comput. 127 (2002) 207–213.
[7] W.E. Jacobsen, Yi Liu, On the use of reduced order models in bifurcation analysis of
distributed parameter systems, Comput. Chem. Eng. 28 (2004) 161–169.
[8] J. Villadsen, J.P. Sorensen, Solution of parabolic partial differential equations by a double
collocation method, Chem. Eng. Sci. 24 (1969) 1337–1349.
[9] B.A. Finlayson, The Method of Weighted Residuals and Variational Principles, Academic
Press, New York, 1972.
[10] L.T. Fan, G.K.C. Chen, L.E. Erickson, Efficiency and utility of collocation methods in solving
the performance equations of flow chemical reactors with axial dispersion, Chem. Eng. Sci. 26
(1971) 379–387.
[11] R.A. Adomaitis, Y. Lin, A collocation/quadrature-based Sturm–Liouville problem solver,
Appl. Math. Comput. 110 (2000) 205–223.
[12] J. Villadsen, M.L. Michelsen, Solution of Differential Equation Models by Polynomial
Approximation, Prentice-Hall, Englewood Cliffs, NJ, 1978.
[13] H. Brenner, The diffusion model of longitudinal mixing in beds of finite length. Numerical
values, Chem. Eng. Sci. 17 (1962) 229–243.
[14] L.E. Grahs, Washing of cellulose fibres, Analysis of displacement washing operation, Ph.D.
Thesis, Chalmers University of Technology, Goteborg, Sweden, 1974.
[15] F. Shirashi, Highly accurate solution of the axial dispersion model expressed in S-system
canonical form by Taylor series method, Chem. Eng. J. 83 (2001) 175–183.

You might also like