# Unit normal Vector Fluid Interface

**URL:** https://discourse.paraview.org/t/unit-normal-vector-fluid-interface/7316
**Category:** ParaView Support
**Created:** [May 28, 2021, 9:46am UTC](https://discourse.paraview.org/t/unit-normal-vector-fluid-interface/7316 "2021-05-28T09:46:10Z")
**Posts on this page:** 15
**Page:** 1

<div class="post-metadata">

### Author: ![M\_M](https://discourse.paraview.org/user_avatar/discourse.paraview.org/m_m/32/6573_2.png) [@M\_M](https://discourse.paraview.org/u/M_M)
#### Post date: [May 28, 2021, 9:46am UTC](https://discourse.paraview.org/t/unit-normal-vector-fluid-interface/7316/1 "2021-05-28T09:46:10Z")

</div>

Hello.

This is my first post so I will try my best to be concise. I use Paraview 5.0.1

I am working on a two-phase fluid flow simulation where I am post-processing using Paraview. I am trying to obtain the unit normal vector at the liquid-gas interface given by  
n = grad(alpha)/|grad(alpha)|

I have been able to compute the normal by applying the **Contour** filter (set fluid = 0.5) and checking _Compute Normals_ box.

Q1. Is this unit normal vector?

Q2. If it is, why am I not getting it shown in **Calculator** to calculate a different parameter?

Q3. If it is not, how can I use the unit normal vector equation above in **Calculator or Python Calculator**? I read that it is not possible to do gradient calculation with **Calculator filter** in the below post  
[https://www.paraview.org/pipermail/paraview/2010-September/018776.html](https://www.paraview.org/pipermail/paraview/2010-September/018776.html)  
but when I tried using **Python Calculator** , it crashes.

I have looked at different forums and have been unsuccessful so far.

Any help is appreciated.

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [May 28, 2021, 9:50am UTC](https://discourse.paraview.org/t/unit-normal-vector-fluid-interface/7316/2 "2021-05-28T09:50:13Z")

</div>

> [@M\_M](#):
>
> Paraview 5.0.1

Can you upgrade to 5.9.1 ?

---

<div class="post-metadata">

### Author: ![M\_M](https://discourse.paraview.org/user_avatar/discourse.paraview.org/m_m/32/6573_2.png) [@M\_M](https://discourse.paraview.org/u/M_M)
#### Post date: [May 28, 2021, 9:55am UTC](https://discourse.paraview.org/t/unit-normal-vector-fluid-interface/7316/3 "2021-05-28T09:55:37Z")

</div>

Unfortunately, I am unable to upgrade. Although I have Paraview 5.4.0 but thought it was my implementation which was incorrect.

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [May 28, 2021, 10:05am UTC](https://discourse.paraview.org/t/unit-normal-vector-fluid-interface/7316/4 "2021-05-28T10:05:25Z")

</div>

> [@M\_M](#):
>
> Q1. Is this unit normal vector?

It is the normal vector at each point

> **[Normal (geometry)](https://en.wikipedia.org/wiki/Normal_(geometry))**
>
> In geometry, a normal is an object (e.g. a line, ray, or vector) that is perpendicular to a given object. For example, the normal line to a plane curve at a given point is the line perpendicular to the tangent line to the curve at the point.
> A normal vector of length one is called a unit normal vector. A curvature vector is a normal vector whose length is the curvature of the object. 
> Multiplying a normal vector by -1 results in the opposite vector, which may be used for indicating sides (e.g.,...

> [@](#):
>
> Q2. If it is, why am I not getting it shown in **Calculator** to calculate a different parameter?

I can see it in my calculator (ParaView 5.9.1)

---

<div class="post-metadata">

### Author: ![M\_M](https://discourse.paraview.org/user_avatar/discourse.paraview.org/m_m/32/6573_2.png) [@M\_M](https://discourse.paraview.org/u/M_M)
#### Post date: [May 28, 2021, 1:24pm UTC](https://discourse.paraview.org/t/unit-normal-vector-fluid-interface/7316/5 "2021-05-28T13:24:50Z")

</div>

1. Would it be possible to obtain unit normal vector from normal vector?

2. I have attached a screenshot of my Calculator.

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [May 28, 2021, 1:28pm UTC](https://discourse.paraview.org/t/unit-normal-vector-fluid-interface/7316/6 "2021-05-28T13:28:46Z")

</div>

Well, upgrade ParaView.

[https://www.paraview.org/download/](https://www.paraview.org/download/)

---

<div class="post-metadata">

### Author: ![M\_M](https://discourse.paraview.org/user_avatar/discourse.paraview.org/m_m/32/6573_2.png) [@M\_M](https://discourse.paraview.org/u/M_M)
#### Post date: [May 28, 2021, 1:43pm UTC](https://discourse.paraview.org/t/unit-normal-vector-fluid-interface/7316/7 "2021-05-28T13:43:59Z")

</div>

I wasn’t aware that I could simply run without installing.

> [@Install Paraview 5.8](https://discourse.paraview.org/t/install-paraview-5-8/4148/2):
>
> Welcome to the community, Victor! You probably have some link to system ParaView that you are finding. I would recommend the following: Download a new version of Paraview from the [paraview.org](http://paraview.org) website. Untar this. cd to the bin directory. Run as follows: ./paraview. This will run in the bin directory, rather than the first “paraview” that is found in your path. Alan

I have managed to get ParaView 5.9.1 but still am unable to see the normal in Vectors drop down.

 ![Screenshot 2021-05-28 143950](https://discourse.paraview.org/uploads/default/original/2X/f/fda2b58181ee275123f457d8740300d212a05ca4.jpeg)

I appreciate your help @mwestphal

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [May 28, 2021, 1:46pm UTC](https://discourse.paraview.org/t/unit-normal-vector-fluid-interface/7316/8 "2021-05-28T13:46:03Z")

</div>

please share your data.

---

<div class="post-metadata">

### Author: ![M\_M](https://discourse.paraview.org/user_avatar/discourse.paraview.org/m_m/32/6573_2.png) [@M\_M](https://discourse.paraview.org/u/M_M)
#### Post date: [May 28, 2021, 1:55pm UTC](https://discourse.paraview.org/t/unit-normal-vector-fluid-interface/7316/9 "2021-05-28T13:55:25Z")

</div>

I am unable to share my data here due to the space limit so please find the dropbox link

> **[case.tar.gz](https://www.dropbox.com/s/rc5xf44h26fh6om/case.tar.gz?dl=0)**
>
> Shared with Dropbox

---

<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: [May 28, 2021, 8:26pm UTC](https://discourse.paraview.org/t/unit-normal-vector-fluid-interface/7316/10 "2021-05-28T20:26:06Z")

</div>

If you apply the slice filter first, the result of the contour filter will be line segments, and since there are no surfaces, the normals cannot be calculated. Therefore, it is necessary to change the order of the contour filter and the slice filter.

 ![contour_normals](https://discourse.paraview.org/uploads/default/original/2X/6/6cb2bceeb4c9ef2c431eda223fd8424a652b3e89.png)

---

<div class="post-metadata">

### Author: ![M\_M](https://discourse.paraview.org/user_avatar/discourse.paraview.org/m_m/32/6573_2.png) [@M\_M](https://discourse.paraview.org/u/M_M)
#### Post date: [May 29, 2021, 11:13am UTC](https://discourse.paraview.org/t/unit-normal-vector-fluid-interface/7316/11 "2021-05-29T11:13:07Z")

</div>

@Kenichiro-Yoshimi silly mistake, many thanks.

Can I also check if these are **unit** normal vector?

---

<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: [May 29, 2021, 1:35pm UTC](https://discourse.paraview.org/t/unit-normal-vector-fluid-interface/7316/12 "2021-05-29T13:35:49Z")

</div>

You can use the **mag** function in the Calculator filter to compute the magnitude of a normal vector. Then, as shown below, in the **Information** tab, the maximum and minimum length of the normal vectors are both 1, which confirms that they are unit vectors.

 ![mag_normals](https://discourse.paraview.org/uploads/default/original/2X/8/8041e03d8676b9d5228e63bbe628ec8dfcf8885e.png)

---

<div class="post-metadata">

### Author: ![M\_M](https://discourse.paraview.org/user_avatar/discourse.paraview.org/m_m/32/6573_2.png) [@M\_M](https://discourse.paraview.org/u/M_M)
#### Post date: [May 30, 2021, 1:12pm UTC](https://discourse.paraview.org/t/unit-normal-vector-fluid-interface/7316/13 "2021-05-30T13:12:04Z")

</div>

@Kenichiro-Yoshimi much appreciate your help.

---

<div class="post-metadata">

### Author: ![Stewart\_Gospel](https://discourse.paraview.org/user_avatar/discourse.paraview.org/stewart_gospel/32/12807_2.png) [@Stewart\_Gospel](https://discourse.paraview.org/u/Stewart_Gospel)
#### Post date: [November 7, 2023, 7:42pm UTC](https://discourse.paraview.org/t/unit-normal-vector-fluid-interface/7316/14 "2023-11-07T19:42:58Z")

</div>

Hi @Kenichiro-Yoshimi, thanks for the help. I am trying to do a similar thing but I am still a beginner in Paraview. Is it possible for you to outline the steps to do this? Starting from loading the ParaView.foam file. I have tried to do it myself, somehow I get the interface curvature but I do not see the normal vertor as I see here in your image.

@mwestphal can you also help with the steps? I just need the steps and a short explanation. I can figure out the rest by myself.

---

<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: [November 8, 2023, 1:50am UTC](https://discourse.paraview.org/t/unit-normal-vector-fluid-interface/7316/15 "2023-11-08T01:50:56Z")

</div>

Below is a video on how to display normal vectors using the data shared here.

Hope this helps you.
