diff --git a/src/ts/examples/tutorials/ex23.c b/src/ts/examples/tutorials/ex23.c index 835f476..dbe53aa 100644 --- a/src/ts/examples/tutorials/ex23.c +++ b/src/ts/examples/tutorials/ex23.c @@ -14,6 +14,7 @@ static const char help[] = "Demonstrates the use of TSEvaluteObjectiveAndGradien It also shows how to compute gradients with point-functionals of the type f(u,T,m), with T in (T0,TF]. */ #include +#include "petsc/private/tsimpl.h" typedef struct { PetscBool isnorm; @@ -539,6 +540,11 @@ int main(int argc, char* argv[]) /* Test objective function evaluation */ ierr = VecSet(U,user.a);CHKERRQ(ierr); ierr = TSEvaluateObjectiveAndGradient(ts,t0,dt,tf,U,M,NULL,&obj);CHKERRQ(ierr); + { + ierr = MatView(ts->Arhs,NULL);CHKERRQ(ierr); + ierr = TSComputeRHSJacobian(ts,tf,U,ts->Arhs,ts->Brhs);CHKERRQ(ierr); + ierr = MatView(ts->Arhs,NULL);CHKERRQ(ierr); + } if (!testgeneral && user.b != 0.0) { ierr = PetscPrintf(PETSC_COMM_WORLD,"Objective function: time [%g,%g], val %g (should be %g)\n",t0,tf,(double)obj,(double)(objtest+store_Event));CHKERRQ(ierr); } else { /* too lazy to compute an analytical solution */