[petsc-users] Solution "jumps" after setting timestep

Emil Constantinescu emconsta at mcs.anl.gov
Thu Dec 13 13:21:21 CST 2018


Okay, so you start your integration with
"TSSetMaxTime and then call TSSolve (TSSetExactFinalTime is set to 
TS_EXACTFINALTIME_MATCHSTEP)"

Then after it's done at t=2 you tell TS that TSSetTimeStep(ts,1e-3) and 
call TSSolve again?

Emil



On 12/13/18 11:36 AM, Zhang, Hong via petsc-users wrote:
> Please make sure your messages go to petsc-users when replying.
> 
>> On Dec 13, 2018, at 11:25 AM, Moritz.Huck at isea.rwth-aachen.de 
>> <mailto:Moritz.Huck at isea.rwth-aachen.de> wrote:
>>
>> The first solve to 1e-3
>>     TSAdapt basic arkimex 0:1bee step   0 rejected t=0          + 
>> 1.000e-03 dt=1.000e-04  wlte=  102  wltea=   -1 wlter=   -1
>>     TSAdapt basic arkimex 0:1bee step   0 rejected t=0          + 
>> 1.000e-04 dt=1.000e-05  wlte=  127  wltea=   -1 wlter=   -1
>>     TSAdapt basic arkimex 0:1bee step   0 rejected t=0          + 
>> 1.000e-05 dt=1.995e-06  wlte= 5.09  wltea=   -1 wlter=   -1
>>     TSAdapt basic arkimex 0:1bee step   0 accepted t=0          + 
>> 1.995e-06 dt=3.232e-06  wlte=0.309  wltea=   -1 wlter=   -1
>>     TSAdapt basic arkimex 0:4 step   1 accepted t=1.99488e-06+ 
>> 3.232e-06 dt=3.232e-05  wlte=1.65e-06  wltea=   -1 wlter=   -1
>>     TSAdapt basic arkimex 0:4 step   2 accepted t=5.22663e-06+ 
>> 3.232e-05 dt=3.232e-04  wlte=3.96e-05  wltea=   -1 wlter=   -1
>>     TSAdapt basic arkimex 0:4 step   3 accepted t=3.75441e-05+ 
>> 3.232e-04 dt=6.393e-04  wlte=0.000973  wltea=   -1 wlter=   -1
>>     TSAdapt basic arkimex 0:4 step   4 accepted t=0.000360719+ 
>> 6.393e-04 dt=2.962e-03  wlte=0.00142  wltea=   -1 wlter=   -1
>> the solve steps afterwards:
>>     TSAdapt basic arkimex 0:4 step   5 accepted t=0.001      + 
>> 2.962e-03 dt=7.110e-03  wlte=0.0197  wltea=   -1 wlter=   -1
>>     TSAdapt basic arkimex 0:4 step   6 accepted t=0.00396151 + 
>> 7.110e-03 dt=2.489e-02  wlte=0.00437  wltea=   -1 wlter=   -1
>>     TSAdapt basic arkimex 0:4 step   7 accepted t=0.0110717  + 
>> 2.489e-02 dt=7.079e-02  wlte= 0.01  wltea=   -1 wlter=   -1
>>     TSAdapt basic arkimex 0:4 step   8 accepted t=0.03596    + 
>> 7.079e-02 dt=9.672e-02  wlte=0.188  wltea=   -1 wlter=   -1
>>     TSAdapt basic arkimex 0:4 step   9 accepted t=0.106753   + 
>> 9.672e-02 dt=1.329e-01  wlte=0.184  wltea=   -1 wlter=   -1
>> around here it reaches a steady state
>>     TSAdapt basic arkimex 0:4 step  10 accepted t=0.203478   + 
>> 1.329e-01 dt=2.432e-01  wlte=0.0586  wltea=   -1 wlter=   -1
>>     TSAdapt basic arkimex 0:4 step  11 accepted t=0.336424   + 
>> 2.432e-01 dt=4.536e-01  wlte=0.0542  wltea=   -1 wlter=   -1
>>     TSAdapt basic arkimex 0:4 step  12 accepted t=0.579616   + 
>> 4.536e-01 dt=1.112e+00  wlte=0.0182  wltea=   -1 wlter=   -1
>>     TSAdapt basic arkimex 0:4 step  13 accepted t=1.03324    + 
>> 9.668e-01 dt=3.286e+00  wlte=0.00492  wltea=   -1 wlter=   -1
>> here I set the timestep to 1e-3 artificially and the solution deviates 
>> from the steady state solution
> 
> The TS time jumps between step 13 and step 14, which is probably the 
> cause of the jump in the solution.
> Did you reset the time to t=2 by calling TSSetTime() after step 13?
> 
> Hong
> 
>>       TSAdapt basic arkimex 0:4 step  14 accepted t=2          + 
>> 1.000e-03 dt=3.845e-03  wlte=0.003  wltea=   -1 wlter=   -1
>>       TSAdapt basic arkimex 0:4 step  15 accepted t=2.001      + 
>> 3.845e-03 dt=3.845e-02  wlte=6.95e-06  wltea=   -1 wlter=   -1
>>       TSAdapt basic arkimex 0:4 step  16 accepted t=2.00485    + 
>> 3.845e-02 dt=3.845e-01  wlte=4.31e-05  wltea=   -1 wlter=   -1
>>       TSAdapt basic arkimex 0:4 step  17 accepted t=2.0433     + 
>> 3.845e-01 dt=2.473e+00  wlte=0.000384  wltea=   -1 wlter=   -1
>>       TSAdapt basic arkimex 0:4 step  18 accepted t=2.42784    + 
>> 2.473e+00 dt=4.540e+00  wlte=0.0578  wltea=   -1 wlter=   -1
>> this point is "back on track"
>>       TSAdapt basic arkimex 0:4 step  19 accepted t=4.90058    + 
>> 4.540e+00 dt=4.649e+00  wlte=0.596  wltea=   -1 wlter=   -1
>> *Von:*Zhang, Hong <hongzhang at anl.gov <mailto:hongzhang at anl.gov>>
>> *Gesendet:*Donnerstag, 13. Dezember 2018 17:39
>> *An:*Huck, Moritz <Moritz.Huck at isea.rwth-aachen.de 
>> <mailto:Moritz.Huck at isea.rwth-aachen.de>>
>> *Cc:*petsc-users at mcs.anl.gov <mailto:petsc-users at mcs.anl.gov>
>> *Betreff:*Re: [petsc-users] Solution "jumps" after setting timestep
>> Can you show the outputs of -ts_monitor for both cases (one with 
>> oscillations and one without)?
>> Thanks,
>> Hong
>>
>>
>>     On Dec 13, 2018, at 9:48 AM,Moritz.Huck at isea.rwth-aachen.de
>>     <mailto:Moritz.Huck at isea.rwth-aachen.de>wrote:
>>     Hi,
>>     Sure after reaching a steady state it looks like this:
>>         0 SNES Function norm 3.767377637168e-03
>>         1 SNES Function norm 2.529971638368e-05
>>         2 SNES Function norm 4.433873358247e-09
>>         3 SNES Function norm 4.535675922104e-11
>>         0 SNES Function norm 9.898938706929e-04
>>         1 SNES Function norm 1.322473621975e-05
>>         2 SNES Function norm 1.672724799379e-09
>>         3 SNES Function norm 1.338501638801e-11
>>         0 SNES Function norm 1.624500221071e-03
>>         1 SNES Function norm 2.448515345247e-05
>>         2 SNES Function norm 6.225549426481e-09
>>         3 SNES Function norm 1.062516222150e-10
>>         4 SNES Function norm 6.493758120241e-13
>>         0 SNES Function norm 1.106311709708e-03
>>         1 SNES Function norm 2.475673243430e-05
>>         2 SNES Function norm 9.969586735411e-09
>>         3 SNES Function norm 2.479591395229e-10
>>         4 SNES Function norm 1.542689576708e-12
>>         0 SNES Function norm 6.070943996748e-04
>>         1 SNES Function norm 1.648134285171e-05
>>         2 SNES Function norm 8.461078655420e-09
>>         3 SNES Function norm 2.480863447790e-10
>>         4 SNES Function norm 1.513977618851e-12
>>           TSAdapt basic arkimex 0:4 step  15 accepted t=5.67201    +
>>     4.328e+00 dt=4.687e+00  wlte$
>>     0.477  wltea=   -1 wlter=   -1
>>     If I set the next target time (in tssolve) to be tlast+1e-3 it
>>     looks like this:
>>         0 SNES Function norm 4.734802409365e-03
>>         1 SNES Function norm 6.173939866359e-13
>>         0 SNES Function norm 5.633294284900e-04
>>         1 SNES Function norm 3.575533754564e-13
>>         0 SNES Function norm 9.651618110271e-04
>>         1 SNES Function norm 6.863177319359e-13
>>         0 SNES Function norm 7.706102281617e-04
>>         1 SNES Function norm 8.490865565002e-13
>>         0 SNES Function norm 5.028108294534e-04
>>         1 SNES Function norm 6.905750968862e-13
>>           TSAdapt basic arkimex 0:4 step  16 accepted t=10         +
>>     1.000e-03 dt=2.612e-03  wlte$
>>     0.0141  wltea=   -1 wlter=   -1
>>     The SNES solver has a atoll of 1e-10, setting the atoll to lower
>>     values does not change the result.
>>     Thank you,
>>     Moritz
>>     *Von:*Zhang, Hong <hongzhang at anl.gov <mailto:hongzhang at anl.gov>>
>>     *Gesendet:*Donnerstag, 13. Dezember 2018 16:42
>>     *An:*Huck, Moritz <Moritz.Huck at isea.rwth-aachen.de
>>     <mailto:Moritz.Huck at isea.rwth-aachen.de>>
>>     *Cc:*petsc-users at mcs.anl.gov <mailto:petsc-users at mcs.anl.gov>
>>     *Betreff:*Re: [petsc-users] Solution "jumps" after setting timestep
>>     Can you please add command line options -ts_monitor -snes_monitor
>>     and show us the outputs?
>>     Thanks,
>>     Hong (Mr.)
>>
>>
>>
>>         On Nov 4, 2018, at 6:19 AM, Moritz.Huck--- via petsc-users
>>         <petsc-users at mcs.anl.gov <mailto:petsc-users at mcs.anl.gov>> wrote:
>>         Hi,
>>
>>         I using the basic adaptor.
>>         If I let the adaptor handle everything it does not oscillates.
>>         I don’t mean setting the timestep at the start (which does not
>>         produces the
>>         problem),
>>         I need to set during runtime between two steps.
>>
>>         Best Regards,
>>
>>         Moritz
>>
>>         -----Ursprüngliche Nachricht-----
>>         Von: Constantinescu, Emil M. <emconsta at anl.gov
>>         <mailto:emconsta at anl.gov>>
>>         Gesendet: Samstag, 3. November 2018 15:43
>>         An: Huck, Moritz <Moritz.Huck at isea.rwth-aachen.de
>>         <mailto:Moritz.Huck at isea.rwth-aachen.de>>;petsc-users at mcs.anl.gov
>>         <mailto:petsc-users at mcs.anl.gov>
>>         Betreff: Re: [petsc-users] Solution "jumps" after setting timestep
>>
>>         On 11/3/18 4:56 AM, Moritz.Huck--- via petsc-users wrote:
>>
>>
>>             Hi,
>>
>>             I am using the IMEX Runge Kutta to solve an implicit DAE
>>             (G=0).
>>
>>             When I manually set the time step (TSSetTimestep) my
>>             solution jumps.
>>
>>
>>         When you don't set the time step, does it still oscillates? If
>>         not, can you
>>         check if it oscillates when reducing the fixed initial time step?
>>         Did you turn the adaptivity off (-ts_adapt_type none)?
>>
>>         Emil
>>
>>
>>
>>
>>             If I go from  a steady state to the  same state, it
>>             oscillates a few
>>             time and comes back to the steady solution.
>>
>>             Can this be prevented?
>>
>>             Thank you,
>>
>>             Moritz
>>
> 


More information about the petsc-users mailing list