Displaying 1 result from an estimated 1 matches for "lambdanew".
2010 Sep 15
2
Programming: loop versus vector oriented
...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[z]))^2 # Start value
iter <- 0
repeat {
lambda <- lambdanew
lambdanew <- 1 / (2 * log10(2.51/(Re * sqrt(lambda)) + 0.27/dk[z]))^2
iter <- iter + 1
if ((abs(lambdanew - lambda) < 0.001) || (iter > 100)) break
}
la...