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

Normal derivatice of velocity gradient

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 8, 2021, 18:18
Default Normal derivatice of velocity gradient
  #1
Member
 
Join Date: Feb 2020
Posts: 90
Rep Power: 6
Shibi is on a distinguished road
Hello to all,

I would like to calculate the normal derivative of the velocity gradient on a patch. However, I am confused on which side to put the normal vector to dot with the velocity gradient.

From here (https://cfd.direct/openfoam/tensor-mathematics/) it follows that :

\frac{\partial \vec{v}}{\partial n} = \vec{n} \cdot \nabla \vec{v}


From here (https://en.wikipedia.org/wiki/Directional_derivative), that:

\frac{\partial T}{\partial n} =  \nabla T \cdot \vec{n}

When the gradient results in a vector, the dot product is commutative, so it does not matter the side. When it results in a tensor, this matters, and I would like to know on which side I get the correct definition.

Code:
        

tensor a (1,2,3,4,5,6,7,8,9);
 vector b (1,2,3);

 Info << (a & b) << endl;
  Info << (b & a) << endl;
Code:
(14 32 50)
(30 36 42)

Thanks in advance.
Shibi is offline   Reply With Quote

Old   July 9, 2021, 21:09
Default
  #2
Member
 
Join Date: Feb 2020
Posts: 90
Rep Power: 6
Shibi is on a distinguished road
So,

The gradient of a scalar is defined as:

\nabla s = \left ( \frac{\partial s}{\partial x}, \frac{\partial s}{\partial y}, \frac{\partial s}{\partial z}  \right )

The divergence of a vector \vec{v} = (u, v, w):

\nabla \cdot \vec{v} =  \frac{\partial u}{\partial x} + \frac{\partial v}{\partial y} +\frac{\partial w}{\partial z}

The gradient of a vector quantity is not mathematically defined, but in CFD we give it the following treatment:

\nabla \vec{v} =  \begin{bmatrix}
\underbrace{ \begin{matrix}
\frac{\partial u}{\partial x}\\ 
\frac{\partial u}{\partial y}\\ 
\frac{\partial u}{\partial z}
\end{matrix}}_{\nabla u}

\underbrace{ \begin{matrix}
\frac{\partial v}{\partial x}\\ 
\frac{\partial v}{\partial y}\\ 
\frac{\partial v}{\partial z}
\end{matrix}}_{\nabla v}

\underbrace{ \begin{matrix}
\frac{\partial w}{\partial x}\\ 
\frac{\partial w}{\partial y}\\ 
\frac{\partial w}{\partial z}
\end{matrix}}_{\nabla w}  
\end{bmatrix}

The divergence of a tensor is also not mathematically defined, and here we will analyze this as follows:

\nabla \cdot (\nabla \vec{v}) =  \left (\nabla \cdot\nabla u, \nabla \cdot\nabla v, \nabla \cdot\nabla w  \right )

I guess the same reasoning can be applied to the directional derivative, where:

\frac{\partial \vec{v}}{\partial n} =  \left (\vec{n} \cdot\nabla u, \vec{n} \cdot\nabla v, \vec{n} \cdot\nabla w  \right ) = \vec{n} \cdot \nabla \vec{v}

So, I would say, the normal vector should be multiplied on the left side to behave has a column vector.

Now... why do we have defined in programmers guide (https://sourceforge.net/projects/ope...e.pdf/download) (1)


\nabla \cdot \mathbf{T} = \begin{bmatrix}
\frac{\partial T_{11}}{\partial x_1}+ \frac{\partial T_{21}}{\partial x_1}+ \frac{\partial T_{31}}{\partial x_1} \\
\frac{\partial T_{12}}{\partial x_2}+ \frac{\partial T_{22}}{\partial x_2}+ \frac{\partial T_{32}}{\partial x_2}\\ 
\frac{\partial T_{13}}{\partial x_3}+ \frac{\partial T_{23}}{\partial x_3}+ \frac{\partial T_{33}}{\partial x_3}
\end{bmatrix}

In https://cfd.direct/openfoam/tensor-mathematics/ (2):
\nabla \cdot \mathbf{T} = \begin{bmatrix}
\frac{\partial T_{11}}{\partial x_1}+ \frac{\partial T_{12}}{\partial x_1}+ \frac{\partial T_{13}}{\partial x_1} \\
\frac{\partial T_{21}}{\partial x_2}+ \frac{\partial T_{22}}{\partial x_2}+ \frac{\partial T_{23}}{\partial x_2}\\ 
\frac{\partial T_{31}}{\partial x_3}+ \frac{\partial T_{32}}{\partial x_3}+ \frac{\partial T_{33}}{\partial x_3}
\end{bmatrix}

and in here (https://openfoamwiki.net/index.php/OpenFOAM_guide/Programmer%27s_Guide_Errata): (3)
\nabla \cdot \mathbf{T} = \begin{bmatrix}
\frac{\partial T_{11}}{\partial x_1}+ \frac{\partial T_{21}}{\partial x_2}+ \frac{\partial T_{31}}{\partial x_3} \\
\frac{\partial T_{12}}{\partial x_1}+ \frac{\partial T_{22}}{\partial x_2}+ \frac{\partial T_{32}}{\partial x_3}\\ 
\frac{\partial T_{13}}{\partial x_1}+ \frac{\partial T_{23}}{\partial x_2}+ \frac{\partial T_{33}}{\partial x_3}
\end{bmatrix}

Which formulation in OpenFoam actually using? Does is depend on the flavor (ESI, Foundation an Extend?)


From the source code we have:

Inner-product of a Vector and a Tensor (Eq3)
Code:
//- Inner-product of a Vector and a Tensor 

template<class Cmpt>
 inline typename innerProduct<Vector<Cmpt>, Tensor<Cmpt>>::type operator&(const Vector<Cmpt>& v, const Tensor<Cmpt>& t) 

{     

     return Vector<Cmpt> (        

              v.x()*t.xx() + v.y()*t.yx() + v.z()*t.zx(),         

              v.x()*t.xy() + v.y()*t.yy() + v.z()*t.zy(),         

              v.x()*t.xz() + v.y()*t.yz() + v.z()*t.zz()     

    );
 }
Shibi 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
UDF: problem with calculating velocity gradient to normal direction hkdai Fluent UDF and Scheme Programming 0 January 15, 2019 02:29
Same pressure gradient but different velocity field TurbJet Main CFD Forum 22 April 28, 2018 03:35
surface tension as function of normal gradient tom FLUENT 2 September 7, 2016 03:48
Normal particle velocity in particle deposition! Prashanth Fluent Multiphase 1 May 29, 2013 22:30
ATTENTION! Reliability problems in CFX 5.7 Joseph CFX 14 April 20, 2010 15:45


All times are GMT -4. The time now is 18:30.