Hi Nils,
We have now a very new BoundaryFromVolumeCF, which does what you need. Copy from the doc-string:
Code:
Help on built-in function BoundaryFromVolumeCF in module ngsolve.comp:
BoundaryFromVolumeCF(...) method of builtins.PyCapsule instance
BoundaryFromVolumeCF(vol_cf: ngsolve.fem.CoefficientFunction) -> ngsolve.fem.CoefficientFunction
Allows the evaluation of volumentric functions on the boundary.
When evaluated on a boundary element, this function searches for the associated
volume element, transforms the local coordinates, and evaluates the function in the
volume. A typical use-case is to visualize L2-functions, or mechanical stresses at
the boundary.
It is different to the boundary Trace()-operator. The trace provides a function
which is defined by boundary degrees of freedom only. E.g. the trace of an H(div)
function is only the normal component, while the BoundaryFromVolumeCF gives the
whole function.
If called on an interface, it evaluates from one side (which one is not specified).
If the function is only defined on one side, this side will be taken. One can use
a domain-wise CF to define a function only locally:
uloc = CoefficientFunction( [None, None, u, None] )
Attached is also a small test-file providing the domain-wise outgoing normal-vector.
In your case, you have to integrate over a boundary-region, which you have to define via boundary condition labels.
Best, Joachim