# Measuring wall shear stress in bend pipe

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

February 13, 2012, 20:02
#21
Member

Guifan Li
Join Date: Apr 2011
Location: New York City, U.S.
Posts: 96
Rep Power: 7
Can you post your bifurcation geometry as well as how you measure the WSS?

Quote:
 Originally Posted by itsme_kit Hi Can you tell me how to measure the wall shear stress? I'm confused why my wall shear stress is zero and only a tiny part in inlet is non-zero I am modelling a 3D laminar straight pipe flow by using star ccm

February 14, 2012, 11:24
#22
Senior Member

Ke Wu
Join Date: Jan 2012
Posts: 179
Rep Power: 6
Quote:
 Originally Posted by liguifan Can you post your bifurcation geometry as well as how you measure the WSS?
I uploaded some plots and you can have a look
I'm not sure how to measure WSS
I just created a scalar plot and then selected wall in parts and WSS in function

Appreciate any useful suggestion

Thanks
Attached Images
 2.jpg (34.6 KB, 121 views) 3.jpg (28.5 KB, 115 views) 4.jpg (32.2 KB, 112 views) 5.jpg (32.3 KB, 94 views) 6.jpg (25.6 KB, 104 views)

February 14, 2012, 19:50
#23
Member

Guifan Li
Join Date: Apr 2011
Location: New York City, U.S.
Posts: 96
Rep Power: 7
I think there is tool under filter is plot over intersection curve.
1) In property inspection field, choose the wall object (whoever the name you named it).
2) Use "Clip" to get rid of the part you do not want to measure.
3) Use "Plot over intersection curve" to plot the wall shear stress over the line which is the intersection of a plane and the wall.

Quote:
 Originally Posted by itsme_kit I uploaded some plots and you can have a look I'm not sure how to measure WSS I just created a scalar plot and then selected wall in parts and WSS in function Appreciate any useful suggestion Thanks

 August 13, 2012, 09:11 #24 New Member   Tian Coulsting Join Date: Jun 2012 Posts: 19 Rep Power: 6 Hi guys, Is there any way that you can output the wall shear stress at every calculated time step (to use this as a measure of convergence to a steady state)? I would like to incorporate it into the solver but not quite sure what the script would look like. Any help would be greatly appreciated. Cheers, Tian

 August 13, 2012, 09:17 #25 Senior Member     Amir Join Date: May 2009 Location: Montreal, QC Posts: 739 Blog Entries: 1 Rep Power: 15 Hi, Try this: solve->monitor->surface .... wall fluxes (wall shear stress) Bests, __________________ Amir

August 13, 2012, 13:42
#26
New Member

Tian Coulsting
Join Date: Jun 2012
Posts: 19
Rep Power: 6
Quote:
 Originally Posted by Amir Hi, Try this: solve->monitor->surface .... wall fluxes (wall shear stress) Bests,
Sorry, where does this go? In the solver.C file? (I have made a new solver called mypisoFoam) I have been trying to incorporate an average wall shear stress calculator over the top surface of my simulation. I have added this to mypisoFoam.C:

// Print out average wall shear stress over topSurface
// // find the identification number (e.g. label) for our boundary of interest.
label topSurfacePatch = mesh.boundaryMesh().findPatchID("topSurface");
// if we don't have such a patch, warn the user
//
if (topSurfacePatch==-1)
{
Info << "Failure to find patch named topSurface for average wall shear stress calc."
<< endl;
}
else // calculate the result and do output
{
// the sum operator implicity loops over the boundary faces and stores the result in avgWSS

scalar avgWSS = 0.0;
avgWSS = sum(wallShearStress.boundaryField()[topSurfacePatch]);
reduce(avgWSS,sumOp<scalar>());
Info << "Monitor: at Time = " << runTime.timeName() << " -- Average wall shear stress over top surface= " << avgWSS <<" [kg/(m*s^2)] " ;
}

When compiling with wmake, the following message appears:

Making dependency list for source file mypisoFoam1.C
SOURCE=mypisoFoam1.C ; g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3 -DNoRepository -ftemplate-depth-100 -I/hpcwarwick/openfoam/2.1.0/OpenFOAM-2.1.0/src/turbulenceModels/incompressible/turbulenceModel -I/hpcwarwick/openfoam/2.1.0/OpenFOAM-2.1.0/src/transportModels -I/hpcwarwick/openfoam/2.1.0/OpenFOAM-2.1.0/src/transportModels/incompressible/singlePhaseTransportModel -I/hpcwarwick/openfoam/2.1.0/OpenFOAM-2.1.0/src/finiteVolume/lnInclude -IlnInclude -I. -I/hpcwarwick/openfoam/2.1.0/OpenFOAM-2.1.0/src/OpenFOAM/lnInclude -I/hpcwarwick/openfoam/2.1.0/OpenFOAM-2.1.0/src/OSspecific/POSIX/lnInclude -fPIC -c \$SOURCE -o Make/linux64GccDPOpt/mypisoFoam1.o
mypisoFoam1.C: In function â€˜int main(int, char**)â€™:
mypisoFoam1.C:175: error: â€˜wallShearStressâ€™ was not declared in this scope
make: *** [Make/linux64GccDPOpt/mypisoFoam1.o] Error 1

The problem appears to be that it can't find wallShearStress as a variable. How do I make it calculate/read this?

Cheers

Tian

August 13, 2012, 14:37
#27
Senior Member

Amir
Join Date: May 2009
Location: Montreal, QC
Posts: 739
Blog Entries: 1
Rep Power: 15
Oh, sorry about previous post, that was a forum conflict!
But in openFoam it seems that the original utility compute wall traction instead of wall shear stress and I posted the revised form you can easily embed it in your solver and assess its changing. (note that it's a revised utility now which can be used in this form as a utility or you can put in your desired code with few manipulation)
see the attachment ...
(the error of your code is that you haven't defined wall shear stress yet)
Attached Files
 shear.zip (2.2 KB, 100 views)
__________________
Amir

 August 13, 2012, 18:04 #28 New Member   Tian Coulsting Join Date: Jun 2012 Posts: 19 Rep Power: 6 Thanks a lot for your reply Amir. Does the old wallShearStress function not actually give wall shear stress then? In your utility it requires a tau file in the 0 directory and therefore gives the resulting error message: --> FOAM FATAL IO ERROR: cannot find file file: /gpfs/home/eng/mauiie/OpenFOAM/mauiie-2.1.0/run/project/cavity2D/solverTest/0/tau at line 0. From function regIOobject::readStream() in file db/regIOobject/regIOobjectRead.C at line 73. FOAM exiting Is this a file used by the RAS solvers? It appears that this utility is designed for RAS not LES. With the old utility it was possible to make some alterations to the script (mainly changing RAS to LES wherever it occurred) and the utility would just as well with an LES case. Is this possible also with this solver? Also, how would you embed the function into the solver? Would you simply copy and paste it in? Or would you do something more a long the lines I started with? Sorry for all the questions, I am a bit new to OpenFOAM. Please bear with me

August 14, 2012, 06:26
#29
Senior Member

Amir
Join Date: May 2009
Location: Montreal, QC
Posts: 739
Blog Entries: 1
Rep Power: 15
Quote:
 Originally Posted by TianC Does the old wallShearStress function not actually give wall shear stress then?
No, as I said it leads to wall traction instead of wall shear stress. (you can easily check the formulation)
Quote:
 Originally Posted by TianC In your utility it requires a tau file in the 0 directory and therefore gives the resulting error message: --> FOAM FATAL IO ERROR: cannot find file file: /gpfs/home/eng/mauiie/OpenFOAM/mauiie-2.1.0/run/project/cavity2D/solverTest/0/tau at line 0. From function regIOobject::readStream() in file db/regIOobject/regIOobjectRead.C at line 73. FOAM exiting
Of course it is! the tau parameter depends on your model. (actually I prepared it for viscoelastic solver where the tau parameter exists but for general cases you have to set its formulation in your code)
Quote:
 Originally Posted by TianC Is this a file used by the RAS solvers? It appears that this utility is designed for RAS not LES. With the old utility it was possible to make some alterations to the script (mainly changing RAS to LES wherever it occurred) and the utility would just as well with an LES case. Is this possible also with this solver?
It's the general from and you can set it for any solver appropriately.
Quote:
 Originally Posted by TianC Also, how would you embed the function into the solver? Would you simply copy and paste it in? Or would you do something more a long the lines I started with?
Sure, I did it for a simple code which uses moving reference frame; but note that according to the code, there must be initializing files additional to the current one in 0 folder where you can change them according to your purpose from IOobject control .... (see the attachment) it's just a template; you can change the IOobject.
Attached Files
 test.zip (3.3 KB, 53 views)
__________________
Amir

 August 15, 2012, 07:23 #30 New Member   Tian Coulsting Join Date: Jun 2012 Posts: 19 Rep Power: 6 Thank you again for your help so far. I've managed to incorporate the wall shear stress into my solver now (after some modifications to createFields.H). Ideally what I want is to output an average of wall shear stress over the top surface of my simulation into a log file (for every deltaT). I have put this script in at the end of my script: // Print out average wall shear stress over topSurface // // find the identification number (e.g. label) for our boundary of interest. label topSurfacePatch = mesh.boundaryMesh().findPatchID("topSurface"); // if we don't have such a patch, warn the user // if (topSurfacePatch==-1) { Info << "Failure to find patch named topSurface for average wall shear stress calc." << endl; } else // calculate the result and do output { // the sum operator implicity loops over the boundary faces and stores the result in avgWSS scalar avgWSS = 0.0; avgWSS = sum(mag(shear.boundaryField()[topSurfacePatch])); reduce(avgWSS,sumOp()); Info << "Monitor: at Time = " << runTime.timeName() << " -- Average wall shear stress over top surface= " << avgWSS <<" [kg/(m*s^2)] " ; } It is now outputting the sum of over all of that patch. The only thing I need to know is how to say divide by the total number of points on that face??(this is because I need the average not the sum) Cheers Tian

 August 15, 2012, 07:31 #31 New Member   Tian Coulsting Join Date: Jun 2012 Posts: 19 Rep Power: 6 Also, the script that gives a line break would be very useful

August 15, 2012, 08:55
#32
Senior Member

Amir
Join Date: May 2009
Location: Montreal, QC
Posts: 739
Blog Entries: 1
Rep Power: 15
Quote:
 Originally Posted by TianC It is now outputting the sum of over all of that patch. The only thing I need to know is how to say divide by the total number of points on that face??(this is because I need the average not the sum)
Have you taken a look over patchAverage utility? (postProcessing->patch->patchAverage)
As you can see; you'll need to compute patch area there (not the numbers!):

scalar area = gSum(mesh.magSf().boundaryField()[patchI]);

Quote:
 Originally Posted by TianC Also, the script that gives a line break would be very useful
use endl (see the above utility (patchAverage))

Bests,
__________________
Amir

August 15, 2012, 09:53
#33
New Member

Tian Coulsting
Join Date: Jun 2012
Posts: 19
Rep Power: 6
Quote:
 Originally Posted by Amir Have you taken a look over patchAverage utility? (postProcessing->patch->patchAverage) As you can see; you'll need to compute patch area there (not the numbers!): scalar area = gSum(mesh.magSf().boundaryField()[patchI]);
Thank you again Amir, your help is greatly appreciated.

Why should it be over the patch area rather than the number of points on that patch? Since the shear utility outputs a vector at every point on the patch, surely the more points you have (i.e. a finer resolution of mesh) the greater the sum of these vectors will be. So it is by dividing by the number of points that you would achieve the average.

Cheers,

Tian

August 15, 2012, 10:47
#34
Senior Member

Amir
Join Date: May 2009
Location: Montreal, QC
Posts: 739
Blog Entries: 1
Rep Power: 15
Quote:
 Originally Posted by TianC Why should it be over the patch area rather than the number of points on that patch? Since the shear utility outputs a vector at every point on the patch, surely the more points you have (i.e. a finer resolution of mesh) the greater the sum of these vectors will be. So it is by dividing by the number of points that you would achieve the average.
The resolution is not the concern but the mesh grading is. If you have equal-size faces, you'll achieve the same result. But generally, your formulation doesn't lead to the average value physically because it doesn't contribute the weighting! these are the formulations:
- The correct formulation: (1/area)*sum(shear*area)

Bests,
__________________
Amir

 August 15, 2012, 11:25 #35 New Member   Tian Coulsting Join Date: Jun 2012 Posts: 19 Rep Power: 6 Ah, I see... I did not realise the calculated values were weighted by the size of the cells! Looking over the script I have an understanding of all aspects except, why do you write this: volTensorField T=mu*(gradU+gradU.T()); T you say is the stress tensor which is the Jacobian of the velocity (i.e. gradU) and I assume you multiply by mu because it's as good a stage as any to do so. However, why the "+gradU.T()"? Cheers Tian

August 15, 2012, 14:43
#36
Senior Member

Amir
Join Date: May 2009
Location: Montreal, QC
Posts: 739
Blog Entries: 1
Rep Power: 15
Quote:
 Originally Posted by TianC T you say is the stress tensor which is the Jacobian of the velocity (i.e. gradU) and I assume you multiply by mu because it's as good a stage as any to do so. However, why the "+gradU.T()"? Tian
Because it's the constitutive equation! Take a look over basic fluid mechanic equation in a continuum media.
(T=2*mu*D) for incompressible flow
D : symmetric part of grad(U)

Bests,
__________________
Amir

 August 26, 2012, 05:02 #37 New Member   Tian Coulsting Join Date: Jun 2012 Posts: 19 Rep Power: 6 Hi again! I seem to be getting far too high values out for wall shear stress. I have implemented a monitor in my solver, so that it outputs average wall shear stress over the top surface of my simulation. The code looks as follows: volTensorField gradU=fvc::grad(U); volTensorField T=mu*(gradU+gradU.T()); volVectorField nn ( IOobject ( "nn", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::NO_WRITE ), mesh, vector::zero ); forAll(nn.boundaryField(), patchI) { nn.boundaryField()[patchI] = ( -mesh.Sf().boundaryField()[patchI] /mesh.magSf().boundaryField()[patchI] ); } forAll(wallShearStress.boundaryField(), patchI) { wallShearStress.boundaryField()[patchI] = nn.boundaryField()[patchI] & T.boundaryField()[patchI]; } forAll(normal.boundaryField(), patchI) { normal.boundaryField()[patchI] = (nn.boundaryField()[patchI] & wallShearStress.boundaryField()[patchI]) *nn.boundaryField()[patchI]; } forAll(shear.boundaryField(), patchI) { shear.boundaryField()[patchI] = wallShearStress.boundaryField()[patchI]-normal.boundaryField()[patchI]; } // Print out average wall shear stress over topSurface // find the identification number (e.g. label) for our boundary of interest. label topSurfacePatch = mesh.boundaryMesh().findPatchID("topSurface"); // if we don't have such a patch, warn the user if (topSurfacePatch==-1) { Info << "Failure to find patch named topSurface for average wall shear stress calc." << endl; } else // calculate the result and do output { // the sum operator implicity loops over the boundary faces and stores the result in avgWSS scalar area = gSum(mesh.magSf().boundaryField()[topSurfacePatch]); scalar avgWSS = gSum(mag(shear.boundaryField()[topSurfacePatch]))/area; // reduce(avgWSS,sumOp()); Info << "Monitor: at Time = " << runTime.timeName() << " -- Average wall shear stress over top surface= " << avgWSS <<" [kg/(m*s^2)] " << "Area = " << area << " [m^2] "; } The values I am getting out are far too high for my simulation, for example average wall shear stress of 40 where mean velocity is magnitude 1. I have searched through the code trying to work out where the issue is occurring. Do you have any suggestions please? Cheers, Tian

 August 26, 2012, 05:21 #38 Senior Member   Niels Gjoel Jacobsen Join Date: Mar 2009 Location: Deltares, Delft, The Netherlands Posts: 1,702 Rep Power: 27 Hi Tian, I think (am certain) that the error is in the following line: Code: `scalar avgWSS = gSum(mag(shear.boundaryField()[topSurfacePatch]))/area;` where, if you want a area weighted average, you should do Code: `scalar avgWSS = gSum(mag(shear.boundaryField()[topSurfacePatch]) * mesh.magSf().boundaryField()[topSurfacePatch])/area;` Kind regards, Niels TianC likes this.

 August 26, 2012, 05:40 #39 New Member   Tian Coulsting Join Date: Jun 2012 Posts: 19 Rep Power: 6 Ahhh... That is so much better. Thank you Niels you're a life saver! Tian

 August 26, 2012, 05:47 #40 Senior Member   Niels Gjoel Jacobsen Join Date: Mar 2009 Location: Deltares, Delft, The Netherlands Posts: 1,702 Rep Power: 27 No problem. BTW: In stead of making the stress tensor yourself, you could benefit from the turbulence model by calling devReff(). The only thing to remember is that this tensor is also non-tangential with the wall, so you have to perform the same projection (as you already do) onto the boundary face. The upside of using the turbulence model is that you do not have to implement turbulence model specific shear stress methods, because the turbulence model itself tells, how the shear stress is defined. / Niels

 Thread Tools Display Modes Linear Mode

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

 Similar Threads Thread Thread Starter Forum Replies Last Post Attesz CFX 7 January 5, 2013 04:32 yossarian88 STAR-CCM+ 0 February 21, 2011 14:12 winter FLUENT 0 December 11, 2007 18:11 Satish FLUENT 4 November 26, 2003 15:46 Min-Hua Wang CFX 0 April 3, 2002 17:40

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