diff --git a/src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduMatrix.H b/src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduMatrix.H index bae2bd10d5..c0673eb34f 100644 --- a/src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduMatrix.H +++ b/src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduMatrix.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation - Copyright (C) 2019 OpenCFD Ltd. + Copyright (C) 2019-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -134,6 +134,9 @@ public: //- Minimum number of iterations in the solver label minIter_; + //- Level of verbosity in the solver output statements + label log_; + //- Final convergence tolerance Type tolerance_; diff --git a/src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduMatrixSolver.C b/src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduMatrixSolver.C index 26e0dab299..54a5923603 100644 --- a/src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduMatrixSolver.C +++ b/src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduMatrixSolver.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation - Copyright (C) 2019 OpenCFD Ltd. + Copyright (C) 2019-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -131,6 +131,7 @@ Foam::LduMatrix::solver::solver maxIter_(defaultMaxIter_), minIter_(0), + log_(1), tolerance_(1e-6*pTraits::one), relTol_(Zero) { @@ -145,6 +146,7 @@ void Foam::LduMatrix::solver::readControls() { readControl(controlDict_, maxIter_, "maxIter"); readControl(controlDict_, minIter_, "minIter"); + readControl(controlDict_, log_, "log"); readControl(controlDict_, tolerance_, "tolerance"); readControl(controlDict_, relTol_, "relTol"); } diff --git a/src/OpenFOAM/matrices/LduMatrix/LduMatrix/SolverPerformance.C b/src/OpenFOAM/matrices/LduMatrix/LduMatrix/SolverPerformance.C index e291b0289a..2c53aedbee 100644 --- a/src/OpenFOAM/matrices/LduMatrix/LduMatrix/SolverPerformance.C +++ b/src/OpenFOAM/matrices/LduMatrix/LduMatrix/SolverPerformance.C @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation + Copyright (C) 2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -62,10 +63,11 @@ template bool Foam::SolverPerformance::checkConvergence ( const Type& Tolerance, - const Type& RelTolerance + const Type& RelTolerance, + const label log ) { - if (debug >= 2) + if ((log >= 2) || (debug >= 2)) { Info<< solverName_ << ": Iteration " << nIterations_ diff --git a/src/OpenFOAM/matrices/LduMatrix/LduMatrix/SolverPerformance.H b/src/OpenFOAM/matrices/LduMatrix/LduMatrix/SolverPerformance.H index 9d835599ce..476e842cb3 100644 --- a/src/OpenFOAM/matrices/LduMatrix/LduMatrix/SolverPerformance.H +++ b/src/OpenFOAM/matrices/LduMatrix/LduMatrix/SolverPerformance.H @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2012-2016 OpenFOAM Foundation + Copyright (C) 2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -218,7 +219,8 @@ public: bool checkConvergence ( const Type& tolerance, - const Type& relTolerance + const Type& relTolerance, + const label log ); //- Singularity test diff --git a/src/OpenFOAM/matrices/LduMatrix/Solvers/PBiCCCG/PBiCCCG.C b/src/OpenFOAM/matrices/LduMatrix/Solvers/PBiCCCG/PBiCCCG.C index f20a64a026..c219c276a6 100644 --- a/src/OpenFOAM/matrices/LduMatrix/Solvers/PBiCCCG/PBiCCCG.C +++ b/src/OpenFOAM/matrices/LduMatrix/Solvers/PBiCCCG/PBiCCCG.C @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation + Copyright (C) 2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -98,7 +99,7 @@ Foam::PBiCCCG::solve // --- Calculate normalisation factor Type normFactor = this->normFactor(psi, wA, pA); - if (LduMatrix::debug >= 2) + if ((this->log_ >= 2) || (LduMatrix::debug >= 2)) { Info<< " Normalisation factor = " << normFactor << endl; } @@ -111,7 +112,12 @@ Foam::PBiCCCG::solve if ( this->minIter_ > 0 - || !solverPerf.checkConvergence(this->tolerance_, this->relTol_) + || !solverPerf.checkConvergence + ( + this->tolerance_, + this->relTol_, + this->log_ + ) ) { // --- Select and construct the preconditioner @@ -192,7 +198,12 @@ Foam::PBiCCCG::solve ( ( nIter++ < this->maxIter_ - && !solverPerf.checkConvergence(this->tolerance_, this->relTol_) + && !solverPerf.checkConvergence + ( + this->tolerance_, + this->relTol_, + this->log_ + ) ) || nIter < this->minIter_ ); diff --git a/src/OpenFOAM/matrices/LduMatrix/Solvers/PBiCICG/PBiCICG.C b/src/OpenFOAM/matrices/LduMatrix/Solvers/PBiCICG/PBiCICG.C index 5796597fac..6dee6ad57e 100644 --- a/src/OpenFOAM/matrices/LduMatrix/Solvers/PBiCICG/PBiCICG.C +++ b/src/OpenFOAM/matrices/LduMatrix/Solvers/PBiCICG/PBiCICG.C @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation + Copyright (C) 2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -95,7 +96,7 @@ Foam::PBiCICG::solve(Field& psi) const // --- Calculate normalisation factor Type normFactor = this->normFactor(psi, wA, pA); - if (LduMatrix::debug >= 2) + if ((this->log_ >= 2) || (LduMatrix::debug >= 2)) { Info<< " Normalisation factor = " << normFactor << endl; } @@ -105,7 +106,15 @@ Foam::PBiCICG::solve(Field& psi) const solverPerf.finalResidual() = solverPerf.initialResidual(); // --- Check convergence, solve if not converged - if (!solverPerf.checkConvergence(this->tolerance_, this->relTol_)) + if + ( + !solverPerf.checkConvergence + ( + this->tolerance_, + this->relTol_, + this->log_ + ) + ) { // --- Select and construct the preconditioner autoPtr::preconditioner> @@ -192,7 +201,12 @@ Foam::PBiCICG::solve(Field& psi) const } while ( nIter++ < this->maxIter_ - && !(solverPerf.checkConvergence(this->tolerance_, this->relTol_)) + && !solverPerf.checkConvergence + ( + this->tolerance_, + this->relTol_, + this->log_ + ) ); } diff --git a/src/OpenFOAM/matrices/LduMatrix/Solvers/PCICG/PCICG.C b/src/OpenFOAM/matrices/LduMatrix/Solvers/PCICG/PCICG.C index 7adf70b392..6dec5d953d 100644 --- a/src/OpenFOAM/matrices/LduMatrix/Solvers/PCICG/PCICG.C +++ b/src/OpenFOAM/matrices/LduMatrix/Solvers/PCICG/PCICG.C @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation + Copyright (C) 2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -86,7 +87,7 @@ Foam::PCICG::solve(Field& psi) const // --- Calculate normalisation factor Type normFactor = this->normFactor(psi, wA, pA); - if (LduMatrix::debug >= 2) + if ((this->log_ >= 2) || (LduMatrix::debug >= 2)) { Info<< " Normalisation factor = " << normFactor << endl; } @@ -99,7 +100,12 @@ Foam::PCICG::solve(Field& psi) const if ( this->minIter_ > 0 - || !solverPerf.checkConvergence(this->tolerance_, this->relTol_) + || !solverPerf.checkConvergence + ( + this->tolerance_, + this->relTol_, + this->log_ + ) ) { // --- Select and construct the preconditioner @@ -184,7 +190,12 @@ Foam::PCICG::solve(Field& psi) const ( ( nIter++ < this->maxIter_ - && !solverPerf.checkConvergence(this->tolerance_, this->relTol_) + && !solverPerf.checkConvergence + ( + this->tolerance_, + this->relTol_, + this->log_ + ) ) || nIter < this->minIter_ ); diff --git a/src/OpenFOAM/matrices/LduMatrix/Solvers/SmoothSolver/SmoothSolver.C b/src/OpenFOAM/matrices/LduMatrix/Solvers/SmoothSolver/SmoothSolver.C index 9c5a5c80fd..ed10c2ae12 100644 --- a/src/OpenFOAM/matrices/LduMatrix/Solvers/SmoothSolver/SmoothSolver.C +++ b/src/OpenFOAM/matrices/LduMatrix/Solvers/SmoothSolver/SmoothSolver.C @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation + Copyright (C) 2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -110,7 +111,7 @@ Foam::SmoothSolver::solve(Field& psi) const solverPerf.finalResidual() = solverPerf.initialResidual(); } - if (LduMatrix::debug >= 2) + if ((this->log_ >= 2) || (LduMatrix::debug >= 2)) { Info<< " Normalisation factor = " << normFactor << endl; } @@ -120,7 +121,12 @@ Foam::SmoothSolver::solve(Field& psi) const if ( this->minIter_ > 0 - || !solverPerf.checkConvergence(this->tolerance_, this->relTol_) + || !solverPerf.checkConvergence + ( + this->tolerance_, + this->relTol_, + this->log_ + ) ) { autoPtr::smoother> @@ -150,7 +156,12 @@ Foam::SmoothSolver::solve(Field& psi) const ( ( (nIter += nSweeps_) < this->maxIter_ - && !solverPerf.checkConvergence(this->tolerance_, this->relTol_) + && !solverPerf.checkConvergence + ( + this->tolerance_, + this->relTol_, + this->log_ + ) ) || nIter < this->minIter_ ); diff --git a/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrix.H b/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrix.H index 644de9caa0..f7642bad24 100644 --- a/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrix.H +++ b/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrix.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation - Copyright (C) 2016-2019 OpenCFD Ltd. + Copyright (C) 2016-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -120,6 +120,9 @@ public: //- Minimum number of iterations in the solver label minIter_; + //- Level of verbosity in the solver output statements + label log_; + //- Final convergence tolerance scalar tolerance_; diff --git a/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrixSolver.C b/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrixSolver.C index b750b74a65..8a3f5ad6a1 100644 --- a/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrixSolver.C +++ b/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrixSolver.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation - Copyright (C) 2016-2020 OpenCFD Ltd. + Copyright (C) 2016-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -164,6 +164,7 @@ void Foam::lduMatrix::solver::readControls() { maxIter_ = controlDict_.getOrDefault