Hello Chrono developers,
To ensure a tighter coupling between (mesh or particle-based ) CFD solver and Chrono, it may be necessary to conduct several iterations per time step. Is there a function in ChSystem that can simply restore the system state (bodies, links, FEA, contact, etc) to the previous time step?
The current archives and (de)serialization write the system to an external file (binary, json, xml), which I suppose supports a restart simulation. https://api.projectchrono.org/tutorial_demo_archive.html
Every time a system state is deserialized through such a file, the predefined bodies and links are, however, not restored to the previous time step. Could the Chrono system be serialized directly into the memory, or even better, can the system restore the states of all its children to a previous time step, while still using all of the children’s predefined pointers/references? Is this possible, or did I misunderstand something?
I notice that the current FSI module adopts a loose coupling approach. No fluid-solid iteration is to be performed within every time step.
Thank you,
Haifei
Hi Haifei,
Peng Chao is correct, but his answer may be a bit confusing.
Indeed, since there are no structural changes to your system (e.g., addition or removal of components), all you need to do is save the state of the system and restore it when needed.
From the functions Peng Chao listed, you only need the positions and velocities (those completely define the state of the system, with accelerations and Lagrange multipliers calculated during integration). Keep also in mind that the “integrable” you are dealing with here is the ChSystem object itself.
With that, and assuming sys is your ChSystem object, you should be able to do what you need with something like the following:
double t = sys.GetChTime();
ChState X(sys.GetNumCoordsPosLevel(), &sys);
ChStateDelta V(sys.GetNumCoordsVelLevel(), &sys);
sys.StateGather(X, V, t);
sys.SetChTime(t);
sys.StateScatter(X, V, t, true);
Note that the above code uses the very latest code in the main branch of the Chrono repository (after a large refactoring that was merged just a while ago). Assuming you are using an older version of the Chrono code, you will need to replace the functions ChSystem::GetNumCoordsPosLevel() and GetNumCoordsVelLevel() with their older names.
Note that, since currently all Chrono solvers and integrators are memory-less (i.e., they do not use cached information from previous steps), without any other changes (e.g. in loading conditions or solver/integrator settings), this approach should allow you to exactly reproduce the original sequence of steps starting from the checkpoint. This may change in the future if we make any changes so that past information is used in the time stepping (one such example could be contact history which would be difficult/expensive to cache).
--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/ce445fcb-8714-42fd-a51e-2b10a73876bfn%40googlegroups.com.