search for: lambda_wall

Displaying 1 result from an estimated 1 matches for "lambda_wall".

2010 Sep 15
2
Programming: loop versus vector oriented
...but I can't figure out how to do that without looping through every element of it. Is there a more elegant way? Note: I have shortened it, so it is NOT correct from the pipe hydraulics point of view # Calculate wall friction factor # reynolds: Reynolds number # dk: relative roughness of pipe lambda_wall <- function (reynolds, dk) { z <- 1 result <- 0 for (Re in reynolds) { if (Re <= 2320) { # Laminar flow lambda <- 64/Re } else if (Re < 65 * dk[z]) { # Turbulent flow if (Re < 1e+5) { lambda <- 0.3164 / sqrt(sqrt(Re)) } else { l...