CFD Online Logo CFD Online URL
Home > Forums > OpenFOAM Programming & Development

Face IDs for cells at boundary patch

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

LinkBack Thread Tools Display Modes
Old   June 17, 2016, 17:56
Default Face IDs for cells at boundary patch
New Member
Praveen Srikanth
Join Date: Jul 2012
Location: West Lafayette, IN
Posts: 23
Rep Power: 7
praveensrikanth91 is on a distinguished road
Hello Forum users,

I am working with the conjugate heat transfer solver where I am trying to find the temperature at a liquid vapor interface by interpolating the temperatures from the liquid and the gas regions and taking an average. I interpolate the temperatures with

surfaceScalarField TI_liquid = fvc::interpolate(liquidT); 
surfaceScalarField TI_gas = fvc::interpolate(gasT);
but this does it for the entire region. I also know the cells next to the boundary which I get using the respective patchIDs

const labelList& gasPFaceCells = gasMesh_.boundary()[gasPatchID_].faceCells();
But I am not sure how to find the face IDs for the boundary faces for these cells which I can then use to get the interpolated temperature at the boundary. I have been going through this forum without much luck so any help is most appreciated
praveensrikanth91 is offline   Reply With Quote

Old   June 23, 2016, 07:13
Join Date: Oct 2012
Location: Darmstadt, Germany
Posts: 66
Rep Power: 7
vigneshTG is on a distinguished road
If you have not figured it out,

//To access the mesh information for the boundary
const polyPatch& cPatch = mesh.boundaryMesh()[patchI];

//Starting index of the face in a patch
label faceId_start = cPatch.start() ;

List of cells close to a boundary
const labelUList& faceCells = cPatch.faceCells();

forAll(cPatch, faceI) 
// index of each face
label faceID = faceId_start +faceI;

//id of the owner cell having the face
label faceOwner = faceCells[faceI] ;



If there is a better way, do let me know !!
Thanks and Regards

vigneshTG is offline   Reply With Quote

Old   July 6, 2016, 11:55
New Member
Praveen Srikanth
Join Date: Jul 2012
Location: West Lafayette, IN
Posts: 23
Rep Power: 7
praveensrikanth91 is on a distinguished road
Hey Vignesh,

Thank you so much for that. I did not realise that the face numbers on the patch were going to be continuous.
	const cell& gasFaces = gasMesh_.cells()[gasPfCellI];
	label gasfaceI = 0;

	forAll(gasFaces, i)
		label gasPatchI = gasMesh_.boundaryMesh().whichPatch(gasFaces[i]);
		if(gasPatchI == gasPatchID_)
			gasfaceI = gasFaces[i];
			Info<<"gasFaceI = "<< gasfaceI<<endl;
I used boundary().faceCells() on the boundary patches to get the cells on the boundary like you did. It seems to work fine as far as I can see. I will let you know if I find something wrong with it. Thanks again.
praveensrikanth91 is offline   Reply With Quote


boundary cell, chtmultiregionfoam, conjugate heat transfer, face

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
Wedge patch '*' is not planar LilumDaru OpenFOAM Meshing & Mesh Conversion 4 May 21, 2016 07:50
Problems setting up case for running with chtMultiRegionFoam (mesh is from Salome) esujby OpenFOAM Pre-Processing 29 January 31, 2016 14:09
how to set periodic boundary conditions Ganesh FLUENT 13 January 22, 2014 05:11
Error finding variable "THERMX" sunilpatil CFX 8 April 26, 2013 07:00
Import problem ARC Open Source Meshers: Gmsh, Netgen, CGNS, ... 0 February 27, 2010 11:56

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