help-gsl
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-gsl] odeiv2 rk2imp driver time step


From: Farkas, Illes
Subject: Re: [Help-gsl] odeiv2 rk2imp driver time step
Date: Thu, 22 Dec 2011 11:55:38 -0800

Hi Juan,

Sorry for the delay and thanks for all the help. I've just finished
trimming it down to a simple test case. Please see the attached source
(test.c), the stdout (test.out.txt), the gnuplot cmd file (test.gnu) and
the resulting plot (test.ps, test.pdf). It is very likely that I'm making
some very dumb mistake. I just can't find it. Thanks for any help !

The compilation command was: gcc test.c -Wall -O3 -I...<include>...
-L...<lib>... -lm -lgsl -lgslcblas -o test

The test output file (test.out.txt) contains output from the main program
(lines starting with "main") and output from the function (lines starting
with "ode_system_rhs_function").

According to the last ~50 lines of test.out.txt it seems that the attempted
time step is halved many times.

One more question. According to test.out.txt the r.h.s. function is
accessed 3 or 2 times at each time point. Can this be reduced to accessing
only once (in order to speed up rk2imp) ?

Thanks,
Illes


2011/12/22 Juan Pablo Amorocho D. <address@hidden>

> Illes,
>
> I'm curious how you solved your problem. I would be grateful if you post
> your solution on the help-gsl list.
>
> -- Juan
>
> 2011/12/21 Farkas, Illes <address@hidden>
>
>> Thanks, Tuomo
>>
>> I just ran into something unexpected. I am trying to find out where
>> exactly
>> I'm making a mistake.
>>
>> I'm integrating with rk2imp a 3d ODE that has constants, linear and second
>> order polynomial terms on the r.h.s. I use gsl_odeiv2_driver_apply to
>> evolve the ODE in steps of 0.125s. After 10s or so (the exact time varies
>> with the parameters) all three variables converge (very little relative
>> change). However, some time ( > 5s ) later there is an update
>> when gsl_odeiv2_driver_apply returns the FAILURE value: -1. After logging
>> the current time directly from the "function" and "jacobian" (used by
>> the gsl_odeiv2_system, which is driver by the driver), I found that this
>> particular update fails, because the time step is halved again and again
>> until it reaches the limit of numerical precision.
>>
>> Have you seen a similar error before ?
>>
>> I have the Ascher Petzold book. Will sections 5.4.3 (modified Newton
>> iteration) and 4.7 (implicit methods) be helpful for this problem or shall
>> I use a different resource ?
>>
>> Thanks
>>
>>
>>
>> 2011/12/1 Tuomo Keskitalo <address@hidden>
>>
>> > Hello,
>> >
>> > rk2imp (among other implicit methods) in ode-initval2 uses a modified
>> > Newton iteration instead of old functional iteration in solving the
>> system
>> > of non-linear equations. E.g. for stiff problems Newton iteration is
>> quite
>> > more powerful. Because of that, the ODE-solver can use larger step
>> sizes.
>> > Newton iteration converges with larger step sizes, while functional
>> > iteration does not.
>> >
>> >
>> > On 12/01/2011 08:42 PM, Farkas, Illes wrote:
>> >
>> >  Hi,
>> >>
>> >> I just tested the speed of rk2imp with the simple harmonic oscillator
>> >> (dx/dt=-y, dy/dt=x). In the first test I used
>> >> gsl_odeiv_step/control/evolve
>> >> (does *not* use Jacobian) and in the 2nd test I used
>> >> simply gsl_odeiv2_driver (uses Jacobian). With the same parameters the
>> >> first version ran for 26s and the second version finished below 1s. Is
>> >> this
>> >> test wrong? Or is there really such a big difference?
>> >>
>> >> Thanks
>> >> Illes
>> >> ______________________________**_________________
>> >> Help-gsl mailing list
>> >> address@hidden
>> >> https://lists.gnu.org/mailman/**listinfo/help-gsl<
>> https://lists.gnu.org/mailman/listinfo/help-gsl>
>>
>> >>
>> >>
>> >
>> > --
>> > address@hidden
>> > http://iki.fi/tuomo.keskitalo
>> >
>>
>>
>>
>> --
>> http://hal.elte.hu/fij
>> _______________________________________________
>> Help-gsl mailing list
>> address@hidden
>> https://lists.gnu.org/mailman/listinfo/help-gsl
>>
>
>


-- 
http://hal.elte.hu/fij

Attachment: test.7z
Description: Binary data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]