Looking for a solution?

Where there's a problem there's a solution

  • 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
    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:
    ************************************************************************************************************************
    #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(" I=%d ",i);
    if(i==1)
    {
    Message(" WALL-SURFACE HAS FLUID ZONE ADJACENT TO IT ");
    }
    else
    {
    Message(" WALL-SURFACE HAS SOLID ZONE ADJACENT TO IT ");
    }

    }
    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(" J=%d ",j);
    if(j==1)
    {
    Message(" WALL-SURFACE-SHADOW HAS FLUID ZONE ADJACENT TO IT ");
    }
    else
    {
    Message(" WALL-SURFACE-SHADOW HAS SOLID ZONE ADJACENT TO IT ");
    }

    }
    end_f_loop(f_shadow,t_shadow)

    }
    ************************************************************************************************************************
    Implementation of the UDF:
    1) Compile the above UDF and load the library.
    2) Read the case file into Fluent.
    3) Execute the macro "cell_type" through Define---->User-Defined--->Execute-On-Demand.
    4) Cell type is seen in Fluent console.



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