CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Bugs (http://www.cfd-online.com/Forums/openfoam-bugs/)
-   -   muSgsWallFunctionFvPatchField, explanations or bug ? (http://www.cfd-online.com/Forums/openfoam-bugs/78477-musgswallfunctionfvpatchfield-explanations-bug.html)

fgal July 22, 2010 14:19

muSgsWallFunctionFvPatchField, explanations or bug ?
 
Hi Foamers,

I had a look at the muSgsWallFunctionFvPatchField implementation in order to know which kind of model was used. I am confused about what I found as I think that many formula are not homogeneous, but that could be due to my lack of knowledge of OpenFoam. Also, could anybody tell me where this formulation comes from ?
Code:

void muSgsWallFunctionFvPatchScalarField::evaluate
(
    const Pstream::commsTypes
)
{
    const scalarField& ry = patch().deltaCoeffs();

    const fvPatchVectorField& U =
        patch().lookupPatchField<volVectorField,  vector>(UName_);

    scalarField magUp = mag(U.patchInternalField() - U);

    const scalarField& muw =
        patch().lookupPatchField<volScalarField,  scalar>(muName_);

    const scalarField& rhow =
        patch().lookupPatchField<volScalarField,  scalar>(rhoName_);

    scalarField& muSgsw = *this;

    scalarField magFaceGradU = mag(U.snGrad());

    forAll(muSgsw, facei)
    {
        scalar magUpara = magUp[facei];

        scalar utau =
            sqrt((muSgsw[facei] +  muw[facei])*magFaceGradU[facei]/rhow[facei]);

        if (utau > 0)
        {
            int iter = 0;
            scalar err = GREAT;

            do
            {
                scalar kUu = kappa_*magUpara/utau;
                scalar fkUu = exp(kUu) - 1 - kUu*(1 + 0.5*kUu);

                scalar f =
                    - utau/(ry[facei]*muw[facei]/rhow[facei])
                    + magUpara/utau
                    + 1/E_*(fkUu - 1.0/6.0*kUu*sqr(kUu));

                scalar df =
                    - 1.0/(ry[facei]*muw[facei]/rhow[facei])
                    - magUpara/sqr(utau)
                    - 1/E_*kUu*fkUu/utau;

                scalar utauNew = utau - f/df;
                err = mag((utau - utauNew)/utau);
                utau = utauNew;

            } while (utau > VSMALL && err > 0.01  && ++iter < 10);

            muSgsw[facei] =
                max
                (
                    rhow[facei]*sqr(utau)/magFaceGradU[facei] -  muw[facei],
                    0.0
                );
        }
        else
        {
            muSgsw[facei] = 0;
        }
    }
}

I understand the code until the while loop.
First, if the uTau should be corrected and computed iteratively, why does this loop does not include the updated muSgs as it is used to compute utau ?

Then the following formulas seems not homogeneous:

Code:

  scalar f =
                    - utau/(ry[facei]*muw[facei]/rhow[facei])
                    + magUpara/utau
                    + 1/E_*(fkUu - 1.0/6.0*kUu*sqr(kUu));

If I am right ry is the delta of the LES filter so is in meters, so, with the convention that "~" means "is homogeneous to":

utau/(ry[facei]*muw[facei]/rhow[facei]) ~ m.s-1/(m.m2.s-1) ~ m-2
magUpara/utau ~ 1
1/E_*(fkUu - 1.0/6.0*kUu*sqr(kUu)) ~ 1

So the first term seems not to be exact.

Then
Code:

  scalar df =
                    - 1.0/(ry[facei]*muw[facei]/rhow[facei])
                    - magUpara/sqr(utau)
                    - 1/E_*kUu*fkUu/utau;

- 1.0/(ry[facei]*muw[facei]/rhow[facei]) ~1/(m.m2.s-1) ~ m-3.s-1
- magUpara/sqr(utau) ~ 1
- 1/E_*kUu*fkUu/utau; ~ m.s-1

Also, could anybody tell me what these terms mean ?

Finally

Code:

muSgsw[facei] =
                max
                (
                    rhow[facei]*sqr(utau)/magFaceGradU[facei] -  muw[facei],
                    0.0
                );

rhow[facei]*sqr(utau)/magFaceGradU[facei]~kg.m-3.(m.s-1)**0.5/(m.s-1.m-1) ~ kg.m-2.5.s0.5
which is not a dynamic viscosity in : kg.m-1.s-1

Thanks in advance for any comment.


Francois


All times are GMT -4. The time now is 19:51.