Symbolic Variables

Symbolic variables can contain expressions to calculate specific parameters of the model and have specific syntax requirements.

Instead of using numerical values in the cards, it is possible to use predefined variables. The name of a variable always consists of the “#” symbol followed by a string consisting of the characters “a-z”, “A-Z”, “0-9” and the special character “_”.

The following are examples of valid variable names:
  • #height
  • #a
  • #a_1
  • #P5_7f
The following are examples of invalid variable names:
  • #a?1
  • #value2.1
Note: There is no distinction between upper and lower case characters.

For example, #a and #A are interpreted as the same variable.

It is important to note that in CADFEKO variables are used without the “#” character whereas PREFEKO requires the “#” character to distinguish between variables and functions (such as cosine).

When CADFEKO writes the variables to the .cfm file, it prepends the “#” character so that the variables can be used after the IN card in the .pre file. When using OPTFEKO in a model that has no CADFEKO geometry defined, the .cfm file mesh import command must be removed, or variables that are defined in the .cfm file must be excluded from the import, as these variable values will override the values assigned by OPTFEKO if they are included.

Expressions and functions are used when defining variables so that direct calculations can be carried out. The variables must be defined before they can be used in the respective cards. It is possible to use expressions such as 2*#radius in the input fields subject to the maximum allowed length for the column based format (10 characters for real values, 5 characters for integer values). For larger expressions additional variables must be defined or the colon based format can be used.

Examples of variables:
#2pi = 2*#pi
#vara = 1 + sqrt(2)
#varb = #vara * 2.3e-2 * (sin(#pi/6) + sin(rad(40)) + #vara^2)
#sum = #vara+#varb
Note: The “#” character must appear in the first column to define a variable.