def testKineticEnergy(self): "PBC: utils.kineticEnergy considers only fluctuation velocity, not the velocity gradient" O.step() # updates velocity with homotheticCellResize # ½(mv²+ωIω) # #0 is still, no need to add it; #1 has zero angular velocity # we must take self.initVel since O.bodies[1].state.vel now contains the homothetic resize which utils.kineticEnergy is supposed to compensate back Ek=.5*O.bodies[1].state.mass*self.initVel.squaredNorm() self.assertAlmostEqual(Ek,utils.kineticEnergy())
def testKineticEnergy(self): "PBC: utils.kineticEnergy considers only fluctuation velocity, not the velocity gradient" O.step() # updates velocity with homotheticCellResize # ½(mv²+ωIω) # #0 is still, no need to add it; #1 has zero angular velocity # we must take self.initVel since O.bodies[1].state.vel now contains the homothetic resize which utils.kineticEnergy is supposed to compensate back Ek = .5 * O.bodies[1].state.mass * self.initVel.squaredNorm() self.assertAlmostEqual(Ek, utils.kineticEnergy())
def addPlotData(): plot.addData(t=O.time, Ekin=utils.kineticEnergy())
def addPlotData(): plot.addData(t=O.time, eKin=utils.kineticEnergy())