1 2 #include <private/tsimpl.h> /*I "petscts.h" I*/ 3 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; 12 13 #if 0 14 #undef __FUNCT__ 15 #define __FUNCT__ "TSPublish_Petsc" 16 static PetscErrorCode TSPublish_Petsc(PetscObject obj) 17 { 18 PetscFunctionBegin; 19 PetscFunctionReturn(0); 20 } 21 #endif 22 23 #undef __FUNCT__ 24 #define __FUNCT__ "TSCreate" 25 /*@C 26 TSCreate - This function creates an empty timestepper. The problem type can then be set with TSSetProblemType() and the 27 type of solver can then be set with TSSetType(). 28 29 Collective on MPI_Comm 30 31 Input Parameter: 32 . comm - The communicator 33 34 Output Parameter: 35 . ts - The TS 36 37 Level: beginner 38 39 .keywords: TS, create 40 .seealso: TSSetType(), TSSetUp(), TSDestroy(), MeshCreate(), TSSetProblemType() 41 @*/ 42 PetscErrorCode TSCreate(MPI_Comm comm, TS *ts) { 43 TS t; 44 PetscErrorCode ierr; 45 46 PetscFunctionBegin; 47 PetscValidPointer(ts,1); 48 *ts = PETSC_NULL; 49 #ifndef PETSC_USE_DYNAMIC_LIBRARIES 50 ierr = TSInitializePackage(PETSC_NULL);CHKERRQ(ierr); 51 #endif 52 53 ierr = PetscHeaderCreate(t, _p_TS, struct _TSOps, TS_CLASSID, -1, "TS", comm, TSDestroy, TSView);CHKERRQ(ierr); 54 ierr = PetscMemzero(t->ops, sizeof(struct _TSOps));CHKERRQ(ierr); 55 56 ierr = PetscMalloc(sizeof(struct _TSUserOps), &t->userops); 57 t->userops->rhsfunction = 0; 58 t->userops->ifunction = 0; 59 t->userops->rhsjacobian = 0; 60 t->userops->ijacobian = 0; 61 62 /* General TS description */ 63 t->problem_type = TS_NONLINEAR; 64 t->vec_sol = PETSC_NULL; 65 t->numbermonitors = 0; 66 t->snes = PETSC_NULL; 67 t->funP = PETSC_NULL; 68 t->jacP = PETSC_NULL; 69 t->setupcalled = 0; 70 t->data = PETSC_NULL; 71 t->user = PETSC_NULL; 72 t->max_steps = 5000; 73 t->max_time = 5.0; 74 t->steps = 0; 75 t->linear_its = 0; 76 t->nonlinear_its = 0; 77 t->work = PETSC_NULL; 78 t->nwork = 0; 79 t->max_snes_failures = 1; 80 t->max_reject = 10; 81 t->errorifstepfailed = PETSC_TRUE; 82 83 ierr = TSSetInitialTimeStep(t,0.,0.1);CHKERRQ(ierr); 84 85 *ts = t; 86 PetscFunctionReturn(0); 87 } 88