function diffusivity_2d_jvb_contour ( m )

%*****************************************************************************80
%
%% diffusivity_2d_jvb_contour displays contour plots of a 2D stochastic diffusivity function.
%
%  Discussion:
%
%    The diffusivity function is computed by DIFFUSIVITY_2D.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    08 February 2019
%
%  Author:
%
%    John Burkardt
%
%  Reference:
%
%    Ivo Babuska, Fabio Nobile, Raul Tempone,
%    A stochastic collocation method for elliptic partial differential equations
%    with random input data,
%    SIAM Journal on Numerical Analysis,
%    Volume 45, Number 3, 2007, pages 1005-1034.
%
%  Input:
%
%    integer M, controls the number of random coefficients, which
%    will be 4*M.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'diffusivity_2d_jvb_contour\n' );
  fprintf ( 1, '  Display contour or surface plots of the stochastic\n' );
  fprintf ( 1, '  diffusivity function defined by DIFFUSIVITY_2D.\n' );
  fprintf ( 1, '\n' );
  fprintf ( 1, '  Number of random coefficients will be 4*M = %d\n', 4 * m );
%
%  Set the spatial grid X, Y..
%
  nx = 101;
  ny = 101;

  x_1d = linspace ( -1.0, +1.0, nx );
  y_1d = linspace ( -1.0, +1.0, ny );

  [ X, Y ] = meshgrid ( x_1d, y_1d );
%
%  Compute the diffusivity field A(X,Y).
%
  a0 = 2.0;
  omega = -1.0 + 2.0 * rand ( 4 * m, 1 );
  n = nx * ny;

  A = diffusivity_2d_jvb ( a0, m, omega, n, X, Y );
%
%  Plot the diffusivity field.
%
  surf ( Y, X, A, 'EdgeColor', 'interp' )
  xlabel ( '<--- Y --->', 'fontsize', 12 )
  ylabel ( '<--- X --->', 'fontsize', 12 )
  zlabel ( '<--- \rho(X,Y) --->', 'fontsize', 12 )
  label = sprintf ( 'JVB stochastic diffusivity, using %d terms', 4 * m );
  title ( label, 'Fontsize', 18 )

  filename = 'diffusivity_2d_jvb.png';
  print ( '-dpng', filename )
  fprintf ( 1, '\n' );
  fprintf ( 1, '  Plot file stored as "%s".\n', filename );

  pause ( 5 );

  return
end
