MDL syntax and programming

This chapter describes the basic syntax rules for input files written in the B2000++ Model Description Language (MDL), and its programming features.

MDL features variable assignment, substitution, and flow control statements, and therefore constitutes a simple programming language. These features enable the writing of parametric MDL input files which can be used several times for different kinds of analyses, substituting different values for geometrical and material properties, boundary conditions, etc. This functionality proves useful in a wide range of contexts, but it cannot replace real programming languages (such as Python). For complex model creation tasks, it is recommended to write a Python script, a C++ program, or a Fortran program which creates the MDL files.

1. MDL format

MDL consists of human-readable characters and is typically read from one or several MDL input files. These files may be created with text editors or by means of scripts.

MDL is interpreted as a stream of items which are separated by space characters and newline characters. It does not matter how many space or newline characters are present. Thus,


three   4

is equivalent to

One two three 4

Items pertaining to the parametric input either begin with a reserved word or are enclosed in parentheses. Such items are processed and may expand to new data items. This is illustrated by means of the following example:

(a=4) One to three (a)

The item "(a=4)" assigns the integer value 4 to the variable "a", and the item "(a)" expands the current contents of variable "a". Thus, the expanded MDL is

One to three 4

Comments, i.e. explanatory text, begin with the # character and stretch until the end of the line.