CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM (
-   -   Interpolation on a curved patch (

fumiya September 5, 2012 21:58

Interpolation on a curved patch

I want to calculate values at points on a patch by interpolation
using only the boundaryField values (not using internalField values at all).
My target patch is a *curved* surface (not a plane) and the values at
the nodal points on this patch are known.

Is it possible to do above interpolation in OpenFOAM?
If so, which utility should I use?


bigphil September 6, 2012 03:29

Hi Fumiya,

you could use the primitivePatchInterpolation class. This class allows interpolation of data from patch face centre to patch points (and vice-versa).

Here is an example:

//- find label of patch
label patchID = mesh.boundaryMesh().findPatchID("patchOfInterest");
if(patchID == -1)
  FatalError << "Patch not found!" << exit(FatalaError);

//- create interpolator
primitivePatchInterpolation myPatchInterpolator(mesh.boundaryMesh()[patchID]);

//- perform interpolation of vectorField U from patch faces to points
vectorField patchUAtPoints = myPatchInterpolator.faceToPointInterpolate<vector>

Place the line #include "primitivePatchInterpolation.H" at the top of your program under #included "fvCFD.H".

The primitivePatchInterpolation class uses the inverse-distance method to interpolate the data, so it is quite accurate on orthogonal grids but can have errors on meshes with considerably skewed/non-orthgonal faces/cells.

Hope it helps,

fumiya September 11, 2012 06:29

Hi Philip,

Thank you for your information. I'll give it a try.


All times are GMT -4. The time now is 11:08.