How to check for fluid thread in an interpreted UDF


As described in Section 6.10 of the Fluent 6.1 UDF Manual (http://www.fluentusers.com/fluent61/doc/ori/html/udf/node122.htm ), the macro FLUID_THREAD_P(thread) can be used as a test to see whether a cell thread is a fluid thread. However, in FLUENT 6.1.22 this macro is only defined for use with compiled UDFs. For Windows users who do not have the appropriate Microsoft C-compiler (see the installation FAQs <a target=_blank href="http://www.fluentusers.com/support/installation/winfaq/">http://www.fluentusers.com/support/installation/winfaq/</a>http://www.fluentusers.com/support/installation/winfaq/ for more information about compiled UDFs on Windows), compiled UDFs are not an option. There is an alternate method to test whether a cell thread is a fluid thread from within an interpreted UDF.
Because pressure is stored in a fluid thread, but not in a solid thread, we can use the utilities NULLP or NNULLP, which can be used within an interpreted UDF and are also described in Section 6.10 of the Fluent 6.1 UDF manual, to determine whether a thread is a fluid thread by checking whether pressure is available. A very simple example is below.

#include "udf.h"

DEFINE_ADJUST(test,d)
{
Thread *t;
cell_t c;

thread_loop_c(t,d)
{
if(NNULLP(T_STORAGE_R(t,SV_P)))printf("Fluid threadn");
else printf("Not fluid threadn");
}
}





Show Form
No comments yet. Be the first to add a comment!