[petsc-users] TSSetTimeStep or -ts_dt not working

Ali Berk Kahraman aliberkkahraman at yahoo.com
Wed Oct 11 14:25:17 CDT 2017


Dr. Adams, thank you for your reply.

I have solved the problem with suggestions of Dr.Zhang, who answered 
right after you.


On 11-10-2017 20:18, Mark Adams wrote:
> Try running with -ts_view and -options_left and send all of the output.
>
> On Wed, Oct 11, 2017 at 1:12 PM, Ali Berk Kahraman 
> <aliberkkahraman at yahoo.com <mailto:aliberkkahraman at yahoo.com>> wrote:
>
>     Hello All,
>
>
>     I am trying to use timesteppers, however I have a problem.
>     Whenever I want to set a dt for the timstepping integration, I
>     cannot succeed. Neither the function TSSetTimeStep nor the command
>     line option seems to work. Using either of them(but not at the
>     same time) and setting it to 1, when I call TSGetTimeStep to learn
>     the value of dt, it gives me the answer 0.002871. Perhaps this is
>     the default value, however I cannot work with this, since the
>     equation I have is slowly evolving.
>
>
>     Any ideas what might be causing this?
>
>
>     The part of the code I use,
>
>
>     PetscReal time=0, timestep=1;
>         int maxsteps=30;
>         float maxtime=300;
>
>
>             TS ts;
>             ierr= TSCreate(PETSC_COMM_WORLD,&ts);
>             CHKERRQ(ierr);
>             ierr= TSSetProblemType(ts,TS_LINEAR);
>             CHKERRQ(ierr);
>             ierr= TSSetSolution(ts, dummyvec);
>             CHKERRQ(ierr);
>             ierr= TSSetType(ts,TSRK);
>             CHKERRQ(ierr);
>             ierr= TSSetTime(ts,time);
>             CHKERRQ(ierr);
>             ierr= TSSetTimeStep(ts,timestep);
>             CHKERRQ(ierr);
>             ierr=TSSetExactFinalTime(ts,TS_EXACTFINALTIME_STEPOVER);
>             CHKERRQ(ierr);
>             TSSetMaxSteps(ts,maxsteps);
>             TSSetMaxTime(ts,maxtime);
>
>             ierr=TSSetFromOptions(ts);CHKERRQ(ierr);
>             TSSetRHSFunction(ts,residual,
>                              FormRHSFunction,&mycontext);
>             ierr= TSSolve(ts,uJi);
>             CHKERRQ(ierr);
>             TSView(ts,PETSC_VIEWER_STDOUT_SELF);
>
>             TSConvergedReason reason;
>             ierr=TSGetConvergedReason(ts,&reason);CHKERRQ(ierr);
>             printf("Why Converged: %d\n",reason);
>             PetscReal usedtimestep;
>             TSGetTimeStep(ts,&usedtimestep);
>             printf("Used timestep: %f\n",usedtimestep);
>
>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20171011/90069bf2/attachment-0001.html>


More information about the petsc-users mailing list