This function solves the Darcy-Weisbach friction loss equation for with water in circular pipes. the function solves for either head loss (hf), flow rate (Q), diameter (D),or roughness height, (ks) whichever is missing (not included as an argument).

## Usage

darcyweisbach(
Q = NULL,
D = NULL,
hf = NULL,
L = NULL,
ks = NULL,
nu = NULL,
units = c("SI", "Eng"),
ret_units = FALSE
)

## Arguments

Q

numeric vector that contains the flow rate [$$m^3 s^{-1}$$ or $$ft^3 s^{-1}$$]

D

numeric vector that contains the pipe diameter [$$m$$ or $$ft$$]

hf

numeric vector that contains the head loss through the pipe section [$$m$$ or $$ft$$]

L

numeric vector that contains the pipe length [$$m$$ or $$ft$$],

ks

numeric vector that contains the equivalent sand roughness height. Units should be consistent with other input [$$m$$ or $$ft$$]

nu

numeric vector that contains the kinematic viscosity of water, [$$m^2 s^{-1}$$ or $$ft^2 s^{-1}$$].

units

character vector that contains the system of units [options are SI for International System of Units and Eng for English (US customary) units. This is used for compatibility with iemisc package

ret_units

If set to TRUE the value(s) returned are of class units with units attached to the value. [Default is FALSE]

## Value

Returns a list including the missing parameter (hf, Q, D, or ks):

• Q - flow rate.

• V - flow velocity.

• L - pipe length.

• hf - head loss due to friction

• f - Darcy-Weisbach friction factor

• ks - roughness height

• Re - Reynolds number

## Details

The Darcy-Weisbach equation was developed to estimate the head loss, $$h_f$$, due to friction over a length of pipe. For circular pipes it is expressed as: $$h_f = \frac{fL}{D}\frac{V^2}{2g} = \frac{8fL}{\pi^{2}gD^{5}}Q^{2}$$ where $$f$$ is the friction factor (calculated with the colebrook function and $$g$$ is the gravitational acceleration ($$9.81\frac{m}{s^2}$$ or $$32.2\frac{ft}{s^2}$$).

colebrook for friction factor calculation

## Examples


#Type 2 (solving for flow rate, Q): SI Units
D <- .5
L <- 10
hf <- 0.006*L
T <- 20
ks <- 0.000046
darcyweisbach(D = D, hf = hf, L = L, ks = ks, nu = kvisc(T=T, units='SI'), units = c('SI'))
#> Q missing: solving a Type 2 problem
#> $Q #> [1] 0.4059048 #> #>$V
#> [1] 2.067256
#>
#> $L #> [1] 10 #> #>$D
#> [1] 0.5
#>
#> $hf #> [1] 0.06 #> #>$f
#> [1] 0.01330553
#>
#> $ks #> [1] 4.6e-05 #> #>$Re
#> [1] 1010337
#>

#Type 3 (solving for diameter, D): Eng (US) units
Q <- 37.5     #flow in ft^3/s
L <- 8000     #pipe length in ft
hf <- 215     #head loss due to friction, in ft
T <- 68       #water temperature, F
ks <- 0.0008  #pipe roughness, ft
darcyweisbach(Q = Q, hf = hf, L = L, ks = ks, nu = kvisc(T=T, units='Eng'), units = c('Eng'))
#> D missing: solving a Type 3 problem
#> $Q #> [1] 37.5 #> #>$V
#> [1] 13.964
#>
#> $L #> [1] 8000 #> #>$D
#> [1] 1.849123
#>
#> $hf #> [1] 215 #> #>$f
#> [1] 0.01642589
#>
#> $ks #> [1] 8e-04 #> #>$Re
#> [1] 2336974
#>