modelPowerLaw_m_flow_inv_DerivativeCheck2

Model that checks the correct implementation of the 1st and 2nd order derivative of the inverse of the power law function

Extends from Modelica.Icons.Example (Icon for runnable examples).

Information

This model validates the implementation of Buildings.Fluid.BaseClasses.FlowModels.powerLaw_m_flow_inv and its first and second order derivatives Buildings.Fluid.BaseClasses.FlowModels.powerLaw_m_flow_inv_der and Buildings.Fluid.BaseClasses.FlowModels.powerLaw_m_flow_inv_der2. If the derivative implementation is wrong, the simulation will stop with an error.

Implementation

The pressure difference dp is increased non-linearly in order for the first and second derivatives in Buildings.Fluid.BaseClasses.FlowModels.powerLaw_m_flow_inv_der2 to be non-zero during part of the simulation. The input sweeps through the laminar and the turbulent region.

Parameters

TypeNameDefaultDescription
Realk0.5Flow coefficient, k = m_flow/ dp^(1/n)
Realn1.5Flow exponent, n=1 for laminar, n=2 for turbulent
Modelica.Units.SI.MassFlowRatem_flow_turbulent0.1Mass flow rate where transition to turbulent flow occurs

Components

TypeNameDefaultDescription
Modelica.Units.SI.MassFlowRatem_flowMass flow rate
Modelica.Units.SI.MassFlowRatem_flow_compComparison value for m_flow
Realder_m_flow1st order derivative of mass flow rate
Realder_m_flow_comp1st order derivative of comparison value for m_flow
Modelica.Units.SI.PressureDifferencedpPressure difference
Modelica.Units.SI.MassFlowRateerr_m_flowIntegration error for m_flow
Realerr_der_m_flowIntegration error for der_m_flow

Revisions

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