ResampleWithDataset and extrapolate to nearby points

Dear all,

This is the result of interpolating experimental data on a finite element mesh using ResampleWithDataset filter.
The missing points along the circle have value zero (blue in the contour above) because these points were not measured or have NaN.
However, the distance to the points living on the circle is small, so I want to extrapolate (nearest neighbor, bilinear, …) to have values everywhere.

Here is a state file containing the data and the output of the filter
state.pvsm (551.5 KB)

Here are the data (points and experimental values):
nodes.csv (7.4 KB)
data.txt (655.1 KB)

and the sequence of filters to generate the output
image

Is there any filter in paraview / pvpython that enables extrapolation or anything else I can do in paraview?

Thank you!

please share your data

@mwestphal I uploaded a state file in my question.

state file does not contains data Im afraid.

@mwestphal I uploaded the data manually and a screenshot how I apply the filter. Does this help?

Use a calculator to replace the NaNs with zero:

state.pvsm (719.2 KB)

I can not open the state file
ERROR: In vtkDelimitedTextReader.cxx, line 648

vtkDelimitedTextReader (0x17245b30): caught exception: Unable to open input file /home/glow/data/tmp/u2_325.txt

What is the calculator essentially doing? At the end, the values at the circle are still zero and no extrapolation happened.

@mwestphal My idea of extrapolation is not to replace the NaN’s by 0 but by a value related to the neighbor values, which are from 0.

Is that possible?

you obviously need to change the path to your own paths.

At the end, the values at the circle are still zero and no extrapolation happened.

Indeed, you can just remove the NaN point and let delaunay do its thing.

Here is a new version, you still need to change the path when you load the state:

state.pvsm (900.5 KB)

@mwestphal

I could reproduce the result in your state file. Basically, you have added an selection u>=0 followed by another delaunay. The trick is that the selection u>=0 gets rid of the NaN’s in my data, hence forcing the delaunay to triangulate the entire domain resulting in interpolation everywhere, even between the hole. Is it like that?

Exactly

ResampleWithDataSet provides a pickable option “Snap data to Cell with Closest Data”. Without choosing this option, points outside of the domain get a zero which for fields that cannot be zero is bad so I was very hopeful to see this option become available. However, to me, Snap means to not extrapolate, rather to take the closest boundary value directly.
Examining the data, it does seem to be extrapolating. According to the information tab which gives the Ranges → [ min, max]
Source
[0.0008571940043974022, 0.15147366645850846]
Target
[-0.0017042262373027119, 0.15147364187106566]
Note the source and target are generated from the same CAD so we are talking about roundoff error in the mesh generation that leaves a significant fraction of the points outside of the domain and critically lots of them on a wall surface with dramatic solution variation so this is really bad because the flow solver downstream will not accept 0 density as an starting field (equation of state blows up) and an extrapolated negative value is even worse.

I don’t see anyway for a target to give a negative value from a uniformly positive source field without doing extrapolation which to my understanding is not what snap means.

My hack around this, provides a “safe” but very inaccurate starting field by using transform to scale (shrink) and translate such that no points on the target mesh fall outside of the domain.

ScaleShift
[0.000857194435906585, 0.15147185625300372]

Can we get an option that is truly Snap and a separate one for extrapolate (which in my case is catastrophically bad)?