Under some necessary setting:
from ngsolve import *
from netgen.csg import *
from ngsolve.webgui import Draw
L = 4
R = 1
geo = CSGeometry()
cyl = Cylinder(Pnt(0,0,0), Pnt(L,0,0), R)
cyl.bc("wall")
right = Plane( Pnt(L,0,0), Vec(1,0,0))
left = Plane(Pnt(0,0,0), Vec(-1,0,0))
finitecyl = cyl * left * right
geo.Add(finitecyl)
mesh = Mesh(geo.GenerateMesh(maxh=0.5))
Draw(mesh)
V = VectorH1(mesh,order=1)
u,v = fes.TnT()
Main part of question:
then, if I write
n = CoefficientFunction((0, y/R, z/R)) # outward normal
a = BilinearForm(-InnerProduct(Grad(u)*n,v)
*ds("wall")).Assemble()
where n is the outward unit normal.
Error information:
Trialfunction does not support BND-forms, maybe a Trace() operator is misssing.
My question is how to fix it?
The following is a way without errors or warnings:
a = BilinearForm(-InnerProduct(Grad(u).Trace()*n,v)
*ds("wall")).Assemble()
But if I use it, I will get the tangential gradient(I think it is the projection of the usual gradient into the tangent space) as said in
https://docu.ngsolve.org/latest/how_to/howto_traceoperator.html?highlight=trace
However, I want to get the usual gradient firstly, then multiply n, finally integral on the boundary.