Compound space on different meshes

Dear all,
to simulate a PDE-ODE-System, I was trying to use a compound FE-Space on two different mesh, one with only one DOF (for the ODE). However, it seems that assembling in such a space does not work properly.

Is this a bug or am I using it in an unintended way?

Minimal example:

from ngsolve.meshes import Make1DMesh
from ngsolve.meshes import Mesh as NgMesh
from netgen.meshing import *

from ngsolve import *

nx = 10
ngsmesh = Make1DMesh(nx)
ngsmesh_ODE = Make1DMesh(1) # For the ODE, thus only one DOF

fes1 = L2(ngsmesh_ODE, order=0)
fes2 = L2(ngsmesh, order=1, dgjumps=True)
fes = FESpace([fes1,fes2])
u,v = fes.TnT()

m = BilinearForm(fes)

m.components[0] += BFI("mass", coef=1) #u[0]*v[0]*dx
m.components[1] += BFI("mass", coef=1) #u[1]*v[1]*dx

m.Assemble()

print(m.mat)

The component-spaces of a compound space have to live on the same mesh.

You can use NumberFESpace instead. It is one constant function on the whole domain.

Joachim

Compound spaces expect the same mesh to be defined on. But you can use a global space with one dof by using the NumberSpace:

fes1 = NumberSpace(ngsmesh)
fes2 = L2(ngsmesh, order=1, dgjumps=True)
fes = fes1 * fes2
(uO, u), (vO, v) = fes.TnT()

m = BilinearForm(fes)
m += uO * vO * dx
m += u * v * dx
m.Assemble()
print(m.mat)

Many thanks!