CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Bugs (http://www.cfd-online.com/Forums/openfoam-bugs/)
-   -   mutRoughWallFunction on OF 1.7.0 (http://www.cfd-online.com/Forums/openfoam-bugs/79735-mutroughwallfunction-1-7-0-a.html)

OMN September 2, 2010 02:23

mutRoughWallFunction on OF 1.7.0
 
Hello

I tried to set up a rough wall for a run with buoyantSimpleFoam in OF 1.7 using the syntax:

wall
{
type mutRoughWallFunction;
Ks uniform 0.005;
Cs uniform 0.5;
value uniform 0;
}

and I got this error message after starting buoyantSimpleFoam:

Selecting RAS turbulence model realizableKE
#0 Foam::error::printStack(Foam::Ostream&) in "/opt/openfoam170/lib/linuxGccDPOpt/libOpenFOAM.so"
#1 Foam::sigFpe::sigFpeHandler(int) in "/opt/openfoam170/lib/linuxGccDPOpt/libOpenFOAM.so"
#2 Uninterpreted:
#3 log in "/lib/tls/i686/cmov/libm.so.6"
#4 Foam::compressible::RASModel::yPlusLam(double, double) const in "/opt/openfoam170/lib/linuxGccDPOpt/libcompressibleRASModels.so"
#5 Foam::compressible::RASModels::mutRoughWallFunctio nFvPatchScalarField::calcMut() const in "/opt/openfoam170/lib/linuxGccDPOpt/libcompressibleRASModels.so"
#6 Foam::compressible::RASModels::mutWallFunctionFvPa tchScalarField::updateCoeffs() in "/opt/openfoam170/lib/linuxGccDPOpt/libcompressibleRASModels.so"
#7 Foam::fvPatchField<double>::evaluate(Foam::Pstream ::commsTypes) in "/opt/openfoam170/applications/bin/linuxGccDPOpt/buoyantSimpleFoam"
#8 Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>::GeometricBoundaryField::evaluate() in "/opt/openfoam170/applications/bin/linuxGccDPOpt/buoyantSimpleFoam"
#9 Foam::compressible::RASModels::realizableKE::reali zableKE(Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> const&, Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh> const&, Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> const&, Foam::basicThermo const&) in "/opt/openfoam170/lib/linuxGccDPOpt/libcompressibleRASModels.so"
#10 Foam::compressible::RASModel::adddictionaryConstru ctorToTable<Foam::compressible::RASModels::realiza bleKE>::New(Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> const&, Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh> const&, Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> const&, Foam::basicThermo const&) in "/opt/openfoam170/lib/linuxGccDPOpt/libcompressibleRASModels.so"
#11 Foam::compressible::RASModel::New(Foam::GeometricF ield<double, Foam::fvPatchField, Foam::volMesh> const&, Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh> const&, Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> const&, Foam::basicThermo const&) in "/opt/openfoam170/lib/linuxGccDPOpt/libcompressibleRASModels.so"
#12
in "/opt/openfoam170/applications/bin/linuxGccDPOpt/buoyantSimpleFoam"
#13 __libc_start_main in "/lib/tls/i686/cmov/libc.so.6"
#14
in "/opt/openfoam170/applications/bin/linuxGccDPOpt/buoyantSimpleFoam"
Floating point exception

Would someone know what the problem is? Everything works fine with mutWallFunction.

I also tried to use mutRoughWallFunction in the hotroom tutorial for buoyantSimpleFoam but I got the same error message. I also tried this with rhoPorousSimpleFoam and got the same error message. Is this a bug or my lack of understanding of the use of mutRoughWallFunction?

Cheers

Olivier

mattijs September 2, 2010 03:09

We've finally got a proper bug reporting system :-)
Please report any 1.7 bugs on http://www.openfoam.com/bugs.

Thanks,

Mattijs

anger September 20, 2010 11:27

same problem with 1.7.x (git of today)
 
Hi Olivier,

I checked your and andy's communication on the bug tracker; is the issue resolved for you?
Background: I tried the same for rhoPorousSimpleFoam with the angledDuctImplicit tutorial case. All my efforts failed miserably and I did not get the case to run, even with initializing all values in the 0/mut file (error message below).

Selecting RAS turbulence model kEpsilon
#0 Foam::error::printStack(Foam::Ostream&) in "/soft/OpenFOAM/OpenFOAM-1.7.x/lib/linux64GccDPOpt/libOpenFOAM.so"
#1 Foam::sigFpe::sigFpeHandler(int) in "/soft/OpenFOAM/OpenFOAM-1.7.x/lib/linux64GccDPOpt/libOpenFOAM.so"
#2 ?? in "/lib/libc.so.6"
#3 ?? in "/lib/libm.so.6"
#4 log in "/lib/libm.so.6"
#5 Foam::compressible::RASModel::yPlusLam(double, double) const in "/soft/OpenFOAM/OpenFOAM-1.7.x/lib/linux64GccDPOpt/libcompressibleRASModels.so"
#6 Foam::compressible::RASModels::mutRoughWallFunctio nFvPatchScalarField::calcMut() const in "/soft/OpenFOAM/OpenFOAM-1.7.x/lib/linux64GccDPOpt/libcompressibleRASModels.so"
#7 Foam::compressible::RASModels::mutWallFunctionFvPa tchScalarField::updateCoeffs() in "/soft/OpenFOAM/OpenFOAM-1.7.x/lib/linux64GccDPOpt/libcompressibleRASModels.so"
#8 Foam::fvPatchField<double>::evaluate(Foam::Pstream ::commsTypes) in "/soft/OpenFOAM/OpenFOAM-1.7.x/applications/bin/linux64GccDPOpt/rhoPorousSimpleFoam"
#9 Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>::GeometricBoundaryField::evaluate() in "/soft/OpenFOAM/OpenFOAM-1.7.x/applications/bin/linux64GccDPOpt/rhoPorousSimpleFoam"
#10 Foam::compressible::RASModels::kEpsilon::kEpsilon( Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> const&, Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh> const&, Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> const&, Foam::basicThermo const&) in "/soft/OpenFOAM/OpenFOAM-1.7.x/lib/linux64GccDPOpt/libcompressibleRASModels.so"
#11 Foam::compressible::RASModel::adddictionaryConstru ctorToTable<Foam::compressible::RASModels::kEpsilo n>::New(Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> const&, Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh> const&, Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> const&, Foam::basicThermo const&) in "/soft/OpenFOAM/OpenFOAM-1.7.x/lib/linux64GccDPOpt/libcompressibleRASModels.so"
#12 Foam::compressible::RASModel::New(Foam::GeometricF ield<double, Foam::fvPatchField, Foam::volMesh> const&, Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh> const&, Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> const&, Foam::basicThermo const&) in "/soft/OpenFOAM/OpenFOAM-1.7.x/lib/linux64GccDPOpt/libcompressibleRASModels.so"
#13 main in "/soft/OpenFOAM/OpenFOAM-1.7.x/applications/bin/linux64GccDPOpt/rhoPorousSimpleFoam"
#14 __libc_start_main in "/lib/libc.so.6"
#15 _start at /build/buildd/eglibc-2.10.1/csu/../sysdeps/x86_64/elf/start.S:116
Floating point exception

To my surprise the case ran through valgrind; I'm in no way an expert what this could mean, but probably an initialisation issue exists. What else did you change to get the case running?

Regards,
--
Thomas

OMN September 21, 2010 02:06

I initialized with mutWallFunction
 
Hello

I ran the case with mutWallFunction for about 100 iterations, then I switched to mutRoughWallFunction. But I did that on my own case, not the tutorial. But it should work: it is indeed an initialization problem. But it is weird that it would affect the solution so strongly.

Kind regards

Olivier

anger September 21, 2010 03:30

Problem found (but not understood)
 
Hi,

thanks for your input, Olivier.
Sadly, this did not work for me so I tried to track down this issue.
The problem comes from ypl getting negative at around line 166 of file RASModel.C, so catching this resolves the issue technically; however I do not know what this means physically, i.e. whether an error may be introduced here.
Maybe someone having more insight into the OF internals can comment on this.

Best regards,
--
Thomas

aerothermal November 10, 2010 12:23

trying to use mutRoughWallFunction with kOmegaSST in rhoSimpleFoam
 
I got same messages when trying to use mutRoughWallFunction with kOmegaSST in rhoSimpleFoam.

Is it a confirmed bug? Did someone know how to use wall functions wiht roughness?

aerothermal November 10, 2010 14:06

just try

Code:

export FOAM_SIGFPE=false
or

Code:

unset FOAM_SIGFPE

niklas November 12, 2010 04:05

find the file RASModel.C

in src/turbulenceModels/compressible/RAS/RASModel

and modify the line to calculate ypl to whats below
Code:

scalar RASModel::yPlusLam(const scalar kappa, const scalar E) const
{
    scalar ypl = 11.0;

    for (int i=0; i<10; i++)
    {
      ypl = log(max(E*ypl,1.0))/kappa;
    }

    return ypl;
}

then goto src/turbulenceModels/compressible/RAS
and type wmake libso

now try it again. Does that work better?

aerothermal November 12, 2010 09:47

Other bugs in model implemented in mutRoughWallFuntion
 
Quote:

Originally Posted by niklas (Post 283190)
find the file RASModel.C

in src/turbulenceModels/compressible/RAS/RASModel

and modify the line to calculate ypl to whats below
Code:

scalar RASModel::yPlusLam(const scalar kappa, const scalar E) const
{
    scalar ypl = 11.0;

    for (int i=0; i<10; i++)
    {
      ypl = log(max(E*ypl,1.0))/kappa;
    }

    return ypl;
}

then goto src/turbulenceModels/compressible/RAS
and type wmake libso

now try it again. Does that work better?


Thank you. It makes sense in order to prevent log(0) calculation. I will implement it anyway.

However, I have found another potential bugs in equations of mutRoughWallFunction. The implementation does not reflect the mathematical modelling found in some references:

In order to fix that bug, I implemented additional changes to the code, which I called mymutRoughWallFunctionFvPatchScalarField.C. As you can see, I commented out the original lines for reference and traceability.

Code:


tmp<scalarField> mymutRoughWallFunctionFvPatchScalarField::calcMut() const
{
    const label patchI = patch().index();

    const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties");
    const scalarField& y = rasModel.y()[patchI];
    const scalarField& rhow = rasModel.rho().boundaryField()[patchI];
    const tmp<volScalarField> tk = rasModel.k();
    const volScalarField& k = tk();
    const scalarField& muw = rasModel.mu().boundaryField()[patchI];

    const scalar Cmu25 = pow(Cmu_, 0.25);

    tmp<scalarField> tmutw(new scalarField(*this));
    scalarField& mutw = tmutw();

    forAll(mutw, faceI)
    {
        label faceCellI = patch().faceCells()[faceI];

        scalar uStar = Cmu25*sqrt(k[faceCellI]);

        scalar yPlus = uStar*y[faceI]/(muw[faceI]/rhow[faceI]);

        scalar KsPlus = uStar*Ks_[faceI]/(muw[faceI]/rhow[faceI]);

//        scalar Edash = E_;
        scalar Edash = 0;
        scalar yPlusLamNew = yPlusLam_;
        if (KsPlus > 2.25)
        {
            /* it was
            yPlusLamNew = rasModel.yPlusLam(kappa_, Edash);
            Edash /= fnRough(KsPlus, Cs_[faceI]);*/
           
            /* it becomes */
            Edash = 1/kappa_*log(fnRough(KsPlus, Cs_[faceI]));
            yPlusLamNew = rasModel.yPlusLam(kappa_, E_);
        }

        if (debug)
        {
            Info<< "yPlus = " << yPlus
                << ", KsPlus = " << KsPlus
                << ", Edash = " << Edash
                << ", yPlusLam = " << yPlusLam_
                << endl;
        }

        if (yPlus > yPlusLamNew)
        {
            /* it was
            mutw[faceI] =
                muw[faceI]*(yPlus*kappa_/log(max(Edash*yPlus, 1+1e-4)) - 1);

            Calculation from OpenFOAM original mutWallFunction (smooth wall!!)
            mutw[faceI] = muw[faceI]*(yPlus*kappa_/log(E_*yPlus) - 1);*/

            mutw[faceI] = muw[faceI]*(yPlus*kappa_/
                log(max(E_*yPlus/exp(kappa_*Edash),1+1e-4)) - 1);

        }
    }

    return tmutw;
}

I already run a rough cylinder flow of Re 2.2E5, heat transfer from isothermal wall at 333.15 K and freestream temperature of 303.15. The original OpenFoam gave me a Cp lowest value between the potential solution and the experimental; and provided me a Frossling (which is Nu/sqrt(Re)) three times less than experimental. With the new implementation, everything is in the same order. Both Frossling and Cp are very close to experimental data.

Regards,

Guilherme

aerothermal November 12, 2010 17:39

E is a constant (non-zero).
yplus is 11 at the start and is calculated....

How does it go to zero anyway?

newOFuser June 14, 2011 11:07

Hi

I tried "unset FOAM_SIGFPE" in the .bashrc file followed by the “. $HOME/.bashrc” command, but when I run the case, I still get the following before the simulation starts:
SigFpe : Enabling floating point exception trapping (FOAM_SIGFPE).
SetNaN : Initialising allocated memory to NaN (FOAM_SETNAN).

I tried "export FOAM_SIGFPE=false" as well but that didn't work either.

Do we have to run ./Allwmake in the top-level source directory $WM_PROJECT_DIR as well?

Can anyone who has successfully unset sigFpe provide the details?
Sorry, it seems like it is easy to implement, but I am new to using OF, and would appreciate any help.

Thanks so much.
ak

rgarcia December 13, 2011 08:11

Hi all,

I have a quick and probably stupid question...

I don't understans the code line: "scalar Edash /= E_"

Even when E_ has not been initialised.

Thank you in advance.

Roger


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