functionbasicFlowFunction_m_flow_inv

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

Information

Function that computes the mass flow rate for a given pressure drop as the inverse of Buildings.Fluid.BaseClasses.FlowModels.basicFlowFunction_m_flow. Hence, basicFlowFunction_m_flow evaluated at the mass flow rate computed by this function is equal to dp up to rounding errors.

This function is the inverse of Buildings.Fluid.BaseClasses.FlowModels.basicFlowFunction_m_flow. It differs from Buildings.Fluid.BaseClasses.FlowModels.basicFlowFunction_dp for |Δp| < Δpt, where Δpt = (ṁt ⁄ k)2, because the two functions use different polynomials for the regularization.

Implementation

For |Δp| > Δpt, the function is

ṁ = sign(Δp) k √ |Δp|  ,

which is the exact inverse of the turbulent branch of basicFlowFunction_m_flow. Otherwise, the normalised pressure difference d = Δp ⁄ Δpt and the normalised mass flow rate x = ṁ ⁄ ṁt are related by the polynomial d = x (0.375 + 0.75 x2 - 0.125 x4). Its inverse is approximated by a rational function in d2 whose relative error is below 1.4 ⋅ 10-4, 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.PressureDifferencedpPressure difference between port_a and port_b (= port_a.p - port_b.p)
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.MassFlowRatem_flowMass flow rate in design flow direction

Revisions

  • October 22, 2026, by Martin Sjölund:
    First implementation.
    This is for Buildings, #4798.