Compound space on different meshes

More
3 years 1 month ago #3966 by janfp
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:
Code:
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)
More
3 years 1 month ago #3967 by joachim
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
The following user(s) said Thank You: janfp
More
3 years 1 month ago - 3 years 1 month ago #3968 by christopher
Compound spaces expect the same mesh to be defined on. But you can use a global space with one dof by using the NumberSpace:
Code:
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)
Last edit: 3 years 1 month ago by christopher.
The following user(s) said Thank You: janfp
More
3 years 1 month ago #3969 by janfp
Many thanks!
Time to create page: 0.104 seconds