CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   strainrate() (https://www.cfd-online.com/Forums/openfoam-programming-development/123858-strainrate.html)

sharonyue September 23, 2013 04:18

strainrate()
 
Hi guys,

This is a piece of code in viscosity.C
Code:

Foam::tmp<Foam::volScalarField> Foam::viscosityModel::strainRate() const
{
    return sqrt(2.0)*mag(symm(fvc::grad(U_)));
}

Mathematically, it is\gamma  = \sqrt 2  \cdot \left| {\frac{1}{2}\left( {\nabla u + \nabla {u^T}} \right)} \right|

but how can I get the magnitude of a tensor? and why isn't this strainrate a tensor but a scalar? Shouldnt it be:
Code:

Foam::tmp<Foam::volTensorField> Foam::viscosityModel::strainRate() const
{
    return symm(fvc::grad(U_));
}


vonboett September 24, 2013 03:27

mag(D) = sqrt(D_ij D_ij ) = norm of strain rate tensor in OpenFOAM, where D_ij = 1/2 ((grad(U)+grad(U)^T) = symm(grad(U)) = 2*DR and that is a scalar. There are several definitions of the norm, this is one wideley used to calculate a kind of "magnitude" of the tensors components

sharonyue September 26, 2013 03:41

Quote:

Originally Posted by vonboett (Post 453258)
mag(D) = sqrt(D_ij D_ij ) = norm of strain rate tensor in OpenFOAM, where D_ij = 1/2 ((grad(U)+grad(U)^T) = symm(grad(U)) = 2*DR and that is a scalar.

Sorry. Are you sure this is a scalar?

vonboett September 30, 2013 09:35

Sorry, more precise: norm(D) = sqrt{trace(D^2)}, so if I am correct Dij above would be: Dij = 0.5*(du_i/dx_j + du_j/dx_i) + 0.5(du_i/dx_j - du_j/dx_i).
Please check if I messed with the indices, du_/dx_ stands for the corresponding derivative of the velocity.


All times are GMT -4. The time now is 08:28.