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

Obtaining the number of faces contained in a patch.

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

Reply
 
LinkBack Thread Tools Display Modes
Old   September 30, 2010, 08:56
Question Obtaining the number of faces contained in a patch.
  #1
Senior Member
 
Francois
Join Date: Jun 2010
Posts: 107
Rep Power: 7
Fransje is on a distinguished road
Dear Foamers,

I had two questions related to the information depending on a certain patch.
  • First of all, in order to initialize a variable of the right size, I would like to know the number of faces contained in the patch accessed by:
    Code:
    nbr.boundaryMesh()[nbrPatchID]
    Would somebody happen to know how to do this?
  • Secondly I'm trying to obtain the distance of the faces in that patch to the closest wall. I've been using the wallDist class, with the following command
    Code:
    wallDist myWallDistRoutine(nbrMesh);
    volScalarField myWallDistance= myWallDistRoutine.y();
    Which does the job, but works on the total domain mesh, meaning I have to use some trick to relate the local face index from [nbrPatchI] to the global face index from the entire domain.
    I was therefore wondering whether it might be possible to return a submesh containing the information of [nbrPatchI], of type mesh, and feed that to wallDist to obtain the distance to the closest wall?
I hope my questions were clear enough.. If not so, please let me know.

Thank you for your reply!

Francois.
Fransje is offline   Reply With Quote

Old   September 30, 2010, 20:36
Default
  #2
Senior Member
 
santiagomarquezd's Avatar
 
Santiago Marquez Damian
Join Date: Aug 2009
Location: Santa Fe, Santa Fe, Argentina
Posts: 418
Rep Power: 14
santiagomarquezd will become famous soon enough
Francois, as regards your first question I don't what kind of class is nbr. I'll give you an example with a volScalarField:

T.boundaryField()[nbrPatchID].size()

I think the solution is not far of this. Always remember to look in classes whose your interested in class inherits. In this case size() method is implemented in fvPatch class.

Greetings from Argentina.
__________________
Santiago MÁRQUEZ DAMIÁN, Ph.D.
Post-doctoral Fellow
Research Center for Computational Mechanics (CIMEC) - CONICET/FICH-UNL
T.E.: 54-342-4511594 Ext. 1005
Güemes 3450 - (3000) Santa Fe
Santa Fe - Argentina
http://www.cimec.org.ar

Last edited by santiagomarquezd; October 1, 2010 at 08:17. Reason: Spelling error
santiagomarquezd is offline   Reply With Quote

Old   October 1, 2010, 06:41
Default
  #3
Senior Member
 
Francois
Join Date: Jun 2010
Posts: 107
Rep Power: 7
Fransje is on a distinguished road
Dear Santiago,

Thank you for your reply!
Coincidentally, your example was exactly what I was looking for, as I am trying to modify the velocity field of a volVectorField. It works!

nbrMesh is of type fvMesh, and from that object I'm read a velocity field which I want to adapt. I was trying to get the patch size from the mesh object through the use op some obscure function called .nFaces() contained in primitiveMesh, and inherited via via by fvMesh... How to make your life complicated...

Thanks again for your efficient solution!

Does anybody care to give me some hints on how to proceed with my second question?

Greetings from sunny Holland,

Francois
Fransje is offline   Reply With Quote

Old   October 3, 2010, 11:14
Default
  #4
Senior Member
 
David Gaden
Join Date: Apr 2009
Location: Winnipeg, Canada
Posts: 397
Rep Power: 12
marupio is on a distinguished road
Try whichPatch and whichFace from boundaryMesh.
marupio is offline   Reply With Quote

Old   October 6, 2010, 08:41
Default
  #5
Senior Member
 
Francois
Join Date: Jun 2010
Posts: 107
Rep Power: 7
Fransje is on a distinguished road
Thanks for the tip!
Fransje is offline   Reply With Quote

Reply

Tags
nfaces, walldist

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
How to let the mesh motion solver just solve a small region near a moving boundary? zhajingjing OpenFOAM 8 April 7, 2014 11:10
Problems with mpirun duderino OpenFOAM 17 February 5, 2010 14:00
Using createPatch in place of couplePatches sripplinger OpenFOAM Mesh Utilities 8 November 13, 2009 08:14
Courant number, patches, etc oort OpenFOAM 1 July 24, 2009 18:05
Multicomponent fluid Andrea CFX 2 October 11, 2004 05:12


All times are GMT -4. The time now is 07:31.