# definedon for FacetFESpace

Hello,

If I have a domain with two materials, M1 and M2, I can use the definedon in the function space, such as in the FSI example. Does this definedon also work for FacetFESpace? For example:

F = FacetFESpace(mesh, order = 2, dirichlet = “wall|interface”, definedon=mesh.Materials(“M1”))

I’m asking because I get an error that my matrix is singular. However, if I include a bilinear form for functions in F defined on M2, my matrix is not singular anymore and I can get a solution. I guess I don’t understand how this works because I thought these functions in F were not defined in my second material.

Thanks,
Sander

Hi Sander,
the definedon was not used correctly for the FacetFESpace. It’s fixed now and will be in the nightly release. If it still does not work, send us your testcase.
Thanks for the bug report,
Joachim

Hi Joachim,

Thanks - I updated NGSolve, but I seem to have the same error. Attached a small example. I divided the unit square into two subdomains. In the subdomain y<0.5, I am solving a hybridized Poisson problem. I have an exact solution with matching boundary and source terms. In the subdomain y>0.5, I’m just solving u = uexact and p=pexact. As you can see on line 47, I define the facet space only on “material1” (y<0.5).

If you run the code as is, I get the “matrix is singular” error. However, if I switch on line 60, the code runs, but I don’t get the correct rates of convergence for velocity or pressure in the subdomain y<0.5. I’m thinking the facet variables on the subdomain y>0.5 may be a reason for this (or otherwise the facet variables on the interface through line 65).

Thanks,
Sander

Attachment: hybridpoisson.py

now it’s working ! independently of line 60

you get optimal rate of convergence:
DOFs E_u r E_p r
11873 2.85e-06 1.96 1.74e-04 1.47
47525 3.51e-07 3.02 4.35e-05 2.00
189869 4.35e-08 3.01 1.09e-05 2.00

best, Joachim

thanks - no not working yet. I did an update of ngsolve, but I assume I have to wait until tomorrow for the updates to have made it into the nightly build?
Sander

yes, right, it will be in the coming nightly build.

Alternatively, you can get the sources from github quite now. build as described here:
https://ngsolve.org/docu/latest/install/install_sources.html

Joachim

Hi Joachim,
Great - it’s working!
Sander
ps: I’m not sure whether the change went through in the nightly build. I updated NGSolve but kept getting the same error. I now installed from sources and things are working.