CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM Post-Processing

Compute shear stress interFoam

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree17Likes

Reply
 
LinkBack Thread Tools Display Modes
Old   February 12, 2007, 17:09
Default Hi, I completed a case usin
  #1
Senior Member
 
Pei-Ying Hsieh
Join Date: Mar 2009
Posts: 317
Rep Power: 9
hsieh is on a distinguished road
Hi,

I completed a case using interFoam. How can I compute shear stress of the 3D domain based on the transient data?

Thanks!

Pei
hsieh is offline   Reply With Quote

Old   February 13, 2007, 07:04
Default // you get the stress tensor w
  #2
Senior Member
 
Markus Hartinger
Join Date: Mar 2009
Posts: 102
Rep Power: 8
hartinger is on a distinguished road
// you get the stress tensor with:

volTensorField stressTensor = - mu * (fvc::grad(U) + (fvc::grad(U)).T());
// there might be a better way describing that, if haven't used the stressTensor directly

//if you're only interested in the shearRate, for shear-thinnning for example:

volScalarField shearRate = mag(fvc::grad(U));

for the wall shear stress check the tool 'wallShearStress'

regards
markus
hartinger is offline   Reply With Quote

Old   February 13, 2007, 11:28
Default Thanks a lot Markus! Pei
  #3
Senior Member
 
Pei-Ying Hsieh
Join Date: Mar 2009
Posts: 317
Rep Power: 9
hsieh is on a distinguished road
Thanks a lot Markus!

Pei
hsieh is offline   Reply With Quote

Old   February 13, 2007, 19:58
Default Hello Pei The tool 'wallShe
  #4
Senior Member
 
santos's Avatar
 
Jose Luis Santos
Join Date: Mar 2009
Location: Portugal
Posts: 213
Rep Power: 9
santos is on a distinguished road
Send a message via Skype™ to santos
Hello Pei

The tool 'wallShearStress' didnt work for me (it kept asking me about turbulence model, but I was using DNS), so what I did was:

- Calculate U gradient at wall (using wallGradU utility);

- Then calculate the magnitude of wall shear stress by using the following:
volScalarField shear
(
IOobject
(
"shear",
runTime.timeName(),
mesh,
IOobject::NO_READ
),
8.9e-4*sqrt(sqr(wallGradU.component(vector::X)) + sqr(wallGradU.component(vector::Z)))
);
shear.write();

X and Z components were relevant in my case, your situation may be different. 8.9e-4 is the dynamic viscosity for water at room temperature, this way the shear stress comes in Pa.

Hope that this can help you!

Regards,
Josť Santos
santos is offline   Reply With Quote

Old   February 16, 2007, 15:15
Default Hi, Josť Santos, Thanks for
  #5
Senior Member
 
Pei-Ying Hsieh
Join Date: Mar 2009
Posts: 317
Rep Power: 9
hsieh is on a distinguished road
Hi, Josť Santos,

Thanks for the reply!

Do you have any idea if I would like to compute the tangential direction of wall shear stress? Because my wall is curved, so, the X and Z components may not necessarily tangent.

Pei
hsieh is offline   Reply With Quote

Old   February 16, 2007, 15:41
Default dot product with n (normal dir
  #6
liu
Senior Member
 
Xiaofeng Liu
Join Date: Mar 2009
Location: State College, PA, USA
Posts: 118
Rep Power: 8
liu is on a distinguished road
dot product with n (normal direction)
__________________
Xiaofeng Liu, Ph.D., P.E.,
Assistant Professor
Department of Civil and Environmental Engineering
Penn State University
223B Sackett Building
University Park, PA 16802


Web: http://water.engr.psu.edu/liu/
liu is offline   Reply With Quote

Old   February 16, 2007, 17:42
Default Hi, Xiaofeng: Thanks for th
  #7
Senior Member
 
Pei-Ying Hsieh
Join Date: Mar 2009
Posts: 317
Rep Power: 9
hsieh is on a distinguished road
Hi, Xiaofeng:

Thanks for the answer. I did try it, but, I got a message said that n is not defined. What will I have to include to get n in post-processing?

Pei
hsieh is offline   Reply With Quote

Old   February 16, 2007, 18:38
Default I remember there are some disc
  #8
liu
Senior Member
 
Xiaofeng Liu
Join Date: Mar 2009
Location: State College, PA, USA
Posts: 118
Rep Power: 8
liu is on a distinguished road
I remember there are some discussion on this issure. Search "wall shear stress" may do the work.
__________________
Xiaofeng Liu, Ph.D., P.E.,
Assistant Professor
Department of Civil and Environmental Engineering
Penn State University
223B Sackett Building
University Park, PA 16802


Web: http://water.engr.psu.edu/liu/
liu is offline   Reply With Quote

Old   February 16, 2007, 19:22
Default Hi, Xiaofeng, I did do a se
  #9
Senior Member
 
Pei-Ying Hsieh
Join Date: Mar 2009
Posts: 317
Rep Power: 9
hsieh is on a distinguished road
Hi, Xiaofeng,

I did do a search on "wall shear stress". I have also looked at the source code of wallShearStress under postprocessing/wall. It is not obvious to me how to get n.

Pei
hsieh is offline   Reply With Quote

Old   February 16, 2007, 19:56
Default Hi, I just happened to brow
  #10
Senior Member
 
Philippose Rajan
Join Date: Mar 2009
Location: Germany
Posts: 530
Rep Power: 16
philippose will become famous soon enough
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
philippose is offline   Reply With Quote

Old   February 17, 2007, 06:52
Default Hi, Philipose, Thanks for t
  #11
Senior Member
 
Pei-Ying Hsieh
Join Date: Mar 2009
Posts: 317
Rep Power: 9
hsieh is on a distinguished road
Hi, Philipose,

Thanks for the detailed post.

The solver I used was standard interFoam. So, this is a laminar case.

The question I am having is:

Does U.boundaryField()[patchi].snGrad() contains normal component of shear (shear stress normal to wall)?

In my case, I have a curve wall with strong centrifugal force. I am only interested in the shear stress tangent to the wall.

Do a n dot U.boundaryField()[patchi].snGrad() should remove the normal component, correct?

What do I have to do to get n in post-processing?

Pei
hsieh is offline   Reply With Quote

Old   February 17, 2007, 09:10
Default Hello Pei, A Good day to yo
  #12
Senior Member
 
Philippose Rajan
Join Date: Mar 2009
Location: Germany
Posts: 530
Rep Power: 16
philippose will become famous soon enough
Hello Pei,
A Good day to you!

Looks like you have a small confusion regarding the issue of shear stress at a wall.

Lets go from the basics.... we know that for a Newtonian fluid, shear stress (Tau) is given by the equation:

Tau = mu * (dU/dy)

This can be seen in the image below:



In your case, the "boundary plate (stationary)" would be the wall (i.e., the fluid is moving relative to the wall).

In the image, the term "gradient, dU/dy" is what is given by the openFOAM term:

U.boundaryField()[patchi].snGrad()

It is the "change in velocity U, with distance y, normal to the wall", which is basically, the gradient "dU/dy".

When you multiply this term with the dynamic viscosity of the medium, you get the shear stress on the wall due to the motion of the fluid, and ofcourse, this shear stress is by definition, tangential to the wall.

So you dont need to take a dot product of the snGrad with a vector tangential to the surface, because by definition, tangential wall shear stress is proportional to the gradient of velocity normal to the wall.
oscarli, Kent_Neo and Uyan like this.
philippose is offline   Reply With Quote

Old   February 17, 2007, 09:54
Default Hello Philippose I have a q
  #13
Senior Member
 
santos's Avatar
 
Jose Luis Santos
Join Date: Mar 2009
Location: Portugal
Posts: 213
Rep Power: 9
santos is on a distinguished road
Send a message via Skype™ to santos
Hello Philippose

I have a question regarding your good explanation of wall shear stress.

When we calculate:

U.boundaryField()[patchi].snGrad()

we get the velocity gradient at the wall, and in OpenFOAM definition, U is a vector with components x, y and z, so the previous calculation would give us (assuming y is normal to the wall):

(dUx/dy, dUy/dy, dUz/dy)

Isnt dUy/dy a normal stress? And the shear stress wouldnt be calculated using the other two components?

Regards,
Josť Santos
santos is offline   Reply With Quote

Old   February 17, 2007, 15:09
Default Hi Josť, Interesting questio
  #14
Senior Member
 
Philippose Rajan
Join Date: Mar 2009
Location: Germany
Posts: 530
Rep Power: 16
philippose will become famous soon enough
Hi Josť,
Interesting question! In order to answer that, I guess we will have to look deeper into the implementation of the "snGrad" function in OpenFOAM.

I was trying to locate the definition of the function, and found something in the "fvPatchField.H" file in the "finiteVolume/lnInclude" directory of the openFOAM source.

As far as I understood, the snGrad function takes the difference between the value (in this case U) at the patch face, and in the internal field next to the patch, and divides it by the distance from the patch face to the centre of the corresponding cell.

So technically, if there exists a velocity component in a direction normal to the wall, that would come up as a term in the stress calculation (I hope someone corrects me if I am wrong :-)!)

On the other hand, when one talks about laminar flow, one of the basic assumptions is that the fluid flows in the form of shear layers in regions close to walls, and at a distance of one cell height from the wall, you will not (must not / should not) have flow in a direction normal to the wall... if a normal component exists so close to a wall, it would be more or less violating the laminar flow assumptions.

If I am wrong, it would be great if someone could correct me :-)!

Have a nice day!

Philippose
desert_1250 and reza2031 like this.
philippose is offline   Reply With Quote

Old   February 18, 2007, 07:55
Default Thanks Philippose! I get it
  #15
Senior Member
 
Pei-Ying Hsieh
Join Date: Mar 2009
Posts: 317
Rep Power: 9
hsieh is on a distinguished road
Thanks Philippose!

I get it now.

Pei
hsieh is offline   Reply With Quote

Old   May 30, 2007, 12:19
Default Hi all, I'm trying to use M
  #16
New Member
 
Giovanni Boldrini
Join Date: Mar 2009
Location: Bologna, Italy
Posts: 10
Rep Power: 8
giovanni is on a distinguished road
Hi all,

I'm trying to use Markus's

volTensorField stressTensor = - mu * (fvc::grad(U) + (fvc::grad(U)).T());

in a rhoSimpleFoam case for OpenFOAM 1.4, but appears this error message:

error: 'class Foam::tmp<foam::geometricfield<foam::tensor<double >, Foam::fvPatchField, Foam::volMesh> >' has no member named 'T'

Can anyone help me to solve this problem?

Thanks a lot!


Giovanni
giovanni is offline   Reply With Quote

Old   May 30, 2007, 13:12
Default Hi Giovanni, the stuff i po
  #17
Senior Member
 
Markus Hartinger
Join Date: Mar 2009
Posts: 102
Rep Power: 8
hartinger is on a distinguished road
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());
sina.s and mgg like this.
hartinger is offline   Reply With Quote

Old   May 31, 2007, 07:18
Default Thank you Markus, I'll try
  #18
New Member
 
Giovanni Boldrini
Join Date: Mar 2009
Location: Bologna, Italy
Posts: 10
Rep Power: 8
giovanni is on a distinguished road
Thank you Markus,

I'll try as soon as possible (this afternoon I think)!

Have a nice day!

Giovanni
giovanni is offline   Reply With Quote

Old   May 6, 2008, 10:30
Default Hi and good eveninghttp://www.
  #19
ngj
Senior Member
 
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Deltares, Delft, The Netherlands
Posts: 1,608
Rep Power: 25
ngj will become famous soon enoughngj will become famous soon enough
Hi and good evening

I have been reading the above discussion several times, and I have been thinking what to do about the bed shear stresses. I like the procedure of simply calculating

dU_dn = U.boundaryField().snGrad()

though in my case, I will have vertical velocity components in the cell next to the wall, as I consider non-stationary flows such as wave boundary layers. Thus I will suggest a slightly modified version of Phillipposes (please consider if I am off track).

As I get a non-zero surface-normal component in dU_dn the bed shear stress is not aligned with the bed, which is wrong. Thus I suggest to make a projection of dU_dn onto the boundary patch. Then the bed shear stress will definitely be aligned with the bed, and therefor being shear stress components only and not a combination of shear and normal stresses.

Based on this: http://www.euclideanspace.com/maths/geometry/elements/plane/lineOnPlane/index.ht m l
the projection reads:

tau / mu = sf x (dU_dn x sf / magSf) / magSf

where sf is the surface normal gradient, magSf is the magnitude of sf and x takes the role of the cross product. I have projected dU_dn, since snGrad() takes care of the non-orthogonality of the mesh.

I would like to hear if you agree and especially if there are any numerical traps which I have walked straight into.

Best regards,

Niels
__________________
Please note that I do not use the Friend-feature, so do not be offended, if I do not accept a request.
ngj is offline   Reply With Quote

Old   June 10, 2009, 15:30
Default
  #20
Member
 
Sven Winkler
Join Date: May 2009
Posts: 70
Rep Power: 8
sven is on a distinguished road
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??
sven is offline   Reply With Quote

Reply

Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Interfoam Droplet under shear test case adona058 OpenFOAM Running, Solving & CFD 3 May 3, 2010 18:46
shear stress a.abbaspour FLUENT 3 March 23, 2010 10:50
Shear Stress Thomas FLUENT 0 January 13, 2008 16:10
About shear stress, need help!! Dong Wenchao FLUENT 1 August 23, 2006 07:38
Shear Stress RK CFX 0 January 24, 2005 08:11


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