xref: /petsc/src/ts/impls/implicit/sundials/sundials.h (revision ec7bbb8b40366f23f2cdc05f6cb757f9ad47bb42)
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 <private/tsimpl.h>       /*I   "petscts.h"   I*/
11 #include <private/pcimpl.h>               /*I   "petscpc.h"   I*/
12 #include <private/matimpl.h>
13 
14 /*
15    Include files specific for SUNDIALS
16 */
17 #if defined(PETSC_HAVE_SUNDIALS)
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 <nvector/nvector_parallel.h>     /* definition N_Vector and macro NV_DATA_P  */
23 EXTERN_C_END
24 
25 typedef struct {
26   Vec        update;    /* work vector where new solution is formed */
27   Vec        ydot;      /* work vector the time derivative is stored */
28   Vec        w1,w2;     /* work space vectors for function evaluation */
29   PetscBool  exact_final_time; /* force Sundials to interpolate solution to exactly final time
30                                    requested by user (default) */
31   /* PETSc peconditioner objects used by SUNDIALS */
32   int  cvode_type;                   /* the SUNDIALS method, BDF or ADAMS  */
33   TSSundialsGramSchmidtType gtype;
34   int                       restart;
35   double                    linear_tol;
36 
37   PetscReal mindt,maxdt;
38 
39   /* Variables used by Sundials */
40   MPI_Comm    comm_sundials;
41   double      reltol;
42   double      abstol;        /* only for using SS flag in SUNDIALS */
43   N_Vector    y;             /* current solution */
44   void        *mem;
45   PetscBool   monitorstep;   /* flag for monitor internal steps; itask=V_ONE_STEP or itask=CV_NORMAL*/
46 } TS_Sundials;
47 #endif
48 
49 #endif
50 
51 
52 
53 
54