If a field in a dialog box or in the prompt area is expecting a floating point number or a complex number, you can enter an arithmetic expression, as shown in Figure 3–1.
The expression is evaluated by the Python interpreter that is built into Abaqus/CAE. The arithmetic expression is replaced by its value; if you reopen a dialog that contained expressions, only the values are available. Variables like pi and functions like sin() are available because Abaqus/CAE imports the Python math module when you start a session. As a result, you can enter any expression that can be evaluated by Python's built-in functions or by the Python math module. For more information, see the documentation for built-in functions and the math module on the official Python home page.To make sure that your expression is evaluated as expected, you should be aware of the following:
If you enter numbers as integers, Python will perform integer division and round down any remainder. For example, Python will interpret 3/2 as 1 and 1/2 as 0. In contrast, Python interprets 3./2 as 1.5 and 1/2. as 0.5.
Python interprets numbers with leading zeros as octal numbers (for example, 0123 is interpreted as 83.0). However, Abaqus/CAE will ignore leading zeros in numbers in text fields before Python interprets them; such numbers are evaluated as decimals.
Python interprets e as the base of the natural logarithm; that is, e equates to 2.71828182846 and e+2 equates to 4.71828182846.
If the “e” character is preceded by a number, Python interprets it as an exponent, not a natural logarithm. For example, Python interprets 2e+2 as 2 × 102 and equates it to 200.
Python interprets 2e+ as 2 × 100 and equates it to 2. Similarly, Python interprets 2e++11 as 2 × 100 + 11 and equates it to 13.
If you are unsure how Python will interpret your expression, you can enter the expression on the command line; Abaqus/CAE will print the resulting interpreted value in the message area. To access the command line interface, click in the bottom left corner of the main window. For more information, see “Components of the main window,” Section 2.2.1.
You can also test how Abaqus/CAE interprets an expression by entering abaqus python at an operating system prompt and entering the expression at the Python prompt that appears. The prompt line and some dialog boxes do not allow you to enter an expression. As an alternative, you can enter the expression on the command line or at the Python prompt and paste the resulting value in the prompt line or dialog box.