Modelica.Fluid.Dissipation.Utilities.Functions.General

Package with utility functions

Information

Extends from Modelica.Icons.FunctionsPackage (Icon for packages containing functions).

Package Content

Name Description
Modelica.Fluid.Dissipation.Utilities.Functions.General.CubicInterpolation_Re CubicInterpolation_Re Cubic Hermite spline interpolation of the Reynolds number in transition regime of the Moody diagram (inverse formulation)
Modelica.Fluid.Dissipation.Utilities.Functions.General.CubicInterpolation_lambda CubicInterpolation_lambda Cubic Hermite spline interpolation of the modified friction coefficient in transition regime of the Moody diagram (direct formulation)
Modelica.Fluid.Dissipation.Utilities.Functions.General.LambertW LambertW Closed approximation of Lambert's w function for solving f(x) = x exp(x) for x
Modelica.Fluid.Dissipation.Utilities.Functions.General.LambertWIter LambertWIter Iterative form of Lambert's w function for solving f(x) = x exp(x) for x
Modelica.Fluid.Dissipation.Utilities.Functions.General.PrandtlNumber PrandtlNumber Calculation of Prandtl number
Modelica.Fluid.Dissipation.Utilities.Functions.General.ReynoldsNumber ReynoldsNumber Calculation of Reynolds number
Modelica.Fluid.Dissipation.Utilities.Functions.General.SmoothPower SmoothPower Limiting the derivative of function y = if x>=0 then x^pow else -(-x)^pow
Modelica.Fluid.Dissipation.Utilities.Functions.General.SmoothPower_der SmoothPower_der The derivative of function SmoothPower
Modelica.Fluid.Dissipation.Utilities.Functions.General.Stepsmoother Stepsmoother Continuous interpolation for x
Modelica.Fluid.Dissipation.Utilities.Functions.General.Stepsmoother_der Stepsmoother_der Derivative of function Stepsmoother

Modelica.Fluid.Dissipation.Utilities.Functions.General.CubicInterpolation_Re Modelica.Fluid.Dissipation.Utilities.Functions.General.CubicInterpolation_Re

Cubic Hermite spline interpolation of the Reynolds number in transition regime of the Moody diagram (inverse formulation)

Information

Syntax

Re = CubicInterpolation_Re(0, Re1, Re2, Delta, lambda2);

Description

Function CubicInterpolation_Re(..) approximates the Reynolds number Re in the transition regime between laminar and turbulent flow of the Moody diagram by an inverse formulation of a cubic Hermite spline interpolation. See Modelica.Fluid.UsersGuide.ComponentDefinition.WallFriction (especially Region 2) for a detailed explanation.

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

Inputs

NameDescription
Re_turbulentUnused input
Re1Boundary Reynolds number for laminar regime [1]
Re2Boundary Reynolds number for turbulent regime [1]
DeltaRelative roughness
lambda2Modified friction coefficient (= independent variable)

Outputs

NameDescription
ReInterpolated Reynolds number in transition region [1]

Modelica.Fluid.Dissipation.Utilities.Functions.General.CubicInterpolation_lambda Modelica.Fluid.Dissipation.Utilities.Functions.General.CubicInterpolation_lambda

Cubic Hermite spline interpolation of the modified friction coefficient in transition regime of the Moody diagram (direct formulation)

Information

Syntax

lambda2 = CubicInterpolation_lambda(Re, Re1, Re2, Delta);

Description

Function CubicInterpolation_lambda(..) approximates the modified friction coefficient lambda2=lambda*Re^2 in the transition regime between laminar and turbulent flow of the Moody diagram by a (direct) cubic Hermite spline interpolation. See Modelica.Fluid.UsersGuide.ComponentDefinition.WallFriction (especially Region 2) for a detailed explanation.

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

Inputs

NameDescription
ReReynolds number (= independent variable) [1]
Re1Boundary Reynolds number for laminar regime [1]
Re2Boundary Reynolds number for turbulent regime [1]
DeltaRelative roughness

Outputs

NameDescription
lambda2Interpolated modified friction coefficient in transition regime

Modelica.Fluid.Dissipation.Utilities.Functions.General.LambertW Modelica.Fluid.Dissipation.Utilities.Functions.General.LambertW

Closed approximation of Lambert's w function for solving f(x) = x exp(x) for x

Information

This function calculates an approximation of the inverse for

f(x) = y = x * exp( x )

within ∞ > y > -1/e. The relative deviation of this approximation for Lambert's w function x = W(y) is displayed in the following graph.

LambertW_deviation

For y > 10 and higher values the relative deviation is smaller 2%.

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

Inputs

NameDescription
yInput f(x)

Outputs

NameDescription
xOutput W(y)

Modelica.Fluid.Dissipation.Utilities.Functions.General.LambertWIter Modelica.Fluid.Dissipation.Utilities.Functions.General.LambertWIter

Iterative form of Lambert's w function for solving f(x) = x exp(x) for x

Information

This function calculates an approximation of the inverse for

f(x) = y = x * exp( x )

within ∞ > y > -1/e. Please note, that for negative inputs two solutions exists. The function currently delivers the result x = -1 ... 0 for that particular range.

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

Inputs

NameDescription
yInput f(x)

Outputs

NameDescription
xOutput W(y)
iter 

Modelica.Fluid.Dissipation.Utilities.Functions.General.PrandtlNumber Modelica.Fluid.Dissipation.Utilities.Functions.General.PrandtlNumber

Calculation of Prandtl number

Information

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

Inputs

NameDescription
cpSpecific heat capacity of fluid at constant pressure [J/(kg.K)]
etaDynamic viscosity of fluid [Pa.s]
lambdaThermal conductivity of fluid [W/(m.K)]

Outputs

NameDescription
PrPrandtl number [1]

Modelica.Fluid.Dissipation.Utilities.Functions.General.ReynoldsNumber Modelica.Fluid.Dissipation.Utilities.Functions.General.ReynoldsNumber

Calculation of Reynolds number

Information

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

Inputs

NameDescription
A_crossCross sectional area [m2]
perimeterWetted perimeter [m]
rhoDensity of fluid [kg/m3]
etaDynamic viscosity of fluid [Pa.s]
m_flowMass flow rate [kg/s]

Outputs

NameDescription
ReReynolds number [1]
velocityMean velocity [m/s]

Modelica.Fluid.Dissipation.Utilities.Functions.General.SmoothPower Modelica.Fluid.Dissipation.Utilities.Functions.General.SmoothPower

Limiting the derivative of function y = if x>=0 then x^pow else -(-x)^pow

Information

The function is used to limit the derivative of the following function at x=0:

y = if x ≥ 0 then xpow else -(-x)pow;  // pow > 0

by approximating the function in the range -deltax< x < deltax with a third order polynomial that has the same derivative at abs(x)=deltax, as the function above.

Example

In the picture below the input x is increased from -1 to 1. The range of interpolation is defined by the same range. Displayed is the output of the function SmoothPower compared to

y=x*|x|

For |x| > 1 both functions return identical results.

SmoothPower

References

ThermoFluid Library
http://sourceforge.net/projects/thermofluid/

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

Inputs

NameDescription
xInput variable
deltaxRange for interpolation
powExponent for x

Outputs

NameDescription
yOutput variable

Modelica.Fluid.Dissipation.Utilities.Functions.General.SmoothPower_der Modelica.Fluid.Dissipation.Utilities.Functions.General.SmoothPower_der

The derivative of function SmoothPower

Information

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

Inputs

NameDescription
xInput variable
deltaxRange of interpolation
powExponent for x
dxDerivative of x

Outputs

NameDescription
dyDerivative of SmoothPower

Modelica.Fluid.Dissipation.Utilities.Functions.General.Stepsmoother Modelica.Fluid.Dissipation.Utilities.Functions.General.Stepsmoother

Continuous interpolation for x

Information

The function is used for continuous fading of variable inputs within a defined range. It allows a differentiable and smooth transition between function outputs, e.g., laminar and turbulent pressure drop or correlations for certain ranges.

Function

The tanh-function is used, since it provides an existing derivative and the derivative is zero at the borders [nofunc, func] of the interpolation domain (smooth derivative for transitions).

In order to work correctly, the internal interpolation range in terms of the external arbitrary input x needs to be scaled such that:

f(func)   = 0.5 π
f(nofunc) = -0.5 π

Example

In the picture below the input x is increased from 0 to 1. The range of interpolation is defined by:

Stepsmoother

References

Wischhusen, St.
Simulation von Kältemaschinen-Prozessen mit MODELICA / DYMOLA. Diploma thesis, Hamburg University of Technology, Institute of Thermofluiddynamics, 2000.

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

Inputs

NameDescription
funcInput value for that result = 100%
nofuncInput value for that result = 0%
xInput variable for continuous interpolation

Outputs

NameDescription
resultOutput value

Modelica.Fluid.Dissipation.Utilities.Functions.General.Stepsmoother_der Modelica.Fluid.Dissipation.Utilities.Functions.General.Stepsmoother_der

Derivative of function Stepsmoother

Information

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

Inputs

NameDescription
funcInput for that result = 100%
nofuncInput for that result = 0%
xInput for interpolation
dfuncDerivative of func
dnofuncDerivative of nofunc
dxDerivative of x

Outputs

NameDescription
dresult 
Automatically generated Thu Oct 1 16:08:00 2020.