### Integrate a stress tensor over a boundary

129

views

0

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$∫

Note: This result should be a vector with two components and how to extract the two components?

I know in Phython, one could use

to get the gradient function, but I do not know how to do it with C++

Thanks in advance!

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`)`d``s`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++

Thanks in advance!

Community: FEniCS Project

Please login to add an answer/comment or follow this question.