# boundary condition of TangentialFacetFESpace

Hi all,

I am trying to impose boundary Dirichlet boundary conditions on a TangentialFacetFESpace but I am not sure if I am doing it correctly.

For instance, consider a coarse mesh of the unit cube such that the top face is split in 2 and the trace space

Nh = TangentialFacetFESpace(mesh, order = 0, dirichlet=‘top’)

if the exact solution is u = (1,0,0) then it has the same tangential component on the top face. so I simply set

gfu = GridFunction(Nh)
gfu.Set(u, definedon=mesh.Boundaries(‘top’) )

I was expecting to see a couple of (1,0) for the components on the Dirichlet faces but I obtained instead (1/3,1/3) and (2/3,-1/3). Would you please explain how these are computed.

Best,

Hi Manuel,

the vector of the GridFunction saves the coefficients of the polynomial basis used for the TangentialFacetSpace, which should be the Nedelec basis functions. As they are not e.g. (1,0,0), but ugrad(v)-vgrad(u) with u,v barycentric coordinates, the coefficient vector does not include ones.

For more information about the computation of these coefficients (local L2 projection or usage of dual shapes) see this tutorial.

If you are unsure if the interpolation is correct, you can test it with

``````u = CoefficientFunction((1,0,0))
gfu = GridFunction(Nh)
gfu.Set(u, definedon=mesh.Boundaries('top') )
print(sqrt(Integrate((gfu-u)*(gfu-u), mesh, definedon=mesh.Boundaries('top'))))``````

Best,
Michael