function diffusivity_2d_ntw_contour ( )

%*****************************************************************************80
%
%% diffusivity_2d_ntw_contour displays a contour plot of a 2D stochastic diffusivity function.
%
%  Discussion:
%
%    The diffusivity function is compute by DIFFUSIVITY_2D_NTW.
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license.
%
%  Modified:
%
%    08 February 2019
%
%  Author:
%
%    John Burkardt
%
%  Reference:
%
%    Fabio Nobile, Raul Tempone, Clayton Webster,
%    A Sparse Grid Stochastic Collocation Method for Partial Differential
%    Equations with Random Input Data,
%    SIAM Journal on Numerical Analysis,
%    Volume 46, Number 5, 2008, pages 2309-2345.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'diffusivity_2d_ntw_contour\n' );
  fprintf ( 1, '  Display contour or surface plots of the stochastic\n' );
  fprintf ( 1, '  diffusivity function defined by DIFFUSIVITY_2D_NTW.\n' );
%
%  Set the spatial grid.
%
  d = 1.0;
  nx = 101;
  ny = 101;
  xvec = linspace ( 0.0, d, nx );
  yvec = linspace ( 0.0, d, ny );

  [ xmat, ymat ] = meshgrid ( xvec, yvec );
%
%  Sample OMEGA.
%  We rescale to  [-sqrt(3),sqrt(3)].
%
  m = 21;
  omega = rand ( m, 1 );
  omega = ( 1.0 - omega ) * ( - sqrt ( 3.0 ) ) ...
        +         omega   *     sqrt ( 3.0 );
%
%  Evaluate the diffusivity field.
%
  cl = 0.1;
  dc0 = 0.5;
  n = nx * ny;

  dc = diffusivity_2d_ntw ( cl, dc0, m, omega, n, xmat, ymat );
%
%  Make a surface plot of the diffusivity coefficient.
%
  figure ( );
  surf ( ymat, xmat, dc, 'EdgeColor', 'interp' )
  xlabel ( '<--- Y --->', 'fontsize', 12 )
  ylabel ( '<--- X --->', 'fontsize', 12 )
  zlabel ( '<--- \rho(X,Y) --->', 'fontsize', 12 )
  title ( 'NTW Stochastic diffusivity function', 'Fontsize', 18 )

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

  pause ( 5 );

  return
end
