Download FLUENT 6.3 UDF Manual

Transcript
Additional Macros for Writing UDFs
Looping Over Phase Threads in Mixture (sub thread loop)
The sub thread loop macro loops over all phase-level threads (subthreads) associated
with a mixture-level thread. The macro steps through and returns the pointer to each
subthread as well as the corresponding phase domain index. As discussed in Section 1.10.1: Multiphase-specific Data Types, if the subthread pointer is associated with
an inlet zone, then the macro will provide the pointers to the face threads associated
with the inlet for each of the phases.
int phase_domain_index;
Thread *subthread;
Thread *mixture_thread;
sub_thread_loop(subthread, mixture_thread, phase_domain_index)
The variable arguments to sub thread loop are subthread, mixture thread, and
phase domain index. subthread is a pointer to the phase thread, and mixture thread
is a pointer to the mixture-level thread. The mixture thread is automatically passed to
your UDF by the FLUENT solver when you use a DEFINE macro that contains a thread
variable argument (e.g., DEFINE PROFILE) and your UDF is hooked to the mixture. If
the mixture thread is not explicitly passed to your UDF, you will need to use a utility
macro to retrieve it before calling sub thread loop. phase domain index is an index
of subdomain pointers that can be retrieved using the PHASE DOMAIN INDEX macro. (See
Section 3.3.2: Phase Domain Index (PHASE DOMAIN INDEX) for details.) The index begins at 0 for the primary phase, and is incremented by one for each secondary phase in
the mixture. Note that subthread and phase domain index are initialized within the
sub thread loop macro definition.
Looping Over Phase Cell Threads in Mixture (mp thread loop c)
The mp thread loop c macro loops through all cell threads (at the mixture level) within
the mixture domain and provides the pointers of the phase-level (cell) threads associated with each mixture-level thread. This is nearly identical to the thread loop c
macro (Section 3.3: Looping Over Cell Threads in a Domain (thread loop c)) when
applied to the mixture domain. The difference is that, in addition to stepping through
each cell thread, the macro also returns a pointer array (pt) that identifies the corresponding phase-level threads. The pointer to the cell thread for the ith phase is pt[i],
where i is the phase domain index. pt[i] can be used as an argument to macros requiring the phase-level thread pointer. phase domain index can be retrieved using the
PHASE DOMAIN INDEX macro. (See Section 3.3.2: Phase Domain Index (PHASE DOMAIN INDEX)
for details.)
3-56
c Fluent Inc. September 11, 2006