|
[Sponsors] |
August 18, 2015, 14:28 |
Cell volume and face area calculation
|
#1 |
New Member
Richard Vega
Join Date: Jun 2014
Location: Texas
Posts: 12
Rep Power: 12 |
Is there a simple way to obtain a list that has the volume of each cell in a mesh along with a list that has the area of each face in a mesh?
|
|
August 18, 2015, 14:37 |
|
#2 |
Senior Member
|
Hi,
1. V method in fvMesh (http://foam.sourceforge.net/docs/cpp...9d5006af5644e5) 2. Sf method in fvMesh (http://foam.sourceforge.net/docs/cpp...121219b4ce84f9) |
|
August 18, 2015, 14:54 |
|
#3 |
New Member
Richard Vega
Join Date: Jun 2014
Location: Texas
Posts: 12
Rep Power: 12 |
Thank you for the quick reply. I probably should have stated somewhere in that question that I have no experience programming in OpenFOAM. The extent of my experience is using standard solvers and utilities, so the links did not mean a while lot to me. Could you add a bit more explanation on how I could use these functions?
|
|
August 18, 2015, 15:04 |
|
#4 | |
Senior Member
|
Quote:
But basically if you have mesh object or type fvMesh (usually you have it in solvers and in most of utilities), then if you would like to iterate over cell volumes, you can use something like: Code:
forAll(mesh.V(), idx) { Info<< "Volume of cell with index " << idx << " is " << mesh.V()[idx] << end; } |
||
August 18, 2015, 15:10 |
why I need them...
|
#5 |
New Member
Richard Vega
Join Date: Jun 2014
Location: Texas
Posts: 12
Rep Power: 12 |
I am using OpenFOAM only as a pre and post processor to my code, which is written in C/OpenCL. Somewhere in my code, I am calculating the volumes and areas and I am getting some strange results that I believe are a result of the 5 digit precision in the points file. I wanted to use OpenFOAM to calculate the volumes and areas to see if this a bug in my code, or indeed the precision issue I am suspecting. Thus, I was hoping for sort of a one-liner that would generate a file called "volumes," but I guess no dice. I will try your suggestion tonight.
|
|
August 18, 2015, 15:46 |
|
#6 |
Senior Member
|
If you just need to look at the list of volumes you can use
Code:
Info << mesh.V() << endl; |
|
April 7, 2021, 07:08 |
|
#7 | |
New Member
Jingna Pan
Join Date: Nov 2019
Posts: 3
Rep Power: 6 |
Quote:
I tried to compile the utility but encountered the following error. I appreciate if you could give any hints. FYI: I am using openfoam 5 and Ubuntu 20.04. write_cell_volumes_and_face_areas.cpp:6:10: fatal error: OFstream.H: No such file or directory 6 | #include "OFstream.H" | ^~~~~~~~~~~~ compilation terminated. |
||
Tags |
face area cell volume |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[Other] mesh airfoil NACA0012 | anand_30 | OpenFOAM Meshing & Mesh Conversion | 13 | March 7, 2022 18:22 |
how to set periodic boundary conditions | Ganesh | FLUENT | 15 | November 18, 2020 07:09 |
[blockMesh] error message with modeling a cube with a hold at the center | hsingtzu | OpenFOAM Meshing & Mesh Conversion | 2 | March 14, 2012 10:56 |
fluent add additional zones for the mesh file | SSL | FLUENT | 2 | January 26, 2008 12:55 |
[blockMesh] Axisymmetrical mesh | Rasmus Gjesing (Gjesing) | OpenFOAM Meshing & Mesh Conversion | 10 | April 2, 2007 15:00 |