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