packageDarcyFriction
Extends from Modelica.Icons.UtilitiesPackage (Icon for utility packages).
Information
Friction Term
First, the functions for defining the friction force in the waterway are described. The friction force Ff is directed in the opposite direction of the velocity v (the linear velocity average across the cross-section of the pipe) of the fluid. A common expression for friction force in the filled pipes is the following:
$$ F_\mathrm{f} = -\frac{1}{8}\pi\rho LDf_\mathrm{D}v|v| $$
Here, L and D are related to the pipe length and diameter, respectively. fD is a Darcy friction factor that is a function of Reynolds number NRe, with the roughness ratio ε/D as a parameter.
Figure: Darcy friction factor as a function of the Reynolds number.
Flow Regimes
The turbulent region (NRe > 2.3×10³) is a flow regime where the velocity across the pipe has a stochastic nature, and where the velocity v is relatively uniform across the pipe when we average the velocity over some short period of time. The laminar region (NRe < 2.1×10³) is a flow regime with a regular velocity v which varies as a parabola with the radius of the pipe, with zero velocity at the pipe wall and maximal velocity at the centre of the pipe.
Laminar Flow
Darcy friction factor varies with the roughness of the pipe surface, specified by roughness height ε. For laminar flow in a cylindrical pipe (NRe < 2.1×10³), the Darcy friction factor fD can be found using the following expression:
$$ f_\mathrm{D} = \frac{64}{N_\mathrm{Re}} $$
Here, the Reynolds number is found as follows: \(N_\mathrm{Re}=\frac{\rho|v|D}{\mu}\), where μ is the fluid viscosity.
Turbulent Flow
For turbulent flow (NRe > 2.3×10³), the Darcy friction factor is expressed as:
$$ f_\mathrm{D} = \frac{1}{\left(2\log_{10}\left(\frac{\epsilon}{3.7D} + \frac{5.74}{N_\mathrm{Re}^{0.9}}\right)\right)^2} $$
Transition Zone
In order to define the Darcy friction factor in a region between laminar and turbulent flow regimes, a cubic polynomial interpolation is used between the laminar value at NRe=2100 and the turbulent value at NRe=2300, with matching slopes at both endpoints to achieve global differentiability.
Implementation
Based on the presented equations for calculation of the friction force in the waterway, two functions are
encoded in class DarcyFriction:
fDarcy— calculates the Darcy friction factor. This function has the following inputs: Reynolds number NRe, pipe diameter D, and pipe roughness height ε. Returns the friction factor fD.Friction— calculates the actual friction force based on the response from thefDarcyfunction. This function has the following inputs: linear velocity v, pipe length and diameter L and D, liquid density and viscosity ρ and μ, and pipe roughness height ε. Returns friction force Ff.
Example Code
An example of a Modelica code for defining the Friction function:
function Friction "Friction force with Darcy friction factor" import Modelica.Constants.pi; input Modelica.SIunits.Velocity v "Flow velocity"; input Modelica.SIunits.Diameter D "Pipe diameter"; input Modelica.SIunits.Length L "Pipe length"; input Modelica.SIunits.Density rho "Density"; input Modelica.SIunits.DynamicViscosity mu "Dynamic viscosity of water"; input Modelica.SIunits.Height eps "Pipe roughness height"; output Modelica.SIunits.Force F_f "Friction force"; protected Modelica.SIunits.ReynoldsNumber N_Re "Reynolds number"; Real f "friction factor"; algorithm N_Re:= rho * abs(v) * D / mu; f := fDarcy(N_Re, D, eps); F_f := 0.5 * pi * f * rho * L * v * abs(v) * D / 4; end Friction;
Contents
| Name | Description |
|---|---|
| Friction force with Darcy friction factor | |
| Darcy friction factor |