xref: /petsc/src/ts/impls/implicit/sundials/sundials.h (revision c6db04a5321582041def2b1e244c75985478b3ef)
17cb94ee6SHong Zhang 
27cb94ee6SHong Zhang /*
37cb94ee6SHong Zhang     Provides a PETSc interface to SUNDIALS. Alan Hindmarsh's parallel ODE
47cb94ee6SHong Zhang    solver developed at LLNL.
57cb94ee6SHong Zhang */
67cb94ee6SHong Zhang 
77cb94ee6SHong Zhang #if !defined(__PETSCSUNDIALS_H)
87cb94ee6SHong Zhang #define __PETSCSUNDIALS_H
97cb94ee6SHong Zhang 
10*c6db04a5SJed Brown #include <private/tsimpl.h>       /*I   "petscts.h"   I*/
11*c6db04a5SJed Brown #include <private/pcimpl.h>               /*I   "petscpc.h"   I*/
12*c6db04a5SJed Brown #include <private/matimpl.h>
137cb94ee6SHong Zhang 
147cb94ee6SHong Zhang /*
157cb94ee6SHong Zhang    Include files specific for SUNDIALS
167cb94ee6SHong Zhang */
177cb94ee6SHong Zhang #if defined(PETSC_HAVE_SUNDIALS)
187cb94ee6SHong Zhang 
197cb94ee6SHong Zhang EXTERN_C_BEGIN
20*c6db04a5SJed Brown #include <cvode/cvode.h>                  /* prototypes for CVODE fcts. */
21*c6db04a5SJed Brown #include <cvode/cvode_spgmr.h>            /* prototypes and constants for CVSPGMR solver */
22*c6db04a5SJed Brown #include <nvector/nvector_parallel.h>     /* definition N_Vector and macro NV_DATA_P  */
237cb94ee6SHong Zhang EXTERN_C_END
247cb94ee6SHong Zhang 
257cb94ee6SHong Zhang typedef struct {
267cb94ee6SHong Zhang   Vec        update;    /* work vector where new solution is formed */
277cb94ee6SHong Zhang   Vec        func;      /* work vector where F(t[i],u[i]) is stored */
287cb94ee6SHong Zhang   Vec        rhs;       /* work vector for RHS; vec_sol/dt */
297cb94ee6SHong Zhang   Vec        w1,w2;     /* work space vectors for function evaluation */
30ace3abfcSBarry Smith   PetscBool  exact_final_time; /* force Sundials to interpolate solution to exactly final time
317cb94ee6SHong Zhang                                    requested by user (default) */
327cb94ee6SHong Zhang   /* PETSc peconditioner objects used by SUNDIALS */
337cb94ee6SHong Zhang   Mat  pmat;                         /* preconditioner Jacobian */
347cb94ee6SHong Zhang   PC   pc;                           /* the PC context */
357cb94ee6SHong Zhang   int  cvode_type;                   /* the SUNDIALS method, BDF or ADAMS  */
367cb94ee6SHong Zhang   TSSundialsGramSchmidtType gtype;
377cb94ee6SHong Zhang   int                       restart;
387cb94ee6SHong Zhang   double                    linear_tol;
397cb94ee6SHong Zhang 
40f1cd61daSJed Brown   PetscReal mindt,maxdt;
41f1cd61daSJed Brown 
427cb94ee6SHong Zhang   /* Variables used by Sundials */
437cb94ee6SHong Zhang   MPI_Comm    comm_sundials;
447cb94ee6SHong Zhang   double      reltol;
457cb94ee6SHong Zhang   double      abstol;        /* only for using SS flag in SUNDIALS */
467cb94ee6SHong Zhang   N_Vector    y;             /* current solution */
472c823083SHong Zhang   void        *mem;
48ace3abfcSBarry Smith   PetscBool   monitorstep;   /* flag for monitor internal steps; itask=V_ONE_STEP or itask=CV_NORMAL*/
497cb94ee6SHong Zhang } TS_Sundials;
507cb94ee6SHong Zhang #endif
517cb94ee6SHong Zhang 
527cb94ee6SHong Zhang #endif
537cb94ee6SHong Zhang 
547cb94ee6SHong Zhang 
557cb94ee6SHong Zhang 
567cb94ee6SHong Zhang 
57