# LES best practice: resolved and modelled turbulence kinetic energy

 Register Blogs Members List Search Today's Posts Mark Forums Read

 November 27, 2018, 09:13 LES best practice: resolved and modelled turbulence kinetic energy #1 New Member   Emily Join Date: Nov 2017 Posts: 24 Rep Power: 8 Hello, I am running an LES simulations with the WALE subgrid-scale model and am looking for some clarification on turbulence properties. To help validate my mesh, I would like to know how much of the turbulence kinetic energy is directly resolved and how much is modelled with the subgrid-scale model. Could anyone tell me how this can be done directly in OpenFOAM? I.e. what calculations I need to perform? Reading through the forums, some people have said that R gives the modelled Reynolds stress tensor and that Uprime2Mean gives the resolved Reynolds stress tensor. Is this correct? If that's the case, does that mean the total Reynolds stress tensor is simply given by R + Uprime2Mean? Then I can simply find the percentage of resolved k as Uprime2Mean/(R + Uprime2Mean)? Please correct me if I am wrong. Since looking into this, it has raised further questions regarding the run time output of the turbulence kinetic energy, k. Is this the total, resolved or modelled turbulence kinetic energy? Thank you, Em

December 13, 2018, 11:25
#2
Member

ano
Join Date: Jan 2017
Location: Delft
Posts: 58
Rep Power: 10
Quote:
 Reading through the forums, some people have said that R gives the modelled Reynolds stress tensor and that Uprime2Mean gives the resolved Reynolds stress tensor. Is this correct? If that's the case, does that mean the total Reynolds stress tensor is simply given by R + Uprime2Mean?
Yes that is correct.

Quote:
 Then I can simply find the percentage of resolved k as Uprime2Mean/(R + Uprime2Mean)? Please correct me if I am wrong.
Basically yes, you have to take the trace to get the kinetic energy from the Reynolds stress tensor, i.e. (1/2*tr(Uprime2Mean))/(1/2*tr(R + Uprime2Mean)).

Quote:
 Since looking into this, it has raised further questions regarding the run time output of the turbulence kinetic energy, k. Is this the total, resolved or modelled turbulence kinetic energy?
k gives only the subgrid part. You can have a look at the source documentation, search for "k()":

https://www.openfoam.com/documentati...E.html#details

And to dig more into detail into the WALE files itself:
https://www.openfoam.com/documentati...8H_source.html
https://www.openfoam.com/documentati...8C_source.html

 December 17, 2018, 07:09 #3 New Member   Emily Join Date: Nov 2017 Posts: 24 Rep Power: 8 Thank you for your detailed reply - you've really helped to clarify this!

 September 25, 2019, 07:06 #4 Senior Member   Andrea Join Date: Feb 2012 Location: Leeds, UK Posts: 179 Rep Power: 15 I know this thread is from a few months ago but recently I have modified pimpleFoam to calculate the resolved turbulent kinetic energy and dissipation rate at run-time. The solver is also calculating the ratio of k_res/(k_res+k_sgs) at run-time. You can download it from this repository. I have tested it in a channel flow at Re_t=395 and is working fine, but any feedback is welcome. ozgunoglu, godfatherBond and jadidi.cfd like this.

October 5, 2019, 02:01
#5
Member

Maximus Arelius
Join Date: Jan 2017
Location: Morocco
Posts: 34
Rep Power: 9
Quote:
 Originally Posted by Andrea1984 I know this thread is from a few months ago but recently I have modified pimpleFoam to calculate the resolved turbulent kinetic energy and dissipation rate at run-time. The solver is also calculating the ratio of k_res/(k_res+k_sgs) at run-time. You can download it from this repository. I have tested it in a channel flow at Re_t=395 and is working fine, but any feedback is welcome.
Hi Andrea,
Could you tell for what version of OF was this orignally created? I am having some issues compiling it. I am using OF5.x.

EDIT: Got it to work in OF5.x. I think it was written using OpenFOAM-dev. Did your setup of Channel ReTau=395 was having the LESResIndex~0.8?
__________________
--
🃏Maximus🃏

 October 5, 2019, 06:58 #6 Senior Member   Andrea Join Date: Feb 2012 Location: Leeds, UK Posts: 179 Rep Power: 15 I have actually written in for OF-6, but it's good to know that is working now! I have created a new mesh from scratch for my channel flow simulation at Re_t=395 so you cannot directly compare your Resolution Index with mine. Andrea

November 29, 2019, 01:06
#7
Member

Maximus Arelius
Join Date: Jan 2017
Location: Morocco
Posts: 34
Rep Power: 9
Quote:
 Originally Posted by Andrea1984 I have actually written in for OF-6, but it's good to know that is working now! I have created a new mesh from scratch for my channel flow simulation at Re_t=395 so you cannot directly compare your Resolution Index with mine. Andrea
Hi Andrea,
If you see Pope's Ten questions concerning LES, to calculate the LES index shouldn't the quantities Ksgs and Kres be averaged in time and them the ratio of them (averaged Ksgs and Kres) be used to calculate LESResIndex. Your code is calculating the instantaneous value, shouldn't it be doing that using averaged values?
Please correct me if I am wrong!
__________________
--
🃏Maximus🃏

 November 29, 2019, 06:22 #8 Senior Member   Andrea Join Date: Feb 2012 Location: Leeds, UK Posts: 179 Rep Power: 15 Hi, please see my answer on this other thread Andrea

April 16, 2020, 13:01
#9
Senior Member

Arijit Saha
Join Date: Feb 2019
Location: Singapore
Posts: 132
Rep Power: 6
Quote:
 Originally Posted by em17 Hello, I am running an LES simulations with the WALE subgrid-scale model and am looking for some clarification on turbulence properties. To help validate my mesh, I would like to know how much of the turbulence kinetic energy is directly resolved and how much is modelled with the subgrid-scale model. Could anyone tell me how this can be done directly in OpenFOAM? I.e. what calculations I need to perform? Reading through the forums, some people have said that R gives the modelled Reynolds stress tensor and that Uprime2Mean gives the resolved Reynolds stress tensor. Is this correct? If that's the case, does that mean the total Reynolds stress tensor is simply given by R + Uprime2Mean? Then I can simply find the percentage of resolved k as Uprime2Mean/(R + Uprime2Mean)? Please correct me if I am wrong. Since looking into this, it has raised further questions regarding the run time output of the turbulence kinetic energy, k. Is this the total, resolved or modelled turbulence kinetic energy? Thank you, Em
Hi bro, I am also stuck at the same state of finding the R from the channel flow (pimpleFoam case). Can you please help me how you actually found the R from?

April 16, 2020, 13:21
#10
Senior Member

Arijit Saha
Join Date: Feb 2019
Location: Singapore
Posts: 132
Rep Power: 6
Quote:
 Originally Posted by Andrea1984 I know this thread is from a few months ago but recently I have modified pimpleFoam to calculate the resolved turbulent kinetic energy and dissipation rate at run-time. The solver is also calculating the ratio of k_res/(k_res+k_sgs) at run-time. You can download it from this repository. I have tested it in a channel flow at Re_t=395 and is working fine, but any feedback is welcome.
Hi Andreas, can you help me how can I compile this into the pimpleFoam solver?

 April 16, 2020, 14:03 #11 Senior Member   Andrea Join Date: Feb 2012 Location: Leeds, UK Posts: 179 Rep Power: 15 Hi Arijit, this is a self-contained solver. You can compile and then use it instead of pimpleFoam. It is essentially as pimpleFoam but it also calculate some useful statistics for LES. Simply clone the repository and execute wmake to compile the solver. I have developed this in OpenFOAM 6.0 so it should work without any issues on that version, not 100% sure about other versions.

April 16, 2020, 14:33
#12
Senior Member

Arijit Saha
Join Date: Feb 2019
Location: Singapore
Posts: 132
Rep Power: 6
Quote:
 Originally Posted by Andrea1984 Hi Arijit, this is a self-contained solver. You can compile and then use it instead of pimpleFoam. It is essentially as pimpleFoam but it also calculate some useful statistics for LES. Simply clone the repository and execute wmake to compile the solver. I have developed this in OpenFOAM 6.0 so it should work without any issues on that version, not 100% sure about other versions.
Yes Andreas, I am new to this openfoam and I am exactly in the intention to find the resolved Kinetic energy part . If you could please tell the steps how to compile,it will be really helpful. I ve tried to go through some youtube videos but those were not much helpful.

 April 16, 2020, 15:09 #13 Senior Member   Andrea Join Date: Feb 2012 Location: Leeds, UK Posts: 179 Rep Power: 15 Copy the files from the repository in a suitable folder in your machine. Usually this is \$WM_PROJECT_USER_DIR/applications/solvers but it can be any folder you can write into Within the folder where you copied the source code execute wmake If this is successful you should now have a pimpleTKEBudgetFoam executable that you can run as you would run the standard pimpleFoam solver

April 16, 2020, 15:51
#14
Senior Member

Arijit Saha
Join Date: Feb 2019
Location: Singapore
Posts: 132
Rep Power: 6
I ve been trying is method as following:-
1. I made a seperate folder consisting of solvers and channel365(as I m trying to simulate that LES flow).
2. In the solvers folder I had taken the pimpleFoam and the pimpleTKEBudgetFoam(the one which is your modified one).
3. Then I started the terminal and initiated with sudo bash.
4. Then I typed wmake but there are some some errors which is popping up.
And with this post I m also attaching the pics which will help you to better understand my problem.
Attached Images
 Screenshot from 2020-04-16 23-44-33 - 1.jpg (30.3 KB, 40 views) Screenshot from 2020-04-16 23-44-40.jpg (30.1 KB, 24 views) Screenshot from 2020-04-16 23-44-55.jpg (33.9 KB, 22 views) Screenshot from 2020-04-17 00-10-20 - 1.jpg (137.3 KB, 31 views) Screenshot from 2020-04-17 00-10-23.jpg (109.8 KB, 21 views)

 April 16, 2020, 16:43 #15 Senior Member   Andrea Join Date: Feb 2012 Location: Leeds, UK Posts: 179 Rep Power: 15 I don't see any obvious issue with what you did. Maybe this is related to the fact that I have developed the solver for OpenFOAM 6.0 and you are using 7.0?

 April 16, 2020, 20:31 #16 Senior Member   Arijit Saha Join Date: Feb 2019 Location: Singapore Posts: 132 Rep Power: 6 Yes it is OpenFoam7 and what is the solution to that?

 April 16, 2020, 22:20 #17 Senior Member   Arijit Saha Join Date: Feb 2019 Location: Singapore Posts: 132 Rep Power: 6 Yaa after lot of trial it is finally done. I have kept the folders similar to pimpleFoam solver where it was showing error. But I didnt found any PimpleTKEBudgetFoam executable file. Even I have modified the solver from pimpleFoam to PimpleTKEBudgetFoam in controlDict but when I m writing the PimpleTKEBudgetFoam in terminal it is showing command not found and it is running properly( as usual) with pimpleFoam.

April 17, 2020, 08:23
#18
New Member

Emily
Join Date: Nov 2017
Posts: 24
Rep Power: 8
Quote:
 Originally Posted by ari003 Hi bro, I am also stuck at the same state of finding the R from the channel flow (pimpleFoam case). Can you please help me how you actually found the R from?
Hi Arijit,

You can write out the modelled (subgrid) Reynolds stress tensor during run time by including the following in your controlDict

functions
{
#includeFunc R
{

You will also need to copy the file 'R' to your system directory, which can be copied from \$FOAM_ETC/caseDicts/postProcessing/fields/R (the location may be slightly different depending on which version of OpenFOAM you use). This will write out the modelled Reynolds stress tensor in your time directories, just like U and p.

Once you have this and the resolved Reynolds stresses (UPrime2Mean) you can follow what Ano replied earlier in the thread to calculate how much of the field is modelled/resolved.

 April 17, 2020, 12:27 #19 Senior Member   Arijit Saha Join Date: Feb 2019 Location: Singapore Posts: 132 Rep Power: 6 Thanks Emi for the reply. I have figured out the way to find R and Uprime2mean and then I can do the calculation in excel spreadsheet right? In this formula 1/2tr(Uprime2Mean))/(1/2tr(R + Uprime2Mean) what does this tr denotes?

 April 17, 2020, 13:37 #20 New Member   Emily Join Date: Nov 2017 Posts: 24 Rep Power: 8 I'd recommend opening the simulation in paraview and then you can use the calculator function - which is very straightforward. tr(...) means the trace of the tensor. Both R and UPrime2Mean are 3x3 tensors, so you can calculate the trace by summing the three diagonal elements.