mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
136 lines
3.1 KiB
C
136 lines
3.1 KiB
C
/*---------------------------------------------------------------------------*\
|
|
========= |
|
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
\\ / O peration |
|
|
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
|
\\/ M anipulation |
|
|
-------------------------------------------------------------------------------
|
|
License
|
|
This file is part of OpenFOAM.
|
|
|
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
|
under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
(at your option) any later version.
|
|
|
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
\*---------------------------------------------------------------------------*/
|
|
|
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
|
|
|
inline Foam::label Foam::pimpleControl::corr() const
|
|
{
|
|
return corr_;
|
|
}
|
|
|
|
|
|
inline Foam::label Foam::pimpleControl::nOuterCorr() const
|
|
{
|
|
return nOuterCorr_;
|
|
}
|
|
|
|
|
|
inline Foam::label Foam::pimpleControl::nCorr() const
|
|
{
|
|
return nCorr_;
|
|
}
|
|
|
|
|
|
inline bool Foam::pimpleControl::start()
|
|
{
|
|
corr_ = 0;
|
|
|
|
return true;
|
|
}
|
|
|
|
|
|
inline bool Foam::pimpleControl::loop()
|
|
{
|
|
read();
|
|
|
|
if (criteriaSatisfied())
|
|
{
|
|
Info<< algorithmName_ << ": converged in " << corr_ << " iterations"
|
|
<< endl;
|
|
return false;
|
|
}
|
|
else
|
|
{
|
|
if (finalIter())
|
|
{
|
|
mesh_.data::add("finalIteration", true);
|
|
}
|
|
|
|
if (corr_ < nOuterCorr_)
|
|
{
|
|
if (nOuterCorr_ != 1)
|
|
{
|
|
Info<< algorithmName_ << ": iteration " << corr_ + 1 << endl;
|
|
}
|
|
|
|
if (corr_ != 0)
|
|
{
|
|
storePrevIterFields();
|
|
}
|
|
|
|
return true;
|
|
}
|
|
else
|
|
{
|
|
if ((!residualControl_.empty()) && (nOuterCorr_ != 1))
|
|
{
|
|
Info<< algorithmName_ << ": not converged within "
|
|
<< nOuterCorr_ << " iterations" << endl;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
inline bool Foam::pimpleControl::finalIter() const
|
|
{
|
|
return corr_ == nOuterCorr_-1;
|
|
}
|
|
|
|
|
|
inline bool Foam::pimpleControl::finalInnerIter
|
|
(
|
|
const label corr,
|
|
const label nonOrth
|
|
) const
|
|
{
|
|
return
|
|
corr_ == nOuterCorr_-1
|
|
&& corr == nCorr_-1
|
|
&& nonOrth == nNonOrthCorr_;
|
|
}
|
|
|
|
|
|
inline bool Foam::pimpleControl::turbCorr() const
|
|
{
|
|
return !turbOnFinalIterOnly_ || finalIter();
|
|
}
|
|
|
|
|
|
inline void Foam::pimpleControl::operator++(int)
|
|
{
|
|
if (finalIter())
|
|
{
|
|
mesh_.data::remove("finalIteration");
|
|
}
|
|
|
|
corr_++;
|
|
}
|
|
|
|
|
|
// ************************************************************************* //
|