export PETSC_OPTIONS="-ts_trajectory_use_history 0" before starting python or

os.environ['PETSC_OPTIONS'] = '-ts_trajectory_use_history 0'

is the easiest.


> On Aug 18, 2020, at 6:12 PM, Salazar De Troya, Miguel via petsc-users 
> <[email protected]> wrote:
> 
> 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" <[email protected] <mailto:[email protected]>>
> Date: Tuesday, August 18, 2020 at 3:46 PM
> To: "Salazar De Troya, Miguel" <[email protected] 
> <mailto:[email protected]>>
> Cc: "Zhang, Hong via petsc-users" <[email protected] 
> <mailto:[email protected]>>
> 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 
>> <[email protected] <mailto:[email protected]>> 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

Reply via email to