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

Outer Correctors Residual Control for PIMPLE algorithm

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree4Likes
  • 4 Post By clapointe

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 15, 2018, 03:17
Default Outer Correctors Residual Control for PIMPLE algorithm
  #1
New Member
 
Ed Barry
Join Date: May 2018
Posts: 4
Rep Power: 8
ed_bar is on a distinguished road
Hi All,
I have tried specifying in my fvSolution a subdict in PIMPLE controls called
Code:
nOuterCorrectorsResidualControl
As per lines 71-80 of
OpenFOAM-dev/src/finiteVolume/cfdTools/general/solutionControl/convergenceControl/singleRegionConvergenceControl/singleRegionConvergenceControl.C



Code:
        if (iter().isDict())
{
    FatalErrorInFunction  << "Solution convergence criteria specified in " 

    << control_.algorithmName() << '.' << residualDict.dictName() 

    << " must be given as single values. Corrector loop "
    << "convergence criteria, if appropriate, are specified as "

    << "dictionaries in " << control_.algorithmName()

    << ".<loopName>ResidualControl." << exit(FatalError); 

 }
I specify what I think this is asking for, yet when it comes to run time, it says that no corrector convergence criteria was found and the calculations will do n iterations. I have uploaded the case with the changed PIMPLE dictionary in system/fvSolution.


Any help would be appreciated.



Ed
Attached Files
File Type: gz planarCouette.tar.gz (12.0 KB, 14 views)

Last edited by ed_bar; May 15, 2018 at 19:26.
ed_bar is offline   Reply With Quote

Old   June 4, 2018, 15:42
Default
  #2
Senior Member
 
Join Date: Aug 2015
Posts: 494
Rep Power: 15
clapointe is on a distinguished road
You've almost got it -- try using outerCorrectorResidualControl for the name of the dict, as in this tutorial : https://github.com/OpenFOAM/OpenFOAM...tem/fvSolution.

Caelan
mechy, sinvastil, mnikku and 1 others like this.
clapointe is offline   Reply With Quote

Old   February 27, 2019, 04:26
Default
  #3
Member
 
Dongxu Wang
Join Date: Sep 2018
Location: China
Posts: 33
Rep Power: 8
wdx_cfd is on a distinguished road
Quote:
Originally Posted by clapointe View Post
You've almost got it -- try using outerCorrectorResidualControl for the name of the dict, as in this tutorial : https://github.com/OpenFOAM/OpenFOAM...tem/fvSolution.

Caelan
Hi Caelan,

I am reading PIMPLE algorithm recently and I have some questions.

Firstly, I find that if we use the PIMPLE algorithm in OpenFOAM v6, the class which controls the residuals of outer loop will only be the "singleRegionCorrectorConvergenceControl". In other words, the subDict with the name of "outerCorrectorResidualControl" in "fvSolution.PIMPLE" is valid rather that the "residualControl" in the previous version. The "residualControl" will only be valid if we use SIMPLE algorithm. Am I right?

Secondly, I cannot understand how the words defined in the subDict work. For example, in the judgement function named "convergence.corrCriteriaSatisfied()":

Code:
bool Foam::singleRegionCorrectorConvergenceControl::
corrCriteriaSatisfied() const
{
    if (!hasCorrResidualControls())
    {
        return false;
    }

    bool achieved = true;
    bool checked = false; // ensure that some checks were actually performed

    if (control_.debug)
    {
        Info<< control_.algorithmName() << ": Correction residuals" << endl;
    }

    // Here I don't understand. What is this "mesh_.solverPerformanceDict()"?
    const dictionary& solverDict = mesh_.solverPerformanceDict();
	
    forAllConstIter(dictionary, solverDict, iter)
    {
        const word& variableName = iter().keyword();

        const label fieldi =
            convergenceControl::residualControlIndex
            (
                variableName,
                corrResidualControl_
            );
        if (fieldi != -1)
        {
            scalar firstResidual, residual;
            convergenceControl::getInitialResiduals
            (
                mesh_,
                variableName,
                corrResidualControl_[fieldi].solveIndex,
                iter().stream(),
                firstResidual,
                residual
            );

            const scalar relativeResidual =
                residual/(firstResidual + ROOTVSMALL);

            const bool absCheck =
                residual < corrResidualControl_[fieldi].absTol;
            const bool relCheck =
                relativeResidual < corrResidualControl_[fieldi].relTol;

            checked = true;
            achieved = achieved && (absCheck || relCheck);

            if (control_.debug)
            {
                Info<< control_.algorithmSpace() << "  " << variableName
                    << ": tolerance " << residual << " ("
                    << corrResidualControl_[fieldi].absTol << ")"
                    << ", relTol " << relativeResidual << " ("
                    << corrResidualControl_[fieldi].relTol << ")"
                    << (absCheck || relCheck ? " CONVERGED" : "") << endl;
            }
        }
    }

    return checked && achieved;
}
There is a dictionary with the name of "solverDict". I print this object during the run time and I get the information just like this:

Code:
{
    pcorr             ;
    p_rgh            ;
}
There are only two words in this dictionary. In other words, no matter what I put in the sub dictionary, the only valid words are "p_rgh" and "pcorr". Therefore, if we put the subDict like this:

Code:
PIMPLE
{
    // other words
       ...

    // subDict in OF v6 for residual control
    outerCorrectorResidualControl
   {
        p_rgh   // valid 
       {
            tolerance    1e-8;
            relTol          1e-6;
       }
       U          // invalid
       {
            tolerance    1e-8;
            relTol          1e-6;
       }
   }
}
U will be invalid at the moment of residual judgement. This makes me confused and I don't know if there is something wrong in my understanding.

Any suggestion will be appreciated.

Thank you very much!

wdx
wdx_cfd is offline   Reply With Quote

Old   February 27, 2019, 12:07
Default
  #4
Senior Member
 
Join Date: Aug 2015
Posts: 494
Rep Power: 15
clapointe is on a distinguished road
Not too much time to go into this, but lets see...

You are right about outerCorrector... vs residualControl -- at least from memory. I hardly use any of the SIMPLE algorithms, but this sounds right.

As for the dictionary question, it looks like a series of dictionaries are stored (as a list? someone can be more technically correct here, I'm sure) in solverDict, which we then loop through. I am not sure what you are printing (or from where), so I cannot answer that question. However, if you check out the tutorial I linked to previously you'll see that a series of fields are checked -- take a look at the tutorial to see how.

Caelan
clapointe is offline   Reply With Quote

Old   February 27, 2019, 21:58
Default
  #5
Member
 
Dongxu Wang
Join Date: Sep 2018
Location: China
Posts: 33
Rep Power: 8
wdx_cfd is on a distinguished road
Quote:
Originally Posted by clapointe View Post
Not too much time to go into this, but lets see...

You are right about outerCorrector... vs residualControl -- at least from memory. I hardly use any of the SIMPLE algorithms, but this sounds right.

As for the dictionary question, it looks like a series of dictionaries are stored (as a list? someone can be more technically correct here, I'm sure) in solverDict, which we then loop through. I am not sure what you are printing (or from where), so I cannot answer that question. However, if you check out the tutorial I linked to previously you'll see that a series of fields are checked -- take a look at the tutorial to see how.

Caelan
Hi Caelan,

Thank you for your reply! According to your advice, I think I have totally understood how this function works. I will try my best to depict it clearly and I hope one day it maybe useful for someone else.

Firstly, my print function is added as:

Code:
//  ...
    forAllConstIter(dictionary, solverDict, iter)
    {
        const word& variableName = iter().keyword();

	// newly added to print the solverDict 
        Info << "solverDict  = " << solverDict << endl;   

        const label fieldi =
            convergenceControl::residualControlIndex
            (
                variableName,
                corrResidualControl_
            );
//  ...
In my previous understanding, the solverDict should be a list which consists of subDicts read from fvSolution. However, I find that the content in solverDict may be constant for a specific solver. And the the subDicts read from the PIMPLE dict will try to match these content for residual judgement. In the function I list above, the word "variableName" stands for the constant content and the lable "fieldi" represents if the subDict read from fvSolution matches the content (0 means yes, -1 means no).

When using interFOAM, the solverDict is read as:
Code:
solverDict  = 
{
    pcorr           1 ( ( GAMGPCG pcorr 1 1.12278473072e-09 9 1 ( 0 ) ) );
    p_rgh           2 ( ( GAMG p_rgh 1 0.00354306144809 1 1 ( 0 ) ) ( GAMGPCG p_rgh 0.0151588085227 2.81533804904e-09 5 1 ( 0 ) ) );
}
In your case mentioned above, the solverDict is read as:
Code:
solverDict  = 
{
    U               1 ( ( smoothSolver U ( 1 1 1 ) ( 0.076108 0.0914346 0.059271 ) ( 5 4 5 ) 0 3 { 0 } ) );
    e               1 ( ( smoothSolver e 1 0.0730702 2 1 ( 0 ) ) );
    p               1 ( ( DICPCG p 1 9.44311e-08 115 1 ( 0 ) ) );
    rho             1 ( ( diagonal rho 0 0 0 1 ( 0 ) ) );
    epsilon         1 ( ( smoothSolver epsilon 0.983447 0.0191881 2 1 ( 0 ) ) );
    k               1 ( ( smoothSolver k 1 0.00447597 1 1 ( 0 ) ) );
}
In other words, for my case only p_rgh and pcorr are valid. Other variables, if presented, should have a -1 fieldi value, which means they are not used for residual judgement.

wdx
wdx_cfd is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
Problem with chtMultiregionFoam radiation boundary condition baran_foam OpenFOAM Running, Solving & CFD 10 December 17, 2019 18:36
Suppress twoPhaseEulerFoam energy AlmostSurelyRob OpenFOAM Running, Solving & CFD 33 September 25, 2018 18:45
Compressor Simulation using rhoPimpleDyMFoam Jetfire OpenFOAM Running, Solving & CFD 107 December 9, 2014 14:38
Unstabil Simulation with chtMultiRegionFoam mbay101 OpenFOAM Running, Solving & CFD 13 December 28, 2013 14:12
calculation stops after few time steps sivakumar OpenFOAM Running, Solving & CFD 7 March 17, 2013 07:37


All times are GMT -4. The time now is 02:05.