Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Where: Re Reynolds number; Re = 5150 V D V flow velocity D pipe diameter Write a

ID: 2998345 • Letter: W

Question

Where:

Re        Reynolds number; Re = 5150 V D

V          flow velocity

D          pipe diameter

Write a MATLAB program that calculates the friction factor for the following conditions:

        Velocity (ft/sec):      1.6        2.0        7.5        5.4        8.5        10.0      20.0

        Pipe diameter (ft):    0.1        0.2        0.5        0.8        1.0        4.0          5.0

Store the data in a text file pipe.txt. (Only values are stored in the file). The program does the following:

The friction factor f is a parameter used to study fluid flow in pipes. It is given by: Where: Re Reynolds number; Re = 5150 V D V flow velocity D pipe diameter Write a MATLAB program that calculates the friction factor for the following conditions: Velocity (ft/sec): 1.6 2.0 7.5 5.4 8.5 10.0 20.0 Pipe diameter (ft): 0.1 0.2 0.5 0.8 1.0 4.0 5.0 Store the data in a text file. (Only values are stored in the file). The program does the following: Reads the data from the file and store them in two arrays. Calculates the Reynolds number. Calculates the friction factor f . Prints an output in tabular form; sample output with fictitious values is shown.

Explanation / Answer

clc
clear all

N = 21 ; % initialisation
Pi = 1 ;
dt = 0.05;
z=dt* (Pi)^2 ;
dX= 1/(N-1);
y = dt/((dX)^2) ;
d = (1+2*y+z)*ones(N,1);
a = -(y)*ones(N-1,1);
b = -(y)*ones(N-1,1);
x= ones(N,1);
n=0;
stopping_criteria=0;


r =ones(N,1) ; %initial conditio
d(1)= 1; % boundary condition
a(1)= 0; % boundary condition
b(N-1) =-1;
d(N)= 1;
r(N)=0 ;
  
  
while stopping_criteria==0 ,

Mean.Square.difference = 0 ;
xn = x;   
[x] = Tri_diagonal(d,a,b,N,r);

for k=1:1:N
  
m = ((x(k)-xn(k))^2)/(N-1) ;
Mean.Square.difference = Mean.Square.difference+m;

end
Rms.difference = sqrt(Mean.Square.difference) ;
  
if ( Rms.difference)/dt<=10^-3
stopping_criteria=1;
else
stopping_criteria=0;
end

for i=1:1:N-1
r(i)=x(i) ;
  
end
n=n+1;
end

  


display(Rms.difference);
display(n);

base_temp_derivative = (x(2)-x(1))/dX;
display(base_temp_derivative);
display(x);

i=1:1:N;
plot ((i-1)/(N-1),x(i));
hold all

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote