2.2.7.  DEFINE_EXECUTE_AFTER_CASE/DATA

2.2.7.1. Description

DEFINE_EXECUTE_AFTER_CASE and DEFINE_EXECUTE_AFTER_DATA are general-purpose macros that can be used to specify a function that executes after the case and/or data file is read in ANSYS Fluent. This is useful because it provides access to UDF functions after the case and/or data file is read.

Compiled UDF libraries are loaded using either the Compiled UDFs or the UDF Library Manager dialog box (see Load and Unload Libraries Using the UDF Library Manager Dialog Box).


Important:   DEFINE_EXECUTE_AFTER_CASE and DEFINE_EXECUTE_AFTER_DATA UDFs can be executed only as compiled UDFs.


2.2.7.2. Usage

DEFINE_EXECUTE_AFTER_CASE (name, libname) or

DEFINE_EXECUTE_AFTER_DATA (name, libname)

Argument Type

Description

symbol name

UDF name.

char *libname

compiled UDF library name.

Function returns

void

There are two arguments to DEFINE_EXECUTE_AFTER_CASE and DEFINE_EXECUTE_AFTER_DATA: name and libname. You supply a name for the UDF which will be used by ANSYS Fluent when reporting that the EXECUTE_AFTER_CASE or EXECUTE_AFTER_DATA UDF is being run. The libname is set by ANSYS Fluent to be the name of the library (for example, libudf) that you have specified (by entering a name or keeping the default libudf). libname is passed so that you can use it in messages within your UDF.

2.2.7.3. Example

The following simple UDF named after_case and after_data, prints a message to the console that contains the name of the library being loaded.

#include "udf.h"

 DEFINE_EXECUTE_AFTER_CASE(after_case, libname)
 {
      Message("EXECUTE_AFTER_CASE called from $s\n", libname);
  }
 
 DEFINE_EXECUTE_AFTER_DATA(after_data, libname) 
 {
      Message("EXECUTE_AFTER_DATA called from $s\n", libname);
 } 

2.2.7.4. Hooking an Execute After Reading Case and Data File UDF to ANSYS Fluent

After the UDF that you have defined using DEFINE_EXECUTE_AFTER_CASE or DEFINE_EXECUTE_AFTER_DATA is compiled (Compiling UDFs), the function will not need to be hooked to ANSYS Fluent through any graphics dialog boxes. Instead, ANSYS Fluent searches the newly loaded library for any UDFs of the type EXECUTE_AFTER_CASE or EXECUTE_AFTER_DATA, and will automatically execute them in the order they appear in the library.


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