Package Modelica.​Fluid.​Dissipation.​Utilities.​Functions.​General
Package with utility functions

Information

Standard package icon.

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

Package Contents

NameDescription
CubicInterpolation_DP 
CubicInterpolation_MFLOW 
LambertWClosed approximation of Lambert's w function for solving f(x) = x exp(x) for x
LambertWIterIterative form of Lambert's w function for solving f(x) = x exp(x) for x
PrandtlNumbercalculation of Prandtl number
ReynoldsNumbercalculation of Reynolds number
SmoothPowerLimiting the derivative of function y = if x>=0 then x^pow else -(-x)^pow
SmoothPower_derThe derivative of function SmoothPower
StepsmootherContinuous interpolation for x
Stepsmoother_derDerivative of function Stepsmoother

Function Modelica.​Fluid.​Dissipation.​Utilities.​Functions.​General.​CubicInterpolation_DP
Icon for functions

Information

This icon indicates Modelica functions.

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

Inputs

TypeNameDescription
RealRe_turbulent 
ReynoldsNumberRe1 
ReynoldsNumberRe2 
RealDelta 
Reallambda2 

Outputs

TypeNameDescription
ReynoldsNumberRe 

Function Modelica.​Fluid.​Dissipation.​Utilities.​Functions.​General.​CubicInterpolation_MFLOW
Icon for functions

Information

This icon indicates Modelica functions.

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

Inputs

TypeNameDescription
ReynoldsNumberRe 
ReynoldsNumberRe1 
ReynoldsNumberRe2 
RealDelta 

Outputs

TypeNameDescription
Reallambda2 

Function 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

TypeNameDescription
Realyf(x)

Outputs

TypeNameDescription
RealxW(y)

Function 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

TypeNameDescription
Realyf(x)

Outputs

TypeNameDescription
RealxW(y)
Integeriter 

Function Modelica.​Fluid.​Dissipation.​Utilities.​Functions.​General.​PrandtlNumber
calculation of Prandtl number

Information

This icon indicates Modelica functions.

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

Inputs

TypeNameDescription
SpecificHeatCapacityAtConstantPressurecpspecific heat capacity of fluid at constant pressure
DynamicViscosityetadynamic viscosity of fluid
ThermalConductivitylambdathermal conductivity of fluid

Outputs

TypeNameDescription
PrandtlNumberPrPrandtl number

Function Modelica.​Fluid.​Dissipation.​Utilities.​Functions.​General.​ReynoldsNumber
calculation of Reynolds number

Information

This icon indicates Modelica functions.

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

Inputs

TypeNameDescription
AreaA_crossCross sectional area
LengthperimeterWetted perimeter
DensityrhoDensity of fluid
DynamicViscosityetaDynamic viscosity of fluid
MassFlowRatem_flowMass flow rate

Outputs

TypeNameDescription
ReynoldsNumberReReynolds number
VelocityvelocityMean velocity

Function 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

TypeNameDescription
Realxinput variable
Realdeltaxrange for interpolation
Realpowexponent for x

Outputs

TypeNameDescription
Realyoutput variable

Function Modelica.​Fluid.​Dissipation.​Utilities.​Functions.​General.​SmoothPower_der
The derivative of function SmoothPower

Information

This icon indicates Modelica functions.

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

Inputs

TypeNameDescription
Realxinput variable
Realdeltaxrange of interpolation
Realpowexponent for x
Realdxderivative of x

Outputs

TypeNameDescription
Realdyderivative of SmoothPower

Function 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

TypeNameDescription
Realfuncinput value for that result = 100%
Realnofuncinput value for that result = 0%
Realxinput variable for continuous interpolation

Outputs

TypeNameDescription
Realresultoutput value

Function Modelica.​Fluid.​Dissipation.​Utilities.​Functions.​General.​Stepsmoother_der
Derivative of function Stepsmoother

Information

This icon indicates Modelica functions.

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

Inputs

TypeNameDescription
Realfuncinput for that result = 100%
Realnofuncinput for that result = 0%
Realxinput for interpolation
Realdfuncderivative of func
Realdnofuncderivative of nofunc
Realdxderivative of x

Outputs

TypeNameDescription
Realdresult