CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Running, Solving & CFD

Relation between k and UPrime2Mean etc in LES

Register Blogs Community New Posts Updated Threads Search

Like Tree26Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 25, 2012, 13:26
Default
  #21
Member
 
pooyan
Join Date: Nov 2011
Posts: 62
Rep Power: 15
sam1364 is on a distinguished road
my Solver is pisoFoam. So, Should I add these new lines to the createFields.H inside the pisoFoam Directory?! Do I need to compile these codes when I add those terms?

in createFields.H inside pisoFoam Directory, I see that it reads U and P fields rather than writing them

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

are you sure this is the place to create R field?
sam1364 is offline   Reply With Quote

Old   January 25, 2012, 13:32
Default
  #22
Member
 
Gregor Olenik
Join Date: Jun 2009
Location: http://greole.github.io/
Posts: 89
Rep Power: 17
gregor is on a distinguished road
Quote:
Originally Posted by sam1364 View Post
my Solver is pisoFoam. So, Should I add these new lines to the createFields.H inside the pisoFoam Directory?! Do I need to compile these codes when I add those terms?
Yes you would have to recompile your code.


Quote:
Originally Posted by sam1364 View Post
in createFields.H inside pisoFoam Directory, I see that it reads U and P fields rather than writing them
It reads the fields and creates an entry in the object registry, which is needed for the sampling. So its nothing wrong with putting it in there, but you can place it anywhere else where it fits

Gregor
gregor is offline   Reply With Quote

Old   January 25, 2012, 13:36
Default
  #23
Member
 
Dejan Morar
Join Date: Nov 2010
Posts: 78
Rep Power: 17
morard is on a distinguished road
...and don't forget to change the name of the solver
morard is offline   Reply With Quote

Old   January 25, 2012, 14:05
Default
  #24
Member
 
pooyan
Join Date: Nov 2011
Posts: 62
Rep Power: 15
sam1364 is on a distinguished road
Ok, thanks guys.

to compile a code, As far as I remember, I should use wmake libso. do I need to make a new library for my new solver let's say pisoFoam2?!
I do not want to change pisoFoam.C. I want to make a copy of that somewhere and then change it.

by the way, by the following command, do you mean that I should use this inside pisoFoam solver?! and what is turbulence?! do you mean RASModel ->R()?!

R_ = turbulence->R()
sam1364 is offline   Reply With Quote

Old   January 26, 2012, 05:03
Default
  #25
Member
 
Dejan Morar
Join Date: Nov 2010
Posts: 78
Rep Power: 17
morard is on a distinguished road
Hi,

first, just copy original pisoFoam and change name to, as you said, pisoFoam2 (but, my suggestion is to choose something other like pisoRFoam, because after some tome you will have pisoFoam2, pisoFoam3,... and you will definitely forget what did you change in each of those..). So, you have to change pisoFoam.C to pisoFoam2.C. Than, open Make folder and inside files, you also have to change:

pisoFoam2.C

EXE = $(FOAM_APPBIN)/pisoFoam2

Then navigate your terminal to pisoFoam2 folder and execute:

wclean
wmake

now you have your own solver pisoFoam2. Now do the changes mentioned by Gregor and me.

If you take a look into createFields.H, you will see how pointer is created. At the end of the file it is written:

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

so, you'll have to put inside pisoFoam2.C

R_ = turbulence->R();

Put this inside while loop. Between the lines: turbulence->correct(); and runTime.write(); might be a good position. So, at the end you'll have:

turbulence->correct();

R_ = turbulence->R();

runTime.write();

This should wor.

Check this page:
http://openfoamwiki.net/index.php/Ho...ure_to_icoFoam

There you can find a lot of useful things.
ashvinc9 likes this.
morard is offline   Reply With Quote

Old   January 26, 2012, 11:53
Default
  #26
Member
 
pooyan
Join Date: Nov 2011
Posts: 62
Rep Power: 15
sam1364 is on a distinguished road
Thanks Morad. So nice!
I will try it out!
sam1364 is offline   Reply With Quote

Old   January 27, 2012, 11:59
Default
  #27
Member
 
pooyan
Join Date: Nov 2011
Posts: 62
Rep Power: 15
sam1364 is on a distinguished road
Hi

I compiled the new pisoFoam solver and I added the following line to the code:

createField.H


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

and to the pisoFoam2 solver,



volSymmTensorField R
(
IOobject
(
"R",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
turbulence->R()
);

R.write();


This way, the solver reads R field from time 0 and it writes and updates the R field every time step to a directory.

My problem is two things:

1- I want to have R field written in time directories specified in controlDict (specified write intervals). My new solver writes R in each time step and gives it as an output every time.

2- When I do field averaging, I do not receive the old error which was "the Requested R field does not exist". Now, R field is created. But, it seems that for field averaging, the algorithm gets the initial R field and average that during runtime which always gives the same thing for all times.


I would be happy if you can suggest a way to overcome any of the above issues.

Thanks,
sam1364 is offline   Reply With Quote

Old   January 27, 2012, 12:12
Default
  #28
Member
 
Gregor Olenik
Join Date: Jun 2009
Location: http://greole.github.io/
Posts: 89
Rep Power: 17
gregor is on a distinguished road
Quote:
Originally Posted by sam1364 View Post
and to the pisoFoam2 solver,



volSymmTensorField R
(
IOobject
(
"R",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
turbulence->R()
);

R.write();
there you made a mistake


In the pisoFoam2.C a simple

Code:
R=turbulence->R();
should be sufficient. You just want to get the R-field every timestep not create it every timestep. Furthermore you don't need a
Code:
R.write()
since you have told the objectRegistry to handle it by IOobject::AUTO_WRITE

Gregor
gregor is offline   Reply With Quote

Old   January 27, 2012, 12:18
Default
  #29
Member
 
pooyan
Join Date: Nov 2011
Posts: 62
Rep Power: 15
sam1364 is on a distinguished road
I also tried adding this line instead of R.write(). But, I received an error when compiling the code. I will post the error in an hour or so.

Thanks
sam1364 is offline   Reply With Quote

Old   January 30, 2012, 13:00
Default
  #30
Member
 
pooyan
Join Date: Nov 2011
Posts: 62
Rep Power: 15
sam1364 is on a distinguished road
hi,

Thanks to your comments, I could get field average of R over time.
sam1364 is offline   Reply With Quote

Old   January 30, 2012, 13:15
Default
  #31
Member
 
pooyan
Join Date: Nov 2011
Posts: 62
Rep Power: 15
sam1364 is on a distinguished road
I also want to calculate U*U and get the average of this field over time. U is given by OpenFoam. I just need to add some lines to calculate U*U. if U=[1 2 3;4 5 6], by U*U, I mean the result is [1 4 9;16 25 36]. I do not know how openfoam writes U field so that I can write a "for loop" to calculate U*U. do you have any suggestions?
sam1364 is offline   Reply With Quote

Old   January 30, 2012, 14:17
Default
  #32
Member
 
pooyan
Join Date: Nov 2011
Posts: 62
Rep Power: 15
sam1364 is on a distinguished road
Hi Gregor

I guess Uprime2Mean(0) is also equivalent to the following equation

<UU>-<U><U>, where <> is time averaged value.
since 1/n sum^N (U-<U>)^2= <UU>-2<U><U>+<U><U>=<UU>-<U><U>.
Am I right?






Quote:
Originally Posted by gregor View Post
Uprime2Mean is simply the variance of the resolved scales. Which is the quadratic value of the standard deviation sigma. Standard deviation gives you an idea on how much your values deviate around a mean value.

var = sigma^2 = 1/(N) sum^N(phi - <phi>)^2, where <.> is a time averaged value

So it is the averaged deviation around a mean value . The definition of Reynoldstresses has nothing to do with how the variances a calculated.

Gregor
sam1364 is offline   Reply With Quote

Old   January 31, 2012, 05:01
Default
  #33
Member
 
Gregor Olenik
Join Date: Jun 2009
Location: http://greole.github.io/
Posts: 89
Rep Power: 17
gregor is on a distinguished road
Quote:
Originally Posted by sam1364 View Post
Hi Gregor

I guess Uprime2Mean(0) is also equivalent to the following equation

<UU>-<U><U>, where <> is time averaged value.
since 1/n sum^N (U-<U>)^2= <UU>-2<U><U>+<U><U>=<UU>-<U><U>.
Am I right?
correct see http://en.wikipedia.org/wiki/Computa...r_the_variance

but i am a bit confussed by your vector definition in the above post ( U=[1 2 3; 4 5 6] ??)

Gregor
gregor is offline   Reply With Quote

Old   February 1, 2012, 06:48
Default
  #34
Senior Member
 
Eugene de Villiers
Join Date: Mar 2009
Posts: 725
Rep Power: 21
eugene is on a distinguished road
You guys are making a mistake. Calling "R()" for an SGS model will not return the total Reynolds stress. It will just return the SGS stress. The only reason it is called "R()" is for compatibility with the RANS model nomenclature.

UPrime2Mean is calculated as:

UPrime2Mean_new = alpha*UPrime2Mean_old + (1-alpha) * sqr(U) - sqr(Umean);

with alpha = (Time - dTime) / Time

If you work it out, this is identical to the definition for Reynolds stress when averaged over a long time (<UU>-<U><U>).

To get the full stresses (resolved + SGS) you thus need UPrime2Mean + RMean. Unfortunately, you will still have to modify a solver to create RMean since the R field is not available by default as noted below.
eugene is offline   Reply With Quote

Old   February 1, 2012, 06:52
Default
  #35
Member
 
Gregor Olenik
Join Date: Jun 2009
Location: http://greole.github.io/
Posts: 89
Rep Power: 17
gregor is on a distinguished road
I know its confusing to discuss RANs matters in a LES thread but sam1364 is using kEpsilon (according to http://www.cfd-online.com/Forums/ope...tml#post340914).

Gregor
gregor is offline   Reply With Quote

Old   February 1, 2012, 10:26
Default
  #36
Member
 
pooyan
Join Date: Nov 2011
Posts: 62
Rep Power: 15
sam1364 is on a distinguished road
Hi guys,

I have done UPrime2Mean + RMean to get the total Reynolds Stress for RANS simulation. I could get RMean thanks to Gregor suggestions. But I see a big problem when calculating R or Rmean and that is the values of R or RMean at the walls of cavity which are not zero (I am solving the lid driven cavity flow). I am using kqrwallfunction for R but I do not understand why I get non zero values of Reynolds stress at fixed walls. Am I using the right wall function, Should I set the values of R zero at the fixed wall?



Quote:
Originally Posted by eugene View Post
You guys are making a mistake. Calling "R()" for an SGS model will not return the total Reynolds stress. It will just return the SGS stress. The only reason it is called "R()" is for compatibility with the RANS model nomenclature.

UPrime2Mean is calculated as:

UPrime2Mean_new = alpha*UPrime2Mean_old + (1-alpha) * sqr(U) - sqr(Umean);

with alpha = (Time - dTime) / Time

If you work it out, this is identical to the definition for Reynolds stress when averaged over a long time (<UU>-<U><U>).

To get the full stresses (resolved + SGS) you thus need UPrime2Mean + RMean. Unfortunately, you will still have to modify a solver to create RMean since the R field is not available by default as noted below.
sam1364 is offline   Reply With Quote

Old   February 1, 2012, 11:19
Default
  #37
Member
 
Gregor Olenik
Join Date: Jun 2009
Location: http://greole.github.io/
Posts: 89
Rep Power: 17
gregor is on a distinguished road
I would assume that you are looking at R in the first cell next to the wall (which isnt zero). R exactly at the wall is zero since your k should be zero.

Gregor
gregor is offline   Reply With Quote

Old   February 1, 2012, 11:38
Default
  #38
Member
 
pooyan
Join Date: Nov 2011
Posts: 62
Rep Power: 15
sam1364 is on a distinguished road
No, I am looking at wall and I am using this initial set up for R

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

internalField uniform (0 0 0 0 0 0);

boundaryField
{
movingWall
{
type kqRWallFunction;
value uniform (0 0 0 0 0 0);
}
fixedWalls
{
type kqRWallFunction;
value uniform (0 0 0 0 0 0);
}
front
{
type symmetryPlane;
}
}

I guess based on the equation given in Kepsilon.C for R, the values at wall can be non zero.
sam1364 is offline   Reply With Quote

Old   May 14, 2012, 04:46
Default
  #39
New Member
 
Forrest
Join Date: May 2012
Posts: 5
Rep Power: 14
buct11019 is on a distinguished road
Quote:
Originally Posted by Tarak View Post
Thanks a lot.

I am using dynamicOneeqEddy model, that's why I am so concerned about it. I am presently simulating the flow over a circular cylinder for Re=3900, but not managing to get an acceptable recirculation length. So, the way you prescribed now may help. If you had any luck with the flow over a circular cylider please do let me know.

Thanks,
Tarak

Nice to meet you , Tarak.
Now I have the same question of you had last year. I am confusing about how to set the k. I had done some work in backward step simulation with oneeqEddy and dynamicOneeqEddy model at the same grid and the same condition. I set k as 1*10-5 in both simulaiton, but the dynamicOneeqEddy model diverge after about 15s, but can go on to compute.Would you please give me some suggestion on it?
buct11019 is offline   Reply With Quote

Old   April 30, 2013, 11:20
Default
  #40
New Member
 
Rajesh Kumar
Join Date: Apr 2009
Posts: 25
Rep Power: 17
rajeshkunwar is on a distinguished road
Hi Gregor

In my URANS simulation k is not equal to 0.5*(Uprime2MeanXX+Uprime2MeanYY+Uprime2MeanZZ). This is probably because k and epsilon are calculated using evolution equation and R is computed using boussinesq approximation. whereas UPrime2Mean is computed using postprocessing of U field. So I doubt Reynolds stress is UPrime2Mean in URANS simulations.
I will appreciate your comment.

Last edited by rajeshkunwar; April 30, 2013 at 11:21. Reason: spelling mistake
rajeshkunwar is offline   Reply With Quote

Reply


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 Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problems sampling UPrime2Mean leonardo.morita OpenFOAM Post-Processing 5 May 10, 2012 05:36
Bug in Dynamic 1Eq Eddy Viscosity LES Model Incompressible flow harishg OpenFOAM Bugs 5 December 2, 2008 19:18


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