Fluid mechanics, Bernoulli’s approach, Hardy Cross & Monte Carlo methods

In this Matlab sample solution, the expert has demonstrated his capabilities to solve problems on topic fluid mechanics. Solution has been provided using Matlab. The given problem showcases an application of concepts like Bernoulli approach, minimum pressure in vena contracta, Cavitation, Hardy cross method, and Monte Carlo method etc.

Fluid mechanics.

Before we  go ahead and define what fluid mechanics is, let’s understand what a fluid is. A Fluid as you probably know, means a liquid. But in physics, it has a different meaning. It is defined as any substance that  changesits shape when some external forces are applied to it. They include liquids and gases.  Fluids are said to have shear modulus, which is a physical term that implies zero resistance to any force applied to it. Fluids and solids areall states  of matter. Therefore fluids are substances that can flow and do not resistany change to its  shape.

Fluid mechanics

Fluid mechanics is a branch of physics that focuses onfluids , i.e., liquid, air, and plasma.

This branch of physics has lots of applications in many disciplines, which is not restricted only to  real-life scenarios. The engineers  arealso  interested in fluid mechanics because  they can use the forces used in fluids for other meaningful purposes. Meteorologists also study fluid mechanics as it can help them in forecasting the weather patterns of a place. Let’s not forget that physicists study fluid mechanics to discover the movement of particles through magnetic fields, which  help them in search of an acceptable means of harnessing energy for nuclear fusions.

Fluid mechanics has  lots of applications that make it an important topic in most engineering fields. Here we will show you some of the practical applications of fluid mechanics.

Branches of fluid mechanics.

Fluid mechanics is further subdivided into two branches which are:-

Fluid Statics -Fluid statics involves studying fluids which are at rest. It carries out a study of  fluids that are in an equilibrium state. Fluid statistics has  specific applications in real life. It can be used to explain the real-life phenomena such as the changes in atmospheric pressure with changes in altitude or why a block of wood floats in water while a stone cannot. It also finds its way in astrophysics , geophysics, and meteorology.

Fluid dynamics- Fluid dynamics is in contrast to  fluid statistics. It studies the fluids in motion. The various  empirical laws have been developed to tackle the different fluid movement problems. Sometimes, determining  the properties of a fluid such as viscosity and density could be the solutions.  Fluid dynamics can be subdivided further into aerodynamics and hydrodynamics—the latter deals with the movement of liquids while the former with movement of gases. Fluid dynamics has  a wide ranging  applications, which include traffic engineering, predicting weather patterns, and aircraft movements.

History of fluid mechanics in a nutshell

The origin of fluid mechanics can not be traced specifically to any point of  time. But it is said to be used in the  ancient civilizations that flourished in Egypt and Babylon. The Egyptians used hydraulic pressure to water their fields, which were situated close to the river beds.  As civilizations developed ,scientists like  Archimedes contributed to it by coming up with the Archimedes principle. Other great scientists, such as Blaise Pascal and Isaac Newton, contributed to the formulation of current laws that we study today.

Fluid mechanic’s common terms, and governing laws.

If you are studying fluid mechanics, there are some of the terms and governing laws that you will encounter  from time to time. They form the basis of this topic. Some of  these terms include: –

Viscosity. This is a term which implies  the resistance of a fluid to deformation.   It could also be defined as the inability of fluid to refuse to flow. A fluid with high viscosity is said to be very dense which  could  achieve the shape of a solid. High viscosity always happens in low temperatures. A fluid with low viscosity is known as an ideal fluid.

Surface tension.It is a phenomenon that is commonly seen on the surface of liquids. Mostly, these surfaces shrink together to occupy a minimum surface area. In water, this surface allows for other insets to float on water. Surface tension can be explained in terms of cohesive forces. In a liquid, all the molecules are attracted to each other by cohesive forces. But the issue is different at  the surface as all the molecules do not have other  molecules to hold them at the top. As a result, they shrink inwards.

According to this explanation, we can say that  surface tension also affects  the shape of droplets.

Archimedes principle. Archimedes principle is named after an ancient Greek named Archimedes who discovered it. It states that a body that is submerged in water is rested upon by an equal force even if it’s fully or partially submerged.  It’s also  known as the law of buoyancy , and one of its common applications is in ships. A ship floats on the sea once its weight is equal to the one it displaces in water.

Pascal’s law. This is a law about the transmission of pressure in a fluid. It states that in a confined and incompressible fluid, a pressure change on one side will lead to an equal transmission of the fluid  on another part of the confined area. This law is very important and has its applications in real life.

Bernoulli’s principle. This is a  law that was proposed by Daniel Bernoulli in 1738. It states that as the flow of the liquid increases, the pressure in the liquid decreases.

 Applications of fluid mechanics.

The real-life applications of the topic are numerous. Some of its uses are  listedas follows: –

Hydroelectric power. Here,  fluid mechanics is applied to determine the power capabilities  of a certain area.

Housing. Fluid mechanics is responsible for the distribution of water in  citiesand towns. It can be used to calculate the amount of water that is needed in these cities. We can even know their monthly water consumption.

Biology. In biology, we can apply fluid mechanics to know the rate at which  blood flows in the veins.

Pumps. Pumps are devices that are made for fluid movements. No matter what pump you are using, they apply the fluid mechanics laws, such as Bernoulli’s principle  and  Pascal’s law.

Wind power


Fluid mechanics using Matlab.

Matlab is one of the finest mathematical computing software that exits in the world.  It was built to help engineers and scientists in their research assignments.   Matlab was developed during the internet age in the 1980s, but its use has grown exponentially since  that time.  Today, most institutions have incorporated it into their curriculum, while most science and engineering practitioners prefer to use Matlab. It’s therefore, a widely accepted programing language.

For fluid mechanics, Matlab has the CFD toolbox, which is an app for all computational fluid dynamics problems. With it, you can model fluid dynamics, simulate it, and use it for predictions. In other cases, you could use the symbolic math toolbox for calculations involving  fluid mechanics.

Matlab assignment experts.

If you want help with fluid mechanics using Matlab, then you can contact us. We are  highly trained Matlab professionals with years of experience doing Matlab related assignments.  We have been serving our clients  for close to a decade and are  still providing them with consistent results.  We put the priorities of our  clients first and ensure that we meet the deadlines and help them secure  high grades.

You, too, can benefit from our top-notch services if you contact us. You won’t be disappointed with our services. Instead, you will join the cohort of numerous clients who are pleased with our services.


Task 1.1: Use Bernoulli and textbook approach to estimate minimum pressure in vena contra(i.e. location in a fluid flow where the diameter of the flow is the smallest). If needed, review section 6.9 in the textbook by White to learn more about the vena contra.Assume that at narrowest location effectively deffective /D ~ 0.23 due to vena contra.


  • Explain/sketch geometry.
  • Recall Bernoulli equation – see sketch below
  • With p1 given in assignment, estimate minimum pressure
  • assuming 20C water, what are cavitation numbers based on both upstream and vena contra pressures. – leave further discussion on if this might cavitate to task 1.3

Task 1.2: Evaluate CFD results provided to you. Determine the margin to the onset of cavitation. If you are choosing your own case of interest, you will need to perform computations with a CFD software that you have available.

For this task, plot contours of pressure and identify and label minima. Plot velocity vectors, streamlines and vorticity contours. Calculate mass flow rate in and out as a check.

Take great care to not blindly trust the results. CFD is an indispensable tool for modern engineers, but the case you are working on highlights the need for critical thinking and proper problem setup, and the sample data provided will be imperfect on purpose.


  • Start with either your own code or with sample code “SampleCapstone_part1_ForStudentsToComplete.m”
  • Plot
    • velocity vectors,
    • streamlines and
    • vorticity contours
    • Calculate mass flow rate in and out as a check.
  • assuming 20C water, what are cavitation numbers based on both upstream and vena contra pressures. – leave further discussion on if this might cavitate to task 1.3

For example, here is a streamline plot. Your plots should be formatted to be easier to read with proper labels, etc. Note for example that in this plot axis labels are too small to even read.

Task 1.3:Consider limitations of both theory and numerical model used. Also, reviewing literature, explore the effect of fluid temperature and nuclei contents to point where incipient cavitation may be expected to occur. Discuss how such cavitation could be detected, qualitatively observed, quantified and what impact it may have in pipeline performance overall.

Explain what assumptions may be faulty and what physical phenomena are or are not accounted for that may lead to differences in the results of inviscid theory, CFD vs. experiment.


  • Discuss/list how both Bernoulli and the time-averaged axisymmetric CFD were idealizations and may have been limited
  • Based on cavitation numbers from tasks 1.1 and 1.2, do you think cavitation might occur?
  • How does this conclusion match with data from Testud et al. (2007)?

Task 1.4:What measurement techniques discussed in the course could you use to observe the flow in this case, and succinctly discuss what would limit their suitability for case in question.


List or make a table of suitable techniques and why they are useful, and up to what point. At least 5 should be easy to recall and discuss. See slides&notes from days 3&4 to recall techniques discussed.


Part 2

Set Q at all outlets, sum of them must equal our single inlet.

Calc pump power assuming lowest pressure node at 300kPa absolute, (note all dp in solution are relative and since we treat fluid as incompressible absoluter pressure within HC solution can be adjusted afterwards if needed – pressure differences are still what the solution yield), reservoir at 100kPa (1 atm absolute).

Task 2.1: Write your own code using Hardy-Cross method to calculate pressure distribution in the sample pipe network. (Contact SSA for sample Hardy-Cross – at which time SSA will want to schedule a virtual meeting with you to discuss through the example. Also, another similar sample will be discussed by Gabriel.) Use the Haaland explicit approximation to compute you the friction factor – just like we did in class!(Make code flexible and see steps below to enable evaluation of temperature etc. effects.) Compute the power required to pump water through the \textbf{ideal} network at given flow rates.


  • Setup Hardy-Cross solution for pipe network – start either from sample code SSA will provide and discuss with you, or from example Gabriel will discuss
  • Use equations covered in class to estimate pumping power
  • Optional: assume something for pump efficiency and discuss succinctly

Task 2.2: Use your code and Monte-Carlo method for propagating uncertainty (section \ref{section:MC}) and consider i) uncertainty in pipe roughness (see table in handout), ii) uncertainty in pipe length, ii) uncertainty in temperature and iv) uncertainty in pipe diameter. To estimate uncertainty in roughness, use data from White table 6.5. (Consider, for example, if water temperature goes from 5C to 30C, what effect will this have?)


  • Modify code to loop over HC calculation and run MC for at least 100,000 cases – more if histogram looks ‘rough’. Plot histogram of needed pumping power – just like we did during Day 5 for White example 6.16

Task 2.3:  Within each pipe, calculate viscous length scale (SSA will provide example upon request), wall shear stress and estimate if a superhydrophobic coating with damage threshold of 50 Pa of shear and manufacturable with rms roughness from 5 to 200 microns might result in drag reduction in each pipe segment (Requires having roughness below ~5 viscous length scales. For simplicity: assume that there would be a way to avoid entrainment of gas from the surface into the flow and a way to supply gas to the surface at pipeline pressure. – not necessarily achievable presently).


  • For each pipe, knowing diameter and average flow rate, calculate viscous length scale
  • How smooth is the pipe compared to the viscous length scale (epsilon over length scale, if<5 smooth, if >70 fully rough and in between transitional – see White’s book)?
  • Calculate shear in each pipe (average at the wall)
  • Discuss if SHS may survive given damage threshold

Bonus task 2.1: add cost of components and energy to try to improve your pipe network. Explain the cost basis you selected and your results.


  • Assume a cost for pipes with smoother and more durable (e.g. stainless) being higher price. Compare energy cost vs. initial cost for different options you chose.

Bonus task 2.2: Compare your code’s predictions to prediction from the free code, EPANET. EPANET can be downloaded from here.


  • Setup problem and run EPA net. Solution may look like something close to that below (Values WILL differ – sample below ran with different values than you will use.).
  • Compare node pressures and pipe flow rates to your MatLab solution from task 2.1

Bonus task 2.3: What would be the achievable reduction in pumping power requirements if the pipeline were to be one standard size larger, have smoother surfaces owing to initial material selection or maintenance, or if fittings causing minor losses would have been chosen such that they have the lowest available minor loss coefficient presently available for a commercial product?


  • Run simulation with larger pipes, etc.
  • Discuss results.