- Thank you received: 0
Laplace equation with non-homogeneous boundary
4 years 2 months ago #3124
by armandyam
Laplace equation with non-homogeneous boundary was created 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
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
Attachments:
4 years 2 months ago #3126
by hvwahl
Replied by hvwahl on topic Laplace equation with non-homogeneous boundary
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:
Best wishes,
Henry
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.100 seconds