[ANSYS, Inc. Logo] return to home search
next up previous contents index

1.8 Data Types in ANSYS FLUENT

In addition to standard C language data types such as real, int, etc. that can be used to define data in your UDF, there are ANSYS FLUENT-specific data types that are associated with solver data. These data types represent the computational units for a mesh (Figure  1.7.1). Variables that are defined using these data types are typically supplied as arguments to DEFINE macros as well as to other special functions that access ANSYS FLUENT solver data.

Some of the more commonly used ANSYS FLUENT data types are:


Node  
face_t  
cell_t  
Thread  
Domain  

Node is a structure data type that stores data associated with a mesh point.

face_t is an integer data type that identifies a particular face within a face thread.

cell_t is an integer data type that identifies a particular cell within a cell thread.

Thread is a structure data type that stores data that is common to the group of cells or faces that it represents. For multiphase applications, there is a thread structure for each phase, as well as for the mixture. See Section  1.10.1 for details.

Domain is a structure data type that stores data associated with a collection of node, face, and cell threads in a mesh. For single-phase applications, there is only a single domain structure. For multiphase applications, there are domain structures for each phase, the interaction between phases, as well as for the mixture. The mixture-level domain is the highest-level structure for a multiphase model. See Section  1.10.1 for details.

figure   

Note that all of the ANSYS FLUENT data types are case sensitive .

When you use a UDF in ANSYS FLUENT, your function can access solution variables at individual cells or cell faces in the fluid and boundary zones. UDFs need to be passed appropriate arguments such as a thread reference (i.e., pointer to a particular thread) and the cell or face ID in order to allow individual cells or faces to be accessed. Note that a face ID or cell ID by itself does not uniquely identify the face or cell. A thread pointer is always required along with the ID to identify which thread the face (or cell) belongs to.

Some UDFs are passed the cell index variable ( c) as an argument (such as in DEFINE_PROPERTY(my_function,c,t)), or the face index variable ( f) (such as in DEFINE_UDS_FLUX(my_function,f,t,i)). If the cell or face index variable (e.g., cell_t c, face_t f) is not passed as an argument and is needed in the UDF, the variable is always available to be used by the function after it has been declared locally. See Section  2.7.3 for an example.

The data structures that are passed to your UDF (as pointers) depend on the DEFINE macro you are using and the property or term you are trying to modify. For example, DEFINE_ADJUST UDFs are general-purpose functions that are passed a domain pointer ( d) (such as in DEFINE_ADJUST(my_function, d)). DEFINE_PROFILE UDFs are passed a thread pointer ( t) to the boundary zone that the function is hooked to, such as in DEFINE_PROFILE(my_function, thread, i).

Some UDFs (such as DEFINE_ON_DEMAND functions) are not passed any pointers to data structures, while others are not passed the pointer the UDF needs. If your UDF needs to access a thread or domain pointer that is not directly passed by the solver through an argument, then you will need to use a special ANSYS FLUENT-supplied macro to obtain the pointer in your UDF. For example, DEFINE_ADJUST is passed only the domain pointer, so if your UDF needs a thread pointer , it will have to declare the variable locally and then obtain it using the special macro Lookup_Thread. An exception to this is if your UDF needs a thread pointer to loop over all of the cell threads or all the face threads in a domain (using thread_c_loop(c,t) or thread_f_loop(f,t), respectively) and it is not passed to the DEFINE macro. Since the UDF will be looping over all threads in the domain, you will not need to use Lookup_Thread to get the thread pointer to pass it to the looping macro; you'll just need to declare the thread pointer (and cell or face ID) locally before calling the loop. See Section  2.2.1 for an example.

As another example, if you are using DEFINE_ON_DEMAND (which is not passed any pointer argument) to execute an asynchronous UDF and your UDF needs a domain pointer, then the function will need to declare the domain variable locally and obtain it using Get_Domain . See Section  2.2.9 for an example. Refer to Section  3.2.6 for details.


next up previous contents index Previous: 1.7 Mesh Terminology
Up: 1. Overview
Next: 1.9 UDF Calling Sequence
Release 12.0 © ANSYS, Inc. 2009-01-14