Cell volume and face area calculation
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?
|
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) |
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?
|
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) |
why I need them...
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.
|
1 Attachment(s)
If you just need to look at the list of volumes you can use
Code:
Info << mesh.V() << endl; |
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. |
All times are GMT -4. The time now is 02:17. |