function h = diffusion_conserved ( x, u )

%*****************************************************************************80
%
%% diffusion_conserved() evaluates the conserved quantity for diffusion PDE.
%
%  Discussion:
%
%    The integral of U over the region should be conserved.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    27 January 2021
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    real X(1,NX), the coordinates of the nodes.
%
%    real U(1,NX), the current solution.
%
%  Output:
%
%    real H: the value of the conserved quantity.
%
  nx = size ( x, 2 );
  dx = ( max ( x ) - min ( x ) ) / ( nx - 1 );
  h = sum ( u ) * dx;

  return
end

