Compute pressure drop from constant loss factor and mass flow rate (dp = f(m_flow)). For small mass flow rates(|m_flow| < m_flow_small), the characteristic is approximated by a polynomial in order to have a finite derivative at zero mass flow rate.
function pressureLoss_m_flow_totalPressure extends Modelica.Icons.Function; input SI.MassFlowRate m_flow "Mass flow rate from port_a to port_b"; input SI.Density rho_a_des "Density at port_a, mass flow in design direction a -> b"; input SI.Density rho_b_des "Density at port_b, mass flow in design direction a -> b"; input SI.Density rho_b_nondes "Density at port_b, mass flow against design direction a <- b"; input SI.Density rho_a_nondes "Density at port_a, mass flow against design direction a <- b"; input LossFactorData data "Constant loss factors for both flow directions" annotation( choices(choice = Modelica.Fluid.Fittings.BaseClasses.QuadraticTurbulent.LossFactorData.wallFriction(), choice = Modelica.Fluid.Fittings.BaseClasses.QuadraticTurbulent.LossFactorData.suddenExpansion(), choice = Modelica.Fluid.Fittings.BaseClasses.QuadraticTurbulent.LossFactorData.sharpEdgedOrifice())); input SI.MassFlowRate m_flow_small = 0.01 "Turbulent flow if |m_flow| >= m_flow_small"; output SI.Pressure dp "Pressure drop (dp = port_a.p - port_b.p)"; end pressureLoss_m_flow_totalPressure;