You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
q=fem.Function(Q) # Q is the scalar quadrature spaceq.interpolate(lambdax: x[0], cells=cells)
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 with strain as global function and call interpolate with cells for each material (so $n$ times if there are $n$ different materials).
But, then we would need to slice strain.x.array when passing the values to the different material routines.
Best,
Philipp
The text was updated successfully, but these errors were encountered:
I think using interpolate will really come in handy once this PR FEniCS/dolfinx#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
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$n$ times if there are $n$ different materials).
strain.interpolate
withstrain
as global function and callinterpolate
with cells for each material (soBut, then we would need to slice
strain.x.array
when passing the values to the different material routines.Best,
Philipp
The text was updated successfully, but these errors were encountered: