#' Flow Calculation
#' @description Pressure Drop in Pipe with Losses (Determine flow)
#' @param pipe_length length of pipe (m)
#' @param dn inner diameter of pipe (m)
#' @param roughness internal roughness of the pipe in (m)
#' @param zeta loss coefficient
#' @param dp pressure diff.
#' @param temp temperature in °C
#' @importFrom stats uniroot
#'
#' @return flow in m3/s
#' @export
#'
flow_calculation <- function(pipe_length, dn, roughness, zeta, dp, temp = 15.6){
root <- uniroot( function(x){ darcy_weisbach(x, pipe_length, dn, roughness, temp) +
minor_losses(x, dn, zeta) - dp } ,
lower = 0.0001,
upper = 10,
tol = 1e-10)
return(root$root)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.