For solving steady-state problems with pseudo-timestepping one proceeds as follows.
ierr = TSSetRHSFunction(TS ts,int (*f)(TS,double,Vec,Vec,void*),void *fP);The arguments to the function f() are the timestep context, the current time, the input for the function, the output for the function and the (optional) user-provided context variable fP.
ierr = TSSetRHSJacobian(TS ts,Mat A, Mat B,int (*f)(TS,double,Vec,Mat*,Mat*, MatStructure*,void*),void *fP);The arguments for the function f() are the timestep context, the current time, the location where the Jacobian is to be computed, the Jacobian matrix, an alternative approximate Jacobian matrix used as a preconditioner, and the optional user-provided context, passed in as fP. The user must provide the Jacobian as a matrix; thus, if using a matrix-free approach, one must create a MatShell matrix.
ierr = TSPseudoSetTimeStep(TS ts,int(*dt)(TS,double*,void*),void* dtctx);The function dt is a user-provided function that computes the next pseudo-timestep. As a default one can use TSPseudoDefaultTimeStep(TS,double*,void*) for dt. This routine updates the pseudo-timestep with one of two strategies: the default
or, the alternative,
which can be set with the call
ierr = TSPseudoIncrementDtFromInitialDt(TS ts);or the option -ts_pseudo_increment_dt_from_initial_dt. The value dt_increment is by default 1.1, but can be reset with the call
ierr = TSPseudoSetTimeStepIncrement(TS ts,double inc);or the option -ts_pseudo_increment <inc>.