CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (https://www.cfd-online.com/Forums/fluent-udf/)
-   -   How to identify the cells near the interface? (https://www.cfd-online.com/Forums/fluent-udf/74758-how-identify-cells-near-interface.html)

legendyxg April 8, 2010 02:53

How to identify the cells near the interface?
 
Dear All

Here is my question. There are two regions A and B with an interior interface I in my model. Now I want to identify the neighboring cells near the interface, so that I can add an source term into these cells. How can I identify these cells?

Thank u very much!

Xiaoguang

gearboy April 8, 2010 04:35

Quote:

Originally Posted by legendyxg (Post 253701)
Dear All

Here is my question. There are two regions A and B with an interior interface I in my model. Now I want to identify the neighboring cells near the interface, so that I can add an source term into these cells. How can I identify these cells?

Thank u very much!


Xiaoguang

You can define the face as interior in Gambit. Then it will have an id in fluent.
Use Lookup_Thread(id) to get the face.
Use F_C0, F_C1 to get the neighbour cells

iteration July 11, 2016 11:32

I'm facing a pursuing problem:

I want to access the value of a UDM C_UDMI(c,t,1) in an adjacent cell across an interface.

I use the following code snippet in my UDF:

Code:

tm = THREAD_SUPER_THREAD(thread);

c_face_loop(cell,thread,indexnum)
{
    f = C_FACE(cell,thread,indexnum);
    tf = C_FACE_THREAD(cell,thread,indexnum);
    if (THREAD_TYPE(tf)==THREAD_F_WALL)
    {
        a[indexnum] = 1.0;
    }
    else
    {
        cell0 = F_C0(f,tf);
        cell1 = F_C1(f,tf);
        if (!BOUNDARY_FACE_THREAD_P(tf) && (cell0!=cell))
        {
            a[indexnum] = C_UDMI(cell0,tm,0);
        }
        else if (!BOUNDARY_FACE_THREAD_P(tf) && (cell1!=cell))
        {
            a[indexnum] = C_UDMI(cell1,tm,0);
        }
        else if (BOUNDARY_FACE_THREAD_P(tf) && (cell0!=cell))
        {
            a[indexnum] = C_UDMI(cell0,tm,1);
        }
        else if (BOUNDARY_FACE_THREAD_P(tf) && (cell1!=cell))
        {
            a[indexnum] = C_UDMI(cell1,tm,1);
        }
    }
}

Then I'm looking for the min. value b in a with

Code:

n = C_NFACES(cell,thread);
b = a[0];
for (i = 1; i < n; i++)
{
    if (a[i] < b)
    {
        b = a[i];
    }
}

...but I'm always getting the value 0, while C_UDMI(c,t,0) and C_UDMI(c,t,1) are still greater than 0.

I also should mention that I'm using the mixture model (the UDF refers to the secondary phase, see THREAD_SUPER_THREAD) and that C_UDMI(c,t,0), C_UDMI(c,t,1) and a[9] are initialized with the value 1.0 in the first time step.

Where does this contradiction come from and how can I manage to access the right value across the interface?
I'm thanking you in anticipation.


All times are GMT -4. The time now is 09:56.