|
[Sponsors] |
Relation between k and UPrime2Mean etc in LES |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
January 25, 2012, 13:26 |
|
#21 |
Member
pooyan
Join Date: Nov 2011
Posts: 62
Rep Power: 15 |
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? |
|
January 25, 2012, 13:32 |
|
#22 | ||
Member
Gregor Olenik
Join Date: Jun 2009
Location: http://greole.github.io/
Posts: 89
Rep Power: 17 |
Quote:
Quote:
Gregor |
|||
January 25, 2012, 13:36 |
|
#23 |
Member
Dejan Morar
Join Date: Nov 2010
Posts: 78
Rep Power: 17 |
...and don't forget to change the name of the solver
|
|
January 25, 2012, 14:05 |
|
#24 |
Member
pooyan
Join Date: Nov 2011
Posts: 62
Rep Power: 15 |
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() |
|
January 26, 2012, 05:03 |
|
#25 |
Member
Dejan Morar
Join Date: Nov 2010
Posts: 78
Rep Power: 17 |
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. |
|
January 26, 2012, 11:53 |
|
#26 |
Member
pooyan
Join Date: Nov 2011
Posts: 62
Rep Power: 15 |
Thanks Morad. So nice!
I will try it out! |
|
January 27, 2012, 11:59 |
|
#27 |
Member
pooyan
Join Date: Nov 2011
Posts: 62
Rep Power: 15 |
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, |
|
January 27, 2012, 12:12 |
|
#28 | |
Member
Gregor Olenik
Join Date: Jun 2009
Location: http://greole.github.io/
Posts: 89
Rep Power: 17 |
Quote:
In the pisoFoam2.C a simple Code:
R=turbulence->R(); Code:
R.write() Gregor |
||
January 27, 2012, 12:18 |
|
#29 |
Member
pooyan
Join Date: Nov 2011
Posts: 62
Rep Power: 15 |
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 |
|
January 30, 2012, 13:00 |
|
#30 |
Member
pooyan
Join Date: Nov 2011
Posts: 62
Rep Power: 15 |
hi,
Thanks to your comments, I could get field average of R over time. |
|
January 30, 2012, 13:15 |
|
#31 |
Member
pooyan
Join Date: Nov 2011
Posts: 62
Rep Power: 15 |
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?
|
|
January 30, 2012, 14:17 |
|
#32 | |
Member
pooyan
Join Date: Nov 2011
Posts: 62
Rep Power: 15 |
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:
|
||
January 31, 2012, 05:01 |
|
#33 | |
Member
Gregor Olenik
Join Date: Jun 2009
Location: http://greole.github.io/
Posts: 89
Rep Power: 17 |
Quote:
but i am a bit confussed by your vector definition in the above post ( U=[1 2 3; 4 5 6] ??) Gregor |
||
February 1, 2012, 06:48 |
|
#34 |
Senior Member
Eugene de Villiers
Join Date: Mar 2009
Posts: 725
Rep Power: 21 |
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. |
|
February 1, 2012, 06:52 |
|
#35 |
Member
Gregor Olenik
Join Date: Jun 2009
Location: http://greole.github.io/
Posts: 89
Rep Power: 17 |
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 |
|
February 1, 2012, 10:26 |
|
#36 | |
Member
pooyan
Join Date: Nov 2011
Posts: 62
Rep Power: 15 |
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:
|
||
February 1, 2012, 11:19 |
|
#37 |
Member
Gregor Olenik
Join Date: Jun 2009
Location: http://greole.github.io/
Posts: 89
Rep Power: 17 |
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 |
|
February 1, 2012, 11:38 |
|
#38 |
Member
pooyan
Join Date: Nov 2011
Posts: 62
Rep Power: 15 |
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. |
|
May 14, 2012, 04:46 |
|
#39 | |
New Member
Forrest
Join Date: May 2012
Posts: 5
Rep Power: 14 |
Quote:
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? |
||
April 30, 2013, 11:20 |
|
#40 |
New Member
Rajesh Kumar
Join Date: Apr 2009
Posts: 25
Rep Power: 17 |
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 |
|
|
|
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 |