Package with utility functions
Extends from Modelica.Icons.FunctionsPackage (Icon for packages containing functions).
Name | Description |
---|---|
CubicInterpolation_Re | Cubic Hermite spline interpolation of the Reynolds number in transition regime of the Moody diagram (inverse formulation) |
CubicInterpolation_lambda | Cubic Hermite spline interpolation of the modified friction coefficient in transition regime of the Moody diagram (direct formulation) |
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 |
Cubic Hermite spline interpolation of the Reynolds number in transition regime of the Moody diagram (inverse formulation)
Re = CubicInterpolation_Re(0, Re1, Re2, Delta, lambda2);
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).
Name | Description |
---|---|
Re_turbulent | Unused input |
Re1 | Boundary Reynolds number for laminar regime [1] |
Re2 | Boundary Reynolds number for turbulent regime [1] |
Delta | Relative roughness |
lambda2 | Modified friction coefficient (= independent variable) |
Name | Description |
---|---|
Re | Interpolated Reynolds number in transition region [1] |
Cubic Hermite spline interpolation of the modified friction coefficient in transition regime of the Moody diagram (direct formulation)
lambda2 = CubicInterpolation_lambda(Re, Re1, Re2, Delta);
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).
Name | Description |
---|---|
Re | Reynolds number (= independent variable) [1] |
Re1 | Boundary Reynolds number for laminar regime [1] |
Re2 | Boundary Reynolds number for turbulent regime [1] |
Delta | Relative roughness |
Name | Description |
---|---|
lambda2 | Interpolated modified friction coefficient in transition regime |
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 | Input f(x) |
Name | Description |
---|---|
x | Output 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 | Input f(x) |
Name | Description |
---|---|
x | Output 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 |