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/)
-   -   Sample of Reynolds Stress Normal to Wall (https://www.cfd-online.com/Forums/openfoam-post-processing/182221-sample-reynolds-stress-normal-wall.html)

alekhine January 4, 2017 08:04

Sample of Reynolds Stress Normal to Wall
 
Dear Foamers,

I want to plot the Reynolds stress along the wall normal direction y. The case is turbulent (SA model) and calculated by the simpleFoam solver. After the simulates has converged, I ran the post processing utility of OpenFOAM to calculate the Reynold stress and sample it afterwards.

The velocity and pressure are sampled as expected but it does not work for the Reynold stress. Below are the sampling dictionary and the error when executed.

simpleFoam -postProcess -func 'turbulenceFields(R)' -latestTime
simpleFoam -postProcess -func sampleVel_-6p531 -latestTime

Code:

/*--------------------------------*- C++ -*----------------------------------*\
| =========                |                                                |
| \\      /  F ield        | foam-extend: Open Source CFD                    |
|  \\    /  O peration    | Version:    3.0                                |
|  \\  /    A nd          | Web:        http://www.extend-project.de      |
|    \\/    M anipulation  |                                                |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version    2.0;
    format      ascii;
    class      dictionary;
    location    "system";
    object      sample;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

// file got from CFD course Ulg

libs ("libsampling.so");

setFormat raw;
surfaceFormat raw;

start  (-0.4572 0.07 0);
end    (-0.4572 0.10708 0);
fields  (U p turbulenceProperties:R);

// Sampling and I/O settings
#includeEtc "caseDicts/postProcessing/graphs/sampleDict.cfg"

//  Override settings here, e.g.
setConfig
{
    interpolationScheme cellPoint;
    axis xyz;
}

// Must be last entry
#includeEtc "caseDicts/postProcessing/graphs/graph.cfg"

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

Code:

--> FOAM Warning :
    From function Foam::label Foam::sampledSets::classifyFields()
    in file sampledSet/sampledSets/sampledSetsGrouping.C at line 140
    Cannot find registered field matching turbulenceProperties:R
--> FOAM Warning :
    From function Foam::label Foam::sampledSets::classifyFields()
    in file sampledSet/sampledSets/sampledSetsGrouping.C at line 140
    Cannot find registered field matching turbulenceProperties:R

From the warning I deduce that it is somehow connected to the libraries I use within the sampling dictionary. But I have no clue how to do it differently:confused:

I would highly appreciate your help!
Dimitri

alekhine January 4, 2017 12:32

Any ideas?
I have tried to use simpleFoam -postProcess -func 'components(turbulenceProperties:R)' -latestTimestep but I get

-> FOAM Warning : functionObject components: Cannot find required field turbulenceProperties:R

I use OpenFOAM version 4.1

Please help!!:(
Dimitri

alekhine January 4, 2017 12:52

Ok, problem solved.

If I use

postProcess -func sampleVel_-6p531 -latestTime OR
postProcess -func 'components(turbulenceProperties:R)' -latestTimestep

instead of

simpleFoam -postProcess -func sampleVel_-6p531 -latestTime OR
simpleFoam -postProcess -func 'components(turbulenceProperties:R)'

it works. I don't know the difference at the moment though. However, this thread can be considered closed. :-)

Dimitri

Bashar January 5, 2017 16:50

Dimitri,

Hi,
Did you manage to plot your data in paraview? if yes, please can you share the procedure?
Thank you .
Bashar

alekhine January 5, 2017 16:58

Hi Basher,

I post-process my results in gnuplat and Matlab. You can extract the values as I posted above and load everything in your post-processing tool of choice.

Dimitri

Bashar January 5, 2017 17:12

Thank you for the fast response.

I just want to make sure of something.
So, when I computed the Reynolds Stress, I just type "R" i.e. I used the post-process utility . below are sample of the calculation. Is this is the wright way to do that? I have know in each data file an R file with the matrix inside .


Quote:


/*---------------------------------------------------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 3.0.1 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
Build : 3.0.1-119cac7e8750
Exec : R
Date : Jan 05 2017
Time : 16:05:43
Host : "basharhpc"
PID : 11582
Case : /media/bashar/2E62-CB06/Bashar_Single_1.8mil
nProcs : 1
sigFpe : Enabling floating point exception trapping (FOAM_SIGFPE).
fileModificationChecking : Monitoring run-time modified files using timeStampMaster
allowSystemOperations : Allowing 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
Selecting turbulence model type LES
Selecting LES turbulence model WALE
Selecting LES delta type cubeRootVol
WALECoeffs
{
Ce 1.048;
Ck 0.094;
Cw 0.325;
}

Writing R field

Time = 1.000061
Reading field U

Reading/calculating face flux field phi

Selecting incompressible transport model Newtonian
Selecting turbulence model type LES
Selecting LES turbulence model WALE
Selecting LES delta type cubeRootVol
WALECoeffs
{
Ce 1.048;
Ck 0.094;
Cw 0.325;
}

Writing R field



alekhine January 5, 2017 17:21

It looks right to me. Depending on the version of OpenFOAM you use, the command is a bit different. I believe in the earlier versions (I use V4.1), it is sufficient to simply type 'R' or something similar. The output should be a symmetric tensor <symmTensor> in your write directories.

Afterwards, you can sample this tensor and extract values.

Hope that helps.
Dimitri

Bashar January 5, 2017 17:31

Thanks again and sorry to ask you again, I am really still not that good in openfoam.
So, know I need to extract the data using your method? So, basically I need to execute the command in my terminal or you mean different thing? Sorry to ask this basic questions.
Bashar

alekhine January 5, 2017 17:42

No need for an excuse, I also started using OpenFOAM not long ago and had to learn the hard way.

What you can do is copy my the first code of the first post to your ./system directory and name it yourSample. There you specify the line where you want to extract the values and what quantities.

start (-0.4572 0.07 0);
end (-0.4572 0.10708 0);
fields (U p turbulenceProperties:R);

If needed, you can change the interpolation scheme, type, axis etc. You can look this up in the official OpenFOAM documentation. In my case, I selected

// Override settings here, e.g.
setConfig
{
interpolationScheme cellPoint;
axis xyz;
}

Afterwards you go to your case directory and execute the following in the terminal
postProcess -func yourSample -latestTime

You can replace -latestTime by -time XXX if you want to sample at a specific time or just
postProcess -func yourSample -latestTime

if you want to sample at all types.

Dimitri
body,div,table,thead,tbody,tfoot,tr,th,td,p { font-family:"Liberation Sans"; font-size:x-small } a.comment-indicator:hover + comment { background:#ffd; position:absolute; display:block; border:1px solid black; padding:0.5em; } a.comment-indicator { background:red; display:inline-block; border:1px solid black; width:0.5em; height:0.5em; } comment { display:none; }

Bashar January 5, 2017 17:47

Thank you so much , you make it really clear for me.

best wishes to you and happy new year .

Bashar

alekhine January 5, 2017 17:48

Happy to help

Thanks, to you too!
Dimitri

Yixiang September 27, 2018 05:31

Hello Bashar,



could you please share how do you use the post-process utility"R"? I used it like: postProcess -func "R", and got an error message "the turbulence model not found in database, deactivating".


thanks a lot in advance!


Regards, Yixiang

ar215499@dal.ca November 13, 2018 09:37

Hi Yixiang, you have to input the name of your solver before the postProcess command. For example:


simpleFoam -postProcess -func R


Cheers,
-Aaron


All times are GMT -4. The time now is 13:46.