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

Number of cells adjacent to a patch

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 27, 2019, 12:43
Default Number of cells adjacent to a patch
  #1
Member
 
Join Date: Feb 2018
Posts: 91
Rep Power: 8
charles4allme is on a distinguished road
Hi,

I would really appreciate it, if anyone can tell me how to find the number of cells adjacent to a patch. I would like to loop around the cells for my boundary condition.

Thanks
charles4allme is offline   Reply With Quote

Old   September 29, 2019, 21:50
Default
  #2
Senior Member
 
Join Date: Aug 2015
Posts: 494
Rep Power: 15
clapointe is on a distinguished road
You can probably use something like this :

Code:
        Foam::label patchI = mesh.boundaryMesh().findPatchID("patch");
        const Foam::fvPatch& currPatch = mesh.boundary()[patchI];

	forAll(currPatch,facei){
	    face faceI = currPatch[facei]; //face
	}

        const labelUList& faceCells = currPatch.faceCells();

        Info << "number of adjacent cells : " << faceCells.size(). //number of adjacent cells
I've not tested this, but I tried to piece together code that exists elsewhere in OpenFOAM. In any case, a forAll loop can be used to loop through patch faces and faceCells lets you access adjacent cells.

Caelan
clapointe 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
[snappyHexMesh] Error snappyhexmesh - Multiple outside loops avinashjagdale OpenFOAM Meshing & Mesh Conversion 53 March 8, 2019 10:42
parallel run OpenFoam Srinath Reddy OpenFOAM Running, Solving & CFD 13 February 27, 2019 10:15
[snappyHexMesh] SHM Layer Addition Phase dickcruz OpenFOAM Meshing & Mesh Conversion 4 November 1, 2018 08:05
[snappyHexMesh] SnappyHexMesh for internal Flow vishwa OpenFOAM Meshing & Mesh Conversion 24 June 27, 2016 09:54
[mesh manipulation] Importing Multiple Meshes thomasnwalshiii OpenFOAM Meshing & Mesh Conversion 18 December 19, 2015 19:57


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