Professional Documents
Culture Documents
Computer Project Hardy Cross Spring 2021
Computer Project Hardy Cross Spring 2021
Computer Project Hardy Cross Spring 2021
A pipe network consisting of one inlet, three outlets and four flow loops is shown in the diagram below.
The table below shows the friction factor, length, diameter and initial flow distribution of all pipe
sections. Your tasks are as follows:
Write a MatLab (Python, or other language) code to implement the Hardy Cross method in order
to find the correct distribution of flow rates in all the pipes and thus the correct direction of
flows along each pipe section in the network.
PIPE SECTION f L (m) D (mm) Initial guess, Qi (L/s)
A-B 0.0223 150 225 200 (from A à B)
B-E 0.0175 125 200 100 (from B à E)
E-I 0.0223 125 225 0
GENERAL GUIDELINES:
Your code should be commented (using the % sign) as much as possible, so it is clear what you have
done at each line in your code.
Make sure that your final solution satisfies mass conservation at each junction and the inlet/outlets.
You should make your code as efficient as possible, using a “while” loop instead of a “for” loop.
In the while loop, start by first calculating head loss in loop 1, then the flow rate correction based on
Hardy Cross, then apply to loop 2, calculate the flow rate correction, then apply to loop 3, etc. Make
sure your code updates the values of flow rate which are common to multiple loops.
Use threshold values of hL = 0.01 m and ΔQ* = 0.001 m3/s to determine convergence of your solution.
Record how many iterations it takes to converge?
Record how long it takes to run your code, using the commands “tic” and “toc”.
REPORT STRUCTURE / GRADING CRITERION:
• Projects will be graded out of 20 (10 pts for writing a code that finds the correct solution and 10
pts for your write-up and presentation).
• You must email your code to me (wei.li@ttu.edu, and zhenya.ding@ttu.edu) by 5pm, May 04.
Failure to do this will result in a 5 point deduction. Your code must run on my PC without me
having to modify your code or enter any information. If it does not, there will be a 5 point
deduction.
• Any hand-written work or poor English and grammar will result in a 5 point deduction.
• Problem statement (and diagram) with the initial guess, showing that it satisfies mass
conservation (perform a mass balance at each node). [1pt]
• Statement of the Hardy Cross method that you will implement in your code and the equations.
[2pt]
• Your MatLab (or other) code as an appendix, including time to run the code on your PC and the
total number of iterations. [2pt]
• Your final solution in tabular form, showing the flow rates in each pipe and the number of
iterations required for convergence. [2pt]
• A schematic of the final solution with arrows clearly indicating the direction of the flow in each
pipe. [2pt]