[petsc-users] Some clarifications about TS ex3.c

Smith, Barry F. bsmith at mcs.anl.gov
Thu Nov 29 17:41:53 CST 2018



> On Nov 29, 2018, at 4:50 PM, Sajid Ali <sajidsyed2021 at u.northwestern.edu> wrote:
> 
> Another question I want to ask is about dttol that is used in the Monitor function as follows :
> 
> 417:   dttol = .0001;
> 418:   PetscOptionsGetReal(NULL,NULL,"-dttol",&dttol,NULL);
> 419:   if (dt < dttol) {
> 420:     dt  *= .999;
> 421:     TSSetTimeStep(ts,dt);
> 422:   }
> 
> Is this decreasing dt if it's less than tolerance ? 

   Yes, note this is arbitrary and there would never be a reason to change dt by .999; it is just to test that TSSetTimeStep() works.

> 
> I commented out the norm calculation (lines 404-415) the time is stuck at 0 ( as per the output of -ts_monitor).

   This is because dt is never set (when you comment out those lines), and since it is never set it is likely zero hence less than dttol hence TSSetTimeStep() is called with a value of 0.0 which is why it gets "stuck" at 0.0;

> But if I comment out the above lines (417-422) as well, everything works fine. What explains this behaviour ?
> 
> Thank You! 
> Sajid Ali
> Applied Physics
> Northwestern University



More information about the petsc-users mailing list