CFD Online Logo CFD Online URL
Home > Forums > OpenFOAM Running, Solving & CFD

How to get the face numbers of a boundary?

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

LinkBack Thread Tools Display Modes
Old   March 23, 2009, 04:19
Default How to get the face numbers of a boundary?
New Member
Shui Pei
Join Date: Mar 2009
Posts: 22
Rep Power: 10
spwater is on a distinguished road
I knew I can check the polyMesh directory, however now I am tyring to modify boundary in the solver, and it will deal with different meshes, so which function should I use?
By the way, is their any documents to introduce some common function used in Openfoam, I really don't want to trouble someone...

With regards.

spwater is offline   Reply With Quote

Old   March 24, 2009, 02:01
Wink face number for boundary mesh
Su Xiaohui
Join Date: Mar 2009
Location: Singapore
Posts: 30
Rep Power: 10
sxhdhi is on a distinguished road
Send a message via Skype™ to sxhdhi

try to go through the below code maybe you can learn something for your question.

label patchInletWaterID = mesh.boundaryMesh().findPatchID("outletWater");
const polyPatch& cInletWaterPatch = mesh.boundaryMesh()[patchInletWaterID];
vectorField inletWaterFaceCentres(mesh.C().boundaryField()[patchInletWaterID]);
scalarField inletWaterY(inletWaterFaceCentres.component(vector ::Y));
scalarField inletWaterX(inletWaterFaceCentres.component(vector ::X));

forAll(cInletWaterPatch, faceI)
scalar YWaterpos(inletWaterY[faceI]);
scalar XWaterpos(inletWaterX[faceI]);
vector faceWaterU(vector::zero);

if (YWaterpos<=0.2)
// U.boundaryField()[patchInletWaterID][faceI] = faceWaterU;
// pd.boundaryField()[patchInletWaterID][faceI] = rho.boundaryField()[patchInletWaterID][faceI] *-gh.boundaryField()[patchInletWaterID][faceI];
pd.boundaryField()[patchInletWaterID][faceI] = 0.5*rho.boundaryField()[patchInletWaterID][faceI]*faceWaterU.x()*faceWaterU.x();
// p.boundaryField()[patchInletWaterID][faceI] = 2*pd.boundaryField()[patchInletWaterID][faceI];
cout<< "I am here to change pd value x,y"<<XWaterpos<<"\t"<<YWaterpos<<"\n";
cout<< "gh:="<<gh.boundaryField()[patchInletWaterID][faceI]<<"\n";
cout<< "gamma:="<< gamma.boundaryField()[patchInletWaterID][faceI]<<"\n";
cout<< "rho:="<< rho.boundaryField()[patchInletWaterID][faceI]<<"\n";
cout<<"pd="<<pd.boundaryField()[patchInletWaterID][faceI]<<" P="<<p.boundaryField()[patchInletWaterID][faceI]<<"\n";

sxhdhi is offline   Reply With Quote


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
Face ordering problem for nonrectangular cyclic boundary conditions cfdmarkus OpenFOAM Other Meshers: ICEM, Star, Ansys, Pointwise, GridPro, Ansa, ... 3 August 17, 2011 15:07
Internal boundary problem stefanke OpenFOAM Other Meshers: ICEM, Star, Ansys, Pointwise, GridPro, Ansa, ... 2 May 24, 2011 02:21
BlockMesh FOAM warning gaottino OpenFOAM Native Meshers: blockMesh 7 July 19, 2010 14:11
Boundary condition vector field gradient from two sides of patch face quba OpenFOAM 0 December 12, 2007 06:26
Gambit: face mesh starts at edge, not boundary lr Chris Bailey FLUENT 0 December 5, 2005 14:50

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