Interpolating a residual stress field in a new mesh

Hi,

I am doing something similar to Interpolation problem from mesh to mesh. I am trying to model a composite problem where there is an inclusion embedded in the matrix. In the inclusion, there is a residual stress field P_r, which need to be calculated from another simlation. Here is what I am planning to do:

  1. Calculate a function P_r in the first simulation with mesh1;
  2. During the first step, the function should be defined in the deformed configuration, so I have a set of deformed coordinates (x, y) and the corresponding function value, I will name it with P_r^*(x, y);
  3. Create a new mesh base on the displacement information in step 1;
  4. Apply this function as a flux term (residual stress) to the new mesh mesh2
  5. Model the inclusion problem with residual stress in another hyperelastic simulation.

Since I want to do some parametric study, i.e. changing matrix’s modulus, volume fraction of the inclusion, is there an elegant way to interpolate P_r^*(x, y) to a function defined on mesh2?

Note: It’s not easy to fit to some explicit form for this residual stress field.

Thank you in advance for any help!

With reference to the post you mentioned, you will notice that there is a call to dolfinx.fem.create_nonmatching_meshes_interpolation_data(...). If you need to do the interpolation several times, you may want to factor that out from the outer call to dolfinx.fem.Function..interpolate. That is

# Create nonmatching_meshes_interpolation_data once and for all
data = dolfinx.fem.create_nonmatching_meshes_interpolation_data(...)

# Create u1 and u2 once and for all
u1 = dolfinx.fem.Function(a function spaces that lives on mesh 1)
u2 = dolfinx.fem.Function(a function spaces that lives on mesh 2)

# Repeat interpolation several times
for i in range(100):
   u2.interpolate(u1)

Hi Francesco!

Thank you for your reply. You are my hero!!