2: /*
3: Provides a PETSc interface to SUNDIALS. Alan Hindmarsh's parallel ODE
4: solver developed at LLNL.
5: */
10: #include <petsc-private/tsimpl.h> /*I "petscts.h" I*/
11: #include <petsc-private/pcimpl.h>
12: #include <petsc-private/matimpl.h>
14: /*
15: Include files specific for SUNDIALS
16: */
17: #if defined(PETSC_HAVE_SUNDIALS)
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
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 */
30: /* PETSc peconditioner objects used by SUNDIALS */
31: PetscInt cvode_type; /* the SUNDIALS method, BDF or ADAMS */
32: TSSundialsGramSchmidtType gtype;
33: PetscReal linear_tol;
34: PetscReal mindt,maxdt;
36: /* Variables used by Sundials */
37: MPI_Comm comm_sundials;
38: double reltol;
39: double abstol; /* only for using SS flag in SUNDIALS */
40: N_Vector y; /* current solution */
41: void *mem;
42: PetscBool monitorstep; /* flag for monitor internal steps; itask=V_ONE_STEP or itask=CV_NORMAL*/
43: PetscInt maxl; /* max dimension of the Krylov subspace to be used */
44: } TS_Sundials;
45: #endif
47: #endif