CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Post-Processing

Uprime2Mean and R (LES)

Register Blogs Community New Posts Updated Threads Search

Like Tree23Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 12, 2020, 13:25
Default
  #21
Member
 
Conor Crickmore
Join Date: Jan 2020
Location: Leicestershire, United Kingdom
Posts: 36
Rep Power: 6
cjc96 is on a distinguished road
As an update for those looking for a "cleaner" or just more general solution, I've since implemented the previously discussed codedFunctionObject as a traditional functionObject following the same format as other fieldExpression derived objects.

I've included the .C and .H files, to be inserted and compiled in either the main or a user-defined src/functionObjects/fields directory, alongside an example of how to load the function within a simulation (by adding to controlDict or as a file within the system directory)

Don't forget to make the necessary additions to Make/files prior to compiling!
Attached Files
File Type: zip LESresolution.zip (2.5 KB, 91 views)
lizzy likes this.
__________________
Conor Crickmore
PhD Researcher in Automotive Aerodynamics
Aeronautical and Automotive Engineering
Loughborough University
LE11 3TU
cjc96 is offline   Reply With Quote

Old   December 7, 2021, 06:38
Smile
  #22
New Member
 
Join Date: May 2021
Posts: 9
Rep Power: 5
SonnyD is on a distinguished road
Hi guys,

I know the discussiun ended a year ago. But this is my way to to qualify my LES mesh resolution.

I usually just calculate the UPrime2Mean of course, as you explained before, to calculate my TKE via diagonal components of the Reynolds Stress Tensor. The SGS-part of the TKE is modelled anyway and printed (in e.g. kEquation and dynamicKEquation LES-Model) automatically. If it is not, one can use the tubulenceFields functionObject in controlDict.
To finally quantify my LES-mesh quality I use the Paraview calculator:
(0.5*(UPrime2Mean_XX+UPrime2Mean_YY+UPrime2Mean_ZZ ))/((0.5*(UPrime2Mean_XX+UPrime2Mean_YY+UPrime2Mean_Z Z))+k)

I guess this is a pretty easy way get your results and it might work for DES aswell.

David
David*, tariq, acgnipper and 3 others like this.
SonnyD is offline   Reply With Quote

Old   March 31, 2022, 05:24
Default
  #23
Member
 
Join Date: Apr 2014
Location: N/A
Posts: 50
Rep Power: 12
FluentStarter is on a distinguished road
Quote:
Originally Posted by cjc96 View Post
As an update for those looking for a "cleaner" or just more general solution, I've since implemented the previously discussed codedFunctionObject as a traditional functionObject following the same format as other fieldExpression derived objects.

I've included the .C and .H files, to be inserted and compiled in either the main or a user-defined src/functionObjects/fields directory, alongside an example of how to load the function within a simulation (by adding to controlDict or as a file within the system directory)

Don't forget to make the necessary additions to Make/files prior to compiling!
Sorry but which are the necessary changes in the Make/files?
FluentStarter is offline   Reply With Quote

Old   January 23, 2023, 11:18
Default
  #24
Member
 
David GISEN
Join Date: Jul 2009
Location: Germany
Posts: 68
Rep Power: 17
David* is on a distinguished road
Quote:
Originally Posted by SonnyD View Post
Hi guys,

I know the discussiun ended a year ago. But this is my way to to qualify my LES mesh resolution.

I usually just calculate the UPrime2Mean of course, as you explained before, to calculate my TKE via diagonal components of the Reynolds Stress Tensor. The SGS-part of the TKE is modelled anyway and printed (in e.g. kEquation and dynamicKEquation LES-Model) automatically. If it is not, one can use the tubulenceFields functionObject in controlDict.
To finally quantify my LES-mesh quality I use the Paraview calculator:
(0.5*(UPrime2Mean_XX+UPrime2Mean_YY+UPrime2Mean_ZZ ))/((0.5*(UPrime2Mean_XX+UPrime2Mean_YY+UPrime2Mean_Z Z))+k)

I guess this is a pretty easy way get your results and it might work for DES aswell.

David



Note that in this version the denominator trace does NOT include k, while in cjc96's version it does! What's right?


/EDIT: I mixed up R and k, they are the difference!
David* is offline   Reply With Quote

Old   May 10, 2023, 07:18
Default
  #25
New Member
 
Saeed Salehi
Join Date: Aug 2010
Posts: 27
Rep Power: 16
salehi144 is on a distinguished road
Hi,

I think Conor's code is implemented nicely. However, in my opinion, there is one small issue which is here, the mean resolved turbulent kinetic is compared energy with the instantaneous modeled energy. I think the correct comparison, would be to compare mean resolved and mean modeled kinetic energies. So, first, one needs to average both U (with primes) and R (without primes) during the simulation and then run the functionObject script.

Additionally, I rewrote the whole script to make it more aligned with the current OpenFOAM coding style. It is assumed that UPrime2Mean and RMean are already available.

Code:
readFields
{
    type            readFields;
    libs            (fieldFunctionObjects);
    fields          (UPrime2Mean turbulenceProperties:RMean);
}

LESIndex
{
    type            coded;
    libs            (utilityFunctionObjects);
    name            LESIndex;

    codeExecute
    #{
        auto* LESIndexPtr =
            mesh().getObjectPtr<volScalarField>("LESIndex");

        if (!LESIndexPtr)
        {
            Info<< "Create total turbulent kinetik energy field" << nl;
            LESIndexPtr = new volScalarField
            (
                IOobject
                (
                    "LESIndex",
                    mesh().time().timeName(),
                    mesh(),
                    IOobject::NO_READ,
                    IOobject::AUTO_WRITE
                ),
                mesh(),
                dimless
            );

            regIOobject::store(LESIndexPtr);
        }
        auto& LESIndex = *LESIndexPtr;

        Info<< "Computing total turbulent kinetik energy field\n" << endl;
        
        auto* RPtr = 
            mesh().getObjectPtr<volSymmTensorField>("turbulenceProperties:RMean");
        auto* UPrime2MeanPtr = 
            mesh().getObjectPtr<volSymmTensorField>("UPrime2Mean");

        if (RPtr && UPrime2MeanPtr)
        {
            auto& R = *RPtr;
            auto& UPrime2Mean = *UPrime2MeanPtr;

            volScalarField resolvedTKE = 0.5*tr(UPrime2Mean); 
            volScalarField totalTKE = 0.5*tr(R) + 0.5*tr(UPrime2Mean);
            LESIndex = resolvedTKE/(totalTKE +
                    dimensionedScalar("small", totalTKE.dimensions(), SMALL));
            LESIndex.write(); // Not necessary if the funcitonObject is used during the simulation
        }
        else
        {
            Warning << endl
                    << "    Unable to compute total turbulent kinetik energy" << endl
                    << "    UPrime2Mean and/or RMean Unavailable" << endl;
        }
    #};
}
Saeed
tariq likes this.
salehi144 is offline   Reply With Quote

Old   July 18, 2024, 04:00
Default
  #26
New Member
 
Xin Li
Join Date: Apr 2020
Posts: 2
Rep Power: 0
YongCLee is on a distinguished road
Quote:
Originally Posted by Andrea1984 View Post
Hi Conor,

an alternative method could be to hardcode resolved TKE, epsilon and all the other variables you need in a modified version of the solver. I gave it a go here: pimpleTKEBudgetFoam, which also includes a LESResolutionIndex = k_res/(k_modelled + k_res)

Andrea
When you calculate UPrime, it seems that you use U from current timestep, but use Umean from last timestep. Because the function to calculate Umean is done after "tkeBudget.H".
YongCLee is offline   Reply With Quote

Reply

Tags
des les, les, reynolds stress tensor, turbulent kinetic energy


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
LES best practice: resolved and modelled turbulence kinetic energy em17 OpenFOAM Running, Solving & CFD 22 April 17, 2020 13:01
Relation between k and UPrime2Mean etc in LES Tarak OpenFOAM Running, Solving & CFD 49 August 10, 2018 13:10
Worse accuracy in LES models than in RANS models dferrando OpenFOAM Running, Solving & CFD 0 August 30, 2017 04:56
Resolved KE versus SGS KE - LES smog OpenFOAM 0 February 11, 2016 18:01
Bug in Dynamic 1Eq Eddy Viscosity LES Model Incompressible flow harishg OpenFOAM Bugs 5 December 2, 2008 18:18


All times are GMT -4. The time now is 23:46.