Interpolation on Triangles
This tutorial is devoted to the implementation of an interpolation algorithm for two dimensional simplicial topologies (triangle elements). Scalar and vectorial functions given on vertices can be interpolated to the complete domain. Using point location each point can be assigned a covering cell which covers interpolation coefficients. The source files from the last tutorials can be used.
Tasks
- L1: Create a quantity scalar field and assign the values
and store it on the vertices. - L1: Create a quantity vector field and assign the value
and store it on the vertices. - L2: Derive a formula for linear interpolation on a triangle. The general linear interpolation for two dimensional functions yields
. Given that the function has to be identical to the vertex values in the vertices, the free coefficients a, b, and c can be determined. - Implement an algorithm which calculates the 3 coefficients and store them on each cell using the names a, b, and c.
- L2: Test your implementation using the linear field g. All coefficients a, b, and c have to be constant throughout the field region (a=0, b=3, c=4).
- L2: Implement a function which determines if a geometrical point is contained in a cell(triangle)
- L2: Implement a function which determines the triangle of the domain which contains a certain point (simple point location)
- L2: Use the point location in order to determine the interpolated value. Compare these results to the analytical result.
Hints
Each triangle consists of 3 vertices so you have 3 equations for each of the vertices.
Solve this equation system for a, b, c