functionbasicFlowFunction_dp_inv

Inverse of basicFlowFunction_dp, which computes pressure drop for given mass flow rate

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

TypeNameDefaultDescription
Modelica.Units.SI.MassFlowRatem_flowMass flow rate in design flow direction
RealkFlow coefficient, k=m_flow/sqrt(dp), with unit=(kg.m)^(1/2)
Modelica.Units.SI.MassFlowRatem_flow_turbulentMass flow rate where transition to turbulent flow occurs

Outputs

TypeNameDefaultDescription
Modelica.Units.SI.PressureDifferencedpPressure 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.