# FD1D_PREDATOR_PREY Predator Prey Simulation by Marcus Garvie

FD1D_PREDATOR_PREY is a FORTRAN77 program which solves a predator-prey system in a one dimensional region.

The nondimensional problem has the form

```        du/dt =         del u + ( 1 - u ) * u        - v * h(u/alpha)

dv/dt = delta * del v     - gamma * v + beta * v * h(u/alpha)
```
with initial conditions:
```        u(x,0) = u0(x)
v(x,0) = v0(x)
```
and boundary conditions at the left and right endpoints [A,B]:
```        du/dx = 0
dv/dx = 0
```
The Type II functional response employed here is
```        h(eta) = eta / ( 1 + eta )
```
The parameters ALPHA, BETA, GAMMA and DELTA are strictly positive.

The user must input a value H specifying the desired space step to be used in discretizing the space dimension.

A finite difference scheme is employed to integrate the problem from time 0 to a maximum time T. The user must input the value T, as well as an appropriate time step DELT.

Typical data for this problem is:

```        ALPHA =   0.3
BETA  =   2.0
GAMMA =   0.8
DELTA =   1.0
A     =   0.0
B     = 200.0
H     =   0.5
T     =  40.0
DELT  =   0.0104
GAUSS =   0        (0 = direct solution, 1 = Jacobi )
```
with the initial values of U and V set, for instance, to:
```        u0(1:n) = exp ( - ( x(1:n) - 100.0 )**2 ) / 5.0
v0(1:n) = 2.0 / 5.0
```

### Languages:

FD1D_PREDATOR_PREY is available in a FORTRAN77 version and a FORTRAN90 version and a MATLAB version.

### Related Data and Programs:

FD1D_BURGERS_LAX, a FORTRAN77 program which applies the finite difference method and the Lax-Wendroff method to solve the non-viscous time-dependent Burgers equation in one spatial dimension.

FD1D_BURGERS_LEAP, a FORTRAN77 program which applies the finite difference method and the leapfrog approach to solve the non-viscous time-dependent Burgers equation in one spatial dimension.

FD1D_BVP, a FORTRAN77 program which applies the finite difference method to a two point boundary value problem in one spatial dimension.

FD1D_HEAT_EXPLICIT, a FORTRAN77 program which uses the finite difference method and explicit time stepping to solve the time dependent heat equation in 1D.

FD1D_HEAT_IMPLICIT, a FORTRAN77 program which uses the finite difference method and implicit time stepping to solve the time dependent heat equation in 1D.

FD1D_HEAT_STEADY, a FORTRAN77 program which uses the finite difference method to solve the steady (time independent) heat equation in 1D.

FD1D_PREDATOR_PREY_PLOT, a MATLAB program which displays the solution components computed by FD1D.

FD1D_WAVE, a FORTRAN77 program which applies the finite difference method to solve the time-dependent wave equation utt = c * uxx in one spatial dimension.

FD2D_PREDATOR_PREY, a FORTRAN90 program which implements a finite difference algorithm for a predator-prey system with spatial variation in 2D.

FEM1D, a FORTRAN90 program which applies the finite element method, with piecewise linear basis functions, to a two point boundary value problem;

### Reference:

1. Marcus Garvie,
Finite-Difference Schemes for Reaction-Diffusion Equations Modeling Predator-Prey Interactions in MATLAB,
Bulletin of Mathematical Biology,
Volume 69, Number 3, 2007, pages 931-956.

### Examples and Tests:

• u1d.txt, a file of (X,U(X)) values at the final time.
• v1d.txt, a file of (X,V(X)) values at the final time.
• data.txt, a small amount of data needed by the plotting program.

You can go up one level to the FORTRAN77 source codes.

Last revised on 27 February 2009.