# DMMGSetInitialGuess

Sets the function that computes an initial guess.

### Synopsis

    #include "petscda.h"
    #include "petscksp.h"
    #include "petscmg.h"
    #include "petscdmmg.h"
    #include "petscpc.h"
    PetscErrorCode PETSCSNES_DLLEXPORT DMMGSetInitialGuess(DMMG *dmmg,PetscErrorCode (*guess)(DMMG,Vec))

Collective on DMMG

### Input Parameter

| dmmg | - the context
| guess | - the function

Notes: For nonlinear problems, if this is not set, then the current value in the solution vector (obtained with DMMGGetX()) is used. Thus is if you doing 'time stepping' it will use your current solution as the guess for the next timestep. If grid sequencing is used (via -dmmg_grid_sequence) then the "guess" function is used only on the coarsest grid. For linear problems, if this is not set, then 0 is used as an initial guess. If you would like the linear solver to also (like the nonlinear solver) use the current solution vector as the initial guess then use DMMGInitialGuessCurrent() as the function you pass in

### See Also

DMMGCreate(), DMMGDestroy, DMMGSetKSP(), DMMGSetSNES(), DMMGInitialGuessCurrent()

Level:intermediate
Location:src/snes/utils/damg.c
Index of all DA routines
Table of Contents for all manual pages
Index of all manual pages

### Examples

src/snes/examples/tutorials/ex18.c.html
src/snes/examples/tutorials/ex19.c.html
src/snes/examples/tutorials/ex20.c.html
src/snes/examples/tutorials/ex27.c.html
src/snes/examples/tutorials/ex30.c.html