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_DP CubicInterpolation_DP  
Modelica.Fluid.Dissipation.Utilities.Functions.General.CubicInterpolation_MFLOW CubicInterpolation_MFLOW  
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_DP Modelica.Fluid.Dissipation.Utilities.Functions.General.CubicInterpolation_DP

Information

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

Inputs

NameDescription
Re_turbulent 
Re1[1]
Re2[1]
Delta 
lambda2 

Outputs

NameDescription
Re[1]

Modelica.Fluid.Dissipation.Utilities.Functions.General.CubicInterpolation_MFLOW Modelica.Fluid.Dissipation.Utilities.Functions.General.CubicInterpolation_MFLOW

Information

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

Inputs

NameDescription
Re[1]
Re1[1]
Re2[1]
Delta 

Outputs

NameDescription
lambda2 

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
yf(x)

Outputs

NameDescription
xW(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
yf(x)

Outputs

NameDescription
xW(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 Dec 19 17:20:12 2019.