Hi

I am trying to define some matrices for my FEM and I think I am misunderstanding how to use some of the ngsolve functions.

The listing below defines my geometry and the objects for FEM, then below I define the usual mass and stiffness matrices with entries like u*v and grad(u)*grad(v), and these work fine. My issue is defining this matrix b which will have entries like grad(u)*v. With the code I have below I get an error, so how should I be defining this?

#generate mesh and finite element materials

geo = SplineGeometry()

geo.AddRectangle( (-D, -D), (D, D), bcs = (“bottom”, “right”, “top”, “left”))

mesh = Mesh( geo.GenerateMesh(maxh=msize))

fes = H1(mesh, order=1, dirichlet=“bottom|right|left|top”)

u = fes.TrialFunction()

v = fes.TestFunction()

#generate stiffness and mass matrices

a=BilinearForm(fes)

a+=SymbolicBFI(grad(u)*grad(v))

a.Assemble()

m=BilinearForm(fes)

m+=SymbolicBFI(u*v)

m.Assemble()

b=BilinearForm(fes)

b+=SymbolicBFI(grad(u)*v)

b.Assemble()

Thanks for any help