Python odeint,解决方案返回初始条件数组

时间:2014-08-28 01:15:11

标签: scipy odeint

  

见下面的代码

    import numpy as np
    from scipy.integrate import odeint

    # Define constants
    U = 1000    
    a = 5    
    Ta0 = (37+273)   
    V_tot = 6 
    FA0 = 14.7   
    CA0 = 9.3  
    deltaCp = 0
    Hrx_T = -6900
    sumTheta_Cp = 159

    #Integration conditions

    V = np.linspace(0,V_tot,10) 
    X0 = 0
    T0 = 310

    #Define reaction rate constant as function of temperature 
    def k(T):
        return 31.1*np.exp(7906*((T-360)/(T*360)))

    def Kc(T):
        return 3.03*np.exp(-830.3*((T-333)/(T*333)))

    #Define rate law as function of temperature, conversion 

    def rA(T,X):
        return -k(T)*CA0*(1-(1+(1/Kc(T))*X))


    #Energy balance equation for tubular reactor

    def ode_vector(diff_var,V):

        T = diff_var[0]
        X = diff_var[1]                          

        dT_dV=(U*a*(Ta0-T)+rA(T,X)*Hrx_T/(FA0*sumTheta_Cp+deltaCp*X))
        dX_dV= -rA(T,X)/FA0

        d_dV = [dT_dV,dX_dV]

        return d_dV

    initial_vector = [T0, X0]

    solution = odeint(ode_vector,initial_vector,V)

print solution 
  

当我执行此代码时,我得到了一个初始条件数组

     

[[310. 0.]   [310. 0.]   [310. 0.]   [310. 0.]   [310. 0.]   [310. 0.]   [310. 0.]   [310. 0.]   [310. 0.]   [310. 0。]]

     

对此的任何想法都将非常感激。

0 个答案:

没有答案