Hello, attached I have an implementation of an HDG method for a Poisson problem.
bc_problem_poisson.py (2.2 KB)
Enforcing Neumann boundary conditions with the below code gives the expected convergence rates:
ds = dx(element_boundary = True)
f += ((grad_uex * n) * vbar.Trace()) * ds(definedon=mesh.Boundaries('Neumann'))
Now instead of integrating over ds(definedon=mesh.Boundaries(‘Neumann’)), I would like to implement the Neumann boundary conditions by integrating over all element boundaries, and using an indicator function (or similar) so that the contribution from internal element boundaries is 0.
My attempt:
chiN = GridFunction(FacetFESpace(mesh, order=0, dirichlet='Neumann'))
chiN.Set(CF(1.0), definedon=mesh.Boundaries('Neumann'))
f += ((grad_uex * n) * vbar * chiN) * ds
This does not converge. How can I modify this to achieve the same result as I get when integrating over ds(definedon=mesh.Boundaries(‘Neumann’))?
Thanks,
Elizabeth