CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Post-Processing (https://www.cfd-online.com/Forums/openfoam-post-processing/)
-   -   Compute shear stress interFoam (https://www.cfd-online.com/Forums/openfoam-post-processing/61393-compute-shear-stress-interfoam.html)

bagherij April 3, 2015 20:02

compute shear strees
 
Dear all
I am beginner in openfoam, i am working on creeping flow around cylinder between two plate, how can i compute shear stress, tau, (and compare with yield stress tau0) ?
which and where should i add line code?

i want to display the points where tau>tau0 ,how can i display that?

Best regards
Jafar

arash.heidarian June 17, 2015 07:42

compute shear stress in interfoam
 
Hi fomers..:
I have completed a case with interfoam and I am interested in adding shear stress to my output files.
I checked the last posts but i didn't figure out where to add this equation in my solver.
volScalarField shearRate = mag(fvc::grad(U));
I would be really thanks full if any one help!:(

David* June 17, 2015 08:39

Hi bagherij and arash.heidarian,

I would recommend to you to perform this calculations with the ParaView calculator, as it is easier for the start.

If you still want to compute the shear stress on-the-fly within OpenFOAM, I'd suggest you to look at the coded function object, which you can include in your controlDict, see: http://www.openfoam.org/version2.0.0...me-control.php

Best regards,
David

StefanW April 15, 2016 04:41

Hi guys,

i just created a similar thread according the topic:
calculation of wall shear stresses in multiphase depending on mesh size?

http://www.cfd-online.com/Forums/ope...tml#post595106

Maybe it is also interesting for you and you can help me to solve the problems

Thank you in advance

Stefan

Ananthakrishnan April 19, 2016 05:19

calcFvcGrad - U - shear stress profile
 
1 Attachment(s)
Hi,

I am trying to get the shear stress profile in a cross section using stress = mu * (du/dr). Solver used is simpleFoam.

I used the readymade tool " calcFvcGrad " on the U field which gave me 8 velocity gradients!!! But the shear stress reproduced using one of the U fields matches at the wall with the value given by "wallShearStress" tool.

My doubt is what are the 8 gradients referring to. Also please let me know if the method i followed to obtain shear stress is flawed in any manner.

I have attached the file generated by calcFvcGrad (I have added shear stress calculation in the same file)

My geometry is a concentric annulus as show below in which i need the shear stress profile in a cross section.

http://s19.postimg.org/ec8e6n89r/rotating.jpg

Thanks a lot
Regards
AK

alimea January 24, 2017 03:29

Quote:

Originally Posted by hartinger (Post 186015)
Hi Giovanni,

the stuff i posted wasn't correct, do it like that:

volTensorField gradU = fvc::grad(U);

// stress tensor
volTensorField tau =
- mu * (gradU + gradU.T());


Excuse me,
what's the meaning of "gradU.T()" in mathematics? is it inner product of gradU and T tensor?
could you plz introduce me a source to give me a list of definition of these type of programing?

David* January 24, 2017 04:08

Quote:

Originally Posted by alimea (Post 634474)
Excuse me,
what's the meaning of "gradU.T()" in mathematics? is it inner product of gradU and T tensor?
could you plz introduce me a source to give me a list of definition of these type of programing?

It is the Transpose of gradU according to the OF Programmer's Guide, see https://openfoamwiki.net/index.php/O...s_Guide_Errata

alimea January 24, 2017 04:12

Quote:

Originally Posted by David* (Post 634484)
It is the Transpose of gradU according to the OF Programmer's Guide, see https://openfoamwiki.net/index.php/O...s_Guide_Errata

Thank you
But there was not operation on tensors. e.g. inner product, outer ,...

Regards

TemC February 13, 2017 03:04

1 Attachment(s)
Hi experts,

I am working with simpleFoam, with which I simulated the flow of an Hershel-Bulkley fluid. Now I wan to compute the shear strain rate. On this forum you suggested to do that this way:

volTensorField gradU = fvc::grad(U);

// stress tensor
volTensorField tau =
- mu * (gradU + gradU.T());

I'am a new foamer, so my question might seem stupid to you, but I really have to ask. Those preceeding equations, should I put them in my simpleFoam.C file? Or in my createField.H file?

Because when I put them into my createField.H file like in the attachment, I got an error saying : 'grad' was not declared in the scope of volTensorField gradU (tau).

The second question is should I initialize those tensor fields? With a command like:

dimensionedTensor("tau",dimensionset(...), tensor(...))


I hope you will find a couple of minutes to answer me. Thanks in advance.

Best regards.

tdof February 14, 2017 09:05

Hi,

I can't help you with your question unfortunately, because I face a similar problem. I want to get the shear rate and possibly the shear rate dependent viscosity for non-Newtonian fluids, but I don't know where to put the lines of code you referred to. A little bit of help would be great.

Edit: Alright, I just found out that ParaView displays the viscosity nu, but Hyperview won't do it just as easily. Does anybody know how to get OpenFOAM to output the needed values?

TemC March 3, 2017 04:45

Hi "tdof",

Nonetheless thank you for you answer :).

Have a good week.

Mahe88 March 13, 2017 14:26

Hello,

I also have a question regarding wall shear stress for which I haven't found the answer yet. I am simulation airfoils and need the wall shear stress to identify the regions of detached flow.

I use the postProcessing Utility to compute the wall shear stress, however I am not quite sure in which coordinate system OpenFOAM gives me the values. Is it the local one from my blockMesh or is it the global one?

My flow direction is the x-Direction, y-Direction is upwards and z-Direction is empty since this is a 2D case. When I compute the wall shear stress OpenFoam gives me values for 0 and 1 direction. So far it makes for both the local and global coordinate system.
However the 0 value is almost always negative, which doesn't make sense for the global coordinate system. ( Flow on the airfoils surface would be against the flow direction)

Therefor I think wall shear stress is in the local coordinate system. can somebody confirm this please? :)

thanks!

David* March 14, 2017 03:52

I don't have the answer, just in case you have no starting point:
Try to understand this line
Code:

ssp = (-Sfp/magSfp) & Reffp;
from https://github.com/OpenFOAM/OpenFOAM...lShearStress.C

using the OF Programmer's Guide.

albet April 29, 2017 19:40

Hello,

I used interFoam to solve a two-phase flow, and I want to use the wallShearStress utility, but it works only for single-phase flow.
Could anybody help me how I can change the wallShearStress to be applicable for two-phase flow?

Regards,
Amir

randolph July 19, 2018 12:28

Quote:

Originally Posted by philippose (Post 186008)
Hi,
I just happened to browse through this dialogue regarding calculating wall shear stresses.

In the simple case, if you take laminar flow, the wall shear stress is calculated using the equation:

Tau (shear stress) = mu * (dU/dy)

In this equation, "mu" is the dynamic viscosity of the medium, and "(dU/dy)" is the change in velocity "U" with change in "y", which is the distance from the wall in a direction normal to the wall.

Now, in the case of incompressible solvers in openFOAM, the whole system is normalised with respect to the fluid density "rho".... so in this case, the dynamic viscosity (mu) is given by:

mu = nu * rho

Where "nu" is the kinematic viscosity, defined in the "transportProperties" dictionary, and "rho" would depend on the fluid you are working with.

Now, to implement this in openFOAM, there exists a class member called "snGrad". This directly gives you the gradient of velocity (dU/dy) normal to each face of the wall patches.

So, you would use:

wallShear = nu * rho * mesh.boundaryField()[patchID].snGrad()

This directly gives you the wall shear stress (assuming the "patchID" refers to a wall patch ofcourse). Here, you can read "nu" from the transportProperties dictionary, and you will have to define "rho" somewhere.

When the case is not laminar, but turbulent, then things look a bit different, which is why you may have gotten confused when you looked through the wallShearStress source-code.

In this case, the Reynolds Stress Tensor gives you the shear stress, but not necessarily normal to the face, and you need to resolve the tensor along the normal to the face in order to obtain the wall shear stress.

This is because in the case of turbulent simulations, the viscosity is not a constant, and is an effective value which is a result of the turbulence model, and the Reynolds Stress Tensor.

So, to calculate the wall shear stress in the case of a turbulent simulation, you need to do something like:

wallShear = (-mesh.Sf().boundaryField()[patchID]/(mag(mesh.Sf().boundaryField()[patchID])) ) & (turbulence->R()().boundaryField()[patchID])

The above equation will give you the wall shear stress with the velocity gradient resolved in the direction normal to each face in the patch.

Have a nice day!

Philippose

I think devReff()() should be used instead of R()()

Miss Li October 12, 2018 00:02

hei
 
Quote:

Originally Posted by sven (Post 218860)
Hello,

in this thread you it is often mentioned to use something like "U.boundaryField()[patchi].snGrad()" to calculate a gradient. How do I do this? is this a command for bash or what do I have to do to use this function for calculating a gradient??

sorry,I want to look for problems that have been solved on CFD Online before, can you tell me how to search quickly.
thank you!

albet December 19, 2018 13:14

Quote:

Originally Posted by randolph (Post 699842)
I think devReff()() should be used instead of R()()

You are right.

Code:

wallShear = (-mesh.Sf().boundaryField()[patchID]/(mag(mesh.Sf().boundaryField()[patchID])) ) & (turbulence->devReff()().boundaryField()[patchID])
I checked it. This piece of code gives the values equal to wallShearStress utility.

Kind regards,
Amir

calf.Z November 5, 2019 10:56

Quote:

Originally Posted by David* (Post 550747)
Hi bagherij and arash.heidarian,

I would recommend to you to perform this calculations with the ParaView calculator, as it is easier for the start.

If you still want to compute the shear stress on-the-fly within OpenFOAM, I'd suggest you to look at the coded function object, which you can include in your controlDict, see: http://www.openfoam.org/version2.0.0...me-control.php

Best regards,
David

I am wondering how I can use paraview to calculate wallShearStress, thank you.

Lil June 20, 2022 05:15

Hello,

I know that is an old post but i'm facing the same problem. Can anayone tell me when I can implement the wall shear stress equation in openfoam (.C or .H?)


All times are GMT -4. The time now is 07:14.