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