CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM

Problem regarding solution under-relaxation

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 20, 2010, 12:49
Default Problem regarding solution under-relaxation
  #1
Edy
Member
 
Join Date: Sep 2010
Posts: 35
Rep Power: 16
Edy is on a distinguished road
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
Edy is offline   Reply With Quote

Old   October 20, 2010, 14:18
Default
  #2
Senior Member
 
Ben K
Join Date: Feb 2010
Location: Ottawa, Canada
Posts: 140
Rep Power: 19
benk is on a distinguished road
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.
benk is offline   Reply With Quote

Old   October 20, 2010, 14:22
Default
  #3
Edy
Member
 
Join Date: Sep 2010
Posts: 35
Rep Power: 16
Edy is on a distinguished road
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 is offline   Reply With Quote

Old   October 20, 2010, 14:24
Default
  #4
Edy
Member
 
Join Date: Sep 2010
Posts: 35
Rep Power: 16
Edy is on a distinguished road
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...
Edy is offline   Reply With Quote

Old   October 21, 2010, 09:59
Default
  #5
Senior Member
 
Ben K
Join Date: Feb 2010
Location: Ottawa, Canada
Posts: 140
Rep Power: 19
benk is on a distinguished road
Hmm...you're right...I'm not sure what the problem is. Maybe try underrelaxing the other way to see if that works?
benk is offline   Reply With Quote

Old   October 21, 2010, 10:15
Default
  #6
Edy
Member
 
Join Date: Sep 2010
Posts: 35
Rep Power: 16
Edy is on a distinguished road
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
Edy is offline   Reply With Quote

Old   March 21, 2013, 13:38
Question
  #7
Senior Member
 
Join Date: Nov 2012
Posts: 171
Rep Power: 14
hz283 is on a distinguished road
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 View Post
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
hz283 is offline   Reply With Quote

Old   August 8, 2013, 04:01
Default
  #8
Senior Member
 
Anne Gerdes
Join Date: Aug 2010
Location: Hamburg
Posts: 168
Rep Power: 16
Anne Lincke is on a distinguished road
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"
Anne Lincke is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
smoothSolver diverges - solution in using PBiCG solver? makaveli_lcf OpenFOAM Running, Solving & CFD 3 September 11, 2013 13:44
Fluent VOF Volume of Fluid Realistic Solution Problem wormik FLUENT 3 June 21, 2009 08:04
Discretization problem in Solution controls Tamm FLUENT 0 July 15, 2005 08:07
Periodic flow boundary condition problem sudha FLUENT 3 April 28, 2004 09:40
Symmetric problem - Asymmetric prediction Mark Main CFD Forum 14 January 29, 2001 14:21


All times are GMT -4. The time now is 21:34.