How to set two or more different boundary conditions in HDG

More
3 years 6 months ago #3775 by Younghigh
Dear all,

Recently, I have applied the HDG method to fluid problems. However, I cannot sure the following methods to set two or more different boundary conditions is correct. Please help revise.
Code:
V = L2(mesh, order=k) M = FacetFESpace(mesh, order=k, dirichlet="left|bottom|right|top") fes = FESpace([V,M]) gfu = GridFunction(fes) a = BilinearForm(fes, condense=True) l = LinearForm(fes) ... a.Assemble() gfu.components[1].Set(2, definedon=mesh.Boundaries("left")) gfu.components[1].Set(1, definedon=mesh.Boundaries("bottom")) gfu.components[1].Set(-1, definedon=mesh.Boundaries("right")) # add Dirichlet BC l.vec.data = -a.mat * gfu.vec

Best,

Di Yang
More
3 years 6 months ago #3776 by christopher
You need to set all boundary conditions at once, since the .Set method sets it to 0 everywhere else:
Code:
gfu.components[1].Set(mesh.BoundaryCF({ "left" : 2, "bottom" : 1, "right" : -1}), definedon=mesh.Boundaries("left|bottom|right"))

Best
Christopher
More
3 years 6 months ago #3777 by Younghigh
Dear Christopher,

Thank you for your revision. This helps me very much.

Best,

Di Yang
Time to create page: 0.100 seconds