CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   FLUENT (http://www.cfd-online.com/Forums/fluent/)
-   -   Neighbouring Cells (http://www.cfd-online.com/Forums/fluent/43531-neighbouring-cells.html)

Carlos V. January 29, 2007 16:01

Neighbouring Cells
 
Hi everybody:

I'm simulating a reforming system. I need to access some variables (like a User - Defined Scalar quantity) in the neighbouring cells of each cell of my domain. Can anyone help me on this?

Thanks! Carlos V.


Bogdan January 30, 2007 02:59

Re: Neighbouring Cells
 
See the answer http://www.cfd-online.com/Forum/fluent.cgi?read=45754

Carlos V. January 30, 2007 11:26

Re: Neighbouring Cells
 
Thank you very much Bogdan.Can you give an example of a code that uses that implementation to access a variable in a DEFINE_ADJUST macro? I've already tried to implement that in a original code, but had no success! Really need help on this. Thank you once again!

Carlos


Bogdan January 31, 2007 12:05

Re: Neighbouring Cells
 
void neighboringCells(cell_t* n_cell,Thread* n_thread[],cell_t cell,Thread* cell_thread){

/************************************************** *******************************

**This function gets the neighboring cells and threads (if exists) for a given cell

**and thread. The order is left x, right x, back y, front y, bottom x, top z.

**Bogdan Nichita nov.2006****************************************** ****************

**

************************************************** *********************************/

face_t face;

Thread *face_thread;

int n;

real xc[ND_ND],xf[ND_ND];

real min_xf,max_xf,min_yf,max_yf,min_zf,max_zf;

C_CENTROID(xc,cell,cell_thread);

min_xf=max_xf=xc[0];

min_yf=max_yf=xc[1];

min_zf=max_zf=xc[2];

c_face_loop(cell,cell_thread,n)

{

face=C_FACE(cell,cell_thread,n);

face_thread=C_FACE_THREAD(cell,cell_thread,n);

F_CENTROID(xf,face,face_thread);

if (xf[0]>max_xf){

max_xf=xf[0];

if (BOUNDARY_FACE_THREAD_P(face_thread))

{

n_cell[1]=-1;

n_thread[1]=NULL;

}else{

n_cell[1]=F_C1(face,face_thread);

n_thread[1]=THREAD_T1(face_thread);

if (n_cell[1]==cell && n_thread[1]==cell_thread){

n_cell[1]=F_C0(face,face_thread);

n_thread[1]=THREAD_T0(face_thread);

}

}

}

if (xf[0]<min_xf){

min_xf=xf[0];

if (BOUNDARY_FACE_THREAD_P(face_thread))

{

n_cell[0]=-1;

n_thread[0]=NULL;

}else{

n_cell[0]=F_C1(face,face_thread);

n_thread[0]=THREAD_T1(face_thread);

if (n_cell[0]==cell && n_thread[0]==cell_thread){

n_cell[0]=F_C0(face,face_thread);

n_thread[0]=THREAD_T0(face_thread);

}

}

}

if (xf[1]>max_yf){

max_yf=xf[1];

if (BOUNDARY_FACE_THREAD_P(face_thread))

{

n_cell[3]=-1;

n_thread[3]=NULL;

}else{

n_cell[3]=F_C1(face,face_thread);

n_thread[3]=THREAD_T1(face_thread);

if (n_cell[3]==cell && n_thread[3]==cell_thread){

n_cell[3]=F_C0(face,face_thread);

n_thread[3]=THREAD_T0(face_thread);

}

}

}

if (xf[1]<min_yf){

min_yf=xf[1];

if (BOUNDARY_FACE_THREAD_P(face_thread))

{

n_cell[2]=-1;

n_thread[2]=NULL;

}else{

n_cell[2]=F_C1(face,face_thread);

n_thread[2]=THREAD_T1(face_thread);

if (n_cell[2]==cell && n_thread[2]==cell_thread){

n_cell[2]=F_C0(face,face_thread);

n_thread[2]=THREAD_T0(face_thread);

}

}

}

if (xf[2]>max_zf){

max_zf=xf[2];

if (BOUNDARY_FACE_THREAD_P(face_thread))

{

n_cell[5]=-1;

n_thread[5]=NULL;

}else{

n_cell[5]=F_C1(face,face_thread);

n_thread[5]=THREAD_T1(face_thread);

if (n_cell[5]==cell && n_thread[5]==cell_thread){

n_cell[5]=F_C0(face,face_thread);

n_thread[5]=THREAD_T0(face_thread);

}

}

}

if (xf[2]<min_zf){

min_zf=xf[2];

if (BOUNDARY_FACE_THREAD_P(face_thread))

{

n_cell[4]=-1;

n_thread[4]=NULL;

}else{

n_cell[4]=F_C1(face,face_thread);

n_thread[4]=THREAD_T1(face_thread);

if (n_cell[4]==cell && n_thread[4]==cell_thread){

n_cell[4]=F_C0(face,face_thread);

n_thread[4]=THREAD_T0(face_thread);

}

}

}

} }


Carlos V. February 1, 2007 09:45

Re: Neighbouring Cells
 
Thank you very much Bogdan!

I'll see if I can get this to work! Thank you once again.

Carlos Ventura


All times are GMT -4. The time now is 22:00.