[petsc-users] Best way to save entire solution history of a TS

Jed Brown jed at jedbrown.org
Sun Sep 28 13:34:42 CDT 2014

Miguel Angel Salazar de Troya <salazardetroya at gmail.com> writes:

> Hello
> I'm performing an adjoint sensitivity analysis in a transient problem and I
> need to save the entire solution history. I don't have many degrees of
> freedom or time steps so I should be able to avoid memory problems. I've
> thought of creating a std::vector<Vec> and save all the PETSc Vec that I
> get from TSGetSolution there. Would this be a problem if I'm running the
> simulation in parallel? Is there a better way to save the entire solution
> history in memory?

Your suggestion is fine.  I would do it from a monitor (TSMonitorSet)
and VecCopy the solution vector into your array of solutions.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 818 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20140928/74bf73b5/attachment.pgp>

More information about the petsc-users mailing list