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/)
-   -   wall shear stress (https://www.cfd-online.com/Forums/openfoam-post-processing/140635-wall-shear-stress.html)

1988 August 20, 2014 00:06

wall shear stress
 
Hello everyone
I want to plot wall shear stress contours and I did it by using"wallShearStress" command but it does not give me the right amount of that and it is some how irrelevant.
I have also read this page
http://www.cfd-online.com/Forums/ope...bend-pipe.html
but I did not get what to do ,is there any idea?

1988 August 21, 2014 07:09

there is no idea?

1988 August 31, 2014 09:38

no one is interested in this topic?

wyldckat August 31, 2014 17:23

Greetings Ali Reza,

In the next few paragraphs I'll be going on a rant, because, well... it has been hard to get the time to help people on the forum and then I stumble on this kind of thread and it makes me feel like I should find better things to do in life.
Therefore, if you don't want to read what I've written below, I strongly suggest you read instead the instructions given on this thread: http://www.cfd-online.com/Forums/ope...-get-help.html


------------------

Ready? Commencing ranting:
Quote:

Originally Posted by 1988 (Post 506734)
Hello everyone

OK, good start :)

Quote:

Originally Posted by 1988 (Post 506734)
I want to plot wall shear stress contours

OK, so far so good...
Quote:

Originally Posted by 1988 (Post 506734)
and I did it by using"wallShearStress" command

OK, you used the utility wallShearStress, seems all well so far...

Quote:

Originally Posted by 1988 (Post 506734)
but it does not give me the right amount of that and it is some how irrelevant.

And you lost me. That part of the sentence pretty much says nothing :( Ironically, it's pretty much "irrelevant" for making it possible to help you based on your description :(

Quote:

Originally Posted by 1988 (Post 506734)
I have also read this page
http://www.cfd-online.com/Forums/ope...bend-pipe.html
but I did not get what to do ,is there any idea?

Uhm... there are over 40 posts on that thread. It'll take me 15-30 minutes to read it all.
You know, I and many people that use this forum have got plenty of ideas, but usually nobody has 20h to write every possible idea on how you could solve the problem :(
In my case, pretty much because I have not understood what the problem was, since you did not clearly state what the problem is.

Quote:

Originally Posted by 1988 (Post 507011)
there is no idea?

Actually, the problem is a lack of time.

Quote:

Originally Posted by 1988 (Post 508513)
no one is interested in this topic?

Again, not a problem of a lack of interest, but rather a lack of time :(.


Let me try to put this into a perspective to try and explain it to you, so that perhaps you can understand why I'm ranting. I like helping people here on the forum, because:
  1. It's better than playing computer games, since this way I can learn more about OpenFOAM and ParaView and so on, which in comparison games are unlikely able to teach me about.
  2. I like helping people and I prefer to help people in something that I'm good at or at least in something I would like to become good at.
But unfortunately, as time passes by, I become older and older, stress takes its toll on the body and mind... and work continues to increase. Because in today's world, usually as one gains more knowledge, also gains more responsibilities and proportionally less free time.
This to say that a few years ago every day I was able to come to the forums for an hour or two, and help a little few people every day. Nowadays it's a matter of great luck that I'm able to spend 2-4h per weekend to try and help a few people.

... and now I'm getting tired of ranting... yes, I'm getting that old :rolleyes:...

OK, so to sum it up: with luck, I'll be able to answer your next post next Saturday, 6 days from now. And I can only hope that you will provide more than enough information in order to help you.
If you do not provide enough information, that will mean that I will have to write every single detail I need to know from your case in order for me to be able to help you... and only 7 days from then will I be able to look at your answer with all of the necessary information.


In other words:
  1. If you had provided enough information in your very first post, or in the other 2 posts you made with no additional relevant information, I would have been able to answer your question and we would both be happy.
  2. Since you did not, then with luck, I will be able to answer your question in 6 days time.
  3. But if you do not provide enough information, it will take 13 or more days, for me or anyone else to be able to answer you, if you do not provide the necessary information.
Therefore, if you really want to know the answer and if you really want me or anyone else to help you, then please provide more than enough information when you ask your question, so that we can all be happy! :(

End of rant.
---------------

Best regards,
Bruno

PS: I wasn't very helpful on this post, I know, but unfortunately you did not provide enough information in order to help you :(

1988 September 4, 2014 05:53

2 Attachment(s)
thanks for your complete analysis and remebering me to poste in the right way.:);)
I feel so good after reading your post,it was useful .
ok.
I am going to give the the whole things about this case.I have simulated,laminar,incompressible,newotoinian and transient flow in a pipe which is shown in the picture.
I have got different contours like velocity maginitude and pressure,all of them show what I have expected to see but the wall shear stress contours were not in this way.
the wall shear stress contours shoul be the same as which has been shown in picture2.
As I said before,I think there some thing wrong between what I need and what openfoam shows,is that right?
what should I do?
inlet velocity profile is u=0.15-0.15cos(2.5pi*t)
and nu is defined as =3.78e-6
source codes are here
Code:

/*---------------------------------------------------------------------------*\
  =========                |
  \\      /  F ield        | OpenFOAM: The Open Source CFD Toolbox
  \\    /  O peration    |
    \\  /    A nd          | Copyright (C) 2012 OpenFOAM Foundation
    \\/    M anipulation  |
-------------------------------------------------------------------------------
License
    This file is part of OpenFOAM.

    OpenFOAM is free software: you can redistribute it and/or modify it
    under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    for more details.

    You should have received a copy of the GNU General Public License
    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.

Application
    wallShearStress

Description
    Calculates and reports wall shear stress for all patches, for the
    specified times when using RAS turbulence models.

    Default behaviour assumes operating in incompressible mode.
    Use the -compressible option for compressible RAS cases.

\*---------------------------------------------------------------------------*/

#include "fvCFD.H"

#include "incompressible/singlePhaseTransportModel/singlePhaseTransportModel.H"
#include "incompressible/RAS/RASModel/RASModel.H"

#include "fluidThermo.H"
#include "compressible/RAS/RASModel/RASModel.H"

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

void calcIncompressible
(
    const fvMesh& mesh,
    const Time& runTime,
    const volVectorField& U,
    volVectorField& wallShearStress
)
{
    #include "createPhi.H"

    singlePhaseTransportModel laminarTransport(U, phi);

    autoPtr<incompressible::RASModel> model
    (
        incompressible::RASModel::New(U, phi, laminarTransport)
    );

    const volSymmTensorField Reff(model->devReff());

    forAll(wallShearStress.boundaryField(), patchI)
    {
        wallShearStress.boundaryField()[patchI] =
        (
          -mesh.Sf().boundaryField()[patchI]
          /mesh.magSf().boundaryField()[patchI]
        ) & Reff.boundaryField()[patchI];
    }
}


void calcCompressible
(
    const fvMesh& mesh,
    const Time& runTime,
    const volVectorField& U,
    volVectorField& wallShearStress
)
{
    IOobject rhoHeader
    (
        "rho",
        runTime.timeName(),
        mesh,
        IOobject::MUST_READ,
        IOobject::NO_WRITE
    );

    if (!rhoHeader.headerOk())
    {
        Info<< "    no rho field" << endl;
        return;
    }

    Info<< "Reading field rho\n" << endl;
    volScalarField rho(rhoHeader, mesh);

    #include "compressibleCreatePhi.H"

    autoPtr<fluidThermo> pThermo(fluidThermo::New(mesh));
    fluidThermo& thermo = pThermo();

    autoPtr<compressible::RASModel> model
    (
        compressible::RASModel::New
        (
            rho,
            U,
            phi,
            thermo
        )
    );

    const volSymmTensorField Reff(model->devRhoReff());

    forAll(wallShearStress.boundaryField(), patchI)
    {
        wallShearStress.boundaryField()[patchI] =
        (
          -mesh.Sf().boundaryField()[patchI]
          /mesh.magSf().boundaryField()[patchI]
        ) & Reff.boundaryField()[patchI];
    }
}


int main(int argc, char *argv[])
{
    timeSelector::addOptions();

    #include "addRegionOption.H"

    argList::addBoolOption
    (
        "compressible",
        "calculate compressible wall shear stress"
    );

    #include "setRootCase.H"
    #include "createTime.H"
    instantList timeDirs = timeSelector::select0(runTime, args);
    #include "createNamedMesh.H"

    const bool compressible = args.optionFound("compressible");

    forAll(timeDirs, timeI)
    {
        runTime.setTime(timeDirs[timeI], timeI);
        Info<< "Time = " << runTime.timeName() << endl;
        mesh.readUpdate();

        volVectorField wallShearStress
        (
            IOobject
            (
                "wallShearStress",
                runTime.timeName(),
                mesh,
                IOobject::NO_READ,
                IOobject::AUTO_WRITE
            ),
            mesh,
            dimensionedVector
            (
                "wallShearStress",
                sqr(dimLength)/sqr(dimTime),
                vector::zero
            )
        );

        IOobject UHeader
        (
            "U",
            runTime.timeName(),
            mesh,
            IOobject::MUST_READ,
            IOobject::NO_WRITE
        );

        if (UHeader.headerOk())
        {
            Info<< "Reading field U\n" << endl;
            volVectorField U(UHeader, mesh);

            if (compressible)
            {
                calcCompressible(mesh, runTime, U, wallShearStress);
            }
            else
            {
                calcIncompressible(mesh, runTime, U, wallShearStress);
            }
        }
        else
        {
            Info<< "    no U field" << endl;
        }

        Info<< "Writing wall shear stress to field " << wallShearStress.name()
            << nl << endl;

        wallShearStress.write();
    }

    Info<< "End" << endl;

    return 0;
}


// ************************************************************************* //

the link which has been posted before was about something in this code that should be changed to show the expeced wall shear stress, they said that wall shear stress command in openfoam computes wall traction instead of wall shear stress.
do you agree with that?

wyldckat September 7, 2014 16:20

Hi Ali,

My guess is that you did not take into account the fact that the wallShearStress utility will give you the results in the same units of the pressure field: http://www.cfd-online.com/Wiki/Wall_shear_stress
Which for incompressible flow, in OpenFOAM, it usually is in "kinematic pressure", namely in "m2/s2".

In post #46 of the other thread you pointed out, you'll find this comment:
Quote:

Originally Posted by Nucleophobe (Post 418210)
Edit:
I just tried this for my case, and I get the same result doing either of the following:
tau = (wallShearStress) * rho
tau = (wallGradU) * mu

This means that the value are seeing in OpenFOAM does not yet take into account the density of the fluid. You can use the Calculator filter in ParaView to multiply the "wallShearStress" field by the density value you have for your fluid.

Best regards,
Bruno

killsecond November 19, 2014 10:19

Quote:

Originally Posted by wyldckat (Post 509408)
Hi Ali,

My guess is that you did not take into account the fact that the wallShearStress utility will give you the results in the same units of the pressure field: http://www.cfd-online.com/Wiki/Wall_shear_stress
Which for incompressible flow, in OpenFOAM, it usually is in "kinematic pressure", namely in "m2/s2".

In post #46 of the other thread you pointed out, you'll find this comment:

This means that the value are seeing in OpenFOAM does not yet take into account the density of the fluid. You can use the Calculator filter in ParaView to multiply the "wallShearStress" field by the density value you have for your fluid.

Best regards,
Bruno

Hi Bruno,

I know "wallShearStress" utility will show the xyz components of wall shear stress. I want to show the skin friction coefficient (cf=tauw/(0.5*rho*U^2) around a circular cylinder, so which component of wall shear stress is the tauw or how to calculate it?

wyldckat November 23, 2014 13:45

Greetings killsecond,

Quote:

Originally Posted by killsecond (Post 520006)
I know "wallShearStress" utility will show the xyz components of wall shear stress. I want to show the skin friction coefficient (cf=tauw/(0.5*rho*U^2) around a circular cylinder, so which component of wall shear stress is the tauw or how to calculate it?

Have you tried using the Calculator filter in ParaView? http://www.itk.org/Wiki/ParaView/Users_Guide/Calculator

Oh, wait... you want to know what "tauw" is in fact from the wall shear stress vector? But what you want is the skin friction on the surface of a cylinder... you're referring to this: http://www.cfd-online.com/Wiki/Skin_...on_coefficient
Honestly, I have no idea. My best guess is that you use the magnitude of the wall shear stress. This is a generic Fluid Dynamics question, so I suggest that you ask on the main CFD forum: http://www.cfd-online.com/Forums/main/

Best regards,
Bruno

killsecond November 23, 2014 20:32

Quote:

Originally Posted by wyldckat (Post 520653)
Greetings killsecond,



Have you tried using the Calculator filter in ParaView? http://www.itk.org/Wiki/ParaView/Users_Guide/Calculator

Oh, wait... you want to know what "tauw" is in fact from the wall shear stress vector? But what you want is the skin friction on the surface of a cylinder... you're referring to this: http://www.cfd-online.com/Wiki/Skin_...on_coefficient
Honestly, I have no idea. My best guess is that you use the magnitude of the wall shear stress. This is a generic Fluid Dynamics question, so I suggest that you ask on the main CFD forum: http://www.cfd-online.com/Forums/main/

Best regards,
Bruno

Hi Bruno,

Thank you for your advices, I will try them.

pnovo May 4, 2017 05:25

Same subject, different issue?
 
1 Attachment(s)
Hi,

I have a case study in which I make use of simpleFoam to find the steady-state flow solution inside a microfluidic channel. I am attaching a print screen of the (obtained) flow velocity (magnitude to the left and vector to the right).

Then, as according to many suggestions and the guide itself, I want to calculate the wall shear stress by running:

Code:

simpleFoam -postProcess -func wallShearStress
which runs without errors:

Code:

Create time

Create mesh for time = 0


SIMPLE: convergence criteria
    field p      tolerance 0.01
    field U      tolerance 0.001
    field "(k|epsilon|omega|f|v2)"      tolerance 0.001

wallShearStress wallShearStress:
    processing all wall patches

Time = 0
Reading field p

Reading field U

Reading/calculating face flux field phi

Selecting incompressible transport model Newtonian
Selecting turbulence model type laminar
No MRF models present

wallShearStress wallShearStress write:
    writing field wallShearStress

Time = 53
Reading field p

Reading field U

Reading/calculating face flux field phi

Selecting incompressible transport model Newtonian
Selecting turbulence model type laminar
No MRF models present

wallShearStress wallShearStress write:
    writing field wallShearStress

End

But the results are far from expected. A new text file was created in the previously calculated time point folder (ie converged solution, for instance 53 in this case), inside the case's directory. This new text file "wallShearStress" does not contain any data besides the typical syntax used in boundary definition:

Code:

dimensions      [0 2 -2 0 0 0 0];

internalField  uniform (0 0 0);

boundaryField
{
    Walls
    {
        type            calculated;
        value          uniform (0 0 0);
    }
    Inlet_No_Concentration
    {
        type            calculated;
        value          uniform (0 0 0);
    }
    Inlet_Concentration
    {
        type            calculated;
        value          uniform (0 0 0);
    }
    Outlet
    {
        type            calculated;
        value          uniform (0 0 0);
    }
}


// ************************************************************************* //

If I repeat the exact same procedure using the example from "incompressible/simpleFoam/pitzDaily" I do get the expected result. Btw, in my own case I am using the same controlDict, fvSolutions and fvSchemes as from the tutorial mentioned. The only difference in the calculation is that I set "laminar" simulationType. I do not know if I am missing any relevant info... Anybody has an idea about the problem and could guide me towards the solution?

Thank you in advance.

wyldckat May 8, 2017 18:59

Quick answer @pnovo: Notice that the output shows this:
Code:

wallShearStress wallShearStress:
    processing all wall patches

This means that it will only calculate for the patches (boundaries) of type "wall".

Please look inside the file "constant/polyMesh/boundary" and see of what type is the patch/boundary named "Walls". If it's not of type "wall", then that's why it did not calculate the shear stress there on that non-wall ;).

pnovo May 9, 2017 03:03

Hi,
Thanks for the analysis. That's was exactly the issue. I manually changed the type in "boundary" from "patch" to "wall" and ran again the
Code:

simpleFoam -postProcess -func wallShearStress
to find a meaningful result.

Now, I am preparing my meshes with Salome, export to UNV file type and use
Code:

ideasUnvToFoam
utility to generate the polyMesh data. Is there a simple trick on this process that would let the user set, for instance, a given boundary group as type wall (or any other for that matter)? Googled this shortly but found no suitable information. It is also not fundamental, one can always perform the step mentioned in the solution above. It is rather a question of efficiency and avoiding errors during case study setting.

Thank you!

gtarang May 21, 2017 14:17

Wall shear stress utility writing normal stress also
 
1 Attachment(s)
Hello, I am solving a Marangoni Convection Problem. I am using boundary condition as used here https://www.cfd-online.com/Forums/op...tml#post197203. The solver I am using is buoyantPimpleFoam.
I also have to plot the Nusselt No as mentioned in here http://www.tandfonline.com/doi/abs/1...07788808913603. The geometry is a 20mm x 20mm square cavity with marangoni bc at top surface and no slip on all side. The simulation is 2D.
When I plot Shear Stress at the top surface (Y plane), it shows y component of stress also, which in my opinion is not possible as it is a normal stress to the plane. I also checked the wallShearStress.C and found that it uses deviatoric Stress tensor. The dev stress tensor should have zero values at its diagonal locations. I am not able to understand this. Although the Y-stress value is 2 order less but still I think it should be zero. Here is the output from wallShearStress.

One more thing. I am using the function object wallShearStress. But some how it is writing the values at every calculation time, where as I want at certain time intervals. Can you suggest what am I missing here?
Code:

functions
{
    shearStress
    {
        functionObjectLibs ("libfieldFunctionObjects.so");
        type            wallShearStress;
        writeInterval  2;
        patches        ("upperWall");
    }
}

I am using OpenFOAM 4.1

Thanks

RobertHB August 18, 2017 09:01

Quote:

Originally Posted by gtarang (Post 649733)
But some how it is writing the values at every calculation time, where as I want at certain time intervals. Can you suggest what am I missing here?

Running the postProcess command via e.g. simpleFoam -postProcess -func wallShearStress prints the usage for the command. You could, for example, use the -time parameter:
-time <ranges> comma-separated time ranges - eg, ':10,20,40:70,1000:'

As for your wallShearStress also printing the components you could try calculating the magnitude of the parameter.

With regards,
Robert

openfoam_aero December 28, 2022 11:12

Quote:

Originally Posted by killsecond (Post 520006)
Hi Bruno,

I know "wallShearStress" utility will show the xyz components of wall shear stress. I want to show the skin friction coefficient (cf=tauw/(0.5*rho*U^2) around a circular cylinder, so which component of wall shear stress is the tauw or how to calculate it?

https://doc.cfd.direct/openfoam/user...processing-cli

Check this.

Says the wallShearStress is given as a volVectorField. So as Bruno said, you will have to take the magnitude of it as \sqrt(taux^2 + tauy^2 + tauz^2).


All times are GMT -4. The time now is 04:42.