# Tangential and radial components of velocity

**URL:** https://discourse.paraview.org/t/tangential-and-radial-components-of-velocity/12796
**Category:** ParaView Support
**Created:** [September 1, 2023, 11:35am UTC](https://discourse.paraview.org/t/tangential-and-radial-components-of-velocity/12796 "2023-09-01T11:35:55Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Robert](https://discourse.paraview.org/user_avatar/discourse.paraview.org/robert/32/8104_2.png) [@Robert](https://discourse.paraview.org/u/Robert)
#### Post date: [September 1, 2023, 11:35am UTC](https://discourse.paraview.org/t/tangential-and-radial-components-of-velocity/12796/1 "2023-09-01T11:35:55Z")

</div>

Dear all,

I have a simple flow configuration of a vortex in a pipe which I performed using the Code\_Saturne software.  
Now I want to visualize using ParaVIEW the tangential and radial components of the velocity but I find some difficulties.

Knowing that Z is the axial direction, I calculate the angle a=atan(Y/X) using the calculator filter as:  
atan(coordsY/coordsX)

Further, I use again the calculator filter to get the tangential velocity using the relation:  
Vtan=Velocity\_Y \* cos(a)-Velocity\_x \* sin(a)

When I calculate the angle _a_ I get some strange results, maybe due to the fac that at some points it meets the coordinate X=0.

Could you please tell me how should I handle this problem? I also attach a picture with _a_ angle visualized on a slice perpendicular to the flow axis.

Regards,  
Robert

 ![image](https://discourse.paraview.org/uploads/default/original/2X/1/1d6b8ba98c2d337d8487b904dcc5932af68df8d9.png)

---

<div class="post-metadata">

### Author: ![Kenichiro-Yoshimi](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/k/ecc23a/32.png) [@Kenichiro-Yoshimi](https://discourse.paraview.org/u/Kenichiro-Yoshimi)
#### Post date: [September 1, 2023, 10:25pm UTC](https://discourse.paraview.org/t/tangential-and-radial-components-of-velocity/12796/2 "2023-09-01T22:25:35Z")

</div>

To avoid zero division in the calculation of angle a, instead of using the `Calculator` filter, you can use the `Python Calculator`, which allows you to use numpy’s `arctan2()`. That is, it would be possible to write

```python
arctan2(points[:,1], points[:,0])

```

in the `Expression` of the `Python Calculator`.

---

<div class="post-metadata">

### Author: ![Robert](https://discourse.paraview.org/user_avatar/discourse.paraview.org/robert/32/8104_2.png) [@Robert](https://discourse.paraview.org/u/Robert)
#### Post date: [September 2, 2023, 11:12am UTC](https://discourse.paraview.org/t/tangential-and-radial-components-of-velocity/12796/3 "2023-09-02T11:12:45Z")

</div>

Dear Kyoshimi,

Thank you for the interest in my problem. I applied you suggestion at the problem is partial solved, see the attached figure. Should I do something more?

Regards,  
Robert

 ![image](https://discourse.paraview.org/uploads/default/original/2X/2/2e83ef26939720b127ea9436ed103de42bf4e8cb.png)

---

<div class="post-metadata">

### Author: ![Kenichiro-Yoshimi](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/k/ecc23a/32.png) [@Kenichiro-Yoshimi](https://discourse.paraview.org/u/Kenichiro-Yoshimi)
#### Post date: [September 2, 2023, 12:39pm UTC](https://discourse.paraview.org/t/tangential-and-radial-components-of-velocity/12796/4 "2023-09-02T12:39:36Z")

</div>

Hi,

Since the function arctan() is a multivalued function, one rotation should always result in a discontinuity at a certain angle. On the other hand, for tangent vectors, as shown in the figure below, no problem arises. Therefore, the inner product of the velocity vector and tangent vector should be calculated correctly. (The same goes for the radial vector.)  
I hope this is helpful.

 ![tangent_vec](https://discourse.paraview.org/uploads/default/original/2X/e/e0f217f2467d306af3fef2b2d9ea13cfbe166ca3.jpeg)

---

<div class="post-metadata">

### Author: ![Robert](https://discourse.paraview.org/user_avatar/discourse.paraview.org/robert/32/8104_2.png) [@Robert](https://discourse.paraview.org/u/Robert)
#### Post date: [September 2, 2023, 2:29pm UTC](https://discourse.paraview.org/t/tangential-and-radial-components-of-velocity/12796/5 "2023-09-02T14:29:29Z")

</div>

Thank you for the explanation.

I would have one more question if possible. Now that I got the tangential and radial velocities I have to time average them.

So, I used the following steps:

- From Filter-\>Temporal-\>Extract Time Steps, I selected the wanted time (in my case, there is a swirl in a pipe so I extracted the time steps according to a rotation of the swirl);

- I applied to the previous filter a new filter Temporal-\>Temporal Statistics and computed the average values.  
Is there another way to time-average the values? I have some reference velocities and the results are quite different as you can see attached.  
Regards,  
Robert

 ![image](https://discourse.paraview.org/uploads/default/original/2X/8/8bcda8a42c3fb96511d1ca96934d13debf20b329.png)

---

<div class="post-metadata">

### Author: ![Kenichiro-Yoshimi](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/k/ecc23a/32.png) [@Kenichiro-Yoshimi](https://discourse.paraview.org/u/Kenichiro-Yoshimi)
#### Post date: [September 3, 2023, 2:15am UTC](https://discourse.paraview.org/t/tangential-and-radial-components-of-velocity/12796/6 "2023-09-03T02:15:20Z")

</div>

Sorry, but I am not familiar with how to assess the swirl flow, is it unusual for Tangential\_average to be all negative?

Is the horizontal axis of the PlotOverLine1 graph a line along the y-axis? If so, it seems reasonable that the tangential component would be negative if the swirl flow is clockwise.

@Kenneth_Moreland Since you seem to be familiar with the fluid analysis, would you be able to take a look at it, if possible?
