<div class="gmail_quote">On Mon, Apr 18, 2011 at 20:19, Barry Smith <span dir="ltr"><<a href="mailto:bsmith@mcs.anl.gov">bsmith@mcs.anl.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div id=":251">> I was wondering if I could adjust the time step as the simulations run<br>
> using DAEs & theta method.</div></blockquote></div><div><br></div>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:<div>
<br></div><div><div>changeset:   20:3a389a7b1f12</div><div>user:        <a href="mailto:knepley@spinetta.mcs.anl.gov">knepley@spinetta.mcs.anl.gov</a></div><div>date:        Thu Oct 11 06:07:09 2001 -0600</div><div>summary:     bk-changeset-1.21.1.2</div>
</div><div><br></div><div>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.</div><div><br></div><div>Alternatively, you can use TSSetPreStep() to choose the step size. Unfortunately, it has confusing semantics near the end of the interval.</div>
<div><br></div><div><div>  for (i=0; i<ts->max_steps; i++) {</div><div>    if (ts->ptime + ts->time_step > ts->max_time) break;</div><div>    ierr = TSPreStep(ts);CHKERRQ(ierr);</div></div><div><br></div>