functionpowerLaw_m_flow_inv

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

Information

Function that computes the mass flow rate for a given pressure difference as the inverse of Buildings.Fluid.BaseClasses.FlowModels.powerLaw_m_flow. Hence, powerLaw_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.powerLaw_m_flow. It differs from Buildings.Fluid.BaseClasses.FlowModels.powerLaw_dp in the laminar region because the two functions use different polynomials for the regularization. It takes the same arguments as powerLaw_m_flow, except that the first argument is the pressure difference. The coefficients are computed by the function Buildings.Fluid.BaseClasses.FlowModels.powerLawData.

Implementation

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

ṁ = k sign(Δp) |Δp|1/n,

which is the exact inverse of the turbulent branch of powerLaw_m_flow. Otherwise, the normalized pressure difference d = Δp ⁄ Δpt and the normalized mass flow rate x = ṁ ⁄ ṁt are related by the polynomial d = x (c1 + c3 x2 + c5 x4), with c1 = (n-3)(n-5)/8, c3 = (n-1)(5-n)/4 and c5 = (n-1)(n-3)/8. Its inverse is approximated by a rational function in d2 whose coefficients are quadratic polynomials in n-1. For n between 1 and 2, its relative error is below 3.4 ⋅ 10-2. Two steps of Halley's method on the polynomial reduce the relative error to below 4 ⋅ 10-15. The coefficients of the rational function are computed by Buildings/Resources/src/fluid/flowModels/fitInverseFlowFunctions.py.

An alternative without fitted coefficients is the rational function x = d (8 + 2 (7n - n2 - 4) d2) ⁄ ((n-3)(n-5) + (22n - 3n2 - 15) d2), which has the slope of the inverse at d=0 and its value and slope at d=1, as is used in Buildings.Fluid.BaseClasses.FlowModels.powerLaw_dp_inv. For n close to 2, it needs three Halley steps rather than two, which makes the function about 30% to 40% slower in the laminar region.

Inputs

TypeNameDefaultDescription
Modelica.Units.SI.PressureDifferencedpPressure difference
RealkFlow coefficient, k = m_flow/ dp^(1/n)
RealnFlow exponent, n=1 for laminar, n=2 for turbulent
Modelica.Units.SI.MassFlowRatem_flow_turbulentMass flow rate where transition to turbulent flow occurs
Modelica.Units.SI.PressureDifferencedp_turbulentPressure difference where turbulent flow occurs
RealmFlow exponent for the pressure drop
Reala1Polynomial coefficient for regularized implementation of flow resistance
Reala3Polynomial coefficient for regularized implementation of flow resistance
Reala5Polynomial coefficient for regularized implementation of flow resistance
RealCCoefficient 1/k^n, based on the definition k = m_flow / dp^(1/n)
Realb1Polynomial coefficient for regularized implementation of flow resistance
Realb3Polynomial coefficient for regularized implementation of flow resistance
Realb5Polynomial coefficient for regularized implementation of flow resistance

Outputs

TypeNameDefaultDescription
Modelica.Units.SI.MassFlowRatem_flowMass flow rate

Revisions

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