mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
PBiCG: Suggest changing to the more robust PBiCGStab solver
if convergence is not achieved within the maximum number of iterations. Sometimes, particularly running in parallel, PBiCG fails to converge or diverges without warning or obvious cause leaving a solution field containing significant errors which can cause divergence of the application. PBiCGStab is more robust and does not suffer from the problems encountered with PBiCG.
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -122,6 +122,9 @@ public:
|
||||
//- Dictionary of controls
|
||||
dictionary controlDict_;
|
||||
|
||||
//- Default maximum number of iterations in the solver
|
||||
static const label defaultMaxIter_ = 1000;
|
||||
|
||||
//- Maximum number of iterations in the solver
|
||||
label maxIter_;
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -131,7 +131,7 @@ Foam::LduMatrix<Type, DType, LUType>::solver::solver
|
||||
|
||||
controlDict_(solverDict),
|
||||
|
||||
maxIter_(1000),
|
||||
maxIter_(defaultMaxIter_),
|
||||
minIter_(0),
|
||||
tolerance_(1e-6*pTraits<Type>::one),
|
||||
relTol_(Zero)
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -35,6 +35,9 @@ namespace Foam
|
||||
}
|
||||
|
||||
|
||||
const Foam::label Foam::lduMatrix::solver::defaultMaxIter_ = 1000;
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::lduMatrix::lduMatrix(const lduMesh& mesh)
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -106,6 +106,9 @@ public:
|
||||
//- Dictionary of controls
|
||||
dictionary controlDict_;
|
||||
|
||||
//- Default maximum number of iterations in the solver
|
||||
static const label defaultMaxIter_;
|
||||
|
||||
//- Maximum number of iterations in the solver
|
||||
label maxIter_;
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -157,10 +157,10 @@ Foam::lduMatrix::solver::solver
|
||||
|
||||
void Foam::lduMatrix::solver::readControls()
|
||||
{
|
||||
maxIter_ = controlDict_.lookupOrDefault<label>("maxIter", 1000);
|
||||
minIter_ = controlDict_.lookupOrDefault<label>("minIter", 0);
|
||||
maxIter_ = controlDict_.lookupOrDefault<label>("maxIter", defaultMaxIter_);
|
||||
minIter_ = controlDict_.lookupOrDefault<label>("minIter", 0);
|
||||
tolerance_ = controlDict_.lookupOrDefault<scalar>("tolerance", 1e-6);
|
||||
relTol_ = controlDict_.lookupOrDefault<scalar>("relTol", 0);
|
||||
relTol_ = controlDict_.lookupOrDefault<scalar>("relTol", 0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -208,6 +208,16 @@ Foam::solverPerformance Foam::PBiCG::solve
|
||||
);
|
||||
}
|
||||
|
||||
// Recommend PBiCGStab if PBiCG fails to converge
|
||||
if (solverPerf.nIterations() > max(defaultMaxIter_, maxIter_))
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "PBiCG has failed to converge within the maximum number"
|
||||
" of iterations " << max(defaultMaxIter_, maxIter_) << nl
|
||||
<< " Please try the more robust PBiCGStab solver."
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
return solverPerf;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user