fd1d_predator_prey, a FORTRAN90 code which solves a predator-prey system in a one dimensional region, creating graphics files for processing by GNUPLOT, by Marcus Garvie.
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)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 = 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.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.
The computer code and data files made available on this web page are distributed under the MIT license
fd1d_predator_prey is available in a FORTRAN90 version and a MATLAB version.
FD1D_BURGERS_LAX, a FORTRAN90 code 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 code 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 code which applies the finite difference method to a two point boundary value problem in one spatial dimension.
FD1D_HEAT_EXPLICIT, a FORTRAN90 code which uses the finite difference method and explicit time stepping to solve the time dependent heat equation in 1D.
FD1D_HEAT_IMPLICIT, a FORTRAN90 code which uses the finite difference method and implicit time stepping to solve the time dependent heat equation in 1D.
FD1D_HEAT_STEADY, a FORTRAN90 code which uses the finite difference method to solve the steady (time independent) heat equation in 1D.
FD1D_WAVE, a FORTRAN90 code 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 code which uses the finite element method to solve a simulation of the 2D predator prey equations.
FEM1D, a FORTRAN90 code which applies the finite element method, with piecewise linear basis functions, to a two point boundary value problem;
gnuplot_test, FORTRAN90 codes which write data and command files so that gnuplot() can create plots.
Marcus Garvie