Open pdiercks opened 3 months ago
Sorry, I missed this message,
I think using interpolate
will really come in handy once this PR https://github.com/FEniCS/dolfinx/pull/3114 gets merged in dolfinx. Then, we can just evaluate the expression defined on the whole mesh on the submeshes without handling cell indices ourselves.
It was after 5pm when I wrote that message ...
I think if we want to work with functions on submeshes, then we do not need to pass cells
at all and simply call
self._del_grad_u[k].interpolate(strain_expr) # cells=None
But, in any case, we should re-evaluate the whole design once the new features are available (interpolation from to submeshes, and also assembly of forms that contain quantities defined on different meshes).
Hi @srosenbu
I just noticed that something like
will fill the entries according to cells in
q
and leave other entries being zero.Using
fem.Expression
on the other hand, only the nonzero values would be returned or the user would need to provide an array of the correct size to store the result.That being said, I don't think using
interpolate
for_del_grad_u
(see code) will work. What's more, the cell indices are also global indices, so the function on the subspace would probably complain if it encounters indices out of range, and you would evaluate the wrong cells.We could, however, use
strain.interpolate
withstrain
as global function and callinterpolate
with cells for each material (so $n$ times if there are $n$ different materials). But, then we would need to slicestrain.x.array
when passing the values to the different material routines.Best, Philipp