[SciPy-User] Help!!!!!! having problems with ODEINT

Laura Matrajt matrajt at gmail.com
Thu Jul 21 20:22:07 EDT 2011


Hi all,
 I am working with a system of 16 differential equations that simulates an
epidemic in a city.  Because there are many cities interacting with each
other, I need to run my ode's for a single day, stop them, modify the
initial conditions and run them again.  Because the ode is running only for
a day, I defined my tspan to have only two points, like this:

tspan = tspan = linspace(day, day+1, 2)

I wrote my equations in Python and I am using scipy.odeint to solve it.

Here is my code:
def advanceODEoneDay(self,day):

        #rename variables for convenience
        N0, N1 = self.children, self.adults
        S0,S1,A0,A1,I0,I1,RA0,RA1,RI0,RI1 =
self.S0,self.S1,self.A0,self.A1,self.I0,self.I1,self.RA0,self.RA1,self.RI0,self.RI1



        #create a vector of times for integration:
        tspan = linspace(day, day+1, 2)


        #set initial conditions. To do this, I need to look in the array in
the day
        initCond = [S0[day,0], S0[day,1],
                    S1[day,0], S1[day,1],
                    A0[day,0], A0[day,1], A1[day,0], A1[day,1],
                    I0[day,0], I0[day,1], I1[day,0], I1[day,1],
                    RA0[day,0], RA1[day,0], RI0[day,0], RI1[day,0] ]


        #run the ode:
        sir_sol = odeint(sir2groups,initCond, tspan,
args=(self.p,self.C,self.m,self.VEs,self.VEi,self.VEp,N0,N1))#,self.gamma,self.rho))


Most of the time, it works just fine. However, there are some times where
the following message appears:

Excess work done on this call (perhaps wrong Dfun type).
Run with full_output = 1 to get quantitative information.
 lsoda--  at current t (=r1), mxstep (=i1) steps
       taken on this call before reaching tout
      In above message,  I1 =       500
      In above message,  R1 =  0.1170754095027E+03

I should mention that it is NOT only a warning. This is repeated over and
over (thousands of times) and then it will break the rest of my code
Ok, after searching in this mailing list, someone else posted a similar
warning message and it was suggested to him that "

*In your case, you might simply be computing for to coarse a mesh in
t,** so "too much work" has to be done for each step. "


*Is this what is happening to me? the problem is that I don't get this
error every single time, so I don't even know how to run it with
full_output = 1 to get the info...
I really don't know what to do. Any help will be very very very very
appreciated!
thank you very *

*




-- 
Laura
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20110721/19b9e9af/attachment.html>


More information about the SciPy-User mailing list