Skip to content
Snippets Groups Projects
Commit 94bacb8c authored by andy's avatar andy
Browse files

BUG: Corrected pimpleControl behaviour for final iteration

parent f849409c
Branches
Tags v1806
No related merge requests found
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
...@@ -126,7 +126,8 @@ Foam::pimpleControl::pimpleControl(fvMesh& mesh) ...@@ -126,7 +126,8 @@ Foam::pimpleControl::pimpleControl(fvMesh& mesh)
nCorrPIMPLE_(0), nCorrPIMPLE_(0),
nCorrPISO_(0), nCorrPISO_(0),
corrPISO_(0), corrPISO_(0),
turbOnFinalIterOnly_(true) turbOnFinalIterOnly_(true),
converged_(false)
{ {
read(); read();
...@@ -194,12 +195,27 @@ bool Foam::pimpleControl::loop() ...@@ -194,12 +195,27 @@ bool Foam::pimpleControl::loop()
} }
bool completed = false; bool completed = false;
if (criteriaSatisfied()) if (converged_ || criteriaSatisfied())
{ {
Info<< algorithmName_ << ": converged in " << corr_ - 1 << " iterations" if (converged_)
<< endl; {
completed = true; Info<< algorithmName_ << ": converged in " << corr_ - 1
corr_ = 0; << " iterations" << endl;
mesh_.data::remove("finalIteration");
corr_ = 0;
converged_ = false;
completed = true;
}
else
{
Info<< algorithmName_ << ": iteration " << corr_ << endl;
storePrevIterFields();
mesh_.data::add("finalIteration", true);
converged_ = true;
}
} }
else else
{ {
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
...@@ -66,6 +66,9 @@ protected: ...@@ -66,6 +66,9 @@ protected:
//- Flag to indicate whether to only solve turbulence on final iter //- Flag to indicate whether to only solve turbulence on final iter
bool turbOnFinalIterOnly_; bool turbOnFinalIterOnly_;
//- Converged flag
bool converged_;
// Protected Member Functions // Protected Member Functions
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
...@@ -73,14 +73,14 @@ inline bool Foam::pimpleControl::storeInitialResiduals() const ...@@ -73,14 +73,14 @@ inline bool Foam::pimpleControl::storeInitialResiduals() const
inline bool Foam::pimpleControl::finalIter() const inline bool Foam::pimpleControl::finalIter() const
{ {
return corr_ == nCorrPIMPLE_; return converged_ || (corr_ == nCorrPIMPLE_);
} }
inline bool Foam::pimpleControl::finalInnerIter() const inline bool Foam::pimpleControl::finalInnerIter() const
{ {
return return
corr_ == nCorrPIMPLE_ finalIter()
&& corrPISO_ == nCorrPISO_ && corrPISO_ == nCorrPISO_
&& corrNonOrtho_ == nNonOrthCorr_ + 1; && corrNonOrtho_ == nNonOrthCorr_ + 1;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment