[ < ] | [ > ] | [Contents] | [Index] | [ ? ] |
Some models may originally be non continuous, as the ones using a Fortran instruction IF
.
Some may use implicitly a step function on a variable. In such cases, the model has to be
set in a derivable form, and use a “smooth step” instead.
One should be aware of that this apparently mathematical treatment currently
indeed leads to a physical question about the macroscopic form of a physical law.
At a macroscipic level, a step function is usually a nonsense.
Taking
the example of phase-change, a fluid volume does not change phase at once, and a “smooth
change of state” is a correct macroscopic model.
Miniker provides with the smooth step function Heavyside3 in the Miniker mathlib:
Delta = -1."K"; A_Ice = heavyside("in:" (T_K-Tf), Delta, "out:" dAIce_dT);
in this example, Tf
is the ice fusion-temperature, A_ice
gives the ice-fraction
of the mesh-volume of water at temperature T_k
.
The smooth-step function is a quasi
hyperbolic tangent function of x∕Δ,
normalised from 0 to 1, with a maximum slope
of 2.5, see figure Figure 3.1.
For Mortran
to be able to symbolicaly compute the partial derivarives, the rule
is in the table of macros as:
&'(HEAVYSIDE(#,#,#))(/#)' = '((#1)(/#4)*HEAVYDELTA(#1,#2,#3))'
which uses the Foratn entry point HeavyDelta
in the Fortrsan function heavyside
.
Another type of problem arises when coding a
var=min(f(x),g(x))
Fortran instruction.
In such a case one does not want a derivative and one will code:
var = HeavySide(f(x)-g(x),Delta,dum)*g(x) + (1.-HeavySide(f(x)-g(x),Delta,dum)*f(x);
or equivalently:
var = HeavySide(f(x)-g(x),Delta,dum)*g(x) + HeavySide(g(x)-f(x),-Delta,dum)*f(x);
Warning: the value of the argument Delta is important because it will fix the maximum slope of the function that will appear as a coefficient in the Jacbian matrices.
[Contents] | [Index] | [ ? ] |
This document was generated on a sunny day using texi2any.