TSSetPostEventSecondStep#

Set the second time step to use after the event

Synopsis#

#include "petscts.h" 
PetscErrorCode TSSetPostEventSecondStep(TS ts, PetscReal dt2)

Logically Collective

Input Parameters#

  • ts - time integration context

  • dt2 - second post event step

Options Database Key#

  • -ts_event_post_event_second_step - second time step after the event

Notes#

TSSetPostEventSecondStep() allows one to set the second time step after the event.

The post-event time steps should be selected based on the post-event dynamics. If the dynamics are stiff, or a significant jump in the equations or the state vector has taken place at the event, conservative (small) steps should be employed. If not, then larger time steps may be appropriate.

This function accepts either a numerical value for dt2, or PETSC_DECIDE (default).

To describe the way PETSC_DECIDE affects the post-event steps, consider a trajectory of time points t1 -> t2 -> t3 -> t4. Suppose the TS has reached and calculated the solution at point t3, and has planned the next move: t3 -> t4. At this moment, an event between t2 and t3 is detected, and after a few iterations it is resolved at point te, t2 < te < t3. After event te, two post-event steps can be specified: the first one dt1 (TSSetPostEventStep()), and the second one dt2 (TSSetPostEventSecondStep()). Both post-event steps can be either PETSC_DECIDE, or a number. Four different combinations are possible:

  1. dt1 = PETSC_DECIDE, dt2 = PETSC_DECIDE. Then, after te TS goes to t3, and then to t4. This is the all-default behaviour.

  2. dt1 = PETSC_DECIDE, dt2 = x2 (numerical). Then, after te TS goes to t3, and then to t3+x2.

  3. dt1 = x1 (numerical), dt2 = x2 (numerical). Then, after te TS goes to te+x1, and then to te+x1+x2.

  4. dt1 = x1 (numerical), dt2 = PETSC_DECIDE. Then, after te TS goes to te+x1, and event handler does not interfere to the subsequent steps.

In the special case when te == t3 with a good precision, the post-event step te -> t3 is not performed, so behaviour of (1) and (2) becomes:

1a. After te TS goes to t4, and event handler does not interfere to the subsequent steps.

2a. After te TS goes to t4, and then to t4+x2.

Warning! When the second post-event step (either PETSC_DECIDE or a numerical value) is managed by the event handler, i.e. in cases 1, 2, 3 and 2a, TSAdapt will never analyse (and never do a reasonable rejection of) the first post-event step. The first post-event step will always be accepted. In this situation, it is the user’s responsibility to make sure the step size is appropriate! In cases 4 and 1a, however, TSAdapt will analyse the first post-event step, and is allowed to reject it.

This function can be called not only in the initial setup, but also inside the postevent() callback set with TSSetEventHandler(), affecting the post-event steps for the current event, and the subsequent ones.

The default value is PETSC_DECIDE.

See Also#

TS: Scalable ODE and DAE Solvers, TS, TSEvent, TSSetEventHandler(), TSSetPostEventStep()

Level#

advanced

Location#

src/ts/event/tsevent.c


Index of all TS routines
Table of Contents for all manual pages
Index of all manual pages