R/darcy_weisbach.R

Defines functions darcy_weisbach

Documented in darcy_weisbach

#' @title Darcy Weisbach equation
#' @description In fluid dynamics, the Darcy–Weisbach equation is an empirical
#' equation, which relates the head loss, or pressure loss, due to friction
#' along a given length of pipe to the average velocity of the fluid flow
#' for an incompressible fluid.
#' The Darcy–Weisbach equation contains a dimensionless friction factor,
#' known as the Darcy friction factor. This is also variously called the
#' Darcy–Weisbach friction factor, friction factor, resistance coefficient,
#' or flow coefficient.
#' See more about the Darcy–Weisbach equation at the
#' [Darcy–Weisbach equation](https://en.wikipedia.org/wiki/Darcy%E2%80%93Weisbach_equation)
#' @author Dr. Raúl Trujillo Álvarez \email{dr.ing.trujillo@gmail.com}
#' @param flow cubic meter per second (m3/s)
#' @param pipe_length length of pipe  (m)
#' @param dn inner diameter of pipe  (m)
#' @param roughness internal roughness of the pipe in (m)
#' @param temp temperature in °C
#'
#' @return head loss (m)
#' @export
#'
#' @examples
#' darcy_weisbach( flow = 0.042,
#'                 pipe_length = 970,
#'                 dn = 0.150,
#'                 roughness = 1.5e-6,
#'                 temp = 14.5)
#'
darcy_weisbach <- function(flow, pipe_length, dn, roughness, temp = 20){

  friction <- friction_colebrook (flow, dn, roughness, temp)
  v <- velocity(flow, dn)
  darcy <- friction*(pipe_length/dn)*((v^2)/(2*9.807))
  return(darcy)
}
ratral/hyd4gpv documentation built on Feb. 5, 2022, 10:30 p.m.