# Symbolic Substitution

Symbolic substitution provides flexibility to modify the input file to use parameterized input to define various data fields across the model.

Currently, only real-valued data fields of entries in the Bulk Data section are supported for parameterization using symbolic substitution. Data fields in the Bulk Data section can be controlled using such parameterized input variables, which allows for rapidly manipulating certain key model attributes to conduct studies on how the response of the model varies based on these attributes.

Symbolic substitution can be defined using the following keywords:
%setrepsym <variable_name> = <variable_value>
%defrepsym <variable_name> = <variable_value>
%setrepsym creates a variable for symbolic substitution and %defrepsym creates a default variable for symbolic substitution. The symbolic variables can be unset using the following keywords, respectively.
%unsetrepsym <variable>
%undefrepsym <variable>
The syntax for using the symbolic variables in the fields of a Bulk Data Entry is:
%<variable>%

Multiple variables are allowed, and the same variable can also be used for multiple parameterizations on multiple Bulk Data Entries. Additionally, multiple parameterizations on the same Bulk Data Entry is also supported.

## Examples of Symbolic Substitution

Figure 1 illustrates symbolic substitution of shell thickness of a thin plate with a hole when subjected to static forces.

The sides AB and CD are fixed using SPC constraints and a total concentrated z-direction force of 1000 N are created on the nodes around the hole. The plate is defined as PSHELL with 10 mm thickness and steel as the material property with Young’s modulus of 0.21 MPa and Poisson’s ratio of 0.3. For details on setting up the model, refer to OS-T: 1000 Linear Static Analysis of a Plate with a Hole.

### Example: Setting One Default Variable Using %defrepsym

The symbolic variable here is the thickness of the plate. A variable called ‘thick’ is defined in the input file (.fem) as:
%defrepsym thick=10.0
SUBCASE       1
SPC =        1
BEGIN BULK
PSHELL         1       1%thick%           1               1
MAT1           1210000.0
ENDDATA
The model will run with 10 mm as the default value for thickness for the PSHELL properties. The ECHO entry can be used view the replaced values, in the .out file.
PSHELL	1	110.0	1	1	0.0

### Example 2: Setting Two or More Default Substitutions Using %setrepsym

Multiple variables are supported for parameterization. This example illustrates setting the Young’s modulus and shell thickness as symbolic variables in the input file.
%defrepsym thick=10.0
%defrepsym mat=4.1e5
SUBCASE       1
ANALYSIS STATICS
SPC =        1
BEGIN BULK
PSHELL         1       1%thick%           1               1
MAT1           1%mat%
ENDDATA
The replaced Bulk Data fields are:
PSHELL         1       110.0           1               1        0.0
MAT1           14.1e5                                                

### Example 3: Using %setrepsym and %defrepsym for Symbolic Substitution

This example illustrates setting a default symbolic variable using %defrepsym and using a different value for a section of the model for the same variable using %setrepsym. In the following input file, a default symbolic variable ‘thick’ has a value 10 mm as the default thickness of the plate. The thickness can be set to 5 mm for one PSHELL the default can be used for PSHELL 2.
%defrepsym thick=10.0
SUBCASE       1
ANALYSIS STATICS
SPC =        1
BEGIN BULK
%setrepsym thick=5.0
PSHELL         1       1%thick%           1               1        0.0
%unsetrepsym thick
PSHELL         2       1%thick%           1               1        0.0
MAT1           1210000.0
ENDDATA
The job will run with a thickness value equal to 5.0 mm as the thickness for PSHELL 1 and a thickness of 10.0 mm for PSHELL 2.
PSHELL	1	1 5.0	 1	1	0.0
PSHELL	2	1 10.0 1	1	0.0

The symbolic variable will unset the value previously set using %setrepsym and the default value from %defrepsym is used when the program encounters the %unsetrepsym command.

## Keywords

The keywords for symbolic substitution, i.e. %setrepsym, %defrepsym, %unsetrepsym, %undefrepsym should always start with ‘%’ symbol in the first column in any line. If the program encounters a ‘\$’ symbol in the first column, the following characters will be assumed as a part of a comment line and will be skipped. Special characters such as ‘*’, ‘&’, etc. should not appear before the keyword. The keywords for symbolic substitution are not case-sensitive; therefore, a keyword spelled as ‘SETREPSYM’ and ‘setrepsym’ are equivalent. A minimum of one blank character should be present to separate a keyword and a variable name. Two or more variables can be used for substitutions (ie, example 2 for setting up two or more substitutions). The syntax for setting and unsetting symbolic variables are:
• %defrepsym <variable_name> = <variable_value> (setting a default symbolic substitution variable)
• %setrepsym <variable_name> = <variable_value> (setting a symbolic substitution variable
• %unsetrepsym <variable_name> (unsetting a default symbolic substitution variable)
• %undefrepsym <variable_name> (unsetting a default symbolic substitution variable)

## Rules for Substitution

When a substitution request is made, determining the substitution value that will be used for a variable depends on where the variable was set. %setrepsym always has higher priority over %defrepsym. Therefore, if %setrepsym is specified, then any Bulk Data with the corresponding variable below this %setrepsym will use the value defined by this %setrepsym, unless either another %setrepsym for the same variable is encountered or if an %unsetrepsym is encountered for this variable. If %unsetrepsym is encountered, then the value of %defrepsym for this variable (if any) is used for subsequent replacements.

## Variables

### Variable Names

The variable names are not case sensitive and should not contain any embedded blanks and special characters. Special characters include (‘*’, ‘!’, ‘~’, etc.). The variables may contain an underscore (‘_’) anywhere within the field. Variables are case insensitive, for example a variable name ‘THICK’ and ‘thick’ is equivalent.

Examples of valid variable names:
• THICK
• ThicK
• _thick
• Thi_ck
• thick12
Examples of invalid variable names:
• *thick
• thick^
• th ick

### Variable Values

Currently, only real-valued data are supported for variable values. Any character or integer values are not supported.

## Verify Substituted Data Fields

The ECHO entry can be used to print the input deck in the .out file. This echoed input deck contains replaced values for all the variables which required symbolic substitution. This allows for verification of the intended replacements.