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

Neighbor of a boundary face

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 9, 2012, 19:36
Default Neighbor of a boundary face
  #1
Senior Member
 
Senthil Kabilan
Join Date: Mar 2009
Posts: 113
Rep Power: 17
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, 02:36
Default
  #2
Disabled
 
Join Date: Mar 2011
Posts: 174
Rep Power: 15
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, 14:41
Default
  #3
Senior Member
 
Senthil Kabilan
Join Date: Mar 2009
Posts: 113
Rep Power: 17
skabilan is on a distinguished road
Hi anon_a,

Thank you for the help!

Cheers!
Senthil
skabilan is offline   Reply With Quote

Reply


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
[Other] mesh airfoil NACA0012 anand_30 OpenFOAM Meshing & Mesh Conversion 13 March 7, 2022 17:22
CFX13 Post Periodic interface EtaEta CFX 7 December 8, 2011 17:15
channelFoam for a 3D pipe AlmostSurelyRob OpenFOAM 3 June 24, 2011 13:06
[blockMesh] BlockMesh FOAM warning gaottino OpenFOAM Meshing & Mesh Conversion 7 July 19, 2010 14:11
Boundary conditions? Tom Main CFD Forum 0 November 5, 2002 01:54


All times are GMT -4. The time now is 21:11.