How to get mesh total volume quickly?
Hi,
What's the fastest way to get the total volume of a mesh precisely (sum of volume of each cell)? I know checkMesh is giving Mesh total volume but i'm not sure if it's really mesh total volume or volume of bounding box .. Thank you! |
What software are you using to generate the mesh? It may provide the appropriate utilities for doing a volume calculation.
|
checkMesh gives the volume of the mesh not the bounding box
you can easily calculate the volume of the bounding box yourself.. compare with checkMesh volume given |
Dear Foamers,
I would like to get the total volume of a solution domain. I tried Code:
scalar totalVolume(0.0); Then I found this last answer and hence I tried to get it with 'checkMesh'. Unfortunately, I can't find the code snippet in the folder /OpenFOAM-3.0.1/applications/utilities/mesh/manipulation/checkMesh/ using e.g.: grep -nr "volume" Can you please show me, where they hid it? :) Regards, Peter |
Hi,
Why have you decided to iterate over strange cells() list? This does the job: Code:
scalar vol = 0.0; Code:
scalar vol = gSum(mesh.V()); Code:
scalar vol = sum(mesh.V()); Also it is up to you to check if you run 2D axisymmetric case and multiply result to get real mesh volume. Answering you last question: it is in primitiveMeshCheck.C (http://foam.sourceforge.net/docs/cpp...ce.html#l00318). |
Thanks Alexey,
it works :) (I use Code:
scalar vol = gSum( mesh_.V() ); |
All times are GMT -4. The time now is 12:40. |