next up previous
Next: 4.3.1 The Model Definition Up: 4. AMIGOS Previous: 4.2.4 Boundary Initialization

4.3 AMI - Analytical Model Interface

The Analytical Model Interface is an interpreter for translating mathematical expressions into a discretized numerical representation, highly optimized for numerical simulation. This tool is thought to be used in developer mode only, since all models have to be defined there. Because of the physical and mathematical background AMI is equipped with a model description language that is similar to well known systems like Math-CAD, Mathematica or Matlab. This should reduce the break-in period for scientists who are sometimes not experienced in high level programming languages like C++ or Fortran but are often familiar with mathematical software.

Although the syntax and semantics of C++ or Fortran are not much more difficult than the developed input language, the difficulty comes partly from the need to understand the language's quirks, and even more so from the need to understand (or develop) data structures associated with discretized PDE solvers. The developed model definition language completes the lack of expressive power in these general languages and supports, among others, symbolic manipulation and native understanding of matrices and vectors. The following lines give a short impression of the input language which will be discussed in detail in Chapter 4.3.1.

MODEL ModelName = [x1,x2,...,xn];
# MODEL is a predefined keyword 
# ModelName: the name the model should get 
# X = [x1,x2,x3,...] the solution-vector
# Begin Model Description

# any user defined mathematical expression
# including matrices and tensors
var1 = x1+5*x2;   
var2 = var1+2*x3;
var3(var1,var2) = var1 - var2; 
# running index-variable from 1 to n
i = 1..n;
f[i] = var3(X[i],X[i+1]);

# Definition of residual and its derivative to 
# get the numerical form: 
#       [jacobian] * [X] = [residual] 

residual = [[f1(x1,x2,...,xn)] 
            [         ...    ]
jacobian = [[df1/dx1] [df1/dx2] ... [df1/dxn] 
            [df2/dx1] [df2/dx2] ... [df2/dxn] 
            [dfn/dx1] [dfn/dx2] ... [dfn/dxn]];

A model developer only has to set up a quantity vector to be solved, select any kind of discretization (finite elements, finite differences or finite boxes) and has to define the discretized residual vector. Its derivative is calculated automatically by the system but alternatively can be defined by the user, if influence on the iterative behavior of the system using penalty terms or damping methods is desired. Several variables within the model can be marked as parameters or derivative quantities (e.g. the gradient field of an unknown quantity) to simplify the interactive process in user mode. These variables are treated in a special manner by AMIGOS so that the performance of the system stays as high as possible.

AMI is equipped with an analytical and a numerical optimizer which is tailor-made for matrix operations and standard mathematical expressions (e.g. +, -, /, *, sin, cos, atanh, ...) to minimize the number of operations for evaluation of a defined model. Every mathematical term calculated is stored and reused whenever an equivalent term is detected (taking commutative law, associative law, etc. into account). Operations like multiplying with zero or one are detected and immediately eliminated which drastically reduces the amount of operations, especially when using matrices. Therefore the number of internal mathematical operations of a complete model can be reduced considerably which leads to very high performance in addition to high flexibility. Comparisons between models using the built-in optimizer and non optimized models have shown, that the optimization reduces the number of operations by a factor of approximately three.

next up previous
Next: 4.3.1 The Model Definition Up: 4. AMIGOS Previous: 4.2.4 Boundary Initialization
Mustafa Radi