Boundary Finite Element Spaces

More
2 years 6 months ago #4143 by walker_tr9
I'm having some trouble. I would like to have a finite element space defined on the boundary mesh of a bulk mesh. Fore example, piecewise linear on the boundary of a square. So I did this:

bdy_H1 = H1(mesh, order=1, definedon="top|left|right|bottom")

Is this right? If so, I now create a GridFunction:

bdy_u = GridFunction(bdy_H1, "bdy_func")
bdy_u.Set(1)

Here I set it to 1, but it could be anything. In fact, bdy_u could end up being the solution of some boundary PDE.

Anyway, I now want to plot bdy_u. From what I have read, I have to create a bulk GridFunction, and somehow transfer the bdy_u values to the bulk GridFunction. But I don't know how to do that.

-Shawn
More
2 years 6 months ago #4144 by schruste
Hi Shawn,

The Set(..) sets values on specified domains. If nothing is specified it will set on the whole *volume* mesh (where your GridFunction is not defined). You need to specify the part of the boundary you want to prescribe a function. If it's on the whole boundary simply use .Set(..., BND) otherwise use .Set(..., mesh.Boundaries("...")).

Best,
Christoph
More
2 years 6 months ago #4145 by walker_tr9
Ok, so I do this:

mesh = Mesh (unit_square.GenerateMesh(maxh=0.02))
# standard FE space
V = H1(mesh, order=1, dirichlet=[])

# my boundary FE space
bdy_H1 = H1(mesh, order=1, definedon="top|left|right|bottom")
bdy_u = GridFunction(bdy_H1, "bdy_func")
bdy_u.Set(1)

bdy_u_ext = GridFunction(V)
bdy_u_ext.Set(bdy_u, BND)
Draw(bdy_u_ext)

But the plot just shows zero everywhere.

If I made a CoefficientFunction defined to be 1 (on the boundary), then there is a way to plot that. But that is not an option. I need to be able to plot a finite element function that is only defined on the boundary.
More
2 years 6 months ago #4146 by walker_tr9
Ok, I found this explanation, which definitely helps!

ngsolve.org/forum/ngspy-forum/976-how-to...ace-on-the-interface
More
2 years 6 months ago #4150 by walker_tr9
Just to confirm, I did get this figured out.
BTW: ngsolve does "complain" about

definedonbound="Gamma"

not being documented. I suppose it is safe.
Time to create page: 0.142 seconds