problem.py 文件源码

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

项目:Python-Solver 作者: zaidedan 项目源码 文件源码
def solveUnst(self,t):
    solution = [None]*len(self.mapping)
    # This has the unsteady part
    # Solver, just live and let live  
    for ix, (i,k) in enumerate(self.mapping):
      solution[ix] = self.b[i][k]
    soln = odeint(self.rUnst, solution, t,hmax=(t[-1]-t[0])/len(t), \
      rtol = 1e-4, atol = 1e-4)

    # final update
    self.updateUnst(t[-1])
    self.update(soln[-1,:])

    # Lets collect all the steps
    fullSolution = dict([(b.name + '_'+s,[]) for b in self.b for s in b.state])
    for j in range(0,len(t)):
      for ix, (i,k) in enumerate(self.mapping):
        fullSolution[self.b[i].name+'_'+k].append(soln[j,ix])
    fullSolution['t'] = t
    return fullSolution
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号