Cell type adjacent to two sided wall
Cell type adjacent to a two sided wall can be found through UDF using macros,THREAD_SHADOW(Thread *t), F_SHADOW(face_t f,Thread *t), FLUID_THREAD_P(t). Following is the description of each macro: 1)THREAD_SHADOW(Thread *t)------>this macro returns the pointer to the shadow-thread,"t" being thread-pointer to the wall. 2)F_SHADOW(face_t f,Thread *t)------>this macro returns the index of the shadow face,"f" being index of wall. 3) FLUID_THREAD_P(t)------->this macro returns cell-type as explained at <a target=_blank href="http://www.fluentusers.com/fluent6/doc/ori/html/udf/node167.htm">http://www.fluentusers.com/fluent6/doc/ori/html/udf/node167.htm</a>http://www.fluentusers.com/fluent6/doc/ori/html/udf/node167.htm Please note that c1,t1 of a face is the c0,t0 of the face's shadow. The following example UDF describes the usage of above macros: ******************************************************************************************************************************** UDF ******************************************************************************************************************************** #include "udf.h" #define DOMAIN_ID 5 /* 5=id of two-sided wall surface seen from Define--->Boundary Conditions*/ DEFINE_ON_DEMAND(cell_type) { Domain *d; int i,j; Thread *tw,*tc0,*tc1,*t_shadow; face_t f,f_shadow; cell_t c0,c1; d = Get_Domain(1); tw=Lookup_Thread(d,DOMAIN_ID); t_shadow = THREAD_SHADOW(tw); /*THREAD_SHADOW --->macro to access thread pointer to shadow face*/ f_shadow = F_SHADOW(f,tw); /* F_SHADOW -->macro to access index to face shadow */ begin_f_loop(f,tw) { c0 = F_C0(f,tw); /*returns ID for c0 */ tc0 = THREAD_T0(tw); /* returns the cell thread for c0 */ i=FLUID_THREAD_P(tc0); /* FLUID_THREAD_P-->macro to check whether a thread is fluid*/ Message("n I=%d n",i); if(i==1) { Message("n WALL-SURFACE HAS FLUID ZONE ADJACENT TO IT n"); } else { Message("n WALL-SURFACE HAS SOLID ZONE ADJACENT TO IT n"); } } end_f_loop(f,tw) begin_f_loop(f_shadow,t_shadow) { c1 = F_C0(f_shadow,t_shadow); /*returns ID for c1 */ tc1 = THREAD_T0(t_shadow);/* returns the cell thread for c0 */ j=FLUID_THREAD_P(tc1); Message("n J=%d n",j); if(j==1) { Message("n WALL-SURFACE-SHADOW HAS FLUID ZONE ADJACENT TO IT n"); } else { Message("n WALL-SURFACE-SHADOW HAS SOLID ZONE ADJACENT TO IT n"); } } end_f_loop(f_shadow,t_shadow) } ********************************************************************************************************************************* Implementation of the UDF: 1)Compile the above udf resulting in the formation of libudf directory. 2)Read the case file into Fluent. 3)Hook up the libudf directory through Define->User-Defined--->Functions---->Compiled. 3)Execute the macro "cell_type" through Define---->User-Defined--->Execute-On-Demand. 4)Cell type are seen in Fluent console. |
||
![]()
|