function [ ur, vr, wr, pr ] = resid_poiseuille ( nu, n, x, y, z, t )

%*****************************************************************************80
%
%% resid_poiseuille(): residual of the Poiseuille exact Navier Stokes solution.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    12 January 2020
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    real NU, the viscosity.
%
%    integer N, the number of evaluation points.
%
%    real X( n, 1 ), Y( n, 1 ), Z( n, 1 ), the coordinates of the points.
%
%    real T( n, 1 ), the time coordinates.
%
%  Output:
%
%    real UR( n, 1 ), VR( n, 1 ), WR( n, 1 ), PR( n, 1 ), the residuals.
%
  u = 1.0 - y.^2 - z.^2;
  ux =  zeros ( n, 1 );
  uxx = zeros ( n, 1 );
  uy =  - 2.0 * y;
  uyy = - 2.0 * ones ( n, 1 );
  uz =  - 2.0 * z;
  uzz = - 2.0 * ones ( n, 1 );
  ut =  zeros ( n, 1 );

  v =   zeros( n, 1 );
  vx =  zeros( n, 1 );
  vxx = zeros( n, 1 );
  vy =  zeros( n, 1 );
  vyy = zeros( n, 1 );
  vz =  zeros( n, 1 );
  vzz = zeros( n, 1 );
  vt =  zeros( n, 1 );

  w =   zeros( n, 1 );
  wx =  zeros( n, 1 );
  wxx = zeros( n, 1 );
  wy =  zeros( n, 1 );
  wyy = zeros( n, 1 );
  wz =  zeros( n, 1 );
  wzz = zeros( n, 1 );
  wt =  zeros( n, 1 );

  p  = - 4.0 * x;
  px = - 4.0;
  py = zeros( n, 1 );
  pz = zeros( n, 1 );
%
%  Evaluate the residuals.
%
  ur = ut + u .* ux + v .* uy + w .* uz + px - ( uxx + uyy + uzz );
  vr = vt + u .* vx + v .* vy + w .* vz + py - ( vxx + vyy + vzz );
  wr = wt + u .* wx + v .* wy + w .* wz + pz - ( wxx + wyy + wzz );
  pr = ux + vy + wz;

  return
end

