0

I have a stiff system which I want to integrate with integrate_adaptive and a controlled rosenbrock4 stepper from (boost::) odeint.

For the most conditions I can predict a good first time step, but for some it fails "for sure"

I assume the problem ist that one change does depend on a constant:

Change[0]=f(States,Changes) + C

The dependence on the States does show up in the Jacobian, C does not. But C can have a significant influence. I there a way to make the stepper know of the influence of C ?

To clarify the error I get is:

Integrate adaptive : Maximal number of iterations reached. A step size could not be found.

An other guess would is that is caused by the different magnitudes of States[0] and the other states

I try to give an structural example, the full example would be to big, all factors are set to one:

class system{
    void operator(const state_type &states, state_type &changes, const doulbe t){
        changes[0]=0.0;
        for( int i =1; i<states.size();++i){
            changes[i]=(states[0]-exp(-1/states[i])/states[i];
            changes[0]-=states[i]*states[i]*changes[i];
        }
        changes[0]+=C;
    }

C may in some cases be more bigger than the contribution from the states

The Jacobian is set up accordingly.

MagunRa
  • 543
  • 4
  • 13
  • is it really that crucial if you get the initial step size right? if not the controller will adjust it - that's what the controlled stepper is there for in the end. – mariomulansky Jan 17 '14 at 18:51
  • Yes it makes a great difference, which it should not as far as I understand. My guess this has is caused by the constant (it is constant for one integration not for the whole program) , which does not show up in the Jacobian. And the adaptive integrator uses the Jacobian to determine the steps. – MagunRa Jan 17 '14 at 22:22
  • sorry for the delayed response... can you add some reduced code example so I fully understand what's going on, please? – mariomulansky Feb 03 '14 at 17:44
  • I added a scetch of the system, if you need to see the Jacobian i will type this one too. – MagunRa Feb 07 '14 at 10:37
  • The constant should not be a problem. My first suggestion would be that you double check your Jacobian, because your rhs function is quite complicated. A tiny mistake in the Jacobian might give you such an error. Secondly, you should check that your state[i] are always non-zero, because for states[i]=0 the changes[i] diverge which could also lead to such an error. – mariomulansky Feb 08 '14 at 00:14
  • Ok, I will try this. The states are always >0, this is ensured by the observer. – MagunRa Feb 08 '14 at 09:09
  • The Jacobian seems correct for me. I discoverd that States[0] changes its magnitude quiet strong in the crashing condition. Normally States[0] is of order 1e-4 to 1e-2 and the other States are in the order of 1e-9 to 1e-6. In the crashing case States[0] goes down to 1e-20. Maybe the problem lies there? – MagunRa Feb 13 '14 at 12:23

0 Answers0