- Thank you received: 0
Issue with vector-valued FacetSpace
- walker_tr9
- Topic Author
- Offline
- Senior Member
Less
More
2 years 7 months ago #4274
by walker_tr9
Issue with vector-valued FacetSpace was created 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?
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?
- walker_tr9
- Topic Author
- Offline
- Senior Member
Less
More
- Thank you received: 0
2 years 7 months ago #4277
by walker_tr9
Replied by walker_tr9 on topic Issue with vector-valued FacetSpace
Did this get fixed? I noticed Joachim made a commit related to this.
- mneunteufel
- Offline
- Premium Member
Less
More
- Thank you received: 59
2 years 7 months ago #4278
by mneunteufel
Replied by mneunteufel on topic Issue with vector-valued FacetSpace
Hey,
yes, it should be fixed now and is available in the latest nightly build.
Best,
Michael
yes, it should be fixed now and is available in the latest nightly build.
Best,
Michael
- walker_tr9
- Topic Author
- Offline
- Senior Member
Less
More
- Thank you received: 0
2 years 7 months ago #4279
by walker_tr9
Replied by walker_tr9 on topic Issue with vector-valued FacetSpace
Ok, so I guess this doesn't update the conda ngsolve package. So I should switch to compiling everything.
- walker_tr9
- Topic Author
- Offline
- Senior Member
Less
More
- Thank you received: 0
2 years 7 months ago #4281
by walker_tr9
Replied by walker_tr9 on topic Issue with vector-valued FacetSpace
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.
- walker_tr9
- Topic Author
- Offline
- Senior Member
Less
More
- Thank you received: 0
2 years 7 months ago #4282
by walker_tr9
Replied by walker_tr9 on topic Issue with vector-valued FacetSpace
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.
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.125 seconds