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.

FESpace.Element(BND) returns empty list for L^2 spaces

More
3 years 11 months ago #2625 by arieder
Hi,

I'm trying to implement a DG-BEM coupling method. Therefore i would like to iterate over all the elements on the boundary to set up my coupling matrices. Everything works fine if I use a H^1 space, but if I use L^2 the resulting list is always empty.
To illustrate what I mean, I've attached a short sample script. If I change the space to H1 there, everthing works as expected.

File Attachment:

File Name: test.py
File Size:0 KB
Attachments:
More
3 years 11 months ago #2626 by schruste
Hi Alexander,

The space L2 does not provide Surface Elements. However, we have SurfaceL2 to obtain an L2 space that lives only on the surface.

Best,
Christoph
More
3 years 11 months ago #2629 by christopher
Hi,
I guess what you need is the L2 function to be evaluated "at" the boundary. You can do that by iterating over mesh boundary elements and evaluating the L2 function (which will then be evaluated at the adjacent volume element) at your desired points.
More
3 years 11 months ago #2630 by arieder
Is there no way to get information on which degrees of freedom are attached to a surface element? Otherwise this sounds like a really unclean solution with lots of iterating to generate zeros.
To be more specific, what I would like to do is set up a sparse matrix representing the trace operator, but between the two libraries.
For the H1(and Maxwell) case, i iterate over the surface elements and for each element, i construct a local Dof map by evaluating the shapeset in the lagrange points (as Bem++ uses lagrange based elements). Then i use the local2global maps of both libraries to construct the global map.

While some solution based on a SurfaceL2 might be possible, I would like to keep my discretization of the surface values in the BEM++ format (because thats where the more involved computations are happening).

On a different, but related note: Is it possible in NGsolve to assemble a Mass matrix where test and trial functions are different FESpace? (one surface L^2 and one global L^2) BilinearForm seems to only allow test and trial space to be the same.


Thanks for your help,

Alex
More
3 years 11 months ago #2631 by christopher
BilinearForms allow different test and trial spaces
Code:
a = BilinearForm(trialspace=fes1, testspace=fes2)
but combining surface and volume L2 spaces does not make much sense, as they do not have any elements in common (surface l2 is only defined on surface elements, L2 only defined on volume elements)

You can project the function to the surface L2 by using:
Code:
sgf.Set(BoundaryFromVolumeCF(gf), BND)
and then do the dof mapping using the l2 surface elements.
More
3 years 11 months ago #2633 by schruste
Hi again,

Perhaps the following works for you?

1. Use a FacetFESpace, restrict it to the boundary.

fesf = FacetFESpace(mesh,order=..., dirichlet=".*")
fesf = Compress(fes,active_dofs=~fesf.FreeDofs())

2. Then, form a mixed BLF with fesf and the volume L2 space fesl2:

m = Bilinearform(trialspace=fesf, testspace=fesl2)
m += fesf.TrialFunction() * fesl2.TestFunction() * ds(skeleton=True,BND)

Best,
Christoph
Time to create page: 0.132 seconds