BUG: solutionControl solver objects can return false positives in residualControl

Reported by Mark Olesen
This commit is contained in:
andy
2011-09-27 15:37:15 +01:00
parent e26ce06560
commit 2e80e7c6ef
5 changed files with 37 additions and 33 deletions

View File

@ -59,36 +59,37 @@ bool Foam::pimpleControl::criteriaSatisfied()
bool firstIter = corr_ == 1;
bool achieved = true;
const dictionary& solverDict = mesh_.solverPerformanceDict();
bool checked = false; // safety that some checks were indeed performed
const dictionary& solverDict = mesh_.solverPerformanceDict();
forAllConstIter(dictionary, solverDict, iter)
{
const word& variableName = iter().keyword();
label fieldI = applyToField(variableName);
const label fieldI = applyToField(variableName);
if (fieldI != -1)
{
const List<lduMatrix::solverPerformance> sp(iter().stream());
const scalar residual = sp.last().initialResidual();
checked = true;
if (firstIter)
{
residualControl_[fieldI].initialResidual =
sp.first().initialResidual();
}
bool absCheck = residual < residualControl_[fieldI].absTol;
const bool absCheck = residual < residualControl_[fieldI].absTol;
bool relCheck = false;
scalar relative = 0.0;
if (!firstIter)
{
scalar iniRes =
const scalar iniRes =
residualControl_[fieldI].initialResidual
+ ROOTVSMALL;
relative = residual/iniRes;
relCheck = relative < residualControl_[fieldI].relTol;
}
@ -110,7 +111,7 @@ bool Foam::pimpleControl::criteriaSatisfied()
}
}
return achieved;
return checked && achieved;
}
@ -129,7 +130,13 @@ Foam::pimpleControl::pimpleControl(fvMesh& mesh)
if (nOuterCorr_ > 1)
{
Info<< nl;
if (!residualControl_.empty())
if (residualControl_.empty())
{
Info<< algorithmName_ << ": no residual control data found. "
<< "Calculations will employ " << nOuterCorr_
<< " corrector loops" << nl << endl;
}
else
{
Info<< algorithmName_ << ": max iterations = " << nOuterCorr_
<< endl;
@ -142,12 +149,6 @@ Foam::pimpleControl::pimpleControl(fvMesh& mesh)
}
Info<< endl;
}
else
{
Info<< algorithmName_ << ": no residual control data found. " << nl
<< "Calculations will employ " << nOuterCorr_
<< " corrector loops" << nl << endl;
}
}
else
{