Forum Message

 

 

We have moved the forum to https://forum.ngsolve.org . This is an archived version of the topics until 05/05/23. All the topics were moved to the new forum and conversations can be continued there. This forum is just kept as legacy to not invalidate old links. If you want to continue a conversation just look for the topic in the new forum.

Notice

The forum is in read only mode.

Compound space on different meshes

More
2 years 7 months 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
2 years 7 months 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
2 years 7 months ago - 2 years 7 months 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: 2 years 7 months ago by christopher.
The following user(s) said Thank You: janfp
More
2 years 7 months ago #3969 by janfp
Many thanks!
Time to create page: 0.164 seconds