Displaying 1 result from an estimated 1 matches for "laminar".
2010 Sep 15
2
Programming: loop versus vector oriented
...hortened 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 {
lambda <- 0.309/(log10(Re/7))^2
}
} else {
# Intermediate area
lambdanew <- 1 / (2 * log10(3.71 * dk[...