mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: Updated solution algorithm classes
This commit is contained in:
@ -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,9 +122,13 @@ Foam::pimpleControl::pimpleControl(fvMesh& mesh)
|
||||
{
|
||||
read();
|
||||
|
||||
if (residualControl_.size() > 0)
|
||||
if (nOuterCorr_ > 1)
|
||||
{
|
||||
Info<< dictName_ << ": max iterations = " << nOuterCorr_ << endl;
|
||||
Info<< nl;
|
||||
if (!residualControl_.empty())
|
||||
{
|
||||
Info<< algorithmName_ << ": max iterations = " << nOuterCorr_
|
||||
<< endl;
|
||||
forAll(residualControl_, i)
|
||||
{
|
||||
Info<< " field " << residualControl_[i].name << token::TAB
|
||||
@ -136,9 +140,15 @@ Foam::pimpleControl::pimpleControl(fvMesh& mesh)
|
||||
}
|
||||
else
|
||||
{
|
||||
Info<< "No " << dictName_ << " residual control data found. "
|
||||
<< "Calculations will employ a fixed number of corrector loops"
|
||||
<< nl << endl;
|
||||
Info<< algorithmName_ << ": no residual control data found. " << nl
|
||||
<< "Calculations will employ " << nOuterCorr_
|
||||
<< " corrector loops" << nl << endl;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Info<< nl << algorithmName_ << ": Operating solver in PISO mode" << nl
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -102,6 +102,9 @@ public:
|
||||
|
||||
// Access
|
||||
|
||||
//- Current corrector index
|
||||
inline label corr() const;
|
||||
|
||||
//- Maximum number of PIMPLE correctors
|
||||
inline label nOuterCorr() const;
|
||||
|
||||
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -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();
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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
|
||||
|
||||
@ -27,7 +27,7 @@ License
|
||||
|
||||
inline const Foam::dictionary& Foam::solutionControl::dict() const
|
||||
{
|
||||
return mesh_.solutionDict().subDict(dictName_);
|
||||
return mesh_.solutionDict().subDict(algorithmName_);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user