CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Bugs (http://www.cfd-online.com/Forums/openfoam-bugs/)
-   -   Report a bug in LienCubicKELowReSetWallDissipation.H (http://www.cfd-online.com/Forums/openfoam-bugs/89676-report-bug-liencubickelowresetwalldissipation-h.html)

JinBiao June 20, 2011 00:37

Report a bug in LienCubicKELowReSetWallDissipation.H
 
This head file sets the value of epsilon in the near wall cell. In order to consider the possibility that one cell may contain more than one wall-boundary faces. It contains the average function as follow.

Code:

    forAll(patches, patchi)
    {
        const fvPatch& curPatch = patches[patchi];

        if (isA<wallFvPatch>(curPatch))
        {
            forAll(curPatch, facei)
            {
                label faceCelli = curPatch.faceCells()[facei];

                // For corner cells (with two boundary or more faces),
                // epsilon in the near-wall cell are calculated as an average

                cellBoundaryFaceCount[faceCelli]++;

                epsilon_[faceCelli] +=
                    Cmu75*pow(k_[faceCelli], 1.5)
                    /(
                        kappa_.value()*y_[faceCelli]
                        *(1.0 - exp(-Aepsilon_.value()*yStar_[faceCelli]))
                    )
                    *exp(-Amu_.value()*sqr(yStar_[faceCelli]));

            }
        }
    }

    // perform the averaging

    forAll(patches, patchi)
    {
        const fvPatch& curPatch = patches[patchi];

        if (isA<wallFvPatch>(curPatch))
        {
            forAll(curPatch, facei)
            {
                label faceCelli = curPatch.faceCells()[facei];

                epsilon_[faceCelli] /= cellBoundaryFaceCount[faceCelli];
            }
        }
    }

For example, the cell i have two wall-boundary faces, then cellBoundaryFaceCount[i]=2. But the epsilon_ in the cell i will be divided by 2 twice. It is to say the epsilon_ is actually divided by 4. To remedy this bug, I replace the code above with

Code:

    forAll(patches, patchi)
    {
        const fvPatch& curPatch = patches[patchi];

        if (isA<wallFvPatch>(curPatch))
        {
            forAll(curPatch, facei)
            {
                label faceCelli = curPatch.faceCells()[facei];

                // For corner cells (with two boundary or more faces),
                // epsilon in the near-wall cell are calculated as an average

                cellBoundaryFaceCount[faceCelli]++;

                label n = cellBoundaryFaceCount[faceCelli];

                scalar eps_n = 
                            Cmu75*pow(k_[faceCelli], 1.5)
                          /(
                                kappa_.value()*y_[faceCelli]
                              *(1.0 - exp(-Aepsilon_.value()*yStar_[faceCelli]))
                            )
                          *exp(-Amu_.value()*sqr(yStar_[faceCelli]));

                // eps_ave = [(n-1)*eps_{n-1} + eps_n]/n
                epsilon_[faceCelli] =  ((n-1)*epsilon_[faceCelli] + eps_n) / n;;

            }
        }
    }

Best,

Jinbiao


All times are GMT -4. The time now is 09:47.