- #1
sV.Hypnosis
- 1
- 0
1.We are asked to:
i - Plot Wdot(pump) vs Q where v varies from 1 m/s to 50 m/s in increments of 1 m/s
ii - plot P vs Q
iii - write a function that uses Newtons method with a numerical derivative to calculate the friction factor -- function f = frict (e_over_d,Re)
equations are below
In this program you will write a program that determines the pressure a pump must provide and the horsepower required to run an ideal pump for a system that removes water from a reservoir and discharges the water to a second water reservoir at a higher elevation.
water density ρ = 998 kg/m^3
water viscosity μ = 1.003E-3
roughness ratio e/D= 2E-4
g = 9.81 m/s^2
2. pump exit pressure, P
P = ρ[f*(L/D)*(v^2/2) + g*h]/b]
Colebrook equation for the friction factor f (based on Re=*v*D/μ)
1/√f = -2log(base10)[(ε/D*3.7)+(2.51/Re*√f)] which when solved for f (neglecting the f term on the right side of the equation) => f = 1.325/[ln(ε/3.7D + 5.74/Re^.9)]^2
horsepower for the pump
Wdot(pump) = mdot [P/ρ + v^2/2]
3. I created a for loop for the Reynolds number:
clc
clear all
rho=998;
mu=1.003e-3;
D=.5;
v=1:1:49;
Re=rho*v*D/mu;
i=0;
for i=1:length(v)
i=i+1
v=i;
Re=rho*v*D/mu
root(i)=funct(v(i))
end
Now i need to figure out how to call this loop into another loop using the friction factor equation f..
Once i get that i need to plug that f value "loop"(from 1 to 50 m/s for velocity of course) into the Pressure function and then that P loop into the Wdot(pump) equation so I can plot it..
Newtons method is applied here but I don't understand why because I am not taking derivative. The only thing i can think of is that since v changes by 1 m/s up to 50 m/s so its a rate of change. It will keep going up by adding small parts together with Newtons method which is this code:
function [ f ] = frict( e_over_d,Re )
%use secant method to calculate the friction factor
% Detailed explanation goes here
e_over_d=2e-4;
rho=998;
mu=1.003e-3;
vo=1;
D=.5
Re=rho*vo*D/mu;
f =1.325/(ln((e_over_d/3.7)+(5.74/Re^.9))^2);
eps=abs(f);
iter=0;
while eps>1.0e-12 && iter < 100
fprime=1.325/(ln((e_over_d/3.7)+(5.74/Re(vo)^.9))^2);
iter=iter+1
delx=1.0e-4*vo
vright=vo+delx
fright=1.325/(ln((e_over_d/3.7)+(5.74/Re(vright)^.9))^2)
fprime=(fright - f)/delx
v = vo-f/fprime
f= 1.325/(ln((e_over_d/3.7)+(5.74/Re^.9))^2);
eps=abs(f)
v=vo
end
this code is all messed up but the format is Newtons method.. I just cannot figure out how to use that Re loop i made with that function!
help!
-Ethan G
i - Plot Wdot(pump) vs Q where v varies from 1 m/s to 50 m/s in increments of 1 m/s
ii - plot P vs Q
iii - write a function that uses Newtons method with a numerical derivative to calculate the friction factor -- function f = frict (e_over_d,Re)
equations are below
In this program you will write a program that determines the pressure a pump must provide and the horsepower required to run an ideal pump for a system that removes water from a reservoir and discharges the water to a second water reservoir at a higher elevation.
water density ρ = 998 kg/m^3
water viscosity μ = 1.003E-3
roughness ratio e/D= 2E-4
g = 9.81 m/s^2
2. pump exit pressure, P
P = ρ[f*(L/D)*(v^2/2) + g*h]/b]
Colebrook equation for the friction factor f (based on Re=*v*D/μ)
1/√f = -2log(base10)[(ε/D*3.7)+(2.51/Re*√f)] which when solved for f (neglecting the f term on the right side of the equation) => f = 1.325/[ln(ε/3.7D + 5.74/Re^.9)]^2
horsepower for the pump
Wdot(pump) = mdot [P/ρ + v^2/2]
3. I created a for loop for the Reynolds number:
clc
clear all
rho=998;
mu=1.003e-3;
D=.5;
v=1:1:49;
Re=rho*v*D/mu;
i=0;
for i=1:length(v)
i=i+1
v=i;
Re=rho*v*D/mu
root(i)=funct(v(i))
end
Now i need to figure out how to call this loop into another loop using the friction factor equation f..
Once i get that i need to plug that f value "loop"(from 1 to 50 m/s for velocity of course) into the Pressure function and then that P loop into the Wdot(pump) equation so I can plot it..
Newtons method is applied here but I don't understand why because I am not taking derivative. The only thing i can think of is that since v changes by 1 m/s up to 50 m/s so its a rate of change. It will keep going up by adding small parts together with Newtons method which is this code:
function [ f ] = frict( e_over_d,Re )
%use secant method to calculate the friction factor
% Detailed explanation goes here
e_over_d=2e-4;
rho=998;
mu=1.003e-3;
vo=1;
D=.5
Re=rho*vo*D/mu;
f =1.325/(ln((e_over_d/3.7)+(5.74/Re^.9))^2);
eps=abs(f);
iter=0;
while eps>1.0e-12 && iter < 100
fprime=1.325/(ln((e_over_d/3.7)+(5.74/Re(vo)^.9))^2);
iter=iter+1
delx=1.0e-4*vo
vright=vo+delx
fright=1.325/(ln((e_over_d/3.7)+(5.74/Re(vright)^.9))^2)
fprime=(fright - f)/delx
v = vo-f/fprime
f= 1.325/(ln((e_over_d/3.7)+(5.74/Re^.9))^2);
eps=abs(f)
v=vo
end
this code is all messed up but the format is Newtons method.. I just cannot figure out how to use that Re loop i made with that function!
help!
The Attempt at a Solution
-Ethan G