TSSetResize#

Sets the resize callbacks.

Synopsis#

#include "petscts.h"  
PetscErrorCode TSSetResize(TS ts, PetscErrorCode (*setup)(TS ts, PetscInt step, PetscReal time, Vec state, PetscBool *resize, void *ctx), PetscErrorCode (*transfer)(TS ts, PetscInt nv, Vec vecsin[], Vec vecsout[], void *ctx), void *ctx)

Logically Collective

Input Parameters#

  • ts - The TS context obtained from TSCreate()

  • setup - The setup function

  • transfer - The transfer function

  • ctx - [optional] The user-defined context

Calling sequence of setup#

  • ts - the TS context

  • step - the current step

  • time - the current time

  • state - the current vector of state

  • resize - (output parameter) PETSC_TRUE if need resizing, PETSC_FALSE otherwise

  • ctx - user defined context

Calling sequence of transfer#

  • ts - the TS context

  • nv - the number of vectors to be transferred

  • vecsin - array of vectors to be transferred

  • vecsout - array of transferred vectors

  • ctx - user defined context

Notes#

The setup function is called inside TSSolve() after TSPostStep() at the end of each time step to determine if the problem size has changed. If it is the case, the solver will collect the needed vectors that need to be transferred from the old to the new sizes using transfer. These vectors will include the current solution vector, and other vectors needed by the specific solver used. For example, TSBDF uses previous solutions vectors to solve for the next time step. Other application specific objects associated with the solver, i.e. Jacobian matrices and DM, will be automatically reset if the sizes are changed and they must be specified again by the user inside the transfer function. The input and output arrays passed to transfer are allocated by PETSc. Vectors in vecsout must be created by the user. Ownership of vectors in vecsout is transferred to PETSc.

See Also#

TS: Scalable ODE and DAE Solvers, TS, TSSetDM(), TSSetIJacobian(), TSSetRHSJacobian()

Level#

advanced

Location#

src/ts/interface/ts.c

Examples#

src/ts/tutorials/ex45.c
src/ts/tutorials/ex11.c


Index of all TS routines
Table of Contents for all manual pages
Index of all manual pages