OpenFOAM guide/Interpolation (by cell)

From OpenFOAMWiki
< OpenFOAM guide
Revision as of 19:20, 30 June 2010 by Marupio (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
This article is about the interpolation class in OpenFOAM's libfiniteVolume. For other uses, see Interpolation (disambiguation).

This article refers to classes in the interpolation (by cell) family, which includes:

  • interpolation (abstract base class);
  • interpolationCell;
  • interpolationCellPoint; and
  • interpolationCellPointFace.

These classes all perform linear interpolation on a volume field, given a cell and arbitrary location within that cell. Used by meshToMeshInterpolation. They are primarily employed by post-processing sampling utilities, such as sample.

1 interpolation (base class)

This class holds a reference to a volume field, and explicitly holds references to some of its components. It is an abstract base class that provides an interface for the other classes in this family.

2 interpolationCell

This class is an implementation of a nearest-cell interpolation, and although it appears trivial (i.e. interpolating to the nearest cell in a class that requires the cell index as a parameter!), when loaded by runTime selection by a post-processing utility, this class basically turns off interpolation. There are no explicit manifestations of this class in OpenFOAM - it is loaded exclusively by runTime selection.

3 interpolationCellPoint

Interpolate to an arbitrary location within a cell. This class works by:

  • breaking each face down into triangles;
  • defining tetrahedra using these triangles and the cell centre-point;
  • cycling through all tetrahedra to find which encloses the arbitrary point; and
  • using inverse distance weights to perform linear interpolation.

4 interpolationCellPointFace

Given an arbitrary point within the cell, find the nearest point on one of its faces. This class works by:

  • finding a candidate face by projecting a line from the cell-centre through the arbitrary point;
  • decomposing the cell face into traingles that include the face centre-point and two vertices;
  • defining tetrahedra using these triangles and the cell centre-point;
  • searches for the tetrahedron enclosing the point;
  • if this fails, it repeats this for all faces;
  • if the face is not an empty fvpatch, it returns the normal projection of the point onto the selected face;
  • if the face is an empty fvpatch, it returns the cell centre instead.