numerical solution of the system of six coupled nonlinear ... · pdf filenumerical solution of...

19
Applied Mathematical Sciences, Vol. 7, 2013, no. 6, 287 - 305 Numerical Solution of the System of Six Coupled Nonlinear ODEs by Runge-Kutta Fourth Order Method B. S. Desale Department of Mathematics School of Mathematical Sciences North Maharashtra University Jalgaon-425001, India Corresponding author e-mail: bsdesale@rediffmail.com N. R. Dasre Department of Engineering Sciences Ramrao Adik Institute of Technology Nerul, Navi Mumbai-400706, India narendasre@rediffmail.com Abstract In this paper, we have proposed the numerical solutions of the system of six coupled nonlinear Ordinary Differential Equations(ODEs), which are aroused in the reduction of stratified Boussinesq Equation. We have obtained the numerical solutions on unstable and stable manifolds by Runge-Kutta fourth order method. The minimum error in the solution is of the order 10 20 and it increases up to 10 6 for φ, while the minimum error in θ is of the order 10 14 and it increases up to 10 3 . These errors can be reduced by reducing step size. We have coded this programme in C-language. Mathematics Subject Classification: 34A09, 65L05, 65L99. Keywords: Stratified Boussinesq equation, Runge-Kutta Method, Cou- pled Differential Equations, Integrable systems 1 Introduction The stratified Boussinesq equations form a system of Partial Differential Equa- tions (PDEs) modelling the movements of planetary atmospheres. The liter-

Upload: vankhuong

Post on 06-Mar-2018

224 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Numerical Solution of the System of Six Coupled Nonlinear ... · PDF fileNumerical Solution of the System of Six Coupled ... 1 Introduction ... The system of six coupled nonlinear

Applied Mathematical Sciences, Vol. 7, 2013, no. 6, 287 - 305

Numerical Solution of the System of Six Coupled

Nonlinear ODEs by Runge-Kutta

Fourth Order Method

B. S. Desale�

Department of MathematicsSchool of Mathematical SciencesNorth Maharashtra University

Jalgaon-425001, India� Corresponding author e-mail: [email protected]

N. R. Dasre

Department of Engineering SciencesRamrao Adik Institute of TechnologyNerul, Navi Mumbai-400706, India

[email protected]

AbstractIn this paper, we have proposed the numerical solutions of the system

of six coupled nonlinear Ordinary Differential Equations(ODEs), whichare aroused in the reduction of stratified Boussinesq Equation. We haveobtained the numerical solutions on unstable and stable manifolds byRunge-Kutta fourth order method. The minimum error in the solutionis of the order 10−20 and it increases up to 10−6 for φ, while the minimumerror in θ is of the order 10−14 and it increases up to 10−3. These errorscan be reduced by reducing step size. We have coded this programmein C-language.

Mathematics Subject Classification: 34A09, 65L05, 65L99.

Keywords: Stratified Boussinesq equation, Runge-Kutta Method, Cou-pled Differential Equations, Integrable systems

1 Introduction

The stratified Boussinesq equations form a system of Partial Differential Equa-tions (PDEs) modelling the movements of planetary atmospheres. The liter-

Page 2: Numerical Solution of the System of Six Coupled Nonlinear ... · PDF fileNumerical Solution of the System of Six Coupled ... 1 Introduction ... The system of six coupled nonlinear

288 B. S. Desale and N. R. Dasre

ature also refers Boussinesq approximation as Oberbeck-Boussinesq approxi-mation [1]. In this connection of Desale [2] has given the complete analysisof an ideal rotating uniformly stratified system of ODEs. Desale and Sharma[3] have given special solutions for rotating stratified Boussinesq equations.Desale and Dasre [4] have also given solutions to the system.

In this paper, we have implemented Runge-Kutta fourth order method tofind the numerical solution of system (1) passing through the initial values onthe stable and unstable manifolds. We have discussed the implementation ofthis method in the section 3. We have given codes for the solution on stableand unstable manifolds of invariant surface which is obtained by four firstintegrals.

2 Preliminary Notes

Shrinivasan et al [5] have tested the system (1) as given below for completeintegrability. Also Desale and Shrinivasan [6] have obtained singular solutionsof the same system. The system of six coupled nonlinear ODEs, which isaroused in the reduction of stratified Boussinesq equations is as below.

w = gρb

e3 × b,

b = 12w × b,

⎫⎬⎭ (1)

where w = (w1, w2, w3)T , b = (b1, b2, b3)

T and gρb

is a non-dimensional

constant as mentioned by Desale [7] in his thesis. The above system can bewritten as componentwise as below

w1 = − gρb

b2,

w2 = gρb

b1,

w1 = 0,

b1 = 12(w2b3 − w3b2),

b2 = 12(w3b1 − w1b3),

b3 = 12(w1b2 − w2b1).

⎫⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎬⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎭

(2)

More detail mathematical analysis of system (2) can be obtained fromDesale[7].

A critical point (e3, e3) lies on invariant surface and (b1, b2, b3) are on the

Page 3: Numerical Solution of the System of Six Coupled Nonlinear ... · PDF fileNumerical Solution of the System of Six Coupled ... 1 Introduction ... The system of six coupled nonlinear

Numerical solutions by Runge-Kutta fourth order method 289

surface |b|2 = 1. Hence, we have

w1 =−b2k

1 − b3

+b1

1 + b3

,

w2 =b1k

1 − b3+

b2

1 + b3,

w3 = 1.

⎫⎪⎪⎪⎪⎪⎪⎬⎪⎪⎪⎪⎪⎪⎭

(3)

In above equations k is a function of b3, and it can be expressed as;

k2 =(1 − b3)

2

(1 + b3)2[4g(1 + b3) − ρb

ρb]. (4)

One may concern Shrinivasan et al [5] for more details of this analysis. Since|b|2 = 1, we consider spherical co-ordinate system

b1 = cos θ sinφ, b2 = sin θ sin φ, b3 = cosφ. (5)

Hence,

k2 = tan4(φ

2)[

8g

ρbcos2(

φ

2) − 1]. (6)

For k to be real, Shrinivasan et al [5] have put up the restriction to φas 0 ≤ φ ≤ 2cos−1(

√ρb

8g). With this limitation k takes the values negative,

positive and zero. With these possible choices of k, the invariant surface willbe the union of disjoint manifolds corresponding to k > 0, is unstable manifold,k < 0, is stable manifold and k = 0, is a center manifold. Regarding thesemanifolds, readers are advised to refer to Shrinivasan et al [5].

Now for k > 0 the unstable manifold is given by

w1 = tan(φ2)[cos θ − sin θ

√8gρb

cos2(φ2) − 1],

w2 = tan(φ2)[cos θ + sin θ

√8gρb

cos2(φ2) − 1],

w3 = 1,

b1 = cos θ sinφ,

b2 = sin θ sinφ,

b3 = cosφ,

k = tan2(φ

2)[

8g

ρbcos2(

φ

2) − 1].

⎫⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎬⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎭

(7)

On this surface system (1) reduces to

Page 4: Numerical Solution of the System of Six Coupled Nonlinear ... · PDF fileNumerical Solution of the System of Six Coupled ... 1 Introduction ... The system of six coupled nonlinear

290 B. S. Desale and N. R. Dasre

dt= 1

2tan(φ

2)√

8gρb

cos2(φ2) − 1,

dt= 1

4sec2(φ

2).

⎫⎪⎪⎪⎬⎪⎪⎪⎭

(8)

Whereas for k < 0, the stable manifold is given by

w1 = tan(φ2)[cos θ + sin θ

√8gρb

cos2(φ2) − 1],

w2 = tan(φ2)[cos θ − sin θ

√8gρb

cos2(φ2) − 1],

w3 = 1,

b1 = cos θ sinφ,

b2 = sin θ sinφ,

b3 = cosφ,

k = − tan2(φ2)[8g

ρbcos2(φ

2) − 1].

⎫⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎬⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎭

(9)

On this surface system (1) reduces to

dt= −1

2tan(φ

2)√

8gρb

cos2(φ2) − 1,

dt= 1

4sec2(φ

2).

⎫⎪⎪⎪⎬⎪⎪⎪⎭

(10)

3 Numerical Solution

In this paper, we have obtained the numerical solutions of a system (2) withthe initial values on stable and unstable manifolds by Runge-Kutta fourthorder method. The details of this method can be obtained from [8, 9, 10].

3.1 Implementation of Runge-Kutta Fourth Order Method

For Numerical Solution

We start with the initial condition t = 0 and the initial value b0 = (b10, b20, b30).We calculate the initial values of (φ0, θ0) as

θ0 = tan−1(b20

b10),

φ0 = tan−1(

√b210 + b2

20

b30

).

⎫⎪⎪⎪⎪⎬⎪⎪⎪⎪⎭

(11)

Page 5: Numerical Solution of the System of Six Coupled Nonlinear ... · PDF fileNumerical Solution of the System of Six Coupled ... 1 Introduction ... The system of six coupled nonlinear

Numerical solutions by Runge-Kutta fourth order method 291

Now we calculate φ1 and θ1 by Runge-Kutta fourth order method as,

φ1 = φ0 + k10, θ1 = θ0 + k20.

The values of k10 and k20 in above equation are given by

k10 =1

6[k11 + 2(k12 + k13) + k14], k20 =

1

6[k21 + 2(k22 + k23) + k24].

Withk11 = hf1(t0, φ0, θ0),

k12 = hf1(t0 +h

2, φ0 +

k11

2, θ0 +

k11

2),

k13 = hf1(t0 +h

2, φ0 +

k12

2, θ0 +

k12

2),

k14 = hf1(t0 + h, φ0 + k13, θ0 + k13),

k21 = hf2(t0, θ0, φ0),

k22 = hf2(t0 +h

2, θ0 +

k21

2, φ0 +

k21

2),

k23 = hf2(t0 +h

2, θ0 +

k22

2, φ0 +

k22

2),

k24 = hf2(t0 + h, θ0 + k23, φ0 + k23).

This gives us the next approximate values of θ and φ. Then t is set to t0 + hand the values of θ and φ are iterated with the above formulae. The exactsolution on unstable manifold is given by

φ(t) = 2 sin−1[2k1

√G−1

Ge−

t4

√G−1

1 + k21e

− t2

√G−1

],

θ(t) =t

4+ tan−1[

√G

k1

et4

√G−1 −√

G − 1]

− tan−1[

√G

k1e

t4

√G−1 +

√G − 1] + k2.

⎫⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎬⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎭

(12)

Whereas on stable manifold the exact solution is given by

φ(t) = 2 sin−1[2k1

√G−1

Ge

t4

√G−1

1 + k21e

t2

√G−1

],

θ(t) =t

4− tan−1[

√G

k1e−

t4

√G−1 −√

G − 1]

+ tan−1[

√G

k1

e−t4

√G−1 +

√G − 1] + k2,

⎫⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎬⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎭

(13)

Page 6: Numerical Solution of the System of Six Coupled Nonlinear ... · PDF fileNumerical Solution of the System of Six Coupled ... 1 Introduction ... The system of six coupled nonlinear

292 B. S. Desale and N. R. Dasre

where k1, k2 are constants and G = 8gρb

. Now for our calculations, we tookG = 39.2 with g = 9.8 and ρb = 2. We have compared the calculated solutionsand exact solutions. We have found that the minimum error in φ 10−15 andminimum error in θ is 10−5. While in iteration process these errors increaseup to 10−6 and 10−3 for φ and θ respectively with the consideration of thestep size h = 0.001. Please note that these errors will be minimized with thestep size. After calculating φ and θ, we use the method of back-substitutionto obtain the values of b(b1, b2, b3) and w(w1, w2, w3).

3.2 Algorithm For Numerical solution

The following algorithm is used to find the solution by Runge-Kutta fourthorder method. The details of algorithm are given as below.

Step 1: Enter the initial values of t0, φ0, θ0, t, g, ρb and h (step size).

Step 2: Calculate the values of b10, b20, b30, w10, w20, w30, k1, k2 and k. Here wehave obtained the initial values.

Step 3: Calculate the values of φ1 and θ1 by using Runge-Kutta fourth ordermethod.

Step 4: Calculate the values of b1, b2, b3, w1, w2 and w3 by using equation(7) (or(9)).

Step 5: Calculate the exact values of φ and θ by using equation(12) (or (13))then calculate the exact values of b1, b2, b3, w1, w2 and w3 by usingequation(7) (or (9)).

Step 6: Print the required exact and calculated numerical values.

Step 7: Replace φ1 by φ0, θ1 by θ0 and t0 by t+h and go to Step 3, until the valueof φ is reached to its maximum ( or minimum ) for the given unstable(or stable ) fold.

Step 10: Plot the graphs to see the difference.

Step 11: End

3.3 Numerical Solution For Unstable Manifold

On this manifold, we have k > 0 and the system (1) reduces to (8). Now weuse the following programme to find the solution on unstable manifold.

Page 7: Numerical Solution of the System of Six Coupled Nonlinear ... · PDF fileNumerical Solution of the System of Six Coupled ... 1 Introduction ... The system of six coupled nonlinear

Numerical solutions by Runge-Kutta fourth order method 293

#include<stdio.h> #include<stdlib.h> #include<conio.h>

#include<math.h> #include<sys\stat.h>

void main()

{double f(double p); double f1(double a);

FILE *fp;

double phi0,phi1,phi10,theta0,theta1,theta10,er_theta,er_phi;

double h,t,t0,t1,b1,b2,b3,w1,w2,w3,b10,b20,b30,w10,w20,w30;

double eb1,eb2,eb3,ew1,ew2,ew3,be1,be2,be3,we1,we2,we3;

double x,y0,y1,z0,z1,diff1,diff2,k11,k12,k13,k14,k10;

double k21,k22,k23,k24,k20,etheta,ephi,G=39.2,u,u1,u2;

double k1,k2,k; /* g=9.8, rho_b=2*/

int i=0,n; clrscr();

printf("\n\n\t PROGRAMME FOR RUNGE-KUTTA FOURTH ORDER METHOD ON

UNSTABLE MANIFOLD");

fp=fopen("rk4002c.xls","w+");

fprintf(fp,"\n\n\t PROGRAMME FOR RUNGE-KUTTA FOURTH ORDER METHOD

ON UNSTABLE MANIFOLD");

t0=0.0; t=5.358; h=0.001;

printf("\n\t Enter the value of phi0="); scanf("%lf",&phi0);

printf("\n\t Enter the value of theta0="); scanf("%lf",&theta0);

fprintf(fp,"\n The value of phi0=%lf ",phi0);

fprintf(fp,"\n The value of theta0=%lf ",theta0);

b10=cos(theta0)*sin(phi0); b20=sin(theta0)*sin(phi0); b30=cos(phi0);

y1=sqrt(39.2*cos(phi0/2.0)*cos(phi0/2.0)-1);

w10=tan(phi0/2.0)*(cos(theta0)-sin(theta0)*y1);

w20=tan(phi0/2.0)*(sin(theta0)+cos(theta0)*y1);w30=1.000000;

fprintf(fp,"\n The value of b10=%lf ",b10);

fprintf(fp,"\n The value of b20=%lf ",b20);

fprintf(fp,"\n The value of b30=%lf ",b30);

fprintf(fp,"\n The value of w10=%lf ",w10);

fprintf(fp,"\n The value of w20=%lf ",w20);

fprintf(fp,"\n The value of w30=%lf ",w30);

/*calculating k1 and k2 for exact solution and k for initial

solution*/

u=sin(phi0/2.0); k1=(sqrt((G-1.0)/G)+sqrt(((G-1)/G)-u*u))/u;

k2=theta0-atan((sqrt(G)/k1)-(sqrt(G-1.0)))

+atan((sqrt(G)/k1)+(sqrt(G-1.0)));

k=(tan(phi0/2)*tan(phi0/2))*sqrt(G*cos(phi0/2)*cos(phi0/2)-1);

printf("\n\n\tThe value of k1=%f \n\n\tThe value of k2=%f",k1,k2);

printf("\n\n\tThe value of k=%.8f ",k);

fprintf(fp,"\nThe value of k1=%.8f ",k1);

fprintf(fp,"\nThe value of k2=%.8f ",k2);

Page 8: Numerical Solution of the System of Six Coupled Nonlinear ... · PDF fileNumerical Solution of the System of Six Coupled ... 1 Introduction ... The system of six coupled nonlinear

294 B. S. Desale and N. R. Dasre

fprintf(fp,"\nThe value of k=%.8f ",k);

printf("\n\n\tPress ’ENTER’ to get step by step");

fprintf(fp,"\nt\tb1\tb2\tb3\tw1\tw2\tw3\ttheta\tphi\tk\tExact phi

\tExact Theta\tExact b1\tExact b2\tExact b3\tExact w1\tExact w2

\tExact w3");

printf("\n\n\tError in Theta\t\tError in Phi\tValue of K");

while(t0<t)

{ i++; t1=t0+h;

/* Calculation of phi */

k11=h*f1(phi0); k12=h*f1(phi0+0.5*k11);

k13=h*f1(phi0+0.5*k12); k14=h*f1(phi0+k13);

k10=(k11+2.0*k12+2.0*k13+k14)/6.0; phi1=phi0+k10;

/*Calculation of theta */

k21=h*f(phi1); k22=h*f(phi1+0.5*k21);

k23=h*f(phi1+0.5*k22); k24=h*f(phi1+k23);

k20=(k21+2.0*k22+2.0*k23+k24)/6.0; theta1=theta0+k20;

/* Calculation of approximate solution B and W */

b1=cos(theta1)*sin(phi1); b2=sin(theta1)*sin(phi1); b3=cos(phi1);

y1=sqrt(39.2*cos(phi1/2.0)*cos(phi1/2.0)-1);

w1=tan(phi1/2.0)*(cos(theta1)-sin(theta1)*y1);

w2=tan(phi1/2.0)*(sin(theta1)+cos(theta1)*y1); w3=1.000000;

/* calculation of exact solution */

ephi=2.0*asin((2.0*k1*sqrt((G-1.0)/G)*exp(-(t1/4.0)*sqrt(G-1.0)))/

(1.0+k1*k1*exp(-(t1/2.0)*sqrt(G-1.0))));

u1=atan((sqrt(G)*exp((t1/4.0)*sqrt(G-1.0)))/k1-sqrt(G-1.0));

u2=atan((sqrt(G)*exp((t1/4.0)*sqrt(G-1.0)))/k1+sqrt(G-1.0));

etheta=(t1/4.0)+u1-u2+k2;

k=(tan(etheta/2.0)*tan(etheta/2.0))*sqrt(G*cos(etheta/2.0)

*cos(etheta/2.0)-1.0);

/* calculation of error in theta and phi*/

er_theta=fabs(theta1-etheta); er_phi=fabs(phi1-ephi);

/* calculation of B and W */

be1=cos(etheta)*sin(ephi); be2=sin(etheta)*sin(ephi);

be3=cos(ephi); y1=sqrt(39.2*cos(ephi/2.0)*cos(ephi/2.0)-1);

we1=tan(ephi/2.0)*(cos(etheta)-sin(etheta)*y1);

we2=tan(ephi/2.0)*(sin(etheta)+cos(etheta)*y1); we3=1.0000;

fprintf(fp,"\n%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf

\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf",t1,b1,b2,b3,w1,w2,

w3,theta1,phi1,k,etheta,ephi,be1,be2,be3,we1,we2,we3);

printf("\n\n\t%.20lf\t%.20lf\t%lf",er_theta,er_phi,k);

phi0=phi1;theta0=theta1; t0=t1;

} getch(); }

Page 9: Numerical Solution of the System of Six Coupled Nonlinear ... · PDF fileNumerical Solution of the System of Six Coupled ... 1 Introduction ... The system of six coupled nonlinear

Numerical solutions by Runge-Kutta fourth order method 295

double f(double p)

{ double p_dash;

p_dash=0.25*(1.0/(cos(p/2.0)*cos(p/2.0)));

return(p_dash); }

double f1(double a)

{ double a_dash;

a_dash=0.5*tan(0.5*a)*sqrt(39.2*(cos(a/2.0)*cos(a/2.0))-1.0);

return(a_dash); }

3.4 Numerical Solution For Stable Manifold

On this manifold, we have k < 0 and the system (1) reduces to (10). Now weuse the following programme to find the solution on stable manifold.

#include<stdio.h> #include<stdlib.h> #include<conio.h>

#include<math.h> #include<sys\stat.h>

void main()

{ double f(double p);

double f1(double a);

FILE *fp;

double phi0,phi1,phi10,theta0,theta1,theta10,er_theta;

double er_phi,h,t,t0,t1,b1,b2,b3,w1,w2;

double w3,b10,b20,b30,w10,w20,w30,eb1,eb2,eb3,ew1,ew2,ew3;

double be1,be2,be3,we1,we2,we3,x,y0,y1,z0,z1,diff1,diff2;

double k11,k12,k13,k14,k10,k21,k22,k23,k24,k20;

double etheta,ephi,G=39.2,u,u1,u2,k1,k2,k; /* g=9.8, rho_b=2*/

int i=0,n; clrscr();

printf("\n\n\t PROGRAMME FOR RUNGE-KUTTA FOURTH ORDER METHOD ON

STABLE MANIFOLD");

fp=fopen("rk4001s.xls","w+");

fprintf(fp,"\n\n\t PROGRAMME FOR RUNGE-KUTTA FOURTH ORDER METHOD ON

STABLE MANIFOLD");

t0=0.0; t=10.0; h=0.001;

printf("\n\t Enter the value of phi0=");

scanf("%lf",&phi0);

printf("\n\t Enter the value of theta0=");

scanf("%lf",&theta0);

fprintf(fp,"\n The value of phi0=%lf ",phi0);

fprintf(fp,"\n The value of theta0=%lf ",theta0);

b10=cos(theta0)*sin(phi0);b20=sin(theta0)*sin(phi0);b30=cos(phi0);

y1=sqrt(39.2*cos(phi0/2.0)*cos(phi0/2.0)-1);

w10=tan(phi0/2.0)*(cos(theta0)-sin(theta0)*y1);

w20=tan(phi0/2.0)*(sin(theta0)+cos(theta0)*y1); w30=1.000000;

Page 10: Numerical Solution of the System of Six Coupled Nonlinear ... · PDF fileNumerical Solution of the System of Six Coupled ... 1 Introduction ... The system of six coupled nonlinear

296 B. S. Desale and N. R. Dasre

fprintf(fp,"\n The value of b10=%lf ",b10);

fprintf(fp,"\n The value of b20=%lf ",b20);

fprintf(fp,"\n The value of b30=%lf ",b30);

fprintf(fp,"\n The value of w10=%lf ",w10);

fprintf(fp,"\n The value of w20=%lf ",w20);

fprintf(fp,"\n The value of w30=%lf ",w30);

/*calculating k1 and k2 for exact solution and k for initial

solution*/

u=sin(phi0/2.0);k1=(sqrt((G-1.0)/G)+sqrt(((G-1)/G)-u*u))/u;

k2=theta0+atan((sqrt(G)/k1)-sqrt(G-1.0))-atan((sqrt(G)/k1)

+sqrt(G-1.0));

k=-(tan(phi0/2.0)*tan(phi0/2.0))*sqrt(G*cos(phi0/2.0)

*cos(phi0/2.0)-1.0);

printf("\n\n\tThe value of k1=%f\n\n\tThe value of k2=%f",k1,k2);

printf("\n\n\tThe value of k=%.8f ",k);

fprintf(fp,"\nThe value of k1=%.8f ",k1);

fprintf(fp,"\nThe value of k2=%.8f ",k2);

fprintf(fp,"\nThe value of k=%.8f ",k);

printf("\n\n\tPress ’ENTER’ to get step by step");

fprintf(fp,"\nt\tb1\tb2\tb3\tw1\tw2\tw3\tTheta\tPhi\tk\tExact

Theta\tExactPhi\tExactb1\tExactb2\tExactb3\tExactw1\tExact

w2\tExact w3");

printf("\n\n\tError in Theta\t\tError in Phi\tValue of K");

while(t0<t)

{ i++; t1=t0+h;

/* Calculation of phi */

k11=h*f1(phi0); k12=h*f1(phi0+0.5*k11);

k13=h*f1(phi0+0.5*k12); k14=h*f1(phi0+k13);

k10=(k11+2.0*k12+2.0*k13+k14)/6.0; phi1=phi0+k10;

/*Calculation of theta */

k21=h*f(phi1); k22=h*f(phi1+0.5*k21);

k23=h*f(phi1+0.5*k22); k24=h*f(phi1+k23);

k20=(k21+2.0*k22+2.0*k23+k24)/6.0; theta1=theta0+k20;

/* Calculation of approximate solution B and W */

b1=cos(theta1)*sin(phi1); b2=sin(theta1)*sin(phi1); b3=cos(phi1);

y1=sqrt(39.2*cos(phi1/2.0)*cos(phi1/2.0)-1.0);

w1=tan(phi1/2.0)*(cos(theta1)+sin(theta1)*y1);

w2=tan(phi1/2.0)*(sin(theta1)-cos(theta1)*y1); w3=1.000000;

/* calculation of exact solution */

ephi=2.0*asin((2.0*k1*sqrt((G-1.0)/G)*exp((t1/4.0)*sqrt(G-1.0)))/

(1.0+k1*k1*exp((t1/2.0)*sqrt(G-1.0))));

u1=atan(((sqrt(G)*exp(-(t1/4.0)*sqrt(G-1.0)))/k1)-sqrt(G-1.0));

Page 11: Numerical Solution of the System of Six Coupled Nonlinear ... · PDF fileNumerical Solution of the System of Six Coupled ... 1 Introduction ... The system of six coupled nonlinear

Numerical solutions by Runge-Kutta fourth order method 297

u2=atan(((sqrt(G)*exp(-(t1/4.0)*sqrt(G-1.0)))/k1)+sqrt(G-1.0));

etheta=(t1/4.0)-u1+u2+k2;

k=-(tan(etheta/2.0)*tan(etheta/2.0))*sqrt(G*cos(etheta/2.0)

*cos(etheta/2.0)-1.0);

/* calculation of error in theta and phi*/

er_theta=fabs(theta1-etheta); er_phi=fabs(phi1-ephi);

/* calculation of B and W */

be1=cos(etheta)*sin(ephi); be2=sin(etheta)*sin(ephi);

be3=cos(ephi); y10=sqrt(39.2*cos(ephi/2.0)*cos(ephi/2.0)-1.0);

we1=tan(ephi/2.0)*(cos(etheta)+sin(etheta)*y10);

we2=tan(ephi/2.0)*(sin(etheta)-cos(etheta)*y10); we3=1.0000000;

fprintf(fp,"\n%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf

\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf",t1,b1,b2,b3,w1,w2,

w3,theta1,phi1,k,etheta,ephi,be1,be2,be3,we1,we2,we3);

printf("\n\n\t%.20lf\t%.20lf\t%lf",er_theta,er_phi,k);

phi0=phi1; theta0=theta1; t0=t1;

} getch(); }

double f(double p)

{ double p_dash;

p_dash=0.25*(1.0/(cos(p/2.0)*cos(p/2.0)));

return(p_dash); }

double f1(double a)

{ double a_dash;

a_dash=-0.5*tan(0.5*a)*sqrt(39.2*(cos(a/2.0)*cos(a/2.0))-1.0);

return(a_dash); }

4 Experimental Results

We have coded the above algorithm with the help of C-programming. All thegraphs are plotted using MATLAB software. We have considered the initialvalue as φ0 = 0.001 and θ0 = 0.000 on the unstable manifold with respectto k > 0. From the limitations on φ, given by Desale [7], at φ = 2.820649the value of k becomes negative. Hence we have considered φ = 2.820649and θ0 = 0.000 on stable manifold. In each figure, the first graph shows thenumerical value calculated by us; the second graph shows the exact solutionand the third graph shows the comparison of the first and the second graphsas shown in Figure(1) to Figure(16).

Page 12: Numerical Solution of the System of Six Coupled Nonlinear ... · PDF fileNumerical Solution of the System of Six Coupled ... 1 Introduction ... The system of six coupled nonlinear

298 B. S. Desale and N. R. Dasre

4.1 Figures for Numerical Solution on Unstable Mani-fold

On unstable manifold, we consider k > 0, φ0 = 0.001 and θ0 = 0.000. Thecomparison of calculated values and exact values is as shown below in Fig.(1)to Fig.(8)

0 2 4 6−0.4

−0.2

0

0.2

0.4

t

b1

Calculated b1

0 2 4 6−0.4

−0.2

0

0.2

0.4

t

b1

Exact b1

0 1 2 3 4 5 6−0.4

−0.2

0

0.2

0.4

t

b1

Comparision of Exact and Calculated

Figure 1: Graphs for b1 on unstable manifold

0 2 4 60

0.2

0.4

0.6

0.8

1

t

b2

Calculated b2

0 2 4 60

0.2

0.4

0.6

0.8

1

t

b2

Exact b2

0 1 2 3 4 5 60

0.2

0.4

0.6

0.8

1

t

b2

Comparision of Exact and Calculated

Figure 2: Graphs for b2 on unstable manifold

Page 13: Numerical Solution of the System of Six Coupled Nonlinear ... · PDF fileNumerical Solution of the System of Six Coupled ... 1 Introduction ... The system of six coupled nonlinear

Numerical solutions by Runge-Kutta fourth order method 299

0 2 4 6−1

−0.5

0

0.5

1

t

b3

Calculated b3

0 2 4 6−1

−0.5

0

0.5

1

t

b3

Exact b3

0 1 2 3 4 5 6−1

−0.5

0

0.5

1

t

b3

Comparision of Exact and Calculated

Figure 3: Graphs for b3 on unstable manifold

0 2 4 60

1

2

3

t

thet

a

Calculated theta

0 2 4 60

1

2

3

t

thet

a

Exact theta

0 1 2 3 4 5 60

1

2

3

t

thet

a

Comparision of Exact and Calculated

Figure 4: Graphs for θ on unstable manifold

0 2 4 60

1

2

3

t

phi

Calculated phi

0 2 4 60

1

2

3

t

phi

Exact phi

0 1 2 3 4 5 60

1

2

3

t

phi

Comparision of Exact and Calculated

Figure 5: Graphs for φ on unstable manifold

Page 14: Numerical Solution of the System of Six Coupled Nonlinear ... · PDF fileNumerical Solution of the System of Six Coupled ... 1 Introduction ... The system of six coupled nonlinear

300 B. S. Desale and N. R. Dasre

0 2 4 6−6

−4

−2

0

2

t

w1

Calculated w1

0 2 4 6−6

−4

−2

0

2

t

w1

Exact w1

0 1 2 3 4 5 6−6

−4

−2

0

2

t

w1

Comparision of Exact and Calculated

Figure 6: Graphs for w1 on unstable manifold

0 2 4 60

1

2

3

t

w2

Calculated w2

0 2 4 60

1

2

3

t

w2

Exact w2

0 1 2 3 4 5 60

1

2

3

t

w2

Comparision of Exact and Calculated

Figure 7: Graphs for w2 on unstable manifold

0 2 4 60

0.5

1

1.5

2

t

w3

Calculated w1

0 2 4 60

0.5

1

1.5

2

t

w3

Exact w3

0 1 2 3 4 5 60

0.5

1

1.5

2

t

w3

Comparision of Exact and Calculated

Figure 8: Graphs for w3 on unstable manifold

Page 15: Numerical Solution of the System of Six Coupled Nonlinear ... · PDF fileNumerical Solution of the System of Six Coupled ... 1 Introduction ... The system of six coupled nonlinear

Numerical solutions by Runge-Kutta fourth order method 301

4.2 Figures for Numerical Solution on Stable Manifold

On stable manifold, we consider k < 0, φ0 = 2.820649 and θ0 = 0.000. Com-parison of calculated values and exact values is as shown in the following figuresFig.(9) to Fig.(16)

0 5 10 15−0.5

0

0.5

1

t

b1

Calculated b1

0 5 10 15−0.5

0

0.5

1

t

b1

Exact b1

0 2 4 6 8 10 12−0.5

0

0.5

1

t

b1

Comparision of Exact and Calculated

Figure 9: Graphs for b1 on stable manifold

0 5 10 150

0.1

0.2

0.3

0.4

t

b2

Calculated b2

0 5 10 150

0.1

0.2

0.3

0.4

t

b2

Exact b2

0 2 4 6 8 10 120

0.1

0.2

0.3

0.4

t

b2

Comparision of Exact and Calculated

Figure 10: Graphs for b2 on stable manifold

Page 16: Numerical Solution of the System of Six Coupled Nonlinear ... · PDF fileNumerical Solution of the System of Six Coupled ... 1 Introduction ... The system of six coupled nonlinear

302 B. S. Desale and N. R. Dasre

0 5 10 15−1

−0.5

0

0.5

1

t

b3

Calculated b3

0 5 10 15−1

−0.5

0

0.5

1

t

b3

Exact b3

0 2 4 6 8 10 12−1

−0.5

0

0.5

1

t

b3

Comparision of Exact and Calculated

Figure 11: Graphs for b3 on stable manifold

0 5 10 150

1

2

3

t

thet

a

Calculated theta

0 5 10 150

1

2

3

t

thet

a

Exact theta

0 2 4 6 8 10 120

1

2

3

t

thet

a

Comparision of Exact and Calculated

Figure 12: Graphs for θ on stable manifold

0 5 10 150

1

2

3

t

phi

Calculated phi

0 5 10 150

1

2

3

t

phi

Exact phi

0 2 4 6 8 10 120

0.5

1

1.5

2

2.5

t

phi

Comparision of Exact and Calculated

Figure 13: Graphs for φ on stable manifold

Page 17: Numerical Solution of the System of Six Coupled Nonlinear ... · PDF fileNumerical Solution of the System of Six Coupled ... 1 Introduction ... The system of six coupled nonlinear

Numerical solutions by Runge-Kutta fourth order method 303

0 5 10 150

1

2

3

t

w1

Calculated w1

0 5 10 150

1

2

3

t

w1

Exact w1

0 2 4 6 8 10 120

0.5

1

1.5

2

2.5

t

w1

Comparision of Exact and Calculated

Figure 14: Graphs for w1 on stable manifold

0 5 10 15−6

−4

−2

0

2

t

w2

Calculated w2

0 5 10 15−6

−4

−2

0

2

t

w2

Exact w2

0 2 4 6 8 10 12−6

−4

−2

0

2

t

w2

Comparision of Exact and Calculated

Figure 15: Graphs for w2 on stable manifold

0 5 10 150

0.5

1

1.5

2

t

w3

Calculated w1

0 5 10 150

0.5

1

1.5

2

t

w3

Exact w3

0 2 4 6 8 10 120

0.5

1

1.5

2

t

w3

Comparision of Exact and Calculated

Figure 16: Graphs for w3 on stable manifold

Page 18: Numerical Solution of the System of Six Coupled Nonlinear ... · PDF fileNumerical Solution of the System of Six Coupled ... 1 Introduction ... The system of six coupled nonlinear

304 B. S. Desale and N. R. Dasre

5 Conclusion

Here we have presented the scheme of Runge-Kutta fourth order Method forthe numerical solution of the system of six coupled nonlinear ODEs (1). Inour calculation initially we have the error of 10−20, while in iteration processit increases up to 10−3 in the solution. It can be reduced as we reduce the stepsize. In future we will attempt to minimize the error and sharpen the accuracyof the solution.

References

[1] K. R. Rajagopal, M. Ruzicka and A. R. Srinivasa, On the Oberbeck-Boussinesq Approximation, Mathematical Models and Methods in AppliedSciences, 6 (1996), 1157-1167.

[2] B. S. Desale, Complete Analysis of an Ideal Rotating Uniformly StratifiedSystem of ODEs, Nonlinear Dyanamics and Systems Theory 9(3) (2009),263-275.

[3] B. S. Desale and V. Sharma, Special Solutions to Rotating StratifiedBoussinesq Equations, Nonlinear Dyanamics and Systems Theory 10(1)(2010), 29-38.

[4] B. S. Desale and N. R. Dasre, Numerical Solutions of System of Non-linear ODEs by Euler Modified Method, Nonlinear Dyanamics and Sys-tems Theory 12(3) (2012), 215-236.

[5] G. K. Srinivasan, V. D. Sharma and B. S. Desale, An integrable systemof ODE reductions of the stratified Boussinesq equations, Computers andMathematics with Applications, 53 (2007), 296-304.

[6] B. S. Desale and G. K. Srinivasan, Singular Analysis of the System of ODEreductions of the Stratified Boussinesq Equations, IAENG InternationalJournal of Applied Mathematics, 38:4, IJAM 38 4 04 (2008), 184-191.

[7] B. S. Desale, An integrable system of reduced ODEs of Stratified Boussi-nesq Equations, Ph. D. Thesis, subitted to IITB, Powai, Mumbai (2007).

[8] J. H. Mathews, Numerical Methods for Mathematics, Science and Engi-neering Prentice Hall of India, New Delhi, INDIA, 1994.

[9] E. Kreyszig, Advanced Engineering Mathematics Wiley India (P) Ltd.,New Delhi, INDIA, 2010.

Page 19: Numerical Solution of the System of Six Coupled Nonlinear ... · PDF fileNumerical Solution of the System of Six Coupled ... 1 Introduction ... The system of six coupled nonlinear

Numerical solutions by Runge-Kutta fourth order method 305

[10] M. K. Jain and S. R. K. Iyengar, Numerical Methods for scientific andengineering computation New Age International (P) Ltd., Mumbai, India,2001.

Received: June, 2012