[petsc-users] TSPseudo overriding SNES iterations

Barry Smith bsmith at mcs.anl.gov
Wed Jan 4 14:22:16 CST 2017


   Here is the code in TSCreate_Pseudo() 

  ierr = TSGetSNES(ts,&snes);CHKERRQ(ierr);
  ierr = SNESGetType(snes,&stype);CHKERRQ(ierr);
  if (!stype) {ierr = SNESSetType(snes,SNESKSPONLY);CHKERRQ(ierr);}

  it doesn't really "override" things in SNES, it just sets a different default SNES solver. 

  Because of the complexity of the defaults for different circumstances it is really helpful to run with -ts_view (or -snes_view etc) to see what solver is actually being used as opposed to what solver you think is being used. Like you, I would assume that NEWTONLS is being used with TSPSEUDO, but as the other developer noted in the literature it seems the "single Newton step" approach is the "community standard" and it could be that using a single Newton step does led to the fastest solution time.

   Barry





> On Jan 4, 2017, at 2:09 PM, Mark W. Lohry <mlohry at princeton.edu> wrote:
> 
> Thanks for quick reply Barry, that did the trick. 
> 
> While I respect the belief of the anonymous distinguished developer, IMHO it would probably be better for things in TS to not override things in SNES unless necessary.
> 
> On Jan 4, 2017 2:50 PM, Barry Smith <bsmith at mcs.anl.gov> wrote:
> 
>    Mark,
> 
>      This happens because some distinguished PETSc developer believes that by definition Pseudo transient continuation should not do multiple Newton iterations per "time step".  Thus this developer defaulted the nonlinear solver in TSPSEUDO to be KSPONLY which, since it only does a linear solver does not support multiple Newton steps even if you ask for multiple steps.
> 
>    To get the effect you want, and what, IMHO many people may want, you need to run with -snes_type newtonls Please let us know if this does not work.
> 
>    Sorry for the confusion,
> 
>     Barry
> 
> 
> 
> > On Jan 4, 2017, at 1:26 PM, Mark W. Lohry <mlohry at princeton.edu> wrote:
> > 
> > I have an unsteady problem I'm trying to solve for steady state. The regular time-accurate stepping works fine (uses around 5 Newton iterations with 100 krylov iterations each per time step) with beuler stepping. 
> > 
> > 
> > But when changing only TSType to pseudo it looks like SNES max iterations is getting set to 1, and each pseduo time step then only does a single Newton step and then throws SNES CONVERGED_ITS 1 despite setting snessettolerances to allow 50 Newton steps.
> > 
> > I'm trying to use all the same configuration here that works for backward Euler, but just continually increase the step size each time step. What am I missing here?
> > 
> > Thanks,
> > Mark
> 
> 



More information about the petsc-users mailing list