Please make sure your replies go to the maillist.

On Feb 15, 2020, at 4:35 AM, Mohammed Ashour 
<[email protected]<mailto:[email protected]>> wrote:

Dear Mr. Hong,
Thanks for your reply and clarification.
I have a follow-up question. If TSRollBack() is to be called within a 
TSPostStep, that would set the ts->steprollback to PETSC_TRUE. And since there 
is a falsity test on TSPreStep in TSSolve, that would prevent TSPreStep from 
being engaged as long as ts->steprollback is PETSC_TRUE, which it is after 
being set so in the TSPostStep. So I'm wondering, why is there a falsity test 
on TSPreStep knowing that it would not be accessible if TSRollBack is called 
within TSPostStep.

This guarantees TSPreStep is called only once before each successful step.

Hong


Thanks in advance.
Yours sincerely

On Tue, Feb 4, 2020 at 5:32 PM Zhang, Hong 
<[email protected]<mailto:[email protected]>> wrote:


> On Feb 2, 2020, at 11:24 AM, Mohammed Ashour 
> <[email protected]<mailto:[email protected]>> wrote:
>
> Dear All,
> I'm solving a constraint phase-field problem using PetIGA. This question i'm 
> having is more relevant to PETSc, so I'm posting here.
>
> I have an algorithm involving iterating on the solution vector until certain 
> criteria are met before moving forward for the next time step. The sequence 
> inside the TSSolve is to call TSMonitor first, to print a user-defined set of 
> values and the move to solve at TSStep and then call TSPostEvaluate.
>
> So I'm using the TSMonitor to update some variables at time n , those 
> variables are used the in the residual and jacobian calculations at time n+1, 
> and then solving and then check if those criteria are met or not in a 
> function assigned to TS via TSSetPostEvaluate, if the criteria are met, it'll 
> move forward, if not, it'll engaged the routine TSRollBack(), which based on 
> my understanding is the proper way yo flag the solver to recalculate n+1. My 
> question is, is this the proper way to do it? what is the difference between 
> TSRollBack and TSRestart?

You are right that TSRollBack() recalculates the current time step. But I would 
not suggest to use TSPostEvaluate in your case. Presumably you are not using 
the PETSc adaptor (e.g. via -ts_adapt_type none) and want to control the 
stepsize yourself. You can check the criteria in TSPostStep, call TSRollBack() 
if the criteria are not met and update the variables accordingly. The variables 
can also be updated in TSPreStep(), but TSMonitor should not be used since it 
is designed for read-only operations.

TSRestart may be needed when you are using non-self-starting integration 
methods such as multiple step methods and FSAL RK methods (-ts_rk_type 
<3bs,5dp,5bs,6vr,7vr,8vr>). These methods rely on solutions or residuals from 
previous time steps, thus need a flag to hard restart the time integration 
whenever discontinuity is introduced (e.g. a parameter in the RHS function is 
changed). So TSRestart sets the flag to tell the integrator to treat the next 
time step like the first time step in a time integration.

Hong (Mr.)

> Thanks a lot
>
> --



--
Mohammed Ashour, M.Sc.
PhD Scholar
Bauhaus-Universität Weimar
Institute of Structural Mechanics (ISM)
Marienstraße 7
99423 Weimar, Germany
Mobile: +(49) 176 58834667

Reply via email to