Interpolation/Kriging

I have a complex unstructured mesh that I would like to shade with field measurements. However, those are at only select locations. They can be assigned to nodes or elements.
Question: Is there a Paraview tool to interpolate in between, preferably using Krieging?

An external Kriging python library can be applied using the Programmable Filter.

For example, if you want to use PyKrige (PyKrige — PyKrige 1.6.1 documentation), first, prepare the same version of the Python environment that ParaView uses, and install Pykrige on it. Then, copy:

  • Anaconda3/envs/pyKrige/Lib/site-packages/pykrige

  • Anaconda3/envs/pyKrige/Lib/site-packages/scipy
    (This is an Anaconda example)

under (ParaView install folder)/bin/Lib/site-packages. After this preparation, start ParaView and apply a programmable filter to your geometry and observation points. Below is a concrete sample and its State file.

pyKrige.pvsm (567.3 KB)

The operation procedure is as follows.

  1. Select the geometry data (UnstructuredCellTypes1) you want to interpolate or extrapolate in the Pipeline Browser.
  2. Continue to select the observation point data (RandomAttributes1) while holding down the Ctrl key.
  3. Then, start the Programmable Filter
  4. Type in the following in Script:
from pykrige.ok3d import OrdinaryKriging3D

grid = self.GetInputDataObject(0, 0)
pnts = inputs[1]
output.CopyStructure(grid)

k_psill = 10.0
k_range = 5.0
k_nugget = 0.002

ok3d = OrdinaryKriging3D(
    pnts.Points[:,0], pnts.Points[:,1], pnts.Points[:,2], pnts.PointData['RandomPointScalars'],
    variogram_model="gaussian", variogram_parameters ={'psill': k_psill, 'range': k_range, 'nugget': k_nugget}
    #anisotropy_scaling_y=None, anisotropy_angle_z=None
)

k3d1, ss3d = ok3d.execute('points', output.Points[:,0], output.Points[:,1], output.Points[:,2])

output.PointData.append(k3d1, 'kriging')
1 Like

Thanks, you have a nice simple square block for an example. In my case, my geometry is pretty complex,


Still doable?

Yes, it is possible. This method is not affected by the complexity of the geometry.

FYI @Francois_Mazen

Unfortunately, I have only used paraview with Matlab generated vtks.
Would there be anyone in this forum who can implement for me Kyoshimi’s solution on a consultant basis?

This is a very detailed answer. Thank you very much for sharing that!

Hello Victor,

Kitware can help you via paid services. You can reach out Kitware for consultancy using this page:
https://www.kitware.com/contact-us/

Best,