- Thank you received: 0
How to set two or more different boundary conditions in HDG
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.
Best,
Di Yang
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
- christopher
- Offline
- Administrator
Less
More
- Thank you received: 101
3 years 6 months ago #3776
by christopher
Replied by christopher on topic How to set two or more different boundary conditions in HDG
You need to set all boundary conditions at once, since the .Set method sets it to 0 everywhere else:
Best
Christopher
Code:
gfu.components[1].Set(mesh.BoundaryCF({ "left" : 2, "bottom" : 1, "right" : -1}), definedon=mesh.Boundaries("left|bottom|right"))
Best
Christopher
Time to create page: 0.100 seconds