def stableTimestep(self, old_dt): from ExchangerLib import exchangeTimestep if self.synchronized: #print "start new big step" mycomm = self.communicator self.ccplr_t = exchangeTimestep(old_dt, mycomm.handle(), self.sinkComm.handle(), 0) self.ecplr_t = 0 self.synchronized = False dt = old_dt self.ecplr_t += dt # clipping oversized ecplr_t if self.ecplr_t >= self.ccplr_t: #print "** clip dt **" #print "dt = %g, ecplr_t = %g, ccplr_t = %g" %(dt, self.ecplr_t, self.ccplr_t) dt = dt - (self.ecplr_t - self.ccplr_t) self.ecplr_t = self.ccplr_t self.synchronized = True #print self.name, " SYNCHRONIZED!" # store timestep for interpolating boundary velocities self.inlet.storeTimestep(self.ecplr_t, self.ccplr_t) #print "%s - old dt = %g exchanged dt = %g" % ( # self.name, old_dt, dt) #print "ccplr_t = %g ecplr_t = %g" % (self.ccplr_t, self.ecplr_t) return dt
def stableTimestep(self, dt): #used by controller from ExchangerLib import exchangeTimestep remote_dt = exchangeTimestep(dt, self.communicator.handle(), self.srcCommList[0].handle(), self.srcCommList[0].size - 1) remote_dt2 = exchangeTimestep(dt, self.communicator.handle(), self.srcCommList2[0].handle(), self.srcCommList2[0].size - 1) assert remote_dt < dt, \ 'Size of dt in the esolver is greater than dt in the csolver!' assert remote_dt2 < dt, \ 'Size of dt in the esolver is greater than dt in the csolver2!' #print "%s - old dt = %g exchanged dt = %g" % ( # self.__class__, dt, remote_dt) return dt