Answered step by step
Verified Expert Solution
Question
1 Approved Answer
In Lab 4, you created a subroutine to calculate the pressure drop in pipes using the Darcy-Weisbach equation. There is a better approximation for the
In Lab 4, you created a subroutine to calculate the pressure drop in pipes using the Darcy-Weisbach equation. There is a better approximation for the Friction factor (fp) in turbulent flow (Re > 3000) of smooth pipes then the one I provided. The improved equation is: = 1.930 log(Re: VfD) - 0.537 Note that this equation is implicit, i.e. you cannot solve for fp directly. Fortunately this equation will converge to the correct answer if you start with an initial value of fp and keep recalculating a new value of fp until the difference is very small. I.e. do the following: 1. guess an initial value for fp (fp = 1 will generally work) 2. calculate the right hand side of the equation above using that value 3. solve for a *new* value of fp on the left hand side 4. Use the new value of fo in step 2 5. Repeat steps 2-4 until the difference between the new value of fp and the previous value is very small. Write a VBA function to calculate the value of fp given a value of Re. Iterate until the difference between the last 2 fp calculations is less than 1x10-6. Use your function on the worksheet to display the values off for RE from 500 to 10,000 (the chart should display your results automatically). WARNING! VBA does not have a Log base 10 function (Excel has LOG10(), but VBA does not!). LOG() in VBA is the natural log function (not LN()). However converting is easy, just use the identity: Log10 (2) = (10) Hints: a starting guess of fp = 1 should always work Don't attempt to calculate values of fp for very low values of Re, it will not converge (i.e. infinite loop) In Lab 4, you created a subroutine to calculate the pressure drop in pipes using the Darcy-Weisbach equation. There is a better approximation for the Friction factor (fp) in turbulent flow (Re > 3000) of smooth pipes then the one I provided. The improved equation is: = 1.930 log(Re: VfD) - 0.537 Note that this equation is implicit, i.e. you cannot solve for fp directly. Fortunately this equation will converge to the correct answer if you start with an initial value of fp and keep recalculating a new value of fp until the difference is very small. I.e. do the following: 1. guess an initial value for fp (fp = 1 will generally work) 2. calculate the right hand side of the equation above using that value 3. solve for a *new* value of fp on the left hand side 4. Use the new value of fo in step 2 5. Repeat steps 2-4 until the difference between the new value of fp and the previous value is very small. Write a VBA function to calculate the value of fp given a value of Re. Iterate until the difference between the last 2 fp calculations is less than 1x10-6. Use your function on the worksheet to display the values off for RE from 500 to 10,000 (the chart should display your results automatically). WARNING! VBA does not have a Log base 10 function (Excel has LOG10(), but VBA does not!). LOG() in VBA is the natural log function (not LN()). However converting is easy, just use the identity: Log10 (2) = (10) Hints: a starting guess of fp = 1 should always work Don't attempt to calculate values of fp for very low values of Re, it will not converge (i.e. infinite loop)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started