Actual source code: tscreate.c
petsc-3.3-p7 2013-05-11
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: #if 0
16: static PetscErrorCode TSPublish_Petsc(PetscObject obj)
17: {
19: return(0);
20: }
21: #endif
23: #undef __FUNCT__
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().
29: Collective on MPI_Comm
31: Input Parameter:
32: . comm - The communicator
34: Output Parameter:
35: . ts - The TS
37: Level: beginner
39: .keywords: TS, create
40: .seealso: TSSetType(), TSSetUp(), TSDestroy(), MeshCreate(), TSSetProblemType()
41: @*/
42: PetscErrorCode TSCreate(MPI_Comm comm, TS *ts) {
43: TS t;
48: *ts = PETSC_NULL;
49: #ifndef PETSC_USE_DYNAMIC_LIBRARIES
50: TSInitializePackage(PETSC_NULL);
51: #endif
53: PetscHeaderCreate(t, _p_TS, struct _TSOps, TS_CLASSID, -1, "TS", "Time stepping", "TS", comm, TSDestroy, TSView);
54: PetscMemzero(t->ops, sizeof(struct _TSOps));
56: PetscMalloc(sizeof(struct _TSUserOps), &t->userops);
57: t->userops->rhsfunction = 0;
58: t->userops->ifunction = 0;
59: t->userops->rhsjacobian = 0;
60: t->userops->rhsjacobian = 0;
61: t->userops->ijacobian = 0;
63: /* General TS description */
64: t->problem_type = TS_NONLINEAR;
65: t->vec_sol = PETSC_NULL;
66: t->numbermonitors = 0;
67: t->snes = PETSC_NULL;
68: t->funP = PETSC_NULL;
69: t->jacP = PETSC_NULL;
70: t->setupcalled = 0;
71: t->data = PETSC_NULL;
72: t->user = PETSC_NULL;
73: t->ptime = 0.0;
74: t->time_step = 0.1;
75: t->max_time = 5.0;
76: t->steps = 0;
77: t->max_steps = 5000;
78: t->ksp_its = 0;
79: t->snes_its = 0;
80: t->work = PETSC_NULL;
81: t->nwork = 0;
82: t->max_snes_failures = 1;
83: t->max_reject = 10;
84: t->errorifstepfailed = PETSC_TRUE;
85: t->rhsjacobian.time = -1e20;
86: t->ijacobian.time = -1e20;
88: t->atol = 1e-4;
89: t->rtol = 1e-4;
90: t->cfltime = PETSC_MAX_REAL;
91: t->cfltime_local = PETSC_MAX_REAL;
92: t->exact_final_time = PETSC_DECIDE;
94: *ts = t;
95: return(0);
96: }