WOLFRAM SYSTEM MODELER
This information is part of the Modelica Standard Library maintained by the Modelica Association.
This function is used to approximate the equation
state = if x > 0 then state_a else state_b;
by a smooth characteristic, so that the expression is continuous and differentiable:
state := smooth(1, if x > x_small then state_a else if x < -x_small then state_b else f(state_a, state_b));
This is performed by applying function Media.Common.smoothStep(..) on every element of the thermodynamic state record.
If mass fractions X[:] are approximated with this function then this can be performed for all nX mass fractions, instead of applying it for nX-1 mass fractions and computing the last one by the mass fraction constraint sum(X)=1. The reason is that the approximating function has the property that sum(state.X) = 1, provided sum(state_a.X) = sum(state_b.X) = 1. This can be shown by evaluating the approximating function in the abs(x) < x_small region (otherwise state.X is either state_a.X or state_b.X):
X = smoothStep(x, X_a , X_b , x_small); X = smoothStep(x, X_a , X_b , x_small); ... X[nX] = smoothStep(x, X_a[nX], X_b[nX], x_small);
X = c*(X_a - X_b) + (X_a + X_b)/2 X = c*(X_a - X_b) + (X_a + X_b)/2; ... X[nX] = c*(X_a[nX] - X_b[nX]) + (X_a[nX] + X_b[nX])/2; c = (x/x_small)*((x/x_small)^2 - 3)/4
Summing all mass fractions together results in
sum(X) = c*(sum(X_a) - sum(X_b)) + (sum(X_a) + sum(X_b))/2 = c*(1 - 1) + (1 + 1)/2 = 1
Description: Smooth thermodynamic state for all x (continuous and differentiable)
Return thermodynamic state so that it smoothly approximates: if x > 0 then state_a else state_b