[petsc-users] [TimeStepping] Eventhandler

Zhang, Hong hongzhang at anl.gov
Sun Feb 3 10:04:20 CST 2019


ex40 seems to work fine. Here is the output with -ts_monitor -ts_event_monitor -ts_dt 0.01 :

8 TS dt 0.5 time 3.11
9 TS dt 0.5 time 3.61
TSEvent: iter 0 - Event 0 interval detected [3.61 - 4.11]
9 TS dt 0.467955 time 3.61 (r)
TSEvent: iter 1 - Stepping forward as no event detected in interval [3.61 - 4.07796]
10 TS dt 0.00365179 time 4.07796
TSEvent: iter 2 - Stepping forward as no event detected in interval [4.07796 - 4.08161]
11 TS dt 2.5403e-05 time 4.08161
TSEvent: Event 0 zero crossing at time 4.08163 located in 3 iterations
Ball hit the ground at t =  4.08 seconds
12 TS dt 0.0283673 time 4.08163
13 TS dt 0.01 time 4.11
14 TS dt 0.1 time 4.12

The event occurs during the step [3.61- 4.11]. After the event is located at 4.08163, the next step after the event should be 4.11-4.08163 = 0.02837 (see 12 TS) to complete the original step. After 4.11, the specified initial stepsize dt=0.01 will be used.

Hong (Mr.)

> On Feb 3, 2019, at 6:08 AM, Moritz Huck via petsc-users <petsc-users at mcs.anl.gov> wrote:
> 
> Hi Barry,
> 
> src/ts/examples/tutorials/ex40.c (run with ARKIMEX3 and initial dt=1e-2) has the same behavior:
> 
> TSEvent: iter 0 - Event 0 interval detected [3.61 - 4.11]
> TSEvent: iter 1 - Stepping forward as no event detected in interval [3.61 - 4.07796]
> TSEvent: iter 2 - Stepping forward as no event detected in interval [4.07796 - 4.08161]
> TSEvent: Event 0 zero crossing at time 4.08163 located in 3 iterations
> Ball hit the ground at t =  4.08 seconds
>       TSAdapt basic arkimex 0:3 step  13 accepted t=4.11       + 1.000e-02 dt=1.000e-01  wlte=    0  wltea=   -1 wlter=   -1
> 
>       TSAdapt basic arkimex 0:3 step  14 accepted t=4.12       + 1.000e-01 dt=5.000e-01  wlte=    0  wltea=   -1 wlter=   -1
> 
> It continues at the end of the "event interval" with the initial timestep.
> 
> Best Regards,
> 
> Moritz
> 
> 
> 
> 
> Am 03.02.19 um 02:43 schrieb Smith, Barry F.:
>> 
>>> On Feb 2, 2019, at 12:08 PM, Moritz Huck via petsc-users <petsc-users at mcs.anl.gov> wrote:
>>> 
>>> Hi,
>>> I am trying to use SetEventHandler.
>>> I hav eencountered two "problems":
>>> 
>>> 1. after an event is encountered the next time step is needlessly small (h=1e-6), even if a don't change anything in the function (for testing).
>>> 
>>> 
>>> 2. the integration does not continue at the event encounter
>>> e.g. my eventfunction is g(t,u)=t-1,
>>> the event is found in the step from t= 0.9 to 1.1 at tevent=1
>>> but the next step is not 1+dt but it is 1.1 + dt
>>> I would expect the next step to be 1.+dt
>>      Hmm, this sounds like it could be an error. Could you send us a simple code that exhibits it?
>> 
>>    Thanks
>> 
>>    Barry
>> 
>>> Best Regards,
>>> Moritz
>>> 	



More information about the petsc-users mailing list