xref: /petsc/src/ts/impls/implicit/sundials/sundials.h (revision 58d68138c660dfb4e9f5b03334792cd4f2ffd7cc)
1 
2 /*
3     Provides a PETSc interface to SUNDIALS. Alan Hindmarsh's parallel ODE
4    solver developed at LLNL.
5 */
6 
7 #if !defined(PETSC_SUNDIALS_H)
8 #define PETSC_SUNDIALS_H
9 
10 #include <petsc/private/tsimpl.h> /*I   "petscts.h"   I*/
11 #include <petsc/private/pcimpl.h>
12 #include <petsc/private/matimpl.h>
13 
14 /*
15    Include files specific for SUNDIALS
16 */
17 #if defined(PETSC_HAVE_SUNDIALS2)
18 
19 EXTERN_C_BEGIN
20 #include <cvode/cvode.h>              /* prototypes for CVODE fcts. */
21 #include <cvode/cvode_spgmr.h>        /* prototypes and constants for CVSPGMR solver */
22 #include <cvode/cvode_dense.h>        /* prototypes and constants for CVDense solver */
23 #include <nvector/nvector_parallel.h> /* definition N_Vector and macro NV_DATA_P  */
24 #include <nvector/nvector_serial.h>
25 EXTERN_C_END
26 
27 typedef struct {
28   Vec update; /* work vector where new solution is formed */
29   Vec ydot;   /* work vector the time derivative is stored */
30   Vec w1, w2; /* work space vectors for function evaluation */
31 
32   /* PETSc preconditioner objects used by SUNDIALS */
33   PetscInt                  cvode_type; /* the SUNDIALS method, BDF or ADAMS  */
34   TSSundialsGramSchmidtType gtype;
35   PetscReal                 linear_tol;
36   PetscReal                 mindt, maxdt;
37 
38   /* Variables used by Sundials */
39   MPI_Comm  comm_sundials;
40   PetscReal reltol;
41   PetscReal abstol; /* only for using SS flag in SUNDIALS */
42   N_Vector  y;      /* current solution */
43   void     *mem;
44   PetscBool monitorstep; /* flag for monitor internal steps; itask=V_ONE_STEP or itask=CV_NORMAL*/
45   PetscInt  maxl;        /* max dimension of the Krylov subspace to be used */
46   PetscInt  maxord;      /* max order of BDF / Adams method */
47   PetscBool use_dense;   /* Use a dense instead of iterative solve within SUNDIALS (serial only) */
48 } TS_Sundials;
49 #endif
50 
51 #endif
52