close all
clear all


pipe_size = 2;

D = [2.5 3.0 3.5 4.0 4.5]*.0254;
Dr = 2*.0254;


A = 0.25*pi*(D.^2-Dr^2);


V = 0:1/100:1; V = V';
F = 0:10:15000; ;

Q = V*A;
P = (1./A')*F;

figure('Position',[520   142   843   956],'PaperOrientation','portrait','PaperPositionMode','auto');
subplot(2,1,1)
plot(V,Q*1000*60/3.81)  %G/min
xlabel('Speed (m/s)');
ylabel('Flow Rate (GPM)');
legend('D = 2.5 in','D = 3.0 in','D = 3.5 in','D = 4.0 in','D = 4.5 in');
title('Flow and Pressures for a range of Bore Diameters;  Rod = 2 in');

subplot(2,1,2)
plot(F,P/6894)  %psi
xlabel('Force (N)');
ylabel('Pressure Differential (psi)');
legend('D = 2.5 in','D = 3.0 in','D = 3.5 in','D = 4.0 in','D = 4.5 in');


D = 6.0*.0254;
Dr = 2*.0254;

A = 0.25*pi*(D.^2-Dr^2);


V = 0:1/100:1; V = V';
F = 0:10:15000; 

Q = V*A;
P = (1./A')*F;

figure('Position',[520   142   843   956],'PaperOrientation','portrait','PaperPositionMode','auto');
contour(Q*1000*60/3.81,P/6894,(Q*P)');
ylabel('Pressure (psi)');
xlabel('Flow (GPM)');
title('Power Contours for Bore = 3 in, Rod = 2 in');

figure('Position',[520   142   843   956],'PaperOrientation','portrait','PaperPositionMode','auto');
contour(V,F,(Q*P)');
ylabel('Force (N)');
xlabel('Speed (m/s)');
title('Power Contours for Bore = 3 in, Rod = 2 in');


