# FD1D_PREDATOR_PREY Predator Prey Simulation

FD1D_PREDATOR_PREY is an FORTRAN90 program which solves a predator-prey system in a one dimensional region, creating graphics files for processing by GNUPLOT, by Marcus Garvie.

The program requires both some interactive input from the user, and two simple FORTRAN90 routines that define the initial values.

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.

A typical input 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 following initial values of U and V supplied in auxiliary subroutines:
```        u0(1:n) = exp ( - ( x(1:n) - 100.0 )**2 ) / 5.0
v0(1:n) = 2.0 / 5.0
```

The user is prompted for all the necessary parameters, time and space-steps. The formulas for the initial values of the functions U and V must be supplied by two FORTRAN90 subroutines.

### 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 FORTRAN90 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 FORTRAN90 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 FORTRAN90 program which applies the finite difference method to a two point boundary value problem in one spatial dimension.

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

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

FD1D_HEAT_STEADY, a FORTRAN90 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 FORTRAN90 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 uses the finite element method to solve a simulation of the 2D predator prey equations.

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

GNUPLOT, FORTRAN90 programs which illustrate how a program can write data and command files so that gnuplot can create plots of the program results.

Marcus Garvie

### 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.

### List of Routines:

• MAIN is the main program for FD1D_PREDATOR_PREY.
• D3_JAC_SL solves a D3 system using Jacobi iteration.
• D3_NP_FA factors a D3 matrix without pivoting.
• D3_NP_SL solves a D3 system factored by D3_NP_FA.
• TIMESTAMP prints the current YMDHMS date as a time stamp.

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

Last revised on 08 June 2013.