TrueGrid logo

A Mesh Generator and Pre-Processor for
FEA and CFD Analysis

TrueGrid® Expression Feature

An expression in TrueGrid® is defined to be any FORTRAN like expressions enclosed in square brackets. These expressions can be used any place a number is required in the input stream.


For example:

  scale [sqrt(2.1)/17.2]

This can be combined with parameters so that expressions become dependent on values defined in the PARAMETER command.


For example:

  PARAMETER   a 2.1 b 17.2; 
              scale [sqrt(%a)/%b]

Properties Of Expressions


  • Integer, floating point, and exponential numbers and parameters can be used as operands and arguments to functions
  • All calculations are done in floating point
  • Unitary and binary arithmetic operators + and -
  • Binary arithmetic operators *, /, **, and ^
  • Parentheses to specify order of operations where the default order is given to:
    First - exponentiation ( ** or ^ )
    Second - multiplication ( * ) and division ( / )
    Third - addition ( + ) and subtraction ( - )
  • The expression can be continued to the next line by using a space and the ampersand ( & ) at the end of the line
  • All illegal operations cause warnings
  • All trigonometric operations are in degrees

Expressions Can Call Functions


  • INT(x): truncates x to an integer
  • NINT(x): rounds x to the nearest integer
  • ABS(x): absolute value of x
  • MOD(a,b): a modulo b
  • SIGN(a,b): transfer the sign of b to a
  • MAX(x1,x2,...,xn): maximum value of a list of numbers
  • MIN(x1,x2,...,xn): minimum value of a list of numbers
  • SQRT(x): square root of x where x most be positive
  • EXP(x): exponential of x where x must not exceed 85.19
  • LOG(x): natural logarithm where x must be positive
  • LOG10(x): common logarithm base 10 where x must be positive
  • SIN(x): trigonometric sine of x
  • COS(x): trigonometric cosine of x
  • TAN(x): trigonometric tangent of x where abs(x) can not be 90
  • ASIN(x): trigonometric arcsine of x where abs(x) can not exceed 1
  • ACOS(x): trigonometric arccosine of x where abs(x) can not exceed 1
  • ATAN(x): trigonometric arctangent
  • ATAN2(y,x): trigonometric arctangent with two arguments
  • SINH(x): hyperbolic sine
  • COSH(x): hyperbolic cosine
  • RAND(seed,mean): uniform random number from 0 to 1
  • NORM(seed,mean,sig): normal random number