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.

Laplace equation with non-homogeneous boundary

More
3 years 8 months ago #3124 by armandyam
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

File Attachment:

File Name: trial.py
File Size:1 KB
Attachments:
More
3 years 7 months ago #3126 by hvwahl
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:
Code:
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
Time to create page: 0.095 seconds