CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (https://www.cfd-online.com/Forums/openfoam-solving/)
-   -   Solution control in pimpleFoam (https://www.cfd-online.com/Forums/openfoam-solving/218595-solution-control-pimplefoam.html)

sita June 26, 2019 06:09

Solution control in pimpleFoam
 
Hi everyone,

I've a few questions about the pimpleFoam solver (using OpenFOAM-dev, build dev-68e9c8eac2bf, on a Scientific Linux cluster). I couldn't find the answers on the OpenFOAM-Wiki (https://openfoamwiki.net/index.php/O...hm_in_OpenFOAM) or in the book by Tobias Holzmann (Mathematics, Numerics, Derivations and OpenFOAM), so I was hoping someone on this forum would be able to help me out.

1. Looking at pimpleControl.H and pimpleControl.C, it looks like pimpleFoam can run in steady-state, transient, or mixed steady-state/transient mode. Is that correct? And if so, how do I control which mode to use?

2. After running the DTCHullMoving tutorial, the log file says "PIMPLE: No convergence criteria found", which is what I expected, as none are set in this tutorial, but it also says "PIMPLE: No corrector convergence criteria found. Calculations will do 2 corrections". So, what's the difference between these? And how should I set these corrector convergence criteria, is there something similar to residualControl for that?

Thanks in advance for your help,
Sita

clapointe June 30, 2019 15:26

Quick answers -- as you know, the PIMPLE algorithm as coded in foam uses outer (SIMPLE-like) and inner (PISO) iterations. The outer iterations are controlled by the PIMPLE residual control, and the inner correctors are presumably controlled by the corrector convergence criteria -- although I've never used this before. Not sure why one would not use SIMPLE to obtain a steady solution, but transient calculations can employ multiple outer iterations to obtain a quasi-steady solution for a given time step and there are a variety of reasons you may or may not want to do this. Taking a look at Tobi's write up (there are a variety of ways to find it, but here's a link Mathematics, numerics, derivations and OpenFOAMŪ)would be a good place to start seeing how using outer/inner correctors and residual control can impact a solution.

Caelan

sita July 1, 2019 02:09

Hi Caelan,

Thanks for your reply. As I wrote, I couldn't find the answers to my questions in the book of Tobi (or in any of the other resources I mentioned), but perhaps I should look again.

Cheers,
Sita

clapointe July 1, 2019 07:25

Sorry, I linked the wrong verion -- his newer ones include a section on the PIMPLE algorithm that should be helpful. Here's the link mathematics, numerics, derivations and openfoam - ResearchGate https://www.researchgate.net/...Holz...rivations-and-....

Caelan

sita July 1, 2019 14:28

Thanks, but that's actually the one I checked. As far as I could find, it does explain about the outer and inner correction loops, but not how to set residual control for each of those separately. Also, the text seems to be slightly outdated: the correct syntax for setting residual control has changed by now (see also this post: https://www.cfd-online.com/Forums/op...kin-6-0-a.html).

Does anyone know about a more up-to-date and comprehensive pimpleFoam manual?

clapointe July 1, 2019 15:22

Ah good. The same principles outlined in the PIMPLE section should still apply, even if the syntax as changed. It has been a while since I've looked at in detail, but from memory the (possibly qualitative) solution is shown to depend on the number of outer/inner pimple loops. If you're looking for a hard and fast rule on how to set the number of outer/inner correctors, I doubt you'll find one -- it is very likely problem (and resource) dependent. But using the controls to exit an outer -- or inner -- loop should in principle allow the simulation to decide for you when to exit based on the solution residuals. There are various threads around on the topic, but I vaguely recall seeing 1e-4 as a good value to start with -- at least for the outer loop and using just a few inner correctors should also be fine.

Caelan

sita July 2, 2019 02:12

Hi Caelan,

Thanks for that. Sorry, I'm afraid my question wasn't clear. I do get the idea of the outer and inner loops, it's just that I'd like to know how/where to set the corrector convergence criteria. If you add a sub-dictionary residualControl to the PIMPLE dictionary in fvSolution, this will set the convergence criteria (nCorrectors), but it won't set the corrector convergence criteria (nOuterCorrections). Does somebody know how and where to set these?

Thanks,
Sita

clapointe July 2, 2019 07:13

Oh, now I understand -- sorry for the confusion. Try searching the tutorials for "outerCorrectorResidualControl". You'll likely end up here : https://github.com/OpenFOAM/OpenFOAM...tem/fvSolution. And the relevant bit is below :

Code:

    outerCorrectorResidualControl
    {
        "(U|k|epsilon)"
        {
            relTol          0;
            tolerance      0.0001;
        }
    }

Caelan

sita July 2, 2019 08:45

Awesome, thanks a million!


P.S. Cool, it works now: the log file says PIMPLE detected both the convergence criteria and the corrector convergence criteria. It's still operating in transient mode though (I figured it might say mixed steady-state/transient now). Does anyone know what the steady, transient, mixed steady-state/transient options in pimpleControl.C mean, and how to access these?

Anuraag March 14, 2021 08:52

Here's how you set the residual control for both: nCorrectors and nOuterCorrectors-, as well as the relaxation factors. This is according to OF2006 v6.
Cheers!

PIMPLE
{
nNonOrthogonalCorrectors 1;
nCorrectors 3;
nOuterCorrectors 50;
pRefCell 0;
pRefValue 0;

residualControl
{
p 1e-06;
U 1e-06;
}

outerCorrectorResidualControl
{
p
{
tolerance 1e-06;
relTol 0;
}

U
{
tolerance 1e-06;
relTol 0;
}

}

}
relaxationFactors
{
fields
{
p 0.95;
pFinal 1;
}
equations
{
U 0.9;
UFinal 1;
}
}

Tobermory March 15, 2021 12:05

Quote:

Originally Posted by sita (Post 737791)
Does anyone know what the steady, transient, mixed steady-state/transient options in pimpleControl.C mean, and how to access these?

The pimple solvers are inherently transient solvers. You can run them in true transient mode with ddtSchemes such as Euler, or in a special pseudo-transient mode using "local time stepping" or LTS. LTS is used for time-stepping towards a steady solution, where you don't care about solution accuracy en route to the steady state; can be useful for buoyancy dominated flows, for example. Control the choice of either via the ddtScheme entry in fvSchemes (eg Euler or localEuler).

You can select steadyState as your ddtScheme in the pimple solver, in which case all of the ddt terms will be zeroed out. Be careful with this, however, since these ddt terms provide stability and your simulation may diverge rapidly; you'll need to apply relaxation factors, like in the SIMPLE steady state solver.

If you do try and use the steadyState solver, then maybe you are better off just running the simpleFoam variant of the solver (if it exists), since that will be more efficient. Otherwise consider carefully the number of outer iterations (pimple iterations) and pressure correctors that you use, and remember that simpleFoam only uses 1 of each.

I am not aware of any "mixed steady-state/transient" option - that seems a contradiction! Perhaps you were referring to the LTS scheme?

Good luck.

sita March 15, 2021 12:28

Thanks for this comprehensive explanation, that seems to make sense.

These steady-state, transient, and mixed steady-state/transient modes are something I came across in pimpleControl.C:

Code:

  52        Info<< nl << algorithmName << ": Operating solver in "
  53        << (mesh.steady() ? "steady-state" : mesh.transient() ? "transient" :
  54            "mixed steady-state/transient") << " mode with " << nCorrPimple_
  55        << " outer corrector" << (nCorrPimple_ == 1 ? "" : "s") << nl;

No clue what that would mean, it just made me curious.

Cheers,
Sita

Tobermory March 15, 2021 12:36

And that made me curious! If you open up pimpleControl.H in Doxygen (https://cpp.openfoam.org/v8/pimpleCo...8C_source.html), and then hover your mouse over say the hyperlink on mesh.steady(), you'll see a pop-up say that this is defined in fvSchemes.H (https://cpp.openfoam.org/v8/fvScheme...ce.html#l00140). So let's take a look at fvSchemes.H:

Code:

            //- Return true if the default ddtScheme is steadyState
            bool steady() const
            {
                return steady_;
            }
 
            //- Return true if the default ddtScheme is not steadyState
            bool transient() const
            {
                return !steady_;
            }

in other words, one of mesh.steady() or mesh.transient() must be true. This means that the "mixed steady-state/transient" condition can never occur, and is a dinosaur fragment of code!

sita March 15, 2021 13:13

Neat! Never realised that Doxygen had this hyperlink functionality, looks like I'm a bit of a dinosaur too... Thanks for the tip!

Tobermory March 15, 2021 15:07

That's the beauty of this forum - I am always discovering new things and new tricks. ;)


All times are GMT -4. The time now is 14:54.