modelExactInverses
Extends from Modelica.Icons.Example (Icon for runnable examples).
Information
This model checks that the functions
Buildings.Fluid.BaseClasses.FlowModels.basicFlowFunction_m_flow_inv,
Buildings.Fluid.BaseClasses.FlowModels.basicFlowFunction_dp_inv,
Buildings.Fluid.BaseClasses.FlowModels.powerLaw_m_flow_inv and
Buildings.Fluid.BaseClasses.FlowModels.powerLaw_dp_inv
are the inverses of the respective flow functions.
The pressure difference and the mass flow rate sweep through the laminar
and the turbulent region.
Applying a flow function to the result of its inverse function needs to give
the input back up to rounding errors.
If the relative error exceeds tol,
the simulation stops with an error.
The power law functions are checked for the flow exponents
n=1, 1.25, 1.5 and 2.
Parameters
| Type | Name | Default | Description |
|---|---|---|---|
| Real | k | 0.5 | Flow coefficient |
| Real[4] | n | {1, 1.25, 1.5, 2} | Flow exponent, n=1 for laminar, n=2 for turbulent |
| Modelica.Units.SI.MassFlowRate | m_flow_turbulent | 0.3 | Mass flow rate where transition to turbulent flow occurs |
| Real | tol | 1E-10 | Tolerance for the relative error of forward function after inverse function |
Components
| Type | Name | Default | Description |
|---|---|---|---|
| Modelica.Units.SI.PressureDifference | dp | Pressure difference | |
| Modelica.Units.SI.MassFlowRate | m_flow | Mass flow rate | |
| Modelica.Units.SI.MassFlowRate | m_flowBas | Mass flow rate computed by basicFlowFunction_m_flow_inv for dp | |
| Modelica.Units.SI.PressureDifference | dpBas | Pressure difference computed by basicFlowFunction_dp_inv for m_flow | |
| Modelica.Units.SI.MassFlowRate[4] | m_flowPow | Mass flow rate computed by powerLaw_m_flow_inv for dp | |
| Modelica.Units.SI.PressureDifference[4] | dpPow | Pressure difference computed by powerLaw_dp_inv for m_flow | |
| Real[2] | errBas | Relative errors of basicFlowFunction_m_flow and basicFlowFunction_dp after their inverses | |
| Real[4,2] | errPow | Relative errors of powerLaw_m_flow and powerLaw_dp after their inverses |
Revisions
-
October 22, 2026, by Martin Sjölund:
First implementation.
This is for Buildings, #4798.