|
|
Description
DEFINE_EXECUTE_AT_END is a general-purpose macro that is executed at the end of an iteration in a steady state run, or at the end of a time step in a transient run. You can use DEFINE_EXECUTE_AT_END when you want to calculate flow quantities at these particular times. Note that you do not have to specify whether your execute-at-end UDF gets executed at the end of a time step or the end of an iteration. This is done automatically when you select the steady or unsteady time method in your ANSYS FLUENT model.
Usage
| DEFINE_EXECUTE_AT_END( name) |
| Argument Type | Description |
| symbol name | UDF name. |
| Function returns | |
| void | |
There is only one argument to DEFINE_EXECUTE_AT_END: name. You supply name, the name of the UDF. Unlike DEFINE_ADJUST, DEFINE_EXECUTE_AT_END is not passed a domain pointer. Therefore, if your function requires access to a domain pointer, then you will need to use the utility Get_Domain(ID) to explicitly obtain it (see Section 3.2.6 and the example below). If your UDF requires access to a phase domain pointer in a multiphase solution, then it will need to pass the appropriate phase ID to Get_Domain in order to obtain it.
Example
The following UDF, named execute_at_end, integrates the turbulent dissipation over the entire domain using DEFINE_EXECUTE_AT_END and displays it in the console at the end of the current iteration or time step. It can be executed as an interpreted or compiled UDF in ANSYS FLUENT.
/********************************************************************
UDF for integrating turbulent dissipation and displaying it in the
console at the end of the current iteration or time step
*********************************************************************/
#include "udf.h"
DEFINE_EXECUTE_AT_END(execute_at_end)
{
Domain *d;
Thread *t;
/* Integrate dissipation. */
real sum_diss=0.;
cell_t c;
d = Get_Domain(1); /* mixture domain if multiphase */
thread_loop_c(t,d)
{
if (FLUID_THREAD_P(t))
{
begin_c_loop(c,t)
sum_diss += C_D(c,t) * C_VOLUME(c,t);
end_c_loop(c,t)
}
}
printf("Volume integral of turbulent dissipation: %g\n", sum_diss);
fflush(stdout);
}
|
Hooking an Execute-at-End UDF to
ANSYS FLUENT
After the UDF that you have defined using DEFINE_EXECUTE_AT_END is interpreted (Chapter 4) or compiled (Chapter 5), the name of the argument that you supplied as the first DEFINE macro argument (e.g. execute_at_end) will become visible and selectable via the User-Defined Function Hooks dialog box in ANSYS FLUENT. Note that you can hook multiple end-iteration functions to your model. See Section 6.1.3 for details.