include_foam_variables command

Warning

GPU support for this command has not been tested and may not work as expected.

Syntax

include_foam_variables file
  • file = filename of file containing OpenFOAM runtime variables

Examples

include_foam_variables myFoamVariables

Description

This commands reads OpenFOAM runtime variables and converts them to Aspherix® style variables. The variables can then be used in the Aspherix® input script. Scalar variables are directly converted to single variables with the same name, OpenFOAM vectors are converted to three Aspherix® variables with the extension x, y and z:

OpenFOAM style:
myScalar 0.1;
myVector (1 2 3);
Aspherix® style:
variable myScalar equal 0.1
variable myVectorx equal 1
variable myVectory equal 2
variable myVectorz equal 3

The functionality is also able to convert simple scalar calculations:

OpenFOAM style:
myResult #calc "$myScalar1*$myScalar2";
Aspherix® style:
variable myResult equal ${myScalar1}*${myScalar2}

Note that all arguments must be scalars and only addition, subtraction, multiplication and division are allowed. Round brackets are ignored.

Due to OpenFOAM conventions (from OpenFOAM-8 on), division operands must escaped by parentheses:

OpenFOAM style:
myResult #calc "($myScalar1)/$myScalar2"; // NOT: "$myScalar1/$myScalar2"

The original OpenFOAM variable input file may contain comments, which have to have one of the following signs at the beginning: /,//,|,\,*,# Furthermore all content that follows after // in a line is ignored, even if // is not at the beginning of the line.

Note

Although allowed in OpenFOAM itself, spaces around the operands are not allowed.

Restrictions

none