Fluid Mechanics Using Matlab

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.

SOLUTION : –

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.

Solution:

  • 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.

Solution:

  • 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.

Solution:

  • 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.

Solution:

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.

Technique Why Limitation

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.

Solution:

  • 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?)

Solution:

  • 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).

Solution:

  • 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.

Solution:

  • 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 https://www.epa.gov/water-research/epanet.

Solution:

  • 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?

Solution:

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