xref: /petsc/src/ts/impls/implicit/sundials/sundials.h (revision 6356e834d5fb4a471e3a695b6642083919bc5a29)
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 
107cb94ee6SHong Zhang #include "src/ts/tsimpl.h"              /*I   "petscts.h"   I*/
11*6356e834SBarry Smith #include "private/pcimpl.h"         /*I   "petscpc.h"   I*/
127cb94ee6SHong Zhang #include "src/mat/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
207cb94ee6SHong Zhang #include "sundialstypes.h"
217cb94ee6SHong Zhang #include "cvode.h"
227cb94ee6SHong Zhang #include "nvector_parallel.h"
237cb94ee6SHong Zhang #include "iterative.h"
247cb94ee6SHong Zhang #include "cvspgmr.h"
257cb94ee6SHong Zhang EXTERN_C_END
267cb94ee6SHong Zhang 
277cb94ee6SHong Zhang typedef struct {
287cb94ee6SHong Zhang   Vec  update;    /* work vector where new solution is formed */
297cb94ee6SHong Zhang   Vec  func;      /* work vector where F(t[i],u[i]) is stored */
307cb94ee6SHong Zhang   Vec  rhs;       /* work vector for RHS; vec_sol/dt */
317cb94ee6SHong Zhang   Vec  w1,w2;     /* work space vectors for function evaluation */
327cb94ee6SHong Zhang   PetscTruth  exact_final_time; /* force Sundials to interpolate solution to exactly final time
337cb94ee6SHong Zhang                                    requested by user (default) */
347cb94ee6SHong Zhang   /* PETSc peconditioner objects used by SUNDIALS */
357cb94ee6SHong Zhang   Mat  pmat;                         /* preconditioner Jacobian */
367cb94ee6SHong Zhang   PC   pc;                           /* the PC context */
377cb94ee6SHong Zhang   int  cvode_type;                   /* the SUNDIALS method, BDF or ADAMS   */
387cb94ee6SHong Zhang   TSSundialsGramSchmidtType gtype;
397cb94ee6SHong Zhang   int                    restart;
407cb94ee6SHong Zhang   double                 linear_tol;
417cb94ee6SHong Zhang 
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 */
477cb94ee6SHong Zhang   int      nonlinear_solves,linear_solves; /* since creation of object */
487cb94ee6SHong Zhang } TS_Sundials;
497cb94ee6SHong Zhang #endif
507cb94ee6SHong Zhang 
517cb94ee6SHong Zhang #endif
527cb94ee6SHong Zhang 
537cb94ee6SHong Zhang 
547cb94ee6SHong Zhang 
557cb94ee6SHong Zhang 
56