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.
DEFINE_EXECUTE_AT_END (name)
|
Argument Type |
Description |
|---|---|
|
|
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 Domain Pointer (Get_Domain) 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.
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);
}
After the UDF that you have defined using DEFINE_EXECUTE_AT_END is interpreted (Interpreting UDFs)
or compiled (Compiling UDFs), the name
of the argument that you supplied as the first DEFINE macro argument (for example, 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 Hooking DEFINE_EXECUTE_AT_END UDFs for details.