L2 space with number of components different than mesh dim

Hello,

I have a VectorL2 and MatrixValued FE space defined on a 3D mesh. I need the trial and test functions to have only 2 components and not 3, which is the default for a 3D mesh. A straightforward way of doing this would be to have two scalar L2 spaces defined on a 3D mesh, but this would make the rest of the code quite tedious (even more so for the matrix space). Is there an easier way of doing this?

Thank you!

Best,
Giselle

HI Giselle,

with

fes = L2(mesh, order=2)**3
gfu = GridFunction(fes)

gfu.Set ( (x, y, x*y))

print (gfu.dims)
print (Grad(gfu).dims)

you can create vectorial spaces of arbitrary dimension. You can also iterate:

fes = (L2(mesh, order=2)**4) ** 5
gfu = GridFunction(fes)
print (gfu.dims)
print (Grad(gfu).dims)

Better to double-check how the ordering of higher-order tensors come out, you may need some reshape.

Joachim

Thank you so much, Joachim!