Actual source code: arkimex.c

petsc-3.3-p7 2013-05-11
  1: /*
  2:   Code for timestepping with additive Runge-Kutta IMEX method

  4:   Notes:
  5:   The general system is written as

  7:   F(t,X,Xdot) = G(t,X)

  9:   where F represents the stiff part of the physics and G represents the non-stiff part.

 11: */
 12: #include <petsc-private/tsimpl.h>                /*I   "petscts.h"   I*/

 14: static const TSARKIMEXType TSARKIMEXDefault = TSARKIMEX3;
 15: static PetscBool TSARKIMEXRegisterAllCalled;
 16: static PetscBool TSARKIMEXPackageInitialized;

 18: typedef struct _ARKTableau *ARKTableau;
 19: struct _ARKTableau {
 20:   char *name;
 21:   PetscInt order;               /* Classical approximation order of the method */
 22:   PetscInt s;                   /* Number of stages */
 23:   PetscInt pinterp;             /* Interpolation order */
 24:   PetscReal *At,*bt,*ct;        /* Stiff tableau */
 25:   PetscReal *A,*b,*c;           /* Non-stiff tableau */
 26:   PetscReal *bembedt,*bembed;   /* Embedded formula of order one less (order-1) */
 27:   PetscReal *binterpt,*binterp; /* Dense output formula */
 28:   PetscReal ccfl;               /* Placeholder for CFL coefficient relative to forward Euler */
 29: };
 30: typedef struct _ARKTableauLink *ARKTableauLink;
 31: struct _ARKTableauLink {
 32:   struct _ARKTableau tab;
 33:   ARKTableauLink next;
 34: };
 35: static ARKTableauLink ARKTableauList;

 37: typedef struct {
 38:   ARKTableau  tableau;
 39:   Vec         *Y;               /* States computed during the step */
 40:   Vec