[petsc-dev] Fwd: [petsc-maint #70675] update of the timestep in theta method

Jed Brown jed at 59A2.org
Mon Apr 18 13:36:46 CDT 2011


On Mon, Apr 18, 2011 at 20:19, Barry Smith <bsmith at mcs.anl.gov> wrote:

> > I was wondering if I could adjust the time step as the simulations run
> > using DAEs & theta method.
>

We have longer term plans to add a proper interface for using adaptive
controllers with all the methods in TS, but TSTheta is not currently set up
for it so you have to do something slightly dirty. You can use
TSSetPostStep() to register a callback which you can use to modify the step
size. When this function was added in 2001, it didn't have a context:

changeset:   20:3a389a7b1f12
user:        knepley at spinetta.mcs.anl.gov
date:        Thu Oct 11 06:07:09 2001 -0600
summary:     bk-changeset-1.21.1.2

It should definitely get a context. Using TSPostStep() to change the step
size is actually not ideal because (in this case) the monitor will see the
wrong time step.

Alternatively, you can use TSSetPreStep() to choose the step size.
Unfortunately, it has confusing semantics near the end of the interval.

  for (i=0; i<ts->max_steps; i++) {
    if (ts->ptime + ts->time_step > ts->max_time) break;
    ierr = TSPreStep(ts);CHKERRQ(ierr);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20110418/5139154e/attachment.html>


More information about the petsc-dev mailing list