mirror of
https://github.com/OpenFOAM/OpenFOAM-6.git
synced 2025-12-08 06:57:46 +00:00
convergenceControl: Store solve index per-field not per-entry
Resolves bug report https://bugs.openfoam.org/view.php?id=3173
This commit is contained in:
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration | Website: https://openfoam.org
|
\\ / O peration | Website: https://openfoam.org
|
||||||
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2018-2019 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -60,7 +60,6 @@ public:
|
|||||||
wordRe name;
|
wordRe name;
|
||||||
scalar absTol;
|
scalar absTol;
|
||||||
scalar relTol;
|
scalar relTol;
|
||||||
label solveIndex;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration | Website: https://openfoam.org
|
\\ / O peration | Website: https://openfoam.org
|
||||||
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2018-2019 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -96,7 +96,6 @@ bool Foam::singleRegionCorrectorConvergenceControl::readCorrResidualControls()
|
|||||||
rd.name = fName.c_str();
|
rd.name = fName.c_str();
|
||||||
rd.absTol = readScalar(fieldDict.lookup("tolerance"));
|
rd.absTol = readScalar(fieldDict.lookup("tolerance"));
|
||||||
rd.relTol = readScalar(fieldDict.lookup("relTol"));
|
rd.relTol = readScalar(fieldDict.lookup("relTol"));
|
||||||
rd.solveIndex = 0;
|
|
||||||
data.append(rd);
|
data.append(rd);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -177,11 +176,11 @@ corrCriteriaSatisfied() const
|
|||||||
const dictionary& solverDict = mesh_.solverPerformanceDict();
|
const dictionary& solverDict = mesh_.solverPerformanceDict();
|
||||||
forAllConstIter(dictionary, solverDict, iter)
|
forAllConstIter(dictionary, solverDict, iter)
|
||||||
{
|
{
|
||||||
const word& variableName = iter().keyword();
|
const word& fieldName = iter().keyword();
|
||||||
const label fieldi =
|
const label fieldi =
|
||||||
convergenceControl::residualControlIndex
|
convergenceControl::residualControlIndex
|
||||||
(
|
(
|
||||||
variableName,
|
fieldName,
|
||||||
corrResidualControl_
|
corrResidualControl_
|
||||||
);
|
);
|
||||||
if (fieldi != -1)
|
if (fieldi != -1)
|
||||||
@ -190,8 +189,8 @@ corrCriteriaSatisfied() const
|
|||||||
convergenceControl::getInitialResiduals
|
convergenceControl::getInitialResiduals
|
||||||
(
|
(
|
||||||
mesh_,
|
mesh_,
|
||||||
variableName,
|
fieldName,
|
||||||
corrResidualControl_[fieldi].solveIndex,
|
solveIndex_.found(fieldName) ? solveIndex_[fieldName] : 0,
|
||||||
iter().stream(),
|
iter().stream(),
|
||||||
firstResidual,
|
firstResidual,
|
||||||
residual
|
residual
|
||||||
@ -209,7 +208,7 @@ corrCriteriaSatisfied() const
|
|||||||
|
|
||||||
if (control_.debug)
|
if (control_.debug)
|
||||||
{
|
{
|
||||||
Info<< control_.algorithmSpace() << " " << variableName
|
Info<< control_.algorithmSpace() << " " << fieldName
|
||||||
<< ": tolerance " << residual << " ("
|
<< ": tolerance " << residual << " ("
|
||||||
<< corrResidualControl_[fieldi].absTol << ")"
|
<< corrResidualControl_[fieldi].absTol << ")"
|
||||||
<< ", relTol " << relativeResidual << " ("
|
<< ", relTol " << relativeResidual << " ("
|
||||||
@ -225,10 +224,7 @@ corrCriteriaSatisfied() const
|
|||||||
|
|
||||||
void Foam::singleRegionCorrectorConvergenceControl::resetCorrSolveIndex()
|
void Foam::singleRegionCorrectorConvergenceControl::resetCorrSolveIndex()
|
||||||
{
|
{
|
||||||
forAll(corrResidualControl_, i)
|
solveIndex_.clear();
|
||||||
{
|
|
||||||
corrResidualControl_[i].solveIndex = 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -237,24 +233,15 @@ void Foam::singleRegionCorrectorConvergenceControl::updateCorrSolveIndex()
|
|||||||
const dictionary& solverDict = mesh_.solverPerformanceDict();
|
const dictionary& solverDict = mesh_.solverPerformanceDict();
|
||||||
forAllConstIter(dictionary, solverDict, iter)
|
forAllConstIter(dictionary, solverDict, iter)
|
||||||
{
|
{
|
||||||
const word& variableName = iter().keyword();
|
const word& fieldName = iter().keyword();
|
||||||
const label fieldi =
|
|
||||||
convergenceControl::residualControlIndex
|
|
||||||
(
|
|
||||||
variableName,
|
|
||||||
corrResidualControl_
|
|
||||||
);
|
|
||||||
if (fieldi != -1)
|
|
||||||
{
|
|
||||||
getNSolves
|
getNSolves
|
||||||
(
|
(
|
||||||
mesh_,
|
mesh_,
|
||||||
variableName,
|
fieldName,
|
||||||
iter().stream(),
|
iter().stream(),
|
||||||
corrResidualControl_[fieldi].solveIndex
|
solveIndex_(fieldName)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration | Website: https://openfoam.org
|
\\ / O peration | Website: https://openfoam.org
|
||||||
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2018-2019 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -62,6 +62,11 @@ protected:
|
|||||||
//- List of residual data per field
|
//- List of residual data per field
|
||||||
List<corrResidualData> corrResidualControl_;
|
List<corrResidualData> corrResidualControl_;
|
||||||
|
|
||||||
|
//- The index of the solution at the start of the corrector loop, for
|
||||||
|
// each field. If the field name is not in the table then the index is
|
||||||
|
// assumed to be zero; i.e, the first solution.
|
||||||
|
HashTable<label> solveIndex_;
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user