Hello,
Quick question here. I want to operate on a fem.Function of a vector function space, like matrix multiplication, and return a function in the same space. A similar question is https://fenicsproject.discourse.group/t/dolfinx-fem-function-function-add-with-dolfinx-fem-function-function/9328, however, it was a simple addition operation of another function or interpolation. I have a simple example below, and I’d like for it to work without interpolation, if possible.
Thank you.
from dolfinx import mesh, fem
import ufl
nx, ny = 10,10
domain = mesh.create_rectangle(comm=MPI.COMM_WORLD, points=((-1., -1.), (1., 1.)),n=(nx, ny), cell_type=mesh.CellType.triangle)
# Vector function space
W = fem.VectorFunctionSpace(domain, ("CG",1), dim = 4)
# create a function
u1 = fem.Function(W)
# create a function modified from u1
u2 = ufl.Identity(4)*u1 # <--- Returns a different type than u1
# try to access u2's DOFs... Attribute error
u2.x.array
The above returns the error
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
Cell In[24], line 15
12 u2 = ufl.Identity(4)*u1 # <--- Returns a different type than u1
14 # try to access u2's DOFs
---> 15 u2.x.array
AttributeError: 'ComponentTensor' object has no attribute 'x'