Qihan,
A word of caution about the WriteCheckpoint and ReadCheckpoint functions that Luning mentioned. While these are indeed meant for restarting a simulation the way you intend to do, when I wrote them, I was only interested in reinitializing a granular dynamics simulation. As such, they are somewhat limited in what kind of systems they can be applied to. If you look at them, you will see that they only extract and re-apply body states (position, orientation, linear and angular velocity). This will not be enough for multibody systems that include other modeling elements that have states (such as ChShaft, or some of the motors in Chrono).
Arguably a better way of doing this reinitialization is by saving (and caching) the state vector for the entire system and then reapplying it when you want to reinitialize. I have not formalized this in Chrono, but you can see an example precisely doing that in the test_VEH_reinit_wheeled in my own fork of the Chrono repository. The two functions in that program you should look at are SaveCheckpoint and LoadCheckpoint. They have some extra stuff specific to a vehicle model which you should discard (or else adapt) for your own problem.
By the way, adding proper formal support for checkpointing in Chrono, across all modules and system types, is on our todo list.
--Radu
--
You received this message because you are subscribed to the Google Groups "ProjectChrono" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
projectchron...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/projectchrono/c5898d28-6d64-48b5-9a25-7a8617bcef98n%40googlegroups.com.