CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM (http://www.cfd-online.com/Forums/openfoam/)
-   -   To calculate wall shear stress in of210 for les simulation (http://www.cfd-online.com/Forums/openfoam/103304-calculate-wall-shear-stress-of210-les-simulation.html)

suryawanshi_nitin June 16, 2012 18:26

To calculate wall shear stress in of210 for les simulation
 
hi friends, i m doing flow over flat plate simulation for transition point prediction using les smagorinsky. want to extract wall shear stresses on wall (flat plate). when i m typing wallShearStress in terminal under working directory then i m getting following error,


neptune@ubuntu:~/nitin/x1$ wallShearStress
/*---------------------------------------------------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2.1.0 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
Build : 2.1.0-bd7367f93311
Exec : wallShearStress
Date : Jun 17 2012
Time : 03:42:52
Host : "ubuntu"
PID : 3101
Case : /home/neptune/nitin/x1
nProcs : 1
sigFpe : Enabling floating point exception trapping (FOAM_SIGFPE).
fileModificationChecking : Monitoring run-time modified files using timeStampMaster
allowSystemOperations : Disallowing user-supplied system call operations

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time

Create mesh for time = 0

Time = 0
Reading field U

Reading/calculating face flux field phi

Selecting incompressible transport model Newtonian


--> FOAM FATAL IO ERROR:
cannot find file

file: /home/neptune/nitin/x1/constant/RASProperties at line 0.

From function regIOobject::readStream()
in file db/regIOobject/regIOobjectRead.C at line 73.

FOAM exiting





why is it searching for RAS as i m using LES. Also i have created
velocityGradient field for same simulation...
Also plz help me on extracting rms velocity fluctuation (u')rms

Thanks in advance...

Thanks & Regards
Nitin Suryawanshi....

morard June 18, 2012 08:44

Hi Nitin,

this utility is written for the RANS, but you can create a new one for LES.
Just check the wallShearStress.C and change the line:

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

to be:

#include "incompressible/LES/LESModel/LESModel.H"

Then, change inside the code:

/*
forAll(wallShearStress.boundaryField(), patchi)
{
wallShearStress.boundaryField()[patchi] =
(
-mesh.Sf().boundaryField()[patchi]
/mesh.magSf().boundaryField()[patchi]
) & Beff.boundaryField()[patchi];
}

*/
forAll(wallShearStress.boundaryField(), patchi)
{
wallShearStress.boundaryField()[patchi] =
(
-mesh.Sf().boundaryField()[patchi]
/mesh.magSf().boundaryField()[patchi]
) & Beff.boundaryField()[patchi];
}

I think that this should work. Before doing so don't forget to change the name so you won't make any damage to original utility.

For rms values, just add function in controlDict

functions
{
fieldAverage1
{
type fieldAverage;
functionObjectLibs ( "libfieldFunctionObjects.so" );
enabled true;
outputControl outputTime;
fields
(
U
{
mean on;
prime2Mean on;
base time;
}

p
{
mean on;
prime2Mean on;
base time;
}
);
}
}

Check channel395 tutorial and postChannel utility.

Regards,
Dejan

suryawanshi_nitin June 18, 2012 13:06

Dear Dejan thanks for your valuable reply.
do i need to change createField.h file too? if yes, what changes should i do ??

Also the wallshearstress.c file in utility post folder whic i m having im my source pack installation is not having this line
#include "incompressible/RAS/RASModel/RASModel.H"

wallshearstress.c file at my end is looks like following........

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

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

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

int main(int argc, char *argv[])
{
timeSelector::addOptions();
#include "setRootCase.H"
#include "createTime.H"
instantList timeDirs = timeSelector::select0(runTime, args);
#include "createMesh.H"

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

#include "createFields.H"

volSymmTensorField Reff(RASModel->devReff());

volVectorField wallShearStress
(
IOobject
(
"wallShearStress",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
mesh,
dimensionedVector
(
"wallShearStress",
Reff.dimensions(),
vector::zero
)
);

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


wallShearStress.write();
}

Info<< "End" << endl;

return 0;
}


Pink colored text i will chnage as per your suggestions.

thanks again

regards Nitin Suryawanshi

morard June 19, 2012 03:21

Hi again, Nitin

then, instead of
#include "RASModel.H"
try:
#include "LESModel.H"

Last time I forgot to mention that you also have to change file "options" which is
inside Make folder. Anywhere you find RAS change it to LES. I think that this should
be ok... And yes, you have to do this for createFields.H too.

Regards,
Dejan

suryawanshi_nitin June 20, 2012 01:05

Dear Dejan i did the changes in wallShearStress.C, CreateField.h also inside make folder i have changed, but getting following error...


administrator@ubuntu:~/OpenFOAM/OpenFOAM-2.1.0/applications/utilities/postProcessing/wall/wallShearStress$ wmake
Making dependency list for source file wallShearStress.C
could not open file LESdelta.H for source file wallShearStress.C
SOURCE=wallShearStress.C ; g++ -m32 -Dlinux -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -O3 -DNoRepository -ftemplate-depth-100 -I/home/administrator/OpenFOAM/OpenFOAM-2.1.0/src/transportModels -I/home/administrator/OpenFOAM/OpenFOAM-2.1.0/src/turbulenceModels -I/home/administrator/OpenFOAM/OpenFOAM-2.1.0/src/turbulenceModels/incompressible/LES/LESModel -I/home/administrator/OpenFOAM/OpenFOAM-2.1.0/src/finiteVolume/lnInclude -IlnInclude -I. -I/home/administrator/OpenFOAM/OpenFOAM-2.1.0/src/OpenFOAM/lnInclude -I/home/administrator/OpenFOAM/OpenFOAM-2.1.0/src/OSspecific/POSIX/lnInclude -fPIC -c $SOURCE -o Make/linuxGccDPOpt/wallShearStress.o
In file included from wallShearStress.C:34:0:
/home/administrator/OpenFOAM/OpenFOAM-2.1.0/src/turbulenceModels/incompressible/LES/LESModel/LESModel.H:51:22: fatal error: LESdelta.H: No such file or directory
compilation terminated.
make: *** [Make/linuxGccDPOpt/wallShearStress.o] Error 1

thanks
Nitin

morard June 20, 2012 03:50

Hi Nitin,

first of all I advise you to copy the whole folder and change the name into something like
wallShearStressLES so that at the and you have your own utility... If you didn't know for this page before, just check it now, it's very useful.

http://openfoamwiki.net/index.php/Ho...ure_to_icoFoam

Now, your problem. Go to Make/options and under
EXE_INC = \

add the following line:

-I$(LIB_SRC)/turbulenceModels/LES/LESdeltas/lnInclude \

so that at the end it looks like:

EXE_INC = \
-I$(LIB_SRC)/transportModels \
-I$(LIB_SRC)/turbulenceModels \
-I$(LIB_SRC)/turbulenceModels/incompressible/LES/LESModel \
-I$(LIB_SRC)/turbulenceModels/LES/LESdeltas/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude

EXE_LIBS = \
-lincompressibleLESModels \
-lincompressibleTransportModels \
-lfiniteVolume \
-lgenericPatchFields

Now, this should work.

Regards,
Dejan

suryawanshi_nitin June 22, 2012 00:17

hi Dejan...
with those changes its working now... thanks alot....

now it is giving me wall shear stress along flat plate. Now i want to extract wall shear stress value only at some selected points along along flat plate. Therefor what i did is, using probeLocations post utility in foam. i m trying to extract wall shear stress only at selected point, therefore in system folder i have created probeDict file but when i m running "probleLocations" utility in terminal. i m getting (0,0,0) wall shear stress value. Is there any other way to find wall shear stress directly at selected location, instead searching for the selected points in long list of wallShearStress file for each time step, created by typing wallShearStress in terminal.

thanks alot again.

Regards
Nitin

morard June 22, 2012 03:37

Hi Nitin,

i'm happy to hear that this utility is working in your case :)
Well, actually I've never heard about utility probeLocations but now I've tested it and I think that it wont do the job in your case since wallShearStress is specified only at the boundary field... So, maybe you can use sample utility. There, instead of specifying a point, you have to give the coordinates of a line which will cut the specific location you want. This will give you a list of values for wallShearStress and all of them will be zero (as you get with this probe utility) except the first one which will be the value at the boundary at the point you wanted. I did a simple example and I get this:

Check how sample utility works and in sampleDict set the cutting line. In my case it is:

sets
(
Y
{
type face;
axis distance;

//- cavity. Slightly perturbed so not to align with face or edge.
start (3.001 -0.01 1.501); //(-0.0657927840948105 0.000001 0.125001);
end (3.001 0.1 1.501);
}
... ... ...

and so on...

Try to play around whit this, I'm sure that at the end you'll get what you wanted.

Dejan

TianC August 8, 2012 08:49

Hi guys,

To my understanding, the wallShearStress utility calculates the wall shear stress at the latest timestep. It is a post-processing utility.

wallShearStress can be a good way to monitor if a simulation has settled down to a steady state. Ideally you don't want to be saving all your data for many timesteps until the simulation has settled (since this consumes vast amounts of data as you may have noticed!)

So my question is:

Is there any way of outputting wallShearStress at every timestep (i.e. not having to use the utility for just the last timestep every time)?

Ideally, is it possible of outputting JUST the wallShearStress at more frequent intervals than you output your other data?

Also, is it possible to do some kind of average magnitude to see how the wall shear stress behaves?

Kopy August 8, 2012 22:42

Hi guys,

can somebody explain what exactly I get by running "wallShearStress".

Since wallShearStress is
tau_w = mu * grad(U)
with grad(U) normal to the wall. In a flat plate case grad(U) = dU/dy

By checking the code I see:

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

I read somewhere that "Sf" is a vector normal to the surface. So

-mesh.Sf().boundaryField()[patchI]
/mesh.magSf().boundaryField()[patchI]

seems to be the gradient, right? I miss mu respectively nu.

Can anyone give me a hint?

wikstrom October 11, 2012 04:10

Reff is the effective (viscous+turbulent) stress tensor (calculated by the turbulence model). For laminar flow (or y-plus low) this would be more or less nu*grad(U).

nati December 9, 2012 08:47

Request for the modified code
 
dear Nitin,
I have applied all changes that Mr. Morard explained in the topic but it doesn't work for me and i found the following error:



OURCE=wallShearStress.C ; g++ -m64 -Dlinux64 -DDP -Wall -Wno-strict-aliasing -Wextra -Wno-unused-parameter -Wold-style-cast -march=opteron -O3 -DNoRepository -ftemplate-depth-40 -I/home/Afshin/OpenFOAM/OpenFOAM-1.5/src/finiteVolume/lnInclude -I/home/Afshin/OpenFOAM/OpenFOAM-1.5/src/turbulenceModels/LES -I/home/Afshin/OpenFOAM/OpenFOAM-1.5/src/transportModels -I/home/Afshin/OpenFOAM/OpenFOAM-1.5/src/turbulenceModels/LES/LESdeltas/lnInclude -IlnInclude -I. -I/home/Afshin/OpenFOAM/OpenFOAM-1.5/src/OpenFOAM/lnInclude -I/home/Afshin/OpenFOAM/OpenFOAM-1.5/src/OSspecific/Unix/lnInclude -fPIC -c $SOURCE -o Make/linux64GccDPOpt/wallShearStress.o
wallShearStress.C: In function ‘int main(int, char**)’:
wallShearStress.C:55: error: ‘class Foam::incompressible::LESModel’ has no member named ‘devReff’
make: *** [Make/linux64GccDPOpt/wallShearStress.o] Error 1



could you please send me your modified code so that I can fix this problem.
Regards,
Nati




Quote:

Originally Posted by suryawanshi_nitin (Post 367779)
hi Dejan...
with those changes its working now... thanks alot....

now it is giving me wall shear stress along flat plate. Now i want to extract wall shear stress value only at some selected points along along flat plate. Therefor what i did is, using probeLocations post utility in foam. i m trying to extract wall shear stress only at selected point, therefore in system folder i have created probeDict file but when i m running "probleLocations" utility in terminal. i m getting (0,0,0) wall shear stress value. Is there any other way to find wall shear stress directly at selected location, instead searching for the selected points in long list of wallShearStress file for each time step, created by typing wallShearStress in terminal.

thanks alot again.

Regards
Nitin


nati December 9, 2012 08:51

Help me on this error
 
Dear Morard,
I have applied the procedure that you mentioned in this topic but I have found the new following error :




OURCE=wallShearStress.C ; g++ -m64 -Dlinux64 -DDP -Wall -Wno-strict-aliasing -Wextra -Wno-unused-parameter -Wold-style-cast -march=opteron -O3 -DNoRepository -ftemplate-depth-40 -I/home/Afshin/OpenFOAM/OpenFOAM-1.5/src/finiteVolume/lnInclude -I/home/Afshin/OpenFOAM/OpenFOAM-1.5/src/turbulenceModels/LES -I/home/Afshin/OpenFOAM/OpenFOAM-1.5/src/transportModels -I/home/Afshin/OpenFOAM/OpenFOAM-1.5/src/turbulenceModels/LES/LESdeltas/lnInclude -IlnInclude -I. -I/home/Afshin/OpenFOAM/OpenFOAM-1.5/src/OpenFOAM/lnInclude -I/home/Afshin/OpenFOAM/OpenFOAM-1.5/src/OSspecific/Unix/lnInclude -fPIC -c $SOURCE -o Make/linux64GccDPOpt/wallShearStress.o
wallShearStress.C: In function ‘int main(int, char**)’:
wallShearStress.C:55: error: ‘class Foam::incompressible::LESModel’ has no member named ‘devReff’
make: *** [Make/linux64GccDPOpt/wallShearStress.o] Error 1



Would you please help me on this problem ?
Regards,
Nati






Quote:

Originally Posted by morard (Post 367386)
Hi Nitin,

first of all I advise you to copy the whole folder and change the name into something like
wallShearStressLES so that at the and you have your own utility... If you didn't know for this page before, just check it now, it's very useful.

http://openfoamwiki.net/index.php/Ho...ure_to_icoFoam

Now, your problem. Go to Make/options and under
EXE_INC = \

add the following line:

-I$(LIB_SRC)/turbulenceModels/LES/LESdeltas/lnInclude \

so that at the end it looks like:

EXE_INC = \
-I$(LIB_SRC)/transportModels \
-I$(LIB_SRC)/turbulenceModels \
-I$(LIB_SRC)/turbulenceModels/incompressible/LES/LESModel \
-I$(LIB_SRC)/turbulenceModels/LES/LESdeltas/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude

EXE_LIBS = \
-lincompressibleLESModels \
-lincompressibleTransportModels \
-lfiniteVolume \
-lgenericPatchFields

Now, this should work.

Regards,
Dejan


meindert December 9, 2012 09:15

Changing devReff to devBeff should solve your problem.

nati December 9, 2012 09:41

Thank You for answer but I found a new problem


Making dependency list for source file wallShearStress.C
SOURCE=wallShearStress.C ; g++ -m64 -Dlinux64 -DDP -Wall -Wno-strict-aliasing -Wextra -Wno-unused-parameter -Wold-style-cast -march=opteron -O3 -DNoRepository -ftemplate-depth-40 -I/home/Afshin/OpenFOAM/OpenFOAM-1.5/src/transportModels -I/home/Afshin/OpenFOAM/OpenFOAM-1.5/src/turbulenceModels/LES -I/home/Afshin/OpenFOAM/OpenFOAM-1.5/src/turbulenceModels/LES/LESdeltas/lnInclude -I/home/Afshin/OpenFOAM/OpenFOAM-1.5/src/finiteVolume/lnInclude -IlnInclude -I. -I/home/Afshin/OpenFOAM/OpenFOAM-1.5/src/OpenFOAM/lnInclude -I/home/Afshin/OpenFOAM/OpenFOAM-1.5/src/OSspecific/Unix/lnInclude -fPIC -c $SOURCE -o Make/linux64GccDPOpt/wallShearStress.o
g++ -m64 -Dlinux64 -DDP -Wall -Wno-strict-aliasing -Wextra -Wno-unused-parameter -Wold-style-cast -march=opteron -O3 -DNoRepository -ftemplate-depth-40 -I/home/Afshin/OpenFOAM/OpenFOAM-1.5/src/transportModels -I/home/Afshin/OpenFOAM/OpenFOAM-1.5/src/turbulenceModels/LES -I/home/Afshin/OpenFOAM/OpenFOAM-1.5/src/turbulenceModels/LES/LESdeltas/lnInclude -I/home/Afshin/OpenFOAM/OpenFOAM-1.5/src/finiteVolume/lnInclude -IlnInclude -I. -I/home/Afshin/OpenFOAM/OpenFOAM-1.5/src/OpenFOAM/lnInclude -I/home/Afshin/OpenFOAM/OpenFOAM-1.5/src/OSspecific/Unix/lnInclude -fPIC Make/linux64GccDPOpt/wallShearStress.o -L/home/Afshin/OpenFOAM/OpenFOAM-1.5/lib/linux64GccDPOpt \
-lincompressibleRASModels -lincompressibleTransportModels -lfiniteVolume -lOpenFOAM -liberty -ldl -lm -o /home/Afshin/OpenFOAM/OpenFOAM-1.5/applications/bin/linux64GccDPOpt/wallShearStress
Make/linux64GccDPOpt/wallShearStress.o: In function `main':
wallShearStress.C:(.text+0xc68): undefined reference to `Foam::incompressible::LESModel::New(Foam::Geometr icField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh> const&, Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> const&, Foam::transportModel&)'
collect2: ld returned 1 exit status
make: *** [/home/Afshin/OpenFOAM/OpenFOAM-1.5/applications/bin/linux64GccDPOpt/wallShearStress] Error 1


Regards,
Nati

Quote:

Originally Posted by meindert (Post 396515)
Changing devReff to devBeff should solve your problem.


meindert December 9, 2012 10:18

Did you perhaps forget to make changes to createFields.H?

nati December 9, 2012 10:25

I have applied the changes and this is the file :



Info<< "Reading field U\n" << endl;
volVectorField U
(
IOobject
(
"U",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);

# include "createPhi.H"

singlePhaseTransportModel laminarTransport(U, phi);

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


Quote:

Originally Posted by meindert (Post 396518)
Did you perhaps forget to make changes to createFields.H?


morard December 9, 2012 16:02

Hi nati,

check the following line in your error message:

Make/linux64GccDPOpt/wallShearStress.o -L/home/Afshin/OpenFOAM/OpenFOAM-1.5/lib/linux64GccDPOpt \
-lincompressibleRASModels -lincompressibleTransportModels -lfiniteVolume -lOpenFOAM -liberty -ldl -lm -o /home/Afshin/OpenFOAM/OpenFOAM-1.5/applications/bin/linux64GccDPOpt/wallShearStress

now go to Make/options
and

-lincompressibleRASModels \

replace with

-lincompressibleLESModels \

A few posts before you can see how Make/options should like.

Regards,
Dejan

nati December 10, 2012 02:49

Dear Morard

Thank you for your helpful tips. :)

Quote:

Originally Posted by morard (Post 396546)
Hi nati,

check the following line in your error message:

Make/linux64GccDPOpt/wallShearStress.o -L/home/Afshin/OpenFOAM/OpenFOAM-1.5/lib/linux64GccDPOpt \
-lincompressibleRASModels -lincompressibleTransportModels -lfiniteVolume -lOpenFOAM -liberty -ldl -lm -o /home/Afshin/OpenFOAM/OpenFOAM-1.5/applications/bin/linux64GccDPOpt/wallShearStress

now go to Make/options
and

-lincompressibleRASModels \

replace with

-lincompressibleLESModels \

A few posts before you can see how Make/options should like.

Regards,
Dejan


nati December 10, 2012 08:05

Dear Morard,
After compiling the wall shear stress code for each point in field, stress has three components. Is one of these components the normal stress? If Yes, How I can realize which one is the normal one? And what is the direction of two other shear stresses?


How I can calculate the lift and drag forces after runtime?
Thank you so much.

Regards,
Nati



Quote:

Originally Posted by morard (Post 396546)
Hi nati,

check the following line in your error message:

Make/linux64GccDPOpt/wallShearStress.o -L/home/Afshin/OpenFOAM/OpenFOAM-1.5/lib/linux64GccDPOpt \
-lincompressibleRASModels -lincompressibleTransportModels -lfiniteVolume -lOpenFOAM -liberty -ldl -lm -o /home/Afshin/OpenFOAM/OpenFOAM-1.5/applications/bin/linux64GccDPOpt/wallShearStress

now go to Make/options
and

-lincompressibleRASModels \

replace with

-lincompressibleLESModels \

A few posts before you can see how Make/options should like.

Regards,
Dejan



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