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

How to access vertex from face?

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 25, 2021, 01:20
Default How to access vertex from face?
  #1
Member
 
Jun
Join Date: Nov 2015
Posts: 57
Rep Power: 11
mykkujinu2201 is on a distinguished road
Dear forums,

As far as I know, vertex points can be accessed through mesh.points()[cellID].
However, I want to know how to access vertex point directly from faceID.
Furthermore, I want to get vertex coordinates for further calculation.

1. Is there a way to access pointID from faceID or vice versa?
2. Is there a way to access point coordinates from pointID?

primitvePatch seems to be related to this issue but I do not know exactly.

Best,
Jun
mykkujinu2201 is offline   Reply With Quote

Old   June 25, 2021, 07:52
Default
  #2
Senior Member
 
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,714
Rep Power: 40
olesen has a spectacular aura aboutolesen has a spectacular aura about
Quote:
Originally Posted by mykkujinu2201 View Post
Dear forums,

As far as I know, vertex points can be accessed through mesh.points()[cellID].
However, I want to know how to access vertex point directly from faceID.
Furthermore, I want to get vertex coordinates for further calculation.

1. Is there a way to access pointID from faceID or vice versa?
2. Is there a way to access point coordinates from pointID?

primitvePatch seems to be related to this issue but I do not know exactly.

Best,
Jun

It becomes quite easy once you understand how things are put together in OpenFOAM. A face is just a collection of labels (vertex indices) - it doesn't really care what it indexes into.


Suppose you have a face "f" from that you know is from the mesh. In that case the coordinates associated with the face are simply those from the mesh.
Code:
const label faceId = 100;   // face Id in mesh
const face& f = mesh.faces()[faceId];   // face in mesh

Info<< "face point 0: " << f[0] << nl;
Info<< "face point 0 coordinate: " << mesh.points()[ f[0] ] << nl;
olesen is offline   Reply With Quote

Old   June 27, 2021, 05:03
Default
  #3
Member
 
Jun
Join Date: Nov 2015
Posts: 57
Rep Power: 11
mykkujinu2201 is on a distinguished road
Dear Olesen,

Thank you for the reply.

I have more question.

If I am going to compute values at faces using the neighbour and the owner cells in parallel computation, will it work also? or should I do some other treatment?

Best,
Jun
mykkujinu2201 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
how to set periodic boundary conditions Ganesh FLUENT 15 November 18, 2020 07:09
[blockMesh] mergePatchPairs error (please help me out) ramhari OpenFOAM Meshing & Mesh Conversion 16 May 30, 2017 14:42
[blockMesh] error message with modeling a cube with a hold at the center hsingtzu OpenFOAM Meshing & Mesh Conversion 2 March 14, 2012 10:56
gmsh2ToFoam sarajags_89 OpenFOAM 0 November 24, 2009 23:50
[Commercial meshers] Trimmed cell and embedded refinement mesh conversion issues michele OpenFOAM Meshing & Mesh Conversion 2 July 15, 2005 05:15


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