|
[Sponsors] |
June 25, 2021, 01:20 |
How to access vertex from face?
|
#1 |
Member
Jun
Join Date: Nov 2015
Posts: 57
Rep Power: 11 |
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 |
|
June 25, 2021, 07:52 |
|
#2 | |
Senior Member
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,714
Rep Power: 40 |
Quote:
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; |
||
June 27, 2021, 05:03 |
|
#3 |
Member
Jun
Join Date: Nov 2015
Posts: 57
Rep Power: 11 |
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 |
|
|
|
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 |