6.1.8. Defining and Viewing Parameters

You can define a series of cases based on a set of parametric values. These parameters may be defined for numeric cell zone and boundary condition settings. This is especially useful if you are using Workbench and performing parametric studies (optimization), comparing cases with different boundary settings. Information about this feature can be found in see Working with Parameters and Design Points in the Workbench User's Guide. If you are not running ANSYS Fluent through Workbench, then you can use the parameter settings to define the same boundary condition value to different boundaries having the same units.


Note:  For more information about using parameters with ANSYS Fluent in ANSYS Workbench, see Working With Input and Output Parameters in Workbench in the separate Fluent in Workbench User's Guide.


The parameters that you have defined in the various boundary condition dialog boxes are accessed by clicking the Parameters... button in the Cell Zone Conditions or Boundary Conditions task page. The Parameters dialog box will open, as shown in Figure 6.3: The Parameters Dialog Box, listing all of the input parameters that you have created in the various boundary condition dialog boxes.

Figure 6.3:  The Parameters Dialog Box

The Parameters Dialog Box

In the Parameters dialog box, under the Input Parameters list, you can

In the Parameters dialog box, under the Output Parameters list, you can also


Important:  Changing the units for a quantity changes the value for any input parameter using that quantity.



Note:  Various ANSYS Fluent setup-related input quantities (of type real and profile) can be assigned to an input parameter (indicated by the New Input Parameter... option in the corresponding drop-down list or by a small “p” icon next to the field). Clicking this option or icon displays the Select Input Parameter Dialog Box where you can create and assign input parameters.


6.1.8.1. Creating a New Parameter

You can create a new cell zone or boundary condition parameter, as shown in Figure 6.4: The New Input Parameter... Selection.

Figure 6.4:  The New Input Parameter... Selection

The New Input Parameter... Selection

When you select New Input Parameter... from the drop-down list, the Input Parameter Properties dialog box (Figure 6.5: The Input Parameter Properties Dialog Box) will open where you will

  • Enter the Name of the parameter.

  • Specify the Current Value as a constant.

  • The Used In field displays information about where the parameter is utilized.

Figure 6.5:  The Input Parameter Properties Dialog Box

The Input Parameter Properties Dialog Box

Once the parameters are defined in the Input Parameter Properties dialog box, the name of the parameter will appear in the drop-down list of the property you are defining, as seen in Figure 6.4: The New Input Parameter... Selection.


Note:  ANSYS Fluent automatically creates generic default names for new input and output parameters (for example, parameter-1, parameter-2, parameter-3, and so on) If a parameter is deleted, the default name is not reused. For example, if you have parameter-1, parameter-2, and parameter-3, then delete parameter-2 and create a new parameter, the default name for the new parameter will be parameter-4.


6.1.8.2. Working With Advanced Parameter Options

Various ANSYS Fluent setup related input quantities can be assigned to an input parameter. You can define a series of simulations based on a set of parametric values that are managed both in ANSYS Fluent and in Workbench. These parameters may be defined for numeric cell zone and boundary condition settings using the New Input Parameter … option in the corresponding drop-down list or by a small “p” icon adjacent to a specific input setting. However, various ANSYS Fluent settings are not supported by these methods.

You can mitigate this limitation using input parameters through Scheme procedures and user-defined functions (UDFs), and define input parameters for various ANSYS Fluent simulation related settings.

6.1.8.2.1. Defining Scheme Procedures With Input Parameters

To use a Scheme procedure with input parameters, in the Parameters dialog box under Input Parameters, select More, then choose Use in Scheme Procedure to display the Use Input Parameter in Scheme Procedure Dialog Box where you can register the input parameters that can be used in Scheme procedures during calculations. A text user interface command is also available, described in Using the Text User Interface to Define UDFs and Scheme Procedures With Input Parameters.

Figure 6.6:  Use Input Parameter in Scheme Procedure Dialog Box

Use Input Parameter in Scheme Procedure Dialog Box


Use the Select button to open the Select Input Parameter Dialog Box where an input parameter can be chosen. Enter a Scheme Procedure name or body starting with lambda that should receive a real argument (the value of the selected input parameter). For example, if the following Scheme procedure called my-funct is defined as a Scheme file that gets loaded into the current session, 

(define my-funct
	(lambda (value )
		(ti-menu-load-string (format #f "/solve/set/under-relaxation/pressure ~g" value))))

then enter my-funct for the Scheme Procedure. Otherwise, you can directly enter the following code for the Scheme Procedure:

(lambda (value)(ti-menu-load-string (args->string '/solve/set/under-relaxation/pressure value)))

Click Define to populate the Registered List. Use Delete to delete the use of the selected input variable, but not the associated input parameter (the input parameter has to be deleted separately in the Parameters dialog box). Use Print to print out details of the registered input parameters.


Important:  While writing Scheme procedures, you should use the "args->string" help procedure instead of using double quotes. For example:

(lambda ( value1) 
 (display (args->string 'Changing-Theta-Divisions-value=   value1))
 (ti-menu-load-string 
    (args->string '/define/models/radiation/discrete-ordinates? 'yes value1  '_  '_  '_)) )

Alternatively, you could also write:

(lambda ( value1)
 (display (args->string 'Changing-Theta-Divisions-value=  value1))
 (ti-menu-load-string 
   (apply args->string `(/define/models/radiation/discrete-ordinates? yes ,value1  _  _  _) )) )

where the ` character after args->string is the grave accent character (not a single quote) and the _ character stores the default value of the current text user interface prompt. Note that the first occurrence of value1 is the Scheme variable, while the second occurrence of value1 will be replaced by the value stored in the variable. This method eliminates the need to specify a single quote for all arguments.

Also note that if you enter a scheme procedure body in the Use Input Parameter in Scheme Procedure dialog box, you should combine the scheme procedure lines into one single line.


6.1.8.2.2. Defining UDFs With Input Parameters

To use a UDF with input parameters, in the Parameters dialog box under Input Parameters, select More, then choose Use in UDF to display the Use Input Parameter for UDF Dialog Box where you can register the input parameters that can be used in UDF functions during calculations. A text user interface command is also available, described in Using the Text User Interface to Define UDFs and Scheme Procedures With Input Parameters.

Figure 6.7:  Use Input Parameter for UDF Dialog Box

Use Input Parameter for UDF Dialog Box


Use the Select button to open the Select Input Parameter Dialog Box where an input parameter can be chosen. Click Define to populate the Registered List. Use Delete to delete the use of the selected input variable, but not the associated input parameter (the input parameter has to be deleted separately in the Parameters dialog box). Click Print to print out the parameter ID of the registered input parameter. This ID should be used to access the value of the parameter in UDF.

By registering the input parameter, ANSYS Fluent knows that this input parameter is being used by a UDF. In the UDF C function, you can access the registered input parameter value using the RP_Get_Input_Parameter macro. For example,

real value = RP_Get_Input_Parameter(“real-4”),

where real-4 is an input parameter ID obtained using the Print feature.

6.1.8.2.3. Using the Text User Interface to Define UDFs and Scheme Procedures With Input Parameters

The /define/parameters/input-parameters/advance/use-in text interface command can also be used to define input parameters and Scheme procedures and user-defined functions.

The Scheme procedures can use other text user interface (TUI) commands in ANSYS Fluent to change the desired simulation settings in a parametric manner. Each numerical component of the TUI command string can be marked and treated as a parameter. Setting up advanced input parameters requires using Scheme functions that use text interface commands to apply new values. Once defined, these input parameters are displayed in the Parameters dialog box alongside other input parameters. The input parameter passes a constant numeric value to the registered/provided Scheme function. Therefore, the associated Scheme function (and corresponding ANSYS Fluent text command) uses the constant parameter values using the units that were already defined for the designated text command quantity.

/define/parameters/input-parameters/advance

Enter the advanced input parameters menu.

use-in/

Allows you to use an input parameter in a Scheme procedure or in a UDF. The following examples demonstrates how to use an input parameter using a Scheme procedure. The Scheme procedure body can be written at the prompt itself:

/define/parameters/input-parameters/advance> use-in
Select type:> scheme-proc
Name of parameter ["parameter-1"] 
parameter-1 value [0] 0.3
Enter the name/body of apply-function [()] (lambda (value )
        (ti-menu-load-string (format #f "/solve/set/under-relaxation/pressure ~g" value)))

or it can be written in a Scheme file (for example, my-funct)

/define/parameters/custom-input-parameters> use-in
Select type:> scheme-proc
Name of parameter ["parameter-1"] 
parameter-1 value [0] 0.3
Enter the name/body of apply-function [()] my-funct

where the my-funct Scheme file contents are:

(define my-funct
    (lambda (value )
        (ti-menu-load-string (format #f "/solve/set/under-relaxation/pressure ~g" value))))

The following example demonstrates how to use an input parameter using a UDF:

/define/parameters/input-parameters/advance> use-in
Select type:> udf-side
Name of parameter ["parameter-1"] 
parameter-1 value [0] 0.3
delete

Deletes the use of the selected input variable, but not the associated input parameter (the input parameter has to be deleted separately). Using the wildcard ‘*’ allows you to delete all custom input variable at once.

list

Shows usage of input parameters for Scheme procedures and for UDFs


Release 18.2 - © ANSYS, Inc. All rights reserved.