Legacy solver wrappers ICCG and BICCG removed

Instead of ICCG use PCG with the DIC preconditioner
Instead of BICCG use PBiCG with the DILU preconditioner
This commit is contained in:
Henry Weller
2016-06-14 14:53:28 +01:00
parent e96166000e
commit 1bc9ff44e1
9 changed files with 74 additions and 535 deletions

View File

@ -75,7 +75,6 @@ DebugSwitches
Analytical 0;
APIdiffCoefFunc 0;
Ar 0;
BICCG 0;
BirdCarreau 0;
C10H22 0;
C12H26 0;
@ -158,7 +157,6 @@ DebugSwitches
HerschelBulkley 0;
HrenyaSinclair 0;
IC8H18 0;
ICCG 0;
IDDESDelta 0;
IDEA 0;
IFstream 0;

View File

@ -271,8 +271,6 @@ $(lduMatrix)/solvers/diagonalSolver/diagonalSolver.C
$(lduMatrix)/solvers/smoothSolver/smoothSolver.C
$(lduMatrix)/solvers/PCG/PCG.C
$(lduMatrix)/solvers/PBiCG/PBiCG.C
$(lduMatrix)/solvers/ICCG/ICCG.C
$(lduMatrix)/solvers/BICCG/BICCG.C
$(lduMatrix)/smoothers/GaussSeidel/GaussSeidelSmoother.C
$(lduMatrix)/smoothers/symGaussSeidel/symGaussSeidelSmoother.C

View File

@ -1,113 +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/>.
\*---------------------------------------------------------------------------*/
#include "BICCG.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(BICCG, 0);
lduMatrix::solver::addasymMatrixConstructorToTable<BICCG>
addBICCGSymMatrixConstructorToTable_;
}
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
Foam::dictionary Foam::BICCG::solverDict
(
const scalar tol,
const scalar relTol
)
{
dictionary dict(IStringStream("solver PBiCG; preconditioner DILU;")());
dict.add("tolerance", tol);
dict.add("relTol", relTol);
return dict;
}
Foam::dictionary Foam::BICCG::solverDict
(
Istream& is
)
{
scalar tol(readScalar(is));
scalar relTol(readScalar(is));
return solverDict(tol, relTol);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::BICCG::BICCG
(
const word& fieldName,
const lduMatrix& matrix,
const FieldField<Field, scalar>& interfaceBouCoeffs,
const FieldField<Field, scalar>& interfaceIntCoeffs,
const lduInterfaceFieldPtrsList& interfaces,
const dictionary& solverControls
)
:
PBiCG
(
fieldName,
matrix,
interfaceBouCoeffs,
interfaceIntCoeffs,
interfaces,
solverControls
)
{}
Foam::BICCG::BICCG
(
const word& fieldName,
const lduMatrix& matrix,
const FieldField<Field, scalar>& interfaceBouCoeffs,
const FieldField<Field, scalar>& interfaceIntCoeffs,
const lduInterfaceFieldPtrsList& interfaces,
const scalar tolerance,
const scalar relTol
)
:
PBiCG
(
fieldName,
matrix,
interfaceBouCoeffs,
interfaceIntCoeffs,
interfaces,
solverDict(tolerance, relTol)
)
{}
// ************************************************************************* //

View File

@ -1,127 +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/>.
Class
Foam::BICCG
Description
Diagonal incomplete LU preconditioned BiCG solver derived from the general
preconditioned BiCG solver PBiCG but with the choice of preconditioner
pre-selected.
Deprecated
This solver is present for backward-compatibility and the PBiCG solver
should be used instead. (deprecated Apr 2008)
SourceFiles
BICCG.C
\*---------------------------------------------------------------------------*/
#ifndef BICCG_H
#define BICCG_H
#include "PBiCG.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class BICCG Declaration
\*---------------------------------------------------------------------------*/
class BICCG
:
public PBiCG
{
// Private Member Functions
//- Disallow default bitwise copy construct
BICCG(const BICCG&);
//- Disallow default bitwise assignment
void operator=(const BICCG&);
public:
//- Return the dictionary constructed from the components.
// Needed for backward compatibility
static dictionary solverDict
(
const scalar tol,
const scalar relTol
);
//- Return the dictionary constructed from the old-style data-stream.
// Needed for backward compatibility
static dictionary solverDict(Istream&);
//- Runtime type information
TypeName("BICCG");
// Constructors
//- Construct from matrix components and solver data stream
BICCG
(
const word& fieldName,
const lduMatrix& matrix,
const FieldField<Field, scalar>& interfaceBouCoeffs,
const FieldField<Field, scalar>& interfaceIntCoeffs,
const lduInterfaceFieldPtrsList& interfaces,
const dictionary& solverControls
);
//- Construct from matrix components and tolerances
BICCG
(
const word& fieldName,
const lduMatrix& matrix,
const FieldField<Field, scalar>& interfaceBouCoeffs,
const FieldField<Field, scalar>& interfaceIntCoeffs,
const lduInterfaceFieldPtrsList& interfaces,
const scalar tolerance,
const scalar relTol = 0.0
);
//- Destructor
virtual ~BICCG()
{}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -39,7 +39,7 @@ Description
- Coarse matrix scaling: performed by correction scaling, using steepest
descent optimisation.
- Type of cycle: V-cycle with optional pre-smoothing.
- Coarsest-level matrix solved using ICCG or BICCG.
- Coarsest-level matrix solved using PCG or PBiCG.
SourceFiles
GAMGSolver.C
@ -234,7 +234,7 @@ class GAMGSolver
) const;
//- Interpolate the correction after injected prolongation and
/// re-normalise
// re-normalise
void interpolate
(
scalarField& psi,
@ -292,6 +292,21 @@ class GAMGSolver
const direction cmpt=0
) const;
//- Create and return the dictionary to specify the PCG solver
// to solve the coarsest level
dictionary PCGsolverDict
(
const scalar tol,
const scalar relTol
) const;
//- Create and return the dictionary to specify the PBiCG solver
// to solve the coarsest level
dictionary PBiCGsolverDict
(
const scalar tol,
const scalar relTol
) const;
//- Solve the coarsest level with either an iterative or direct solver
void solveCoarsestLevel

View File

@ -24,8 +24,8 @@ License
\*---------------------------------------------------------------------------*/
#include "GAMGSolver.H"
#include "ICCG.H"
#include "BICCG.H"
#include "PCG.H"
#include "PBiCG.H"
#include "SubField.H"
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
@ -519,6 +519,34 @@ void Foam::GAMGSolver::initVcycle
}
Foam::dictionary Foam::GAMGSolver::PCGsolverDict
(
const scalar tol,
const scalar relTol
) const
{
dictionary dict(IStringStream("solver PCG; preconditioner DIC;")());
dict.add("tolerance", tol);
dict.add("relTol", relTol);
return dict;
}
Foam::dictionary Foam::GAMGSolver::PBiCGsolverDict
(
const scalar tol,
const scalar relTol
) const
{
dictionary dict(IStringStream("solver PBiCG; preconditioner DILU;")());
dict.add("tolerance", tol);
dict.add("relTol", relTol);
return dict;
}
void Foam::GAMGSolver::solveCoarsestLevel
(
scalarField& coarsestCorrField,
@ -584,15 +612,14 @@ void Foam::GAMGSolver::solveCoarsestLevel
//
// if (allMatrix.asymmetric())
// {
// coarseSolverPerf = BICCG
// coarseSolverPerf = PBiCG
// (
// "coarsestLevelCorr",
// allMatrix,
// procInterfaceLevelsBouCoeffs_[coarsestLevel],
// procInterfaceLevelsIntCoeffs_[coarsestLevel],
// procInterfaceLevels_[coarsestLevel],
// tolerance_,
// relTol_
// PBiCGsolverDict(tolerance_, relTol_)
// ).solve
// (
// coarsestCorrField,
@ -601,15 +628,14 @@ void Foam::GAMGSolver::solveCoarsestLevel
// }
// else
// {
// coarseSolverPerf = ICCG
// coarseSolverPerf = PCG
// (
// "coarsestLevelCorr",
// allMatrix,
// procInterfaceLevelsBouCoeffs_[coarsestLevel],
// procInterfaceLevelsIntCoeffs_[coarsestLevel],
// procInterfaceLevels_[coarsestLevel],
// tolerance_,
// relTol_
// PCGsolverDict(tolerance_, relTol_)
// ).solve
// (
// coarsestCorrField,
@ -647,15 +673,14 @@ void Foam::GAMGSolver::solveCoarsestLevel
if (matrixLevels_[coarsestLevel].asymmetric())
{
coarseSolverPerf = BICCG
coarseSolverPerf = PBiCG
(
"coarsestLevelCorr",
matrixLevels_[coarsestLevel],
interfaceLevelsBouCoeffs_[coarsestLevel],
interfaceLevelsIntCoeffs_[coarsestLevel],
interfaceLevels_[coarsestLevel],
tolerance_,
relTol_
PBiCGsolverDict(tolerance_, relTol_)
).solve
(
coarsestCorrField,
@ -664,15 +689,14 @@ void Foam::GAMGSolver::solveCoarsestLevel
}
else
{
coarseSolverPerf = ICCG
coarseSolverPerf = PCG
(
"coarsestLevelCorr",
matrixLevels_[coarsestLevel],
interfaceLevelsBouCoeffs_[coarsestLevel],
interfaceLevelsIntCoeffs_[coarsestLevel],
interfaceLevels_[coarsestLevel],
tolerance_,
relTol_
PCGsolverDict(tolerance_, relTol_)
).solve
(
coarsestCorrField,

View File

@ -1,111 +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/>.
\*---------------------------------------------------------------------------*/
#include "ICCG.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(ICCG, 0);
lduMatrix::solver::addsymMatrixConstructorToTable<ICCG>
addICCGSymMatrixConstructorToTable_;
}
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
Foam::dictionary Foam::ICCG::solverDict
(
const scalar tol,
const scalar relTol
)
{
dictionary dict(IStringStream("solver PCG; preconditioner DIC;")());
dict.add("tolerance", tol);
dict.add("relTol", relTol);
return dict;
}
Foam::dictionary Foam::ICCG::solverDict
(
Istream& is
)
{
scalar tol(readScalar(is));
scalar relTol(readScalar(is));
return solverDict(tol, relTol);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::ICCG::ICCG
(
const word& fieldName,
const lduMatrix& matrix,
const FieldField<Field, scalar>& interfaceBouCoeffs,
const FieldField<Field, scalar>& interfaceIntCoeffs,
const lduInterfaceFieldPtrsList& interfaces,
const dictionary& solverControls
)
:
PCG
(
fieldName,
matrix,
interfaceBouCoeffs,
interfaceIntCoeffs,
interfaces,
solverControls
)
{}
Foam::ICCG::ICCG
(
const word& fieldName,
const lduMatrix& matrix,
const FieldField<Field, scalar>& interfaceBouCoeffs,
const FieldField<Field, scalar>& interfaceIntCoeffs,
const lduInterfaceFieldPtrsList& interfaces,
const scalar tolerance,
const scalar relTol
)
:
PCG
(
fieldName,
matrix,
interfaceBouCoeffs,
interfaceIntCoeffs,
interfaces,
solverDict(tolerance, relTol)
)
{}
// ************************************************************************* //

View File

@ -1,126 +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/>.
Class
Foam::ICCG
Description
Incomplete Cholesky preconditioned CG solver derived from the general
preconditioned CG solver PCG but with the choice of preconditioner
pre-selected.
Deprecated
This solver is present for backward-compatibility and the PCG solver
should be used for preference. (deprecated Apr 2008)
SourceFiles
ICCG.C
\*---------------------------------------------------------------------------*/
#ifndef ICCG_H
#define ICCG_H
#include "PCG.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class ICCG Declaration
\*---------------------------------------------------------------------------*/
class ICCG
:
public PCG
{
// Private Member Functions
//- Disallow default bitwise copy construct
ICCG(const ICCG&);
//- Disallow default bitwise assignment
void operator=(const ICCG&);
public:
//- Return the dictionary constructed from the components.
// Needed for backward compatibility
static dictionary solverDict
(
const scalar tol,
const scalar relTol
);
//- Return the dictionary constructed from the old-style data-stream.
// Needed for backward compatibility
static dictionary solverDict(Istream&);
//- Runtime type information
TypeName("ICCG");
// Constructors
//- Construct from matrix components and solver data stream
ICCG
(
const word& fieldName,
const lduMatrix& matrix,
const FieldField<Field, scalar>& interfaceBouCoeffs,
const FieldField<Field, scalar>& interfaceIntCoeffs,
const lduInterfaceFieldPtrsList& interfaces,
const dictionary& solverControls
);
//- Construct from matrix components and tolerances
ICCG
(
const word& fieldName,
const lduMatrix& matrix,
const FieldField<Field, scalar>& interfaceBouCoeffs,
const FieldField<Field, scalar>& interfaceIntCoeffs,
const lduInterfaceFieldPtrsList& interfaces,
const scalar tolerance,
const scalar relTol = 0.0
);
//- Destructor
virtual ~ICCG()
{}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -26,11 +26,6 @@ License
#include "solution.H"
#include "Time.H"
// These are for old syntax compatibility:
#include "BICCG.H"
#include "ICCG.H"
#include "IStringStream.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
@ -185,48 +180,34 @@ Foam::label Foam::solution::upgradeSolverDict
word name(is);
dictionary subdict;
if (name == "BICCG")
{
// special treatment for very old syntax
subdict = BICCG::solverDict(is);
}
else if (name == "ICCG")
{
// special treatment for very old syntax
subdict = ICCG::solverDict(is);
}
else
{
subdict.add("solver", name);
subdict <<= dictionary(is);
subdict.add("solver", name);
subdict <<= dictionary(is);
// preconditioner and smoother entries can be
// 1) primitiveEntry w/o settings,
// 2) or a dictionaryEntry.
// transform primitiveEntry with settings -> dictionaryEntry
forAll(subDictNames, dictI)
// preconditioner and smoother entries can be
// 1) primitiveEntry w/o settings,
// 2) or a dictionaryEntry.
// transform primitiveEntry with settings -> dictionaryEntry
forAll(subDictNames, dictI)
{
const word& dictName = subDictNames[dictI];
entry* ePtr = subdict.lookupEntryPtr(dictName,false,false);
if (ePtr && !ePtr->isDict())
{
const word& dictName = subDictNames[dictI];
entry* ePtr = subdict.lookupEntryPtr(dictName,false,false);
Istream& is = ePtr->stream();
is >> name;
if (ePtr && !ePtr->isDict())
if (!is.eof())
{
Istream& is = ePtr->stream();
is >> name;
dictionary newDict;
newDict.add(dictName, name);
newDict <<= dictionary(is);
if (!is.eof())
{
dictionary newDict;
newDict.add(dictName, name);
newDict <<= dictionary(is);
subdict.set(dictName, newDict);
}
subdict.set(dictName, newDict);
}
}
}
// write out information to help people adjust to the new syntax
if (verbose && Pstream::master())
{