CFD Online Discussion Forums

CFD Online Discussion Forums (
-   Fluent UDF and Scheme Programming (
-   -   global face number (

Häwimeddel October 6, 2009 10:12

global face number

Is it a feasible approach to determine if two cells of bordering threads are neighbours by finding out if they share a face?

Lets say I have a cell A in thread A and I loop through the faces (four, since 2d). For every face of cell A I loop through all the cells of thread B and see if any one shares this face.

Could this work? Or is the global face number (which can be retrieved with

different for neighbouring cells if they are of different threads?

Häwimeddel October 7, 2009 05:00

It does not work, unfortunately.

But as an easy fix, I just compare the coords of the face centres to determine wether cell are neigbours or not.

Häwimeddel October 7, 2009 09:07

That also did not work. My solution (which works now):


int neighbourcell(cell_t cell0, Thread *thread0, cell_t cell1, Thread *thread1, int n) //put cell pointers and a face index (of cell 0) -> it is estimated if cell 0 is a neighbour of cell 1, connected via face
    Thread *threadf; //face thread of face

    Thread *tc0; //cell threads of neighbours to face
    Thread *tc1; //cell threads of neighbours to face

    face_t face;
    cell_t c0; //neighbour to the face
    cell_t c1; //neighbour to the face

    face = C_FACE(cell0,thread0,n); //the face of cell 1
    threadf = C_FACE_THREAD(cell0,thread0,n); //the face thread of this face

    c0 = F_C0(face,threadf);
    c1 = F_C1(face,threadf);

    tc0 = F_C0_THREAD(face,threadf);
    tc1 = F_C1_THREAD(face,threadf);

    if ( (c0 == cell0 && c1 == cell1 && tc0 == thread0 && tc1 == thread1) || (c0 == cell1 && c1 == cell0 && tc0 == thread1 && tc1 == thread0) )
        return 1;
        return 0;

dmoroian October 20, 2009 03:04

Adjacent cells macros
Did you try these macros:



Häwimeddel October 20, 2009 03:14

Yes, see my code above. And they worked, too! ;)

dmoroian October 20, 2009 03:24

Oh :o
Sorry for missreading your code.

My bad

All times are GMT -4. The time now is 23:06.