function mhd_resid_test ( )

%*****************************************************************************80
%
%% mhd_resid_test() tests mhd_resid().
%
%  Discussion:
%
%    Formulas for u(y) and b(y) are used to define an exact solution
%    of an MHD system.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    23 August 2024
%
%  Author:
%
%    John Burkardt
%
%  Reference:
%
%    Jean-Frederic Gerbeau, Claude Le Bris, Tony Lelievre,
%    Mathematical methods for the magnetohydrodynamics
%    of liquid metals,
%    Oxford University Press, 2006,
%    ISBN 978-0-19-856665-6
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'mhd_resid_test():\n' );
  fprintf ( 1, '  Compute maximum residual over sample points for\n' );
  fprintf ( 1, '  functions u(y) and b(y) that define an exact solution\n' );
  fprintf ( 1, '  of the Hartmann MHD solution.\n' );

  [ ~, ~, L, ~, ~, ~, ~ ] = mhd_parameters ( );
%
%  Select random points in the region.
%
  x = 0.0 + L * rand ( 10, 1 );
  y = -1.0 + 2.0 * rand ( 10, 1 );
%
%  Evaluate the residuals.
%
  [ ur, br ] = mhd_resid ( x, y );

  fprintf ( 1, '\n' );
  fprintf ( 1, '  Maximum residual in u(y) equation = %g\n', max ( abs ( ur ) ) );
  fprintf ( 1, '  Maximum residual in b(y) equation = %g\n', max ( abs ( br ) ) );

  return
end

