CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT > Fluent UDF and Scheme Programming

adjacent cells (neighbor cells)

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 12, 2012, 04:09
Default adjacent cells (neighbor cells)
  #1
New Member
 
onlyou
Join Date: Mar 2012
Posts: 1
Rep Power: 0
onlyou1221 is on a distinguished road
Hi,
I want to obtain the adjacent cells of a cell (cells connected to each nodes not only faces), I loop over all cells, check to see if a cell shares any nodes with the cell of interest, and save a array of the ones that do. But I found taht the array (neighbourcell[Ncell][NeighC] in code) doesn't contain all the adjacent cells and I don't know why, please help me, thanks!
Code:
#include "udf.h"
#define Ncell 100000 /*number of cells*/
#define NeighC 26 /*maximun number of adjacent cells*/
cell_t c1,c2,neighbourcell[Ncell][NeighC];
Thread *t;
int ii,jj,kk;
DEFINE_INIT(init,domain)
{
 for(ii=0;ii<Ncell;ii++)
  for(jj=0;jj<NeighC;jj++)
   neighbourcell[ii][jj]=-1;
 thread_loop_c(t,domain)
 {
  begin_c_loop(c1,t)/*loop_c1*/
  {
   kk=0;
   begin_c_loop(c2,t)
   {
    for(ii=0;ii<C_NNODES(c1,t);++ii)
     for(jj=0;jj<C_NNODES(c2,t);++jj)
      if(C_NODE(c1,t,ii)==C_NODE(c2,t,jj))/*share Node;*/
      {
       neighbourcell[c1][kk]=c2;
       kk++;
       break;
      }
    if(C_NODE(c1,t,ii)==C_NODE(c,t,jj)) break;/*exit loop_c1*/
   }
   end_c_loop(c2,t)
  }
  end_c_loop(c1,t)
 }
}

Last edited by onlyou1221; March 12, 2012 at 06:59.
onlyou1221 is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
[snappyHexMesh] No layers in a small gap bobburnquist OpenFOAM Meshing & Mesh Conversion 6 August 26, 2015 09:38
[Netgen] Import netgen mesh to OpenFOAM hsieh OpenFOAM Meshing & Mesh Conversion 32 September 13, 2011 05:50
[snappyHexMesh] snappyHexMesh won't work - zeros everywhere! sc298 OpenFOAM Meshing & Mesh Conversion 2 March 27, 2011 21:11
[snappyHexMesh] snappyHexMesh aborting Tobi OpenFOAM Meshing & Mesh Conversion 0 November 10, 2010 03:23
physical boundary error!! kris Siemens 2 August 3, 2005 00:32


All times are GMT -4. The time now is 15:45.