# Behaviour of TensorProductFESpace

Hello!

I am building a spacetime formulation of the heat equation, on a tensor product “prism”-like mesh (simplices in space, intervals in time). For now, I am focussing on 1+1 and 1+2 dimensions.

I found some (mostly undocumented) files regarding tensor product meshes and -FEspaces in the directory “ngsolve/py_tutorials/TensorProduct”. However, whenever I try to use these objects, I get very unexpected behaviour.

First example, where the mesh on Y is just 1-dimensional (as opposed to 1+2-dimensional as I was hoping) and the matrix A contains far less nonzero entries than what I had expected:

``````from ngsolve import Mesh, x, y, GridFunction, H1
from netgen.geom2d import unit_square
from ngsolve.TensorProductTools import *
from ngsolve.comp import *
import scipy.sparse as sp

time_mesh = Mesh(SegMesh(20, 0, 1))
space_mesh = Mesh(unit_square.GenerateMesh(maxh=0.1))
Y = TensorProductFESpace([L2(time_mesh), H1(space_mesh)])

A = BilinearForm(Y)
u, v = Y.TnT()
A += u * v * dx
A.Assemble()
Amat = sp.csr_matrix(A.mat.CSR())
print(Amat.nnz)
print(Y.mesh.dim)
Draw(Y.mesh)``````

Secondly, when I create a compound FESpace from these TensorProductFESpace’s (or even just one), I get segfaults:

``````from ngsolve import Mesh, x, y, GridFunction, H1
from netgen.geom2d import unit_square
from ngsolve.TensorProductTools import *
from ngsolve.comp import *
import scipy.sparse as sp

time_mesh = Mesh(SegMesh(20, 0, 1))
space_mesh = Mesh(unit_square.GenerateMesh(maxh=0.1))
Y = TensorProductFESpace([L2(time_mesh), H1(space_mesh)])
compound_fes = FESpace([Y])

A = BilinearForm(Y)
u, v = Y.TnT()
A += u * v * dx
A.Assemble()``````

Lastly, when I use this compound FESpace “as intended”, I get an error indicating “not implemented”:

[code]
from ngsolve import Mesh, x, y, GridFunction, H1
from netgen.geom2d import unit_square
from ngsolve.TensorProductTools import *
from ngsolve.comp import *
import scipy.sparse as sp

time_mesh = Mesh(SegMesh(20, 0, 1))
space_mesh = Mesh(unit_square.GenerateMesh(maxh=0.1))
Y = TensorProductFESpace([L2(time_mesh), H1(space_mesh)])
compound_fes = FESpace([Y])

A = BilinearForm(compound_fes)
(u, ), (v, ) = compound_fes.TnT()
A += u * v * dx
A.Assemble()

\$ netgen mwe.py

catch in AssembleBilinearform 2: 4 not implemented
Traceback (most recent call last):
File “”, line 15, in
netgen.libngpy._meshing.NgException: 4 not implementedin Assemble BilinearForm ‘biform_from_py’[/code]

Is there any way I can get around this, maybe by not using a TensorProductFESpace, but rather specifying the FESpace (L2 in the time-direction, H1 in the space-direction) on the tensorproduct mesh directly?