Date: 2025-03-29T05:58:50+00:00

Actual source code: reaction_diffusion.h

      1: #pragma once

      3: #include <petscts.h>

      5: /* Simple C struct that allows us to access the two velocity (x and y directions) values easily in the code */
      6: typedef struct {
      7:   PetscScalar u, v;
      8: } Field;

     10: /* Data structure to store the model parameters */
     11: typedef struct {
     12:   PetscReal D1, D2, gamma, kappa;
     13:   PetscBool aijpc;
     14:   Vec       U;
     15:   Mat       A;
     16:   TS        ts;
     17: } AppCtx;

     19: /* User-supplied functions for TS */
     20: PetscErrorCode RHSFunction(TS, PetscReal, Vec, Vec, void *);
     21: PetscErrorCode RHSJacobian(TS, PetscReal, Vec, Mat, Mat, void *);
     22: PetscErrorCode IFunction(TS, PetscReal, Vec, Vec, Vec, void *);
     23: PetscErrorCode IJacobian(TS, PetscReal, Vec, Vec, PetscReal, Mat, Mat, void *);