Question #688070 on Yade changed: https://answers.launchpad.net/yade/+question/688070
Status: Open => Answered Jan Stránský proposed the following answer: > 3. i used two NewtonIntegrator because i didn't found another command to tilt the system. maybe newtonIntegr.gravity = ... ? Please open a new question if you want further discuss this topic 4. ... but when i saved it [kinetic energy] ... once more, you are NOT saving kinetic energy, but the value of "e", which is equal to math.e (because "e" is not assign any other value anywhere in your script). > it's always equal 2 even i use (%.3f). I used fil.write('%.3f %.3f\n' % (e,x_g/n)) and the value saved in the file was 2.718 > is there any other method to have values of kinetic energy over time apart plot.addData(i=O.iter,e=kineticEnergy()/n,**O.energy) ? yes, infinitely many methods. E.g. the one you use (just save what you want to save) cheers Jan PS: ok, the solution: ### def AddData(): x_g=0 for b in O.bodies: if isinstance(b.shape,Sphere) and b.shape.radius==0.5: x_g=x_g+b.state.pos[0] e = kineticEnergy()/n # !! this was missing in your original script plot.addData(i=O.iter,e=e,**O.energy) # !! moved outside "for b in O.bodies:" fil.write('%.3f %.3f\n' % (e,x_g/n)) ### -- You received this question notification because your team yade-users is an answer contact for Yade. _______________________________________________ Mailing list: https://launchpad.net/~yade-users Post to : yade-users@lists.launchpad.net Unsubscribe : https://launchpad.net/~yade-users More help : https://help.launchpad.net/ListHelp