← Back to team overview

yade-users team mailing list archive

Re: [Question #258679]: Non conservation of energy when, simulation is loaded after saving

 

1. do you check energy at the end of first iteration, or at the beginning of first iteration?
2. do you have correct energy in 2nd iteration?




ipemath said:     (by the date of Fri, 05 Dec 2014 18:06:52 -0000)

> Question #258679 on Yade changed:
> https://answers.launchpad.net/yade/+question/258679
> 
> Description changed to:
> Hai everyone,
> 
> This is my first post in this forum. I am also a relatively new
> user. I am presently trying to understand yade by solving a problem
> of projectile impingement on a particle bed. Because of the
> restriction in SuperComuputer usage time, I have to save and reload
> the interval after certain fixed number of iterations. Hence I am
> using multiple python scripts. The first one sets the problem, runs
> the problem for a fixed no of iterations and saves it. Then the
> second script reopens the saved simulation and runs it futher for
> some more steps. In the course of simulation I am monitoring
> kinematic variables and total energy of the system. In the case of
> the strategy mentioned above(multiple scripts), the energy is not
> conserved. There is a sharp drop in energy when the second script
> is run. But if I used a single python script to run the simulation
> for the same number of steps, the energy is conserved. Below I
> would like to give below the important points of my scripts in the
> form of a pseudocode.
> **********************************************************************************************************
> First Script.
> 
> #Create the spheres(Uniform sized ones for the bed, a bigger on
> with an initial velocity as projectile) #Create the enclosing walls
> for the bed O.engine[
> ForceResetter(),
> .........................................
> InteractionLoop(
> .........................................
> ........................................
> [Law2_ScGeom_MindlinPhys_Mindlin(label='Mindlin')]
> ),
> PyRunner(initRun=True,iterPeriod=50,command='myFunction()'),
> PyRunner(initRun=True,iterPeriod=50,command='stopCond()'),
> ]   
> -------------------------
> Mindlin.calcEnergy=True
> fet=open('egtotal.dat','w')
> ------------------------------
> def myFunction():
>         pe_normal  = Mindlin.normElastEnergy() # normal PE
>  	pe_shear  = Mindlin.shearEnergy # shear PE
> 	norm_damp_dissip = Mindlin.normDampDissip # normal diss
>  	shear_damp_dissip = Mindlin.shearDampDissip # shear diss
>  	fric_dissip = Mindlin.frictionDissipation # loss due to
> friction E_tracker	  = dict(O.energy.items())
> 	E_kin_trans = E_tracker['kinTrans']
> 	E_kin_rotation = E_tracker['kinRot']
> 	etotal =  pe_normal + pe_shear + E_kin_trans +
> E_kin_rotation + fric_dissip + norm_damp_dissip + shear_damp_dissip
> # total energy fet.write('%g\n'%(etotal))
> 
> def stopCond():
>         if O.iter>10000
>               O.pause
>               fet.close()
>               O.save("1.xml.bz2") 
>               O.exitNoBacktrace()
> 
> O.run()
> #######################################################
> Second Script:
> O.load("1.xml.bz2")
> ----------------------------
> Mindlin.calcEnergy=True
> fet=open('egtotal.dat','a') #Append to the existing values
> -------------------------------
> def myFunction():
>         pe_normal  = Mindlin.normElastEnergy() # normal PE
>  	pe_shear  = Mindlin.shearEnergy # shear PE
> 	norm_damp_dissip = Mindlin.normDampDissip # normal diss
>  	shear_damp_dissip = Mindlin.shearDampDissip # shear diss
>  	fric_dissip = Mindlin.frictionDissipation # loss due to
> friction E_tracker	  = dict(O.energy.items())
> 	E_kin_trans = E_tracker['kinTrans']
> 	E_kin_rotation = E_tracker['kinRot']
> 	etotal =  pe_normal + pe_shear + E_kin_trans +
> E_kin_rotation + fric_dissip + norm_damp_dissip + shear_damp_dissip
> # total energy fet.write('%g\n'%(etotal)) def stopCond():
>         if O.iter>20000
>               O.pause
>               fet.close()
>               O.save("1.xml.bz2") 
>               O.exitNoBacktrace()
> 
> O.run()
> ****************************************************************************************
> The above given are excerpts from the script I am using and this
> strategy doesnt conserve the energy. It dips sharply when the
> second script starts running. 
> 
> I request the help of the yade experts in finding a solution to this
> problem.
> 
> -- 
> You received this question notification because you are a member of
> yade-users, which is an answer contact for Yade.
> 
> _______________________________________________
> Mailing list: https://launchpad.net/~yade-users
> Post to     : yade-users@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~yade-users
> More help   : https://help.launchpad.net/ListHelp
> 


-- 
Janek Kozicki                               http://janek.kozicki.pl/  |


Follow ups

References