Hello everyone,
I’m working on a multiphysics problem where I’m coupling a reaction-diffusion system (which requires a fine mesh) with a mechanical model (which typically converges well on a coarser mesh). To reduce computational cost, I want to solve each system on a separate mesh and then transfer fields between the meshes, especially from the fine one to the coarse one and vice versa.
I’ve been using gf.compute_interpolate_on
and gf_compute_extrapolate_on
to transfer scalar and vector fields (e.g., concentration, internal strain, etc.) between the meshes. However, I’m facing difficulties in getting this to work reliably when the source and target meshes are different (though they cover the same domain), especially:
- When interpolating from a fine mesh (high resolution) to a coarser one for the mechanical model;
- When extrapolating from a coarse mechanical mesh to a fine reaction-diffusion mesh to feed back deformation or strain information.
In some tests, the interpolation seemed to return NaNs
or values at zero, likely due to the lack of correspondence in mesh nodes or insufficient coverage. I suspect this is because the meshes are not nested and the interpolation might miss points outside the convex hull.
Here’s a simplified version of what I’m trying to do:
phi_fine = md_diffusion.variable("phi") # solved on fine mesh
phi_coarse = gf.compute_interpolate_on(mf_fine, phi_fine, mf_coarse) # interpolation
md_mechanics.add_fem_data("phi", mf_coarse)
md_mechanics.set_variable("phi", phi_coarse)
Similarly, I tried using extrapolation from coarse to fine, but encountered instability or inaccuracies.
I’m aware that interpolating between different FEM spaces (e.g., P2 to P1 or P1 to P2) on the same mesh works well, but I need to extend this to different meshes for efficiency.
My main goal is to make this kind of coupling efficient:
- fine mesh for the physics that needs it (e.g., diffusion),
- coarse mesh for what can afford it (e.g., mechanics),
- and reliable, accurate transfer between them.
Has anyone encountered a similar issue or implemented a robust solution for interpolation/extrapolation across non-nested meshes in GetFEM++?
Thanks in advance for your help and suggestions!
Best regards,