The
USER_common_variables file utilizes its own scripting syntax and this page serves as overview over the syntax in USER_common_variables.dat (UCV).
Warning: First of all, the scripting language is
case sensitive.
There are three major concepts involved: variables, assignments (in order to assign boundary conditions), and environments (for defining things that naturally do not fit into one line).
Strings
Strings are put inbetween "..." or '...'. The strings are however interpreted/parsed during read-in, that is, if they contain
Variables .
In order to avoid interpretion/parsing of strings during read-in, then the string has to be put in >>...<<. Currently, that is only used in
KindOfProblem defintions.
There are four types of variables that can be referenced within the UCV files:
-
- &AliasVariableName& references an alias variable defined by the user as string in the alias section, see ALIAS, or in the construct section, see ConstructClause.
- $AcronymVariableName$ refers to an acronym or soft variable; MESHFREE automatically assigns consecutive integer values to the $...$-variables in the order they are appearing within the UCV.
- %MESHFREEVariableName% refers to MESHFREE internal variables such as the index variables (see __Indices__) and constants (see __Constants__). Generally, the user cannot define these variables (the only exception is UserDefinedIndices).
- @SystemVariable@ represents system or software information.
- ScalarVariable scalar variable, that can be evaluated in every timestep, see valA().
More information in
Variables.
Assignments
Assignments in the UCV can take the following forms. The number of arguments depends on the LHS statement.
LHS = RHS: left hand side with no argument
The assignment
LHS = RHS (left hand side with no argument) can have the two following meanings:
-
- A value is assigned to a parameter, e.g. the end time for the simulation shall be 10 seconds:
Tend = 10.0
# set parameter Tend to 10.0 seconds
- A new item of LHS is added and an implicit enumeration takes place, e.g. SAVE_ITEM. For example, the code snippet
adds two SAVE_ITEMs, one for RHS1 and one for RHS2.
LHS(arg) = RHS: left hand side with one argument
In the assignment
LHS(arg) = RHS, the right hand side is assigned to the argument regarding the LHS, e.g.
-
- PhysicalProperties: the density of the material referenced by acronym $WATER$ is 1000.00:
density($WATER$) = 1000.00
With that, also the acronym variable $WATER$ is automatically initialized and can be referenced in the alias section with the MAT tag.
- BoundaryConditions: a boundary condition for the temperature defined for the acronym $BC_wall$ :
With that, also the acronym variable $BC_wall$ is automatically initialized and can be referenced in the alias section with the BC tag.
LHS(arg1,arg2) = RHS: left hand side with two arguments
In the assignment
LHS(arg1,arg2) = RHS, the right hand side is assigned to the two arguments regarding the LHS, e.g.
-
- Initial conditions for a quantity, e.g. the initial temperature (referenced by internal variable %ind_T%) in the simulation of the material (referenced with acronym $WATER$ ) is 310.8 Kelvin:
- see the documentation of CODI for more examples of two arguments on the LHS.
So far, we have not tackled the
RHS, for this please refer to
RightHandSideExpression.
Environments
In the UCV syntax, there are also environments to provide certain functionalities. An environment starts with begin_environment{"nameOfEnvironment"}, ends with end_environment and can be referred to by the name "nameOfEnvironment". Here are some examples for environments:
Execution control for statements
-
- Selection: Execution of statements based on a condition, decision by the value of an alias variable which statements to execute in a UCV file. (Similar to If-else)
- Loops: Repetition of statements, N-times repetition of statements with an iterator variable.
Options for structuring UCVs
Sometimes UCV files can get very complex and the individual lines get very long. Here are some tools for structuring.