jeudi 14 juillet 2016

Excess work done on this call (perhaps wrong Dfun type)

Everytime I run this code it gives me an error saying

 lsoda--  at current t (=r1), mxstep (=i1) steps   
       taken on this call before reaching tout     
      in above message,  i1 =    500000
      in above message,  r1 =  0.2587791948500D+00
Excess work done on this call (perhaps wrong Dfun type).
Run with full_output = 1 to get quantitative information.

But this code runs perfectly if generate 4 or 5 random values of w.Can somebody tell me what the problem is? Why does it show error if higher number of random numbers are produced? Thanks for any help in advance.

from math import*
import scipy as sp
import random
import numpy as np 
import matplotlib.pyplot as plt
from scipy.integrate import odeint


def pend(y, t, lum, a1, a2, a3,a4,a5,a6,a7,a8):
    r,v,p = y
    if p>0.003:
        dydt = [a1*v,(a2*((((p-a3)*a6)-(v**2.))/(r*(a4+a5*(r**3.))))),(((a7*lum)/(r**3.))-((a8*v*p)/r))]
    else:
        dydt = [0,0.,0.]
    return dydt                         
b = 1.9
j = open('13.out','w')
u = input("t_snapshot")                                     
l = 43*u
k = 1.0
alist = []
w = sp.random.uniform(low=0,high=1.0,size=l)
m = (((((1-b)*w/0.9)+1)**(1/(1-b))))
alist.append(m)
for lum in np.nditer(alist):
    a = sp.random.uniform(low=0,high=1,size=1.0)
    dn = u*a
    ts = (u-dn)*1000
    blist = []
    blist.append(ts)
    for ts in np.nditer(blist):
        a1 = 1.022
        a2 = 0.0374
        a3 = 0.003
        a4 = 9.945
        a5 = 127.28
        a6 = 10**(-4)
        a7 = 17.136
        a8 = 5.103
        r0 = 0.00001
        v0 = 0.00001
        p0 = 6.0
        dt = 0.0001
        y0 = [r0,v0,p0]
        t = np.linspace(0., ts, 100000)
        sol = odeint(pend, y0, t, args=(lum, a1, a2, a3,a4,a5,a6,a7,a8),mxstep = 500000)
        print>>j,sol[:,0][-1], lum, ts/1000




Aucun commentaire:

Enregistrer un commentaire