Here some hints on how to deploy Elmer's internal scripting language MATC are shown. For a deeper introduction to MATC, see the MATC manual.
A MATC function can be used if there is the need for a more complex syntax (like if-cases) that would render an in-line MATC directive too complicated. Functions are declared outside any section in the SIF with the general syntax:
$ function name(argument){\ contents of function;\ _name = result;\ }
The syntax is very close to C. The argument can also be an array of variables. The call within, for instance, a boundary condition section in the SIF then would be:
DependentVariableName = Variable FirstDependency, SecondDependency Real MATC "name(tx)"
One can also pass a MATC constant, which is defined outside any section block in the SIF by the syntax “$ RHO = 910.0” to the function using the import
argument:
$ RHO = 910.0 $ function overburden(depth) import RHO {\ _overburden = RHO * depth * 9.81;\ }
Time as well as time step size are both accessible as variables in Elmer. Dependency of a variable on these could look like
DependentVariable = Variable Time, Timestep Size Real ... }