|
[Sponsors] |
May 5, 2005, 18:45 |
Runge Kutta Method
|
#1 |
Guest
Posts: n/a
|
Hello
I performed an IV Order Runge Kutta Method to solve linear differential equations , but my final solutions we re first order accurate ??? What could be reason for this..how should i explain this ? Can somebody help me. Thanks CFDtoy |
|
May 5, 2005, 20:25 |
Re: Runge Kutta Method
|
#2 |
Guest
Posts: n/a
|
something wrong with ur solver , coefficients I guess debug it
|
|
May 6, 2005, 02:05 |
Re: Runge Kutta Method
|
#3 |
Guest
Posts: n/a
|
Just making sure this is not some misunderstanding: How did you determine that your solutions are first-order accurate?
|
|
May 7, 2005, 21:41 |
Re: Runge Kutta Method
|
#4 |
Guest
Posts: n/a
|
The problem might be because you did not use the updated values at next time step and you need to use the original values in all the time steps to add to.
- h |
|
May 10, 2005, 18:24 |
Re: Runge Kutta Method
|
#5 |
Guest
Posts: n/a
|
Here is the problem listing:
I equation : d2y/dt2 + beta * dy/dt+ p = sin(omega*t) II equation : dp/dt=y* d2y/dt2; so, actually, III first order differential eqns: I solve as follows ! lets suppose functions return 1) z=dydt 2) dzdt 3) dpdt while ( t < tfinal) k1=dydt() q1=dzdt() p1=dpdt() i get k1,k2,k3,k4 using Runge kutta method to finally update y=y+(k1+2k2...)/6 z=z+(q1+..)/6 p=p+(..)/6 time = time +dtime Now, the first order differential equations are coupled..and i perform IV order scheme here. I plot the error Vs dt and take the slope to get first order ? Now, where exactly is the problem ? CFDtoy |
|
May 10, 2005, 19:34 |
Re: Runge Kutta Method
|
#6 |
Guest
Posts: n/a
|
a) I don't see why you have three first-order equations when your original equation is only of second order. I think you should have two first-order equations, one for "y" and one for it's time-derivative "z". Maybe it's the term p that's confusing, but can't you treat it implicitly by merging it with the second derivative in the original equation?
d2y/dt2 +beta/(1+y)*dy/dt = sin(omega*t)/(1+y) As long as you avoid the singularity, this should be fine. Maybe your way is safer, though. b)Are you sure you should expect second-order accuracy, here? You are solving a nonlinear system of equations. I suppose you will get to higher accuracy through subiteration. |
|
May 10, 2005, 20:54 |
Re: Runge Kutta Method
|
#7 |
Guest
Posts: n/a
|
Hello Mani, You are right abt the eqns: The II order gives 2 first order eqns, and my equation for 'p' is a give derivative...wht do u mean by treating it implicitly ?? Since this represents a new system of eqn and is there a way to avoid singularity ? so i chose to do it separate .
If you do IV order runge kutta..wht do u expecT ? IV order ...I am solving highly nonlinear eqns..yes very true and infact for higher dtime..my solution collapses and with sufficient level of low time steps the solutions are recovered. But again, i wanted high accuracy and hence did IV order runge kutta..why did I get a I order solution ? You think, the nonlinearity of the solution has anything ..or if you have comments plez send me an email in detail..im confused abt this scheme. thanks again CFDtoy |
|
May 11, 2005, 17:48 |
Re: Runge Kutta Method
|
#8 |
Guest
Posts: n/a
|
I still don't understand how you evaluate dpdt, i.e. what exactly is your equation for p?
I would try this instead: if y1 not equal to -1: dy1/dt = y2 dy2/dt = (sin(omega*t) -beta*y2)/(1 +y1) if y1 equal to -1: dy1/dt = sin(omeg*t)/beta dy2/dt = omeg*cos(omeg*t)/beta The four-step Runge-Kutta method is of fourth order only under certain conditions (which I don't remember). Also, you need to make sure that the evaluation of your error is appropriate. How do you define the error? I am not sure if this equation has a periodic solution, but if it does, an appropriate norm could be defined by the r.m.s. error over one oscillation period. |
|
May 11, 2005, 17:51 |
Re: Runge Kutta Method
|
#9 |
Guest
Posts: n/a
|
correction:
if y1 equal to -1: dy1/dt = sin(omeg*t)/beta dy2/dt = omeg*cos(omeg*t)/beta |
|
May 11, 2005, 20:22 |
Re: Runge Kutta Method
|
#10 |
Guest
Posts: n/a
|
hi Mani
Say, my eqn for p can be written is coupled as : dp/dt= p*y with appropriate B.C. You made a point sayin that IV order runge kutta is IV order only under certain conditions? Can you help me locate the necessary condition/ Ok...as far as the error thing, I take a very small time step..and say dt -> 0 Now, take points, and plot log ( R@dt - R at dt=0) Vs log (dt). Take the slope, it should give order of the method. This is available in lotsa books. I am still working in the code..i guess ,, the behavior of Runge kutta isnt proper for highly non linear systems ?? wht say ?? Thanks CFDtoy |
|
May 19, 2005, 02:25 |
Re: Runge Kutta Method
|
#11 |
Guest
Posts: n/a
|
The classic RK4 is 4th accurate on first-order ODEs regardless of whether they are linear, quasilinear, semilinear, or nonlinear. In Runge-Kutta parlance, one satisfies quadrature, subquadrature, extended subquadrature, and nonlinear order conditions. Occasionally you'll find someone who only designed the method using quadrature and subquadrature conditions (usually acoustics).
If you are getting first order results, here are some thoughts: 1) it's coded wrong 2) you are looking at the order of accuracy from one of the stages rather than the step value 3) you are looking at a derived quantity that uses at least one piece of information from a stage. 4) you are integrating over a temporal discontinuity 5) you are integrating a PDE and the physical BC's are reducing the order of the temporal solution to something close to 2. A key point here is that explicit Runge-Kutta methods have a stage-order of 1. That means all intermediate quantities are first-order in time. It is only the final linear combination of solution vectors that is, say, fourth-order accurate. |
|
May 19, 2005, 20:40 |
Re: Runge Kutta Method
|
#12 |
Guest
Posts: n/a
|
Hello Runge_Kutta, Thanks for some information on the numerics. Consider coding a runge kutta for an equation how do you find the accuracy of the method on the whole ?? May be I was looking at some wrong plots ?
As said before, consider a non linear equation: Xtt+Xt^2 = A sin (wt) where Xtt = second time derivative of X Xt = First time derivative of X A = constant w = some frequency Now, If i want to do runge kutta for this with BC given by X(0)= X1, Xt(0)=X2 Wht do you suggest i do to check the numerical accuracy of the method..say wht I should Plot to see the order of the method. Also, its interesting to see that the BC can reduce the order of accuracy ? and some discontinuity in time are you talking about smoothness of the solution? Really appreciate your very valuable discussion. Please let me know more details. Thanks again CFDtoy |
|
May 22, 2005, 14:00 |
Re: Runge Kutta Method
|
#13 |
Guest
Posts: n/a
|
To find the order of the method can be interpreted several ways. First, there is the formal order of the method. This can be tested by placing the method coefficients in what is sometimes called a "Butcher" array
http://www.math.auckland.ac.nz/~butcher/ Once you've done this, you will have the b- and c- vectors and the A-matrix, each with dimension s or s x s (s = number of stages). To get first order, you need b.e = 1 where e = {1,1, ..., 1} is of length s. For second order b.c = 1/2 At third order, there are 2: b.c^2 = 1/3 b.A.c = 1/6 At 4th-order, there are 4: b.c^3 = 1/4 (b*c).A.c^2 = 1/8 b.A.c^2 = 1/12 b.A.A.c = 1/24 For the classic RK4, A = {{0,0,0,0}, {0,1/2,0,0}, {0,0,1/2,0}, {0,0,0,1}} b = {1/6,1/3,1/3,1/6} c = {0,1/2,1/2,1} One can verify that the method is 4th-order. See the 1991 book by J.D. Lambert http://www.amazon.com/exec/obidos/tg...glance&s=books The second way to interpret your comment is through testing. As to your test problem, it is a second-order ODE. If you want to solve that problem, either recast it as a system of first-order ODEs or use a RK-Nystrom method. I doubt boundary order reduction is your problem. In its most severe form, it would drop you to second-order accuracy (stage-order plus 1). Just in case, solve a discretized PDE with periodic BCs and the problem can't arise. Yes, the discontinuity is temporal and much like a shock wave is to the spatial domain. A few things to remember. When we speak of a Runge-Kutta method being of order x, we mean the global order. This is the order that you will observe after many steps. Local order relates the the error incurred over one step. When the global order is x, the local order is x+1. The classic RK4 will give you 5th-order convergence over a single step. I have had a DNS team observe first order convergence with their explicit Runge-Kutta method, only to scream at me about the POS RK methods. It turned out that they were observing the effects of first-order accurate stage information. In backing out the temperature from the internal energy at the end of the step, they used some stage information in the iteration (as I recall). Assume you are integrating {a,b,c} and use these to derive the value of d. Each time you update {a,b,c} in the stages, they are only first-order accurate. Now, let's say you update {a,b,c} at the end of the step but in computing d, you not only use {a,b,c} but also use e from the last stage to calculate d. You have let low order information creep in and d will not be 4th-order. To test your method, do a convergence study over many steps using periodic BCs for your PDE. Also, error estimators are useful in understanding what is going on. |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
1D Burgers euqation with 4th Runge Kutta | dokeun | Main CFD Forum | 3 | August 8, 2011 07:34 |
Runge Kutta Discontinuous Galerkin procedure? | Ameya J | Main CFD Forum | 6 | July 29, 2011 06:56 |
need some resources for evaluation of Runge Kutta method in CFD | seyedashraf | Main CFD Forum | 0 | June 20, 2011 16:41 |
Runge Kutta Optimization | vasanth | Main CFD Forum | 6 | December 2, 2005 14:07 |
Diagonally Dominate Runge Kutta Method | Anthony Iannetti | Main CFD Forum | 0 | January 23, 2001 22:27 |