How to calculate the LES turbulent kinetic erengy in OpenFOAM

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

 February 25, 2020, 01:56 How to calculate the LES turbulent kinetic erengy in OpenFOAM #1 New Member   王子阳 Join Date: Aug 2019 Posts: 25 Rep Power: 3 hi i recently want to calculate the turbulent kinetic erengy using LES, when i search on the net, i only search the formula: k= 0.5((u')^2+(v')^2+(w')^2) where,u'=u-umean,v'=v-vmean,w'=w-wmean i think this formula is uncorrect,but i can't find how to calculate LES TKE in openfoam help! best wishes! ziwang Светлана likes this.

 February 27, 2020, 07:57 #2 Member   Conor Crickmore Join Date: Jan 2020 Location: Leicestershire, United Kingdom Posts: 30 Rep Power: 2 Hey! This is asked quite a lot on the forum, you'll probably find a fair few discussions about if you were to type in "LES TKE CFD-Online" into Google. Your formula for Turbulent Turbulent Kinetic Energy is (more or less) correct. I've recently posted a thread where I was working on a function to output the ratio of resolved/total TKE for my own LES work, see here. The quick version of which is that the 'R' post-processing function will provide you with the sub-grid Reynolds Stress Tensor, and the 'UPrime2Mean' calculation in the 'fieldAverage' function will provide you with the resolved Reynolds Stress Tensor, where: so your total Turbulent Kinetic Energy is: Hopefully this and the links provided should be enough to see you through! Светлана likes this. __________________ Conor Crickmore PhD Researcher in Automotive Aerodynamics Aeronautical and Automotive Engineering Loughborough University LE11 3TU

 August 27, 2020, 16:51 #3 New Member   Luiz Oliveira Join Date: Aug 2018 Location: Campo Grande, Brazil Posts: 17 Rep Power: 4 Since someone might be as lazy as myself, here goes the code that adds the totalTKE into account: Code: totalTKE { type coded; libs ("libutilityFunctionObjects.so"); name totalTKE; executeControl timeStep; writeControl writeTime; // timeStart 0; // timeEnd 0; enabled true; /*---------------------------------------------------------------------------*\ Total Turbulent Kinect Energy Evaluation ** Requires fieldAverage Function to Obtain UPrime2Mean** ** Resolved Reynolds Stress Tensor ** Requires turbulenceFields Function to Obtain R** ** Subgrid Reynolds Stress Tensor \*---------------------------------------------------------------------------*/ codeExecute #{ static autoPtr totalTKE; if ( mesh().foundObject("UPrime2Mean") && mesh().foundObject("turbulenceProperties:R") && mesh().foundObject("totalTKE") == 0 ) { Info << "Turbulent Kinect Energy:" << endl; Info << " Initialising" << endl; Info << " Calculating" << nl << endl; totalTKE.set ( new volScalarField ( IOobject ( "totalTKE", mesh().time().timeName(), mesh(), IOobject::NO_READ, IOobject::AUTO_WRITE ), mesh(), dimensionedScalar ( "totalTKE", dimensionSet(0,2,-2,0,0,0,0), 0 ) ) ); const volSymmTensorField& R = mesh().lookupObjectRef("turbulenceProperties:R"); const volSymmTensorField& UPrime2Mean = mesh().lookupObjectRef("UPrime2Mean"); volScalarField& totalTKE = mesh().lookupObjectRef("totalTKE"); totalTKE = (0.5 * tr(R)) + (0.5 * tr(UPrime2Mean)); totalTKE.write(); } else if ( mesh().foundObject("UPrime2Mean") && mesh().foundObject("turbulenceProperties:R") && mesh().foundObject("totalTKE") ) { Info << "Turbulent Kinect Energy:" << endl; Info << " Calculating" << nl << endl; const volSymmTensorField& R = mesh().lookupObjectRef("turbulenceProperties:R"); const volSymmTensorField& UPrime2Mean = mesh().lookupObjectRef("UPrime2Mean"); volScalarField& totalTKE = mesh().lookupObjectRef("totalTKE"); totalTKE = (0.5 * tr(R)) + (0.5 * tr(UPrime2Mean)); totalTKE.write(); } else { Info << "Turbulent Kinect Energy:" << endl; Warning << endl << " Unable to Calculate Turbulent Kinect Energy" << endl << " UPrime2Mean and/or R Unavailable" << endl << " Enable fieldAverage and turbulenceFields Functions" << nl << endl; } #}; } Note that this most be in system folder and called by controlDict. The only changes from cjc96 function are the referencing to R (from R to turbulenceProperties:R) and the calculation itself. I checked function results with some literature data available and it seems to yield adequate values. oswald likes this. __________________ Luiz Oliveira MSc Researcher in Environmental Fluid Dynamics Environmental Fluid Dynamics Federal University of Mato Grosso do Sul

 Tags tke les