CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Post-Processing (https://www.cfd-online.com/Forums/openfoam-post-processing/)
-   -   Mismatch LES resolution index and PopeIndex (https://www.cfd-online.com/Forums/openfoam-post-processing/254984-mismatch-les-resolution-index-popeindex.html)

rcombette March 13, 2024 03:46

Mismatch LES resolution index and PopeIndex
 
Hi everyone,


I am doing LES on OpenFoam (using the dynamicKEqn and buoyantBoussinesqPimpleFoam if it matters) and as an indicator for the resolution I am trying to compare the resolved and modeled part of the turbulent kinetic energy. As the formula by Pope: Gamma = kres/(kres+ksgs).


This index can directly be calculated in OpenFoam by using in controlDict:
Code:

PopeCrit
 {       
    type        resolutionIndex;
    libs        (fieldFunctionObjects);
    model      PopeIndex;
    writeControl        writeTime;
    includeKnum false;
}

An additionnal term knum can be included in the equation for Gamma.


Since I could not find a lot of information about the implementation of this index in OpenFoam I wanted to check it and calculate Gamma myself.


Looking at other threads (such as: https://www.cfd-online.com/Forums/op...ean-r-les.html) I believe I can calculate it in Paraview by doing:
Gamma = kres/(kres+k)
wherein, kres = 0.5*sqrt((U_X-UMean_X)^2+(U_Y-UMean_Y)^2+(U_Z-UMean_Z)^2)


Unfortunately, these two fields do not match. They look alike in terms of space distribution but the values are different.


So my question is: what do I misunderstand ? and where does this mismatch comes from ?
And also maybe if you some of have have already used this Pope index and checked its well implementation ?


Thank you !
Robin






-----------------------------
For reference here is how the PopeIndex is coded which seems to do the same thing I do in Paraview:
Code:

bool Foam::resolutionIndexModels::PopeIndex::read(const dictionary& dict)
{
    if (!resolutionIndexModel::read(dict))
    {
        return false;
    }

    includeKnum_ = dict.getOrDefault<bool>("includeKnum", true);
    if (includeKnum_)
    {
        Cn_ = dict.getOrDefault<scalar>("Cnu", 1.0);
    }
    UName_ = dict.getOrDefault<word>("U", "U");
    UMeanName_ = dict.getOrDefault<word>("UMean", "UMean");
    kName_ = dict.getOrDefault<word>("k", "k");
    deltaName_ = dict.getOrDefault<word>("delta", "delta");

    return true;
}


bool Foam::resolutionIndexModels::PopeIndex::execute()
{
    // Calculate resolved k field
    const auto& U = getOrReadField<volVectorField>(UName_);
    const auto& UMean = getOrReadField<volVectorField>(UMeanName_);
    const volScalarField kRes(0.5*magSqr(U - UMean));

    // Calculate subgrid-scale k field
    const auto& kSgs = getOrReadField<volScalarField>(kName_);

    // Calculate total k field
    tmp<volScalarField> tkTot = kRes + kSgs;
    if (includeKnum_)
    {
        tkTot.ref() += mag(kNum());
    }


rcombette March 14, 2024 08:10

Nevermind, the equation is wrong I don't know why I added the sqrt.
The thread can be deleted


All times are GMT -4. The time now is 11:50.