saving simulation at certain time step

Asked by Alexander Eulitz [Eugen]

hi guys,
I have encountered the following problem:
my simulation starts with a lot of particles falling into a cylinder. after they reached the bottom of the cylinder the start to dispose. this is called initialisation. this needs about 1 million time steps.
Its just a work in progress method for filling up the cylinder with these particle and i know that there are really better ways to handle that.
In my eyes there should be a way to save this simulation after the initialisation so that it can be loaded some days or weeks later continuing the simulation maybe with different parameters or some specific movement of the cyclinder starting at the next timestep.
Is this possible?
I already did save simulation as an .xml file but im not sure whether i can continue simulation with the next yade release and how to load this simulation and continue with a diffrent .py script then I used when i saved the simulation after initialisation.

Is there a way to this?

Thanks for help in advance,
Eugen

Question information

Language:
English Edit question
Status:
Solved
For:
Yade Edit question
Assignee:
No assignee Edit question
Solved by:
Jan Stránský
Solved:
Last query:
Last reply:
Revision history for this message
Jan Stránský (honzik) said :
#1

Hi Eugen,
you can save the position of particles using export module [1] or you can
write your own function creating text file with position and size of all
particles.
cheers
Jan

[1] https://yade-dem.org/doc/yade.export.html

2013/1/31 Eugen Kubowsky <email address hidden>

> New question #220639 on Yade:
> https://answers.launchpad.net/yade/+question/220639
>
> hi guys,
> I have encountered the following problem:
> my simulation starts with a lot of particles falling into a cylinder.
> after they reached the bottom of the cylinder the start to dispose. this is
> called initialisation. this needs about 1 million time steps.
> Its just a work in progress method for filling up the cylinder with these
> particle and i know that there are really better ways to handle that.
> In my eyes there should be a way to save this simulation after the
> initialisation so that it can be loaded some days or weeks later continuing
> the simulation maybe with different parameters or some specific movement of
> the cyclinder starting at the next timestep.
> Is this possible?
> I already did save simulation as an .xml file but im not sure whether i
> can continue simulation with the next yade release and how to load this
> simulation and continue with a diffrent .py script then I used when i saved
> the simulation after initialisation.
>
> Is there a way to this?
>
> Thanks for help in advance,
> Eugen
>
> --
> 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 : <email address hidden>
> Unsubscribe : https://launchpad.net/~yade-users
> More help : https://help.launchpad.net/ListHelp
>

Revision history for this message
Alexander Eulitz [Eugen] (kubeu) said :
#2

Thanks Jan for your answer.
Hm, I already used vtk recorder to save my simulation and postprocess it in paraview. But I dont know whether its possible to import these saved files again in Yade. This would be the easiest way. I would only need the last vtk snapshot after the intialisation of my simulation. After importing it to yade any other .py script could be executed using the loaded particles.
If this is not possible i'd have to write a little script that goes through all particles of my simulation after initialisation process and saves positions in txt, as you said.
is it possible to read a vtk snapshot into yade?

greetings, eugen

Revision history for this message
Best Jan Stránský (honzik) said :
#3

Hi Eugen,
I had in mind export.text function [1] rather than VTK tools.. If you need
also non-spherical particles to be saved, you can write your own function
for facets for example..
Jan

[1] https://yade-dem.org/doc/yade.export.html#yade.export.text

2013/1/31 Eugen Kubowsky <email address hidden>

> Question #220639 on Yade changed:
> https://answers.launchpad.net/yade/+question/220639
>
> Status: Answered => Open
>
> Eugen Kubowsky is still having a problem:
> Thanks Jan for your answer.
> Hm, I already used vtk recorder to save my simulation and postprocess it
> in paraview. But I dont know whether its possible to import these saved
> files again in Yade. This would be the easiest way. I would only need the
> last vtk snapshot after the intialisation of my simulation. After importing
> it to yade any other .py script could be executed using the loaded
> particles.
> If this is not possible i'd have to write a little script that goes
> through all particles of my simulation after initialisation process and
> saves positions in txt, as you said.
> is it possible to read a vtk snapshot into yade?
>
> greetings, eugen
>
> --
> 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 : <email address hidden>
> Unsubscribe : https://launchpad.net/~yade-users
> More help : https://help.launchpad.net/ListHelp
>

Revision history for this message
Christian Jakob (jakob-ifgt) said :
#4

Hi,
You can save/ load simulations with O.save() or O.saveTmp() [1] and O.load() or O.loadTmp() [2].
Also you can store your python variables with O.saveVars() [3] and load it with O.loadVars() [4].

[1] https://yade-dem.org/doc/yade.wrapper.html?highlight=save#yade.wrapper.Omega.save
[2] https://yade-dem.org/doc/yade.wrapper.html?highlight=load#yade.wrapper.Omega.load
[3] https://yade-dem.org/doc/yade.utils.html?highlight=save#yade.utils.saveVars
[4] https://yade-dem.org/doc/yade.utils.html?highlight=load#yade.utils.loadVars

If you saved a sim. with O.save() with yade release (e.g. 0.9.1) it may happen, that you can not load it with a newer version (e.g. 0.9.2). Then you have to run the script again with the new version to get a new save file.

Hope it helps,

Christian

Revision history for this message
Alexander Eulitz [Eugen] (kubeu) said :
#5

Thanks Jan Stránský, that solved my question.

Revision history for this message
Alexander Eulitz [Eugen] (kubeu) said :
#6

I think that the text save way is more flexible if you just need to save the position of spheres. Because it is independent of the yade release you saved it with and could easily be loaded by any yade release.
Nevertheless thanks Christian. I think your proposed solution is the same as saving the simulation as a xml file.
Here is the corresponding doc page for the import of saved coordinates. In case someone is also interested in this. (you wont find yade.import -> search yade.ymport instead)
https://yade-dem.org/doc/yade.ymport.html

PS: how to you make such annotations in comments?

Revision history for this message
Jan Stránský (honzik) said :
#7

Hi Eugen,
what exactly do you mean by "annotations in comments"? :-)
Jan

2013/1/31 Eugen Kubowsky <email address hidden>

> Question #220639 on Yade changed:
> https://answers.launchpad.net/yade/+question/220639
>
> Eugen Kubowsky posted a new comment:
> I think that the text save way is more flexible if you just need to save
> the position of spheres. Because it is independent of the yade release you
> saved it with and could easily be loaded by any yade release.
> Nevertheless thanks Christian. I think your proposed solution is the same
> as saving the simulation as a xml file.
> Here is the corresponding doc page for the import of saved coordinates. In
> case someone is also interested in this. (you wont find yade.import ->
> search yade.ymport instead)
> https://yade-dem.org/doc/yade.ymport.html
>
>
> PS: how to you make such annotations in comments?
>
> --
> 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 : <email address hidden>
> Unsubscribe : https://launchpad.net/~yade-users
> More help : https://help.launchpad.net/ListHelp
>

Revision history for this message
Alexander Eulitz [Eugen] (kubeu) said :
#8

;) Oh my god, what a bad wording ...
I meant footnotes

Revision history for this message
Christian Jakob (jakob-ifgt) said :
#9

Do you mean this: [1], [2], ... ?

... I just typed it ...^^

Revision history for this message
Alexander Eulitz [Eugen] (kubeu) said :
#10

hm, ok that's fine christian ;) Thanks
Is there any plausible reason why you cant share screenshots here in launchpad? I also dont get the point, why there is no code highlighting...

Revision history for this message
Bruno Chareyre (bruno-chareyre) said :
#11

I would not recommend the text save if it can be avoided.
The reason is that everything is lost (mechanical paremeters, contact forces,...). A simulation generated on this basis will in most cases give a mechanically unstable state, so you need an additional "initialisation" phase after reloading (maybe not 1million steps, but still).

O.save() works quite well, and it will give you exactly the state of the simulation where you left it.
Note also that O.save("name.xml") is bad.
O.save("name.yade") is a lot faster and gives smaller files.
O.save("name.yade.gz") is even smaller, 20 times smaller than "name.xml".

Revision history for this message
Bruno Chareyre (bruno-chareyre) said :
#12

For future reference, a more advanced method to avoid reloading positions is examplified in examples/simple-scene/save-then-reload.py [1].
[1]https://github.com/yade/trunk/blob/master/examples/simple-scene/save-then-reload.py