fd2d_predator_prey, a FORTRAN90 code which solves a predator-prey system in a two dimensional region. The code requires both some interactive input from the user, and two simple 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)in a square [A,B]x[A,B], with initial conditions:
u(x,y,0) = u0(x,y) v(x,y,0) = v0(x,y)and Neumann boundary conditions along the boundary of the square:
du/dn = 0 dv/dn = 0The 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.4 BETA = 2.0 GAMMA = 0.6 DELTA = 10.0 A = 0.0 B = 500.0 H = 1.0 T = 150.0 DELT = 0.041666666666666 SOLVE = 0with the following initial values of U and V supplied in auxiliary subroutines:
ustar = gamma * alpha / ( beta - gamma ) u0(i,j) = ustar - 2.0E-07 * ( x(i,j) - 0.1 * y(i,j) - 225.0 ) * ( x(i,j) - 0.1 * y(i,j) - 675.0 ) vstar = ( 1.0 - ustar ) * ( alpha + ustar ) v0(i,j) = vstar - 3.0E-05 * ( x(i,j) - 450.0 ) - 1.2E-04 * ( y(i,j) - 150.0 )
The computer code and data files made available on this web page are distributed under the MIT license
fd2d_predator_prey is available in a FORTRAN90 version and a MATLAB version.
FD1D_PREDATOR_PREY, a FORTRAN90 code which uses finite differences to solve a 1D predator prey problem.