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
评论列表
文章目录