|
[Sponsors] |
face centroid values using mesh.Cf() giving wrong output |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
September 24, 2017, 12:21 |
face centroid values using mesh.Cf() giving wrong output
|
#1 |
Member
Phanindra
Join Date: Jan 2013
Posts: 39
Rep Power: 13 |
Hi foamers,
I tried to print out the face centroid values on a plane with fixed X value and lying on Y-axis. I used the code snippet: { label patchID=mesh.boundaryMesh().findPatchID("left_wall "); const labelList& own = mesh.faceOwner(); forAll(mesh.boundaryMesh()[patchID].faceCells(),cellf) { Info<<mesh.Cf()[own[cellf]]<<endl; } } I'm used 10 cells in Y-direction . The length in Y-Direction is 1.0 starting from origin. I'm getting following output: (0.05 0.1 0.05) (0.05 0.1 0.05) (0.025 0.2 0.05) (0.025 0.2 0.05) (0.1 0.1 0.05) (0.1 0.1 0.05) (0.075 0.2 0.05) (0.075 0.2 0.05) (0.15 0.1 0.05) (0.15 0.1 0.05) I don't see the X value being same (which it is supposed to be 0.0) neither the Y -value varying from 0 to 1 as 0,0.1,0.2 etc.... Can anyone of you tell me where I went wrong ? Regards, Phanindra |
|
September 25, 2017, 04:28 |
|
#2 |
Senior Member
Hrvoje Jasak
Join Date: Mar 2009
Location: London, England
Posts: 1,905
Rep Power: 33 |
Think about it. Cf is a surfaceVector Field, meaning that it is defined on FACES. You are asking the patch for CELLS that are next to the patch faces:
const labelList& own = mesh.faceOwner(); and then addressing owner (which gives you a CELL index) into a list which is defined in FACES. Enough said.
__________________
Hrvoje Jasak Providing commercial FOAM/OpenFOAM and CFD Consulting: http://wikki.co.uk |
|
September 25, 2017, 07:59 |
Hi
|
#3 |
Member
Phanindra
Join Date: Jan 2013
Posts: 39
Rep Power: 13 |
I was trying with many alternatives but couldn't find one. Can you tell me how to solve this problem please.
|
|
February 29, 2024, 08:13 |
|
#4 |
New Member
Thushadh Wijesekere
Join Date: Jan 2024
Location: Lund, Sweden
Posts: 1
Rep Power: 0 |
It should be like this for someone who has run into the same problem:
Code:
const surfaceVectorField Cfs = mesh.cf(); forAll(Cfs, faceI) { vector Cf = Cfs[faceI]; Info << "centroid of face " << faceI << " = " << Cf << nl << endl; } Last edited by theDoomGuy; February 29, 2024 at 08:17. Reason: The code works only for internal faces. |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
udf error | srihari | FLUENT | 1 | October 31, 2016 14:18 |
gmsh2ToFoam | sarajags_89 | OpenFOAM | 0 | November 24, 2009 22:50 |
[blockMesh] BlockMeshmergePatchPairs | hjasak | OpenFOAM Meshing & Mesh Conversion | 11 | August 15, 2008 07:36 |
[blockMesh] Axisymmetrical mesh | Rasmus Gjesing (Gjesing) | OpenFOAM Meshing & Mesh Conversion | 10 | April 2, 2007 14:00 |
[Commercial meshers] Trimmed cell and embedded refinement mesh conversion issues | michele | OpenFOAM Meshing & Mesh Conversion | 2 | July 15, 2005 04:15 |