functionpowerLaw_m_flow_inv
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
| Type | Name | Default | Description |
|---|---|---|---|
| Modelica.Units.SI.PressureDifference | dp | Pressure difference | |
| Real | k | Flow coefficient, k = m_flow/ dp^(1/n) | |
| Real | n | Flow exponent, n=1 for laminar, n=2 for turbulent | |
| Modelica.Units.SI.MassFlowRate | m_flow_turbulent | Mass flow rate where transition to turbulent flow occurs | |
| Modelica.Units.SI.PressureDifference | dp_turbulent | Pressure difference where turbulent flow occurs | |
| Real | m | Flow exponent for the pressure drop | |
| Real | a1 | Polynomial coefficient for regularized implementation of flow resistance | |
| Real | a3 | Polynomial coefficient for regularized implementation of flow resistance | |
| Real | a5 | Polynomial coefficient for regularized implementation of flow resistance | |
| Real | C | Coefficient 1/k^n, based on the definition k = m_flow / dp^(1/n) | |
| Real | b1 | Polynomial coefficient for regularized implementation of flow resistance | |
| Real | b3 | Polynomial coefficient for regularized implementation of flow resistance | |
| Real | b5 | Polynomial coefficient for regularized implementation of flow resistance |
Outputs
| Type | Name | Default | Description |
|---|---|---|---|
| Modelica.Units.SI.MassFlowRate | m_flow | Mass flow rate |
Revisions
-
October 22, 2026, by Martin Sjölund:
First implementation.
This is for Buildings, #4798.