CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM Programming & Development

Neighbor of a boundary face

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

Reply
 
LinkBack Thread Tools Display Modes
Old   March 9, 2012, 20:36
Default Neighbor of a boundary face
  #1
Senior Member
 
Senthil Kabilan
Join Date: Mar 2009
Posts: 113
Rep Power: 8
skabilan is on a distinguished road
Hi Foamers,

I need to access the neighboring faces of boundary face. I have the following code:

label patchID = mesh.boundaryMesh().findPatchID("walls");
const polyPatch& cPatch = mesh.boundaryMesh()[patchID];
forAll(cPatch, facei)
{
I need to access the neighboring FACES of facei
}

Thanks in advance!
Senthil
skabilan is offline   Reply With Quote

Old   March 10, 2012, 03:36
Default
  #2
Senior Member
 
Join Date: Mar 2011
Posts: 174
Rep Power: 6
anon_a is on a distinguished road
Code:
    List<List<bool> > neighbourFace;                          // a list for each face,
                                                                            // a list of bools for the other faces of the patch
                                                                            // The bool responds to whether they are neighbour faces or not
    label patchID = mesh.boundaryMesh().findPatchID("walls"); 
    const polyPatch& cPatch = mesh.boundaryMesh()[patchID];
    neighbourFace.setSize(cPatch.size());
    forAll(cPatch, faceI)                                             // faceI: the face whose neighbour faces we want
    {
        neighbourFace[faceI].setSize(cPatch.size());
        forAll(cPatch, faceJ)                                         // faceJ: possible neighbour face
        {
            neighbourFace[faceI][faceJ] = false;

            if (faceI != faceJ)                                        // if they are the same, they can't be neighbours
            {
                forAll(cPatch[faceI], pointI)                       // check all points of which faceI consists
                {

                    forAll(cPatch[faceJ], pointJ)                   // and compare them with the ones of faceJ
                    {
                        if (cPatch[faceI][pointI] == cPatch[faceJ][pointJ])
                            {
                                neighbourFace[faceI][faceJ] = true;
                            }
                    }
                }
            }
        }
    }
I have only tested that briefly but it seems to be working.
I check if there are common points but you can easily modify it to check if there are common edges only.
anon_a is offline   Reply With Quote

Old   March 10, 2012, 15:41
Default
  #3
Senior Member
 
Senthil Kabilan
Join Date: Mar 2009
Posts: 113
Rep Power: 8
skabilan is on a distinguished road
Hi anon_a,

Thank you for the help!

Cheers!
Senthil
skabilan is offline   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
mesh airfoil NACA0012 anand_30 OpenFOAM Meshing & Mesh Conversion 12 December 12, 2011 05:16
CFX13 Post Periodic interface EtaEta CFX 7 December 8, 2011 18:15
channelFoam for a 3D pipe AlmostSurelyRob OpenFOAM 3 June 24, 2011 13:06
BlockMesh FOAM warning gaottino OpenFOAM Native Meshers: blockMesh 7 July 19, 2010 14:11
Boundary conditions? Tom Main CFD Forum 0 November 5, 2002 02:54


All times are GMT -4. The time now is 20:30.