|
[Sponsors] |
LES UPrime2Mean from previously calculated UMean |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
June 13, 2023, 14:50 |
LES UPrime2Mean from previously calculated UMean
|
#1 |
New Member
Mario Javier Rincón
Join Date: Dec 2020
Location: Denmark
Posts: 9
Rep Power: 6 |
Dear community,
I have been trying to calculate the turbulence kinetic energy (TKE) of large eddy simulations (LES) for a while. I have found that using the fieldAverage utility in OpenFOAM (the standard approach as I have seen) there is a big problem in the calculation of UPrime2Mean. Let me explain by having this code in controlDict: Code:
functions { fieldAverage { type fieldAverage; libs ("libfieldFunctionObjects.so"); writeControl writeTime; fields ( U { mean on; prime2Mean on; base time; } ); } } As a solution, I have been trying to run first only UMean averaging, and when this field is converged, start the UPrime2Mean calculation, hoping that the convergence of the 2nd order statistics does not take that long. However, I have not succeeded at doing so since the calculation of UPrime2Mean takes into account the number of time steps already used to calculate UMean and the UPrime2Mean field barely changes from the results obtained in the first iteration. Have someone managed to fix or use a previous UMean field and use it to calculate UPrime2Mean? Thank you in advance! P.S. I have attached a figure of velocity probes in function of simulation time with the instantaneous values and 1st order statistics to show what I mean. |
|
September 5, 2024, 21:00 |
|
#2 |
New Member
Tian-xiong Zhao
Join Date: Nov 2019
Posts: 2
Rep Power: 0 |
Hi Mario, I have noticed the same issue. Have you figured out a solution?
I'm thinking using the umean from the last timestep and u from every timestep to calculate the uprime2mean manually, but it will only consider "written" timestep instead of "run" timestep, so I'm not sure if that's a good idea. Edit: I have done some more tests and found that I was wrong. The prime2mean value is calculated by the instantaneous value of every timestep, and mean value of the "LAST" step, instead of directly using the prime2mean value from previous timesteps which are based on "PREVIOUS" mean value. Last edited by Lanius; September 6, 2024 at 15:45. |
|
September 6, 2024, 12:16 |
|
#3 | |
Senior Member
Join Date: Apr 2020
Location: UK
Posts: 747
Rep Power: 14 |
Quote:
Don't believe me? Here's the derivation. Start with the mean field, and write the mean based on n samples as: Now substitute and you have a compact way of computing the mean based on just the current sample value and the previous value of the mean (i.e. you don't have to store all the previous sample values). Now buckle up, and let's do the variance. Start with the definition of the perturbation from which it is easy to show that . Then: Now substitute for the summation term using the earlier identity to get: and once again you have a method for calculating the latest, best estimate of the variance using the previous value of the variance and the current sample value. The keen-eyed amongst you will have spotted though that the above requires both the previous and current values of the mean. To save having to store another field (the old mean), the functionObject does some fancy footwork - it calls function addMeanSqrToPrime2Mean() that adds the old mean square to the old prime2 field before updating the mean and then updating the prime2 fields. A masterwork of coding. So the long and short of it is that you just have to keep on sampling, and both the mean and the variance fields will improve. |
||
Tags |
fieldaverage, les, statistics, tke, uprime2mean |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
wallHeatFlux utility for an incompressible case | Mr.Jingles | OpenFOAM Post-Processing | 67 | April 6, 2023 04:25 |
dsmcFoam setup | hherbol | OpenFOAM Pre-Processing | 1 | November 19, 2021 02:52 |
The Umean of a flow around a cube calculated in Openfoam looks like instantaneous | jiaodanuma | OpenFOAM Verification & Validation | 4 | June 14, 2016 18:16 |
LiftDrag coefficient in LES | fabian_korn | OpenFOAM Post-Processing | 1 | September 22, 2008 03:34 |
Some Questions about LES. | Bin Li | Main CFD Forum | 2 | February 20, 2004 10:58 |