CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM (http://www.cfd-online.com/Forums/openfoam/)
-   -   Problem regarding solution under-relaxation (http://www.cfd-online.com/Forums/openfoam/81231-problem-regarding-solution-under-relaxation.html)

Edy October 20, 2010 11:49

Problem regarding solution under-relaxation
 
Hi Foamers,

I am modeling subcooled boiling and condensation using a two phase Euler-Euler approach. So i solve mass, momentum and energy conservation equations for both phases.

I checked several times my model and i am pretty sure that it is physically correct. I mean, the equations i implemented make sense. However my simulation (a simple 2D channel) crashed very quickly...

I think this is due to numerical calculation reasons, so i used relaxation factors, in order to improve the stability of the computation. Here are the solvers and relaxation factors i set:

Code:

solvers
{
    p GAMG
    {
        tolerance        1e-10;
        relTol          0;

        smoother        DIC; //GaussSeidel;
        nPreSweeps      0;
        nPostSweeps      2;
        nFinestSweeps    2;

        cacheAgglomeration true;
        nCellsInCoarsestLevel 10;
        agglomerator    faceAreaPair;
        mergeLevels      1;
    };
    Ua PBiCG
    {
        preconditioner  DILU;
        tolerance        1e-05;
        relTol          0.5;
    };
    Ub PBiCG
    {
        preconditioner  DILU;
        tolerance        1e-05;
        relTol          0;
    };
    alpha PBiCG
    {
        preconditioner  DILU;
        tolerance        1e-10;
        relTol          0;
    };
    beta PBiCG
    {
        preconditioner  DILU;
        tolerance        1e-10;
        relTol          0;
    };

    Ha PBiCG
    {
        preconditioner  DILU;
        tolerance        1e-5;
        relTol          0;
    };
    Hb PBiCG
    {
        preconditioner  DILU;
        tolerance        1e-5;
        relTol          0;
    };
    DS PBiCG
    {
        preconditioner  DILU;
        tolerance        1e-5;
        relTol          0;
    };
    Theta PBiCG
    {
        preconditioner  DILU;
        tolerance        1e-05;
        relTol          0;
    };
    k PBiCG
    {
        preconditioner  DILU;
        tolerance        1e-05;
        relTol          0;
    };
    epsilon PBiCG
    {
        preconditioner  DILU;
        tolerance        1e-05;
        relTol          0;
    };
}

PISO
{
    nCorrectors    2;
    nNonOrthogonalCorrectors 0;
    nAlphaCorr      2;
    correctAlpha    no;
    pRefCell        0;
    pRefValue      0.0;
}

relaxationFactors
{
    alpha          0.3;
    DS              0.3;
    p              0.3;
    Ua              0.3;
    Ub              0.3;
    Ha              0.3;
    Hb              0.3;
}

However, my simulation crashed during the first time step and i get this error message:

Code:

GAMG:  Solving for p, Initial residual = 1, Final residual = 5.7155e-11, No Iterations 93


--> FOAM FATAL ERROR:
previous iteration field
IOobject: volScalarField p "/home/michta/OpenFOAM/michta-1.7.x/run/EulerEulerBoilingFoam/EulerEulerBoilingFoam/referenceCase/0"

  not stored.  Use field.storePrevIter() at start of iteration.

    From function GeometricField<Type, PatchField, GeoMesh>::prevIter() const
    in file /home/michta/OpenFOAM/OpenFOAM-1.7.x/src/OpenFOAM/lnInclude/GeometricField.C at line 863.

FOAM aborting

Could someone explain me what is happening? I checked the OF User Guide but did not find any answer..

Thanks in advance!
Best,

/Edy

benk October 20, 2010 13:18

You may have other problems as well, but in order to use damping factors, you need to store the previous solution. Just place:

FIELD.storePrevIter();

in your solver before solving for the equation.

Edy October 20, 2010 13:22

Hi,

Thanks for your answer. But i applied the relaxation on the equation instead of applying it directly on the field, it should work as well, right?
Here is my piece of code :

Code:

        fvScalarMatrix pEqn
        (
            fvm::laplacian(Dp, p) == fvc::div(phi)
        );

        pEqn.setReference(pRefCell, pRefValue);
        pEqn.relax();     
        pEqn.solve();

I think this should work too, dont you think?


/Edy

Edy October 20, 2010 13:24

Because for the other fields (velocity, enthalpy, k, epsilon), i also apply the relaxation on the equation, not directly on the field, and I do not have this error message...

benk October 21, 2010 08:59

Hmm...you're right...I'm not sure what the problem is. Maybe try underrelaxing the other way to see if that works?

Edy October 21, 2010 09:15

Hi!

Your way works, mine does not, i dont understand why...

However even with this underrelaxation, my simulation crashed, so i will check my code, once again.... :(

Thanks for the help!

Best

/Edy

hz283 March 21, 2013 13:38

Hi All,

I also had a problem about the underrelax factor in openfoam. In my simulation case, I used k-epsilon and rhoSimplecFoam. However, for the relaxation factors of k and epsilon, I need to reduce the factors to very small, less than 0.1. And the iteration step is zero. If I slightly increase the relaxation factors, the simulation will blow up due to large k or epsilon.

Does anybody know what is the underlying reason behind this problem?



Quote:

Originally Posted by Edy (Post 280001)
Hi Foamers,

I am modeling subcooled boiling and condensation using a two phase Euler-Euler approach. So i solve mass, momentum and energy conservation equations for both phases.

I checked several times my model and i am pretty sure that it is physically correct. I mean, the equations i implemented make sense. However my simulation (a simple 2D channel) crashed very quickly...

I think this is due to numerical calculation reasons, so i used relaxation factors, in order to improve the stability of the computation. Here are the solvers and relaxation factors i set:

Code:

solvers
{
    p GAMG
    {
        tolerance        1e-10;
        relTol          0;

        smoother        DIC; //GaussSeidel;
        nPreSweeps      0;
        nPostSweeps      2;
        nFinestSweeps    2;

        cacheAgglomeration true;
        nCellsInCoarsestLevel 10;
        agglomerator    faceAreaPair;
        mergeLevels      1;
    };
    Ua PBiCG
    {
        preconditioner  DILU;
        tolerance        1e-05;
        relTol          0.5;
    };
    Ub PBiCG
    {
        preconditioner  DILU;
        tolerance        1e-05;
        relTol          0;
    };
    alpha PBiCG
    {
        preconditioner  DILU;
        tolerance        1e-10;
        relTol          0;
    };
    beta PBiCG
    {
        preconditioner  DILU;
        tolerance        1e-10;
        relTol          0;
    };

    Ha PBiCG
    {
        preconditioner  DILU;
        tolerance        1e-5;
        relTol          0;
    };
    Hb PBiCG
    {
        preconditioner  DILU;
        tolerance        1e-5;
        relTol          0;
    };
    DS PBiCG
    {
        preconditioner  DILU;
        tolerance        1e-5;
        relTol          0;
    };
    Theta PBiCG
    {
        preconditioner  DILU;
        tolerance        1e-05;
        relTol          0;
    };
    k PBiCG
    {
        preconditioner  DILU;
        tolerance        1e-05;
        relTol          0;
    };
    epsilon PBiCG
    {
        preconditioner  DILU;
        tolerance        1e-05;
        relTol          0;
    };
}

PISO
{
    nCorrectors    2;
    nNonOrthogonalCorrectors 0;
    nAlphaCorr      2;
    correctAlpha    no;
    pRefCell        0;
    pRefValue      0.0;
}

relaxationFactors
{
    alpha          0.3;
    DS              0.3;
    p              0.3;
    Ua              0.3;
    Ub              0.3;
    Ha              0.3;
    Hb              0.3;
}

However, my simulation crashed during the first time step and i get this error message:

Code:

GAMG:  Solving for p, Initial residual = 1, Final residual = 5.7155e-11, No Iterations 93


--> FOAM FATAL ERROR:
previous iteration field
IOobject: volScalarField p "/home/michta/OpenFOAM/michta-1.7.x/run/EulerEulerBoilingFoam/EulerEulerBoilingFoam/referenceCase/0"

  not stored.  Use field.storePrevIter() at start of iteration.

    From function GeometricField<Type, PatchField, GeoMesh>::prevIter() const
    in file /home/michta/OpenFOAM/OpenFOAM-1.7.x/src/OpenFOAM/lnInclude/GeometricField.C at line 863.

FOAM aborting

Could someone explain me what is happening? I checked the OF User Guide but did not find any answer..

Thanks in advance!
Best,

/Edy


Anne Lincke August 8, 2013 03:01

You have to insert

HTML Code:

p.storePrevIter();
I found this is missing in a bug report.
So try to insert it before

HTML Code:

#include "pEqn.H"


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