function [ g, ha, l, p0, re, rm, s ] = mhd_parameters ( ...
  g_user, ha_user, l_user, p0_user, re_user, rm_user )

%*****************************************************************************80
%
%% mhd_nonlinear_parameters(): parameters for the MHD problem.
%
%  Discussion:
%
%    If input values are specified, this resets the default parameters.
%    Otherwise, the output will be the current defaults.
%
%  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
%
%  Input:
%
%    real g_user: a linear factor multiplying the solution;
%
%    real ha_user: the Hartmann number, B*L*sqrt(sigma/nu).
%
%    real l_user: the length of the channel.
%
%    real p0_user: the base pressure.
%
%    real re_user: the fluid Reynolds number.
%
%    real rm_user: the magnetic Reynolds number.
%
%  Output:
%
%    real g: a linear factor multiplying the solution;
%
%    real ha: the Hartmann number.
%
%    real l: the length of the channel.
%
%    real p0: the base pressure;
%
%    real re: the fluid Reynolds number;
%
%    real rm: the magnetic Reynolds number.
%
%    real s: a linear scale factor for the relative sizes of u and b.
%
  persistent g_default;
  persistent ha_default;
  persistent l_default;
  persistent p0_default;
  persistent re_default;
  persistent rm_default;
%
%  Initialize defaults.
%
  if ( isempty ( g_default ) )
    g_default = 1.0;
  end

  if ( isempty ( ha_default ) )
    ha_default = 1.0;
  end

  if ( isempty ( l_default ) )
    l_default = 10.0;
  end

  if ( isempty ( p0_default ) )
    p0_default = 4.0;
  end

  if ( isempty ( re_default ) )
    re_default = 10.0;
  end

  if ( isempty ( rm_default ) )
    rm_default = 6.0;
  end
%
%  Update defaults if input was supplied.
%
  if ( 1 <= nargin )
    g_default = g_user;
  end

  if ( 2 <= nargin )
    ha_default = ha_user;
  end

  if ( 3 <= nargin )
    l_default = l_user;
  end

  if ( 4 <= nargin )
    p0_default = p0_user;
  end

  if ( 5 <= nargin )
    re_default = re_user;
  end

  if ( 6 <= nargin )
    rm_default = rm_user;
  end
%
%  Return values.
%
  g = g_default;
  ha = ha_default;
  l = l_default;
  p0 = p0_default;
  re = re_default;
  rm = rm_default;
  s = ha_default^2 / re_default / rm_default;
  
  return
end

