[petsc-users] TS routine calling order

Jed Brown jed at jedbrown.org
Mon Feb 13 12:20:48 CST 2017


Gideon Simpson <gideon.simpson at gmail.com> writes:

> In terms of the TS PreStep, PostStep, Monitor, etc., what is the calling order?  I’m specifically curious as to whether the Monitor routine is run before or after the PostStep, but I’d be interested to know what the whole workflow is.

Look at TSSolve:

    while (!ts->reason) {
      ierr = TSMonitor(ts,ts->total_steps,ts->ptime,ts->vec_sol);CHKERRQ(ierr);
      if (!ts->steprollback) {
        ierr = TSPreStep(ts);CHKERRQ(ierr);
      }
      ierr = TSStep(ts);CHKERRQ(ierr);
      if (ts->vec_costintegral && ts->costintegralfwd) { /* Must evaluate the cost integral before event is handled. The cost integral value can also be rolled back. */
        ierr = TSForwardCostIntegral(ts);CHKERRQ(ierr);
      }
      ierr = TSPostEvaluate(ts);CHKERRQ(ierr);
      ierr = TSEventHandler(ts);CHKERRQ(ierr); /* The right-hand side may be changed due to event. Be careful with Any computation using the RHS information after this point. */
      if (!ts->steprollback) {
        ierr = TSTrajectorySet(ts->trajectory,ts,ts->total_steps,ts->ptime,ts->vec_sol);CHKERRQ(ierr);
        ierr = TSPostStep(ts);CHKERRQ(ierr);
      }
    }
    ierr = TSMonitor(ts,ts->total_steps,ts->ptime,ts->vec_sol);CHKERRQ(ierr);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20170213/90b5b6c6/attachment.pgp>


More information about the petsc-users mailing list