CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Main CFD Forum (https://www.cfd-online.com/Forums/main/)
-   -   Volume of general hexahedron (https://www.cfd-online.com/Forums/main/163122-volume-general-hexahedron.html)

prak_1989 November 23, 2015 10:23

Volume of general hexahedron
 
Hi all,

How to calculate the volume of a general hexahedron whose faces are of different shapes and the four edges connecting the top and bottom surfaces are of different lengths and are not parallel to each other. Hope you could imagine that hexahedron :)

mprinkey November 23, 2015 15:35

Quote:

Originally Posted by prak_1989 (Post 574601)
Hi all,

How to calculate the volume of a general hexahedron whose faces are of different shapes and the four edges connecting the top and bottom surfaces are of different lengths and are not parallel to each other. Hope you could imagine that hexahedron :)

I'm no expert in computational geometry, but there is simple formula for computing volumes of tetrahedra. I wrote a library some time ago that implemented the tet formula for volume. Then I implemented the volume of a pyramid (one quad base and four triangular faces) as the sum of the volume of two tets. Then, I implemented the hex volume as the sum of three pyramid volumes (pick three faces that all touch each other at edges use those as the base for each. Use the opposite corner as top point for all three pyramids).

This all assumes that the faces are quadrilateral--I think that is a geometric requirement. If one face has four sides, I think they all do. You can build a six-sided volume using six triangles too. The above formula doesn't handle that case. Also, these quadrahedra must have vertices that are co-planar. This is probably not the most efficient way to compute the volume of general hexs, but it is more fool-proof than directly implementing a hex volume formula using a set of eight vectors. I generally only compute the volumes as part of the initialization process, so correctness is more important than absolute performance.

FMDenaro November 23, 2015 17:17

Quote:

Originally Posted by mprinkey (Post 574650)
I'm no expert in computational geometry, but there is simple formula for computing volumes of tetrahedra. I wrote a library some time ago that implemented the tet formula for volume. Then I implemented the volume of a pyramid (one quad base and four triangular faces) as the sum of the volume of two tets. Then, I implemented the hex volume as the sum of three pyramid volumes (pick three faces that all touch each other at edges use those as the base for each. Use the opposite corner as top point for all three pyramids).

This all assumes that the faces are quadrahedral--I think that is a geometric requirement. If one face has four sides, I think they all do. You can build a six-sided volume using six triangles too. The above formula doesn't handle that case. Also, these quadrahedra must have vertices that are co-planar. This is probably not the most efficient way to compute the volume of general hexs, but it is more fool-proof than directly implementing a hex volume formula using a set of six vectors. I generally only compute the volumes as part of the initialization process, so correctness is more important than absolute performance.


I agree to the technique of decomposition in tetrahedra... it is very simple computing the volumes by using the 4-node based formula on each tetrahedron covering the grid and then computing volumes of of more complex shapes

prak_1989 November 24, 2015 05:14

@mprinkey and @FMDenaro: Thank you for the spark. I did not think that way...!!

sbaffini November 25, 2015 02:56

Consider the following approach:

http://www.dept.ku.edu/~cfdku/papers/1999-AIAAJ.pdf

after splitting the hexahedron faces in triangles (along the diagonal)

prak_1989 November 30, 2015 07:44

Thank you very much..!!

heySourabh April 16, 2018 20:18

The method by @mprinkey is an interesting decomposition. However, probably this method will not work in case of non-convex hexahedra, as it will result in negative volumes being added. I have written a simple document at https://github.com/heySourabh/GeometryCalculations/tree/master/Stokes which provides a generic method with code. May be helpful to someone looking for this.


All times are GMT -4. The time now is 05:42.