
[Sponsors] 
February 12, 2007, 17:09 
Hi,
I completed a case usin

#1 
Senior Member
PeiYing Hsieh
Join Date: Mar 2009
Posts: 317
Rep Power: 10 
Hi,
I completed a case using interFoam. How can I compute shear stress of the 3D domain based on the transient data? Thanks! Pei 

February 13, 2007, 07:04 
// you get the stress tensor w

#2 
Senior Member
Markus Hartinger
Join Date: Mar 2009
Posts: 102
Rep Power: 9 
// 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 shearthinnning for example: volScalarField shearRate = mag(fvc::grad(U)); for the wall shear stress check the tool 'wallShearStress' regards markus 

February 13, 2007, 11:28 
Thanks a lot Markus!
Pei

#3 
Senior Member
PeiYing Hsieh
Join Date: Mar 2009
Posts: 317
Rep Power: 10 
Thanks a lot Markus!
Pei 

February 13, 2007, 19:58 
Hello Pei
The tool 'wallShe

#4 
Senior Member

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.9e4*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.9e4 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 

February 16, 2007, 15:15 
Hi, José Santos,
Thanks for

#5 
Senior Member
PeiYing Hsieh
Join Date: Mar 2009
Posts: 317
Rep Power: 10 
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 

February 16, 2007, 15:41 
dot product with n (normal dir

#6 
Senior Member
Xiaofeng Liu
Join Date: Mar 2009
Location: State College, PA, USA
Posts: 118
Rep Power: 9 
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/ 

February 16, 2007, 17:42 
Hi, Xiaofeng:
Thanks for th

#7 
Senior Member
PeiYing Hsieh
Join Date: Mar 2009
Posts: 317
Rep Power: 10 
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 postprocessing? Pei 

February 16, 2007, 18:38 
I remember there are some disc

#8 
Senior Member
Xiaofeng Liu
Join Date: Mar 2009
Location: State College, PA, USA
Posts: 118
Rep Power: 9 
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/ 

February 16, 2007, 19:22 
Hi, Xiaofeng,
I did do a se

#9 
Senior Member
PeiYing Hsieh
Join Date: Mar 2009
Posts: 317
Rep Power: 10 
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 

February 16, 2007, 19:56 
Hi,
I just happened to brow

#10 
Senior Member
Philippose Rajan
Join Date: Mar 2009
Location: Germany
Posts: 543
Rep Power: 17 
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 sourcecode. 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 

February 17, 2007, 06:52 
Hi, Philipose,
Thanks for t

#11 
Senior Member
PeiYing Hsieh
Join Date: Mar 2009
Posts: 317
Rep Power: 10 
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 postprocessing? Pei 

February 17, 2007, 09:10 
Hello Pei,
A Good day to yo

#12 
Senior Member
Philippose Rajan
Join Date: Mar 2009
Location: Germany
Posts: 543
Rep Power: 17 
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. 

February 17, 2007, 09:54 
Hello Philippose
I have a q

#13 
Senior Member

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 

February 17, 2007, 15:09 
Hi José,
Interesting questio

#14 
Senior Member
Philippose Rajan
Join Date: Mar 2009
Location: Germany
Posts: 543
Rep Power: 17 
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 

February 18, 2007, 07:55 
Thanks Philippose!
I get it

#15 
Senior Member
PeiYing Hsieh
Join Date: Mar 2009
Posts: 317
Rep Power: 10 
Thanks Philippose!
I get it now. Pei 

May 30, 2007, 12:19 
Hi all,
I'm trying to use M

#16 
New Member
Giovanni Boldrini
Join Date: Mar 2009
Location: Bologna, Italy
Posts: 10
Rep Power: 9 
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 

May 30, 2007, 13:12 
Hi Giovanni,
the stuff i po

#17 
Senior Member
Markus Hartinger
Join Date: Mar 2009
Posts: 102
Rep Power: 9 
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()); 

May 31, 2007, 07:18 
Thank you Markus,
I'll try

#18 
New Member
Giovanni Boldrini
Join Date: Mar 2009
Location: Bologna, Italy
Posts: 10
Rep Power: 9 
Thank you Markus,
I'll try as soon as possible (this afternoon I think)! Have a nice day! Giovanni 

May 6, 2008, 10:30 
Hi and good eveninghttp://www.

#19 
Senior Member
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Deltares, Delft, The Netherlands
Posts: 1,726
Rep Power: 28 
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 nonstationary 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 nonzero surfacenormal 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 nonorthogonality 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 Friendfeature, so do not be offended, if I do not accept a request. 

June 10, 2009, 15:30 

#20 
Member
Sven Winkler
Join Date: May 2009
Posts: 70
Rep Power: 9 
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?? 

Thread Tools  
Display Modes  


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 