Package with utility functions
Extends from Modelica.Icons.FunctionsPackage (Icon for packages containing functions).
Name | Description |
---|---|
CubicInterpolation_DP | |
CubicInterpolation_MFLOW | |
LambertW | Closed approximation of Lambert's w function for solving f(x) = x exp(x) for x |
LambertWIter | Iterative form of Lambert's w function for solving f(x) = x exp(x) for x |
PrandtlNumber | calculation of Prandtl number |
ReynoldsNumber | calculation of Reynolds number |
SmoothPower | Limiting the derivative of function y = if x>=0 then x^pow else -(-x)^pow |
SmoothPower_der | The derivative of function SmoothPower |
Stepsmoother | Continuous interpolation for x |
Stepsmoother_der | Derivative of function Stepsmoother |
Extends from Modelica.Icons.Function (Icon for functions).
Name | Description |
---|---|
Re_turbulent | |
Re1 | [1] |
Re2 | [1] |
Delta | |
lambda2 |
Name | Description |
---|---|
Re | [1] |
Extends from Modelica.Icons.Function (Icon for functions).
Name | Description |
---|---|
Re | [1] |
Re1 | [1] |
Re2 | [1] |
Delta |
Name | Description |
---|---|
lambda2 |
Closed approximation of Lambert's w function for solving f(x) = x exp(x) for x
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.
For y > 10 and higher values the relative deviation is smaller 2%.
Extends from Modelica.Icons.Function (Icon for functions).
Name | Description |
---|---|
y | f(x) |
Name | Description |
---|---|
x | W(y) |
Iterative form of Lambert's w function for solving f(x) = x exp(x) for x
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).
Name | Description |
---|---|
y | f(x) |
Name | Description |
---|---|
x | W(y) |
iter |
calculation of Prandtl number
Extends from Modelica.Icons.Function (Icon for functions).
Name | Description |
---|---|
cp | specific heat capacity of fluid at constant pressure [J/(kg.K)] |
eta | dynamic viscosity of fluid [Pa.s] |
lambda | thermal conductivity of fluid [W/(m.K)] |
Name | Description |
---|---|
Pr | Prandtl number [1] |
calculation of Reynolds number
Extends from Modelica.Icons.Function (Icon for functions).
Name | Description |
---|---|
A_cross | Cross sectional area [m2] |
perimeter | Wetted perimeter [m] |
rho | Density of fluid [kg/m3] |
eta | Dynamic viscosity of fluid [Pa.s] |
m_flow | Mass flow rate [kg/s] |
Name | Description |
---|---|
Re | Reynolds number [1] |
velocity | Mean velocity [m/s] |
Limiting the derivative of function y = if x>=0 then x^pow else -(-x)^pow
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.
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.
Extends from Modelica.Icons.Function (Icon for functions).
Name | Description |
---|---|
x | input variable |
deltax | range for interpolation |
pow | exponent for x |
Name | Description |
---|---|
y | output variable |
The derivative of function SmoothPower
Extends from Modelica.Icons.Function (Icon for functions).
Name | Description |
---|---|
x | input variable |
deltax | range of interpolation |
pow | exponent for x |
dx | derivative of x |
Name | Description |
---|---|
dy | derivative of SmoothPower |
Continuous interpolation for x
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.
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 π
In the picture below the input x is increased from 0 to 1. The range of interpolation is defined by:
Extends from Modelica.Icons.Function (Icon for functions).
Name | Description |
---|---|
func | input value for that result = 100% |
nofunc | input value for that result = 0% |
x | input variable for continuous interpolation |
Name | Description |
---|---|
result | output value |
Derivative of function Stepsmoother
Extends from Modelica.Icons.Function (Icon for functions).
Name | Description |
---|---|
func | input for that result = 100% |
nofunc | input for that result = 0% |
x | input for interpolation |
dfunc | derivative of func |
dnofunc | derivative of nofunc |
dx | derivative of x |
Name | Description |
---|---|
dresult |