ENH: Updated solution algorithm classes

This commit is contained in:
andy
2011-04-15 16:31:20 +01:00
parent 656bbf5308
commit 9ae8cef32c
8 changed files with 55 additions and 26 deletions

View File

@ -93,7 +93,7 @@ bool Foam::pimpleControl::criteriaSatisfied()
if (debug)
{
Info<< dictName_ << "loop statistics:" << endl;
Info<< algorithmName_ << "loop statistics:" << endl;
Info<< " " << variableName << " iter " << corr_
<< ": ini res = "
@ -122,23 +122,33 @@ Foam::pimpleControl::pimpleControl(fvMesh& mesh)
{
read();
if (residualControl_.size() > 0)
if (nOuterCorr_ > 1)
{
Info<< dictName_ << ": max iterations = " << nOuterCorr_ << endl;
forAll(residualControl_, i)
Info<< nl;
if (!residualControl_.empty())
{
Info<< " field " << residualControl_[i].name << token::TAB
<< ": relTol " << residualControl_[i].relTol
<< ", absTol " << residualControl_[i].absTol
<< nl;
Info<< algorithmName_ << ": max iterations = " << nOuterCorr_
<< endl;
forAll(residualControl_, i)
{
Info<< " field " << residualControl_[i].name << token::TAB
<< ": relTol " << residualControl_[i].relTol
<< ", absTol " << residualControl_[i].absTol
<< nl;
}
Info<< endl;
}
else
{
Info<< algorithmName_ << ": no residual control data found. " << nl
<< "Calculations will employ " << nOuterCorr_
<< " corrector loops" << nl << endl;
}
Info<< endl;
}
else
{
Info<< "No " << dictName_ << " residual control data found. "
<< "Calculations will employ a fixed number of corrector loops"
<< nl << endl;
Info<< nl << algorithmName_ << ": Operating solver in PISO mode" << nl
<< endl;
}
}

View File

@ -102,6 +102,9 @@ public:
// Access
//- Current corrector index
inline label corr() const;
//- Maximum number of PIMPLE correctors
inline label nOuterCorr() const;

View File

@ -25,6 +25,12 @@ License
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
inline Foam::label Foam::pimpleControl::corr() const
{
return corr_;
}
inline Foam::label Foam::pimpleControl::nOuterCorr() const
{
return nOuterCorr_;
@ -51,7 +57,7 @@ inline bool Foam::pimpleControl::loop()
if (criteriaSatisfied())
{
Info<< dictName_ << "loop converged in " << corr_ << " iterations"
Info<< algorithmName_ << ": converged in " << corr_ << " iterations"
<< endl;
return false;
}
@ -64,13 +70,21 @@ inline bool Foam::pimpleControl::loop()
if (corr_ < nOuterCorr_)
{
Info<< dictName_ << " iteration " << corr_ + 1 << endl;
if (nOuterCorr_ != 1)
{
Info<< algorithmName_ << ": iteration " << corr_ + 1 << endl;
}
return true;
}
else
{
Info<< dictName_ << " loop not converged within " << nOuterCorr_
<< " iterations" << endl;
if ((!residualControl_.empty()) && (nOuterCorr_ != 1))
{
Info<< algorithmName_ << ": not converged within "
<< nOuterCorr_ << " iterations" << endl;
}
return false;
}
}

View File

@ -66,7 +66,7 @@ bool Foam::simpleControl::criteriaSatisfied()
if (debug)
{
Info<< dictName_ << " solution statistics:" << endl;
Info<< algorithmName_ << " solution statistics:" << endl;
Info<< " " << variableName << ": abs tol = " << residual
<< " (" << residualControl_[fieldI].absTol << ")"
@ -88,9 +88,11 @@ Foam::simpleControl::simpleControl(fvMesh& mesh)
{
read();
Info<< nl;
if (residualControl_.size() > 0)
{
Info<< dictName_ << " convergence criteria" << endl;
Info<< algorithmName_ << ": convergence criteria" << nl;
forAll(residualControl_, i)
{
Info<< " field " << residualControl_[i].name << token::TAB
@ -101,7 +103,7 @@ Foam::simpleControl::simpleControl(fvMesh& mesh)
}
else
{
Info<< "No " << dictName_ << " convergence criteria found. "
Info<< algorithmName_ << ": no convergence criteria found. "
<< "Calculations will run for " << mesh_.time().endTime().value()
<< " steps." << nl << endl;
}

View File

@ -37,8 +37,8 @@ inline bool Foam::simpleControl::loop()
{
if (criteriaSatisfied())
{
Info<< dictName_ << " solution converged in " << time.timeName()
<< " iterations" << nl << endl;
Info<< nl << algorithmName_ << " solution converged in "
<< time.timeName() << " iterations" << nl << endl;
// Set to finalise calculation
time.writeAndEnd();

View File

@ -104,11 +104,11 @@ Foam::label Foam::solutionControl::applyToField(const word& fieldName) const
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::solutionControl::solutionControl(fvMesh& mesh, const word& dictName)
Foam::solutionControl::solutionControl(fvMesh& mesh, const word& algorithmName)
:
mesh_(mesh),
residualControl_(),
dictName_(dictName),
algorithmName_(algorithmName),
nNonOrthCorr_(0),
momentumPredictor_(true),
transonic_(false)

View File

@ -67,7 +67,7 @@ protected:
List<fieldData> residualControl_;
//- The dictionary name, e.g. SIMPLE, PIMPLE
const word dictName_;
const word algorithmName_;
// Solution controls
@ -112,7 +112,7 @@ public:
// Constructors
//- Construct from mesh
solutionControl(fvMesh& mesh, const word& dictName);
solutionControl(fvMesh& mesh, const word& algorithmName);
//- Destructor

View File

@ -27,7 +27,7 @@ License
inline const Foam::dictionary& Foam::solutionControl::dict() const
{
return mesh_.solutionDict().subDict(dictName_);
return mesh_.solutionDict().subDict(algorithmName_);
}