CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > FLUENT

Neighbouring Cells

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   January 29, 2007, 16:01
Default Neighbouring Cells
  #1
Carlos V.
Guest
 
Posts: n/a
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.

  Reply With Quote

Old   January 30, 2007, 02:59
Default Re: Neighbouring Cells
  #2
Bogdan
Guest
 
Posts: n/a
See the answer http://www.cfd-online.com/Forum/fluent.cgi?read=45754
  Reply With Quote

Old   January 30, 2007, 11:26
Default Re: Neighbouring Cells
  #3
Carlos V.
Guest
 
Posts: n/a
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

  Reply With Quote

Old   January 31, 2007, 12:05
Default Re: Neighbouring Cells
  #4
Bogdan
Guest
 
Posts: n/a
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);

}

}

}

} }

  Reply With Quote

Old   February 1, 2007, 09:45
Default Re: Neighbouring Cells
  #5
Carlos V.
Guest
 
Posts: n/a
Thank you very much Bogdan!

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

Carlos Ventura
  Reply With Quote

Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Import netgen mesh to OpenFOAM hsieh Open Source Meshers: Gmsh, Netgen, CGNS, ... 32 September 13, 2011 05:50
snappyHexMesh won't work - zeros everywhere! sc298 OpenFOAM Native Meshers: snappyHexMesh and Others 2 March 27, 2011 21:11
snappyHexMesh aborting Tobi OpenFOAM Native Meshers: snappyHexMesh and Others 0 November 10, 2010 04:23
external flow with snappyHexMesh chelvistero OpenFOAM 11 January 15, 2010 20:43
physical boundary error!! kris CD-adapco 2 August 3, 2005 00:32


All times are GMT -4. The time now is 03:43.