It is intended to be reusable as you are attempting.
You will have to either (1) run in the debugger with some break points to see why the initial time is always forced to be so small (2) send us the code so we can reproduce the problem. Barry > On Jun 25, 2018, at 3:55 PM, zakaryah <[email protected]> wrote: > > I'm interested in using a time-stepper to solve problems arising from > multiple data sets (external forces). Currently, I do the following: > > TSCreate > TSSetProblemType > TSSetSolution > TSSetDM > TSSetRHSFunction > TSSetRHSJacobian > TSSetType > TSSetMaxSteps > TSSetMaxTime > TSSetExactFinalTime > TSSetMaxStepRejections > > then, inside the loop over different data sets: > > TSSetTimeStep > TSPseudoSetTimeStepIncrement > TSSetTime (to zero) > TSSetStepNumber (to zero) > TSSetUp > TSSolve > > This seems to be working, but the step increment behaves oddly on every loop > iteration after the first. Regardless of what I set the time step to, the > first TSSolve iteration makes a step which is about twelve orders of > magnitude smaller than the specified dt, and from that point on, the > controller multiplies every step size by the specified pseudo time step > increment (1.5), up until the very end, at which point the multiplier becomes > very large as expected near convergence. > > If I create, set up, and destroy the TS in each iteration of the loop, the > behavior is as expected, i.e. the first step is almost always by the > specified dt. Is there additional information inside the TS that I need to > reset? Is it a bad idea to reuse a TS? > > A couple tangential questions - I don't seem to be getting any output from > -ts_adapt_monitor, and calling TSSetMaxStepRejections(ts,(PetscInt)-1) seems > to set the maximum number of accepted step rejections to zero, rather than to > unlimited, as specified by the documentation. > > Thanks for any help you can provide!
