[petsc-users] Turning off TSADAPT still adapts time step

Jed Brown jed at jedbrown.org
Mon Apr 27 10:58:35 CDT 2015


Mark Lohry <mlohry at princeton.edu> writes:

> The TSAdaptSetType is being called. Looking at TSStep_Theta, is it 
> possible that here:
>
> /* Register only the current method as a candidate because we're not 
> supporting multiple candidates yet. */
>      ierr = TSGetAdapt(ts,&adapt);CHKERRQ(ierr);
>      ierr = TSAdaptCandidatesClear(adapt);CHKERRQ(ierr);
>      ierr = 
> TSAdaptCandidateAdd(adapt,NULL,th->order,1,th->ccfl,1.0,PETSC_TRUE);CHKERRQ(ierr);
>      ierr = 
> TSAdaptChoose(adapt,ts,ts->time_step,&next_scheme,&next_time_step,&accept);CHKERRQ(ierr);
>
> TSAdaptCandidatesClear is unsetting whatever method I'm setting?

No.  It does not affect the implementation, it just clears the candidate
list that the implementation may choose from.

PetscErrorCode TSAdaptCandidatesClear(TSAdapt adapt)
{
  PetscErrorCode ierr;

  PetscFunctionBegin;
  PetscValidHeaderSpecific(adapt,TSADAPT_CLASSID,1);
  ierr = PetscMemzero(&adapt->candidates,sizeof(adapt->candidates));CHKERRQ(ierr);
  PetscFunctionReturn(0);
}


When you set -ts_adapt_type none, the function below should be called.
Verify that in a debugger.  Also, always run with -ts_adapt_monitor when
trying to debug something like this.

static PetscErrorCode TSAdaptChoose_None(TSAdapt adapt,TS ts,PetscReal h,PetscInt *next_sc,PetscReal *next_h,PetscBool *accept,PetscReal *wlte)
{

  PetscFunctionBegin;
  *accept  = PETSC_TRUE;
  *next_sc = 0;                 /* Reuse the same order scheme */
  *next_h  = h;                 /* Reuse the old step */
  *wlte    = -1;                /* Weighted local truncation error was not evaluated */
  PetscFunctionReturn(0);
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 818 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20150427/10cc8f3d/attachment.pgp>


More information about the petsc-users mailing list