Actual source code: tscreate.c

petsc-3.5.4 2015-05-23
Report Typos and Errors
  2: #include <petsc-private/tsimpl.h>      /*I "petscts.h"  I*/

  4: const char *const TSConvergedReasons_Shifted[] = {
  5:   "DIVERGED_STEP_REJECTED",
  6:   "DIVERGED_NONLINEAR_SOLVE",
  7:   "CONVERGED_ITERATING",
  8:   "CONVERGED_TIME",
  9:   "CONVERGED_ITS",
 10:   "TSConvergedReason","TS_",0};
 11: const char *const*TSConvergedReasons = TSConvergedReasons_Shifted + 2;

 13: #undef  __FUNCT__
 15: /*@C
 16:   TSCreate - This function creates an empty timestepper. The problem type can then be set with TSSetProblemType() and the
 17:        type of solver can then be set with TSSetType().

 19:   Collective on MPI_Comm

 21:   Input Parameter:
 22: . comm - The communicator

 24:   Output Parameter:
 25: . ts   - The TS

 27:   Level: beginner

 29: .keywords: TS, create
 30: .seealso: TSSetType(), TSSetUp(), TSDestroy(), TSSetProblemType()
 31: @*/
 32: PetscErrorCode  TSCreate(MPI_Comm comm, TS *ts)
 33: {
 34:   TS             t;

 39:   *ts = NULL;
 40:   TSInitializePackage();

 42:   PetscHeaderCreate(t, _p_TS, struct _TSOps, TS_CLASSID, "TS", "Time stepping", "TS", comm, TSDestroy, TSView);
 43:   PetscMemzero(t->ops, sizeof(struct _TSOps));

 45:   /* General TS description */
 46:   t->problem_type      = TS_NONLINEAR;
 47:   t->vec_sol           = NULL;
 48:   t->numbermonitors    = 0;
 49:   t->snes              = NULL;
 50:   t->setupcalled       = 0;
 51:   t->data              = NULL;
 52:   t->user              = NULL;
 53:   t->ptime             = 0.0;
 54:   t->time_step         = 0.1;
 55:   t->time_step_orig    = 0.1;
 56:   t->max_time          = 5.0;
 57:   t->steps             = 0;
 58:   t->max_steps         = 5000;
 59:   t->ksp_its           = 0;
 60:   t->snes_its          = 0;
 61:   t->work              = NULL;
 62:   t->nwork             = 0;
 63:   t->max_snes_failures = 1;
 64:   t->max_reject        = 10;
 65:   t->errorifstepfailed = PETSC_TRUE;
 66:   t->rhsjacobian.time  = -1e20;
 67:   t->rhsjacobian.scale = 1.;
 68:   t->ijacobian.shift   = 1.;
 69:   t->equation_type     = TS_EQ_UNSPECIFIED;

 71:   t->atol             = 1e-4;
 72:   t->rtol             = 1e-4;
 73:   t->cfltime          = PETSC_MAX_REAL;
 74:   t->cfltime_local    = PETSC_MAX_REAL;
 75:   t->exact_final_time = TS_EXACTFINALTIME_STEPOVER;

 77:   *ts = t;
 78:   return(0);
 79: }