Hi,
When I set a grid function defined on a surface, the results seem wrong. See the following code and output.
When I set the parameter to BND
, the values of h_n are still all zeros.
[code]from ngsolve import *
from netgen.csg import *
from netgen.meshing import MeshingStep
from ngsolve.webgui import Draw
geo = CSGeometry()
sphere = Sphere(Pnt(0, 0, 0), 1).bc(‘inner’)
left = Plane(Pnt(0.75, 0, 0), Vec(-1, 0, 0))
fsphere = sphere*left
geo.AddSurface(sphere, fsphere)
geo.NameEdge(sphere, fsphere, ‘boundary’)
mesh = Mesh(geo.GenerateMesh(maxh=0.3))
Draw(mesh)
print_vec = lambda u: print([_ for _ in u.vec.data])
V_H = H1(mesh)
print(V_H.FreeDofs())
h = CoefficientFunction(1)
h_n = GridFunction(V_H)
h_n.Set(h)
print_vec(h_n)
h_n.Set(h, BND)
print_vec(h_n)
h_n.Set(h, BBND)
print_vec(h_n)[/code]
0: 1111111111111111111111111111
[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
[1.0, 1.0, 1.0, 1.0, 0.9999999999999999, 1.0, 1.0, 1.0, 1.0, 0.9999999999999998, 1.0, 0.9999999999999999, 1.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]