Issue with vector-valued FacetSpace

More
2 years 7 months ago #4274 by walker_tr9
So I have this space:

Bdy_Space = FacetFESpace(mesh, order=0, dim=2, definedon="", definedonbound="Gamma")

Note: this space has two components, or at least it should.

I then do this:

zero_vec = CoefficientFunction((0.0, 0.0))

And when I try this:

gf = GridFunction(Bdy_Space)
gf.Set(zero_vec, dual=True)

I get this error:
netgen.libngpy._meshing.NgException: Error in SetValues: gridfunction-dim = 1, but coefficient-dim = 2

It seems to think the grid function has only one component.  But the Bdy_Space was specified with 2.  What is the deal?
More
2 years 7 months ago #4277 by walker_tr9
Did this get fixed?  I noticed Joachim made a commit related to this.
More
2 years 7 months ago #4278 by mneunteufel
Hey,

yes, it should be fixed now and is available in the latest nightly build.

Best,
Michael
More
2 years 7 months ago #4279 by walker_tr9
Ok, so I guess this doesn't update the conda ngsolve package.  So I should switch to compiling everything.
More
2 years 7 months ago #4281 by walker_tr9
So I tried using the PIP installer with the --pre flag, which supposedly gives the latest release.  Everything installed properly, but I still get the error noted above about the dimension of the space.
More
2 years 7 months ago #4282 by walker_tr9
here is a standalone code to reproduce the issue:
import numpy as np

import netgen.gui
from ngsolve import *

#from netgen.geom2d import unit_square
from netgen.geom2d import SplineGeometry

# make the mesh
geo = SplineGeometry()
geo.AddRectangle( (0,0), (1,1), bc = "Gamma")
Om_mesh = Mesh(geo.GenerateMesh(maxh=1.0))
for r in range(3):
    Om_mesh.Refine()
Draw(Om_mesh)
print(Om_mesh.GetBoundaries())

# bdy space
Bdy_Space = FacetFESpace(Om_mesh, order=0, dim=2, definedon="", definedonbound="Gamma")

print(" ")
num_Gm_dofs = np.sum(Bdy_Space.FreeDofs())
print("number of FreeDofs for Bdy_Space: ", num_Gm_dofs)
print("Bdy_Space FreeDof mask: ")
print(Bdy_Space.FreeDofs())

gf = GridFunction(Bdy_Space)
# this does not work
#gf.Set((x*y,y), dual=True)
# (this "works", but shouldn't)
gf.Set(x*y, dual=True)

print(gf)
#help(gf)

uu = Bdy_Space.TrialFunction()

IP = InnerProduct(gf,uu)

input("Press Enter to finish...")

the line:   gf.Set((x*y,y), dual=True)

is what I need to work, but it doesn't.
Time to create page: 0.109 seconds