MATC Examples

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.

General structure of a MATC function

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;\

Passing time or time step size to a function

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 ...
tips/matc.txt · Last modified: 2012/11/19 08:19 by tzwinger
CC Attribution-Share Alike 4.0 International Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0