ENH: Added turbCorr flag to pimpleControl

This commit is contained in:
andy
2011-04-18 11:28:31 +01:00
parent 9f35490c24
commit fd5e0cc7c3
3 changed files with 17 additions and 1 deletions

View File

@ -24,6 +24,7 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "pimpleControl.H" #include "pimpleControl.H"
#include "Switch.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -43,6 +44,8 @@ void Foam::pimpleControl::read()
const dictionary& pimpleDict = dict(); const dictionary& pimpleDict = dict();
nOuterCorr_ = pimpleDict.lookupOrDefault<label>("nOuterCorrectors", 1); nOuterCorr_ = pimpleDict.lookupOrDefault<label>("nOuterCorrectors", 1);
nCorr_ = pimpleDict.lookupOrDefault<label>("nCorrectors", 1); nCorr_ = pimpleDict.lookupOrDefault<label>("nCorrectors", 1);
turbOnFinalIterOnly_ =
pimpleDict.lookupOrDefault<Switch>("turbOnFinalIterOnly", true);
} }
@ -118,7 +121,8 @@ Foam::pimpleControl::pimpleControl(fvMesh& mesh)
solutionControl(mesh, "PIMPLE"), solutionControl(mesh, "PIMPLE"),
nOuterCorr_(0), nOuterCorr_(0),
nCorr_(0), nCorr_(0),
corr_(0) corr_(0),
turbOnFinalIterOnly_(true)
{ {
read(); read();

View File

@ -63,6 +63,9 @@ protected:
//- Current PIMPLE corrector //- Current PIMPLE corrector
label corr_; label corr_;
//- Flag to indicate whether to only solve turbulence on final iter
bool turbOnFinalIterOnly_;
// Protected Member Functions // Protected Member Functions
@ -130,6 +133,9 @@ public:
const label nonOrth const label nonOrth
) const; ) const;
//- Helper function to identify whether to solve for turbulence
inline bool turbCorr() const;
// Member Operators // Member Operators

View File

@ -110,6 +110,12 @@ inline bool Foam::pimpleControl::finalInnerIter
} }
inline bool Foam::pimpleControl::turbCorr() const
{
return !turbOnFinalIterOnly_ || finalIter();
}
inline void Foam::pimpleControl::operator++(int) inline void Foam::pimpleControl::operator++(int)
{ {
if (finalIter()) if (finalIter())