ReactionSystem.py 文件源码

python
阅读 18 收藏 0 点赞 0 评论 0

项目:Chemical-Reaction-System-Simulator 作者: axlevisu 项目源码 文件源码
def run(self,t=1000,ts=100000,plot=False):
        """
        Run it for time t with ts number of time steps
        Outputs the concentration profile for the run
        default values are 100000 and 1000000
        """ 
        t_index = np.linspace(0, t, ts)
        y = self.concentrations
        output = odeint(odes, y, t_index, args= (self.reactions,self.rates))
        self.concentrations = output[-1,:]
        if plot:
            for i in xrange(output.shape[1]):
                label = self.species[i]
                plt.plot(t_index, output[:, i], label=label)
            plt.legend(loc='best')
            plt.xlabel('t')
            plt.title('Concentration Profile')
            plt.grid()
            plt.show()
        return output
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号