xref: /petsc/src/ts/impls/explicit/rk/rk.h (revision bcd3bd92eda2d5998e2f14c4bbfb33bd936bdc3e)
1 typedef struct _RKTableau *RKTableau;
2 struct _RKTableau {
3   char      *name;
4   PetscInt   order;     /* Classical approximation order of the method i              */
5   PetscInt   s;         /* Number of stages                                           */
6   PetscInt   p;         /* Interpolation order                                        */
7   PetscBool  FSAL;      /* flag to indicate if tableau is FSAL                        */
8   PetscReal *A, *b, *c; /* Tableau                                                    */
9   PetscReal *bembed;    /* Embedded formula of order one less (order-1)               */
10   PetscReal *binterp;   /* Dense output formula                                       */
11   PetscReal  ccfl;      /* Placeholder for CFL coefficient relative to forward Euler  */
12 };
13 typedef struct _RKTableauLink *RKTableauLink;
14 struct _RKTableauLink {
15   struct _RKTableau tab;
16   RKTableauLink     next;
17 };
18 
19 typedef struct {
20   RKTableau    tableau;
21   PetscBool    newtableau; /* flag to indicate if tableau has changed */
22   Vec          X0;
23   Vec         *Y;            /* States computed during the step                                              */
24   Vec         *YdotRHS;      /* Function evaluations for the non-stiff part and contains all components      */
25   Vec         *YdotRHS_fast; /* Function evaluations for the non-stiff part and contains fast components     */
26   Vec         *YdotRHS_slow; /* Function evaluations for the non-stiff part and contains slow components     */
27   Vec         *VecsDeltaLam; /* Increment of the adjoint sensitivity w.r.t IC at stage                       */
28   Vec         *VecsSensiTemp;
29   Vec          VecDeltaMu;    /* Increment of the adjoint sensitivity w.r.t P at stage                        */
30   Vec         *VecsDeltaLam2; /* Increment of the 2nd-order adjoint sensitivity w.r.t IC at stage */
31   Vec          VecDeltaMu2;   /* Increment of the 2nd-order adjoint sensitivity w.r.t P at stage */
32   Vec         *VecsSensi2Temp;
33   PetscScalar *work; /* Scalar work                                                                  */
34   PetscInt     slow; /* flag indicates call slow components solver (0) or fast components solver (1) */
35   PetscReal    stage_time;
36   TSStepStatus status;
37   PetscReal    ptime;
38   PetscReal    time_step;
39   PetscInt     dtratio; /* ratio between slow time step size and fast step size                         */
40   IS           is_fast, is_slow;
41   TS           subts_fast, subts_slow, subts_current, ts_root;
42   PetscBool    use_multirate;
43   Mat          MatFwdSensip0;
44   Mat         *MatsFwdStageSensip;
45   Mat         *MatsFwdSensipTemp;
46   Vec          VecDeltaFwdSensipCol; /* Working vector for holding one column of the sensitivity matrix */
47 } TS_RK;
48