[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Help-gsl] Problem when using gsl_odeiv2_evolve_apply
From: |
Nino S |
Subject: |
[Help-gsl] Problem when using gsl_odeiv2_evolve_apply |
Date: |
Mon, 18 May 2015 16:22:13 -0500 |
Hello,
I am a newbie and having trouble in applying gsl ode solvers.
I am solving an ode system using rkf45 algorithm. I use
gsl_odeiv2_evolve_apply
to evolve the system:
...
gsl_odeiv2_system sys = {mysystem, jac, DIM, params};
const gsl_odeiv2_step_type * T= gsl_odeiv2_step_rkf45;
gsl_odeiv2_step * s = gsl_odeiv2_step_alloc (T, DIM);
gsl_odeiv2_control * c = gsl_odeiv2_control_y_new (1e-4, 1e-4);
gsl_odeiv2_evolve * e = gsl_odeiv2_evolve_alloc (DIM);
...
tend=10000;t=0;
while (t < tend)
{
int status = gsl_odeiv2_evolve_apply (e, c, s,
&sys,
&t, tend,
&h, y);
if (status != GSL_SUCCESS)
{
printf ("error, return value=%d\n", status);
break;}
}
However the while loop never stops and after I check the output of 't', I
found a strange behavior:
't' goes like
0,0.1,...,200,0,...,200,0,...200,0,...,200,.......
It is looping from 0 to 200 and never get to 10000.
Within the loop, IMO the solver status checking forces the code to stop if
the return is not 'GSL_SUCCESS'. However it's looping infinitely from 0 to
200. Does it mean there are some weird cases where the
'gsl_odeiv2_evolve_apply' will stop before 'tend', resetting 't' to 0 and
returning a 'GSL_SUCCESS'?
Have no idea what's going on here. Could you give me some help?
Thanks.
Yee
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Help-gsl] Problem when using gsl_odeiv2_evolve_apply,
Nino S <=