### Integrate a stress tensor over a boundary

129
views
0
5 months ago by
Hi

I am a new FEniCS with C++ User. Now, I am facing a problem which is integrating the gradient of a computed function over a boundary.
For example, I have solved a 2D NS equation so that I get velocity vector v. How to calculate grad(v) on a specific boundary:

$\int_{\Gamma}\text{grad}\left(v\right)ds$Γgrad(v)ds

Note: This result should be a vector with two components and how to extract the two components?
I know in Phython, one could use
grad_v=project(grad(v), V)
to  get the gradient function, but I do not know how to do it with C++