2.2.2.  DEFINE_DELTAT

2.2.2.1. Description

DEFINE_DELTAT is a general-purpose macro that you can use to control the size of the time step during the solution of a transient problem. Note that this macro can be used only if Adaptive is selected from the Time Stepping Method drop-down list in the Run Calculation task page in ANSYS Fluent.

2.2.2.2. Usage

DEFINE_DELTAT (name, d)

Argument Type

Description

symbol name

UDF name.

Domain *d

Pointer to domain over which the time stepping control function is to be applied. The domain argument provides access to all cell and face threads in the mesh. For multiphase flows, the pointer that is passed to the function by the solver is the mixture-level domain.

Function returns

real

There are two arguments to DEFINE_DELTAT: name and domain. You supply name, the name of the UDF. domain is passed by the ANSYS Fluent solver to your UDF. Your UDF will need to compute the real value of the physical time step and return it to the solver.

2.2.2.3. Example

The following UDF, named mydeltat, is a simple function that shows how you can use DEFINE_DELTAT to change the value of the time step in a simulation. First, CURRENT_TIME is used to get the value of the current simulation time (which is assigned to the variable flow_time). Then, for the first 0.5 seconds of the calculation, a time step of 0.1 is set. A time step of 0.2 is set for the remainder of the simulation. The time step variable is then returned to the solver. See Time-Dependent Macros for details on CURRENT_TIME.

/*********************************************************************
   UDF that changes the time step value for a time-dependent solution
 **********************************************************************/
 #include "udf.h"
 
 DEFINE_DELTAT(mydeltat,d)
 {
   real time_step;
   real flow_time = CURRENT_TIME;
   if (flow_time < 0.5)
       time_step = 0.1;
   else
       time_step = 0.2;
   return time_step;
 } 

2.2.2.4. Hooking an Adaptive Time Step UDF to ANSYS Fluent

After the UDF that you have defined using DEFINE_DELTAT is interpreted (Interpreting UDFs) or compiled (Compiling UDFs), the name of the argument that you supplied as the first DEFINE macro argument (e.g,. mydeltat) will become visible and selectable in the Adaptive Time Step Settings dialog box in ANSYS Fluent. See Hooking DEFINE_DELTAT UDFs for details.


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