function testIsenProps
% testIsenProps  Test routines for isentropic compressible flow

% --- generate a brief table of properties
fprintf('\n\nTest isentropic property functions for Ma variation\n');
fprintf('    Ma       T/T0       p/p0     rho/rho0   A/Astar\n');
for Ma = 0:0.5:5
  ar = isenAAs(Ma+eps);
  tr = isenTT0(Ma);
  pr = isenpp0(Ma);
  rr = isenrr0(Ma);
  fprintf(' %6.2f   %8.5f   %8.5f   %8.5f   %8.5f\n',Ma,tr,pr,rr,ar);
end

% --- test the inverse routines
%       Verify that Ma_in -> f -> Ma_out gives Ma_out = Ma_in where
%       f is any property (p/p0, T/T0, rho/rho0, A/Astar)
Ma_in = [0.001 0.5:0.5:5]';
fprintf('\n\nTest isenMaTT0:  Ma as function of T/T0\n    Ma_in     Ma_out     tr\n');
tr = isenTT0(Ma_in);
Ma_out = isenMaTT0(tr);
disp([Ma_in   Ma_out  tr]);

fprintf('\n\nTest isenMapp0:  Ma as function of p/p0\n    Ma_in     Ma_out     pr\n');
pr = isenpp0(Ma_in);
Ma_out = isenMapp0(pr);
disp([Ma_in   Ma_out  pr]);

fprintf('\n\nTest isenMarr0:  Ma as function of rho/rho0\n    Ma_in     Ma_out     rr\n');
rr = isenrr0(Ma_in);
Ma_out = isenMarr0(rr);
disp([Ma_in   Ma_out  rr]);

% --- Note on isenMaar test:
%        isenMaar has a second (optional) input argument that is used to select
%        the appropriate solution branch:  subsonic or supersonic.  In the test
%        calculations below Ma_in-1 is used as the flag.  THis is a fair test
%        since it only dictates the branch, not the value of Ma_out that is
%        computed.
fprintf('\n\nTest isenMaar:  Ma as function of A/Astar\n    Ma_in     Ma_out     ar\n');
ar = isenAAs(Ma_in);
for i=1:length(ar)
  Ma_out(i) = isenMaaas(ar(i),Ma_in(i)-1);
end
disp([Ma_in   Ma_out  ar]);


fprintf('\n\nVectorized isenMaar\n');
fprintf('\n\nTest isenMaar:  Ma as function of A/Astar\n    Ma_in     Ma_out     ar\n');
Ma_out = isenMaaas(ar,Ma_in-1);
disp([Ma_in   Ma_out  ar  Ma_in-1]);


