Buildings.Fluid.BaseClasses.FlowModels

Flow models for pressure drop calculations

Information

This package contains a basic flow model that is used by the various models that compute pressure drop.

Assumption and limitations

Because the density does not change signficantly in heating, ventilation and air conditioning systems for buildings, the flow models compute the pressure drop based on the mass flow rate and not the volume flow rate. This typically leads to simpler equations because it does not require the mass density, which changes when the flow is reversed. Although, for conceptual design of building energy system, there is in general not enough information available that would warrant a more detailed pressure drop calculation. If a more detailed computation of the flow resistance is needed, then a user can use models from the Modelica.Fluid library.

All functions have an argument m_flow_turbulent that determines where the flow transitions to fully turbulent flow. For smaller mass flow rates, the quadratic relation is replaced by a function that has finite slope near zero pressure drop. This is done for numerical reasons, and to approximate laminar flow, although the implementation does not use a linear function.

Implementation

The two main functions are Buildings.Fluid.BaseClasses.FlowModels.basicFlowFunction_dp and Buildings.Fluid.BaseClasses.FlowModels.basicFlowFunction_m_flow that compute the mass flow rate or the pressure drop, respectively. Both functions are two times continuously differentiable. First and second order derivatives are provided in the function that have the suffix _der and _der2.

Extends from Modelica.Icons.BasesPackage (Icon for packages containing base classes).

Package Content

Name Description
Buildings.Fluid.BaseClasses.FlowModels.basicFlowFunction_dp basicFlowFunction_dp Function that computes mass flow rate for given pressure drop
Buildings.Fluid.BaseClasses.FlowModels.basicFlowFunction_dp_der basicFlowFunction_dp_der 1st derivative of function that computes mass flow rate for given pressure drop
Buildings.Fluid.BaseClasses.FlowModels.basicFlowFunction_dp_der2 basicFlowFunction_dp_der2 2nd derivative of flow function2nd derivative of function that computes mass flow rate for given pressure drop
Buildings.Fluid.BaseClasses.FlowModels.basicFlowFunction_m_flow basicFlowFunction_m_flow Function that computes pressure drop for given mass flow rate
Buildings.Fluid.BaseClasses.FlowModels.basicFlowFunction_m_flow_der basicFlowFunction_m_flow_der 1st derivative of function that computes pressure drop for given mass flow rate
Buildings.Fluid.BaseClasses.FlowModels.basicFlowFunction_m_flow_der2 basicFlowFunction_m_flow_der2 2nd derivative of function that computes pressure drop for given mass flow rate
Buildings.Fluid.BaseClasses.FlowModels.Validation Validation Collection of validation models

Buildings.Fluid.BaseClasses.FlowModels.basicFlowFunction_dp Buildings.Fluid.BaseClasses.FlowModels.basicFlowFunction_dp

Function that computes mass flow rate for given pressure drop

Information

Function that computes the pressure drop of flow elements as

m = sign(Δp) k √ Δp  

with regularization near the origin. Therefore, the flow coefficient is

k = m ⁄ √ Δp  

The input m_flow_turbulent determines the location of the regularization.

Inputs

TypeNameDefaultDescription
PressureDifferencedp Pressure difference between port_a and port_b (= port_a.p - port_b.p) [Pa]
Realk Flow coefficient, k=m_flow/sqrt(dp), with unit=(kg.m)^(1/2)
MassFlowRatem_flow_turbulent Mass flow rate where transition to turbulent flow occurs [kg/s]

Outputs

TypeNameDescription
MassFlowRatem_flowMass flow rate in design flow direction [kg/s]

Modelica definition

function basicFlowFunction_dp "Function that computes mass flow rate for given pressure drop" annotation(derivative=Buildings.Fluid.BaseClasses.FlowModels.basicFlowFunction_dp_der); input Modelica.Units.SI.PressureDifference dp(displayUnit="Pa") "Pressure difference between port_a and port_b (= port_a.p - port_b.p)"; input Real k(min=0, unit="") "Flow coefficient, k=m_flow/sqrt(dp), with unit=(kg.m)^(1/2)"; input Modelica.Units.SI.MassFlowRate m_flow_turbulent(min=0) "Mass flow rate where transition to turbulent flow occurs"; output Modelica.Units.SI.MassFlowRate m_flow "Mass flow rate in design flow direction"; protected Modelica.Units.SI.PressureDifference dp_turbulent=(m_flow_turbulent/k)^2 "Pressure where flow changes to turbulent"; Real dpNorm=dp/dp_turbulent "Normalised pressure difference"; Real dpNormSq=dpNorm^2 "Square of normalised pressure difference"; algorithm m_flow := smooth(2, if noEvent(abs(dp)>dp_turbulent) then sign(dp)*k*sqrt(abs(dp)) else (1.40625 + (0.15625*dpNormSq - 0.5625)*dpNormSq)*m_flow_turbulent*dpNorm); end basicFlowFunction_dp;

Buildings.Fluid.BaseClasses.FlowModels.basicFlowFunction_dp_der Buildings.Fluid.BaseClasses.FlowModels.basicFlowFunction_dp_der

1st derivative of function that computes mass flow rate for given pressure drop

Information

Function that implements the first order derivative of Buildings.Fluid.BaseClasses.FlowModels.basicFlowFunction_dp with respect to the mass flow rate.

Extends from Modelica.Icons.Function (Icon for functions).

Inputs

TypeNameDefaultDescription
PressureDifferencedp Pressure difference between port_a and port_b (= port_a.p - port_b.p) [Pa]
Realk Flow coefficient, k=m_flow/sqrt(dp), with unit=(kg.m)^(1/2)
MassFlowRatem_flow_turbulent Mass flow rate where transition to turbulent flow occurs [kg/s]
Realdp_der Derivative of pressure difference between port_a and port_b (= port_a.p - port_b.p)

Outputs

TypeNameDescription
Realm_flow_derDerivative of mass flow rate in design flow direction [kg/s2]

Modelica definition

function basicFlowFunction_dp_der "1st derivative of function that computes mass flow rate for given pressure drop" annotation(derivative=Buildings.Fluid.BaseClasses.FlowModels.basicFlowFunction_dp_der2); extends Modelica.Icons.Function; input Modelica.Units.SI.PressureDifference dp(displayUnit="Pa") "Pressure difference between port_a and port_b (= port_a.p - port_b.p)"; input Real k(min=0, unit="") "Flow coefficient, k=m_flow/sqrt(dp), with unit=(kg.m)^(1/2)"; input Modelica.Units.SI.MassFlowRate m_flow_turbulent(min=0) "Mass flow rate where transition to turbulent flow occurs"; input Real dp_der "Derivative of pressure difference between port_a and port_b (= port_a.p - port_b.p)"; output Real m_flow_der(unit="kg/s2") "Derivative of mass flow rate in design flow direction"; protected Modelica.Units.SI.PressureDifference dp_turbulent=(m_flow_turbulent/k)^2 "Pressure where flow changes to turbulent"; Real dpNormSq=(dp/dp_turbulent)^2 "Square of normalised pressure difference"; algorithm m_flow_der := (if noEvent(abs(dp)>dp_turbulent) then 0.5*k/sqrt(abs(dp)) else (1.40625 + (0.78125*dpNormSq - 1.6875)*dpNormSq)*m_flow_turbulent/dp_turbulent)*dp_der; end basicFlowFunction_dp_der;

Buildings.Fluid.BaseClasses.FlowModels.basicFlowFunction_dp_der2 Buildings.Fluid.BaseClasses.FlowModels.basicFlowFunction_dp_der2

2nd derivative of flow function2nd derivative of function that computes mass flow rate for given pressure drop

Information

Function that implements the second order derivative of Buildings.Fluid.BaseClasses.FlowModels.basicFlowFunction_dp with respect to the mass flow rate.

Extends from Modelica.Icons.Function (Icon for functions).

Inputs

TypeNameDefaultDescription
PressureDifferencedp Pressure difference between port_a and port_b (= port_a.p - port_b.p) [Pa]
Realk Flow coefficient, k=m_flow/sqrt(dp), with unit=(kg.m)^(1/2)
MassFlowRatem_flow_turbulent Mass flow rate where transition to turbulent flow occurs [kg/s]
Realdp_der 1st derivative of pressure difference between port_a and port_b (= port_a.p - port_b.p)
Realdp_der2 2nd derivative of pressure difference between port_a and port_b (= port_a.p - port_b.p)

Outputs

TypeNameDescription
Realm_flow_der22nd derivative of mass flow rate in design flow direction

Modelica definition

function basicFlowFunction_dp_der2 "2nd derivative of flow function2nd derivative of function that computes mass flow rate for given pressure drop" extends Modelica.Icons.Function; input Modelica.Units.SI.PressureDifference dp(displayUnit="Pa") "Pressure difference between port_a and port_b (= port_a.p - port_b.p)"; input Real k(min=0, unit="") "Flow coefficient, k=m_flow/sqrt(dp), with unit=(kg.m)^(1/2)"; input Modelica.Units.SI.MassFlowRate m_flow_turbulent(min=0) "Mass flow rate where transition to turbulent flow occurs"; input Real dp_der "1st derivative of pressure difference between port_a and port_b (= port_a.p - port_b.p)"; input Real dp_der2 "2nd derivative of pressure difference between port_a and port_b (= port_a.p - port_b.p)"; output Real m_flow_der2 "2nd derivative of mass flow rate in design flow direction"; protected Modelica.Units.SI.PressureDifference dp_turbulent=(m_flow_turbulent/k)^2 "Pressure where flow changes to turbulent"; Real dpNorm=dp/dp_turbulent "Normalised pressure difference"; Real dpNormSq=dpNorm^2 "Square of normalised pressure difference"; algorithm m_flow_der2 := if noEvent(abs(dp)>dp_turbulent) then 0.5*k/sqrt(abs(dp))*(-0.5/dp * dp_der^2 + dp_der2) else m_flow_turbulent/dp_turbulent*( (1.40625 + (0.78125*dpNormSq - 1.6875)*dpNormSq)*dp_der2 + (-3.375 + 3.125*dpNormSq)*dpNorm/dp_turbulent*dp_der^2); end basicFlowFunction_dp_der2;

Buildings.Fluid.BaseClasses.FlowModels.basicFlowFunction_m_flow Buildings.Fluid.BaseClasses.FlowModels.basicFlowFunction_m_flow

Function that computes pressure drop for given mass flow rate

Information

Function that computes the pressure drop of flow elements as

Δp = sign(m) (m ⁄ k)2

with regularization near the origin. Therefore, the flow coefficient is

k = m ⁄ √ Δp  

The input m_flow_turbulent determines the location of the regularization.

Inputs

TypeNameDefaultDescription
MassFlowRatem_flow Mass flow rate in design flow direction [kg/s]
Realk Flow coefficient, k=m_flow/sqrt(dp), with unit=(kg.m)^(1/2)
MassFlowRatem_flow_turbulent Mass flow rate where transition to turbulent flow occurs [kg/s]

Outputs

TypeNameDescription
PressureDifferencedpPressure difference between port_a and port_b (= port_a.p - port_b.p) [Pa]

Modelica definition

function basicFlowFunction_m_flow "Function that computes pressure drop for given mass flow rate" annotation(derivative=Buildings.Fluid.BaseClasses.FlowModels.basicFlowFunction_m_flow_der); input Modelica.Units.SI.MassFlowRate m_flow "Mass flow rate in design flow direction"; input Real k(unit="") "Flow coefficient, k=m_flow/sqrt(dp), with unit=(kg.m)^(1/2)"; input Modelica.Units.SI.MassFlowRate m_flow_turbulent(min=0) "Mass flow rate where transition to turbulent flow occurs"; output Modelica.Units.SI.PressureDifference dp(displayUnit="Pa") "Pressure difference between port_a and port_b (= port_a.p - port_b.p)"; protected Modelica.Units.SI.PressureDifference dp_turbulent=(m_flow_turbulent/k)^2 "Pressure where flow changes to turbulent"; Real m_flowNorm = m_flow/m_flow_turbulent "Normalised mass flow rate"; Real m_flowNormSq = m_flowNorm^2 "Square of normalised mass flow rate"; algorithm dp := smooth(2, if noEvent(abs(m_flow)>m_flow_turbulent) then sign(m_flow)*(m_flow/k)^2 else (0.375 + (0.75-0.125*m_flowNormSq)*m_flowNormSq)*dp_turbulent*m_flowNorm); end basicFlowFunction_m_flow;

Buildings.Fluid.BaseClasses.FlowModels.basicFlowFunction_m_flow_der Buildings.Fluid.BaseClasses.FlowModels.basicFlowFunction_m_flow_der

1st derivative of function that computes pressure drop for given mass flow rate

Information

Function that implements the first order derivative of Buildings.Fluid.BaseClasses.FlowModels.basicFlowFunction_m_flow with respect to the mass flow rate.

Extends from Modelica.Icons.Function (Icon for functions).

Inputs

TypeNameDefaultDescription
MassFlowRatem_flow Mass flow rate in design flow direction [kg/s]
Realk Flow coefficient, k=m_flow/sqrt(dp), with unit=(kg.m)^(1/2)
MassFlowRatem_flow_turbulent Mass flow rate where transition to turbulent flow occurs [kg/s]
Realm_flow_der Derivative of mass flow rate in design flow direction [kg/s2]

Outputs

TypeNameDescription
Realdp_derDerivative of pressure difference between port_a and port_b (= port_a.p - port_b.p)

Modelica definition

function basicFlowFunction_m_flow_der "1st derivative of function that computes pressure drop for given mass flow rate" annotation(derivative=Buildings.Fluid.BaseClasses.FlowModels.basicFlowFunction_m_flow_der2); extends Modelica.Icons.Function; input Modelica.Units.SI.MassFlowRate m_flow "Mass flow rate in design flow direction"; input Real k(unit="") "Flow coefficient, k=m_flow/sqrt(dp), with unit=(kg.m)^(1/2)"; input Modelica.Units.SI.MassFlowRate m_flow_turbulent(min=0) "Mass flow rate where transition to turbulent flow occurs"; input Real m_flow_der(unit="kg/s2") "Derivative of mass flow rate in design flow direction"; output Real dp_der "Derivative of pressure difference between port_a and port_b (= port_a.p - port_b.p)"; protected Modelica.Units.SI.PressureDifference dp_turbulent=(m_flow_turbulent/k)^2 "Pressure where flow changes to turbulent"; Real m_flowNormSq = (m_flow/m_flow_turbulent)^2 "Square of normalised mass flow rate"; algorithm dp_der :=(if noEvent(abs(m_flow)>m_flow_turbulent) then sign(m_flow)*2*m_flow/k^2 else (0.375 + (2.25 - 0.625*m_flowNormSq)*m_flowNormSq)*dp_turbulent/m_flow_turbulent)*m_flow_der; end basicFlowFunction_m_flow_der;

Buildings.Fluid.BaseClasses.FlowModels.basicFlowFunction_m_flow_der2 Buildings.Fluid.BaseClasses.FlowModels.basicFlowFunction_m_flow_der2

2nd derivative of function that computes pressure drop for given mass flow rate

Information

Function that implements the second order derivative of Buildings.Fluid.BaseClasses.FlowModels.basicFlowFunction_m_flow with respect to the mass flow rate.

Extends from Modelica.Icons.Function (Icon for functions).

Inputs

TypeNameDefaultDescription
MassFlowRatem_flow Mass flow rate in design flow direction [kg/s]
Realk Flow coefficient, k=m_flow/sqrt(dp), with unit=(kg.m)^(1/2)
MassFlowRatem_flow_turbulent Mass flow rate where transition to turbulent flow occurs [kg/s]
Realm_flow_der 1st derivative of mass flow rate in design flow direction [kg/s2]
Realm_flow_der2 2nd derivative of mass flow rate in design flow direction [kg/s3]

Outputs

TypeNameDescription
Realdp_der22nd derivative of pressure difference between port_a and port_b (= port_a.p - port_b.p)

Modelica definition

function basicFlowFunction_m_flow_der2 "2nd derivative of function that computes pressure drop for given mass flow rate" extends Modelica.Icons.Function; input Modelica.Units.SI.MassFlowRate m_flow "Mass flow rate in design flow direction"; input Real k(unit="") "Flow coefficient, k=m_flow/sqrt(dp), with unit=(kg.m)^(1/2)"; input Modelica.Units.SI.MassFlowRate m_flow_turbulent(min=0) "Mass flow rate where transition to turbulent flow occurs"; input Real m_flow_der(unit="kg/s2") "1st derivative of mass flow rate in design flow direction"; input Real m_flow_der2(unit="kg/s3") "2nd derivative of mass flow rate in design flow direction"; output Real dp_der2 "2nd derivative of pressure difference between port_a and port_b (= port_a.p - port_b.p)"; protected Modelica.Units.SI.PressureDifference dp_turbulent=(m_flow_turbulent/k)^2 "Pressure where flow changes to turbulent"; Real m_flowNorm = m_flow/m_flow_turbulent "Normalised mass flow rate"; Real m_flowNormSq = m_flowNorm^2 "Square of normalised mass flow rate"; algorithm dp_der2 :=if noEvent(abs(m_flow)>m_flow_turbulent) then sign(m_flow)*2/k^2 * (m_flow_der^2 + m_flow * m_flow_der2) else dp_turbulent/m_flow_turbulent*( (0.375 + (2.25 - 0.625*m_flowNormSq)*m_flowNormSq)*m_flow_der2 + (4.5 - 2.5*m_flowNormSq)*m_flowNorm/m_flow_turbulent*m_flow_der^2); end basicFlowFunction_m_flow_der2;