xref: /petsc/src/ts/impls/implicit/sundials/sundials.h (revision f68b968ce39302dfa79eb1a6cfa1998ce074e829)
1 
2 /*
3     Provides a PETSc interface to SUNDIALS. Alan Hindmarsh's parallel ODE
4    solver developed at LLNL.
5 */
6 
7 #if !defined(__PETSCSUNDIALS_H)
8 #define __PETSCSUNDIALS_H
9 
10 #include "src/ts/tsimpl.h"              /*I   "petscts.h"   I*/
11 #include "private/pcimpl.h"         /*I   "petscpc.h"   I*/
12 #include "src/mat/matimpl.h"
13 
14 /*
15    Include files specific for SUNDIALS
16 */
17 #if defined(PETSC_HAVE_SUNDIALS)
18 
19 EXTERN_C_BEGIN
20 #include "sundialstypes.h"
21 #include "cvode.h"
22 #include "nvector_parallel.h"
23 #include "iterative.h"
24 #include "cvspgmr.h"
25 EXTERN_C_END
26 
27 typedef struct {
28   Vec  update;    /* work vector where new solution is formed */
29   Vec  func;      /* work vector where F(t[i],u[i]) is stored */
30   Vec  rhs;       /* work vector for RHS; vec_sol/dt */
31   Vec  w1,w2;     /* work space vectors for function evaluation */
32   PetscTruth  exact_final_time; /* force Sundials to interpolate solution to exactly final time
33                                    requested by user (default) */
34   /* PETSc peconditioner objects used by SUNDIALS */
35   Mat  pmat;                         /* preconditioner Jacobian */
36   PC   pc;                           /* the PC context */
37   int  cvode_type;                   /* the SUNDIALS method, BDF or ADAMS   */
38   TSSundialsGramSchmidtType gtype;
39   int                    restart;
40   double                 linear_tol;
41 
42   /* Variables used by Sundials */
43   MPI_Comm comm_sundials;
44   double   reltol;
45   double   abstol;          /* only for using SS flag in SUNDIALS */
46   N_Vector y;               /* current solution */
47   int      nonlinear_solves,linear_solves; /* since creation of object */
48 } TS_Sundials;
49 #endif
50 
51 #endif
52 
53 
54 
55 
56