CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (https://www.cfd-online.com/Forums/openfoam-solving/)
-   -   LES best practice: resolved and modelled turbulence kinetic energy (https://www.cfd-online.com/Forums/openfoam-solving/212160-les-best-practice-resolved-modelled-turbulence-kinetic-energy.html)

em17 November 27, 2018 08:13

LES best practice: resolved and modelled turbulence kinetic energy
 
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

ano December 13, 2018 10:25

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

em17 December 17, 2018 06:09

Thank you for your detailed reply - you've really helped to clarify this!

Andrea1984 September 25, 2019 06:06

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.

godfatherBond October 5, 2019 01:01

Quote:

Originally Posted by Andrea1984 (Post 745453)
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?

Andrea1984 October 5, 2019 05:58

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

godfatherBond November 29, 2019 00:06

Quote:

Originally Posted by Andrea1984 (Post 746271)
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!

Andrea1984 November 29, 2019 05:22

Hi, please see my answer on this other thread

Andrea

ari003 April 16, 2020 12:01

Quote:

Originally Posted by em17 (Post 717032)
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?

ari003 April 16, 2020 12:21

Quote:

Originally Posted by Andrea1984 (Post 745453)
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?

Andrea1984 April 16, 2020 13:03

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.

ari003 April 16, 2020 13:33

Quote:

Originally Posted by Andrea1984 (Post 765990)
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.

Andrea1984 April 16, 2020 14:09

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

ari003 April 16, 2020 14:51

5 Attachment(s)
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.

Andrea1984 April 16, 2020 15:43

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?

ari003 April 16, 2020 19:31

Yes it is OpenFoam7 and what is the solution to that?

ari003 April 16, 2020 21:20

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.

em17 April 17, 2020 07:23

Quote:

Originally Posted by ari003 (Post 765977)
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.

ari003 April 17, 2020 11:27

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?

em17 April 17, 2020 12:37

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.


All times are GMT -4. The time now is 19:04.