Example #1
0
File: pbc.py Project: tufubin/trunk
	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())
Example #2
0
 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())
Example #3
0
def addPlotData(): 
  plot.addData(t=O.time, Ekin=utils.kineticEnergy())
Example #4
0
def addPlotData():
    plot.addData(t=O.time, eKin=utils.kineticEnergy())