Actual source code: sundials.h
1: /*
2: Provides a PETSc interface to SUNDIALS. Alan Hindmarsh's parallel ODE
3: solver developed at LLNL.
4: */
6: #pragma once
8: #include <petsc/private/tsimpl.h>
9: #include <petsc/private/pcimpl.h>
10: #include <petsc/private/matimpl.h>
12: /*
13: Include files specific for SUNDIALS
14: */
15: #if defined(PETSC_HAVE_SUNDIALS2)
17: EXTERN_C_BEGIN
18: #include <cvode/cvode.h> /* prototypes for CVODE fcts. */
19: #include <cvode/cvode_spgmr.h> /* prototypes and constants for CVSPGMR solver */
20: #include <cvode/cvode_dense.h> /* prototypes and constants for CVDense solver */
21: #include <nvector/nvector_parallel.h> /* definition N_Vector and macro NV_DATA_P */
22: #include <nvector/nvector_serial.h>
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 preconditioner 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: PetscReal reltol;
39: PetscReal 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: PetscInt maxord; /* max order of BDF / Adams method */
45: PetscBool use_dense; /* Use a dense instead of iterative solve within SUNDIALS (serial only) */
46: } TS_Sundials;
47: #endif