CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

strange in computation of normal vector

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By Santiago

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 28, 2019, 08:44
Default strange in computation of normal vector
  #1
Senior Member
 
Nguyen Duy Trong
Join Date: Apr 2014
Posts: 124
Rep Power: 12
ndtrong is on a distinguished road
Dear everyone,

I tried to plot the gradient of alpha.water and normal vector of interface using gradient of alpha.water with interFoam solver. And I found a thing that is quite strange for me as shown in the attached file.
Variables are defined as:
gradAlpha = fvc::grad(alpha1)
nAlphaVec = gradAlpha/(mag(gradAlpha) + epsilon)

with epsilon = 1.0e-8

I think that alpha1, gradAlpha and nAlphaVec should have the same contours, however, the contour of nAlphaVec is very different compare to 2 other ones.

Could someone help me to explain what is the reason for that.

I thank you very much
Attached Images
File Type: jpg alpha.water.jpg (90.7 KB, 11 views)
File Type: jpg gradAlpha.jpg (92.4 KB, 13 views)
File Type: jpg nGradAlpha.jpg (102.8 KB, 14 views)
ndtrong is offline   Reply With Quote

Old   December 29, 2019, 04:21
Default
  #2
Senior Member
 
Santiago Lopez Castano
Join Date: Nov 2012
Posts: 354
Rep Power: 15
Santiago is on a distinguished road
the calculation of the surface normal should be confined to a certain alpha, representing the surface for which you wish to obtain the normal. the results you obtain make sense to me (they are not what you want, but you got what you asked for).
Santiago is offline   Reply With Quote

Old   December 29, 2019, 07:39
Default
  #3
Senior Member
 
Nguyen Duy Trong
Join Date: Apr 2014
Posts: 124
Rep Power: 12
ndtrong is on a distinguished road
Quote:
Originally Posted by Santiago View Post
the calculation of the surface normal should be confined to a certain alpha, representing the surface for which you wish to obtain the normal. the results you obtain make sense to me (they are not what you want, but you got what you asked for).
Thank you Santiago for your comment.
However, I think that I do not need to confine value of alpha for surface normal, because obviously we define as:
\begin{cases} 
= 0, & \mbox{ in phase 1} \\
0 < \alpha < 1, & \mbox{in interface } \\
=1,  &\mbox{ in phase 2} \end{cases}
then out of the interface, nAlphaVec should be zero because its gradient become zero, therefore it should have the same contour as gradAlpha and alpha.water.

Thanks
ndtrong is offline   Reply With Quote

Old   December 29, 2019, 09:13
Default
  #4
Senior Member
 
Santiago Lopez Castano
Join Date: Nov 2012
Posts: 354
Rep Power: 15
Santiago is on a distinguished road
Quote:
Originally Posted by ndtrong View Post
Thank you Santiago for your comment.
However, I think that I do not need to confine value of alpha for surface normal, because obviously we define as:
\begin{cases} 
= 0, & \mbox{ in phase 1} \\
0 < \alpha < 1, & \mbox{in interface } \\
=1,  &\mbox{ in phase 2} \end{cases}
then out of the interface, nAlphaVec should be zero because its gradient become zero, therefore it should have the same contour as gradAlpha and alpha.water.

Thanks
Good that you grasp the theory! But the matter here is not about how the normal vector is defined, but where is defined. A surface normal is defined, well, in a surface. In other words, in your case, the field is 2 dimensional, defined over a line (representing a free surface).

Seen in other way, the value of gradAlpha is seldom truly "machine zero", hence dividing it by a rather small value may produce spurious results. by confining the operator to where it "makes sense", the problems you see may be avoided alltogether.
ndtrong likes this.
Santiago is offline   Reply With Quote

Old   December 29, 2019, 17:17
Default
  #5
Senior Member
 
Nguyen Duy Trong
Join Date: Apr 2014
Posts: 124
Rep Power: 12
ndtrong is on a distinguished road
Quote:
Originally Posted by Santiago View Post
Good that you grasp the theory! But the matter here is not about how the normal vector is defined, but where is defined. A surface normal is defined, well, in a surface. In other words, in your case, the field is 2 dimensional, defined over a line (representing a free surface).

Seen in other way, the value of gradAlpha is seldom truly "machine zero", hence dividing it by a rather small value may produce spurious results. by confining the operator to where it "makes sense", the problems you see may be avoided alltogether.
Thanks for your suggestions
ndtrong is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Computation of Turbulence Intensity Profile from PIV vector fields emspinosa Visualization & Post-Processing 0 October 24, 2014 07:00
Normal vector, slope and aspect angle g_niro Main CFD Forum 0 February 2, 2011 17:24
out normal vector ztdep Main CFD Forum 0 September 14, 2008 08:08
Normal vector to a cell??? lagha FLUENT 2 May 28, 2002 11:23
Normal Vector on Curved Surfaces Karl FLUENT 0 July 2, 2001 04:35


All times are GMT -4. The time now is 11:41.