Question: please use matlab to edit the code (fill the blanks '???') to get the questions % Fixed point iteration of pipe system clear; clc f=0.005;

please use matlab to edit the code (fill the blanks '???') to get the questions

% Fixed point iteration of pipe system

clear; clc

f=0.005; % Friction factor

rho=1.23; % Density (kg/m^3)

D=0.01; % Pipe diameter (m)

% Pressure drop through pipe with length L and flow rate Q

dP =@(L,Q) 16/pi^2*f*L*rho/(2*D^5)*Q.^2;

dPdQ=@(L,Q) ??? ; %d(deltaP)/dQ

% Input parameters

Q1=1; % m^3/s

L2=2; % m

L3=1; % m

L4=2; % m

L5=4; % m

L6=1; % m

tol=1e-5; % Convergence tolerance

% Inital pressure drop and flow rate guesses

Q2=0.6; % m^3/s - assumes equal split at each intersection

Q3=Q1-Q2;

Q5=0.05;

Q4=Q3-Q5;

Q6=Q3;

figure(1); clf(1)

% Iterate

alpha=0.1;

N=2000;

Qs=zeros(N,5);

for n=1:N

% Store old values

Q2o=Q2; Q3o=Q3; Q4o=Q4; Q5o=Q5; Q6o=Q6;

% Update

Q2=Q2o+alpha*(Q1 -Q2o-Q3o);

Q3=???;

Q4=Q4o-alpha*(dP(L2,Q2o)-dP(L3,Q3o)-dP(L4,Q4o)-dP(L6,Q6o)) ...

/(-dPdQ(L4,Q4o));

Q5=???;

Q6=???;

% Display output

fprintf('Iter=%2i Q2=%5.3f Q3=%5.3f Q4=%5.3f Q5=%5.3f Q6=%5.3 ', ...

n,Q2,Q3,Q4,Q5,Q6)

% Plot flow rates versus iteration

Qs(n,:)=[Q2,Q3,Q4,Q5,Q6];

if mod(n,10)==1

plot(1:n,Qs(1:n,:))

legend('Q2','Q3','Q4','Q5','Q6')

drawnow

end

% Check if converged

if max([abs(Q2-Q2o),abs(Q3-Q3o),abs(Q4-Q4o),abs(Q5-Q5o)])

disp('Converged')

break % Stop for loop

end

end

please use matlab to edit the code (fill the blanks '???') to

Problem 4: System of Equations (5 points) Esch of these can be updated using A Euid is pamped into a etwork of pipes as shown in the figure below for i-2, . , ., 6. Note that the constant -0.1 has been added to these update equations. Qs Using this theory, complete the MATLAB code posted on D2L, Submit your completed code to D2L and a written docunent that provides (a) the coaverged flowrates (Q's) (b) acheck that these Bowrates satisy equations 1-5 (e) a comment on what the convergence criteria is and why this is reasonable or not (d)a conners on what o is doing to the update equations. (Check what happens if -0.01 or 1 .) Q4 Q6 Due to the principle that Bow-in mast equal low-out the following relations exist where Qi indicates the flow rate through the ith pipe segment Additionally, the pressure drop between any two nodes must be the same no matter which path the uid takes. Therefore, considering nodes 1-3 and 2-4 leads to the relations AP-AP The pressure drop is related to the Bow rate with where f-0.005 is the friction cofficient, L' istbe length of the ita ppe, -1.23 kg/m3, and D-0.01 m. The length of the pipes Rre La-14-2m,Ls-Le-1m' and Ls-4m. For provided input flow rate of Qa-1 ms/s, this is sort of 5 equations that can be solved for the 5 unknows Qa Qa, Q Qs, Qs Use the Newtoo-Raphson method to solve tbe system of non-linear equatioos, Here we will use a simplifed verslon where we assume all varisbles except one is a constant in each equation per iteration. For example, the five equations can be written in tho &ren f (Q1-0, ie. (10) where the variable in parenthesis is the only one that is assumed to not be a constant for that iteration

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!