[petsc-users] TS generating inconsistent data
Stefano Zampini
stefano.zampini at gmail.com
Sat Mar 14 11:34:41 CDT 2020
I believe this should be automated in TSSolve when step == 0 as for other TS internal stuff.
Hong? Are you ok with this?
> On Mar 14, 2020, at 7:31 PM, Stefano Zampini <stefano.zampini at gmail.com> wrote:
>
> Take a look at
>
> src/tao/unconstrained/examples/tutorials/spectraladjointassimilation.c
>
> You need to call TSResetTrajectory before calling TSSolve when reusing the same TS
>
>
>> On Mar 14, 2020, at 6:54 PM, Zane Charles Jakobs <Zane.Jakobs at colorado.edu <mailto:Zane.Jakobs at colorado.edu>> wrote:
>>
>> Hi PETSc devs,
>>
>> I have some code that implements (essentially) 4D-VAR with PETSc, and the results of both my forward and adjoint integrations look correct to me (i.e. calling TSSolve() and then TSAdjointSolve() works correctly as far as I can tell). However, when I try to use a TaoSolve() to optimize my initial condition, I get this error message:
>>
>> [0]PETSC ERROR: --------------------- Error Message --------------------------------------------------------------
>> [0]PETSC ERROR: Petsc has generated inconsistent data
>> [0]PETSC ERROR: History id should be unique
>> [0]PETSC ERROR: See https://www.mcs.anl.gov/petsc/documentation/faq.html <https://www.mcs.anl.gov/petsc/documentation/faq.html> for trouble shooting.
>> [0]PETSC ERROR: Petsc Development GIT revision: v3.12.4-783-g88ddbcab12 GIT Date: 2020-02-21 16:53:25 -0600
>> [0]PETSC ERROR: ./var_ic_test on a arch-linux2-c-debug named DiffeoInvariant by diffeoinvariant Sat Mar 14 09:39:05 2020
>> [0]PETSC ERROR: Configure options CFLAGS="-O3 -march=native -mtune=native -fPIE" --with-shared-libraries=1 --with-openmp=1 --with-threads=1 --with-fortran=0 --with-avx2=1 CXXOPTFLAGS="-O3 -march=native -mtune=native -fPIE" --with-cc=clang --with-cxx=clang++ --download-mpich
>> [0]PETSC ERROR: #1 TSHistoryUpdate() line 82 in /usr/local/petsc/src/ts/interface/tshistory.c
>> [0]PETSC ERROR: #2 TSTrajectorySet() line 73 in /usr/local/petsc/src/ts/trajectory/interface/traj.c
>> [0]PETSC ERROR: #3 TSSolve() line 4005 in /usr/local/petsc/src/ts/interface/ts.c
>> [0]PETSC ERROR: #4 MixedModelFormVARICFunctionGradient() line 301 in mixed.c
>> [0]PETSC ERROR: #5 TaoComputeObjectiveAndGradient() line 261 in /usr/local/petsc/src/tao/interface/taosolver_fg.c
>> [0]PETSC ERROR: #6 TaoSolve_LMVM() line 23 in /usr/local/petsc/src/tao/unconstrained/impls/lmvm/lmvm.c
>> [0]PETSC ERROR: #7 TaoSolve() line 219 in /usr/local/petsc/src/tao/interface/taosolver.c
>> [0]PETSC ERROR: #8 MixedModelOptimize() line 639 in mixed.c
>> [0]PETSC ERROR: #9 MixedModelOptimizeInitialCondition() line 648 in mixed.c
>> [0]PETSC ERROR: #10 main() line 76 in var_ic_test.c
>> [0]PETSC ERROR: No PETSc Option Table entries
>> [0]PETSC ERROR: ----------------End of Error Message -------send entire error message to petsc-maint at mcs.anl.gov <mailto:petsc-maint at mcs.anl.gov>----------
>>
>> In the function MixedModelFormVARICFunctionGradient(), I do
>>
>> ierr = TSSetTime(model->ts, 0.0);CHKERRQ(ierr);
>> ierr = TSSetStepNumber(model->ts, 0);CHKERRQ(ierr);
>> ierr = TSSetFromOptions(model->ts);CHKERRQ(ierr);
>> ierr = TSSetMaxTime(model->ts, model->obs->t);CHKERRQ(ierr);
>> ierr = TSSolve(model->ts, model->X);CHKERRQ(ierr);
>> ... [allocating and setting cost gradient vec]
>> ierr = TSSetCostGradients(model->ts, 1, model->lambda, NULL);CHKERRQ(ierr);
>> ierr = TSAdjointSolve(model->ts);CHKERRQ(ierr);
>> ierr = VecCopy(model->lambda[0], G);CHKERRQ(ierr);
>>
>> What might be causing the above error? Am I using a deprecated version of the Tao interface? (I'm using TaoSetObjectiveAndGradientRoutine, as done in ex20_opt_ic.c)
>>
>> Thanks!
>>
>> -Zane Jakobs
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20200314/94739a6e/attachment.html>
More information about the petsc-users
mailing list