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)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< dictName_ << "loop statistics:" << endl;
|
Info<< algorithmName_ << "loop statistics:" << endl;
|
||||||
|
|
||||||
Info<< " " << variableName << " iter " << corr_
|
Info<< " " << variableName << " iter " << corr_
|
||||||
<< ": ini res = "
|
<< ": ini res = "
|
||||||
@ -122,23 +122,33 @@ Foam::pimpleControl::pimpleControl(fvMesh& mesh)
|
|||||||
{
|
{
|
||||||
read();
|
read();
|
||||||
|
|
||||||
if (residualControl_.size() > 0)
|
if (nOuterCorr_ > 1)
|
||||||
{
|
{
|
||||||
Info<< dictName_ << ": max iterations = " << nOuterCorr_ << endl;
|
Info<< nl;
|
||||||
forAll(residualControl_, i)
|
if (!residualControl_.empty())
|
||||||
{
|
{
|
||||||
Info<< " field " << residualControl_[i].name << token::TAB
|
Info<< algorithmName_ << ": max iterations = " << nOuterCorr_
|
||||||
<< ": relTol " << residualControl_[i].relTol
|
<< endl;
|
||||||
<< ", absTol " << residualControl_[i].absTol
|
forAll(residualControl_, i)
|
||||||
<< nl;
|
{
|
||||||
|
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
|
else
|
||||||
{
|
{
|
||||||
Info<< "No " << dictName_ << " residual control data found. "
|
Info<< nl << algorithmName_ << ": Operating solver in PISO mode" << nl
|
||||||
<< "Calculations will employ a fixed number of corrector loops"
|
<< endl;
|
||||||
<< nl << endl;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -102,6 +102,9 @@ public:
|
|||||||
|
|
||||||
// Access
|
// Access
|
||||||
|
|
||||||
|
//- Current corrector index
|
||||||
|
inline label corr() const;
|
||||||
|
|
||||||
//- Maximum number of PIMPLE correctors
|
//- Maximum number of PIMPLE correctors
|
||||||
inline label nOuterCorr() const;
|
inline label nOuterCorr() const;
|
||||||
|
|
||||||
|
|||||||
@ -25,6 +25,12 @@ License
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
inline Foam::label Foam::pimpleControl::corr() const
|
||||||
|
{
|
||||||
|
return corr_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
inline Foam::label Foam::pimpleControl::nOuterCorr() const
|
inline Foam::label Foam::pimpleControl::nOuterCorr() const
|
||||||
{
|
{
|
||||||
return nOuterCorr_;
|
return nOuterCorr_;
|
||||||
@ -51,7 +57,7 @@ inline bool Foam::pimpleControl::loop()
|
|||||||
|
|
||||||
if (criteriaSatisfied())
|
if (criteriaSatisfied())
|
||||||
{
|
{
|
||||||
Info<< dictName_ << "loop converged in " << corr_ << " iterations"
|
Info<< algorithmName_ << ": converged in " << corr_ << " iterations"
|
||||||
<< endl;
|
<< endl;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -64,13 +70,21 @@ inline bool Foam::pimpleControl::loop()
|
|||||||
|
|
||||||
if (corr_ < nOuterCorr_)
|
if (corr_ < nOuterCorr_)
|
||||||
{
|
{
|
||||||
Info<< dictName_ << " iteration " << corr_ + 1 << endl;
|
if (nOuterCorr_ != 1)
|
||||||
|
{
|
||||||
|
Info<< algorithmName_ << ": iteration " << corr_ + 1 << endl;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Info<< dictName_ << " loop not converged within " << nOuterCorr_
|
if ((!residualControl_.empty()) && (nOuterCorr_ != 1))
|
||||||
<< " iterations" << endl;
|
{
|
||||||
|
Info<< algorithmName_ << ": not converged within "
|
||||||
|
<< nOuterCorr_ << " iterations" << endl;
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -66,7 +66,7 @@ bool Foam::simpleControl::criteriaSatisfied()
|
|||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< dictName_ << " solution statistics:" << endl;
|
Info<< algorithmName_ << " solution statistics:" << endl;
|
||||||
|
|
||||||
Info<< " " << variableName << ": abs tol = " << residual
|
Info<< " " << variableName << ": abs tol = " << residual
|
||||||
<< " (" << residualControl_[fieldI].absTol << ")"
|
<< " (" << residualControl_[fieldI].absTol << ")"
|
||||||
@ -88,9 +88,11 @@ Foam::simpleControl::simpleControl(fvMesh& mesh)
|
|||||||
{
|
{
|
||||||
read();
|
read();
|
||||||
|
|
||||||
|
Info<< nl;
|
||||||
|
|
||||||
if (residualControl_.size() > 0)
|
if (residualControl_.size() > 0)
|
||||||
{
|
{
|
||||||
Info<< dictName_ << " convergence criteria" << endl;
|
Info<< algorithmName_ << ": convergence criteria" << nl;
|
||||||
forAll(residualControl_, i)
|
forAll(residualControl_, i)
|
||||||
{
|
{
|
||||||
Info<< " field " << residualControl_[i].name << token::TAB
|
Info<< " field " << residualControl_[i].name << token::TAB
|
||||||
@ -101,7 +103,7 @@ Foam::simpleControl::simpleControl(fvMesh& mesh)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Info<< "No " << dictName_ << " convergence criteria found. "
|
Info<< algorithmName_ << ": no convergence criteria found. "
|
||||||
<< "Calculations will run for " << mesh_.time().endTime().value()
|
<< "Calculations will run for " << mesh_.time().endTime().value()
|
||||||
<< " steps." << nl << endl;
|
<< " steps." << nl << endl;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -37,8 +37,8 @@ inline bool Foam::simpleControl::loop()
|
|||||||
{
|
{
|
||||||
if (criteriaSatisfied())
|
if (criteriaSatisfied())
|
||||||
{
|
{
|
||||||
Info<< dictName_ << " solution converged in " << time.timeName()
|
Info<< nl << algorithmName_ << " solution converged in "
|
||||||
<< " iterations" << nl << endl;
|
<< time.timeName() << " iterations" << nl << endl;
|
||||||
|
|
||||||
// Set to finalise calculation
|
// Set to finalise calculation
|
||||||
time.writeAndEnd();
|
time.writeAndEnd();
|
||||||
|
|||||||
@ -104,11 +104,11 @@ Foam::label Foam::solutionControl::applyToField(const word& fieldName) const
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::solutionControl::solutionControl(fvMesh& mesh, const word& dictName)
|
Foam::solutionControl::solutionControl(fvMesh& mesh, const word& algorithmName)
|
||||||
:
|
:
|
||||||
mesh_(mesh),
|
mesh_(mesh),
|
||||||
residualControl_(),
|
residualControl_(),
|
||||||
dictName_(dictName),
|
algorithmName_(algorithmName),
|
||||||
nNonOrthCorr_(0),
|
nNonOrthCorr_(0),
|
||||||
momentumPredictor_(true),
|
momentumPredictor_(true),
|
||||||
transonic_(false)
|
transonic_(false)
|
||||||
|
|||||||
@ -67,7 +67,7 @@ protected:
|
|||||||
List<fieldData> residualControl_;
|
List<fieldData> residualControl_;
|
||||||
|
|
||||||
//- The dictionary name, e.g. SIMPLE, PIMPLE
|
//- The dictionary name, e.g. SIMPLE, PIMPLE
|
||||||
const word dictName_;
|
const word algorithmName_;
|
||||||
|
|
||||||
|
|
||||||
// Solution controls
|
// Solution controls
|
||||||
@ -112,7 +112,7 @@ public:
|
|||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct from mesh
|
//- Construct from mesh
|
||||||
solutionControl(fvMesh& mesh, const word& dictName);
|
solutionControl(fvMesh& mesh, const word& algorithmName);
|
||||||
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
|
|||||||
@ -27,7 +27,7 @@ License
|
|||||||
|
|
||||||
inline const Foam::dictionary& Foam::solutionControl::dict() const
|
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