Linear problem on submesh


I need to solve the linear problem shown in the screenshot:
Screenshot 2024-04-11 at 17.14.03

Screenshot 2024-04-11 at 17.17.13

where phi is a scalar function, whereas f is expressed in terms of a vector function m:

phi = fem.Function(fem.FunctionSpace(domain,("CG", 1)))
m = fem.Function(fem.VectorFunctionSpace(domain, ("CG", 1), dim=domain.topology.dim))

I have a mesh which consists of 2 cubes, one inside the other.
I need to solve the linear problem only on the inside domain \Omega_m.
Following the example you provided here Solve a problem of parts of a unit square mesh · GitHub
I defined 2 sub-meshes and I am trying to solve the problem on one of the two.
For that, I’d like to transfer the data of the vector field m from the parent mesh to the submesh.
Unfortunately, I don’t know how to adapt the function transfer_submesh_data from your tutorial to a CG1 vector field.
Could you please help?
Thank you

Please make a minimal reproducible example (MWE), then we might try to experiment it and potentially help you.

1 Like