Interpolating at centroid of a tetrahedral mesh

Hi
I have a 3D mesh with 4-noded tetrahedral elements. I defined a function/vector evaluated at the vertices of the mesh. I need to interpolate this vector at the centroid of each of the tetrahedral elements. Is there any built-in function to do that? I used pdeintrp for 2D mesh, but not sure if it works for the 3D mesh.
Thanks in advance.

답변 (2개)

Bruno Luong
Bruno Luong 2020년 9월 3일

0 개 추천

The vector at the centroid of the tetrahedron is just the mean of the 4 vectors taken at 4 vertices.
So using MEAN with appropriate indexing and you are OK.

댓글 수: 4

Please correct me if I am wrong. I know the coordinate of the centroid of an element is (mean(x1 to x4), mean(y1 to y4), mean(z1 to z4)).
Does this implies the functional value, say f(x,y,z), at the centroid will be MEAN(f(x1,y1,z1) to f(x4,y4,z4))?
The function f(x,y,z) is not linear.
"Does this implies the functional value, say f(x,y,z), at the centroid will be MEAN(f(x1,y1,z1) to f(x4,y4,z4))?"
Not exactly. The P1 interpolation value of the function f at the centroid (or equivalently the interpolation from the linear method) is MEAN(f(x1,y1,z1) to f(x4,y4,z4)).
The PDE solves by Finte Element Method (FEM) usually assumed P1, or P2 elements depending how you set up the PDE method. For P1 the function is linear on the elements, for P2 it's 2nd order.
So if your vectors at the vertices are from P1 FEM then the mean is the f value so you are correct
If you use P2 or something else then it's not, then you are not correct.
Can you please clarify P1 FEM and P2 FEM?
I am using FEM and the basis functions are linear.
You seem to use loosly the vocabulary. For P1 the basis functions are linear on the elements and continuoius on the entire domain. It's a triangle on 1D and "hat" like in 2D. To simplify this cumbersome description people calls it P1 elements.
The basis functions are NOT linear.

댓글을 달려면 로그인하십시오.

Ravi Kumar
Ravi Kumar 2020년 9월 3일

0 개 추천

You can use interpolateSolution if you are using equation based interfaces to setup the problem. If you are solving a structural or thermal problem, then you can use interpolateDisplacement or interpolateTemperature, respectively.
Regards,
Ravi

카테고리

질문:

2020년 9월 3일

답변:

2020년 9월 3일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by