[petsc-users] Error calling TSSolve more than once with TSSetSaveTrajectory

Salazar De Troya, Miguel salazardetro1 at llnl.gov
Tue Aug 18 18:12:46 CDT 2020


Would it be possible for you to share a patch, PR or to point where in the ts.c file to add those lines? I am working from petsc4py, it would be easy for me to modify my petsc local repo than creating the petsc4py interface functions for those two calls.

Thanks
Miguel

From: "Zhang, Hong" <hongzhang at anl.gov>
Date: Tuesday, August 18, 2020 at 3:46 PM
To: "Salazar De Troya, Miguel" <salazardetro1 at llnl.gov>
Cc: "Zhang, Hong via petsc-users" <petsc-users at mcs.anl.gov>
Subject: Re: [petsc-users] Error calling TSSolve more than once with TSSetSaveTrajectory

To get rid of this error, you can disable TSHistory with the command line option -ts_trajectory_use_history 0

or set up your TS with

TSGetTrajectory(ts, &tj);
TSTrajectorySetUseHistory(tj, PETSC_FALSE);

It is a known issue, but not the intended behavior for TSSetSaveTrajectory. I think TSHistory should be disabled by default in TS. It is actually disabled in the setup for TSAdjoint. So if you call TSAdjointSolve once, this error should not occur in the following calls to TSSolve.

Hong(Mr.)


On Aug 18, 2020, at 1:11 PM, Salazar De Troya, Miguel via petsc-users <petsc-users at mcs.anl.gov<mailto:petsc-users at mcs.anl.gov>> wrote:

Hello,

If I set up my TS with TSSetSaveTrajectory() and then call TSSolve() more than once, the second time I get this error:

[0] TSSolve() line 4102 in /Users/salazardetro1/scicomp_libraries/firedrake-debug/firedrake/src/petsc/src/ts/interface/ts.c
[0] TSTrajectorySet() line 73 in /Users/salazardetro1/scicomp_libraries/firedrake-debug/firedrake/src/petsc/src/ts/trajectory/interface/traj.c
[0] TSHistoryUpdate() line 82 in /Users/salazardetro1/scicomp_libraries/firedrake-debug/firedrake/src/petsc/src/ts/interface/tshistory.c
[0] Petsc has generated inconsistent data
[0] History id should be unique

If I call TSAdjointSolve() in between calls to TSSolve(), there is no problem. Is this the intended behavior for TSSetSaveTrajectory? Meaning that TSAdjointSolve() always has to be called right after TSSolve() if TSSetSaveTrajectory() is called. I need to call TSSolve() independently of TSAdjointSolve() whenever I want to perform a line search during the optimization.

Is there a workaround like creating a new trajectory whenever TSSolve() is called?

Thanks
Miguel



Miguel A. Salazar de Troya
Postdoctoral Researcher, Lawrence Livermore National Laboratory
B141
Rm: 1085-5
Ph: 1(925) 422-6411

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20200818/36411520/attachment-0001.html>


More information about the petsc-users mailing list