# Laplace equation with non-homogeneous boundary

Hello,

I have a simple question that I have been struggling with for the past two days. I want to solve a simple laplace equation with non-homogenous boundary using both DG and HDG scheme. I got the proble working with the standard FEM spaces but I dont understand how to set the dirichlet boundary conditions in DG and HDG.

The DG code is attached. It would be great if you can point out my mistake in this simple code.

Best regards

Ajay

https://ngsolve.org/media/kunena/attachments/906/trial.py

Attachment: trial.py

Hi Ajay,

your problem was in the way you attempted to set the boundary condition:

1. Anything added to a BilinearForm needs to contain a trial and a test function. i.e., the uin * v is only a linear form and needs to be added to the right hand side.
2. Boundary and internal facet terms need to be treated slightly differently (as there is no .Other()), or see how to: DG

All in all, this is how you need to define the Bilinear and LinearForms:

acd = BilinearForm(fes)
acd += SymbolicBFI((grad(u)*grad(v)))
acd += SymbolicBFI((alpha*order**2/h*jump_u*jump_v), skeleton=True)
acd += SymbolicBFI((-mean_dudn*jump_v -mean_dvdn*jump_u), skeleton=True)
acd += SymbolicBFI((alpha*order**2/h*u*v), BND, skeleton=True)
acd += SymbolicBFI((-n*grad(u)*v -n*grad(v)*u), BND, skeleton=True)

f = LinearForm(fes)
f += SymbolicLFI((alpha*order**2/h*uin*v), BND, skeleton=True)
f += SymbolicLFI((-n*grad(v)*uin), BND, skeleton=True)

Best wishes,
Henry