functionbasicFlowFunction_dp_inv
Information
Function that computes the pressure drop for a given mass flow rate
as the inverse of
Buildings.Fluid.BaseClasses.FlowModels.basicFlowFunction_dp.
Hence, basicFlowFunction_dp evaluated at the pressure difference
computed by this function is equal to m_flow up to rounding errors.
This function is the inverse of
Buildings.Fluid.BaseClasses.FlowModels.basicFlowFunction_dp.
It differs from
Buildings.Fluid.BaseClasses.FlowModels.basicFlowFunction_m_flow
for |ṁ| < ṁt
because the two functions use different polynomials for the regularization.
Implementation
For |ṁ| > ṁt, the function is
Δp = sign(ṁ) (ṁ ⁄ k)2,
which is the exact inverse of the turbulent branch of
basicFlowFunction_dp.
Otherwise, the normalised mass flow rate
x = ṁ ⁄ ṁt
and the normalised pressure difference
d = Δp ⁄ Δpt, where
Δpt = (ṁt ⁄ k)2,
are related by the polynomial
x = d (1.40625 - 0.5625 d2 + 0.15625 d4).
Its inverse is approximated by a rational function in x2
whose relative error is below 10-5,
followed by one step of Halley's method on the polynomial.
This gives a relative error of the order of the machine precision.
For k between 10-12 and 1012
and ṁt between 10-14 and
108 kg/s, the largest relative error
compared to the exact inverse is below 10-14.
The coefficients of the rational function are computed by
Buildings/Resources/src/fluid/flowModels/fitInverseFlowFunctions.py.
Inputs
| Type | Name | Default | Description |
|---|---|---|---|
| Modelica.Units.SI.MassFlowRate | m_flow | Mass flow rate in design flow direction | |
| Real | k | Flow coefficient, k=m_flow/sqrt(dp), with unit=(kg.m)^(1/2) | |
| Modelica.Units.SI.MassFlowRate | m_flow_turbulent | Mass flow rate where transition to turbulent flow occurs |
Outputs
| Type | Name | Default | Description |
|---|---|---|---|
| Modelica.Units.SI.PressureDifference | dp | Pressure difference between port_a and port_b (= port_a.p - port_b.p) |
Revisions
-
October 22, 2026, by Martin Sjölund:
First implementation.
This is for Buildings, #4798.