[petsc-users] residual norm with TSPSEUDO

Smith, Barry F. bsmith at mcs.anl.gov
Wed Jun 13 09:59:00 CDT 2018


   Take a look at TSPseudoMonitorDefault() in src/ts/impls/pseudo/posindep.c 

    The problem is that you need to expose 

typedef struct {
  Vec update;       /* work vector where new solution is formed */
  Vec func;         /* work vector where F(t[i],u[i]) is stored */
  Vec xdot;         /* work vector for time derivative of state */

  /* information used for Pseudo-timestepping */

  PetscErrorCode (*dt)(TS,PetscReal*,void*);              /* compute next timestep, and related context */
  void *dtctx;
  PetscErrorCode (*verify)(TS,Vec,void*,PetscReal*,PetscBool*);  /* verify previous timestep and related context */
  void *verifyctx;

  PetscReal fnorm_initial,fnorm;                   /* original and current norm of F(u) */
  PetscReal fnorm_previous;

  PetscReal dt_initial;                     /* initial time-step */
  PetscReal dt_increment;                   /* scaling that dt is incremented each time-step */
  PetscReal dt_max;                         /* maximum time step */
  PetscBool increment_dt_from_initial_dt;
  PetscReal fatol,frtol;
} TS_Pseudo;

inside your application code (that is make a copy of this struct definition and put it in your code so you can access the fields).

   Barry


> On Jun 13, 2018, at 12:32 AM, Praveen C <cpraveen at gmail.com> wrote:
> 
> Dear all
> 
> How can I access the current residual norm inside my TSMonitor function when using TSPSEUDO ?
> 
> Thanks
> praveen



More information about the petsc-users mailing list