ChemEng stuff followers

Showing posts with label Google sheets. Show all posts
Showing posts with label Google sheets. Show all posts

Monday, June 5, 2023

Solving the Colebrook equation

 Finding the friction factor $f_F$ can be big trouble for some students with poor numerical methods background while some other will try to go around by using the diagram of Moody. There is nothing wrong with the Moody diagram but you cannot automate any calculations with that. Besides, we are in the XXI century!

First, the friction factor $f_F$ in the Colebrook equation cannot be isolated because this is a trascendental equation. Since $f_F$ appears in the argument of the function and in other terms only numerical solutions are possible. There are several approximations to the Colebrook equation, like that due to Swamee-Jain (shown below),

$f_F=\dfrac{0.25}{\left[ \log_{10}\left( \dfrac{\epsilon}{3.7D} + \dfrac{5.74}{N_{Re}^{0.9}} \right) \right]^2}$        Eq. (1)

which give $f_F$ explicitly. However, these approximations are valid for a range of parameters only. It is not easy to take care of these restrictions all the time.


As the Colebrook equation has a more general scope and very practical tools are already available, its numerical solutions should not be painful anymore. This equation is,

$\dfrac{1}{\sqrt{f_F}}=-2\log_{10}\left( \dfrac{\epsilon}{3.72D}+\dfrac{2.51}{N_{Re}\sqrt{f_F}} \right)$        Eq. (2)

where $\epsilon$ is the pipe roughness, $D$ is the pipe inside diameter, and $N_{Re}$ is the Reynolds number.


Data for some common pipe roughness $\epsilon$

Pipe material Roughness $\epsilon$ (m) Roughness $\epsilon$ (ft)
Glass Smooth Smooth
Plastic $3.0 \times 10^{-7}$ $9.8 \times 10^{-7}$
Drawn tubing; copper, brass, steel $1.5 \times 10^{-6}$ $4.9 \times 10^{-6}$
Steel, commercial or welded $4.6 \times 10^{-5}$ $1.5 \times 10^{-4}$
Galvanized iron $1.5 \times 10^{-4}$ $5.0 \times 10^{-4}$
Ductile iron - coated $1.2 \times 10^{-4}$ $4.0 \times 10^{-}$
Ductile iron - uncoated $2.4 \times 10^{-4}$ $8.0 \times 10^{-4}$
Concrete, well made $1.2 \times 10^{-4}$ $4.0 \times 10^{-4}$
Riveted steel $1.8 \times 10^{-4}$ $6.0 \times 10^{-3}$


Numerical estimation of $f_F$

First, you will need to fixed all parameters $N_{Re}$, $\epsilon$, $D$ but $f_F$ (just in case). All parameters must be in the same unit system!

The friction factor $f_F$ can be iteratively approached by rewritting Eq. (2) as follows,

$f_F=\dfrac{0.25}{\log_{10}\left( \dfrac{\epsilon}{3.72D}+\dfrac{2.51}{N_{Re}\sqrt{f_F}} \right)^2}$        Eq. (3)

The iterative process is as follows. In iteration #1, substitute a guess for $f_F$ on the right hand side of Eq. (3) as shown,

$f_F^{New}=\dfrac{0.25}{\log_{10}\left( \dfrac{\epsilon}{3.72D}+\dfrac{2.51}{N_{Re}\sqrt{f_F^{Guess}}} \right)^2}$        Eq. (4)

and check for the error on satisfying this equation with,

$\left|\dfrac{f_F^{Guess}-f_F^{New}}{f_F^{Guess}}\right| \times 100$        Eq. (5)

For iteration #2, use $f_F^{New}$, from iteration #1, as the $f_F^{Guess}$. Check again for the % error, which should have decreased. Continue the iterations until a reasonable 0.1% error has been achieved.

Estimating $f_F$ with Google Sheets


As you may think, this iterative procedure is a perfect candidate for implementation in Google Sheets. Follow the link below to access a sheet automated to estimate the friction factor:


Any question? Write in the comments and I shall try to help.

=========
Ildebrando.

Saturday, May 27, 2023

Numerical methods in Google Sheets (for engineering)

 There are several options to implement a numerical method as part of the solution to a problem in practical engineering. Many would say that packages like Mathematica or Maple are the best options while some others would vote for Matlab, for example. A few others would say that there exist free options like Octave too. That is true.


However, most of those packages will have troubles in some issues. For example:

  • Resources. These may require too much resources from your computer. If you use an old laptop and already have other programs to run at the same that Matlab, for example, you will find that the computer slows down.
  • Training. Mathematica and Maple are programs easy to use and learn, if you want, while Matlab would require a little bigger effort. Not everyone have the time to learn, as quickly as possible, how to use one of these programs.
  • Broad usage. Mathematica, Maple, Matlab, and Octave would be powerful tools but one would not use it to perform a set of simple unit conversions! Ok, you may use those programs but that is not what you normally do. Why? There exist simpler options for this task (like Google sheets or Excel).
  • Sharebillity. If you made some calculations (not too complicated) you would want to shear your results and programs with other people. However, if they are not users of Mathematica, Maple, Matlab or Octave and if they do not have the very same software in their computers they will be unable to see or review your calculations. This is, perhaps, the largest issue to face.

For simple engineering calculations involving numerical methods, statistics, plotting, etc. Google Sheets is a very good option. Anyone familiar with Microsoft Excel would almost instantaneously know how to use Google Sheets. 

It has to be said that Google Sheets may not have all the commands or functions available in Excel. However, too many people have a Gmail account wich gives you instant access to Google Sheets without the need of installing anything or paying licenses. Al you need is internet!


On the other hand, all your calculations will be in the cloud, so that you do not have to worry about carrying your files in a USB or accidents with your personal computer.

Any question? Write in the comments and I shall try to help.

=========
Ildebrando

Most popular posts