[petsc-users] [TimeStepping] Eventhandler

Smith, Barry F. bsmith at mcs.anl.gov
Mon Feb 4 16:37:13 CST 2019


> 
> Is there any reason you'd like to use the last time step? We used the initial time-step (which is assumed to be small) so as (a) to minimize any numerical issues that may be caused by a large last time-step, and (b) to not miss any ensuing events that may be triggered by the discontinuity.
> 
> Shri

  Shri

     How do you get access to this initial time-step later in the run? TSSetTimeStep() sets the value ts->time_step but I don't see any place where that initial timestep is stashed so could be used later.

   Thanks

    Barry


> On Feb 4, 2019, at 1:56 AM, Huck, Moritz via petsc-users <petsc-users at mcs.anl.gov> wrote:
> 
> Hi,
> yes there is one.
> My system has a set of very different time contants.
> At some events the fast one may be fully developped and only the slower ones are of concern after the event (depending on the postevent).
> If the last step is not an option, setting it manually might be helpfull since I generall know which timeconstants will be relevant (TSSetTime step seems not to have an effect during the postevent call).
> 
> Moritz
> ________________________________________
> Von: Abhyankar, Shrirang G <shrirang.abhyankar at pnnl.gov>
> Gesendet: Montag, 4. Februar 2019 05:09:24
> An: Huck, Moritz; Zhang, Hong
> Betreff: RE: [petsc-users] [TimeStepping] Eventhandler
> 
> Is there any reason you'd like to use the last time step? We used the initial time-step (which is assumed to be small) so as (a) to minimize any numerical issues that may be caused by a large last time-step, and (b) to not miss any ensuing events that may be triggered by the discontinuity.
> 
> Shri
> 
> -----Original Message-----
> From: petsc-users <petsc-users-bounces at mcs.anl.gov> On Behalf Of Moritz Huck via petsc-users
> Sent: Sunday, February 3, 2019 10:45 AM
> To: Zhang, Hong <hongzhang at anl.gov>
> Cc: petsc-users at mcs.anl.gov
> Subject: Re: [petsc-users] [TimeStepping] Eventhandler
> 
> Hi,
> 
> I see I am sorry, I misinterpreted the output -ts_adapt_monitor.
> 
> You are right point 2 is not an issue.
> 
> I there a way to let the time stepping continue with the last time step instead of the initial time step?
> 
> Best Regards,
> 
> Moritz
> 
> Am 03.02.19 um 17:04 schrieb Zhang, Hong:
>> 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