Prey-Predator model

1. Introduction

This model describes the interaction between two species, a predator and its prey, in a given environment. The model is based on a pair of reaction-diffusion equations which describe how the populations of the two species evolve over time and space. The interaction between the species, as well as their movement in the environment, are captured by these equations.

The two species are denoted as follows:

  • u: Prey

  • v: Predator

The reaction-diffusion equations that govern the interaction are:

\[\begin{align*} \frac{\partial u}{\partial t} &= D_u \nabla^2 u - u(1 - u) + \frac{u v}{u + \alpha}\\ \frac{\partial v}{\partial t} &= D_v \nabla^2 v + \beta \frac{u v}{u + \alpha} - \gamma v \end{align*}\]

In these equations:

  • D_u and D_v are the diffusion coefficients for the prey and predators, respectively.

  • \alpha, \beta, and \gamma are parameters governing the interaction between the species. Specifically, \alpha is related to the competition for resources among the prey, \beta represents the rate at which predators consume prey, and \gamma is the mortality rate of predators.

The model also includes equilibrium conditions for the prey and predators, u* and v* respectively, which are defined as:

\[\begin{align*} u* &= \frac{\alpha \gamma}{\beta - \gamma}\\ v* &= (1 - u*)(u* + \alpha) \end{align*}\]

The initial conditions for the prey and predators are given by spatially varying distributions u(x,y) and v(x,y) respectively.

2. Parameters

The model parameters are:

  • thealpha: Governs competition for resources among the prey.

  • thebeta: Represents the rate at which predators consume prey.

  • thegamma: The mortality rate of predators.

  • thedelta: Governs the diffusion of predators.

These can be adjusted to replicate different ecological scenarios.

3. Meshes

The spatial domain for the problem is defined by a mesh. The specific geometry is imported from a .geo file.

4. Post-processing

The results of the simulation are the densities of the prey and predators at each time step, which are exported for further analysis.

5. Configuration

json file
{
    /*
      References :
      - Finite element approximation of spatially extended prey interactions with the Holling type II functional response ( Marcus R. Garvie - Catalin Trenchea )
      - Finite-Difference Schemes for Reaction-Diffusion Equations Modeling Prey-Predator Interactions in MATLAB ( Marcus R. Garvie )
     */
    "Name": "Square2d",
    "ShortName": "Square2d",
    "Models":
    {
        "cfpdes":{
            "equations":["equation1","equation2"]
        },
        "equation1":{
            "setup":{
                "unknown":{
                    "basis":"Pch1",
                    "name":"prey",
                    "symbol":"u"
                },
                "coefficients":{
                    "c":"1", // diffusion
                    "a":"-( (1-equation1_u) - equation2_v/(equation1_u+thealpha) ):thealpha:equation1_u:equation2_v", // reaction
                    //"f":"( equation1_u*(1-equation1_u) - equation1_u*equation2_v/(equation1_u+thealpha) ):thealpha:equation1_u:equation2_v", // source
                    "d":"1" // first time derivative
                }
            }
        },
        "equation2":{
            "setup":{
                "unknown":{
                    "basis":"Pch1",
                    "name":"predator",
                    "symbol":"v"
                },
                "coefficients":{
                    "c":"thedelta:thedelta", // diffusion
                    "a":"-( (thebeta*equation1_u)/(equation1_u+thealpha) - thegamma ):thebeta:thealpha:thegamma:equation1_u", // reaction
                    //"f":"equation2_v*( (thebeta*equation1_u)/(equation1_u+thealpha) - thegamma ):thebeta:thealpha:thegamma:equation1_u:equation2_v", // source
                    "d":"1"// first time derivative
                }
            }
        }
    },
    "Parameters":
    {
        "thealpha":0.4,
        "thebeta":2.0,
        "thegamma":0.6,
        "thedelta":1.0,
        // "ustar":"thealpha*thegamma/(thebeta-thegamma):thealpha:thegamma:thebeta",
        // "vstar":"(1-ustar)*(ustar+thealpha):ustar:thealpha"
        "ustar":"6/35",
        "vstar":"116.0/245"
    },
    "Meshes":
    {
        "cfpdes":
        {
            "Import":
            {
                "filename":"$cfgdir/square2d.geo",
                "hsize":1 //10
            }
        }
    },
    "Materials":
    {
        "mymat1":
        {
            "markers":"Omega"
        }
    },
    // "BoundaryConditions":
    // {
    //     "equation1":
    //     {
    //     },
    //     "equation2":
    //     {
    //     }
    // },
    "InitialConditions":
    {
        "equation1":{
            "prey":{
                "Expression":{
                    "myic":{
                        "markers":"Omega",
                        "expr":"ustar-(2e-7)*(x-0.1*y-225)*(x-0.1*y-675):ustar:x:y"
                    }
                }
            }
        },
        "equation2":{
            "predator":{
                "Expression":{
                    "myic":{
                        "markers":"Omega",
                        "expr":"vstar-(3e-5)*(x-450) -(1.2e-4)*(y-150):vstar:x:y"
                    }
                }
            }
        }
    },
    "PostProcess":
    {
        "cfpdes":
        {
            "Exports":
            {
                "fields":["equation1.prey","equation2.predator"]
            }
        }
    }
}
cfg file
directory=toolboxes/coefficientformpdes/predator-prey
case.dimension=2

[cfpdes]
filename=$cfgdir/predator-prey.json

verbose=0

#solver=Linear#Picard#Linear#Picard
ksp-monitor=1
pc-type=gasm
#ksp-type=preonly
snes-monitor=1
#snes-line-search-type=l2#basic #bt,basic,l2

[cfpdes.equation1]
time-stepping=Theta
#bdf.order=2

[cfpdes.equation2]
time-stepping=Theta
#bdf.order=2

[ts]
time-initial=0
time-step=0.05#0.003#0.05#0.001#0.05
time-final=1000 #150
restart.at-last-save=true

[exporter]
freq=10#50#10#20

6. Results

Video of the simulation