function fd2d_predator_prey_test ( )

%*****************************************************************************80
%
%% fd2d_predator_prey_test() tests fd2d_predator_prey().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    03 May 2020
%
%  Author:
%
%    John Burkardt
%
  addpath ( '../fd2d_predator_prey' )

  timestamp ( );
  fprintf ( 1, '\n' );
  fprintf ( 1, 'fd2d_predator_prey_test():\n' );
  fprintf ( 1, '  MATLAB/Octave version %s\n', version ( ) );
  fprintf ( 1, '  fd2d_predator_prey simulates a 2D predator prey problem.\n' );

  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 = 1.0 / 24.0;

  [ X, Y, U, V ] = fd2d_predator_prey ( alpha, beta, gamma, delta, a, b, h, T, ...
    delt, @u0, @v0 );
%
% Plot solutions u and v
%
  figure ( );
  pcolor ( X, Y, U );
  shading ( 'flat' );
  colorbar ( );
  axis square xy;
  title ( 'u' )
  filename = 'fd2d_predator_prey_u.png';
  print ( '-dpng', filename );
  fprintf ( 1, '  Graphics saved as "%s"\n', filename );

  figure ( );
  pcolor ( X, Y, V );
  shading ( 'flat' );
  colorbar ( );
  axis square xy;
  title ( 'v' )
  filename = 'fd2d_predator_prey_v.png';
  print ( '-dpng', filename );
  fprintf ( 1, '  Graphics saved as "%s"\n', filename );
%
%  Terminate.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'fd2d_predator_prey_test():\n' );
  fprintf ( 1, '  Normal end of execution.\n' );
  fprintf ( 1, '\n' );
  timestamp ( );

  rmpath ( '../fd2d_predator_prey' )

  return
end
function value = u0 ( X, Y )

%*****************************************************************************80
%
%% u0() sets the initial value of U.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    14 February 2003
%
%  Author:
%
%    John Burkardt
%
  value = 6.0 / 35.0 - 2.0E-7 * ( X - 0.1 * Y - 225.0 ) .* ( X - 0.1 * Y - 675.0 );

  return
end
function value = v0 ( X, Y )

%*****************************************************************************80
%
%% v0() sets the initial value for V.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    14 February 2003
%
%  Author:
%
%    John Burkardt
%
  value = 116.0 / 245.0 - 3.0E-5 * ( X - 45.00 ) - 1.2E-4 * ( Y - 150.0 );

  return
end
function timestamp ( )

%*****************************************************************************80
%
%% timestamp() prints the current YMDHMS date as a timestamp.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    14 February 2003
%
%  Author:
%
%    John Burkardt
%
  t = now;
  c = datevec ( t );
  s = datestr ( c, 0 );
  fprintf ( 1, '%s\n', s );

  return
end

