function psi = psi_channel ( X, Y )

%*****************************************************************************80
%
%% psi_channel returns the channel psi field.
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license.
%
%  Modified:
%
%    16 July 2020
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    real X(nr,nc), Y(nr,nc): the node coordinates.
%
%  Output:
%
%    real PSI(nr,nc): the stream function values.
%
  ymin = min ( min ( Y ) );
  ymax = max ( max ( Y ) );

  psi = 4.0 / ( ymax - ymin )^2 ...
    * ( -Y.^3 / 3.0 + 0.5 * ( ymax + ymin ) * Y.^2 - ymax * ymin * Y );

  return
end

