xref: /petsc/src/ts/impls/explicit/rk/rk.h (revision d5b43468fb8780a8feea140ccd6fa3e6a50411cc)
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   Vec          X0;
22   Vec         *Y;            /* States computed during the step                                              */
23   Vec         *YdotRHS;      /* Function evaluations for the non-stiff part and contains all components      */
24   Vec         *YdotRHS_fast; /* Function evaluations for the non-stiff part and contains fast components     */
25   Vec         *YdotRHS_slow; /* Function evaluations for the non-stiff part and contains slow components     */
26   Vec         *VecsDeltaLam; /* Increment of the adjoint sensitivity w.r.t IC at stage                       */
27   Vec         *VecsSensiTemp;
28   Vec          VecDeltaMu;    /* Increment of the adjoint sensitivity w.r.t P at stage                        */
29   Vec         *VecsDeltaLam2; /* Increment of the 2nd-order adjoint sensitivity w.r.t IC at stage */
30   Vec          VecDeltaMu2;   /* Increment of the 2nd-order adjoint sensitivity w.r.t P at stage */
31   Vec         *VecsSensi2Temp;
32   PetscScalar *work; /* Scalar work                                                                  */
33   PetscInt     slow; /* flag indicates call slow components solver (0) or fast components solver (1) */
34   PetscReal    stage_time;
35   TSStepStatus status;
36   PetscReal    ptime;
37   PetscReal    time_step;
38   PetscInt     dtratio; /* ratio between slow time step size and fast step size                         */
39   IS           is_fast, is_slow;
40   TS           subts_fast, subts_slow, subts_current, ts_root;
41   PetscBool    use_multirate;
42   Mat          MatFwdSensip0;
43   Mat         *MatsFwdStageSensip;
44   Mat         *MatsFwdSensipTemp;
45   Vec          VecDeltaFwdSensipCol; /* Working vector for holding one column of the sensitivity matrix */
46 } TS_RK;
47