Interpolation problem from mesh to mesh

Hi everyone,

I have met a problem in interpolating a function from a mesh to the new one. The version I use is dolfinx 0.7.2. The code is like:

domain_a = file_input1.read_mesh(name=“Grid”)
domain_b = file_input2.read_mesh(name=“Grid”)

W_a = fem.functionspace(domain_a, (“CG”, 2))
W_b = fem.functionspace(domain_b, (“CG”, 2))

u_a = fem.Function(W_a)
u_b = fem.Function(W_b)

u_b.interpolate(u_a, nmm_interpolation_data=fem.create_nonmatching_meshes_interpolation_data(domain_b._cpp_object, W_b.element, domain_a._cpp_object, 0))
u_b.x.scatter_forward()

Some spots in the center of the interpolation picture can be seen, which represent the tolerance between the origin values and the interpolated values. I would like to have your ideas about how to eliminate this tolerance, or in another word, is there something I can do or adjust to make the interpolation perfect?

Thanks in advance!

Best regards,
Jeremy

Increase the last argument of fem.create_nonmatching_meshes_interpolation_data from 0 to 1e-6

Hello Dr. Dokken,

Thank you so much for your answer.
With your advice it reaches the accuracy that I need.
In fact I haven´t really understood this “padding” parameter. Could you please elaborate it a little bit more?

Best regards,
Jeremy

When you have non matching meshes, you can have a point in one cell that is on the border of a set of cells in the other mesh.

The GJK collision algorithm that we use for finding colliding cells, does not work at machine precision, so this point may be 1e-7-1e-8 outside all cells in the new mesh.
The padding adds an extra step to finding colliding cells, finding the closest cell within the padding range.
This has for instance been shown in