mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
LduMatrix: Further integration with lduMatrix
Replaced lduMatrix::solverPerformance with SolverPerformance<scalar>
This commit is contained in:
@ -240,7 +240,6 @@ lduMatrix = matrices/lduMatrix
|
||||
$(lduMatrix)/lduMatrix/lduMatrix.C
|
||||
$(lduMatrix)/lduMatrix/lduMatrixOperations.C
|
||||
$(lduMatrix)/lduMatrix/lduMatrixATmul.C
|
||||
$(lduMatrix)/lduMatrix/lduMatrixTests.C
|
||||
$(lduMatrix)/lduMatrix/lduMatrixUpdateMatrixInterfaces.C
|
||||
$(lduMatrix)/lduMatrix/lduMatrixSolver.C
|
||||
$(lduMatrix)/lduMatrix/lduMatrixSmoother.C
|
||||
@ -316,6 +315,7 @@ meshes/lduMesh/lduMesh.C
|
||||
|
||||
LduMatrix = matrices/LduMatrix
|
||||
$(LduMatrix)/LduMatrix/lduMatrices.C
|
||||
$(LduMatrix)/LduMatrix/solverPerformance.C
|
||||
$(LduMatrix)/LduMatrix/LduInterfaceField/LduInterfaceFields.C
|
||||
$(LduMatrix)/Smoothers/lduSmoothers.C
|
||||
$(LduMatrix)/Preconditioners/lduPreconditioners.C
|
||||
|
||||
@ -382,7 +382,6 @@ Foam::Ostream& Foam::operator<<
|
||||
#include "LduMatrixOperations.C"
|
||||
#include "LduMatrixATmul.C"
|
||||
#include "LduMatrixUpdateMatrixInterfaces.C"
|
||||
#include "SolverPerformance.C"
|
||||
#include "LduMatrixPreconditioner.C"
|
||||
#include "LduMatrixSmoother.C"
|
||||
#include "LduMatrixSolver.C"
|
||||
|
||||
@ -460,15 +460,6 @@ public:
|
||||
// Declare name of the class and its debug switch
|
||||
ClassName("LduMatrix");
|
||||
|
||||
//- Large Type for the use in solvers
|
||||
static const scalar great_;
|
||||
|
||||
//- Small Type for the use in solvers
|
||||
static const scalar small_;
|
||||
|
||||
//- Very small Type for the use in solvers
|
||||
static const scalar vsmall_;
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
@ -682,16 +673,6 @@ typedef Foam::LduMatrix<Type, DType, LUType> \
|
||||
defineNamedTemplateTypeNameAndDebug(ldu##Type##DType##LUType##Matrix, 0); \
|
||||
\
|
||||
\
|
||||
template<> \
|
||||
const scalar ldu##Type##DType##LUType##Matrix::great_(1e15); \
|
||||
\
|
||||
template<> \
|
||||
const scalar ldu##Type##DType##LUType##Matrix::small_(1e-15); \
|
||||
\
|
||||
template<> \
|
||||
const scalar ldu##Type##DType##LUType##Matrix::vsmall_(VSMALL); \
|
||||
\
|
||||
\
|
||||
typedef LduMatrix<Type, DType, LUType>::smoother \
|
||||
ldu##Type##DType##LUType##Smoother; \
|
||||
\
|
||||
|
||||
@ -179,7 +179,7 @@ Type Foam::LduMatrix<Type, DType, LUType>::solver::normFactor
|
||||
return stabilise
|
||||
(
|
||||
gSum(cmptMag(Apsi - tmpField) + cmptMag(matrix_.source() - tmpField)),
|
||||
matrix_.small_
|
||||
SolverPerformance<Type>::small_
|
||||
);
|
||||
|
||||
// At convergence this simpler method is equivalent to the above
|
||||
|
||||
@ -23,7 +23,7 @@ License
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "LduMatrix.H"
|
||||
#include "SolverPerformance.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -36,7 +36,7 @@ bool Foam::SolverPerformance<Type>::checkSingularity
|
||||
for(direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
|
||||
{
|
||||
singular_[cmpt] =
|
||||
component(wApA, cmpt) < LduMatrix<scalar, scalar, scalar>::vsmall_;
|
||||
component(wApA, cmpt) < vsmall_;
|
||||
}
|
||||
|
||||
return singular();
|
||||
@ -56,13 +56,13 @@ bool Foam::SolverPerformance<Type>::singular() const
|
||||
|
||||
|
||||
template<class Type>
|
||||
bool Foam::SolverPerformance<Type>::converged
|
||||
bool Foam::SolverPerformance<Type>::checkConvergence
|
||||
(
|
||||
const Type& Tolerance,
|
||||
const Type& RelTolerance
|
||||
)
|
||||
{
|
||||
if (LduMatrix<scalar, scalar, scalar>::debug >= 2)
|
||||
if (debug >= 2)
|
||||
{
|
||||
Info<< solverName_
|
||||
<< ": Iteration " << noIterations_
|
||||
@ -75,7 +75,7 @@ bool Foam::SolverPerformance<Type>::converged
|
||||
finalResidual_ < Tolerance
|
||||
|| (
|
||||
RelTolerance
|
||||
> LduMatrix<scalar, scalar, scalar>::small_*pTraits<Type>::one
|
||||
> small_*pTraits<Type>::one
|
||||
&& finalResidual_ < cmptMultiply(RelTolerance, initialResidual_)
|
||||
)
|
||||
)
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -93,6 +93,21 @@ class SolverPerformance
|
||||
|
||||
public:
|
||||
|
||||
// Static data
|
||||
|
||||
// Declare name of the class and its debug switch
|
||||
ClassName("SolverPerformance");
|
||||
|
||||
//- Large Type for the use in solvers
|
||||
static const scalar great_;
|
||||
|
||||
//- Small Type for the use in solvers
|
||||
static const scalar small_;
|
||||
|
||||
//- Very small Type for the use in solvers
|
||||
static const scalar vsmall_;
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
SolverPerformance()
|
||||
@ -197,7 +212,7 @@ public:
|
||||
bool singular() const;
|
||||
|
||||
//- Check, store and return convergence
|
||||
bool converged
|
||||
bool checkConvergence
|
||||
(
|
||||
const Type& tolerance,
|
||||
const Type& relTolerance
|
||||
@ -245,10 +260,29 @@ public:
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#define makeSolverPerformance(Type) \
|
||||
\
|
||||
typedef Foam::SolverPerformance<Type> \
|
||||
solverPerformance##Type; \
|
||||
\
|
||||
defineNamedTemplateTypeNameAndDebug(solverPerformance##Type, 0); \
|
||||
\
|
||||
template<> \
|
||||
const scalar solverPerformance##Type::great_(1e20); \
|
||||
\
|
||||
template<> \
|
||||
const scalar solverPerformance##Type::small_(1e-20); \
|
||||
\
|
||||
template<> \
|
||||
const scalar solverPerformance##Type::vsmall_(VSMALL); \
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
//# include "SolverPerformance.C"
|
||||
# include "SolverPerformance.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -0,0 +1,39 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "solverPerformance.H"
|
||||
#include "fieldTypes.H"
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
makeSolverPerformance(scalar);
|
||||
makeSolverPerformance(vector);
|
||||
makeSolverPerformance(sphericalTensor);
|
||||
makeSolverPerformance(symmTensor);
|
||||
makeSolverPerformance(tensor);
|
||||
};
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,51 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Typedef
|
||||
Foam::solverPerformance
|
||||
|
||||
Description
|
||||
SolverPerformance instantiated for a scalar
|
||||
|
||||
SourceFiles
|
||||
solverPerformance.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef solverPerformance_H
|
||||
#define solverPerformance_H
|
||||
|
||||
#include "SolverPerformance.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
typedef SolverPerformance<scalar> solverPerformance;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -104,7 +104,7 @@ Foam::PBiCCCG<Type, DType, LUType>::solve
|
||||
solverPerf.finalResidual() = solverPerf.initialResidual();
|
||||
|
||||
// --- Check convergence, solve if not converged
|
||||
if (!solverPerf.converged(this->tolerance_, this->relTol_))
|
||||
if (!solverPerf.checkConvergence(this->tolerance_, this->relTol_))
|
||||
{
|
||||
// --- Select and construct the preconditioner
|
||||
autoPtr<typename LduMatrix<Type, DType, LUType>::preconditioner>
|
||||
@ -183,7 +183,7 @@ Foam::PBiCCCG<Type, DType, LUType>::solve
|
||||
} while
|
||||
(
|
||||
solverPerf.nIterations()++ < this->maxIter_
|
||||
&& !(solverPerf.converged(this->tolerance_, this->relTol_))
|
||||
&& !(solverPerf.checkConvergence(this->tolerance_, this->relTol_))
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -75,7 +75,7 @@ Foam::PBiCICG<Type, DType, LUType>::solve(Field<Type>& psi) const
|
||||
Field<Type> wT(nCells);
|
||||
Type* __restrict__ wTPtr = wT.begin();
|
||||
|
||||
Type wArT = this->matrix_.great_*pTraits<Type>::one;
|
||||
Type wArT = solverPerf.great_*pTraits<Type>::one;
|
||||
Type wArTold = wArT;
|
||||
|
||||
// --- Calculate A.psi and T.psi
|
||||
@ -101,7 +101,7 @@ Foam::PBiCICG<Type, DType, LUType>::solve(Field<Type>& psi) const
|
||||
solverPerf.finalResidual() = solverPerf.initialResidual();
|
||||
|
||||
// --- Check convergence, solve if not converged
|
||||
if (!solverPerf.converged(this->tolerance_, this->relTol_))
|
||||
if (!solverPerf.checkConvergence(this->tolerance_, this->relTol_))
|
||||
{
|
||||
// --- Select and construct the preconditioner
|
||||
autoPtr<typename LduMatrix<Type, DType, LUType>::preconditioner>
|
||||
@ -137,7 +137,7 @@ Foam::PBiCICG<Type, DType, LUType>::solve(Field<Type>& psi) const
|
||||
Type beta = cmptDivide
|
||||
(
|
||||
wArT,
|
||||
stabilise(wArTold, this->matrix_.vsmall_)
|
||||
stabilise(wArTold, solverPerf.vsmall_)
|
||||
);
|
||||
|
||||
for (register label cell=0; cell<nCells; cell++)
|
||||
@ -172,7 +172,7 @@ Foam::PBiCICG<Type, DType, LUType>::solve(Field<Type>& psi) const
|
||||
Type alpha = cmptDivide
|
||||
(
|
||||
wArT,
|
||||
stabilise(wApT, this->matrix_.vsmall_)
|
||||
stabilise(wApT, solverPerf.vsmall_)
|
||||
);
|
||||
|
||||
for (register label cell=0; cell<nCells; cell++)
|
||||
@ -188,7 +188,7 @@ Foam::PBiCICG<Type, DType, LUType>::solve(Field<Type>& psi) const
|
||||
} while
|
||||
(
|
||||
solverPerf.nIterations()++ < this->maxIter_
|
||||
&& !(solverPerf.converged(this->tolerance_, this->relTol_))
|
||||
&& !(solverPerf.checkConvergence(this->tolerance_, this->relTol_))
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -69,7 +69,7 @@ Foam::PCICG<Type, DType, LUType>::solve(Field<Type>& psi) const
|
||||
Field<Type> wA(nCells);
|
||||
Type* __restrict__ wAPtr = wA.begin();
|
||||
|
||||
Type wArA = this->matrix_.great_*pTraits<Type>::one;
|
||||
Type wArA = solverPerf.great_*pTraits<Type>::one;
|
||||
Type wArAold = wArA;
|
||||
|
||||
// --- Calculate A.psi
|
||||
@ -92,7 +92,7 @@ Foam::PCICG<Type, DType, LUType>::solve(Field<Type>& psi) const
|
||||
solverPerf.finalResidual() = solverPerf.initialResidual();
|
||||
|
||||
// --- Check convergence, solve if not converged
|
||||
if (!solverPerf.converged(this->tolerance_, this->relTol_))
|
||||
if (!solverPerf.checkConvergence(this->tolerance_, this->relTol_))
|
||||
{
|
||||
// --- Select and construct the preconditioner
|
||||
autoPtr<typename LduMatrix<Type, DType, LUType>::preconditioner>
|
||||
@ -126,7 +126,7 @@ Foam::PCICG<Type, DType, LUType>::solve(Field<Type>& psi) const
|
||||
Type beta = cmptDivide
|
||||
(
|
||||
wArA,
|
||||
stabilise(wArAold, this->matrix_.vsmall_)
|
||||
stabilise(wArAold, solverPerf.vsmall_)
|
||||
);
|
||||
|
||||
for (register label cell=0; cell<nCells; cell++)
|
||||
@ -160,7 +160,7 @@ Foam::PCICG<Type, DType, LUType>::solve(Field<Type>& psi) const
|
||||
Type alpha = cmptDivide
|
||||
(
|
||||
wArA,
|
||||
stabilise(wApA, this->matrix_.vsmall_)
|
||||
stabilise(wApA, solverPerf.vsmall_)
|
||||
);
|
||||
|
||||
for (register label cell=0; cell<nCells; cell++)
|
||||
@ -175,7 +175,7 @@ Foam::PCICG<Type, DType, LUType>::solve(Field<Type>& psi) const
|
||||
} while
|
||||
(
|
||||
solverPerf.nIterations()++ < this->maxIter_
|
||||
&& !(solverPerf.converged(this->tolerance_, this->relTol_))
|
||||
&& !(solverPerf.checkConvergence(this->tolerance_, this->relTol_))
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -113,7 +113,7 @@ Foam::SmoothSolver<Type, DType, LUType>::solve(Field<Type>& psi) const
|
||||
|
||||
|
||||
// Check convergence, solve if not converged
|
||||
if (!solverPerf.converged(this->tolerance_, this->relTol_))
|
||||
if (!solverPerf.checkConvergence(this->tolerance_, this->relTol_))
|
||||
{
|
||||
autoPtr<typename LduMatrix<Type, DType, LUType>::smoother>
|
||||
smootherPtr = LduMatrix<Type, DType, LUType>::smoother::New
|
||||
@ -141,7 +141,7 @@ Foam::SmoothSolver<Type, DType, LUType>::solve(Field<Type>& psi) const
|
||||
} while
|
||||
(
|
||||
(solverPerf.nIterations() += nSweeps_) < this->maxIter_
|
||||
&& !(solverPerf.converged(this->tolerance_, this->relTol_))
|
||||
&& !(solverPerf.checkConvergence(this->tolerance_, this->relTol_))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -30,9 +30,6 @@ License
|
||||
|
||||
defineTypeNameAndDebug(Foam::lduMatrix, 1);
|
||||
|
||||
const Foam::scalar Foam::lduMatrix::great_ = 1.0e+20;
|
||||
const Foam::scalar Foam::lduMatrix::small_ = 1.0e-20;
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
@ -57,6 +57,7 @@ SourceFiles
|
||||
#include "typeInfo.H"
|
||||
#include "autoPtr.H"
|
||||
#include "runTimeSelectionTables.H"
|
||||
#include "solverPerformance.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -86,166 +87,6 @@ class lduMatrix
|
||||
|
||||
public:
|
||||
|
||||
//- Class returned by the solver, containing performance statistics
|
||||
class solverPerformance
|
||||
{
|
||||
word solverName_;
|
||||
word fieldName_;
|
||||
scalar initialResidual_;
|
||||
scalar finalResidual_;
|
||||
label noIterations_;
|
||||
bool converged_;
|
||||
bool singular_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct null
|
||||
solverPerformance()
|
||||
:
|
||||
initialResidual_(0),
|
||||
finalResidual_(0),
|
||||
noIterations_(0),
|
||||
converged_(false),
|
||||
singular_(false)
|
||||
{}
|
||||
|
||||
//- Construct from components
|
||||
solverPerformance
|
||||
(
|
||||
const word& solverName,
|
||||
const word& fieldName,
|
||||
const scalar iRes = 0,
|
||||
const scalar fRes = 0,
|
||||
const label nIter = 0,
|
||||
const bool converged = false,
|
||||
const bool singular = false
|
||||
)
|
||||
:
|
||||
solverName_(solverName),
|
||||
fieldName_(fieldName),
|
||||
initialResidual_(iRes),
|
||||
finalResidual_(fRes),
|
||||
noIterations_(nIter),
|
||||
converged_(converged),
|
||||
singular_(singular)
|
||||
{}
|
||||
|
||||
//- Construct from Istream
|
||||
solverPerformance(Istream&);
|
||||
|
||||
|
||||
// Member functions
|
||||
|
||||
//- Return solver name
|
||||
const word& solverName() const
|
||||
{
|
||||
return solverName_;
|
||||
}
|
||||
|
||||
//- Return solver name
|
||||
word& solverName()
|
||||
{
|
||||
return solverName_;
|
||||
}
|
||||
|
||||
|
||||
//- Return field name
|
||||
const word& fieldName() const
|
||||
{
|
||||
return fieldName_;
|
||||
}
|
||||
|
||||
|
||||
//- Return initial residual
|
||||
scalar initialResidual() const
|
||||
{
|
||||
return initialResidual_;
|
||||
}
|
||||
|
||||
//- Return initial residual
|
||||
scalar& initialResidual()
|
||||
{
|
||||
return initialResidual_;
|
||||
}
|
||||
|
||||
|
||||
//- Return final residual
|
||||
scalar finalResidual() const
|
||||
{
|
||||
return finalResidual_;
|
||||
}
|
||||
|
||||
//- Return final residual
|
||||
scalar& finalResidual()
|
||||
{
|
||||
return finalResidual_;
|
||||
}
|
||||
|
||||
|
||||
//- Return number of iterations
|
||||
label nIterations() const
|
||||
{
|
||||
return noIterations_;
|
||||
}
|
||||
|
||||
//- Return number of iterations
|
||||
label& nIterations()
|
||||
{
|
||||
return noIterations_;
|
||||
}
|
||||
|
||||
|
||||
//- Has the solver converged?
|
||||
bool converged() const
|
||||
{
|
||||
return converged_;
|
||||
}
|
||||
|
||||
//- Is the matrix singular?
|
||||
bool singular() const
|
||||
{
|
||||
return singular_;
|
||||
}
|
||||
|
||||
//- Check, store and return convergence
|
||||
bool checkConvergence
|
||||
(
|
||||
const scalar tolerance,
|
||||
const scalar relTolerance
|
||||
);
|
||||
|
||||
//- Singularity test
|
||||
bool checkSingularity(const scalar residual);
|
||||
|
||||
//- Print summary of solver performance
|
||||
void print() const;
|
||||
|
||||
|
||||
// Member Operators
|
||||
|
||||
bool operator!=(const solverPerformance&) const;
|
||||
|
||||
|
||||
// Friend functions
|
||||
|
||||
//- Return the element-wise maximum of two solverPerformances
|
||||
friend solverPerformance max
|
||||
(
|
||||
const solverPerformance&,
|
||||
const solverPerformance&
|
||||
);
|
||||
|
||||
|
||||
// Ostream Operator
|
||||
|
||||
friend Istream& operator>>(Istream&, solverPerformance&);
|
||||
friend Ostream& operator<<(Ostream&, const solverPerformance&);
|
||||
};
|
||||
|
||||
|
||||
//- Abstract base-class for lduMatrix solvers
|
||||
class solver
|
||||
{
|
||||
@ -670,12 +511,6 @@ public:
|
||||
// Declare name of the class and its debug switch
|
||||
ClassName("lduMatrix");
|
||||
|
||||
//- Large scalar for the use in solvers
|
||||
static const scalar great_;
|
||||
|
||||
//- Small scalar for the use in solvers
|
||||
static const scalar small_;
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
|
||||
@ -188,10 +188,12 @@ Foam::scalar Foam::lduMatrix::solver::normFactor
|
||||
matrix_.sumA(tmpField, interfaceBouCoeffs_, interfaces_);
|
||||
tmpField *= gAverage(psi);
|
||||
|
||||
return gSum(mag(Apsi - tmpField) + mag(source - tmpField)) + matrix_.small_;
|
||||
return
|
||||
gSum(mag(Apsi - tmpField) + mag(source - tmpField))
|
||||
+ solverPerformance::small_;
|
||||
|
||||
// At convergence this simpler method is equivalent to the above
|
||||
// return 2*gSumMag(source) + matrix_.small_;
|
||||
// return 2*gSumMag(source) + solverPerformance::small_;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -1,190 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Description
|
||||
Convergence and singularity tests for solvers.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "lduMatrix.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::lduMatrix::solverPerformance::solverPerformance(Istream& is)
|
||||
{
|
||||
is >> *this;
|
||||
}
|
||||
|
||||
|
||||
bool Foam::lduMatrix::solverPerformance::checkConvergence
|
||||
(
|
||||
const scalar Tolerance,
|
||||
const scalar RelTolerance
|
||||
)
|
||||
{
|
||||
if (debug >= 2)
|
||||
{
|
||||
Info<< solverName_
|
||||
<< ": Iteration " << noIterations_
|
||||
<< " residual = " << finalResidual_
|
||||
<< endl;
|
||||
}
|
||||
|
||||
if
|
||||
(
|
||||
finalResidual_ < Tolerance
|
||||
|| (
|
||||
RelTolerance > SMALL
|
||||
&& finalResidual_ <= RelTolerance*initialResidual_
|
||||
)
|
||||
// || (solverName == "symSolve" && iter == 0)
|
||||
)
|
||||
{
|
||||
converged_ = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
converged_ = false;
|
||||
}
|
||||
|
||||
return converged_;
|
||||
}
|
||||
|
||||
|
||||
bool Foam::lduMatrix::solverPerformance::checkSingularity
|
||||
(
|
||||
const scalar residual
|
||||
)
|
||||
{
|
||||
if (residual > VSMALL)
|
||||
{
|
||||
singular_ = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
singular_ = true;
|
||||
}
|
||||
|
||||
return singular_;
|
||||
}
|
||||
|
||||
|
||||
void Foam::lduMatrix::solverPerformance::print() const
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
Info<< solverName_ << ": Solving for " << fieldName_;
|
||||
|
||||
if (singular())
|
||||
{
|
||||
Info<< ": solution singularity" << endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
Info<< ", Initial residual = " << initialResidual_
|
||||
<< ", Final residual = " << finalResidual_
|
||||
<< ", No Iterations " << noIterations_
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool Foam::lduMatrix::solverPerformance::operator!=
|
||||
(
|
||||
const lduMatrix::solverPerformance& sp
|
||||
) const
|
||||
{
|
||||
return
|
||||
(
|
||||
solverName() != sp.solverName()
|
||||
|| fieldName() != sp.fieldName()
|
||||
|| initialResidual() != sp.initialResidual()
|
||||
|| finalResidual() != sp.finalResidual()
|
||||
|| nIterations() != sp.nIterations()
|
||||
|| converged() != sp.converged()
|
||||
|| singular() != sp.singular()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Foam::lduMatrix::solverPerformance Foam::max
|
||||
(
|
||||
const lduMatrix::solverPerformance& sp1,
|
||||
const lduMatrix::solverPerformance& sp2
|
||||
)
|
||||
{
|
||||
return lduMatrix::solverPerformance
|
||||
(
|
||||
sp1.solverName(),
|
||||
sp1.fieldName_,
|
||||
max(sp1.initialResidual(), sp2.initialResidual()),
|
||||
max(sp1.finalResidual(), sp2.finalResidual()),
|
||||
max(sp1.nIterations(), sp2.nIterations()),
|
||||
sp1.converged() && sp2.converged(),
|
||||
sp1.singular() || sp2.singular()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Foam::Istream& Foam::operator>>
|
||||
(
|
||||
Istream& is,
|
||||
Foam::lduMatrix::solverPerformance& sp
|
||||
)
|
||||
{
|
||||
is.readBeginList("lduMatrix::solverPerformance");
|
||||
is >> sp.solverName_
|
||||
>> sp.fieldName_
|
||||
>> sp.initialResidual_
|
||||
>> sp.finalResidual_
|
||||
>> sp.noIterations_
|
||||
>> sp.converged_
|
||||
>> sp.singular_;
|
||||
is.readEndList("lduMatrix::solverPerformance");
|
||||
|
||||
return is;
|
||||
}
|
||||
|
||||
|
||||
Foam::Ostream& Foam::operator<<
|
||||
(
|
||||
Ostream& os,
|
||||
const Foam::lduMatrix::solverPerformance& sp
|
||||
)
|
||||
{
|
||||
os << token::BEGIN_LIST
|
||||
<< sp.solverName_ << token::SPACE
|
||||
<< sp.fieldName_ << token::SPACE
|
||||
<< sp.initialResidual_ << token::SPACE
|
||||
<< sp.finalResidual_ << token::SPACE
|
||||
<< sp.noIterations_ << token::SPACE
|
||||
<< sp.converged_ << token::SPACE
|
||||
<< sp.singular_ << token::SPACE
|
||||
<< token::END_LIST;
|
||||
|
||||
return os;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -229,7 +229,7 @@ public:
|
||||
// Member Functions
|
||||
|
||||
//- Solve
|
||||
virtual lduMatrix::solverPerformance solve
|
||||
virtual solverPerformance solve
|
||||
(
|
||||
scalarField& psi,
|
||||
const scalarField& source,
|
||||
|
||||
@ -30,7 +30,7 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
Foam::lduMatrix::solverPerformance Foam::GAMGSolver::solve
|
||||
Foam::solverPerformance Foam::GAMGSolver::solve
|
||||
(
|
||||
scalarField& psi,
|
||||
const scalarField& source,
|
||||
@ -38,7 +38,7 @@ Foam::lduMatrix::solverPerformance Foam::GAMGSolver::solve
|
||||
) const
|
||||
{
|
||||
// Setup class containing solver performance data
|
||||
lduMatrix::solverPerformance solverPerf(typeName, fieldName_);
|
||||
solverPerformance solverPerf(typeName, fieldName_);
|
||||
|
||||
// Calculate A.psi used to calculate the initial residual
|
||||
scalarField Apsi(psi.size());
|
||||
@ -103,7 +103,7 @@ Foam::lduMatrix::solverPerformance Foam::GAMGSolver::solve
|
||||
|
||||
if (debug >= 2)
|
||||
{
|
||||
solverPerf.print();
|
||||
solverPerf.print(Info);
|
||||
}
|
||||
} while
|
||||
(
|
||||
@ -429,7 +429,7 @@ void Foam::GAMGSolver::solveCoarsestLevel
|
||||
{
|
||||
const label coarsestLevel = matrixLevels_.size() - 1;
|
||||
coarsestCorrField = 0;
|
||||
lduMatrix::solverPerformance coarseSolverPerf;
|
||||
solverPerformance coarseSolverPerf;
|
||||
|
||||
if (matrixLevels_[coarsestLevel].asymmetric())
|
||||
{
|
||||
@ -468,7 +468,7 @@ void Foam::GAMGSolver::solveCoarsestLevel
|
||||
|
||||
if (debug >= 2)
|
||||
{
|
||||
coarseSolverPerf.print();
|
||||
coarseSolverPerf.print(Info);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -62,7 +62,7 @@ Foam::PBiCG::PBiCG
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
Foam::lduMatrix::solverPerformance Foam::PBiCG::solve
|
||||
Foam::solverPerformance Foam::PBiCG::solve
|
||||
(
|
||||
scalarField& psi,
|
||||
const scalarField& source,
|
||||
@ -70,7 +70,7 @@ Foam::lduMatrix::solverPerformance Foam::PBiCG::solve
|
||||
) const
|
||||
{
|
||||
// --- Setup class containing solver performance data
|
||||
lduMatrix::solverPerformance solverPerf
|
||||
solverPerformance solverPerf
|
||||
(
|
||||
lduMatrix::preconditioner::getName(controlDict_) + typeName,
|
||||
fieldName_
|
||||
@ -92,7 +92,7 @@ Foam::lduMatrix::solverPerformance Foam::PBiCG::solve
|
||||
scalarField wT(nCells);
|
||||
scalar* __restrict__ wTPtr = wT.begin();
|
||||
|
||||
scalar wArT = matrix_.great_;
|
||||
scalar wArT = solverPerf.great_;
|
||||
scalar wArTold = wArT;
|
||||
|
||||
// --- Calculate A.psi and T.psi
|
||||
|
||||
@ -88,7 +88,7 @@ public:
|
||||
// Member Functions
|
||||
|
||||
//- Solve the matrix with this solver
|
||||
virtual lduMatrix::solverPerformance solve
|
||||
virtual solverPerformance solve
|
||||
(
|
||||
scalarField& psi,
|
||||
const scalarField& source,
|
||||
|
||||
@ -62,7 +62,7 @@ Foam::PCG::PCG
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
Foam::lduMatrix::solverPerformance Foam::PCG::solve
|
||||
Foam::solverPerformance Foam::PCG::solve
|
||||
(
|
||||
scalarField& psi,
|
||||
const scalarField& source,
|
||||
@ -70,7 +70,7 @@ Foam::lduMatrix::solverPerformance Foam::PCG::solve
|
||||
) const
|
||||
{
|
||||
// --- Setup class containing solver performance data
|
||||
lduMatrix::solverPerformance solverPerf
|
||||
solverPerformance solverPerf
|
||||
(
|
||||
lduMatrix::preconditioner::getName(controlDict_) + typeName,
|
||||
fieldName_
|
||||
@ -86,7 +86,7 @@ Foam::lduMatrix::solverPerformance Foam::PCG::solve
|
||||
scalarField wA(nCells);
|
||||
scalar* __restrict__ wAPtr = wA.begin();
|
||||
|
||||
scalar wArA = matrix_.great_;
|
||||
scalar wArA = solverPerf.great_;
|
||||
scalar wArAold = wArA;
|
||||
|
||||
// --- Calculate A.psi
|
||||
|
||||
@ -88,7 +88,7 @@ public:
|
||||
// Member Functions
|
||||
|
||||
//- Solve the matrix with this solver
|
||||
virtual lduMatrix::solverPerformance solve
|
||||
virtual solverPerformance solve
|
||||
(
|
||||
scalarField& psi,
|
||||
const scalarField& source,
|
||||
|
||||
@ -56,7 +56,7 @@ Foam::diagonalSolver::diagonalSolver
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::lduMatrix::solverPerformance Foam::diagonalSolver::solve
|
||||
Foam::solverPerformance Foam::diagonalSolver::solve
|
||||
(
|
||||
scalarField& psi,
|
||||
const scalarField& source,
|
||||
@ -65,7 +65,7 @@ Foam::lduMatrix::solverPerformance Foam::diagonalSolver::solve
|
||||
{
|
||||
psi = source/matrix_.diag();
|
||||
|
||||
return lduMatrix::solverPerformance
|
||||
return solverPerformance
|
||||
(
|
||||
typeName,
|
||||
fieldName_,
|
||||
|
||||
@ -86,7 +86,7 @@ public:
|
||||
{}
|
||||
|
||||
//- Solve the matrix with this solver
|
||||
lduMatrix::solverPerformance solve
|
||||
solverPerformance solve
|
||||
(
|
||||
scalarField& psi,
|
||||
const scalarField& source,
|
||||
|
||||
@ -74,7 +74,7 @@ void Foam::smoothSolver::readControls()
|
||||
}
|
||||
|
||||
|
||||
Foam::lduMatrix::solverPerformance Foam::smoothSolver::solve
|
||||
Foam::solverPerformance Foam::smoothSolver::solve
|
||||
(
|
||||
scalarField& psi,
|
||||
const scalarField& source,
|
||||
@ -82,7 +82,7 @@ Foam::lduMatrix::solverPerformance Foam::smoothSolver::solve
|
||||
) const
|
||||
{
|
||||
// Setup class containing solver performance data
|
||||
lduMatrix::solverPerformance solverPerf(typeName, fieldName_);
|
||||
solverPerformance solverPerf(typeName, fieldName_);
|
||||
|
||||
// If the nSweeps_ is negative do a fixed number of sweeps
|
||||
if (nSweeps_ < 0)
|
||||
|
||||
@ -92,7 +92,7 @@ public:
|
||||
// Member Functions
|
||||
|
||||
//- Solve the matrix with this solver
|
||||
virtual lduMatrix::solverPerformance solve
|
||||
virtual solverPerformance solve
|
||||
(
|
||||
scalarField& psi,
|
||||
const scalarField& source,
|
||||
|
||||
@ -25,7 +25,7 @@ License
|
||||
|
||||
#include "data.H"
|
||||
#include "Time.H"
|
||||
#include "lduMatrix.H"
|
||||
#include "solverPerformance.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
@ -63,12 +63,12 @@ const Foam::dictionary& Foam::data::solverPerformanceDict() const
|
||||
void Foam::data::setSolverPerformance
|
||||
(
|
||||
const word& name,
|
||||
const lduMatrix::solverPerformance& sp
|
||||
const solverPerformance& sp
|
||||
) const
|
||||
{
|
||||
dictionary& dict = const_cast<dictionary&>(solverPerformanceDict());
|
||||
|
||||
List<lduMatrix::solverPerformance> perfs;
|
||||
List<solverPerformance> perfs;
|
||||
|
||||
if (prevTimeIndex_ != this->time().timeIndex())
|
||||
{
|
||||
@ -90,7 +90,7 @@ void Foam::data::setSolverPerformance
|
||||
|
||||
void Foam::data::setSolverPerformance
|
||||
(
|
||||
const lduMatrix::solverPerformance& sp
|
||||
const solverPerformance& sp
|
||||
) const
|
||||
{
|
||||
setSolverPerformance(sp.fieldName(), sp);
|
||||
|
||||
@ -39,7 +39,7 @@ SourceFiles
|
||||
#define data_H
|
||||
|
||||
#include "IOdictionary.H"
|
||||
#include "lduMatrix.H"
|
||||
#include "solverPerformance.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -94,13 +94,13 @@ public:
|
||||
void setSolverPerformance
|
||||
(
|
||||
const word& name,
|
||||
const lduMatrix::solverPerformance&
|
||||
const solverPerformance&
|
||||
) const;
|
||||
|
||||
//- Add/set the solverPerformance entry, using its fieldName
|
||||
void setSolverPerformance
|
||||
(
|
||||
const lduMatrix::solverPerformance&
|
||||
const solverPerformance&
|
||||
) const;
|
||||
};
|
||||
|
||||
|
||||
@ -70,7 +70,7 @@ bool Foam::pimpleControl::criteriaSatisfied()
|
||||
const label fieldI = applyToField(variableName);
|
||||
if (fieldI != -1)
|
||||
{
|
||||
const List<lduMatrix::solverPerformance> sp(iter().stream());
|
||||
const List<solverPerformance> sp(iter().stream());
|
||||
const scalar residual = sp.last().initialResidual();
|
||||
|
||||
checked = true;
|
||||
|
||||
@ -59,7 +59,7 @@ bool Foam::simpleControl::criteriaSatisfied()
|
||||
const label fieldI = applyToField(variableName);
|
||||
if (fieldI != -1)
|
||||
{
|
||||
const List<lduMatrix::solverPerformance> sp(iter().stream());
|
||||
const List<solverPerformance> sp(iter().stream());
|
||||
const scalar residual = sp.first().initialResidual();
|
||||
|
||||
checked = true;
|
||||
|
||||
@ -1377,7 +1377,7 @@ void Foam::checkMethod
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::lduMatrix::solverPerformance Foam::solve
|
||||
Foam::solverPerformance Foam::solve
|
||||
(
|
||||
fvMatrix<Type>& fvm,
|
||||
const dictionary& solverControls
|
||||
@ -1387,13 +1387,13 @@ Foam::lduMatrix::solverPerformance Foam::solve
|
||||
}
|
||||
|
||||
template<class Type>
|
||||
Foam::lduMatrix::solverPerformance Foam::solve
|
||||
Foam::solverPerformance Foam::solve
|
||||
(
|
||||
const tmp<fvMatrix<Type> >& tfvm,
|
||||
const dictionary& solverControls
|
||||
)
|
||||
{
|
||||
lduMatrix::solverPerformance solverPerf =
|
||||
solverPerformance solverPerf =
|
||||
const_cast<fvMatrix<Type>&>(tfvm()).solve(solverControls);
|
||||
|
||||
tfvm.clear();
|
||||
@ -1403,15 +1403,15 @@ Foam::lduMatrix::solverPerformance Foam::solve
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::lduMatrix::solverPerformance Foam::solve(fvMatrix<Type>& fvm)
|
||||
Foam::solverPerformance Foam::solve(fvMatrix<Type>& fvm)
|
||||
{
|
||||
return fvm.solve();
|
||||
}
|
||||
|
||||
template<class Type>
|
||||
Foam::lduMatrix::solverPerformance Foam::solve(const tmp<fvMatrix<Type> >& tfvm)
|
||||
Foam::solverPerformance Foam::solve(const tmp<fvMatrix<Type> >& tfvm)
|
||||
{
|
||||
lduMatrix::solverPerformance solverPerf =
|
||||
solverPerformance solverPerf =
|
||||
const_cast<fvMatrix<Type>&>(tfvm()).solve();
|
||||
|
||||
tfvm.clear();
|
||||
|
||||
@ -239,11 +239,11 @@ public:
|
||||
|
||||
//- Solve returning the solution statistics.
|
||||
// Use the given solver controls
|
||||
lduMatrix::solverPerformance solve(const dictionary&);
|
||||
solverPerformance solve(const dictionary&);
|
||||
|
||||
//- Solve returning the solution statistics.
|
||||
// Solver controls read from fvSolution
|
||||
lduMatrix::solverPerformance solve();
|
||||
solverPerformance solve();
|
||||
};
|
||||
|
||||
|
||||
@ -389,19 +389,19 @@ public:
|
||||
|
||||
//- Solve segregated or coupled returning the solution statistics.
|
||||
// Use the given solver controls
|
||||
lduMatrix::solverPerformance solve(const dictionary&);
|
||||
solverPerformance solve(const dictionary&);
|
||||
|
||||
//- Solve segregated returning the solution statistics.
|
||||
// Use the given solver controls
|
||||
lduMatrix::solverPerformance solveSegregated(const dictionary&);
|
||||
solverPerformance solveSegregated(const dictionary&);
|
||||
|
||||
//- Solve coupled returning the solution statistics.
|
||||
// Use the given solver controls
|
||||
lduMatrix::solverPerformance solveCoupled(const dictionary&);
|
||||
solverPerformance solveCoupled(const dictionary&);
|
||||
|
||||
//- Solve returning the solution statistics.
|
||||
// Solver controls read from fvSolution
|
||||
lduMatrix::solverPerformance solve();
|
||||
solverPerformance solve();
|
||||
|
||||
//- Return the matrix residual
|
||||
tmp<Field<Type> > residual() const;
|
||||
@ -550,14 +550,14 @@ void checkMethod
|
||||
//- Solve returning the solution statistics given convergence tolerance
|
||||
// Use the given solver controls
|
||||
template<class Type>
|
||||
lduMatrix::solverPerformance solve(fvMatrix<Type>&, const dictionary&);
|
||||
solverPerformance solve(fvMatrix<Type>&, const dictionary&);
|
||||
|
||||
|
||||
//- Solve returning the solution statistics given convergence tolerance,
|
||||
// deleting temporary matrix after solution.
|
||||
// Use the given solver controls
|
||||
template<class Type>
|
||||
lduMatrix::solverPerformance solve
|
||||
solverPerformance solve
|
||||
(
|
||||
const tmp<fvMatrix<Type> >&,
|
||||
const dictionary&
|
||||
@ -567,14 +567,14 @@ lduMatrix::solverPerformance solve
|
||||
//- Solve returning the solution statistics given convergence tolerance
|
||||
// Solver controls read fvSolution
|
||||
template<class Type>
|
||||
lduMatrix::solverPerformance solve(fvMatrix<Type>&);
|
||||
solverPerformance solve(fvMatrix<Type>&);
|
||||
|
||||
|
||||
//- Solve returning the solution statistics given convergence tolerance,
|
||||
// deleting temporary matrix after solution.
|
||||
// Solver controls read fvSolution
|
||||
template<class Type>
|
||||
lduMatrix::solverPerformance solve(const tmp<fvMatrix<Type> >&);
|
||||
solverPerformance solve(const tmp<fvMatrix<Type> >&);
|
||||
|
||||
|
||||
//- Return the correction form of the given matrix
|
||||
|
||||
@ -53,7 +53,7 @@ void Foam::fvMatrix<Type>::setComponentReference
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::lduMatrix::solverPerformance Foam::fvMatrix<Type>::solve
|
||||
Foam::solverPerformance Foam::fvMatrix<Type>::solve
|
||||
(
|
||||
const dictionary& solverControls
|
||||
)
|
||||
@ -85,13 +85,13 @@ Foam::lduMatrix::solverPerformance Foam::fvMatrix<Type>::solve
|
||||
<< "; currently supported solver types are segregated and coupled"
|
||||
<< exit(FatalIOError);
|
||||
|
||||
return lduMatrix::solverPerformance();
|
||||
return solverPerformance();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::lduMatrix::solverPerformance Foam::fvMatrix<Type>::solveSegregated
|
||||
Foam::solverPerformance Foam::fvMatrix<Type>::solveSegregated
|
||||
(
|
||||
const dictionary& solverControls
|
||||
)
|
||||
@ -107,7 +107,7 @@ Foam::lduMatrix::solverPerformance Foam::fvMatrix<Type>::solveSegregated
|
||||
GeometricField<Type, fvPatchField, volMesh>& psi =
|
||||
const_cast<GeometricField<Type, fvPatchField, volMesh>&>(psi_);
|
||||
|
||||
lduMatrix::solverPerformance solverPerfVec
|
||||
solverPerformance solverPerfVec
|
||||
(
|
||||
"fvMatrix<Type>::solveSegregated",
|
||||
psi.name()
|
||||
@ -176,7 +176,7 @@ Foam::lduMatrix::solverPerformance Foam::fvMatrix<Type>::solveSegregated
|
||||
cmpt
|
||||
);
|
||||
|
||||
lduMatrix::solverPerformance solverPerf;
|
||||
solverPerformance solverPerf;
|
||||
|
||||
// Solver call
|
||||
solverPerf = lduMatrix::solver::New
|
||||
@ -189,7 +189,7 @@ Foam::lduMatrix::solverPerformance Foam::fvMatrix<Type>::solveSegregated
|
||||
solverControls
|
||||
)->solve(psiCmpt, sourceCmpt, cmpt);
|
||||
|
||||
solverPerf.print();
|
||||
solverPerf.print(Info);
|
||||
|
||||
solverPerfVec = max(solverPerfVec, solverPerf);
|
||||
solverPerfVec.solverName() = solverPerf.solverName();
|
||||
@ -207,7 +207,7 @@ Foam::lduMatrix::solverPerformance Foam::fvMatrix<Type>::solveSegregated
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::lduMatrix::solverPerformance Foam::fvMatrix<Type>::solveCoupled
|
||||
Foam::solverPerformance Foam::fvMatrix<Type>::solveCoupled
|
||||
(
|
||||
const dictionary& solverControls
|
||||
)
|
||||
@ -258,7 +258,7 @@ Foam::lduMatrix::solverPerformance Foam::fvMatrix<Type>::solveCoupled
|
||||
|
||||
// psi.mesh().setSolverPerformance(psi.name(), solverPerf);
|
||||
|
||||
return lduMatrix::solverPerformance();
|
||||
return solverPerformance();
|
||||
}
|
||||
|
||||
|
||||
@ -281,7 +281,7 @@ Foam::fvMatrix<Type>::solver()
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::lduMatrix::solverPerformance Foam::fvMatrix<Type>::fvSolver::solve()
|
||||
Foam::solverPerformance Foam::fvMatrix<Type>::fvSolver::solve()
|
||||
{
|
||||
return solve
|
||||
(
|
||||
@ -298,7 +298,7 @@ Foam::lduMatrix::solverPerformance Foam::fvMatrix<Type>::fvSolver::solve()
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::lduMatrix::solverPerformance Foam::fvMatrix<Type>::solve()
|
||||
Foam::solverPerformance Foam::fvMatrix<Type>::solve()
|
||||
{
|
||||
return solve
|
||||
(
|
||||
|
||||
@ -93,7 +93,7 @@ Foam::fvMatrix<Foam::scalar>::solver
|
||||
|
||||
|
||||
template<>
|
||||
Foam::lduMatrix::solverPerformance Foam::fvMatrix<Foam::scalar>::fvSolver::solve
|
||||
Foam::solverPerformance Foam::fvMatrix<Foam::scalar>::fvSolver::solve
|
||||
(
|
||||
const dictionary& solverControls
|
||||
)
|
||||
@ -111,13 +111,13 @@ Foam::lduMatrix::solverPerformance Foam::fvMatrix<Foam::scalar>::fvSolver::solve
|
||||
// assign new solver controls
|
||||
solver_->read(solverControls);
|
||||
|
||||
lduMatrix::solverPerformance solverPerf = solver_->solve
|
||||
solverPerformance solverPerf = solver_->solve
|
||||
(
|
||||
psi.internalField(),
|
||||
totalSource
|
||||
);
|
||||
|
||||
solverPerf.print();
|
||||
solverPerf.print(Info);
|
||||
|
||||
fvMat_.diag() = saveDiag;
|
||||
|
||||
@ -130,7 +130,7 @@ Foam::lduMatrix::solverPerformance Foam::fvMatrix<Foam::scalar>::fvSolver::solve
|
||||
|
||||
|
||||
template<>
|
||||
Foam::lduMatrix::solverPerformance Foam::fvMatrix<Foam::scalar>::solveSegregated
|
||||
Foam::solverPerformance Foam::fvMatrix<Foam::scalar>::solveSegregated
|
||||
(
|
||||
const dictionary& solverControls
|
||||
)
|
||||
@ -153,7 +153,7 @@ Foam::lduMatrix::solverPerformance Foam::fvMatrix<Foam::scalar>::solveSegregated
|
||||
addBoundarySource(totalSource, false);
|
||||
|
||||
// Solver call
|
||||
lduMatrix::solverPerformance solverPerf = lduMatrix::solver::New
|
||||
solverPerformance solverPerf = lduMatrix::solver::New
|
||||
(
|
||||
psi.name(),
|
||||
*this,
|
||||
@ -163,7 +163,7 @@ Foam::lduMatrix::solverPerformance Foam::fvMatrix<Foam::scalar>::solveSegregated
|
||||
solverControls
|
||||
)->solve(psi.internalField(), totalSource);
|
||||
|
||||
solverPerf.print();
|
||||
solverPerf.print(Info);
|
||||
|
||||
diag() = saveDiag;
|
||||
|
||||
|
||||
@ -62,13 +62,13 @@ autoPtr<fvMatrix<scalar>::fvSolver> fvMatrix<scalar>::solver
|
||||
);
|
||||
|
||||
template<>
|
||||
lduMatrix::solverPerformance fvMatrix<scalar>::fvSolver::solve
|
||||
solverPerformance fvMatrix<scalar>::fvSolver::solve
|
||||
(
|
||||
const dictionary&
|
||||
);
|
||||
|
||||
template<>
|
||||
lduMatrix::solverPerformance fvMatrix<scalar>::solveSegregated
|
||||
solverPerformance fvMatrix<scalar>::solveSegregated
|
||||
(
|
||||
const dictionary&
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user