dasreAMS5-8-2013

Embed Size (px)

Citation preview

  • 8/11/2019 dasreAMS5-8-2013

    1/19

  • 8/11/2019 dasreAMS5-8-2013

    2/19

    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 = gb

    e3 b,b = 1

    2w b,

    (1)

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

    T and gb

    is a non-dimensional

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

    w1 = gb b2,w2 =

    gb

    b1,

    w1 = 0,

    b1 = 1

    2(w2b3 w3b2),

    b2 = 1

    2(w3b1 w1b3),

    b3 = 1

    2(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

  • 8/11/2019 dasreAMS5-8-2013

    3/19

    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 ofb3, 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 2cos1(

    b8g

    ). With this limitation k takes the values negative,

    positive and zero. With these possible choices ofk, the invariant surface willbe the union of disjoint manifolds corresponding tok >0, is unstable manifold,k < 0, is stable manifold and k = 0, is a center manifold. Regarding these

    manifolds, 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

    8gb

    cos2(2

    ) 1],w2 = tan(

    2)[cos + sin

    8g

    bcos2(

    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

  • 8/11/2019 dasreAMS5-8-2013

    4/19

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

    d

    dt = 1

    2tan(

    2)

    8g

    bcos2(

    2) 1,

    d

    dt = 1

    4sec2(

    2).

    (8)

    Whereas for k

  • 8/11/2019 dasreAMS5-8-2013

    5/19

    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 ofk10 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 sin1[2k1

    G1G

    et

    4

    G1

    1 +k21e t

    2

    G1

    ],

    (t) = t

    4+ tan1[

    G

    k1e

    t

    4

    G1 G 1]

    tan1[

    G

    k1e

    t

    4

    G1 +

    G 1] +k2.

    (12)

    Whereas on stable manifold the exact solution is given by

    (t) = 2 sin1[

    2k1G1G

    et

    4

    G1

    1 +k21et

    2

    G1 ],

    (t) = t

    4 tan1[

    G

    k1e

    t

    4

    G1 G 1]

    + tan1[

    G

    k1e

    t

    4

    G1 +

    G 1] +k2,

    (13)

  • 8/11/2019 dasreAMS5-8-2013

    6/19

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

    where k1, k2 are constants and G = 8g

    b. Now for our calculations, we took

    G= 39.2 withg = 9.8 andb= 2. We have compared the calculated solutionsand exact solutions. We have found that the minimum error in 1015 andminimum error in is 105. While in iteration process these errors increaseup to 106 and 103 for and respectively with the consideration of the

    step 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 ofb(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 oft0, 0, 0, t, g, b and h (step size).

    Step 2: Calculate the values ofb10, 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 ofb1,b2, b3, w1, w2and w3by 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: Replace1by0,1by0and t0byt+hand 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.

  • 8/11/2019 dasreAMS5-8-2013

    7/19

    Numerical solutions by Runge-Kutta fourth order method 293

    #include #include #include

    #include #include

    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 METHODON 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);

  • 8/11/2019 dasreAMS5-8-2013

    8/19

    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

  • 8/11/2019 dasreAMS5-8-2013

    9/19

    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

  • 8/11/2019 dasreAMS5-8-2013

    10/19

    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

  • 8/11/2019 dasreAMS5-8-2013

    11/19

    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 respect

    to 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).

  • 8/11/2019 dasreAMS5-8-2013

    12/19

    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 60.4

    0.2

    0

    0.2

    0.4

    t

    b1

    Calculated b1

    0 2 4 60.4

    0.2

    0

    0.2

    0.4

    t

    b1

    Exact b1

    0 1 2 3 4 5 60.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

  • 8/11/2019 dasreAMS5-8-2013

    13/19

    Numerical solutions by Runge-Kutta fourth order method 299

    0 2 4 61

    0.5

    0

    0.5

    1

    t

    b3

    Calculated b3

    0 2 4 61

    0.5

    0

    0.5

    1

    t

    b3

    Exact b3

    0 1 2 3 4 5 61

    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

    theta

    Calculated theta

    0 2 4 60

    1

    2

    3

    t

    theta

    Exact theta

    0 1 2 3 4 5 60

    1

    2

    3

    t

    theta

    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

  • 8/11/2019 dasreAMS5-8-2013

    14/19

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

    0 2 4 66

    4

    2

    0

    2

    t

    w1

    Calculated w1

    0 2 4 66

    4

    2

    0

    2

    t

    w1

    Exact w1

    0 1 2 3 4 5 66

    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

  • 8/11/2019 dasreAMS5-8-2013

    15/19

    Numerical solutions by Runge-Kutta fourth order method 301

    4.2 Figures for Numerical Solution on Stable Manifold

    On stable manifold, we consider k

  • 8/11/2019 dasreAMS5-8-2013

    16/19

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

    0 5 10 151

    0.5

    0

    0.5

    1

    t

    b3

    Calculated b3

    0 5 10 151

    0.5

    0

    0.5

    1

    t

    b3

    Exact b3

    0 2 4 6 8 10 121

    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

    theta

    Calculated theta

    0 5 10 150

    1

    2

    3

    t

    theta

    Exact theta

    0 2 4 6 8 10 120

    1

    2

    3

    t

    theta

    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

  • 8/11/2019 dasreAMS5-8-2013

    17/19

    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 156

    4

    2

    0

    2

    t

    w2

    Calculated w2

    0 5 10 156

    4

    2

    0

    2

    t

    w2

    Exact w2

    0 2 4 6 8 10 126

    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

  • 8/11/2019 dasreAMS5-8-2013

    18/19

    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 1020, while in iteration process

    it increases up to 103 in the solution. It can be reduced as we reduce the step

    size. 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 Theory9(3)(2009),263-275.

    [3] B. S. Desale and V. Sharma, Special Solutions to Rotating StratifiedBoussinesq Equations, Nonlinear Dyanamics and Systems Theory10(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 Theory12(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-neeringPrentice Hall of India, New Delhi, INDIA, 1994.

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

  • 8/11/2019 dasreAMS5-8-2013

    19/19

    Numerical solutions by Runge-Kutta fourth order method 305

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

    Received: June, 2012