modelExactInverses

Model that checks that the inverse functions are exact inverses of the flow functions

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

TypeNameDefaultDescription
Realk0.5Flow coefficient
Real[4]n{1, 1.25, 1.5, 2}Flow exponent, n=1 for laminar, n=2 for turbulent
Modelica.Units.SI.MassFlowRatem_flow_turbulent0.3Mass flow rate where transition to turbulent flow occurs
Realtol1E-10Tolerance for the relative error of forward function after inverse function

Components

TypeNameDefaultDescription
Modelica.Units.SI.PressureDifferencedpPressure difference
Modelica.Units.SI.MassFlowRatem_flowMass flow rate
Modelica.Units.SI.MassFlowRatem_flowBasMass flow rate computed by basicFlowFunction_m_flow_inv for dp
Modelica.Units.SI.PressureDifferencedpBasPressure difference computed by basicFlowFunction_dp_inv for m_flow
Modelica.Units.SI.MassFlowRate[4]m_flowPowMass flow rate computed by powerLaw_m_flow_inv for dp
Modelica.Units.SI.PressureDifference[4]dpPowPressure difference computed by powerLaw_dp_inv for m_flow
Real[2]errBasRelative errors of basicFlowFunction_m_flow and basicFlowFunction_dp after their inverses
Real[4,2]errPowRelative 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.