Cell centres
Hi, what is the most accurate method to calculate the centre of a general polyhedral cell?

Re: Cell centres
Divide it into tetrahedrals and calculate the individual tetra center: the polyhedral center is sumup(ViCi)/sumup(Vi), where Vi is volume of each tetra, and Ci is the center of each tetra.

Re: Cell centres
Thank you. Will do, but how do I calculate the centre of a tet?

Re: Cell centres
...and the volume of a tet for that matter?
thank you 
Re: Cell centres
the centroid of a tet (or any simplex, the tet being a 3D simplex) is the arithmetic average of [the position vectors representing] its vertices. note that such a statement is not in general true for polytopes other than simplices, which is why you have to decompose a general polyhedron into tets.
pick any vertex of the tet. label it "O". label, in any order, the other three vertices "A", "B", "C". denote the vector from O to A by the label "a", from O to B by "b", similarly "c". the volume of the tet is onesixth of the magnitude of the scalar or "box" product of the three vectors a, b, c. that is, volume(OABC)=a.(bxc)/6. (the analogous formula for a triangle embedded in 3D is that the area of triangle OAB is half the magnitude of the crossproduct of a and b, that is, area(OAB)=axb/2.) the decomposition of general polyhedra into the union of tetrahedra with plane faces is not in general exact. for example, if a polyhedron has a quadrilateral for a side, the vertices of the quad need not lie in a plane. then the decomposition of the quad into two or more tets is only an approximation. these issues have been noted in old papers, and are probably discussed in any CFD text that explains unstructured meshes. also probably covered previously in this forum (do a search). 
Re: Cell centres
Another means is to calculate the determinate of the following expression:
V=(1/6)*x1 y1 z1 1  x2 y2 z2 1  x3 y3 z3 1  x4 y4 z4 1  where the x, y & z's are the coordinates of the respective points defining the tetrahedron. Note that the volume will always be positive, even though the value of the determinate might be negative depending upon the ordering of the points. 
All times are GMT 4. The time now is 19:58. 