3.5. Substitution of Numeric Parametric Values

Whenever you use a parameter name in a numeric command field, its value is automatically substituted. If no value has been assigned to the parameter (that is, if the parameter has not been defined), a near-zero value (2-100) will be substituted, usually without warning.


Note:  Defining the parameter after it is used in a command does not "update" the command in most cases. (Exceptions are the commands /TITLE, /STITLE, *ABBR, and /TLABEL. See Forced Substitution for more information.) For example:

Y=0
X=2.7
N,1,X,Y     ! Node 1 at (2.7,0)
Y=3.5       ! Redefining parameter Y now does not update node 1

3.5.1. Preventing Substitution

You can prevent parameter substitution by enclosing the parameter name with single quotes ('), for example, 'XYZ'. The literal string is then used; therefore, this feature is valid only in non-numerical fields.

Conversely, you can force parameter substitution in titles, subtitles, and filenames by enclosing the parameter name with percent signs (%). For example,

/TITLE, TEMPERATURE CONTOURS AT TIME=%TM%

specifies a title in which the numerical value of parameter TM is substituted. Note that the parameter is substituted at the time the title is used.

3.5.2. Substitution of Character Parametric Values

Use of a character parameter in an alphanumeric command field generally results in automatic substitution of its value. Forced substitution and character parameter restrictions are explained below.

3.5.2.1. Forced Substitution

As with numerical parameters, you can force the substitution of a character parameter value in certain cases where substitution would not occur otherwise. This is done by enclosing the character parameter name with percent signs (%). Forced substitution of character parameters is valid for the following commands:

  • /TITLE command (Title field). Specifies titles for various printed output.

  • /STITLE command (Title field). Specifies subtitles, similar to/TITLE. (You cannot access the /STITLE command directly in the GUI.)

  • /TLABEL command (Text field). Specifies text string for annotation.

  • *ABBR command (Abbr field). Defines an abbreviation.

Forced substitution is also valid in the following types of fields:

  • Any filename or extension command argument. These arguments apply to commands such as /FILNAME, RESUME, /INPUT, /OUTPUT, and FILE. (Direct parameter substitution is also valid in these fields.)

  • Any 32 character field: A typical example is the name of macros. (Direct substitution is not valid for these fields.)

  • As a command name in any command name field. Also as an "unknown command" macro name in field 1. For example:

    R='RESUME'   
    %R%,MODEL,DB

The following example of the command input method shows forced substitution for a subtitle definition and for a directory name.

A='TEST'
B='.RST'
C='/ANSYS'
D='/MODELS/'
/STITLE,,RESULTS FROM FILE %C%%D%%A%%B%
 SUBTITLE  1 = 
 RESULTS FROM FILE /ANSYS/MODELS/TEST.RST 
/POST1
FILE,A,RST,%C%%D%      ! Read results from /ANSYS/MODELS/TEST.RST

3.5.2.2. Other Places Where Character Parameters Are Valid

In addition to the more general applications already discussed, there are some specific instances where character parameters are allowed for added convenience. The commands which are affected and details of usage are outlined below.

*ASK

This command may prompt you for an alphanumeric string (up to eight characters enclosed in single quotes) which is assigned to a character scalar parameter. (You cannot access the *ASK command directly in the GUI.)

*CFWRITE

This command writes ANSYS commands to the file opened by *CFOPEN. It can be used to write a character parameter assignment to that file. For example, *CFWRITE,B = 'FILE' is valid. (You cannot access the *CFWRITE and *CFOPEN commands directly in the GUI.)

*IF and *ELSEIF

Character parameters may be used for the VAL1 and VAL2 arguments of these commands. For the Oper argument, only labels EQ (equal) and NE (not equal) are valid when using character parameters. (You cannot access the *IF and *ELSEIF commands directly in the GUI.) Example:

CPARM='NO'
*IF,CPARM,NE,'YES',THEN
*MSG

Character parameters are allowed as input for the VAL1 through VAL8 arguments. The data descriptor %C is used to indicate alphanumeric character data on the format line (which must follow the *MSG command). The %C corresponds to the FORTRAN descriptor A8. (You cannot access the *MSG command directly in the GUI.)

PARSAV and PARRES

These commands will save character parameters to a file (PARSAV command or menu path Utility Menu> Parameters> Save Parameters) and resume character parameters from a file (PARRES or Utility Menu> Parameters> Restore Parameters).

*VREAD

This command (Utility Menu> Parameters> Array Parameters> Read from File) can be used to read alphanumeric character data from a file and produce a character array parameter. The FORTRAN character descriptor (A) may be used in the format line which must follow the *VREAD command.

*VWRITE

This command (menu path Utility Menu> Parameters> Array Parameters> Write to File) can be used to write character parameter data to a file in a formatted sequence. The FORTRAN character descriptor (A) may be used in the format line which must follow the *VWRITE command.

3.5.2.3. Character Parameter Restrictions

Although character parameters have much of the same functionality as numerical parameters, there are several instances where character parameters are not valid.

  • Character parameter substitution is not allowed for the Par argument of the *SET, *GET, *DIM, and *STATUS commands.

  • Interactive editing of array parameters (*VEDIT command) is not available for character array parameters.

  • Vector operation commands, such as *VOPER, *VSCFUN, *VFUN, *VFILL, *VGET, and *VITRP, do not work with character array parameters.

  • When operating on character parameters, the specification commands *VMASK and *VLEN are applicable only to the *VWRITE and *VREAD commands.

  • Character parameters are not valid in parametric expressions which use addition, subtraction, multiplication, etc.


Release 17.0 - © SAS IP, Inc. All rights reserved.