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.

How to set two or more different boundary conditions in HDG

More
2 years 10 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
2 years 10 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
2 years 10 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.104 seconds