Determining cell neighbours on unstructured grid
Hi all.
I want to know is there an efficient way of determining cell neighbours on unstructured grid other than the way in which nodes of (say) hexahedra compared one by one. I mean, hex_1 : node_1, node_2, node_3, node_4 hex_2 : node_5, node_6, node_7, node_8 if hex_1 and hex_2 have 3 nodes in common then they are neighbours. So is there a better way? 
Well, i think it depends on which kind of information you have. In a cellbased solver i think it's much more efficient to deal with faces. In fluent .msh files you have the following kind of information:
nodes: x1 y1 z1 x2 y2 z2 . . . xn yn zn faces: nf1 n_1 n_2 ... n_nf1 c0_f1 c1_f1 nf2 n_1 n_2 ... n_nf2 c0_f2 c1_f2 . . . nfm n_1 n_2 ... n_nfm c0_fm c1_fm where there are n total nodes, m total faces and for the jth face the total number of nodes is nfj In this kind of file you have, for each face, the two neighboring cells (c0_fj c1_fj). Hence, to obtain the information you're looking for, you just need to invert such relationship (once for all). This can be done by allocating an array like: f1_1 f2_1 . . . fk_1 f1_2 f2_2 . . . fk_2 . . . f1_s f2_s . . . fk_s where each row is relative to a cell of the grid. Of course not all the cells will have the same number of faces, so some memory could be wasted. the array is built by a single loop over the faces and, once you have it, you can retrieve the neighbor information trough the 2 previous arrays. If you have a node based solver, this is probably not going to work. In that case you can find some information on the book: R. Lohner: Applied CFD Techniques. An Introduction based on Finite Element Methods. Wiley, 2nd Ed. P.S. I can't think of hexas made up by 4 nodes and sharing each other only 3 nodes. I would change these numbers in 8 and 4 respectively... or maybe hexas in tetra. 
Method is cellcentered. Meshing program is GMSH. The file is msh file. Something like this:
total number of nodes  total number of elements  node_1 x y z . . . line_1 node_# node_# (these lines belong to boundary only!) . . . triangle_1 node_# node_# node_# . . . tetra_1 node_# node_# node_# node_# . . . Thats all. 
I really suggest you to read the book mentioned above, which has algorthmic examples to treat this specific problem. Nonetheless, in this case, you are right: the only way is to check for common nodes as this is the only information you have.

Thank you very much for answering my questions.

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